Compare commits
2 Commits
b506a575fa
...
4c82ca0e2b
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c82ca0e2b | |||
| 59f4546a81 |
6
internal/api/api.cfg.yaml
Normal file
6
internal/api/api.cfg.yaml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
package: api
|
||||||
|
generate:
|
||||||
|
echo-server: true
|
||||||
|
models: true
|
||||||
|
embedded-spec: true
|
||||||
|
output: server.gen.go
|
||||||
@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate oapi-codegen --config=api.cfg.yaml ../../docs/openapi.yaml
|
//go:generate go run github.com/deepmap/oapi-codegen/v2/cmd/oapi-codegen@v2.1.0 --config=api.cfg.yaml ../../docs/openapi.yaml
|
||||||
|
|
||||||
type ServerImpl struct {
|
type ServerImpl struct {
|
||||||
Dal dal.DAL
|
Dal dal.DAL
|
||||||
|
|||||||
@ -10,4 +10,4 @@ type DAL interface {
|
|||||||
Banks() (entity.Banks, error)
|
Banks() (entity.Banks, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:generate mockgen -destination=../mock/mock_dal.gen.go -package=mock . DAL
|
//go:generate go run go.uber.org/mock/mockgen@latest -destination=../mock/mock_dal.gen.go -package=mock . DAL
|
||||||
|
|||||||
@ -54,7 +54,7 @@ func (dal *DalImpl) InsertTransaction(t entity.Transaction) (entity.Transaction,
|
|||||||
}
|
}
|
||||||
|
|
||||||
stmt := `
|
stmt := `
|
||||||
INSERT INTO pfbudget.transactions (date, description, value)
|
INSERT INTO pfbudget.transactions (date, description, amount)
|
||||||
VALUES ($1, $2, $3)
|
VALUES ($1, $2, $3)
|
||||||
RETURNING id
|
RETURNING id
|
||||||
`
|
`
|
||||||
|
|||||||
@ -297,7 +297,7 @@ func TestDalImpl_InsertTransaction(t *testing.T) {
|
|||||||
|
|
||||||
mock.
|
mock.
|
||||||
ExpectQuery(`
|
ExpectQuery(`
|
||||||
INSERT INTO .* \(date, description, value\)
|
INSERT INTO .* \(date, description, amount\)
|
||||||
VALUES \(\$1, \$2, \$3\)
|
VALUES \(\$1, \$2, \$3\)
|
||||||
RETURNING id`).
|
RETURNING id`).
|
||||||
WithArgs(tt.args.t.Date, tt.args.t.Description, tt.args.t.Value).
|
WithArgs(tt.args.t.Date, tt.args.t.Description, tt.args.t.Value).
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user