postgres

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAdminRepository added in v1.3.4

func NewAdminRepository(db *sql.DB) repository.AdminRepository

NewAdminRepository creates the repository behind the admin console.

func NewAircraftRepository

func NewAircraftRepository(db *sql.DB) repository.AircraftRepository

func NewAnnouncementRepository added in v1.3.4

func NewAnnouncementRepository(db *sql.DB) repository.AnnouncementRepository

NewAnnouncementRepository creates a system announcement repository.

func NewBackupDestinationRepository added in v1.2.4

func NewBackupDestinationRepository(db *sql.DB) repository.BackupDestinationRepository

NewBackupDestinationRepository returns a Postgres-backed repository for cloud backup destinations.

func NewBackupRunRepository added in v1.2.4

func NewBackupRunRepository(db *sql.DB) repository.BackupRunRepository

NewBackupRunRepository returns a Postgres-backed repository for backup runs.

func NewCredentialRepository

func NewCredentialRepository(db *sql.DB) repository.CredentialRepository

func NewCurrencyFlightDataProvider added in v1.3.4

func NewCurrencyFlightDataProvider(db *sql.DB) currency.FlightDataProvider

NewCurrencyFlightDataProvider creates a currency.FlightDataProvider backed by PostgreSQL.

func NewCustomCurrencyDataProvider added in v1.3.4

func NewCustomCurrencyDataProvider(db *sql.DB) currency.CustomFlightDataProvider

NewCustomCurrencyDataProvider creates the flight-data provider the custom currency rule evaluator runs on.

func NewCustomCurrencyRuleRepository added in v1.3.1

func NewCustomCurrencyRuleRepository(db *sql.DB) repository.CustomCurrencyRuleRepository

NewCustomCurrencyRuleRepository creates a Postgres-backed repository for user-authored currency rules.

func NewDeletionRepository added in v1.3.2

func NewDeletionRepository(db *sql.DB) repository.DeletionRepository

NewDeletionRepository creates a repository over trigger-written deletion tombstones. It is read-and-sweep only.

func NewDocumentFileRepository added in v1.3.2

func NewDocumentFileRepository(db *sql.DB) repository.DocumentFileRepository

func NewEmailDeliveryRepository added in v1.3.2

func NewEmailDeliveryRepository(db *sql.DB) repository.EmailDeliveryRepository

NewEmailDeliveryRepository creates a new email delivery repository.

func NewEmailVerificationTokenRepository added in v1.2.5

func NewEmailVerificationTokenRepository(db *sql.DB) repository.EmailVerificationTokenRepository

NewEmailVerificationTokenRepository creates a new email verification token repository.

func NewFlightBaselineRepository added in v1.2.3

func NewFlightBaselineRepository(db *sql.DB) repository.FlightBaselineRepository

NewFlightBaselineRepository returns a postgres-backed FlightBaselineRepository.

func NewFlightImportRepository added in v1.3.4

func NewFlightImportRepository(db *sql.DB) repository.FlightImportRepository

NewFlightImportRepository creates the import-history repository.

func NewFlightRepository

func NewFlightRepository(db *sql.DB) repository.FlightRepository

NewFlightRepository creates a new flight repository

func NewFlightSessionRepository added in v1.2.8

func NewFlightSessionRepository(db *sql.DB) repository.FlightSessionRepository

NewFlightSessionRepository returns a postgres-backed FlightSessionRepository.

func NewFlightSignatureRepository added in v1.2.9

func NewFlightSignatureRepository(db *sql.DB) repository.FlightSignatureRepository

NewFlightSignatureRepository returns a postgres-backed FlightSignatureRepository.

func NewIdempotencyRepository added in v1.3.2

func NewIdempotencyRepository(db *sql.DB) repository.IdempotencyRepository

NewIdempotencyRepository creates a new idempotency record repository.

func NewLicenseRepository

func NewLicenseRepository(db *sql.DB) repository.LicenseRepository

NewLicenseRepository creates a new license repository

func NewNotificationRepository

func NewNotificationRepository(db *sql.DB) repository.NotificationRepository

func NewOIDCIdentityRepository added in v1.3.2

func NewOIDCIdentityRepository(db *sql.DB) repository.OIDCIdentityRepository

NewOIDCIdentityRepository returns a repository.OIDCIdentityRepository backed by Postgres.

func NewPasswordResetTokenRepository

func NewPasswordResetTokenRepository(db *sql.DB) repository.PasswordResetTokenRepository

NewPasswordResetTokenRepository creates a new password reset token repository

func NewRefreshTokenRepository

func NewRefreshTokenRepository(db *sql.DB) repository.RefreshTokenRepository

NewRefreshTokenRepository creates a new refresh token repository

func NewReportsRepository added in v1.3.4

func NewReportsRepository(db *sql.DB) repository.ReportsRepository

NewReportsRepository creates the read-only repository behind the reports, analytics and map endpoints.

func NewUserContentRepository added in v1.3.4

func NewUserContentRepository(db *sql.DB) repository.UserContentRepository

NewUserContentRepository creates the account-content wipe repository.

func NewWebAuthnCredentialRepository added in v1.2.0

func NewWebAuthnCredentialRepository(db *sql.DB) repository.WebAuthnCredentialRepository

NewWebAuthnCredentialRepository creates a new WebAuthn credential repository.

func NewWebAuthnSessionRepository added in v1.2.0

func NewWebAuthnSessionRepository(db *sql.DB) repository.WebAuthnSessionRepository

NewWebAuthnSessionRepository creates a new WebAuthn session repository.

Types

type ClassRatingRepository

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

func NewClassRatingRepository

func NewClassRatingRepository(db *sql.DB) *ClassRatingRepository

func (*ClassRatingRepository) Create

func (*ClassRatingRepository) Delete

func (r *ClassRatingRepository) Delete(ctx context.Context, id uuid.UUID) error

func (*ClassRatingRepository) GetByID

func (*ClassRatingRepository) GetByLicenseID

func (r *ClassRatingRepository) GetByLicenseID(ctx context.Context, licenseID uuid.UUID) ([]*models.ClassRating, error)

func (*ClassRatingRepository) Update

type ContactRepository

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

func NewContactRepository

func NewContactRepository(db *sql.DB) *ContactRepository

func (*ContactRepository) Create

func (r *ContactRepository) Create(ctx context.Context, contact *models.Contact) error

func (*ContactRepository) Delete

func (r *ContactRepository) Delete(ctx context.Context, id uuid.UUID) error

func (*ContactRepository) FindOrCreateByName added in v1.3.3

func (r *ContactRepository) FindOrCreateByName(ctx context.Context, userID uuid.UUID, name string) (*models.Contact, bool, error)

FindOrCreateByName returns the user's contact with this name, creating it if there is none, and reports whether it created one. Concurrent callers converge on a single row. The caller is responsible for trimming; the name is matched and stored verbatim.

func (*ContactRepository) GetByExactName

func (r *ContactRepository) GetByExactName(ctx context.Context, userID uuid.UUID, name string) (*models.Contact, error)

func (*ContactRepository) GetByID

func (r *ContactRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.Contact, error)

func (*ContactRepository) GetByUserID

func (r *ContactRepository) GetByUserID(ctx context.Context, userID uuid.UUID, updatedSince *time.Time) ([]*models.Contact, error)

func (*ContactRepository) RolesByContact added in v1.3.3

func (r *ContactRepository) RolesByContact(ctx context.Context, userID uuid.UUID) (map[uuid.UUID][]string, error)

RolesByContact returns the distinct crew roles each of the user's contacts has been logged in, most-used first.

func (*ContactRepository) Search

func (r *ContactRepository) Search(ctx context.Context, userID uuid.UUID, query string, limit int) ([]*models.Contact, error)

func (*ContactRepository) Update

func (r *ContactRepository) Update(ctx context.Context, contact *models.Contact) error

func (*ContactRepository) UpdateWithCrewRename added in v1.3.3

func (r *ContactRepository) UpdateWithCrewRename(ctx context.Context, contact *models.Contact) (int, error)

UpdateWithCrewRename updates the contact and carries a name change into the crew rows of the user's unsigned flights, returning how many crew rows were rewritten. Signed flights keep the crew name they were signed with. contact.UserID must be set by the caller.

type FlightCrewRepository

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

func NewFlightCrewRepository

func NewFlightCrewRepository(db *sql.DB) *FlightCrewRepository

func (*FlightCrewRepository) DeleteByFlightID

func (r *FlightCrewRepository) DeleteByFlightID(ctx context.Context, flightID uuid.UUID) error

func (*FlightCrewRepository) GetByFlightID

func (r *FlightCrewRepository) GetByFlightID(ctx context.Context, flightID uuid.UUID) ([]models.FlightCrewMember, error)

func (*FlightCrewRepository) GetByFlightIDs added in v1.2.3

func (r *FlightCrewRepository) GetByFlightIDs(ctx context.Context, flightIDs []uuid.UUID) (map[uuid.UUID][]models.FlightCrewMember, error)

GetByFlightIDs batch-loads crew members for multiple flights and returns them grouped by flight ID.

func (*FlightCrewRepository) SetCrewMembers

func (r *FlightCrewRepository) SetCrewMembers(ctx context.Context, flightID uuid.UUID, members []models.FlightCrewMember) error

type UserRepository

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

func NewUserRepository

func NewUserRepository(db *sql.DB) *UserRepository

func (*UserRepository) ConsumeRecoveryCode added in v1.3.1

func (r *UserRepository) ConsumeRecoveryCode(ctx context.Context, id uuid.UUID, codeHash string) (bool, error)

ConsumeRecoveryCode atomically removes one recovery code hash from the user's list, returning true only if this call was the one that removed it.

func (*UserRepository) Create

func (r *UserRepository) Create(ctx context.Context, user *models.User) error

func (*UserRepository) Delete

func (r *UserRepository) Delete(ctx context.Context, id uuid.UUID) error

func (*UserRepository) DeleteUnverifiedRemindedBefore added in v1.3.2

func (r *UserRepository) DeleteUnverifiedRemindedBefore(ctx context.Context, remindedBefore time.Time) (int64, error)

func (*UserRepository) GetByEmail

func (r *UserRepository) GetByEmail(ctx context.Context, email string) (*models.User, error)

func (*UserRepository) GetByID

func (r *UserRepository) GetByID(ctx context.Context, id uuid.UUID) (*models.User, error)

func (*UserRepository) IncrementFailedLoginAttempts

func (r *UserRepository) IncrementFailedLoginAttempts(ctx context.Context, id uuid.UUID) error

func (*UserRepository) ListUnverifiedForReminder added in v1.3.2

func (r *UserRepository) ListUnverifiedForReminder(ctx context.Context, createdBefore time.Time, limit int) ([]*models.User, error)

func (*UserRepository) LockAccount

func (r *UserRepository) LockAccount(ctx context.Context, id uuid.UUID, until time.Time) error

func (*UserRepository) MarkEmailVerified added in v1.2.5

func (r *UserRepository) MarkEmailVerified(ctx context.Context, id uuid.UUID) error

func (*UserRepository) MarkVerificationReminderSent added in v1.3.2

func (r *UserRepository) MarkVerificationReminderSent(ctx context.Context, id uuid.UUID, at time.Time) error

func (*UserRepository) ResetFailedLoginAttempts

func (r *UserRepository) ResetFailedLoginAttempts(ctx context.Context, id uuid.UUID) error

func (*UserRepository) Update

func (r *UserRepository) Update(ctx context.Context, user *models.User) error

func (*UserRepository) UpdateLastLogin added in v1.3.2

func (r *UserRepository) UpdateLastLogin(ctx context.Context, id uuid.UUID, at time.Time) error

UpdateLastLogin stamps the moment a session was handed out. A missing row is not an error.

Jump to

Keyboard shortcuts

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