feat(store): generate typed queries with sqlc
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
018b24948e
commit
0af74267b9
6 files changed
+143
No files matched your search
@@ -0,0 +1,50 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
// source: orgs.sql
|
||||
|
||||
package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
const createOrg = `-- name: CreateOrg :one
|
||||
INSERT INTO orgs (slug, name) VALUES ($1, $2)
|
||||
RETURNING id, slug, name, created_at, updated_at
|
||||
`
|
||||
|
||||
type CreateOrgParams struct {
|
||||
Slug string
|
||||
Name string
|
||||
}
|
||||
|
||||
func (q *Queries) CreateOrg(ctx context.Context, arg CreateOrgParams) (Org, error) {
|
||||
row := q.db.QueryRow(ctx, createOrg, arg.Slug, arg.Name)
|
||||
var i Org
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Slug,
|
||||
&i.Name,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const getOrgBySlug = `-- name: GetOrgBySlug :one
|
||||
SELECT id, slug, name, created_at, updated_at FROM orgs WHERE slug = $1
|
||||
`
|
||||
|
||||
func (q *Queries) GetOrgBySlug(ctx context.Context, slug string) (Org, error) {
|
||||
row := q.db.QueryRow(ctx, getOrgBySlug, slug)
|
||||
var i Org
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.Slug,
|
||||
&i.Name,
|
||||
&i.CreatedAt,
|
||||
&i.UpdatedAt,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
Reference in new issue
Block a user