Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.31.1
// source: issue_view_preference.sql
package db
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const getIssueViewPreference = `-- name: GetIssueViewPreference :one
SELECT workspace_id, user_id, scope_type, scope_id, prefs, updated_at FROM issue_view_preference
WHERE workspace_id = $1 AND user_id = $2 AND scope_type = $3 AND scope_id = $4
`
type GetIssueViewPreferenceParams struct {
WorkspaceID pgtype.UUID `json:"workspace_id"`
UserID pgtype.UUID `json:"user_id"`
ScopeType string `json:"scope_type"`
ScopeID pgtype.UUID `json:"scope_id"`
}
func (q *Queries) GetIssueViewPreference(ctx context.Context, arg GetIssueViewPreferenceParams) (IssueViewPreference, error) {
row := q.db.QueryRow(ctx, getIssueViewPreference,
arg.WorkspaceID,
arg.UserID,
arg.ScopeType,
arg.ScopeID,
)
var i IssueViewPreference
err := row.Scan(
&i.WorkspaceID,
&i.UserID,
&i.ScopeType,
&i.ScopeID,
&i.Prefs,
&i.UpdatedAt,
)
return i, err
}
const upsertIssueViewPreference = `-- name: UpsertIssueViewPreference :one
INSERT INTO issue_view_preference (workspace_id, user_id, scope_type, scope_id, prefs)
VALUES ($1, $2, $3, $4, $5)
ON CONFLICT (workspace_id, user_id, scope_type, scope_id)
DO UPDATE SET prefs = EXCLUDED.prefs, updated_at = now()
RETURNING workspace_id, user_id, scope_type, scope_id, prefs, updated_at
`
type UpsertIssueViewPreferenceParams struct {
WorkspaceID pgtype.UUID `json:"workspace_id"`
UserID pgtype.UUID `json:"user_id"`
ScopeType string `json:"scope_type"`
ScopeID pgtype.UUID `json:"scope_id"`
Prefs []byte `json:"prefs"`
}
// Whole-document replace: single-user data, last-write-wins.
func (q *Queries) UpsertIssueViewPreference(ctx context.Context, arg UpsertIssueViewPreferenceParams) (IssueViewPreference, error) {
row := q.db.QueryRow(ctx, upsertIssueViewPreference,
arg.WorkspaceID,
arg.UserID,
arg.ScopeType,
arg.ScopeID,
arg.Prefs,
)
var i IssueViewPreference
err := row.Scan(
&i.WorkspaceID,
&i.UserID,
&i.ScopeType,
&i.ScopeID,
&i.Prefs,
&i.UpdatedAt,
)
return i, err
}