Adds the database abstraction layer (DAL) with a Transactions method and a Connection object to encapsulate the DB open connection. Includes a DAL unit test using the go-sqlmock library. Connection to a PostgreSQL database using environment variables to store the secrets. Overall, with the /transactions endpoint requesting directly to the DB, this patch finish the tracer bullet project. Issues #1, #5, #6 and #7
16 lines
211 B
Go
16 lines
211 B
Go
package entities
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
type Transaction struct {
|
|
Id int64
|
|
Date time.Time
|
|
Description string
|
|
Value decimal.Decimal
|
|
Category string
|
|
}
|