Files
member-console/internal/entitlements/pool_assignments.sql.go
T
cgalo5758 88db730fcc Add dual licensing and SPDX headers
Introduce a commercial license option alongside AGPL-3.0-only, require a
CLA for contributors, and document the terms in COMMERCIAL.md and
NOTICE. Add a script to stamp SPDX headers on Go files and apply it
across the tree.
2026-09-06 02:29:42 -05:00

63 lines
1.8 KiB
Go

// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
// SPDX-FileCopyrightText: 2025-2026 Christian Galo
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.29.0
// source: pool_assignments.sql
package entitlements
import (
"context"
)
const createPoolAssignment = `-- name: CreatePoolAssignment :one
INSERT INTO core.pool_assignments (pool_id, workspace_id, is_primary)
VALUES ($1, $2, $3)
RETURNING assignment_id, pool_id, workspace_id, is_primary, status, suspended_at, created_at, updated_at
`
type CreatePoolAssignmentParams struct {
PoolID string `json:"pool_id"`
WorkspaceID string `json:"workspace_id"`
IsPrimary bool `json:"is_primary"`
}
func (q *Queries) CreatePoolAssignment(ctx context.Context, arg CreatePoolAssignmentParams) (PoolAssignment, error) {
row := q.db.QueryRowContext(ctx, createPoolAssignment, arg.PoolID, arg.WorkspaceID, arg.IsPrimary)
var i PoolAssignment
err := row.Scan(
&i.AssignmentID,
&i.PoolID,
&i.WorkspaceID,
&i.IsPrimary,
&i.Status,
&i.SuspendedAt,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const getPrimaryPoolAssignmentByWorkspace = `-- name: GetPrimaryPoolAssignmentByWorkspace :one
SELECT assignment_id, pool_id, workspace_id, is_primary, status, suspended_at, created_at, updated_at FROM core.pool_assignments
WHERE workspace_id = $1 AND is_primary = TRUE AND status = 'active'
`
func (q *Queries) GetPrimaryPoolAssignmentByWorkspace(ctx context.Context, workspaceID string) (PoolAssignment, error) {
row := q.db.QueryRowContext(ctx, getPrimaryPoolAssignmentByWorkspace, workspaceID)
var i PoolAssignment
err := row.Scan(
&i.AssignmentID,
&i.PoolID,
&i.WorkspaceID,
&i.IsPrimary,
&i.Status,
&i.SuspendedAt,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}