diff options
| author | adamdottv <[email protected]> | 2025-05-13 10:27:09 -0500 |
|---|---|---|
| committer | adamdottv <[email protected]> | 2025-05-13 10:27:09 -0500 |
| commit | ae86ef519c5dc557914c29bd1786b1c87d8dcb95 (patch) | |
| tree | e1b5f7bbeb74739c74055d205ad62181230f0b12 /internal/db/logs.sql.go | |
| parent | 2391e338b4e41726e7233e2bf027a62476140130 (diff) | |
| download | opencode-ae86ef519c5dc557914c29bd1786b1c87d8dcb95.tar.gz opencode-ae86ef519c5dc557914c29bd1786b1c87d8dcb95.zip | |
chore: refactoring
Diffstat (limited to 'internal/db/logs.sql.go')
| -rw-r--r-- | internal/db/logs.sql.go | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/internal/db/logs.sql.go b/internal/db/logs.sql.go index d227b472a..aa89d7d22 100644 --- a/internal/db/logs.sql.go +++ b/internal/db/logs.sql.go @@ -10,7 +10,7 @@ import ( "database/sql" ) -const createLog = `-- name: CreateLog :exec +const createLog = `-- name: CreateLog :one INSERT INTO logs ( id, session_id, @@ -27,7 +27,7 @@ INSERT INTO logs ( ?, ?, ? -) +) RETURNING id, session_id, timestamp, level, message, attributes, created_at ` type CreateLogParams struct { @@ -40,8 +40,8 @@ type CreateLogParams struct { CreatedAt int64 `json:"created_at"` } -func (q *Queries) CreateLog(ctx context.Context, arg CreateLogParams) error { - _, err := q.exec(ctx, q.createLogStmt, createLog, +func (q *Queries) CreateLog(ctx context.Context, arg CreateLogParams) (Log, error) { + row := q.queryRow(ctx, q.createLogStmt, createLog, arg.ID, arg.SessionID, arg.Timestamp, @@ -50,7 +50,17 @@ func (q *Queries) CreateLog(ctx context.Context, arg CreateLogParams) error { arg.Attributes, arg.CreatedAt, ) - return err + var i Log + err := row.Scan( + &i.ID, + &i.SessionID, + &i.Timestamp, + &i.Level, + &i.Message, + &i.Attributes, + &i.CreatedAt, + ) + return i, err } const listAllLogs = `-- name: ListAllLogs :many |
