usersql

package
v0.0.0-...-d781a51 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateParams

type CreateParams struct {
	Name       string
	Email      string
	ExternalID string
}

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 ListMembershipsParams

type ListMembershipsParams struct {
	UserID uuid.UUID
	Offset int32
	Limit  int32
}

type ListMembershipsRow

type ListMembershipsRow struct {
	Team     Team
	RoleName RoleName
}

type ListParams

type ListParams struct {
	OrderBy string
	Offset  int32
	Limit   int32
}

type NullRoleName

type NullRoleName struct {
	RoleName RoleName
	Valid    bool // Valid is true if RoleName is not NULL
}

func (*NullRoleName) Scan

func (ns *NullRoleName) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullRoleName) Value

func (ns NullRoleName) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Querier

type Querier interface {
	Count(ctx context.Context) (int64, error)
	CountMemberships(ctx context.Context, userID uuid.UUID) (int64, error)
	Create(ctx context.Context, arg CreateParams) (*User, error)
	Delete(ctx context.Context, id uuid.UUID) error
	Get(ctx context.Context, id uuid.UUID) (*User, error)
	GetByEmail(ctx context.Context, email string) (*User, error)
	GetByExternalID(ctx context.Context, externalID string) (*User, error)
	GetByIDs(ctx context.Context, ids []uuid.UUID) ([]*User, error)
	List(ctx context.Context, arg ListParams) ([]*User, error)
	ListGCPGroupsForUser(ctx context.Context, userID uuid.UUID) ([]string, error)
	ListMemberships(ctx context.Context, arg ListMembershipsParams) ([]*ListMembershipsRow, error)
	Update(ctx context.Context, arg UpdateParams) (*User, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) Count

func (q *Queries) Count(ctx context.Context) (int64, error)

func (*Queries) CountMemberships

func (q *Queries) CountMemberships(ctx context.Context, userID uuid.UUID) (int64, error)

func (*Queries) Create

func (q *Queries) Create(ctx context.Context, arg CreateParams) (*User, error)

func (*Queries) Delete

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

func (*Queries) Get

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

func (*Queries) GetByEmail

func (q *Queries) GetByEmail(ctx context.Context, email string) (*User, error)

func (*Queries) GetByExternalID

func (q *Queries) GetByExternalID(ctx context.Context, externalID string) (*User, error)

func (*Queries) GetByIDs

func (q *Queries) GetByIDs(ctx context.Context, ids []uuid.UUID) ([]*User, error)

func (*Queries) List

func (q *Queries) List(ctx context.Context, arg ListParams) ([]*User, error)

func (*Queries) ListGCPGroupsForUser

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

func (*Queries) ListMemberships

func (q *Queries) ListMemberships(ctx context.Context, arg ListMembershipsParams) ([]*ListMembershipsRow, error)

func (*Queries) Update

func (q *Queries) Update(ctx context.Context, arg UpdateParams) (*User, error)

func (*Queries) WithTx

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

type RoleName

type RoleName string
const (
	RoleNameAdmin                 RoleName = "Admin"
	RoleNameDeploykeyviewer       RoleName = "Deploy key viewer"
	RoleNameServiceaccountcreator RoleName = "Service account creator"
	RoleNameServiceaccountowner   RoleName = "Service account owner"
	RoleNameSynchronizer          RoleName = "Synchronizer"
	RoleNameTeamcreator           RoleName = "Team creator"
	RoleNameTeammember            RoleName = "Team member"
	RoleNameTeamowner             RoleName = "Team owner"
	RoleNameTeamviewer            RoleName = "Team viewer"
	RoleNameUseradmin             RoleName = "User admin"
	RoleNameUserviewer            RoleName = "User viewer"
)

func AllRoleNameValues

func AllRoleNameValues() []RoleName

func (*RoleName) Scan

func (e *RoleName) Scan(src interface{}) error

func (RoleName) Valid

func (e RoleName) Valid() bool

type Team

type Team struct {
	Slug                 slug.Slug
	Purpose              string
	LastSuccessfulSync   pgtype.Timestamp
	SlackChannel         string
	GoogleGroupEmail     *string
	EntraIDGroupID       *uuid.UUID
	GithubTeamSlug       *string
	GarRepository        *string
	CdnBucket            *string
	DeleteKeyConfirmedAt pgtype.Timestamptz
}

type UpdateParams

type UpdateParams struct {
	Name       string
	Email      string
	ExternalID string
	ID         uuid.UUID
}

type User

type User struct {
	ID         uuid.UUID
	Email      string
	Name       string
	ExternalID string
}

Jump to

Keyboard shortcuts

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