// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.30.0 // source: mcp.sql package sqlc import ( "context" "github.com/jackc/pgx/v5/pgtype" ) const createMCPConnection = `-- name: CreateMCPConnection :one INSERT INTO mcp_connections (bot_id, name, type, config, is_active) VALUES ($1, $2, $3, $4, $5) RETURNING id, bot_id, name, type, config, is_active, created_at, updated_at ` type CreateMCPConnectionParams struct { BotID pgtype.UUID `json:"bot_id"` Name string `json:"name"` Type string `json:"type"` Config []byte `json:"config"` IsActive bool `json:"is_active"` } func (q *Queries) CreateMCPConnection(ctx context.Context, arg CreateMCPConnectionParams) (McpConnection, error) { row := q.db.QueryRow(ctx, createMCPConnection, arg.BotID, arg.Name, arg.Type, arg.Config, arg.IsActive, ) var i McpConnection err := row.Scan( &i.ID, &i.BotID, &i.Name, &i.Type, &i.Config, &i.IsActive, &i.CreatedAt, &i.UpdatedAt, ) return i, err } const deleteMCPConnection = `-- name: DeleteMCPConnection :exec DELETE FROM mcp_connections WHERE bot_id = $1 AND id = $2 ` type DeleteMCPConnectionParams struct { BotID pgtype.UUID `json:"bot_id"` ID pgtype.UUID `json:"id"` } func (q *Queries) DeleteMCPConnection(ctx context.Context, arg DeleteMCPConnectionParams) error { _, err := q.db.Exec(ctx, deleteMCPConnection, arg.BotID, arg.ID) return err } const getMCPConnectionByID = `-- name: GetMCPConnectionByID :one SELECT id, bot_id, name, type, config, is_active, created_at, updated_at FROM mcp_connections WHERE bot_id = $1 AND id = $2 LIMIT 1 ` type GetMCPConnectionByIDParams struct { BotID pgtype.UUID `json:"bot_id"` ID pgtype.UUID `json:"id"` } func (q *Queries) GetMCPConnectionByID(ctx context.Context, arg GetMCPConnectionByIDParams) (McpConnection, error) { row := q.db.QueryRow(ctx, getMCPConnectionByID, arg.BotID, arg.ID) var i McpConnection err := row.Scan( &i.ID, &i.BotID, &i.Name, &i.Type, &i.Config, &i.IsActive, &i.CreatedAt, &i.UpdatedAt, ) return i, err } const listMCPConnectionsByBotID = `-- name: ListMCPConnectionsByBotID :many SELECT id, bot_id, name, type, config, is_active, created_at, updated_at FROM mcp_connections WHERE bot_id = $1 ORDER BY created_at DESC ` func (q *Queries) ListMCPConnectionsByBotID(ctx context.Context, botID pgtype.UUID) ([]McpConnection, error) { rows, err := q.db.Query(ctx, listMCPConnectionsByBotID, botID) if err != nil { return nil, err } defer rows.Close() var items []McpConnection for rows.Next() { var i McpConnection if err := rows.Scan( &i.ID, &i.BotID, &i.Name, &i.Type, &i.Config, &i.IsActive, &i.CreatedAt, &i.UpdatedAt, ); err != nil { return nil, err } items = append(items, i) } if err := rows.Err(); err != nil { return nil, err } return items, nil } const updateMCPConnection = `-- name: UpdateMCPConnection :one UPDATE mcp_connections SET name = $3, type = $4, config = $5, is_active = $6, updated_at = now() WHERE bot_id = $1 AND id = $2 RETURNING id, bot_id, name, type, config, is_active, created_at, updated_at ` type UpdateMCPConnectionParams struct { BotID pgtype.UUID `json:"bot_id"` ID pgtype.UUID `json:"id"` Name string `json:"name"` Type string `json:"type"` Config []byte `json:"config"` IsActive bool `json:"is_active"` } func (q *Queries) UpdateMCPConnection(ctx context.Context, arg UpdateMCPConnectionParams) (McpConnection, error) { row := q.db.QueryRow(ctx, updateMCPConnection, arg.BotID, arg.ID, arg.Name, arg.Type, arg.Config, arg.IsActive, ) var i McpConnection err := row.Scan( &i.ID, &i.BotID, &i.Name, &i.Type, &i.Config, &i.IsActive, &i.CreatedAt, &i.UpdatedAt, ) return i, err } const upsertMCPConnectionByName = `-- name: UpsertMCPConnectionByName :one INSERT INTO mcp_connections (bot_id, name, type, config) VALUES ($1, $2, $3, $4) ON CONFLICT (bot_id, name) DO UPDATE SET type = EXCLUDED.type, config = EXCLUDED.config, updated_at = now() RETURNING id, bot_id, name, type, config, is_active, created_at, updated_at ` type UpsertMCPConnectionByNameParams struct { BotID pgtype.UUID `json:"bot_id"` Name string `json:"name"` Type string `json:"type"` Config []byte `json:"config"` } func (q *Queries) UpsertMCPConnectionByName(ctx context.Context, arg UpsertMCPConnectionByNameParams) (McpConnection, error) { row := q.db.QueryRow(ctx, upsertMCPConnectionByName, arg.BotID, arg.Name, arg.Type, arg.Config, ) var i McpConnection err := row.Scan( &i.ID, &i.BotID, &i.Name, &i.Type, &i.Config, &i.IsActive, &i.CreatedAt, &i.UpdatedAt, ) return i, err }