db

package
v0.0.0-...-6844190 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeEmailParams

type ChangeEmailParams struct {
	Email string `json:"email"`
	ID    int64  `json:"id"`
}

type ChangePasswordParams

type ChangePasswordParams struct {
	HashedPassword string `json:"hashed_password"`
	Email          string `json:"email"`
}

type CreateReminderParams

type CreateReminderParams struct {
	UserID     int64           `json:"user_id"`
	WebsiteUrl string          `json:"website_url"`
	Interval   string          `json:"interval"`
	Extension  json.RawMessage `json:"extension"`
}

type CreateSessionParams

type CreateSessionParams struct {
	ID           uuid.UUID `json:"id"`
	UserID       int64     `json:"user_id"`
	RefreshToken string    `json:"refresh_token"`
	UserAgent    string    `json:"user_agent"`
	ClientIp     string    `json:"client_ip"`
	IsBlocked    bool      `json:"is_blocked"`
	ExpiresAt    time.Time `json:"expires_at"`
}

type CreateUserParams

type CreateUserParams struct {
	FullName       string `json:"full_name"`
	HashedPassword string `json:"hashed_password"`
	Email          string `json:"email"`
}

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 DeactivateUserParams

type DeactivateUserParams struct {
	ID    int64  `json:"id"`
	Email string `json:"email"`
}

type DeleteReminderParams

type DeleteReminderParams struct {
	ID         int64  `json:"id"`
	WebsiteUrl string `json:"website_url"`
}

type GetReminderConfigsParams

type GetReminderConfigsParams struct {
	ID         int64  `json:"id"`
	WebsiteUrl string `json:"website_url"`
}

type GetReminderParams

type GetReminderParams struct {
	ID         int64  `json:"id"`
	WebsiteUrl string `json:"website_url"`
}

type ListRemindersParams

type ListRemindersParams struct {
	UserID int64 `json:"user_id"`
	Limit  int32 `json:"limit"`
	Offset int32 `json:"offset"`
}

type Querier

type Querier interface {
	ChangeEmail(ctx context.Context, arg ChangeEmailParams) (User, error)
	ChangePassword(ctx context.Context, arg ChangePasswordParams) (User, error)
	CreateReminder(ctx context.Context, arg CreateReminderParams) (Reminder, error)
	CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error)
	CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
	DeactivateUser(ctx context.Context, arg DeactivateUserParams) (User, error)
	DeleteReminder(ctx context.Context, arg DeleteReminderParams) error
	GetReminder(ctx context.Context, arg GetReminderParams) (Reminder, error)
	GetReminderConfigs(ctx context.Context, arg GetReminderConfigsParams) (json.RawMessage, error)
	GetSession(ctx context.Context, id uuid.UUID) (Session, error)
	GetUser(ctx context.Context, userID int64) (User, error)
	ListReminders(ctx context.Context, arg ListRemindersParams) ([]Reminder, error)
	SetNewInterval(ctx context.Context, arg SetNewIntervalParams) (Reminder, error)
	SetReminderConfigs(ctx context.Context, arg SetReminderConfigsParams) (Reminder, error)
	UpdateReminder(ctx context.Context, arg UpdateReminderParams) (Reminder, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) ChangeEmail

func (q *Queries) ChangeEmail(ctx context.Context, arg ChangeEmailParams) (User, error)

func (*Queries) ChangePassword

func (q *Queries) ChangePassword(ctx context.Context, arg ChangePasswordParams) (User, error)

func (*Queries) CreateReminder

func (q *Queries) CreateReminder(ctx context.Context, arg CreateReminderParams) (Reminder, error)

func (*Queries) CreateSession

func (q *Queries) CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error)

func (*Queries) CreateUser

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

func (*Queries) DeactivateUser

func (q *Queries) DeactivateUser(ctx context.Context, arg DeactivateUserParams) (User, error)

func (*Queries) DeleteReminder

func (q *Queries) DeleteReminder(ctx context.Context, arg DeleteReminderParams) error

func (*Queries) GetReminder

func (q *Queries) GetReminder(ctx context.Context, arg GetReminderParams) (Reminder, error)

func (*Queries) GetReminderConfigs

func (q *Queries) GetReminderConfigs(ctx context.Context, arg GetReminderConfigsParams) (json.RawMessage, error)

func (*Queries) GetSession

func (q *Queries) GetSession(ctx context.Context, id uuid.UUID) (Session, error)

func (*Queries) GetUser

func (q *Queries) GetUser(ctx context.Context, userID int64) (User, error)

func (*Queries) ListReminders

func (q *Queries) ListReminders(ctx context.Context, arg ListRemindersParams) ([]Reminder, error)

func (*Queries) SetNewInterval

func (q *Queries) SetNewInterval(ctx context.Context, arg SetNewIntervalParams) (Reminder, error)

func (*Queries) SetReminderConfigs

func (q *Queries) SetReminderConfigs(ctx context.Context, arg SetReminderConfigsParams) (Reminder, error)

func (*Queries) UpdateReminder

func (q *Queries) UpdateReminder(ctx context.Context, arg UpdateReminderParams) (Reminder, error)

func (*Queries) WithTx

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

type Reminder

type Reminder struct {
	ID         int64           `json:"id"`
	UserID     int64           `json:"user_id"`
	WebsiteUrl string          `json:"website_url"`
	Interval   string          `json:"interval"`
	UpdatedAt  time.Time       `json:"updated_at"`
	Extension  json.RawMessage `json:"extension"`
}

type Session

type Session struct {
	ID           uuid.UUID `json:"id"`
	UserID       int64     `json:"user_id"`
	RefreshToken string    `json:"refresh_token"`
	UserAgent    string    `json:"user_agent"`
	ClientIp     string    `json:"client_ip"`
	IsBlocked    bool      `json:"is_blocked"`
	ExpiresAt    time.Time `json:"expires_at"`
	CreatedAt    time.Time `json:"created_at"`
}

type SetNewIntervalParams

type SetNewIntervalParams struct {
	NewInterval string `json:"new_interval"`
	ID          int64  `json:"id"`
	WebsiteUrl  string `json:"website_url"`
}

type SetReminderConfigsParams

type SetReminderConfigsParams struct {
	UpdatedExtension json.RawMessage `json:"updated_extension"`
	ID               int64           `json:"id"`
	WebsiteUrl       string          `json:"website_url"`
}

type UpdateReminderParams

type UpdateReminderParams struct {
	UpdatedAt  time.Time `json:"updated_at"`
	ID         int64     `json:"id"`
	WebsiteUrl string    `json:"website_url"`
}

type User

type User struct {
	ID                int64     `json:"id"`
	FullName          string    `json:"full_name"`
	HashedPassword    string    `json:"hashed_password"`
	Email             string    `json:"email"`
	PasswordChangedAt time.Time `json:"password_changed_at"`
	CreatedAt         time.Time `json:"created_at"`
	IsActivated       bool      `json:"is_activated"`
}

Jump to

Keyboard shortcuts

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