sqlcgen

package
v1.145.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BulkUpsertClientsParams added in v1.104.1

type BulkUpsertClientsParams struct {
	Ids             []string
	Secrets         [][]byte
	RedirectUris    [][]byte
	GrantTypes      [][]byte
	ResponseTypes   [][]byte
	Scopes          [][]byte
	Publics         []bool
	Names           []string
	Owners          []string
	Trusteds        []bool
	CreatedAts      []pgtype.Timestamptz
	UpdatedAts      []pgtype.Timestamptz
	Dynamics        []bool
	OrganizationIds []pgtype.UUID
	OwningCellIds   []int64
	SourceIds       []int64
}

type Client

type Client struct {
	ID             string
	Secret         []byte
	RedirectUris   []byte
	GrantTypes     []byte
	ResponseTypes  []byte
	Scopes         []byte
	Public         bool
	Name           string
	Owner          string
	Trusted        bool
	CreatedAt      pgtype.Timestamptz
	UpdatedAt      pgtype.Timestamptz
	Dynamic        bool
	OrganizationID pgtype.UUID
	OwningCellID   pgtype.Int8
	SourceID       pgtype.Int8
}

type CreateClientParams

type CreateClientParams struct {
	ID             string
	Secret         []byte
	RedirectUris   []byte
	GrantTypes     []byte
	ResponseTypes  []byte
	Scopes         []byte
	Public         bool
	Name           string
	Owner          string
	Trusted        bool
	CreatedAt      pgtype.Timestamptz
	UpdatedAt      pgtype.Timestamptz
	Dynamic        bool
	OrganizationID pgtype.UUID
	OwningCellID   pgtype.Int8
	SourceID       pgtype.Int8
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type Querier

type Querier interface {
	// Keep the SET list in step with UpsertClient. NULLIF stores a 0 cell or
	// source id as NULL, as pkgstorage.Int8OrNull does for the single-record path.
	// Rows lock in statement order, so ORDER BY keeps two batches that share
	// clients from deadlocking each other.
	BulkUpsertClients(ctx context.Context, arg BulkUpsertClientsParams) error
	CreateClient(ctx context.Context, arg CreateClientParams) (Client, error)
	DeleteClient(ctx context.Context, id string) (int64, error)
	GetClient(ctx context.Context, id string) (Client, error)
	LockClient(ctx context.Context, id string) (string, error)
	// A client delete marks its Doorkeeper refresh tokens before the cascade;
	// rationale in auth/AGENTS.md ("doorkeeperrefreshtokens"). A marker has no
	// client_id, so only live rows match.
	MarkClientRefreshTokensDeleted(ctx context.Context, clientID string) (int64, error)
	// created_at is written only on insert; ON CONFLICT leaves the stored value
	// untouched so it remains immutable across updates.
	UpsertClient(ctx context.Context, arg UpsertClientParams) (Client, error)
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) BulkUpsertClients added in v1.104.1

func (q *Queries) BulkUpsertClients(ctx context.Context, arg BulkUpsertClientsParams) error

Keep the SET list in step with UpsertClient. NULLIF stores a 0 cell or source id as NULL, as pkgstorage.Int8OrNull does for the single-record path. Rows lock in statement order, so ORDER BY keeps two batches that share clients from deadlocking each other.

func (*Queries) CreateClient

func (q *Queries) CreateClient(ctx context.Context, arg CreateClientParams) (Client, error)

func (*Queries) DeleteClient

func (q *Queries) DeleteClient(ctx context.Context, id string) (int64, error)

func (*Queries) GetClient

func (q *Queries) GetClient(ctx context.Context, id string) (Client, error)

func (*Queries) LockClient added in v1.139.0

func (q *Queries) LockClient(ctx context.Context, id string) (string, error)

func (*Queries) MarkClientRefreshTokensDeleted added in v1.139.0

func (q *Queries) MarkClientRefreshTokensDeleted(ctx context.Context, clientID string) (int64, error)

A client delete marks its Doorkeeper refresh tokens before the cascade; rationale in auth/AGENTS.md ("doorkeeperrefreshtokens"). A marker has no client_id, so only live rows match.

func (*Queries) UpsertClient

func (q *Queries) UpsertClient(ctx context.Context, arg UpsertClientParams) (Client, error)

created_at is written only on insert; ON CONFLICT leaves the stored value untouched so it remains immutable across updates.

func (*Queries) WithTx

func (q *Queries) WithTx(tx pgx.Tx) *Queries

type UpsertClientParams

type UpsertClientParams struct {
	ID             string
	Secret         []byte
	RedirectUris   []byte
	GrantTypes     []byte
	ResponseTypes  []byte
	Scopes         []byte
	Public         bool
	Name           string
	Owner          string
	Trusted        bool
	CreatedAt      pgtype.Timestamptz
	UpdatedAt      pgtype.Timestamptz
	Dynamic        bool
	OrganizationID pgtype.UUID
	OwningCellID   pgtype.Int8
	SourceID       pgtype.Int8
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL