database

package
v0.0.0-...-f54a13a Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountRequest

type AccountRequest struct {
	ID         uuid.UUID
	CreatedAt  pgtype.Timestamp
	Reference  string
	Reason     string
	YearTag    string
	Kthid      string
	Done       bool
	UgKthid    string
	FirstName  string
	FamilyName string
	Email      string
}

type AddPasskeyParams

type AddPasskeyParams struct {
	Kthid        string
	Name         string
	Data         []byte
	Discoverable bool
}

type BeginEmailChangeParams

type BeginEmailChangeParams struct {
	Kthid    string
	NewEmail string
	Code     string
}

type BeginEmailLoginParams

type BeginEmailLoginParams struct {
	Kthid string
	Code  string
}

type CreateAccountRequestManualParams

type CreateAccountRequestManualParams struct {
	Kthid      string
	UgKthid    string
	Reference  string
	Reason     string
	YearTag    string
	FirstName  string
	FamilyName string
	Email      string
}

type CreateAccountRequestParams

type CreateAccountRequestParams struct {
	Reference string
	Reason    string
	YearTag   string
}

type CreateClientParams

type CreateClientParams struct {
	ID         string
	SecretHash []byte
}

type CreateGuestSessionParams

type CreateGuestSessionParams struct {
	GuestData   []byte
	Permissions []byte
}

type CreateInviteParams

type CreateInviteParams struct {
	Name      string
	ExpiresAt pgtype.Timestamp
	MaxUses   pgtype.Int4
}

type CreateSessionParams

type CreateSessionParams struct {
	Kthid       pgtype.Text
	Permissions []byte
}

type CreateUserParams

type CreateUserParams struct {
	Kthid      string
	UgKthid    string
	Email      string
	FirstName  string
	FamilyName string
	YearTag    string
	MemberTo   pgtype.Date
}

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 EmailChangeRequest

type EmailChangeRequest struct {
	Kthid     string
	NewEmail  string
	Code      string
	CreatedAt pgtype.Timestamp
	Attempts  int32
}

type EmailLogin

type EmailLogin struct {
	Kthid     string
	Code      string
	CreatedAt pgtype.Timestamp
	Attempts  int32
}

type FinishAccountRequestKTHParams

type FinishAccountRequestKTHParams struct {
	ID         uuid.UUID
	Kthid      string
	UgKthid    string
	FirstName  string
	FamilyName string
	Email      string
}

type FinishEmailChangeParams

type FinishEmailChangeParams struct {
	Kthid string
	Code  string
}

type FinishEmailChangeRow

type FinishEmailChangeRow struct {
	Ok       bool
	Reason   string
	NewEmail string
}

type FinishEmailLoginParams

type FinishEmailLoginParams struct {
	Kthid string
	Code  string
}

type FinishEmailLoginRow

type FinishEmailLoginRow struct {
	Ok     bool
	Reason string
}

type GetLastSheetUploadRow

type GetLastSheetUploadRow struct {
	UploadedAt pgtype.Timestamp
	UploadedBy string
}

type GetPasskeyParams

type GetPasskeyParams struct {
	Kthid string
	ID    []byte
}

type GetSessionRow

type GetSessionRow struct {
	Kthid       pgtype.Text
	GuestData   []byte
	Permissions []byte
}

type Invite

type Invite struct {
	ID          uuid.UUID
	Name        string
	CreatedAt   pgtype.Timestamp
	ExpiresAt   pgtype.Timestamp
	MaxUses     pgtype.Int4
	CurrentUses int32
}

type LastMembershipSheet

type LastMembershipSheet struct {
	UniqueMarker string
	UploadedAt   pgtype.Timestamp
	UploadedBy   string
}

type LegacyapiToken

type LegacyapiToken struct {
	ID         uuid.UUID
	Kthid      string
	LastUsedAt pgtype.Timestamp
}

type ListUsersParams

type ListUsersParams struct {
	Limit  int32
	Offset int32
	Search string
	Year   string
}

type OidcClient

type OidcClient struct {
	SecretHash   []byte
	RedirectUris []string
	ID           string
	HiveSystemID string
	LastUsedAt   pgtype.Timestamp
	AllowGuests  bool
}

type Passkey

type Passkey struct {
	ID           uuid.UUID
	Name         string
	Kthid        string
	Data         []byte
	Discoverable bool
}

type Queries

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

func Connect

func Connect(ctx context.Context) (*Queries, func() *sql.DB, error)

func ConnectAndMigrate

func ConnectAndMigrate(ctx context.Context) (*Queries, error)

func New

func New(db DBTX) *Queries

func (*Queries) AddPasskey

func (q *Queries) AddPasskey(ctx context.Context, arg AddPasskeyParams) (uuid.UUID, error)

func (*Queries) ApproveNameChangeRequest

func (q *Queries) ApproveNameChangeRequest(ctx context.Context, kthid string) error

func (*Queries) Begin

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

func (*Queries) BeginEmailChange

func (q *Queries) BeginEmailChange(ctx context.Context, arg BeginEmailChangeParams) error

func (*Queries) BeginEmailLogin

func (q *Queries) BeginEmailLogin(ctx context.Context, arg BeginEmailLoginParams) error

func (*Queries) CancelEmailChange

func (q *Queries) CancelEmailChange(ctx context.Context, kthid string) error

func (*Queries) Commit

func (q *Queries) Commit(ctx context.Context) error

func (*Queries) CreateAccountRequest

func (q *Queries) CreateAccountRequest(ctx context.Context, arg CreateAccountRequestParams) (uuid.UUID, error)

func (*Queries) CreateAccountRequestManual

func (q *Queries) CreateAccountRequestManual(ctx context.Context, arg CreateAccountRequestManualParams) (uuid.UUID, error)

func (*Queries) CreateClient

func (q *Queries) CreateClient(ctx context.Context, arg CreateClientParams) (OidcClient, error)

func (*Queries) CreateGuestSession

func (q *Queries) CreateGuestSession(ctx context.Context, arg CreateGuestSessionParams) (uuid.UUID, error)

func (*Queries) CreateInvite

func (q *Queries) CreateInvite(ctx context.Context, arg CreateInviteParams) (Invite, error)

func (*Queries) CreateSession

func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) (uuid.UUID, error)

func (*Queries) CreateToken

func (q *Queries) CreateToken(ctx context.Context, kthid string) (uuid.UUID, error)

func (*Queries) CreateUser

func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) error

func (*Queries) DeleteAccountRequest

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

func (*Queries) DeleteClient

func (q *Queries) DeleteClient(ctx context.Context, id string) error

func (*Queries) DeleteInvite

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

func (*Queries) DeleteToken

func (q *Queries) DeleteToken(ctx context.Context, kthid string) error

func (*Queries) DenyNameChangeRequest

func (q *Queries) DenyNameChangeRequest(ctx context.Context, kthid string) error

func (*Queries) FinishAccountRequestKTH

func (q *Queries) FinishAccountRequestKTH(ctx context.Context, arg FinishAccountRequestKTHParams) error

func (*Queries) FinishEmailChange

func (q *Queries) FinishEmailChange(ctx context.Context, arg FinishEmailChangeParams) (FinishEmailChangeRow, error)

func (*Queries) FinishEmailLogin

func (q *Queries) FinishEmailLogin(ctx context.Context, arg FinishEmailLoginParams) (FinishEmailLoginRow, error)

func (*Queries) GetAllYears

func (q *Queries) GetAllYears(ctx context.Context) ([]string, error)

func (*Queries) GetClient

func (q *Queries) GetClient(ctx context.Context, id string) (OidcClient, error)

func (*Queries) GetClientUpdateLastUse

func (q *Queries) GetClientUpdateLastUse(ctx context.Context, id string) (OidcClient, error)

func (*Queries) GetInvite

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

func (*Queries) GetKTHIDByWebauthnID

func (q *Queries) GetKTHIDByWebauthnID(ctx context.Context, webauthnID []byte) (string, error)

func (*Queries) GetLastSheetUpload

func (q *Queries) GetLastSheetUpload(ctx context.Context) (GetLastSheetUploadRow, error)

func (*Queries) GetPasskey

func (q *Queries) GetPasskey(ctx context.Context, arg GetPasskeyParams) (Passkey, error)

func (*Queries) GetPendingEmailChange

func (q *Queries) GetPendingEmailChange(ctx context.Context, kthid string) (string, error)

func (*Queries) GetSession

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

func (*Queries) GetToken

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

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, kthid string) (User, error)

func (*Queries) GetUsersByIDs

func (q *Queries) GetUsersByIDs(ctx context.Context, ids []string) ([]User, error)

func (*Queries) IncrementInviteUses

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

func (*Queries) ListAccountRequests

func (q *Queries) ListAccountRequests(ctx context.Context) ([]AccountRequest, error)

func (*Queries) ListClients

func (q *Queries) ListClients(ctx context.Context) ([]OidcClient, error)

func (*Queries) ListInvites

func (q *Queries) ListInvites(ctx context.Context) ([]Invite, error)

func (*Queries) ListPasskeysByUser

func (q *Queries) ListPasskeysByUser(ctx context.Context, kthid string) ([]Passkey, error)

func (*Queries) ListUsers

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

func (*Queries) ListUsersWithNameChangeRequests

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

func (*Queries) MarkSheetUploadedNow

func (q *Queries) MarkSheetUploadedNow(ctx context.Context, uploadedBy string) error

func (*Queries) RemovePasskey

func (q *Queries) RemovePasskey(ctx context.Context, arg RemovePasskeyParams) error

func (*Queries) RemoveSession

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

func (*Queries) Rollback

func (q *Queries) Rollback(ctx context.Context) error

func (*Queries) StoreWebAuthnSessionData

func (q *Queries) StoreWebAuthnSessionData(ctx context.Context, arg StoreWebAuthnSessionDataParams) (uuid.UUID, error)

func (*Queries) TakeWebAuthnSessionData

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

func (*Queries) Tx

func (q *Queries) Tx(ctx context.Context, f func(db *Queries) error) error

func (*Queries) UpdateClientAllowGuests

func (q *Queries) UpdateClientAllowGuests(ctx context.Context, arg UpdateClientAllowGuestsParams) (OidcClient, error)

func (*Queries) UpdateClientHiveSystemID

func (q *Queries) UpdateClientHiveSystemID(ctx context.Context, arg UpdateClientHiveSystemIDParams) (OidcClient, error)

func (*Queries) UpdateClientRedirectURIs

func (q *Queries) UpdateClientRedirectURIs(ctx context.Context, arg UpdateClientRedirectURIsParams) (OidcClient, error)

func (*Queries) UpdateInvite

func (q *Queries) UpdateInvite(ctx context.Context, arg UpdateInviteParams) (Invite, error)

func (*Queries) UserSetEmail

func (q *Queries) UserSetEmail(ctx context.Context, arg UserSetEmailParams) (User, error)

func (*Queries) UserSetMemberTo

func (q *Queries) UserSetMemberTo(ctx context.Context, arg UserSetMemberToParams) error

func (*Queries) UserSetNameChangeRequest

func (q *Queries) UserSetNameChangeRequest(ctx context.Context, arg UserSetNameChangeRequestParams) (User, error)

func (*Queries) UserSetYear

func (q *Queries) UserSetYear(ctx context.Context, arg UserSetYearParams) (User, error)

func (*Queries) WithTx

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

type RemovePasskeyParams

type RemovePasskeyParams struct {
	Kthid string
	ID    uuid.UUID
}

type Session

type Session struct {
	ID          uuid.UUID
	Kthid       pgtype.Text
	LastUsedAt  pgtype.Timestamp
	Permissions []byte
	GuestData   []byte
}

type StoreWebAuthnSessionDataParams

type StoreWebAuthnSessionDataParams struct {
	Data  []byte
	Kthid string
}

type TakeWebAuthnSessionDataRow

type TakeWebAuthnSessionDataRow struct {
	Data  []byte
	Kthid string
}

type UpdateClientAllowGuestsParams

type UpdateClientAllowGuestsParams struct {
	ID          string
	AllowGuests bool
}

type UpdateClientHiveSystemIDParams

type UpdateClientHiveSystemIDParams struct {
	ID           string
	HiveSystemID string
}

type UpdateClientRedirectURIsParams

type UpdateClientRedirectURIsParams struct {
	ID           string
	RedirectUris []string
}

type UpdateInviteParams

type UpdateInviteParams struct {
	ID        uuid.UUID
	Name      string
	ExpiresAt pgtype.Timestamp
	MaxUses   pgtype.Int4
}

type User

type User struct {
	Kthid                   string
	UgKthid                 string
	Email                   string
	FirstName               string
	FamilyName              string
	YearTag                 string
	MemberTo                pgtype.Date
	WebauthnID              []byte
	FirstNameChangeRequest  string
	FamilyNameChangeRequest string
}

type UserSetEmailParams

type UserSetEmailParams struct {
	Kthid string
	Email string
}

type UserSetMemberToParams

type UserSetMemberToParams struct {
	Kthid    string
	MemberTo pgtype.Date
}

type UserSetNameChangeRequestParams

type UserSetNameChangeRequestParams struct {
	Kthid                   string
	FirstNameChangeRequest  string
	FamilyNameChangeRequest string
}

type UserSetYearParams

type UserSetYearParams struct {
	Kthid   string
	YearTag string
}

type WebauthnSessionDatum

type WebauthnSessionDatum struct {
	ID        uuid.UUID
	Kthid     string
	CreatedAt pgtype.Timestamp
	Data      []byte
}

Jump to

Keyboard shortcuts

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