model

package
v0.0.0-...-693896e Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BankAccountColumnID represents the corresponding column in Bank Account table
	BankAccountColumnID filter.Field = "bank_accounts.entity_id"
	// BankAccountColumnAccountName represents the corresponding column in Bank Account table
	BankAccountColumnAccountName filter.Field = "bank_accounts.account_name"
	// BankAccountColumnBankName represents the corresponding column in Bank Account table
	BankAccountColumnBankName filter.Field = "bank_accounts.bank_name"
	// BankAccountColumnAccountHolderName represents the corresponding column in Bank Account table
	BankAccountColumnAccountHolderName filter.Field = "bank_accounts.account_holder_name"
	// BankAccountColumnAccountNumber represents the corresponding column in Bank Account table
	BankAccountColumnAccountNumber filter.Field = "bank_accounts.account_number"
	// BankAccountColumnLastBalance represents the corresponding column in Bank Account table
	BankAccountColumnLastBalance filter.Field = "bank_accounts.last_balance"
	// BankAccountColumnLastBalanceDate represents the corresponding column in Bank Account table
	BankAccountColumnLastBalanceDate filter.Field = "bank_accounts.last_balance_date"
	// BankAccountColumnStatus represents the corresponding column in Bank Account table
	BankAccountColumnStatus filter.Field = "bank_accounts.status"
	// BankAccountColumnCreated represents the corresponding column in Bank Account table
	BankAccountColumnCreated filter.Field = "bank_accounts.created"
	// BankAccountColumnCreatedBy represents the corresponding column in Bank Account table
	BankAccountColumnCreatedBy filter.Field = "bank_accounts.created_by"
	// BankAccountColumnUpdated represents the corresponding column in Bank Account table
	BankAccountColumnUpdated filter.Field = "bank_accounts.updated"
	// BankAccountColumnUpdatedBy represents the corresponding column in Bank Account table
	BankAccountColumnUpdatedBy filter.Field = "bank_accounts.updated_by"
	// BankAccountColumnDeleted represents the corresponding column in Bank Account table
	BankAccountColumnDeleted filter.Field = "bank_accounts.deleted"
	// BankAccountColumnDeletedBy represents the corresponding column in Bank Account table
	BankAccountColumnDeletedBy filter.Field = "bank_accounts.deleted_by"
)
View Source
const (
	// BankAccountBalanceColumnID represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnID filter.Field = "bank_account_balances.entity_id"
	// BankAccountBalanceColumnBankAccountID represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnBankAccountID filter.Field = "bank_account_balances.bank_account_entity_id"
	// BankAccountBalanceColumnDate represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnDate filter.Field = "bank_account_balances.date"
	// BankAccountBalanceColumnBalance represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnBalance filter.Field = "bank_account_balances.balance"
	// BankAccountBalanceColumnCreated represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnCreated filter.Field = "bank_account_balances.created"
	// BankAccountBalanceColumnCreatedBy represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnCreatedBy filter.Field = "bank_account_balances.created_by"
	// BankAccountBalanceColumnUpdated represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnUpdated filter.Field = "bank_account_balances.updated"
	// BankAccountBalanceColumnUpdatedBy represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnUpdatedBy filter.Field = "bank_account_balances.updated_by"
	// BankAccountBalanceColumnDeleted represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnDeleted filter.Field = "bank_account_balances.deleted"
	// BankAccountBalanceColumnDeletedBy represents the corresponding column in Bank Account Balances table
	BankAccountBalanceColumnDeletedBy filter.Field = "bank_account_balances.deleted_by"
)
View Source
const (
	// UserColumnID represents the corresponding column in User table
	UserColumnID filter.Field = "users.entity_id"
	// UserColumnUsername represents the corresponding column in User table
	UserColumnUsername filter.Field = "users.username"
	// UserColumnEmail represents the corresponding column in User table
	UserColumnEmail filter.Field = "users.email"
	// UserColumnPassword represents the corresponding column in User table
	UserColumnPassword filter.Field = "users.password"
	// UserColumnName represents the corresponding column in User table
	UserColumnName filter.Field = "users.name"
	// UserColumnCreated represents the corresponding column in User table
	UserColumnCreated filter.Field = "users.created"
	// UserColumnCreatedBy represents the corresponding column in User table
	UserColumnCreatedBy filter.Field = "users.created_by"
	// UserColumnUpdated represents the corresponding column in User table
	UserColumnUpdated filter.Field = "users.updated"
	// UserColumnUpdatedBy represents the corresponding column in User table
	UserColumnUpdatedBy filter.Field = "users.updated_by"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationInfo

type AuthenticationInfo struct {
	Expiration *time.Time
	Token      *string
	User       *User
}

AuthenticationInfo is the wrapper object for authentication information

type BankAccount

type BankAccount struct {
	ID                uuid.UUID            `db:"entity_id" validate:"min=36,max=36"`
	AccountName       string               `db:"account_name" validate:"max=255"`
	BankName          string               `db:"bank_name" validate:"max=255"`
	AccountHolderName string               `db:"account_holder_name" validate:"max=255"`
	AccountNumber     string               `db:"account_number" validate:"max=255"`
	LastBalance       float64              `db:"last_balance" validate:"min=0"`
	LastBalanceDate   time.Time            `db:"last_balance_date"`
	Status            BankAccountStatus    `db:"status"`
	Created           time.Time            `db:"created"`
	CreatedBy         uuid.UUID            `db:"created_by" validate:"min=36,max=36"`
	Updated           null.Time            `db:"updated"`
	UpdatedBy         nuuid.NUUID          `db:"updated_by" validate:"min=36,max=36"`
	Deleted           null.Time            `db:"deleted"`
	DeletedBy         nuuid.NUUID          `db:"deleted_by" validate:"min=36,max=36"`
	Balances          []BankAccountBalance `db:"-"`
}

BankAccount represents a Bank Account object

func NewBankAccountFromInput

func NewBankAccountFromInput(input BankAccountInput, userID uuid.UUID) (b BankAccount)

NewBankAccountFromInput creates a new Bank Account from its input object

func (*BankAccount) AttachBalances

func (b *BankAccount) AttachBalances(balances []BankAccountBalance) BankAccount

AttachBalances attaches Bank Account Balances to a Bank Account

func (*BankAccount) Delete

func (b *BankAccount) Delete(userID uuid.UUID) error

Delete performs a delete on a Bank Account

func (*BankAccount) SetNewBalance

func (b *BankAccount) SetNewBalance(input BankAccountBalanceInput, userID uuid.UUID) error

SetNewBalance sets a new balance and balance date on a Bank Account

func (*BankAccount) ToOutput

func (b *BankAccount) ToOutput() BankAccountOutput

ToOutput converts a Bank Account to its JSON-compatible object representation

func (*BankAccount) Update

func (b *BankAccount) Update(input BankAccountInput, userID uuid.UUID) error

Update performs an update on a Bank Account

type BankAccountBalance

type BankAccountBalance struct {
	ID            uuid.UUID   `db:"entity_id" validate:"min=36,max=36"`
	BankAccountID uuid.UUID   `db:"bank_account_entity_id" validate:"min=36,max=36"`
	Date          time.Time   `db:"date"`
	Balance       float64     `db:"balance"`
	Created       time.Time   `db:"created"`
	CreatedBy     uuid.UUID   `db:"created_by" validate:"min=36,max=36"`
	Updated       null.Time   `db:"updated"`
	UpdatedBy     nuuid.NUUID `db:"updated_by" validate:"min=36,max=36"`
	Deleted       null.Time   `db:"deleted"`
	DeletedBy     nuuid.NUUID `db:"deleted_by" validate:"min=36,max=36"`
}

BankAccountBalance represents a snapshot of a Bank Account's balance at a given time

func NewBankAccountBalanceFromInput

func NewBankAccountBalanceFromInput(input BankAccountBalanceInput, bankAccountID uuid.UUID, userID uuid.UUID) (bb BankAccountBalance)

NewBankAccountBalanceFromInput creates a new Bank Account Balance from its input object

func (BankAccountBalance) Delete

func (bb BankAccountBalance) Delete(userID uuid.UUID) error

Delete performs a delete on a Bank Account Balance

func (*BankAccountBalance) ToOutput

ToOutput converts a Bank Account Balance to its JSON-compatible object representation

func (BankAccountBalance) Update

func (bb BankAccountBalance) Update(input BankAccountBalanceInput, userID uuid.UUID) error

Update performs an update on a Bank Account Balance

type BankAccountBalanceFilterInput

type BankAccountBalanceFilterInput struct {
	filter.BaseFilterInput
	BankAccountID nuuid.NUUID          `json:"bankAccountId,omitempty"`
	StartDate     cachetime.NCacheTime `json:"startDate,omitempty"`
	EndDate       cachetime.NCacheTime `json:"endDate,omitempty"`
	BalanceMin    *float64             `json:"balanceMin,omitempty"`
	BalanceMax    *float64             `json:"balanceMax,omitempty"`
}

BankAccountBalanceFilterInput is the filter input object for Bank Account Balances

func (*BankAccountBalanceFilterInput) ToFilter

ToFilter converts this entity-specific filter into a generic filter.Filter object

type BankAccountBalanceInput

type BankAccountBalanceInput struct {
	ID            uuid.UUID           `json:"id"`
	BankAccountID uuid.UUID           `json:"bankAccountId"`
	Date          cachetime.CacheTime `json:"date"`
	Balance       float64             `json:"balance"`
}

BankAccountBalanceInput represents an input struct for Bank Account Balance entity

type BankAccountBalanceOutput

type BankAccountBalanceOutput struct {
	ID            uuid.UUID            `json:"id"`
	BankAccountID uuid.UUID            `json:"bankAccountId"`
	Date          cachetime.CacheTime  `json:"date"`
	Balance       float64              `json:"balance"`
	Created       cachetime.CacheTime  `json:"created"`
	CreatedBy     uuid.UUID            `json:"createdBy"`
	Updated       cachetime.NCacheTime `json:"updated,omitempty"`
	UpdatedBy     nuuid.NUUID          `json:"updatedBy,omitempty"`
	Deleted       cachetime.NCacheTime `json:"deleted,omitempty"`
	DeletedBy     nuuid.NUUID          `json:"deletedBy,omitempty"`
}

BankAccountBalanceOutput is the JSON-compatible object representation of Bank Account Balance

type BankAccountFilterInput

type BankAccountFilterInput struct {
	filter.BaseFilterInput
}

BankAccountFilterInput is the filter input object for Bank Accounts

func (*BankAccountFilterInput) ToFilter

func (f *BankAccountFilterInput) ToFilter() filter.Filter

ToFilter converts this entity-specific filter into a generic filter.Filter object

type BankAccountInput

type BankAccountInput struct {
	ID                uuid.UUID                 `json:"id"`
	AccountName       string                    `json:"accountName"`
	BankName          string                    `json:"bankName"`
	AccountHolderName string                    `json:"accountHolderName"`
	AccountNumber     string                    `json:"accountNumber"`
	LastBalance       float64                   `json:"lastBalance"`
	LastBalanceDate   cachetime.CacheTime       `json:"lastBalanceDate"`
	Status            BankAccountStatus         `json:"status"`
	Balances          []BankAccountBalanceInput `json:"balances"`
}

BankAccountInput represents an input struct for Bank Account entity

type BankAccountOutput

type BankAccountOutput struct {
	ID                uuid.UUID                  `json:"id"`
	AccountName       string                     `json:"accountName"`
	BankName          string                     `json:"bankName"`
	AccountHolderName string                     `json:"accountHolderName"`
	AccountNumber     string                     `json:"accountNumber"`
	LastBalance       float64                    `json:"lastBalance"`
	LastBalanceDate   cachetime.CacheTime        `json:"lastBalanceDate"`
	Status            BankAccountStatus          `json:"status"`
	Created           cachetime.CacheTime        `json:"created"`
	CreatedBy         uuid.UUID                  `json:"createdBy"`
	Updated           cachetime.NCacheTime       `json:"updated,omitempty"`
	UpdatedBy         nuuid.NUUID                `json:"updatedBy,omitempty"`
	Deleted           cachetime.NCacheTime       `json:"deleted,omitempty"`
	DeletedBy         nuuid.NUUID                `json:"deletedBy,omitempty"`
	Balances          []BankAccountBalanceOutput `json:"balances"`
}

BankAccountOutput is the JSON-compatible object representation of Bank Account

type BankAccountStatus

type BankAccountStatus string

BankAccountStatus indicates the status of a Bank Account

const (
	// BankAccountStatusActive indicates an active Bank Account
	BankAccountStatusActive BankAccountStatus = "active"
	// BankAccountStatusInactive indicates an inactive Bank Account
	BankAccountStatusInactive BankAccountStatus = "inactive"
)

type PageInfoOutput

type PageInfoOutput struct {
	Page       int `json:"page"`
	PageSize   int `json:"pageSize"`
	TotalCount int `json:"totalCount"`
	PageCount  int `json:"pageCount"`
}

PageInfoOutput represents information related to a particular page output

type PageOutput

type PageOutput struct {
	Items    interface{}    `json:"items"`
	PageInfo PageInfoOutput `json:"pageInfo"`
}

PageOutput is a wrapper for any output that requires pagination information

type User

type User struct {
	ID        uuid.UUID   `db:"entity_id" validate:"min=36,max=36"`
	Username  string      `db:"username"`
	Email     string      `db:"email"`
	Password  string      `db:"password"`
	Name      string      `db:"name"`
	Created   time.Time   `db:"created"`
	CreatedBy uuid.UUID   `db:"created_by" validate:"min=36,max=36"`
	Updated   null.Time   `db:"updated"`
	UpdatedBy nuuid.NUUID `db:"updated_by" validate:"min=36,max=36"`
}

User represents a User entity object

func NewUserFromInput

func NewUserFromInput(input UserInput, userID uuid.UUID) (u User)

NewUserFromInput creates a new User from its input struct

func (*User) ComparePassword

func (u *User) ComparePassword(password string) bool

ComparePassword compares a User's password in storage against an input

func (*User) SetPassword

func (u *User) SetPassword(password string, userID uuid.UUID) error

SetPassword sets a User's password

func (*User) ToOutput

func (u *User) ToOutput() UserOutput

ToOutput converts a User to its JSON-compatible object representation

func (*User) Update

func (u *User) Update(input UserInput, userID uuid.UUID) error

Update performs an update on a User

type UserFilterInput

type UserFilterInput struct {
	filter.BaseFilterInput
	IDs *[]uuid.UUID `json:"ids,omitempty"`
}

UserFilterInput is the filter input object for Users

func (*UserFilterInput) ToFilter

func (f *UserFilterInput) ToFilter() filter.Filter

ToFilter converts this entity-specific filter into a generic filter.Filter object

type UserInput

type UserInput struct {
	ID       uuid.UUID `json:"id"`
	Username string    `json:"username"`
	Email    string    `json:"email"`
	Password string    `json:"password"`
	Name     string    `json:"name"`
}

UserInput represents an input struct for User entity

type UserOutput

type UserOutput struct {
	ID        uuid.UUID            `json:"id"`
	Username  string               `json:"username"`
	Email     string               `json:"email"`
	Password  string               `json:"password"`
	Name      string               `json:"name"`
	Created   cachetime.CacheTime  `json:"created"`
	CreatedBy uuid.UUID            `json:"createdBy"`
	Updated   cachetime.NCacheTime `json:"updated,omitempty"`
	UpdatedBy nuuid.NUUID          `json:"updatedBy,omitempty"`
}

UserOutput is the JSON-compatible object representation of User

Jump to

Keyboard shortcuts

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