Files
rogee 7e41bcaaee
Build and push backend image / backend-image (push) Successful in 52s
chore: remove legacy booking flows and use local admin auth
2026-09-23 21:26:58 +08:00

134 lines
2.8 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
// source: users.sql
package db
import (
"context"
"database/sql"
)
const bindUserPhone = `-- name: BindUserPhone :one
UPDATE users
SET phone = ?, updated_at = CURRENT_TIMESTAMP
WHERE id = ?
RETURNING id, openid, unionid, phone, created_at, updated_at, last_login_at
`
type BindUserPhoneParams struct {
Phone sql.NullString `json:"phone"`
ID string `json:"id"`
}
func (q *Queries) BindUserPhone(ctx context.Context, arg BindUserPhoneParams) (User, error) {
row := q.db.QueryRowContext(ctx, bindUserPhone, arg.Phone, arg.ID)
var i User
err := row.Scan(
&i.ID,
&i.Openid,
&i.Unionid,
&i.Phone,
&i.CreatedAt,
&i.UpdatedAt,
&i.LastLoginAt,
)
return i, err
}
const createUser = `-- name: CreateUser :one
INSERT INTO users (id, openid, unionid, phone)
VALUES (?, ?, ?, ?)
RETURNING id, openid, unionid, phone, created_at, updated_at, last_login_at
`
type CreateUserParams struct {
ID string `json:"id"`
Openid string `json:"openid"`
Unionid sql.NullString `json:"unionid"`
Phone sql.NullString `json:"phone"`
}
func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error) {
row := q.db.QueryRowContext(ctx, createUser,
arg.ID,
arg.Openid,
arg.Unionid,
arg.Phone,
)
var i User
err := row.Scan(
&i.ID,
&i.Openid,
&i.Unionid,
&i.Phone,
&i.CreatedAt,
&i.UpdatedAt,
&i.LastLoginAt,
)
return i, err
}
const getUserByID = `-- name: GetUserByID :one
SELECT id, openid, unionid, phone, created_at, updated_at, last_login_at FROM users
WHERE id = ?
`
func (q *Queries) GetUserByID(ctx context.Context, id string) (User, error) {
row := q.db.QueryRowContext(ctx, getUserByID, id)
var i User
err := row.Scan(
&i.ID,
&i.Openid,
&i.Unionid,
&i.Phone,
&i.CreatedAt,
&i.UpdatedAt,
&i.LastLoginAt,
)
return i, err
}
const getUserByOpenID = `-- name: GetUserByOpenID :one
SELECT id, openid, unionid, phone, created_at, updated_at, last_login_at FROM users
WHERE openid = ?
`
func (q *Queries) GetUserByOpenID(ctx context.Context, openid string) (User, error) {
row := q.db.QueryRowContext(ctx, getUserByOpenID, openid)
var i User
err := row.Scan(
&i.ID,
&i.Openid,
&i.Unionid,
&i.Phone,
&i.CreatedAt,
&i.UpdatedAt,
&i.LastLoginAt,
)
return i, err
}
const touchUserLogin = `-- name: TouchUserLogin :one
UPDATE users
SET last_login_at = CURRENT_TIMESTAMP
WHERE openid = ?
RETURNING id, openid, unionid, phone, created_at, updated_at, last_login_at
`
func (q *Queries) TouchUserLogin(ctx context.Context, openid string) (User, error) {
row := q.db.QueryRowContext(ctx, touchUserLogin, openid)
var i User
err := row.Scan(
&i.ID,
&i.Openid,
&i.Unionid,
&i.Phone,
&i.CreatedAt,
&i.UpdatedAt,
&i.LastLoginAt,
)
return i, err
}