sqlcgen

package
v1.35.3 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 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 BatchUpsertRelationshipsParams

type BatchUpsertRelationshipsParams struct {
	Subjects []pgtype.UUID
	Objects  []pgtype.UUID
	Kinds    []int32
	Roles    []pgtype.UUID
}

type CountGrantedObjectsParams added in v1.18.0

type CountGrantedObjectsParams struct {
	Subject pgtype.UUID
	Role    pgtype.UUID
	Objects []pgtype.UUID
}

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 DeleteRelationshipsParams added in v1.33.0

type DeleteRelationshipsParams struct {
	Subjects []pgtype.UUID
	Objects  []pgtype.UUID
	Kinds    []int32
}

type LookupRelationshipsByOrgParams added in v1.27.0

type LookupRelationshipsByOrgParams struct {
	OriginID     string
	Objects      []pgtype.UUID
	Kinds        []int32
	Roles        []pgtype.UUID
	UseCursor    bool
	AfterSubject pgtype.UUID
	AfterObject  pgtype.UUID
	AfterKind    int32
	AfterRole    pgtype.UUID
	PageLimit    int32
}

type LookupRelationshipsByOrgRow added in v1.27.0

type LookupRelationshipsByOrgRow struct {
	Subject   pgtype.UUID
	Object    pgtype.UUID
	Kind      int32
	EdgeType  int32
	Role      pgtype.UUID
	CreatedAt pgtype.Timestamptz
	LocalID   string
}

type Querier

type Querier interface {
	BatchUpsertRelationships(ctx context.Context, arg BatchUpsertRelationshipsParams) ([]Relationship, error)
	CountGrantedObjects(ctx context.Context, arg CountGrantedObjectsParams) (int64, error)
	DeleteRelationships(ctx context.Context, arg DeleteRelationshipsParams) error
	// origin = 1 is relationships.v1.Origin ORIGIN_ORGANIZATION; org scoping is by
	// the subject's local identity in that org.
	//
	// Assumes one identities row per principal per org. True today, since identity
	// resolution always creates a new principal for a new local_id. If that
	// changes, add local_id to the ORDER BY/cursor below, or pagination can
	// silently drop a row (left out now since it costs an extra sort per call).
	LookupRelationshipsByOrg(ctx context.Context, arg LookupRelationshipsByOrgParams) ([]LookupRelationshipsByOrgRow, error)
	ReadRelationships(ctx context.Context, arg ReadRelationshipsParams) ([]Relationship, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) BatchUpsertRelationships

func (q *Queries) BatchUpsertRelationships(ctx context.Context, arg BatchUpsertRelationshipsParams) ([]Relationship, error)

func (*Queries) CountGrantedObjects added in v1.18.0

func (q *Queries) CountGrantedObjects(ctx context.Context, arg CountGrantedObjectsParams) (int64, error)

func (*Queries) DeleteRelationships added in v1.33.0

func (q *Queries) DeleteRelationships(ctx context.Context, arg DeleteRelationshipsParams) error

func (*Queries) LookupRelationshipsByOrg added in v1.27.0

func (q *Queries) LookupRelationshipsByOrg(ctx context.Context, arg LookupRelationshipsByOrgParams) ([]LookupRelationshipsByOrgRow, error)

origin = 1 is relationships.v1.Origin ORIGIN_ORGANIZATION; org scoping is by the subject's local identity in that org.

Assumes one identities row per principal per org. True today, since identity resolution always creates a new principal for a new local_id. If that changes, add local_id to the ORDER BY/cursor below, or pagination can silently drop a row (left out now since it costs an extra sort per call).

func (*Queries) ReadRelationships added in v1.16.0

func (q *Queries) ReadRelationships(ctx context.Context, arg ReadRelationshipsParams) ([]Relationship, error)

func (*Queries) WithTx

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

type ReadRelationshipsParams added in v1.16.0

type ReadRelationshipsParams struct {
	Subject pgtype.UUID
	Objects []pgtype.UUID
	Kinds   []int32
}

type Relationship

type Relationship struct {
	Subject   pgtype.UUID
	Object    pgtype.UUID
	Kind      int32
	EdgeType  int32
	Role      pgtype.UUID
	CreatedAt pgtype.Timestamptz
}

Jump to

Keyboard shortcuts

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