Files
dns-autoresolver/internal/store/db/users.sql.go
T

67 lines
1.4 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
// source: users.sql
package db
import (
"context"
"github.com/google/uuid"
)
const createUser = `-- name: CreateUser :one
INSERT INTO users (id, email, password_hash) VALUES ($1, $2, $3) RETURNING id, email, created_at, password_hash
`
type CreateUserParams struct {
ID uuid.UUID `json:"id"`
Email string `json:"email"`
PasswordHash *string `json:"password_hash"`
}
func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error) {
row := q.db.QueryRow(ctx, createUser, arg.ID, arg.Email, arg.PasswordHash)
var i User
err := row.Scan(
&i.ID,
&i.Email,
&i.CreatedAt,
&i.PasswordHash,
)
return i, err
}
const getUserByEmail = `-- name: GetUserByEmail :one
SELECT id, email, created_at, password_hash 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.CreatedAt,
&i.PasswordHash,
)
return i, err
}
const getUserByID = `-- name: GetUserByID :one
SELECT id, email, created_at, password_hash FROM users WHERE id = $1
`
func (q *Queries) GetUserByID(ctx context.Context, id uuid.UUID) (User, error) {
row := q.db.QueryRow(ctx, getUserByID, id)
var i User
err := row.Scan(
&i.ID,
&i.Email,
&i.CreatedAt,
&i.PasswordHash,
)
return i, err
}