Documentation ¶
Overview ¶
Copyright 2023 PraserX
Copyright 2023 PraserX
Index ¶
- func Close()
- func DepositMoney(uid uint, amount float32) error
- func Get() *gorm.DB
- func InsertBill(bill models.Bill) (int, error)
- func InsertPeriod(period models.Period) (int, error)
- func InsertSchema(schema models.Schema) (int, error)
- func InsertTransaction(transaction models.Transaction) (int, error)
- func InsertUser(user models.User) (int, error)
- func RunAutoMigration() error
- func SelectAllBills() (bills []models.Bill, err error)
- func SelectAllBillsForPeriod(pid uint) ([]models.Bill, error)
- func SelectAllBillsForUser(uid uint) ([]models.Bill, error)
- func SelectAllBillsForUserExceptSpecifiedPeriod(uid, pid uint) ([]models.Bill, error)
- func SelectAllPeriods() ([]models.Period, error)
- func SelectAllPeriodsExceptSpecifiedPeriod(pid uint) ([]models.Period, error)
- func SelectAllTransactions() ([]models.Transaction, error)
- func SelectAllTransactionsForUser(uid uint) ([]models.Transaction, error)
- func SelectAllUsers() (users []models.User, err error)
- func SelectBillByID(id uint) (bill models.Bill, err error)
- func SelectPeriodByID(id uint) (period models.Period, err error)
- func SelectUserByEID(eid string) (user models.User, err error)
- func SelectUserByEmail(email string) (user models.User, err error)
- func SelectUserByID(id uint) (user models.User, err error)
- func SelectVersion() (schema models.Schema, err error)
- func SetupDatabase(opts ...Option)
- func UpdateBillOnIssued(bid uint) error
- func UpdateBillOnPaid(bid uint) error
- func UpdateBillOnPaymentConfirmation(bid uint) error
- func UpdateBillOnPeriodClose(bid uint, amount, payment float32) error
- func UpdatePeriodOnClose(pid uint, totalQuantity int, unitPrice float32) error
- func UpdateUserName(uid uint, firstname, lastname string) error
- func UpdateVersion(version uint) error
- func WithdrawMoney(uid uint, amount float32) error
- type DatabaseOptions
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DepositMoney ¶ added in v1.4.0
func InsertPeriod ¶
InsertUser inserts user into the database and returns ID of the inserted record and error if any occurs.
func InsertTransaction ¶ added in v1.4.0
func InsertTransaction(transaction models.Transaction) (int, error)
func InsertUser ¶
InsertUser inserts user into the database and returns ID of the inserted record and error if any occurs.
func RunAutoMigration ¶
func RunAutoMigration() error
RunAutoMigration creates all required tables in database.
func SelectAllBills ¶ added in v1.2.0
func SelectAllBillsForUser ¶ added in v1.2.0
func SelectAllBillsForUserExceptSpecifiedPeriod ¶ added in v1.2.0
func SelectAllPeriods ¶ added in v1.3.0
func SelectAllPeriodsExceptSpecifiedPeriod ¶ added in v1.2.0
func SelectAllTransactions ¶ added in v1.4.0
func SelectAllTransactions() ([]models.Transaction, error)
func SelectAllTransactionsForUser ¶ added in v1.4.0
func SelectAllTransactionsForUser(uid uint) ([]models.Transaction, error)
func SelectAllUsers ¶
func SelectVersion ¶ added in v1.1.0
func SetupDatabase ¶
func SetupDatabase(opts ...Option)
SetupDatabase set ups database with defined arguments and initialize global instance.
func UpdateBillOnIssued ¶
func UpdateBillOnPaid ¶
func UpdateBillOnPaymentConfirmation ¶ added in v1.2.0
func UpdateBillOnPeriodClose ¶
func UpdatePeriodOnClose ¶
func UpdateUserName ¶ added in v1.3.0
func UpdateVersion ¶ added in v1.1.0
func WithdrawMoney ¶ added in v1.4.0
Types ¶
type DatabaseOptions ¶
type DatabaseOptions struct {
Path string
}
Options are used for Database construct function.
Click to show internal directories.
Click to hide internal directories.