usersyncsql

package
v0.0.0-...-b00d09b Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2025 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 AssignGlobalRoleParams

type AssignGlobalRoleParams struct {
	UserID   uuid.UUID
	RoleName string
}

type CreateLogEntryParams

type CreateLogEntryParams struct {
	Action       UsersyncLogEntryAction
	UserID       uuid.UUID
	UserName     string
	UserEmail    string
	OldUserName  *string
	OldUserEmail *string
	RoleName     *string
}

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 ListLogEntriesParams

type ListLogEntriesParams struct {
	Offset int32
	Limit  int32
}

type NullUsersyncLogEntryAction

type NullUsersyncLogEntryAction struct {
	UsersyncLogEntryAction UsersyncLogEntryAction
	Valid                  bool // Valid is true if UsersyncLogEntryAction is not NULL
}

func (*NullUsersyncLogEntryAction) Scan

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

Scan implements the Scanner interface.

func (NullUsersyncLogEntryAction) Value

Value implements the driver Valuer interface.

type Querier

type Querier interface {
	AssignGlobalAdmin(ctx context.Context, id uuid.UUID) error
	AssignGlobalRole(ctx context.Context, arg AssignGlobalRoleParams) error
	CountLogEntries(ctx context.Context) (int64, error)
	Create(ctx context.Context, arg CreateParams) (*User, error)
	CreateLogEntry(ctx context.Context, arg CreateLogEntryParams) error
	Delete(ctx context.Context, id uuid.UUID) error
	List(ctx context.Context) ([]*User, error)
	ListGlobalAdmins(ctx context.Context) ([]*User, error)
	ListLogEntries(ctx context.Context, arg ListLogEntriesParams) ([]*UsersyncLogEntry, error)
	ListLogEntriesByIDs(ctx context.Context, ids []uuid.UUID) ([]*UsersyncLogEntry, error)
	ListRoles(ctx context.Context) ([]*UserRole, error)
	RevokeGlobalAdmin(ctx context.Context, id uuid.UUID) error
	RevokeGlobalRole(ctx context.Context, arg RevokeGlobalRoleParams) error
	Update(ctx context.Context, arg UpdateParams) error
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AssignGlobalAdmin

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

func (*Queries) AssignGlobalRole

func (q *Queries) AssignGlobalRole(ctx context.Context, arg AssignGlobalRoleParams) error

func (*Queries) CountLogEntries

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

func (*Queries) Create

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

func (*Queries) CreateLogEntry

func (q *Queries) CreateLogEntry(ctx context.Context, arg CreateLogEntryParams) error

func (*Queries) Delete

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

func (*Queries) List

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

func (*Queries) ListGlobalAdmins

func (q *Queries) ListGlobalAdmins(ctx context.Context) ([]*User, error)

func (*Queries) ListLogEntries

func (q *Queries) ListLogEntries(ctx context.Context, arg ListLogEntriesParams) ([]*UsersyncLogEntry, error)

func (*Queries) ListLogEntriesByIDs

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

func (*Queries) ListRoles

func (q *Queries) ListRoles(ctx context.Context) ([]*UserRole, error)

func (*Queries) RevokeGlobalAdmin

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

func (*Queries) RevokeGlobalRole

func (q *Queries) RevokeGlobalRole(ctx context.Context, arg RevokeGlobalRoleParams) error

func (*Queries) Update

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

func (*Queries) WithTx

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

type RevokeGlobalRoleParams

type RevokeGlobalRoleParams struct {
	UserID   uuid.UUID
	RoleName string
}

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
	Admin      bool
}

type UserRole

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

type UsersyncLogEntry

type UsersyncLogEntry struct {
	ID           uuid.UUID
	CreatedAt    pgtype.Timestamptz
	Action       UsersyncLogEntryAction
	UserID       uuid.UUID
	UserName     string
	UserEmail    string
	OldUserName  *string
	OldUserEmail *string
	RoleName     *string
}

type UsersyncLogEntryAction

type UsersyncLogEntryAction string
const (
	UsersyncLogEntryActionCreateUser UsersyncLogEntryAction = "create_user"
	UsersyncLogEntryActionUpdateUser UsersyncLogEntryAction = "update_user"
	UsersyncLogEntryActionDeleteUser UsersyncLogEntryAction = "delete_user"
	UsersyncLogEntryActionAssignRole UsersyncLogEntryAction = "assign_role"
	UsersyncLogEntryActionRevokeRole UsersyncLogEntryAction = "revoke_role"
)

func AllUsersyncLogEntryActionValues

func AllUsersyncLogEntryActionValues() []UsersyncLogEntryAction

func (*UsersyncLogEntryAction) Scan

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

func (UsersyncLogEntryAction) Valid

func (e UsersyncLogEntryAction) Valid() bool

Jump to

Keyboard shortcuts

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