queries

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 8 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              uuid.UUID `db:"id" json:"id"`
	AccountType     string    `db:"account_type" json:"account_type"`
	CustomerName    string    `db:"customer_name" json:"customer_name"`
	DocumentNumber  string    `db:"document_number" json:"document_number"`
	Email           string    `db:"email" json:"email"`
	PasswordEncoded string    `db:"password_encoded" json:"password_encoded"`
	PhoneNumber     string    `db:"phone_number" json:"phone_number"`
	Status          string    `db:"status" json:"status"`
	CreatedAt       time.Time `db:"created_at" json:"created_at"`
	UpdatedAt       time.Time `db:"updated_at" json:"updated_at"`
}

type FindAccountRow

type FindAccountRow struct {
	Account
	Transactions json.RawMessage `db:"transactions"`
}

type Queries

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

func New

func New(db *sqlx.DB) *Queries

func (*Queries) FindAccountByEmail

func (q *Queries) FindAccountByEmail(ctx context.Context, email string) (*FindAccountRow, error)

func (*Queries) FindAccountByID

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

func (*Queries) FindAll

func (q *Queries) FindAll(ctx context.Context) ([]*FindAccountRow, error)

func (*Queries) FindResumeAccount

func (q *Queries) FindResumeAccount(ctx context.Context, email string) (*ResumeAccount, error)

func (*Queries) SaveAccount

func (q *Queries) SaveAccount(ctx context.Context, params SaveAccountParams) error

func (*Queries) SaveTransaction

func (q *Queries) SaveTransaction(ctx context.Context, params SaveTransactionParams) error

func (*Queries) SetSnapshotTransactions

func (q *Queries) SetSnapshotTransactions(ctx context.Context, snapshotID uuid.UUID, transactionIDs uuid.UUIDs) error

func (*Queries) WithTx

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

type Query

type Query interface {
	GetContext(context.Context, any, string, ...any) error
	SelectContext(context.Context, any, string, ...any) error
	ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}

type ResumeAccount

type ResumeAccount struct {
	ID          uuid.UUID `db:"id" json:"id"`
	AccountType string    `db:"account_type" json:"account_type"`
	Status      string    `db:"status" json:"status"`
	Email       string    `db:"email" json:"email"`
	Password    string    `db:"password_encoded" json:"password_encoded"`
}

type SaveAccountParams

type SaveAccountParams struct {
	ID              uuid.UUID `db:"id" json:"id"`
	AccountType     string    `db:"account_type" json:"account_type"`
	CustomerName    string    `db:"customer_name" json:"customer_name"`
	DocumentNumber  string    `db:"document_number" json:"document_number"`
	Email           string    `db:"email" json:"email"`
	PasswordEncoded string    `db:"password_encoded" json:"password_encoded"`
	PhoneNumber     string    `db:"phone_number" json:"phone_number"`
	Status          string    `db:"status" json:"status"`
	CreatedAt       time.Time `db:"created_at" json:"created_at"`
	UpdatedAt       time.Time `db:"updated_at" json:"updated_at"`
}

type SaveTransactionParams

type SaveTransactionParams struct {
	ID              uuid.UUID     `db:"id" json:"id"`
	CorrelatedID    uuid.NullUUID `db:"correlated_id" json:"correlated_id"`
	AccountID       uuid.UUID     `db:"account_id" json:"account_id"`
	TransactionType string        `db:"transaction_type" json:"transaction_type"`
	Timestamp       time.Time     `db:"timestamp" json:"timestamp"`
	Amount          int64         `db:"amount" json:"amount"`
	SnapshotID      uuid.NullUUID `db:"snapshot_id" json:"snapshot_id"`
}

type Transaction

type Transaction struct {
	ID              uuid.UUID     `db:"id" json:"id"`
	AccountID       uuid.UUID     `db:"account_type" json:"account_type"`
	CorrelatedID    uuid.NullUUID `db:"correlated_id" json:"correlated_id"`
	Timestamp       time.Time     `db:"timestamp" json:"timestamp"`
	TransactionType string        `db:"transaction_type" json:"transaction_type"`
	Amount          int64         `db:"amount" json:"amount"`
	SnapshotID      uuid.NullUUID `db:"snapshot_id" json:"snapshot_id"`
}

Jump to

Keyboard shortcuts

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