teamsql

package
v0.0.0-...-10dfb09 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 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 AddMemberParams

type AddMemberParams struct {
	UserID   uuid.UUID
	RoleName RoleName
	TeamSlug slug.Slug
}

type CreateDeleteKeyParams

type CreateDeleteKeyParams struct {
	TeamSlug  slug.Slug
	CreatedBy uuid.UUID
}

type CreateParams

type CreateParams struct {
	Slug         slug.Slug
	Purpose      string
	SlackChannel 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 GetDeleteKeyParams

type GetDeleteKeyParams struct {
	Key  uuid.UUID
	Slug slug.Slug
}

type GetEnvironmentParams

type GetEnvironmentParams struct {
	Slug        slug.Slug
	Environment string
}

type GetMemberByEmailParams

type GetMemberByEmailParams struct {
	TeamSlug slug.Slug
	Email    string
}

type GetMemberByEmailRow

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

type GetMemberParams

type GetMemberParams struct {
	TeamSlug slug.Slug
	UserID   uuid.UUID
}

type GetMemberRow

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

type ListEnvironmentsBySlugsAndEnvNamesParams

type ListEnvironmentsBySlugsAndEnvNamesParams struct {
	TeamSlugs    []slug.Slug
	Environments []string
}

type ListForUserParams

type ListForUserParams struct {
	UserID  uuid.UUID
	OrderBy string
	Offset  int32
	Limit   int32
}

type ListForUserRow

type ListForUserRow struct {
	User     User
	UserRole UserRole
}

type ListMembersParams

type ListMembersParams struct {
	TeamSlug slug.Slug
	OrderBy  string
	Offset   int32
	Limit    int32
}

type ListMembersRow

type ListMembersRow struct {
	User     User
	UserRole UserRole
}

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 {
	AddMember(ctx context.Context, arg AddMemberParams) error
	ConfirmDeleteKey(ctx context.Context, key uuid.UUID) error
	Count(ctx context.Context) (int64, error)
	CountForUser(ctx context.Context, userID uuid.UUID) (int64, error)
	CountMembers(ctx context.Context, teamSlug *slug.Slug) (int64, error)
	Create(ctx context.Context, arg CreateParams) (*Team, error)
	CreateDeleteKey(ctx context.Context, arg CreateDeleteKeyParams) (*TeamDeleteKey, error)
	Exists(ctx context.Context, argSlug slug.Slug) (bool, error)
	Get(ctx context.Context, argSlug slug.Slug) (*Team, error)
	GetDeleteKey(ctx context.Context, arg GetDeleteKeyParams) (*TeamDeleteKey, error)
	GetEnvironment(ctx context.Context, arg GetEnvironmentParams) (*TeamAllEnvironment, error)
	GetMember(ctx context.Context, arg GetMemberParams) (*GetMemberRow, error)
	GetMemberByEmail(ctx context.Context, arg GetMemberByEmailParams) (*GetMemberByEmailRow, error)
	List(ctx context.Context, arg ListParams) ([]*Team, error)
	ListAllSlugs(ctx context.Context) ([]slug.Slug, error)
	ListBySlugs(ctx context.Context, slugs []slug.Slug) ([]*Team, error)
	ListEnvironmentsBySlug(ctx context.Context, argSlug slug.Slug) ([]*TeamAllEnvironment, error)
	// ListEnvironmentsBySlugsAndEnvNames returns a slice of team environments for a list of teams/envs, excluding
	// deleted teams.
	// Input is two arrays of equal length, one for slugs and one for names
	ListEnvironmentsBySlugsAndEnvNames(ctx context.Context, arg ListEnvironmentsBySlugsAndEnvNamesParams) ([]*TeamAllEnvironment, error)
	ListForUser(ctx context.Context, arg ListForUserParams) ([]*ListForUserRow, error)
	ListMembers(ctx context.Context, arg ListMembersParams) ([]*ListMembersRow, error)
	RemoveMember(ctx context.Context, arg RemoveMemberParams) error
	RemoveSlackAlertsChannel(ctx context.Context, arg RemoveSlackAlertsChannelParams) error
	Search(ctx context.Context, query string) ([]*SearchRow, error)
	SetDeleteKeyConfirmedAt(ctx context.Context, argSlug slug.Slug) error
	SlugAvailable(ctx context.Context, argSlug slug.Slug) (bool, error)
	Update(ctx context.Context, arg UpdateParams) (*Team, error)
	UpdateExternalReferences(ctx context.Context, arg UpdateExternalReferencesParams) error
	UpsertEnvironment(ctx context.Context, arg UpsertEnvironmentParams) error
	UserIsMember(ctx context.Context, arg UserIsMemberParams) (bool, error)
	UserIsOwner(ctx context.Context, arg UserIsOwnerParams) (bool, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AddMember

func (q *Queries) AddMember(ctx context.Context, arg AddMemberParams) error

func (*Queries) ConfirmDeleteKey

func (q *Queries) ConfirmDeleteKey(ctx context.Context, key uuid.UUID) error

func (*Queries) Count

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

func (*Queries) CountForUser

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

func (*Queries) CountMembers

func (q *Queries) CountMembers(ctx context.Context, teamSlug *slug.Slug) (int64, error)

func (*Queries) Create

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

func (*Queries) CreateDeleteKey

func (q *Queries) CreateDeleteKey(ctx context.Context, arg CreateDeleteKeyParams) (*TeamDeleteKey, error)

func (*Queries) Exists

func (q *Queries) Exists(ctx context.Context, argSlug slug.Slug) (bool, error)

func (*Queries) Get

func (q *Queries) Get(ctx context.Context, argSlug slug.Slug) (*Team, error)

func (*Queries) GetDeleteKey

func (q *Queries) GetDeleteKey(ctx context.Context, arg GetDeleteKeyParams) (*TeamDeleteKey, error)

func (*Queries) GetEnvironment

func (q *Queries) GetEnvironment(ctx context.Context, arg GetEnvironmentParams) (*TeamAllEnvironment, error)

func (*Queries) GetMember

func (q *Queries) GetMember(ctx context.Context, arg GetMemberParams) (*GetMemberRow, error)

func (*Queries) GetMemberByEmail

func (q *Queries) GetMemberByEmail(ctx context.Context, arg GetMemberByEmailParams) (*GetMemberByEmailRow, error)

func (*Queries) List

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

func (*Queries) ListAllSlugs

func (q *Queries) ListAllSlugs(ctx context.Context) ([]slug.Slug, error)

func (*Queries) ListBySlugs

func (q *Queries) ListBySlugs(ctx context.Context, slugs []slug.Slug) ([]*Team, error)

func (*Queries) ListEnvironmentsBySlug

func (q *Queries) ListEnvironmentsBySlug(ctx context.Context, argSlug slug.Slug) ([]*TeamAllEnvironment, error)

func (*Queries) ListEnvironmentsBySlugsAndEnvNames

func (q *Queries) ListEnvironmentsBySlugsAndEnvNames(ctx context.Context, arg ListEnvironmentsBySlugsAndEnvNamesParams) ([]*TeamAllEnvironment, error)

ListEnvironmentsBySlugsAndEnvNames returns a slice of team environments for a list of teams/envs, excluding deleted teams. Input is two arrays of equal length, one for slugs and one for names

func (*Queries) ListForUser

func (q *Queries) ListForUser(ctx context.Context, arg ListForUserParams) ([]*ListForUserRow, error)

func (*Queries) ListMembers

func (q *Queries) ListMembers(ctx context.Context, arg ListMembersParams) ([]*ListMembersRow, error)

func (*Queries) RemoveMember

func (q *Queries) RemoveMember(ctx context.Context, arg RemoveMemberParams) error

func (*Queries) RemoveSlackAlertsChannel

func (q *Queries) RemoveSlackAlertsChannel(ctx context.Context, arg RemoveSlackAlertsChannelParams) error

func (*Queries) Search

func (q *Queries) Search(ctx context.Context, query string) ([]*SearchRow, error)

func (*Queries) SetDeleteKeyConfirmedAt

func (q *Queries) SetDeleteKeyConfirmedAt(ctx context.Context, argSlug slug.Slug) error

func (*Queries) SlugAvailable

func (q *Queries) SlugAvailable(ctx context.Context, argSlug slug.Slug) (bool, error)

func (*Queries) Update

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

func (*Queries) UpdateExternalReferences

func (q *Queries) UpdateExternalReferences(ctx context.Context, arg UpdateExternalReferencesParams) error

func (*Queries) UpsertEnvironment

func (q *Queries) UpsertEnvironment(ctx context.Context, arg UpsertEnvironmentParams) error

func (*Queries) UserIsMember

func (q *Queries) UserIsMember(ctx context.Context, arg UserIsMemberParams) (bool, error)

func (*Queries) UserIsOwner

func (q *Queries) UserIsOwner(ctx context.Context, arg UserIsOwnerParams) (bool, error)

func (*Queries) WithTx

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

type RemoveMemberParams

type RemoveMemberParams struct {
	UserID   uuid.UUID
	TeamSlug slug.Slug
}

type RemoveSlackAlertsChannelParams

type RemoveSlackAlertsChannelParams struct {
	TeamSlug    slug.Slug
	Environment string
}

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 SearchRow

type SearchRow struct {
	Team Team
	Rank int32
}

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 TeamAllEnvironment

type TeamAllEnvironment struct {
	TeamSlug           slug.Slug
	Environment        string
	Gcp                bool
	GcpProjectID       *string
	ID                 uuid.UUID
	SlackAlertsChannel string
}

type TeamDeleteKey

type TeamDeleteKey struct {
	Key         uuid.UUID
	TeamSlug    slug.Slug
	CreatedAt   pgtype.Timestamptz
	CreatedBy   uuid.UUID
	ConfirmedAt pgtype.Timestamptz
}

type UpdateExternalReferencesParams

type UpdateExternalReferencesParams struct {
	GoogleGroupEmail *string
	EntraIDGroupID   *uuid.UUID
	GithubTeamSlug   *string
	GarRepository    *string
	CdnBucket        *string
	Slug             slug.Slug
}

type UpdateParams

type UpdateParams struct {
	Purpose      *string
	SlackChannel *string
	Slug         slug.Slug
}

type UpsertEnvironmentParams

type UpsertEnvironmentParams struct {
	TeamSlug           slug.Slug
	Environment        string
	SlackAlertsChannel *string
	GcpProjectID       *string
}

type User

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

type UserIsMemberParams

type UserIsMemberParams struct {
	UserID   uuid.UUID
	TeamSlug slug.Slug
}

type UserIsOwnerParams

type UserIsOwnerParams struct {
	UserID   uuid.UUID
	TeamSlug slug.Slug
}

type UserRole

type UserRole struct {
	ID                     int32
	RoleName               RoleName
	UserID                 uuid.UUID
	TargetTeamSlug         *slug.Slug
	TargetServiceAccountID *uuid.UUID
}

Jump to

Keyboard shortcuts

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