postgres

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAircraftRepository

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

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 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 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 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 NewLicenseRepository

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

NewLicenseRepository creates a new license repository

func NewNotificationRepository

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

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 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) 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) ([]*models.Contact, error)

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

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. Used by exporters to avoid N+1 queries when rendering many flights.

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.

The previous read-modify-write (load user, drop the matching entry in Go, write the whole row back) had no lock or version check, so concurrent submissions of the SAME code all observed it as present, all matched, and all authenticated. Confirmed: ten parallel /auth/2fa/login requests with one code returned 200 ten times. array_remove inside a single conditional UPDATE makes consumption atomic -- the WHERE clause fails for every caller after the first, and 0 rows affected means "already used".

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) 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) 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) 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

Jump to

Keyboard shortcuts

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