postgresql

package
v2.0.0-...-549b09c Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddUserDosageParams

type AddUserDosageParams struct {
	UserID   pgtype.Uint32
	LastDose pgtype.Int8
}

type Compression

type Compression string
const (
	CompressionGzip   Compression = "gzip"
	CompressionZstd   Compression = "zstd"
	CompressionBrotli Compression = "brotli"
)

func (*Compression) Scan

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

type CreateUserParams

type CreateUserParams struct {
	UserID   xid.ID
	Email    string
	Passhash []byte
	Name     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 DeliveryMethod

type DeliveryMethod struct {
	ID    string
	Units string
	Name  string
}

type DosageHistory

type DosageHistory struct {
	DoseID         int64
	LastDose       pgtype.Int8
	UserID         pgtype.Uint32
	DeliveryMethod pgtype.Text
	Dose           pgtype.Numeric
	TakenAt        pgtype.Timestamptz
	TakenOffAt     pgtype.Timestamptz
}

type DosageSchedule

type DosageSchedule struct {
	UserID         xid.ID
	DeliveryMethod pgtype.Text
	Dose           pgtype.Numeric
	Interval       pgtype.Interval
	Concurrence    pgtype.Numeric
}

type Meta

type Meta struct {
	V int16
}

type NotificationHistory

type NotificationHistory struct {
	NotificationID int64
	UserID         pgtype.Uint32
	DosageID       pgtype.Int8
	SentAt         pgtype.Timestamptz
	ErrorReason    pgtype.Text
}

type NullCompression

type NullCompression struct {
	Compression Compression
	Valid       bool // Valid is true if Compression is not NULL
}

func (*NullCompression) Scan

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

Scan implements the Scanner interface.

func (NullCompression) Value

func (ns NullCompression) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) AddUserDosage

func (q *Queries) AddUserDosage(ctx context.Context, arg AddUserDosageParams) error

func (*Queries) CreateUser

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

func (*Queries) DeliveryMethod

func (q *Queries) DeliveryMethod(ctx context.Context, name string) (DeliveryMethod, error)

func (*Queries) DeliveryMethods

func (q *Queries) DeliveryMethods(ctx context.Context) ([]DeliveryMethod, error)

func (*Queries) RegisterSession

func (q *Queries) RegisterSession(ctx context.Context, arg RegisterSessionParams) error

func (*Queries) SetUserAvatar

func (q *Queries) SetUserAvatar(ctx context.Context, arg SetUserAvatarParams) error

func (*Queries) SetUserCustomNotification

func (q *Queries) SetUserCustomNotification(ctx context.Context, arg SetUserCustomNotificationParams) error

func (*Queries) SetUserNotificationService

func (q *Queries) SetUserNotificationService(ctx context.Context, arg SetUserNotificationServiceParams) error

func (*Queries) UpdateUserDosageSchedule

func (q *Queries) UpdateUserDosageSchedule(ctx context.Context, arg UpdateUserDosageScheduleParams) error

func (*Queries) UpdateUserEmailPassword

func (q *Queries) UpdateUserEmailPassword(ctx context.Context, arg UpdateUserEmailPasswordParams) 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) User

func (q *Queries) User(ctx context.Context, userID xid.ID) (UserRow, error)

func (*Queries) UserAvatar

func (q *Queries) UserAvatar(ctx context.Context, userID xid.ID) ([]byte, error)

func (*Queries) UserDosageHistory

func (q *Queries) UserDosageHistory(ctx context.Context, arg UserDosageHistoryParams) ([]DosageHistory, error)

func (*Queries) UserDosageSchedule

func (q *Queries) UserDosageSchedule(ctx context.Context, userID xid.ID) error

func (*Queries) UserPasswordHashFromEmail

func (q *Queries) UserPasswordHashFromEmail(ctx context.Context, email string) (UserPasswordHashFromEmailRow, error)

func (*Queries) ValidateSession

func (q *Queries) ValidateSession(ctx context.Context, token []byte) (ValidateSessionRow, error)

func (*Queries) WithTx

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

type RegisterSessionParams

type RegisterSessionParams struct {
	UserID    xid.ID
	Token     []byte
	UserAgent pgtype.Text
}

type SetUserAvatarParams

type SetUserAvatarParams struct {
	UserID      xid.ID
	AvatarImage []byte
}

type SetUserCustomNotificationParams

type SetUserCustomNotificationParams struct {
	UserID             xid.ID
	CustomNotification *notificationservice.Notification
}

type SetUserNotificationServiceParams

type SetUserNotificationServiceParams struct {
	UserID              xid.ID
	NotificationService *notificationservice.NotificationConfigJSON
}

type UpdateUserDosageScheduleParams

type UpdateUserDosageScheduleParams struct {
	UserID         xid.ID
	DeliveryMethod pgtype.Text
	Dose           pgtype.Numeric
	Interval       pgtype.Interval
	Concurrence    pgtype.Numeric
}

type UpdateUserEmailPasswordParams

type UpdateUserEmailPasswordParams struct {
	UserID   xid.ID
	Email    string
	Passhash []byte
}

type UpdateUserLocaleParams

type UpdateUserLocaleParams struct {
	UserID xid.ID
	Locale userservice.Locale
}

type UpdateUserNameParams

type UpdateUserNameParams struct {
	UserID xid.ID
	Name   string
}

type User

type User struct {
	UserID              xid.ID
	Email               string
	Passhash            []byte
	Name                string
	Locale              userservice.Locale
	RegisteredAt        pgtype.Timestamp
	NotificationService *notificationservice.NotificationConfigJSON
	CustomNotification  *notificationservice.Notification
}

type UserAvatar

type UserAvatar struct {
	UserID      xid.ID
	MimeType    string
	Compression assetservice.Compression
	AvatarImage []byte
}

type UserDosageHistoryParams

type UserDosageHistoryParams struct {
	UserID  pgtype.Uint32
	TakenAt pgtype.Timestamptz
	Limit   int32
}

type UserPasswordHashFromEmailRow

type UserPasswordHashFromEmailRow struct {
	UserID   xid.ID
	Passhash []byte
}

type UserRow

type UserRow struct {
	UserID    xid.ID
	Email     string
	Name      string
	HasAvatar bool
}

type UserSession

type UserSession struct {
	SessionID int64
	UserID    xid.ID
	Token     []byte
	CreatedAt pgtype.Timestamp
	LastUsed  pgtype.Timestamp
	UserAgent pgtype.Text
}

type ValidateSessionRow

type ValidateSessionRow struct {
	UserID    xid.ID
	Email     string
	Name      string
	HasAvatar bool
}

Jump to

Keyboard shortcuts

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