Files
Memoh/internal/db/sqlc/bind.sql.go
T
BBQ ca5c6a1866 refactor(core): restructure conversation, channel and message domains
- Rename chat module to conversation with flow-based architecture
- Move channelidentities into channel/identities subpackage
- Add channel/route for routing logic
- Add message service with event hub
- Add MCP providers: container, directory, schedule
- Refactor Feishu/Telegram adapters with directory and stream support
- Add platform management page and channel badges in web UI
- Update database schema for conversations, messages and channel routes
- Add @memoh/shared package for cross-package type definitions
2026-02-12 15:34:40 +08:00

121 lines
3.1 KiB
Go

// 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
}