db

package
v0.0.0-...-10b8bc0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package db is a generated GoMock package.

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"`
	OwnerEmail string    `json:"owner_email"`
	Balance    int64     `json:"balance"`
	Currency   string    `json:"currency"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

type AccountTransactionsEntry

type AccountTransactionsEntry struct {
	Uid           uuid.UUID `json:"uid"`
	TransactionID int64     `json:"transaction_id"`
	AccountID     int64     `json:"account_id"`
	OtherAccount  int64     `json:"other_account"`
	// must be positive
	Amount    int64     `json:"amount"`
	Currency  string    `json:"currency"`
	Type      string    `json:"type"`
	CreatedAt time.Time `json:"created_at"`
}

type CreateAccountParams

type CreateAccountParams struct {
	OwnerEmail string `json:"owner_email"`
	Balance    int64  `json:"balance"`
	Currency   string `json:"currency"`
}

type CreateAccountStatementEntryParams

type CreateAccountStatementEntryParams struct {
	TransactionID int64  `json:"transaction_id"`
	AccountID     int64  `json:"account_id"`
	OtherAccount  int64  `json:"other_account"`
	Amount        int64  `json:"amount"`
	Type          string `json:"type"`
	Currency      string `json:"currency"`
}

type CreateSessionParams

type CreateSessionParams struct {
	Email        string    `json:"email"`
	UserAgent    string    `json:"user_agent"`
	ClientIp     string    `json:"client_ip"`
	RefreshToken string    `json:"refresh_token"`
	ExpiresAt    time.Time `json:"expires_at"`
}

type CreateTransferEntryParams

type CreateTransferEntryParams struct {
	TransactionID int64  `json:"transaction_id"`
	AccountID     int64  `json:"account_id"`
	OtherAccount  int64  `json:"other_account"`
	Amount        int64  `json:"amount"`
	Type          string `json:"type"`
}

type CreateTransferRecordParams

type CreateTransferRecordParams struct {
	TransactionID int64  `json:"transaction_id"`
	FromAccountID int64  `json:"from_account_id"`
	ToAccountID   int64  `json:"to_account_id"`
	Amount        int64  `json:"amount"`
	Currency      string `json:"currency"`
}

type CreateUserParams

type CreateUserParams struct {
	UserEmail    string `json:"user_email"`
	Username     string `json:"username"`
	PasswordHash string `json:"password_hash"`
	IsVerified   bool   `json:"is_verified"`
}

type CreateUserRow

type CreateUserRow struct {
	UserEmail string `json:"user_email"`
	Username  string `json:"username"`
}

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 GetUserDetailsRow

type GetUserDetailsRow struct {
	UserEmail    string `json:"user_email"`
	Username     string `json:"username"`
	PasswordHash string `json:"password_hash"`
}

type ListAccountsParams

type ListAccountsParams struct {
	Offset int32 `json:"offset"`
	Limit  int32 `json:"limit"`
}

type MockStore

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

MockStore is a mock of Store interface.

func NewMockStore

func NewMockStore(ctrl *gomock.Controller) *MockStore

NewMockStore creates a new mock instance.

func (*MockStore) CreateAccount

func (m *MockStore) CreateAccount(arg0 context.Context, arg1 CreateAccountParams) (Account, error)

CreateAccount mocks base method.

func (*MockStore) CreateAccountStatementEntry

func (m *MockStore) CreateAccountStatementEntry(arg0 context.Context, arg1 CreateAccountStatementEntryParams) (AccountTransactionsEntry, error)

CreateAccountStatementEntry mocks base method.

func (*MockStore) CreateTransferRecord

func (m *MockStore) CreateTransferRecord(arg0 context.Context, arg1 CreateTransferRecordParams) (Transaction, error)

CreateTransferRecord mocks base method.

func (*MockStore) CreateUser

func (m *MockStore) CreateUser(arg0 context.Context, arg1 CreateUserParams) (CreateUserRow, error)

CreateUser mocks base method.

func (*MockStore) DeleteAccount

func (m *MockStore) DeleteAccount(arg0 context.Context, arg1 int64) error

DeleteAccount mocks base method.

func (*MockStore) EXPECT

func (m *MockStore) EXPECT() *MockStoreMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockStore) GetAccountById

func (m *MockStore) GetAccountById(arg0 context.Context, arg1 int64) (Account, error)

GetAccountById mocks base method.

func (*MockStore) GetAccountByOwnerEmail

func (m *MockStore) GetAccountByOwnerEmail(arg0 context.Context, arg1 string) (Account, error)

GetAccountByOwnerEmail mocks base method.

func (*MockStore) GetBalanceByAccountId

func (m *MockStore) GetBalanceByAccountId(arg0 context.Context, arg1 int64) (int64, error)

GetBalanceByAccountId mocks base method.

func (*MockStore) GetBalanceByOwnerEmail

func (m *MockStore) GetBalanceByOwnerEmail(arg0 context.Context, arg1 string) (int64, error)

GetBalanceByOwnerEmail mocks base method.

func (*MockStore) GetUserDetails

func (m *MockStore) GetUserDetails(arg0 context.Context, arg1 string) (GetUserDetailsRow, error)

GetUserDetails mocks base method.

func (*MockStore) ListAccounts

func (m *MockStore) ListAccounts(arg0 context.Context, arg1 ListAccountsParams) ([]Account, error)

ListAccounts mocks base method.

func (*MockStore) UpdateAccountBalanceById

func (m *MockStore) UpdateAccountBalanceById(arg0 context.Context, arg1 UpdateAccountBalanceByIdParams) (Account, error)

UpdateAccountBalanceById mocks base method.

type MockStoreMockRecorder

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

MockStoreMockRecorder is the mock recorder for MockStore.

func (*MockStoreMockRecorder) CreateAccount

func (mr *MockStoreMockRecorder) CreateAccount(arg0, arg1 interface{}) *gomock.Call

CreateAccount indicates an expected call of CreateAccount.

func (*MockStoreMockRecorder) CreateAccountStatementEntry

func (mr *MockStoreMockRecorder) CreateAccountStatementEntry(arg0, arg1 interface{}) *gomock.Call

CreateAccountStatementEntry indicates an expected call of CreateAccountStatementEntry.

func (*MockStoreMockRecorder) CreateTransferRecord

func (mr *MockStoreMockRecorder) CreateTransferRecord(arg0, arg1 interface{}) *gomock.Call

CreateTransferRecord indicates an expected call of CreateTransferRecord.

func (*MockStoreMockRecorder) CreateUser

func (mr *MockStoreMockRecorder) CreateUser(arg0, arg1 interface{}) *gomock.Call

CreateUser indicates an expected call of CreateUser.

func (*MockStoreMockRecorder) DeleteAccount

func (mr *MockStoreMockRecorder) DeleteAccount(arg0, arg1 interface{}) *gomock.Call

DeleteAccount indicates an expected call of DeleteAccount.

func (*MockStoreMockRecorder) GetAccountById

func (mr *MockStoreMockRecorder) GetAccountById(arg0, arg1 interface{}) *gomock.Call

GetAccountById indicates an expected call of GetAccountById.

func (*MockStoreMockRecorder) GetAccountByOwnerEmail

func (mr *MockStoreMockRecorder) GetAccountByOwnerEmail(arg0, arg1 interface{}) *gomock.Call

GetAccountByOwnerEmail indicates an expected call of GetAccountByOwnerEmail.

func (*MockStoreMockRecorder) GetBalanceByAccountId

func (mr *MockStoreMockRecorder) GetBalanceByAccountId(arg0, arg1 interface{}) *gomock.Call

GetBalanceByAccountId indicates an expected call of GetBalanceByAccountId.

func (*MockStoreMockRecorder) GetBalanceByOwnerEmail

func (mr *MockStoreMockRecorder) GetBalanceByOwnerEmail(arg0, arg1 interface{}) *gomock.Call

GetBalanceByOwnerEmail indicates an expected call of GetBalanceByOwnerEmail.

func (*MockStoreMockRecorder) GetUserDetails

func (mr *MockStoreMockRecorder) GetUserDetails(arg0, arg1 interface{}) *gomock.Call

GetUserDetails indicates an expected call of GetUserDetails.

func (*MockStoreMockRecorder) ListAccounts

func (mr *MockStoreMockRecorder) ListAccounts(arg0, arg1 interface{}) *gomock.Call

ListAccounts indicates an expected call of ListAccounts.

func (*MockStoreMockRecorder) UpdateAccountBalanceById

func (mr *MockStoreMockRecorder) UpdateAccountBalanceById(arg0, arg1 interface{}) *gomock.Call

UpdateAccountBalanceById indicates an expected call of UpdateAccountBalanceById.

type Querier

type Querier interface {
	BlockSessionById(ctx context.Context, sessionID uuid.UUID) (Session, error)
	BlockSessionFamily(ctx context.Context, email string) (Session, error)
	CreateAccount(ctx context.Context, arg CreateAccountParams) (Account, error)
	CreateAccountStatementEntry(ctx context.Context, arg CreateAccountStatementEntryParams) (AccountTransactionsEntry, error)
	CreateSession(ctx context.Context, arg CreateSessionParams) (Session, error)
	CreateTransferRecord(ctx context.Context, arg CreateTransferRecordParams) (Transaction, error)
	CreateUser(ctx context.Context, arg CreateUserParams) (CreateUserRow, error)
	DeleteAccount(ctx context.Context, id int64) error
	GetAccountById(ctx context.Context, id int64) (Account, error)
	GetAccountByOwnerEmail(ctx context.Context, ownerEmail string) (Account, error)
	GetBalanceByAccountId(ctx context.Context, id int64) (int64, error)
	GetBalanceByOwnerEmail(ctx context.Context, ownerEmail string) (int64, error)
	GetSession(ctx context.Context, sessionID uuid.UUID) (Session, error)
	GetTransaction(ctx context.Context, uid uuid.UUID) (Transaction, error)
	GetTransactionsList(ctx context.Context) ([]Transaction, error)
	GetUserDetails(ctx context.Context, userEmail string) (GetUserDetailsRow, error)
	ListAccounts(ctx context.Context, arg ListAccountsParams) ([]Account, error)
	UpdateAccountBalanceById(ctx context.Context, arg UpdateAccountBalanceByIdParams) (Account, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) BlockSessionById

func (q *Queries) BlockSessionById(ctx context.Context, sessionID uuid.UUID) (Session, error)

func (*Queries) BlockSessionFamily

func (q *Queries) BlockSessionFamily(ctx context.Context, email string) (Session, error)

func (*Queries) CreateAccount

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

func (*Queries) CreateAccountStatementEntry

func (q *Queries) CreateAccountStatementEntry(ctx context.Context, arg CreateAccountStatementEntryParams) (AccountTransactionsEntry, error)

func (*Queries) CreateSession

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

func (*Queries) CreateTransferEntry

func (q *Queries) CreateTransferEntry(ctx context.Context, arg CreateTransferEntryParams) (AccountTransactionsEntry, error)

func (*Queries) CreateTransferRecord

func (q *Queries) CreateTransferRecord(ctx context.Context, arg CreateTransferRecordParams) (Transaction, error)

func (*Queries) CreateUser

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

func (*Queries) DeleteAccount

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

func (*Queries) GetAccountById

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

func (*Queries) GetAccountByOwnerEmail

func (q *Queries) GetAccountByOwnerEmail(ctx context.Context, ownerEmail string) (Account, error)

func (*Queries) GetBalanceByAccountId

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

func (*Queries) GetBalanceByOwnerEmail

func (q *Queries) GetBalanceByOwnerEmail(ctx context.Context, ownerEmail string) (int64, error)

func (*Queries) GetSession

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

func (*Queries) GetTransaction

func (q *Queries) GetTransaction(ctx context.Context, uid uuid.UUID) (Transaction, error)

func (*Queries) GetTransactionsList

func (q *Queries) GetTransactionsList(ctx context.Context) ([]Transaction, error)

func (*Queries) GetUserDetails

func (q *Queries) GetUserDetails(ctx context.Context, userEmail string) (GetUserDetailsRow, error)

func (*Queries) ListAccounts

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

func (*Queries) UpdateAccountBalanceById

func (q *Queries) UpdateAccountBalanceById(ctx context.Context, arg UpdateAccountBalanceByIdParams) (Account, error)

func (*Queries) WithTx

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

type Session

type Session struct {
	SessionID    uuid.UUID `json:"session_id"`
	Email        string    `json:"email"`
	UserAgent    string    `json:"user_agent"`
	ClientIp     string    `json:"client_ip"`
	RefreshToken string    `json:"refresh_token"`
	ExpiresAt    time.Time `json:"expires_at"`
	IsBlocked    bool      `json:"is_blocked"`
	CreatedAt    time.Time `json:"created_at"`
}

type Transaction

type Transaction struct {
	Uid           uuid.UUID `json:"uid"`
	TransactionID int64     `json:"transaction_id"`
	FromAccountID int64     `json:"from_account_id"`
	ToAccountID   int64     `json:"to_account_id"`
	// can be negative depending on debit or credit
	Amount    int64     `json:"amount"`
	Currency  string    `json:"currency"`
	CreatedAt time.Time `json:"created_at"`
}

type UpdateAccountBalanceByIdParams

type UpdateAccountBalanceByIdParams struct {
	ID      int64 `json:"id"`
	Balance int64 `json:"balance"`
}

type User

type User struct {
	UserID       int64     `json:"user_id"`
	Username     string    `json:"username"`
	UserEmail    string    `json:"user_email"`
	PasswordHash string    `json:"password_hash"`
	IsVerified   bool      `json:"is_verified"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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