// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.30.0 // source: bind.sql package sqlc import ( "context" "github.com/jackc/pgx/v5/pgtype" ) const createBindCode = `-- name: CreateBindCode :one INSERT INTO channel_identity_bind_codes (token, issued_by_user_id, channel_type, expires_at) VALUES ($1, $2, $3, $4) RETURNING id, token, issued_by_user_id, channel_type, expires_at, used_at, used_by_channel_identity_id, created_at ` type CreateBindCodeParams struct { Token string `json:"token"` IssuedByUserID pgtype.UUID `json:"issued_by_user_id"` ChannelType pgtype.Text `json:"channel_type"` ExpiresAt pgtype.Timestamptz `json:"expires_at"` } func (q *Queries) CreateBindCode(ctx context.Context, arg CreateBindCodeParams) (ChannelIdentityBindCode, error) { row := q.db.QueryRow(ctx, createBindCode, arg.Token, arg.IssuedByUserID, arg.ChannelType, arg.ExpiresAt, ) var i ChannelIdentityBindCode err := row.Scan( &i.ID, &i.Token, &i.IssuedByUserID, &i.ChannelType, &i.ExpiresAt, &i.UsedAt, &i.UsedByChannelIdentityID, &i.CreatedAt, ) return i, err } const getBindCode = `-- name: GetBindCode :one SELECT id, token, issued_by_user_id, channel_type, expires_at, used_at, used_by_channel_identity_id, created_at FROM channel_identity_bind_codes WHERE token = $1 ` func (q *Queries) GetBindCode(ctx context.Context, token string) (ChannelIdentityBindCode, error) { row := q.db.QueryRow(ctx, getBindCode, token) var i ChannelIdentityBindCode err := row.Scan( &i.ID, &i.Token, &i.IssuedByUserID, &i.ChannelType, &i.ExpiresAt, &i.UsedAt, &i.UsedByChannelIdentityID, &i.CreatedAt, ) return i, err } const getBindCodeForUpdate = `-- name: GetBindCodeForUpdate :one SELECT id, token, issued_by_user_id, channel_type, expires_at, used_at, used_by_channel_identity_id, created_at FROM channel_identity_bind_codes WHERE token = $1 FOR UPDATE ` func (q *Queries) GetBindCodeForUpdate(ctx context.Context, token string) (ChannelIdentityBindCode, error) { row := q.db.QueryRow(ctx, getBindCodeForUpdate, token) var i ChannelIdentityBindCode err := row.Scan( &i.ID, &i.Token, &i.IssuedByUserID, &i.ChannelType, &i.ExpiresAt, &i.UsedAt, &i.UsedByChannelIdentityID, &i.CreatedAt, ) return i, err } const markBindCodeUsed = `-- name: MarkBindCodeUsed :one UPDATE channel_identity_bind_codes SET used_at = now(), used_by_channel_identity_id = $2 WHERE id = $1 AND used_at IS NULL RETURNING id, token, issued_by_user_id, channel_type, expires_at, used_at, used_by_channel_identity_id, created_at ` type MarkBindCodeUsedParams struct { ID pgtype.UUID `json:"id"` UsedByChannelIdentityID pgtype.UUID `json:"used_by_channel_identity_id"` } func (q *Queries) MarkBindCodeUsed(ctx context.Context, arg MarkBindCodeUsedParams) (ChannelIdentityBindCode, error) { row := q.db.QueryRow(ctx, markBindCodeUsed, arg.ID, arg.UsedByChannelIdentityID) var i ChannelIdentityBindCode err := row.Scan( &i.ID, &i.Token, &i.IssuedByUserID, &i.ChannelType, &i.ExpiresAt, &i.UsedAt, &i.UsedByChannelIdentityID, &i.CreatedAt, ) return i, err }