sqlc

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: MIT Imports: 6 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 {
	Email                 string    `json:"email"`
	Username              string    `json:"username"`
	Password              string    `json:"password"`
	Firstname             string    `json:"firstname"`
	Lastname              string    `json:"lastname"`
	AllowedIps            []string  `json:"allowed_ips"`
	LastVerifySentAt      time.Time `json:"last_verify_sent_at"`
	LastRecoverySentAt    time.Time `json:"last_recovery_sent_at"`
	LastEmailchangeSentAt time.Time `json:"last_emailchange_sent_at"`
}

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 Querier

type Querier interface {
	CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
	DeleteUser(ctx context.Context, id uuid.UUID) error
	ReadUserByEmail(ctx context.Context, email string) (User, error)
	ReadUserByID(ctx context.Context, id uuid.UUID) (User, error)
	ReadUserByUsername(ctx context.Context, username string) (User, error)
	ReadUsers(ctx context.Context, arg ReadUsersParams) ([]User, error)
	UpdateUser(ctx context.Context, arg UpdateUserParams) (User, error)
	UpdateUserAllowIP(ctx context.Context, arg UpdateUserAllowIPParams) error
	UpdateUserAllowIPToken(ctx context.Context, arg UpdateUserAllowIPTokenParams) error
	UpdateUserDeleteToken(ctx context.Context, arg UpdateUserDeleteTokenParams) error
	UpdateUserEmailChangeToken(ctx context.Context, arg UpdateUserEmailChangeTokenParams) error
	UpdateUserEmailVerified(ctx context.Context, arg UpdateUserEmailVerifiedParams) error
	UpdateUserRecoveryToken(ctx context.Context, arg UpdateUserRecoveryTokenParams) error
	UpdateUserResetPassword(ctx context.Context, arg UpdateUserResetPasswordParams) error
	UpdateUserVerifyToken(ctx context.Context, arg UpdateUserVerifyTokenParams) error
}

type QuerierExtended

type QuerierExtended interface {
	UpdateUserVerifyTokenTx(ctx context.Context, arg UpdateUserVerifyTokenTxParams) error
	UpdateUserEmailVerifiedTx(ctx context.Context, arg UpdateUserEmailVerifiedTxParams) error

	UpdateUserRecoveryTokenTx(ctx context.Context, arg UpdateUserRecoveryTokenTxParams) error
	UpdateUserResetPasswordTx(ctx context.Context, arg UpdateUserResetPasswordTxParams) error

	UpdateUserDeleteTokenTx(ctx context.Context, arg UpdateUserDeleteTokenTxParams) error
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateUser

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

func (*Queries) DeleteUser

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

func (*Queries) ReadUserByEmail

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

func (*Queries) ReadUserByID

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

func (*Queries) ReadUserByUsername

func (q *Queries) ReadUserByUsername(ctx context.Context, username string) (User, error)

func (*Queries) ReadUsers

func (q *Queries) ReadUsers(ctx context.Context, arg ReadUsersParams) ([]User, error)

func (*Queries) UpdateUser

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

func (*Queries) UpdateUserAllowIP

func (q *Queries) UpdateUserAllowIP(ctx context.Context, arg UpdateUserAllowIPParams) error

func (*Queries) UpdateUserAllowIPToken

func (q *Queries) UpdateUserAllowIPToken(ctx context.Context, arg UpdateUserAllowIPTokenParams) error

func (*Queries) UpdateUserDeleteToken

func (q *Queries) UpdateUserDeleteToken(ctx context.Context, arg UpdateUserDeleteTokenParams) error

func (*Queries) UpdateUserEmailChangeToken

func (q *Queries) UpdateUserEmailChangeToken(ctx context.Context, arg UpdateUserEmailChangeTokenParams) error

func (*Queries) UpdateUserEmailVerified

func (q *Queries) UpdateUserEmailVerified(ctx context.Context, arg UpdateUserEmailVerifiedParams) error

func (*Queries) UpdateUserRecoveryToken

func (q *Queries) UpdateUserRecoveryToken(ctx context.Context, arg UpdateUserRecoveryTokenParams) error

func (*Queries) UpdateUserResetPassword

func (q *Queries) UpdateUserResetPassword(ctx context.Context, arg UpdateUserResetPasswordParams) error

func (*Queries) UpdateUserVerifyToken

func (q *Queries) UpdateUserVerifyToken(ctx context.Context, arg UpdateUserVerifyTokenParams) error

func (*Queries) WithTx

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

type ReadUsersParams

type ReadUsersParams struct {
	Offset sql.NullInt32 `json:"offset"`
	Limit  sql.NullInt32 `json:"limit"`
}

type SQLStore

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

func (*SQLStore) UpdateUserDeleteTokenTx

func (store *SQLStore) UpdateUserDeleteTokenTx(ctx context.Context, arg UpdateUserDeleteTokenTxParams) error

func (*SQLStore) UpdateUserEmailVerifiedTx

func (store *SQLStore) UpdateUserEmailVerifiedTx(ctx context.Context, arg UpdateUserEmailVerifiedTxParams) error

func (*SQLStore) UpdateUserRecoveryTokenTx

func (store *SQLStore) UpdateUserRecoveryTokenTx(ctx context.Context, arg UpdateUserRecoveryTokenTxParams) error

func (*SQLStore) UpdateUserResetPasswordTx

func (store *SQLStore) UpdateUserResetPasswordTx(ctx context.Context, arg UpdateUserResetPasswordTxParams) error

func (*SQLStore) UpdateUserVerifyTokenTx

func (store *SQLStore) UpdateUserVerifyTokenTx(ctx context.Context, arg UpdateUserVerifyTokenTxParams) error

type Store

type Store interface {
	Querier
	QuerierExtended
}

func NewStore

func NewStore(db *sql.DB) Store

type UpdateUserAllowIPParams

type UpdateUserAllowIPParams struct {
	AllowedIps   []string  `json:"allowed_ips"`
	AllowipToken string    `json:"allowip_token"`
	ID           uuid.UUID `json:"id"`
}

type UpdateUserAllowIPTokenParams

type UpdateUserAllowIPTokenParams struct {
	AllowipToken string    `json:"allowip_token"`
	ID           uuid.UUID `json:"id"`
}

type UpdateUserDeleteTokenParams

type UpdateUserDeleteTokenParams struct {
	DeleteToken      string    `json:"delete_token"`
	LastDeleteSentAt time.Time `json:"last_delete_sent_at"`
	ID               uuid.UUID `json:"id"`
}

type UpdateUserDeleteTokenTxParams

type UpdateUserDeleteTokenTxParams struct {
	UpdateUserDeleteTokenParams
	BeforeUpdate func() error
}

type UpdateUserEmailChangeTokenParams

type UpdateUserEmailChangeTokenParams struct {
	EmailchangeToken      string    `json:"emailchange_token"`
	LastEmailchangeSentAt time.Time `json:"last_emailchange_sent_at"`
	ID                    uuid.UUID `json:"id"`
}

type UpdateUserEmailVerifiedParams

type UpdateUserEmailVerifiedParams struct {
	EmailVerified bool      `json:"email_verified"`
	VerifyToken   string    `json:"verify_token"`
	ID            uuid.UUID `json:"id"`
}

type UpdateUserEmailVerifiedTxParams

type UpdateUserEmailVerifiedTxParams struct {
	UpdateUserEmailVerifiedParams
	AfterUpdate func() error
}

type UpdateUserParams

type UpdateUserParams struct {
	Username  string    `json:"username"`
	Password  string    `json:"password"`
	Firstname string    `json:"firstname"`
	Lastname  string    `json:"lastname"`
	ID        uuid.UUID `json:"id"`
}

type UpdateUserRecoveryTokenParams

type UpdateUserRecoveryTokenParams struct {
	RecoveryToken      string    `json:"recovery_token"`
	LastRecoverySentAt time.Time `json:"last_recovery_sent_at"`
	ID                 uuid.UUID `json:"id"`
}

type UpdateUserRecoveryTokenTxParams

type UpdateUserRecoveryTokenTxParams struct {
	UpdateUserRecoveryTokenParams
	BeforeUpdate func() error
}

type UpdateUserResetPasswordParams

type UpdateUserResetPasswordParams struct {
	Password      string    `json:"password"`
	RecoveryToken string    `json:"recovery_token"`
	ID            uuid.UUID `json:"id"`
}

type UpdateUserResetPasswordTxParams

type UpdateUserResetPasswordTxParams struct {
	UpdateUserResetPasswordParams
	BeforeUpdate func() error
}

type UpdateUserVerifyTokenParams

type UpdateUserVerifyTokenParams struct {
	VerifyToken      string    `json:"verify_token"`
	LastVerifySentAt time.Time `json:"last_verify_sent_at"`
	ID               uuid.UUID `json:"id"`
}

type UpdateUserVerifyTokenTxParams

type UpdateUserVerifyTokenTxParams struct {
	UpdateUserVerifyTokenParams
	BeforeUpdate func() error
}

type User

type User struct {
	// account id
	ID uuid.UUID `json:"id"`
	// unique email address
	Email string `json:"email"`
	// unique username
	Username string `json:"username"`
	// hashed password
	Password string `json:"password"`
	// first name
	Firstname string `json:"firstname"`
	// last name
	Lastname string `json:"lastname"`
	// email verified status
	EmailVerified bool `json:"email_verified"`
	// short lived email verification token
	VerifyToken string `json:"verify_token"`
	// last verification token sent at timestamp
	LastVerifySentAt time.Time `json:"last_verify_sent_at"`
	// short lived password recovery token
	RecoveryToken string `json:"recovery_token"`
	// last password recovery token sent at timestamp
	LastRecoverySentAt time.Time `json:"last_recovery_sent_at"`
	// short lived email change token
	EmailchangeToken string `json:"emailchange_token"`
	// last change email token sent at timestamp
	LastEmailchangeSentAt time.Time `json:"last_emailchange_sent_at"`
	// list of all allowed ip address to access this row
	AllowedIps []string `json:"allowed_ips"`
	// short lived allowip token for allowing new ipaddress
	AllowipToken string `json:"allowip_token"`
	// short lived account deletion token
	DeleteToken string `json:"delete_token"`
	// last deletion token sent at timestamp
	LastDeleteSentAt time.Time `json:"last_delete_sent_at"`
	// created at timestamp
	CreatedAt time.Time `json:"created_at"`
	// last updated at timestamp
	UpdatedAt time.Time `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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