summaryrefslogtreecommitdiffhomepage
path: root/internal/db/logs.sql.go
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-05-13 10:27:09 -0500
committeradamdottv <[email protected]>2025-05-13 10:27:09 -0500
commitae86ef519c5dc557914c29bd1786b1c87d8dcb95 (patch)
treee1b5f7bbeb74739c74055d205ad62181230f0b12 /internal/db/logs.sql.go
parent2391e338b4e41726e7233e2bf027a62476140130 (diff)
downloadopencode-ae86ef519c5dc557914c29bd1786b1c87d8dcb95.tar.gz
opencode-ae86ef519c5dc557914c29bd1786b1c87d8dcb95.zip
chore: refactoring
Diffstat (limited to 'internal/db/logs.sql.go')
-rw-r--r--internal/db/logs.sql.go20
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