Documentation
¶
Overview ¶
Package postgresqlc contains raw SQL queries for the storage services and wrapper functions to use them.
Index ¶
- Constants
- func IsConstraintFailed(err error) bool
- func IsErrorCode(err error, code string) bool
- func Migrate(ctx context.Context, conn *pgxpool.Pool) error
- type CreateUserParams
- type DBTX
- type DeleteSessionParams
- type DeliveryMethod
- type DosageHistory
- type DosageSchedule
- type DoseHistoryParams
- type DoseHistoryRows
- type EditDoseParams
- type ForgetDosesParams
- type Meta
- type NotificationHistory
- type Queries
- func (q *Queries) CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
- func (q *Queries) DeleteDosageSchedule(ctx context.Context, userSecret userservice.Secret) error
- func (q *Queries) DeleteSession(ctx context.Context, arg DeleteSessionParams) error
- func (q *Queries) DeliveryMethod(ctx context.Context, name string) (DeliveryMethod, error)
- func (q *Queries) DeliveryMethods(ctx context.Context) ([]DeliveryMethod, error)
- func (q *Queries) DosageSchedule(ctx context.Context, userSecret userservice.Secret) (DosageSchedule, error)
- func (q *Queries) DoseHistory(ctx context.Context, arg DoseHistoryParams) DoseHistoryRows
- func (q *Queries) EditDose(ctx context.Context, arg EditDoseParams) (int64, error)
- func (q *Queries) ForgetDoses(ctx context.Context, arg ForgetDosesParams) (int64, error)
- func (q *Queries) ListSessions(ctx context.Context, userSecret userservice.Secret) ([]UserSession, error)
- func (q *Queries) RecordDose(ctx context.Context, arg RecordDoseParams) error
- func (q *Queries) RegisterSession(ctx context.Context, arg RegisterSessionParams) error
- func (q *Queries) SetDosageSchedule(ctx context.Context, arg SetDosageScheduleParams) error
- func (q *Queries) SetUserNotificationPreferences(ctx context.Context, arg SetUserNotificationPreferencesParams) error
- func (q *Queries) UpdateUserLocale(ctx context.Context, arg UpdateUserLocaleParams) error
- func (q *Queries) UpdateUserName(ctx context.Context, arg UpdateUserNameParams) error
- func (q *Queries) User(ctx context.Context, secret userservice.Secret) (User, error)
- func (q *Queries) UserNotificationPreferences(ctx context.Context, secret userservice.Secret) (notificationservice.UserPreferences, error)
- func (q *Queries) ValidateSession(ctx context.Context, token []byte) (UserSession, error)
- func (q *Queries) Version(ctx context.Context) (int16, error)
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type RecordDoseParams
- type RegisterSessionParams
- type SetDosageScheduleParams
- type SetUserNotificationPreferencesParams
- type UpdateUserLocaleParams
- type UpdateUserNameParams
- type User
- type UserSession
Constants ¶
View Source
const ( CodeTableNotFound = "42P01" CodeUniqueViolation = "23505" )
Variables ¶
This section is empty.
Functions ¶
func IsConstraintFailed ¶
IsConstraintFailed returns true if err is returned because of a unique constraint violation.
func IsErrorCode ¶
IsErrorCode returns true if err is a PostgreSQL error with the given code.
Types ¶
type CreateUserParams ¶
type CreateUserParams struct { Secret userservice.Secret Name string }
type DeleteSessionParams ¶
type DeleteSessionParams struct { UserSecret userservice.Secret ID int64 }
type DeliveryMethod ¶
type DosageHistory ¶
type DosageHistory struct { UserSecret userservice.Secret DeliveryMethod pgtype.Text Dose float32 TakenAt pgtype.Timestamptz TakenOffAt pgtype.Timestamptz Comment pgtype.Text }
type DosageSchedule ¶
type DoseHistoryParams ¶
type DoseHistoryParams struct { UserSecret userservice.Secret Start pgtype.Timestamptz End pgtype.Timestamptz }
type DoseHistoryRows ¶
type DoseHistoryRows struct {
// contains filtered or unexported fields
}
func (*DoseHistoryRows) Close ¶
func (r *DoseHistoryRows) Close()
func (*DoseHistoryRows) Err ¶
func (r *DoseHistoryRows) Err() error
func (*DoseHistoryRows) Iterate ¶
func (r *DoseHistoryRows) Iterate() iter.Seq[DosageHistory]
type EditDoseParams ¶
type EditDoseParams struct { DeliveryMethod pgtype.Text Dose float32 TakenAt pgtype.Timestamptz TakenOffAt pgtype.Timestamptz UserSecret userservice.Secret OldTakenAt pgtype.Timestamptz }
type ForgetDosesParams ¶
type ForgetDosesParams struct { UserSecret userservice.Secret TakenAt []pgtype.Timestamp }
type NotificationHistory ¶
type NotificationHistory struct { NotificationID pgtype.UUID UserSecret userservice.Secret SupposedEntityTime pgtype.Timestamptz SentAt pgtype.Timestamptz ErrorReason pgtype.Text Errored pgtype.Bool }
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) CreateUser ¶
func (*Queries) DeleteDosageSchedule ¶
func (*Queries) DeleteSession ¶
func (q *Queries) DeleteSession(ctx context.Context, arg DeleteSessionParams) error
func (*Queries) DeliveryMethod ¶
func (*Queries) DeliveryMethods ¶
func (q *Queries) DeliveryMethods(ctx context.Context) ([]DeliveryMethod, error)
Language: postgresql
func (*Queries) DosageSchedule ¶
func (q *Queries) DosageSchedule(ctx context.Context, userSecret userservice.Secret) (DosageSchedule, error)
func (*Queries) DoseHistory ¶
func (q *Queries) DoseHistory(ctx context.Context, arg DoseHistoryParams) DoseHistoryRows
func (*Queries) ForgetDoses ¶
func (*Queries) ListSessions ¶
func (q *Queries) ListSessions(ctx context.Context, userSecret userservice.Secret) ([]UserSession, error)
func (*Queries) RecordDose ¶
func (q *Queries) RecordDose(ctx context.Context, arg RecordDoseParams) error
func (*Queries) RegisterSession ¶
func (q *Queries) RegisterSession(ctx context.Context, arg RegisterSessionParams) error
func (*Queries) SetDosageSchedule ¶
func (q *Queries) SetDosageSchedule(ctx context.Context, arg SetDosageScheduleParams) error
func (*Queries) SetUserNotificationPreferences ¶
func (q *Queries) SetUserNotificationPreferences(ctx context.Context, arg SetUserNotificationPreferencesParams) error
func (*Queries) UpdateUserLocale ¶
func (q *Queries) UpdateUserLocale(ctx context.Context, arg UpdateUserLocaleParams) error
func (*Queries) UpdateUserName ¶
func (q *Queries) UpdateUserName(ctx context.Context, arg UpdateUserNameParams) error
func (*Queries) UserNotificationPreferences ¶
func (q *Queries) UserNotificationPreferences(ctx context.Context, secret userservice.Secret) (notificationservice.UserPreferences, error)
func (*Queries) ValidateSession ¶
type RecordDoseParams ¶
type RecordDoseParams struct { UserSecret userservice.Secret DeliveryMethod pgtype.Text Dose float32 TakenAt pgtype.Timestamptz TakenOffAt pgtype.Timestamptz }
type RegisterSessionParams ¶
type RegisterSessionParams struct { UserSecret userservice.Secret Token []byte UserAgent pgtype.Text }
type SetDosageScheduleParams ¶
type SetUserNotificationPreferencesParams ¶
type SetUserNotificationPreferencesParams struct { Secret userservice.Secret Column2 []byte }
type UpdateUserLocaleParams ¶
type UpdateUserLocaleParams struct { Secret userservice.Secret Locale userservice.Locale }
type UpdateUserNameParams ¶
type UpdateUserNameParams struct { Secret userservice.Secret Name string }
type User ¶
type User struct { Secret userservice.Secret Name string Locale userservice.Locale RegisteredAt pgtype.Timestamp NotificationPreferences notificationservice.UserPreferences }
Click to show internal directories.
Click to hide internal directories.