db

package
v0.0.0-...-21bd2b8 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateUserParams

type CreateUserParams struct {
	AuthID  string         `json:"auth_id"`
	Email   string         `json:"email"`
	Name    string         `json:"name"`
	Picture sql.NullString `json:"picture"`
	IsAdmin sql.NullBool   `json:"is_admin"`
}

type CreateUserPreferencesParams

type CreateUserPreferencesParams struct {
	UserID             uuid.NullUUID  `json:"user_id"`
	Theme              sql.NullString `json:"theme"`
	Language           sql.NullString `json:"language"`
	Timezone           sql.NullString `json:"timezone"`
	EmailNotifications sql.NullBool   `json:"email_notifications"`
	EmailBilling       sql.NullBool   `json:"email_billing"`
	PushNotifications  sql.NullBool   `json:"push_notifications"`
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type GetRecentUsersRow

type GetRecentUsersRow struct {
	ID        uuid.UUID    `json:"id"`
	Email     string       `json:"email"`
	Name      string       `json:"name"`
	CreatedAt sql.NullTime `json:"created_at"`
}

type Queries

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

func New

func New(db DBTX) *Queries

func Prepare

func Prepare(ctx context.Context, db DBTX) (*Queries, error)

func (*Queries) Close

func (q *Queries) Close() error

func (*Queries) CountUsers

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

func (*Queries) CountUsersCreatedThisWeek

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

func (*Queries) CountUsersCreatedToday

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

func (*Queries) CreateUser

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

func (*Queries) CreateUserPreferences

func (q *Queries) CreateUserPreferences(ctx context.Context, arg CreateUserPreferencesParams) (UserPreference, error)

func (*Queries) GetAdminUsers

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

func (*Queries) GetAllUsers

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

func (*Queries) GetRecentUsers

func (q *Queries) GetRecentUsers(ctx context.Context) ([]GetRecentUsersRow, error)

func (*Queries) GetUserByAuthID

func (q *Queries) GetUserByAuthID(ctx context.Context, authID string) (User, error)

func (*Queries) GetUserByEmail

func (q *Queries) GetUserByEmail(ctx context.Context, email string) (User, error)

func (*Queries) GetUserByID

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

func (*Queries) GetUserPreferences

func (q *Queries) GetUserPreferences(ctx context.Context, userID uuid.NullUUID) (UserPreference, error)

func (*Queries) UpdateUser

func (q *Queries) UpdateUser(ctx context.Context, arg UpdateUserParams) error

func (*Queries) UpdateUserAdminStatus

func (q *Queries) UpdateUserAdminStatus(ctx context.Context, arg UpdateUserAdminStatusParams) error

func (*Queries) UpdateUserPreferences

func (q *Queries) UpdateUserPreferences(ctx context.Context, arg UpdateUserPreferencesParams) (UserPreference, error)

func (*Queries) UpsertUser

func (q *Queries) UpsertUser(ctx context.Context, arg UpsertUserParams) (User, error)

func (*Queries) WithTx

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

type UpdateUserAdminStatusParams

type UpdateUserAdminStatusParams struct {
	Email   string       `json:"email"`
	IsAdmin sql.NullBool `json:"is_admin"`
}

type UpdateUserParams

type UpdateUserParams struct {
	ID      uuid.UUID      `json:"id"`
	Name    string         `json:"name"`
	Picture sql.NullString `json:"picture"`
}

type UpdateUserPreferencesParams

type UpdateUserPreferencesParams struct {
	UserID             uuid.NullUUID  `json:"user_id"`
	Theme              sql.NullString `json:"theme"`
	Language           sql.NullString `json:"language"`
	Timezone           sql.NullString `json:"timezone"`
	EmailNotifications sql.NullBool   `json:"email_notifications"`
	EmailBilling       sql.NullBool   `json:"email_billing"`
	PushNotifications  sql.NullBool   `json:"push_notifications"`
}

type UpsertUserParams

type UpsertUserParams struct {
	AuthID  string         `json:"auth_id"`
	Email   string         `json:"email"`
	Name    string         `json:"name"`
	Picture sql.NullString `json:"picture"`
	IsAdmin sql.NullBool   `json:"is_admin"`
}

type User

type User struct {
	ID        uuid.UUID      `json:"id"`
	AuthID    string         `json:"auth_id"`
	Email     string         `json:"email"`
	Name      string         `json:"name"`
	Picture   sql.NullString `json:"picture"`
	IsAdmin   sql.NullBool   `json:"is_admin"`
	CreatedAt sql.NullTime   `json:"created_at"`
	UpdatedAt sql.NullTime   `json:"updated_at"`
}

type UserPreference

type UserPreference struct {
	ID                 uuid.UUID      `json:"id"`
	UserID             uuid.NullUUID  `json:"user_id"`
	Theme              sql.NullString `json:"theme"`
	Language           sql.NullString `json:"language"`
	EmailNotifications sql.NullBool   `json:"email_notifications"`
	PushNotifications  sql.NullBool   `json:"push_notifications"`
	CreatedAt          sql.NullTime   `json:"created_at"`
	UpdatedAt          sql.NullTime   `json:"updated_at"`
	Timezone           sql.NullString `json:"timezone"`
	EmailBilling       sql.NullBool   `json:"email_billing"`
}

Jump to

Keyboard shortcuts

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