Refs #1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
77 lines
1.6 KiB
Go
77 lines
1.6 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.31.1
|
|
// source: users.sql
|
|
|
|
package store
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
const createUser = `-- name: CreateUser :one
|
|
INSERT INTO users (email, display_name, password_hash) VALUES ($1, $2, $3)
|
|
RETURNING id, email, display_name, password_hash, disabled_at, created_at, updated_at
|
|
`
|
|
|
|
type CreateUserParams struct {
|
|
Email string
|
|
DisplayName string
|
|
PasswordHash *string
|
|
}
|
|
|
|
func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error) {
|
|
row := q.db.QueryRow(ctx, createUser, arg.Email, arg.DisplayName, arg.PasswordHash)
|
|
var i User
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.Email,
|
|
&i.DisplayName,
|
|
&i.PasswordHash,
|
|
&i.DisabledAt,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const getUser = `-- name: GetUser :one
|
|
SELECT id, email, display_name, password_hash, disabled_at, created_at, updated_at FROM users WHERE id = $1
|
|
`
|
|
|
|
func (q *Queries) GetUser(ctx context.Context, id uuid.UUID) (User, error) {
|
|
row := q.db.QueryRow(ctx, getUser, id)
|
|
var i User
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.Email,
|
|
&i.DisplayName,
|
|
&i.PasswordHash,
|
|
&i.DisabledAt,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const getUserByEmail = `-- name: GetUserByEmail :one
|
|
SELECT id, email, display_name, password_hash, disabled_at, created_at, updated_at FROM users WHERE email = $1
|
|
`
|
|
|
|
func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error) {
|
|
row := q.db.QueryRow(ctx, getUserByEmail, email)
|
|
var i User
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.Email,
|
|
&i.DisplayName,
|
|
&i.PasswordHash,
|
|
&i.DisabledAt,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
)
|
|
return i, err
|
|
}
|