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