authqueries

package
v0.0.0-...-fa14b81 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: Apache-2.0 Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyProjectMemberProjectionParams

type ApplyProjectMemberProjectionParams struct {
	ProjectID uuid.UUID
	UserID    uuid.UUID
	Revision  int64
	Present   bool
}

type CopyTeamAliasesToNamespaceParams

type CopyTeamAliasesToNamespaceParams struct {
	Namespace         string
	TeamID            uuid.UUID
	PreviousNamespace string
}

type CreateTeamAPIKeyParams

type CreateTeamAPIKeyParams struct {
	TeamID           uuid.UUID
	CreatedBy        *uuid.UUID
	ApiKeyHash       string
	ApiKeyPrefix     string
	ApiKeyLength     int32
	ApiKeyMaskPrefix string
	ApiKeyMaskSuffix string
	Name             string
}

type CreateTeamMembershipParams

type CreateTeamMembershipParams struct {
	UserID    uuid.UUID
	TeamID    uuid.UUID
	IsDefault bool
	AddedBy   *uuid.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 DeleteTeamAPIKeyParams

type DeleteTeamAPIKeyParams struct {
	ID     uuid.UUID
	TeamID uuid.UUID
}

type DeleteTeamMemberParams

type DeleteTeamMemberParams struct {
	TeamID uuid.UUID
	UserID uuid.UUID
}

type GetTeamAPIKeysWithCreatorRow

type GetTeamAPIKeysWithCreatorRow struct {
	ID               uuid.UUID
	Name             string
	ApiKeyPrefix     string
	ApiKeyLength     int32
	ApiKeyMaskPrefix string
	ApiKeyMaskSuffix string
	CreatedByID      *uuid.UUID
	CreatedAt        time.Time
	LastUsed         *time.Time
}

type GetTeamByAPIKeyRow

type GetTeamByAPIKeyRow struct {
	ID                               uuid.UUID
	CreatedAt                        time.Time
	IsBlocked                        bool
	Name                             string
	Email                            string
	IsBanned                         bool
	BlockedReason                    *string
	ClusterID                        *uuid.UUID
	SandboxSchedulingLabels          []string
	SsoOrganizationID                *uuid.UUID
	SsoAutoJoin                      bool
	DeletedAt                        *time.Time
	Slug                             string
	SandboxDefaultAllowPublicTraffic *bool
	MaxLengthHours                   int64
	ConcurrentSandboxes              int64
	ConcurrentTemplateBuilds         int64
	MaxVcpu                          int64
	MaxRamMb                         int64
	DiskMb                           int64
	EventsTtlDays                    int64
	DefaultFreeDiskSizeMb            int64
	MaxDiskSizeMb                    int64
	MaxFreeDiskSizeMb                int64
	ApiTeamRpsList                   int64
	ApiTeamRpsDelete                 int64
	MaxSecrets                       int64
}

type GetTeamByTeamAndUserParams

type GetTeamByTeamAndUserParams struct {
	UserID uuid.UUID
	ID     uuid.UUID
}

type GetTeamByTeamAndUserRow

type GetTeamByTeamAndUserRow struct {
	ID                               uuid.UUID
	CreatedAt                        time.Time
	IsBlocked                        bool
	Name                             string
	Email                            string
	IsBanned                         bool
	BlockedReason                    *string
	ClusterID                        *uuid.UUID
	SandboxSchedulingLabels          []string
	SsoOrganizationID                *uuid.UUID
	SsoAutoJoin                      bool
	DeletedAt                        *time.Time
	Slug                             string
	SandboxDefaultAllowPublicTraffic *bool
	MaxLengthHours                   int64
	ConcurrentSandboxes              int64
	ConcurrentTemplateBuilds         int64
	MaxVcpu                          int64
	MaxRamMb                         int64
	DiskMb                           int64
	EventsTtlDays                    int64
	DefaultFreeDiskSizeMb            int64
	MaxDiskSizeMb                    int64
	MaxFreeDiskSizeMb                int64
	ApiTeamRpsList                   int64
	ApiTeamRpsDelete                 int64
	MaxSecrets                       int64
}

type GetTeamByTeamIDRow

type GetTeamByTeamIDRow struct {
	ID                               uuid.UUID
	CreatedAt                        time.Time
	IsBlocked                        bool
	Name                             string
	Email                            string
	IsBanned                         bool
	BlockedReason                    *string
	ClusterID                        *uuid.UUID
	SandboxSchedulingLabels          []string
	SsoOrganizationID                *uuid.UUID
	SsoAutoJoin                      bool
	DeletedAt                        *time.Time
	Slug                             string
	SandboxDefaultAllowPublicTraffic *bool
	MaxLengthHours                   int64
	ConcurrentSandboxes              int64
	ConcurrentTemplateBuilds         int64
	MaxVcpu                          int64
	MaxRamMb                         int64
	DiskMb                           int64
	EventsTtlDays                    int64
	DefaultFreeDiskSizeMb            int64
	MaxDiskSizeMb                    int64
	MaxFreeDiskSizeMb                int64
	ApiTeamRpsList                   int64
	ApiTeamRpsDelete                 int64
	MaxSecrets                       int64
}

type GetTeamsWithUsersTeamsRow

type GetTeamsWithUsersTeamsRow struct {
	ID        uuid.UUID
	CreatedAt time.Time
	Name      string
	DeletedAt *time.Time
	IsDefault bool
}

type GetUserIdentitiesByUserIDsAndIssuersParams

type GetUserIdentitiesByUserIDsAndIssuersParams struct {
	OidcIssuers []string
	UserIds     []uuid.UUID
}

type GetUserIdentitiesByUserIDsAndIssuersRow

type GetUserIdentitiesByUserIDsAndIssuersRow struct {
	OidcIss string
	OidcSub string
	UserID  uuid.UUID
}

type GetUserIdentityParams

type GetUserIdentityParams struct {
	OidcIss string
	OidcSub string
}

type GetUserIdentityRow

type GetUserIdentityRow struct {
	OidcIss   string
	OidcSub   string
	UserID    uuid.UUID
	CreatedAt time.Time
	UpdatedAt time.Time
}

type GetUserTeamsWithLimitsRow

type GetUserTeamsWithLimitsRow struct {
	ID                               uuid.UUID
	CreatedAt                        time.Time
	IsBlocked                        bool
	Name                             string
	Email                            string
	IsBanned                         bool
	BlockedReason                    *string
	ClusterID                        *uuid.UUID
	SandboxSchedulingLabels          []string
	SsoOrganizationID                *uuid.UUID
	SsoAutoJoin                      bool
	DeletedAt                        *time.Time
	Slug                             string
	IsDefault                        bool
	SandboxDefaultAllowPublicTraffic *bool
	MaxLengthHours                   int64
	ConcurrentSandboxes              int64
	ConcurrentTemplateBuilds         int64
	MaxVcpu                          int64
	MaxRamMb                         int64
	DiskMb                           int64
	EventsTtlDays                    int64
	DefaultFreeDiskSizeMb            int64
	MaxDiskSizeMb                    int64
	MaxFreeDiskSizeMb                int64
	ApiTeamRpsList                   int64
	ApiTeamRpsDelete                 int64
	MaxSecrets                       int64
}

type InsertManagedTeamParams

type InsertManagedTeamParams struct {
	ID        uuid.UUID
	Name      string
	Slug      string
	Email     string
	ClusterID *uuid.UUID
}

type InsertManagedTeamRow

type InsertManagedTeamRow struct {
	ID        uuid.UUID
	Name      string
	Slug      string
	Email     string
	ClusterID *uuid.UUID
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) ApplyProjectMemberProjection

func (q *Queries) ApplyProjectMemberProjection(ctx context.Context, arg ApplyProjectMemberProjectionParams) (bool, error)

func (*Queries) CopyTeamAliasesToNamespace

func (q *Queries) CopyTeamAliasesToNamespace(ctx context.Context, arg CopyTeamAliasesToNamespaceParams) ([]string, error)

Follows a slug change: every alias the team holds under an earlier namespace is also given under the new one, so a template stays reachable by the new slug while the old names keep working. Aliases without a namespace are global and stay out of it. Where two earlier namespaces hold the same alias, the one under the slug being replaced wins.

Only live templates are copied, and FOR SHARE serializes against a concurrent template delete: the delete either waits and then releases the copies too, or has committed and its template is skipped.

An alias the new namespace already holds is left as it is rather than failing the reconcile, which the caller would only retry. Returns the aliases skipped because the new namespace gives them to another template; the outer select reads the table as it was before the insert.

func (*Queries) CreateTeamAPIKey

func (q *Queries) CreateTeamAPIKey(ctx context.Context, arg CreateTeamAPIKeyParams) (TeamApiKey, error)

func (*Queries) CreateTeamMembership

func (q *Queries) CreateTeamMembership(ctx context.Context, arg CreateTeamMembershipParams) error

func (*Queries) DeletePublicUser

func (q *Queries) DeletePublicUser(ctx context.Context, id uuid.UUID) error

func (*Queries) DeleteTeamAPIKey

func (q *Queries) DeleteTeamAPIKey(ctx context.Context, arg DeleteTeamAPIKeyParams) ([]string, error)

func (*Queries) DeleteTeamMember

func (q *Queries) DeleteTeamMember(ctx context.Context, arg DeleteTeamMemberParams) error

func (*Queries) GetTeamAPIKeyHashes

func (q *Queries) GetTeamAPIKeyHashes(ctx context.Context, teamID uuid.UUID) ([]string, error)

func (*Queries) GetTeamAPIKeysWithCreator

func (q *Queries) GetTeamAPIKeysWithCreator(ctx context.Context, teamID uuid.UUID) ([]GetTeamAPIKeysWithCreatorRow, error)

func (*Queries) GetTeamByAPIKey

func (q *Queries) GetTeamByAPIKey(ctx context.Context, apiKeyHash string) (GetTeamByAPIKeyRow, error)

Each lookup resolves the team and its limits in one statement: the pushed project_limits row, else default_limits, which always holds one row. The limit columns repeat across these queries on purpose, so a new limit needs no migration recreating a view or function; TestTeamLookupsReturnEveryDefaultLimit in pkg/tests fails when a lookup misses one.

func (*Queries) GetTeamByTeamAndUser

func (q *Queries) GetTeamByTeamAndUser(ctx context.Context, arg GetTeamByTeamAndUserParams) (GetTeamByTeamAndUserRow, error)

func (*Queries) GetTeamByTeamID

func (q *Queries) GetTeamByTeamID(ctx context.Context, id uuid.UUID) (GetTeamByTeamIDRow, error)

func (*Queries) GetTeamMemberIDs

func (q *Queries) GetTeamMemberIDs(ctx context.Context, teamID uuid.UUID) ([]uuid.UUID, error)

GetTeamMemberIDs lists the users whose cached auth entry carries this team's data, so invalidating the team can reach all of them.

func (*Queries) GetTeamsWithUsersTeams

func (q *Queries) GetTeamsWithUsersTeams(ctx context.Context, userID uuid.UUID) ([]GetTeamsWithUsersTeamsRow, error)

func (*Queries) GetUserIdentity

func (q *Queries) GetUserIdentity(ctx context.Context, arg GetUserIdentityParams) (GetUserIdentityRow, error)

func (*Queries) GetUserTeamsWithLimits

func (q *Queries) GetUserTeamsWithLimits(ctx context.Context, userID uuid.UUID) ([]GetUserTeamsWithLimitsRow, error)

func (*Queries) InsertManagedTeam

func (q *Queries) InsertManagedTeam(ctx context.Context, arg InsertManagedTeamParams) (InsertManagedTeamRow, error)

DO NOTHING covers the case where the lock above found nothing and another request inserted the same id before this ran: no row means that happened. A slug collision is a different constraint and still raises.

func (*Queries) LockManagedTeam

func (q *Queries) LockManagedTeam(ctx context.Context, id uuid.UUID) (string, error)

Project reconciliation for the control-plane management interface. The caller supplies the id, so create and reconcile are one request and these are its branches. Taken first, so the branch is decided by whether the project exists rather than by an insert failing. Returns the slug so a reconcile can tell whether it moves.

func (*Queries) UpdateLastTimeUsed

func (q *Queries) UpdateLastTimeUsed(ctx context.Context, apiKeyHash string) error

func (*Queries) UpdateManagedTeam

func (q *Queries) UpdateManagedTeam(ctx context.Context, arg UpdateManagedTeamParams) (UpdateManagedTeamRow, error)

Touches only the properties the caller synchronizes. is_blocked stays because an operator's decision must outlive a routine push.

func (*Queries) UpdateTeamApiKey

func (q *Queries) UpdateTeamApiKey(ctx context.Context, arg UpdateTeamApiKeyParams) (uuid.UUID, error)

func (*Queries) UpsertPublicIdentity

func (q *Queries) UpsertPublicIdentity(ctx context.Context, arg UpsertPublicIdentityParams) (uuid.UUID, error)

func (*Queries) UpsertPublicUser

func (q *Queries) UpsertPublicUser(ctx context.Context, id uuid.UUID) error

func (*Queries) UpsertTeamMember

func (q *Queries) UpsertTeamMember(ctx context.Context, arg UpsertTeamMemberParams) error

func (*Queries) WithTx

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

type TeamApiKey

type TeamApiKey struct {
	CreatedAt time.Time
	TeamID    uuid.UUID
	UpdatedAt *time.Time
	Name      string
	LastUsed  *time.Time
	CreatedBy *uuid.UUID
	ID        uuid.UUID
	// sensitive
	ApiKeyHash       string
	ApiKeyPrefix     string
	ApiKeyLength     int32
	ApiKeyMaskPrefix string
	ApiKeyMaskSuffix string
}

type UpdateManagedTeamParams

type UpdateManagedTeamParams struct {
	Name      string
	Slug      string
	Email     string
	ClusterID *uuid.UUID
	ID        uuid.UUID
}

type UpdateManagedTeamRow

type UpdateManagedTeamRow struct {
	ID        uuid.UUID
	Name      string
	Slug      string
	Email     string
	ClusterID *uuid.UUID
}

type UpdateTeamApiKeyParams

type UpdateTeamApiKeyParams struct {
	Name      string
	UpdatedAt *time.Time
	ID        uuid.UUID
	TeamID    uuid.UUID
}

type UpsertPublicIdentityParams

type UpsertPublicIdentityParams struct {
	OidcIss string
	OidcSub string
	UserID  uuid.UUID
}

type UpsertTeamMemberParams

type UpsertTeamMemberParams struct {
	UserID    uuid.UUID
	TeamID    uuid.UUID
	IsDefault bool
	AddedBy   *uuid.UUID
}

Jump to

Keyboard shortcuts

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