database

package
v0.0.0-...-107286f Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DBPATH = utils.DBPATH()

Functions

func GetDB

func GetDB() (*sqlx.DB, error)

func InitApplication

func InitApplication() error

Types

type DeleteConfig

type DeleteConfig struct {
	Dry     bool
	Verbose bool
	All     bool
	Ids     []string
}

type TQuery

type TQuery struct {
	Query  string
	Config TransactionConfig
	// contains filtered or unexported fields
}

func NewQuery

func NewQuery(t TransactionConfig, isCount bool) TQuery

func (*TQuery) AddAmount

func (q *TQuery) AddAmount()

func (*TQuery) AddColumns

func (q *TQuery) AddColumns()

func (*TQuery) AddDate

func (q *TQuery) AddDate()

func (*TQuery) AddDesc

func (q *TQuery) AddDesc()

func (*TQuery) AddLimit

func (q *TQuery) AddLimit()

func (*TQuery) AddOffset

func (q *TQuery) AddOffset()

func (*TQuery) AddSort

func (q *TQuery) AddSort()

func (*TQuery) AddType

func (q *TQuery) AddType()

func (*TQuery) Build

func (q *TQuery) Build() string

type Transaction

type Transaction struct {
	ID          int     `db:"id" json:"id"`
	Type        string  `db:"type" json:"type"`
	Description string  `db:"description" json:"description"`
	Amount      float64 `db:"amount" json:"amount"`
	CreatedAt   string  `db:"created_at" json:"created_at"`
	UpdatedAt   string  `db:"updated_at" json:"updated_at"`
}

type TransactionConfig

type TransactionConfig struct {
	Dry      bool
	Verbose  bool
	TxType   string
	Page     int
	Limit    int
	All      bool
	Date     string
	Amount   string
	Sort     string
	SortAsc  bool
	Desc     string
	Columns  []string
	IsHRTime bool
	Format   string
	IsPretty bool
}

type TransactionRepository

type TransactionRepository interface {
	CreateTransaction(transaction Transaction) error
	GetTransactionsWithConfig(c TransactionConfig) ([]Transaction, error)
	GetTransactionCountWithConfig(c TransactionConfig) (int, error)
	DeleteTransactions(c DeleteConfig) error
}

func NewTransactionRepository

func NewTransactionRepository() TransactionRepository

Jump to

Keyboard shortcuts

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