Skip to content

Commit

Permalink
fix db.Get(ctx) usage in test module
Browse files Browse the repository at this point in the history
  • Loading branch information
matt2e committed Apr 23, 2024
1 parent 457f06f commit 74448c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions integration/testdata/go/database/echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ type InsertResponse struct{}

//ftl:export
func Insert(ctx context.Context, req InsertRequest) (InsertResponse, error) {
err := persistRequest(req)
err := persistRequest(ctx, req)
if err != nil {
return InsertResponse{}, err
}

return InsertResponse{}, nil
}

func persistRequest(req InsertRequest) error {
_, err := db.Exec(`CREATE TABLE IF NOT EXISTS requests
func persistRequest(ctx context.Context, req InsertRequest) error {
_, err := db.Get(ctx).Exec(`CREATE TABLE IF NOT EXISTS requests
(
data TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT (NOW() AT TIME ZONE 'utc'),
Expand All @@ -34,7 +34,7 @@ func persistRequest(req InsertRequest) error {
if err != nil {
return err
}
_, err = db.Exec("INSERT INTO requests (data) VALUES ($1);", req.Data)
_, err = db.Get(ctx).Exec("INSERT INTO requests (data) VALUES ($1);", req.Data)
if err != nil {
return err
}
Expand Down

0 comments on commit 74448c5

Please sign in to comment.