db_generated

package
v0.0.0-...-8414c70 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID        int64     `json:"id"`
	Owner     string    `json:"owner"`
	Name      string    `json:"name"`
	Balance   int64     `json:"balance"`
	Currency  string    `json:"currency"`
	CreatedAt time.Time `json:"created_at"`
}

type CreateAccountParams

type CreateAccountParams struct {
	Owner    string `json:"owner"`
	Name     string `json:"name"`
	Balance  int64  `json:"balance"`
	Currency string `json:"currency"`
}

type CreateEntryParams

type CreateEntryParams struct {
	AccountID int64 `json:"account_id"`
	Amount    int64 `json:"amount"`
}

type CreateFriendParams

type CreateFriendParams struct {
	FromAccountID int64 `json:"from_account_id"`
	ToAccountID   int64 `json:"to_account_id"`
}

type CreateTransferParams

type CreateTransferParams struct {
	FromAccountID int64 `json:"from_account_id"`
	ToAccountID   int64 `json:"to_account_id"`
	Amount        int64 `json:"amount"`
}

type CreateUserParams

type CreateUserParams struct {
	Username       string      `json:"username"`
	HashedPassword string      `json:"hashed_password"`
	Email          pgtype.Text `json:"email"`
}

type CreateVerifyEmailParams

type CreateVerifyEmailParams struct {
	Username   string `json:"username"`
	Email      string `json:"email"`
	SecretCode string `json:"secret_code"`
}

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 Entry

type Entry struct {
	ID        int64 `json:"id"`
	AccountID int64 `json:"account_id"`
	// can be negative or positive
	Amount    int64     `json:"amount"`
	CreatedAt time.Time `json:"created_at"`
}

type Friendship

type Friendship struct {
	ID            int64     `json:"id"`
	FromAccountID int64     `json:"from_account_id"`
	ToAccountID   int64     `json:"to_account_id"`
	Status        string    `json:"status"`
	CreatedAt     time.Time `json:"created_at"`
}

type ListAccountsParams

type ListAccountsParams struct {
	Limit  int32       `json:"limit"`
	Offset int32       `json:"offset"`
	Owner  pgtype.Text `json:"owner"`
}

type ListEntriesParams

type ListEntriesParams struct {
	Limit     int32            `json:"limit"`
	Offset    int32            `json:"offset"`
	AccountID pgtype.Int8      `json:"account_id"`
	StartDate pgtype.Timestamp `json:"start_date"`
	EndDate   pgtype.Timestamp `json:"end_date"`
}

type ListFriendsParams

type ListFriendsParams struct {
	Limit         int32       `json:"limit"`
	Offset        int32       `json:"offset"`
	FromAccountID pgtype.Int8 `json:"from_account_id"`
	ToAccountID   pgtype.Int8 `json:"to_account_id"`
	Status        pgtype.Text `json:"status"`
}

type ListTransfersParams

type ListTransfersParams struct {
	FromAccountID int64 `json:"from_account_id"`
	Limit         int32 `json:"limit"`
	Offset        int32 `json:"offset"`
}

type Querier

type Querier interface {
	CreateAccount(ctx context.Context, arg CreateAccountParams) (Account, error)
	CreateEntry(ctx context.Context, arg CreateEntryParams) (Entry, error)
	CreateFriend(ctx context.Context, arg CreateFriendParams) (Friendship, error)
	CreateTransfer(ctx context.Context, arg CreateTransferParams) (Transfer, error)
	CreateUser(ctx context.Context, arg CreateUserParams) (User, error)
	CreateVerifyEmail(ctx context.Context, arg CreateVerifyEmailParams) (VerifyEmail, error)
	DeleteAccount(ctx context.Context, id int64) error
	GetAccount(ctx context.Context, id int64) (Account, error)
	GetAccountForUpdate(ctx context.Context, id int64) (Account, error)
	GetEntry(ctx context.Context, id int64) (Entry, error)
	GetFriend(ctx context.Context, id int64) (Friendship, error)
	GetTransfer(ctx context.Context, id int64) (Transfer, error)
	GetUser(ctx context.Context, username string) (User, error)
	ListAccounts(ctx context.Context, arg ListAccountsParams) ([]Account, error)
	ListEntries(ctx context.Context, arg ListEntriesParams) ([]Entry, error)
	ListFriends(ctx context.Context, arg ListFriendsParams) ([]Friendship, error)
	ListTransfers(ctx context.Context, arg ListTransfersParams) ([]Transfer, error)
	UpdateAccountBalance(ctx context.Context, arg UpdateAccountBalanceParams) (Account, error)
	UpdateAccountName(ctx context.Context, arg UpdateAccountNameParams) (Account, error)
	UpdateFriend(ctx context.Context, arg UpdateFriendParams) (Friendship, error)
	UpdateUser(ctx context.Context, arg UpdateUserParams) (User, error)
	UpdateVerifyEmail(ctx context.Context, arg UpdateVerifyEmailParams) (VerifyEmail, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateAccount

func (q *Queries) CreateAccount(ctx context.Context, arg CreateAccountParams) (Account, error)

func (*Queries) CreateEntry

func (q *Queries) CreateEntry(ctx context.Context, arg CreateEntryParams) (Entry, error)

func (*Queries) CreateFriend

func (q *Queries) CreateFriend(ctx context.Context, arg CreateFriendParams) (Friendship, error)

func (*Queries) CreateTransfer

func (q *Queries) CreateTransfer(ctx context.Context, arg CreateTransferParams) (Transfer, error)

func (*Queries) CreateUser

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

func (*Queries) CreateVerifyEmail

func (q *Queries) CreateVerifyEmail(ctx context.Context, arg CreateVerifyEmailParams) (VerifyEmail, error)

func (*Queries) DeleteAccount

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

func (*Queries) GetAccount

func (q *Queries) GetAccount(ctx context.Context, id int64) (Account, error)

func (*Queries) GetAccountForUpdate

func (q *Queries) GetAccountForUpdate(ctx context.Context, id int64) (Account, error)

func (*Queries) GetEntry

func (q *Queries) GetEntry(ctx context.Context, id int64) (Entry, error)

func (*Queries) GetFriend

func (q *Queries) GetFriend(ctx context.Context, id int64) (Friendship, error)

func (*Queries) GetTransfer

func (q *Queries) GetTransfer(ctx context.Context, id int64) (Transfer, error)

func (*Queries) GetUser

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

func (*Queries) ListAccounts

func (q *Queries) ListAccounts(ctx context.Context, arg ListAccountsParams) ([]Account, error)

func (*Queries) ListEntries

func (q *Queries) ListEntries(ctx context.Context, arg ListEntriesParams) ([]Entry, error)

func (*Queries) ListFriends

func (q *Queries) ListFriends(ctx context.Context, arg ListFriendsParams) ([]Friendship, error)

func (*Queries) ListTransfers

func (q *Queries) ListTransfers(ctx context.Context, arg ListTransfersParams) ([]Transfer, error)

func (*Queries) UpdateAccountBalance

func (q *Queries) UpdateAccountBalance(ctx context.Context, arg UpdateAccountBalanceParams) (Account, error)

func (*Queries) UpdateAccountName

func (q *Queries) UpdateAccountName(ctx context.Context, arg UpdateAccountNameParams) (Account, error)

func (*Queries) UpdateFriend

func (q *Queries) UpdateFriend(ctx context.Context, arg UpdateFriendParams) (Friendship, error)

func (*Queries) UpdateUser

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

func (*Queries) UpdateVerifyEmail

func (q *Queries) UpdateVerifyEmail(ctx context.Context, arg UpdateVerifyEmailParams) (VerifyEmail, error)

func (*Queries) WithTx

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

type Transfer

type Transfer struct {
	ID            int64 `json:"id"`
	FromAccountID int64 `json:"from_account_id"`
	ToAccountID   int64 `json:"to_account_id"`
	// must be positive
	Amount    int64     `json:"amount"`
	CreatedAt time.Time `json:"created_at"`
}

type UpdateAccountBalanceParams

type UpdateAccountBalanceParams struct {
	Amount int64 `json:"amount"`
	ID     int64 `json:"id"`
}

type UpdateAccountNameParams

type UpdateAccountNameParams struct {
	ID   int64  `json:"id"`
	Name string `json:"name"`
}

type UpdateFriendParams

type UpdateFriendParams struct {
	ID     int64  `json:"id"`
	Status string `json:"status"`
}

type UpdateUserParams

type UpdateUserParams struct {
	HashedPassword    pgtype.Text        `json:"hashed_password"`
	PasswordChangedAt pgtype.Timestamptz `json:"password_changed_at"`
	Email             pgtype.Text        `json:"email"`
	IsEmailVerified   pgtype.Bool        `json:"is_email_verified"`
	Username          string             `json:"username"`
}

type UpdateVerifyEmailParams

type UpdateVerifyEmailParams struct {
	ID         int64  `json:"id"`
	SecretCode string `json:"secret_code"`
}

type User

type User struct {
	Username          string      `json:"username"`
	Email             pgtype.Text `json:"email"`
	HashedPassword    string      `json:"hashed_password"`
	PasswordChangedAt time.Time   `json:"password_changed_at"`
	CreatedAt         time.Time   `json:"created_at"`
	IsEmailVerified   bool        `json:"is_email_verified"`
}

type VerifyEmail

type VerifyEmail struct {
	ID         int64     `json:"id"`
	Username   string    `json:"username"`
	Email      string    `json:"email"`
	SecretCode string    `json:"secret_code"`
	IsUsed     bool      `json:"is_used"`
	CreatedAt  time.Time `json:"created_at"`
	ExpiredAt  time.Time `json:"expired_at"`
}

Jump to

Keyboard shortcuts

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