database

package
v0.0.0-...-a9d3047 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: Unlicense Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

func CreateDB

func CreateDB() *DB

CreateDB opens sqlite database connection and returns pointer to DB struct.

func (*DB) Close

func (db *DB) Close() error

Close closes the database connection.

func (DB) DeleteExpense

func (db DB) DeleteExpense(id int) error

DeleteExpense deletes an expense from expenses table by its Id.

func (*DB) GetBudgetWithYearMonth

func (db *DB) GetBudgetWithYearMonth(date string) string

GetBudgetWithYearMonth returns budget amount of a specific month and year (YYYY-MM).

func (*DB) GetDefaultBudget

func (db *DB) GetDefaultBudget() string

GetDefaultBudget returns the default monthly budget amount.

func (*DB) GetExpensesWithYearMonth

func (db *DB) GetExpensesWithYearMonth(yearMonth string) []domain.Expense

GetWithMonthYear returns expenses of a specific month and year (YYYY-MM).

func (DB) InsertBudget

func (db DB) InsertBudget(amount, date string) error

InsertBudget inserts budget amount for a specific month and year (YYYY-MM).

func (DB) InsertExpense

func (db DB) InsertExpense(expense domain.Expense) error

InsertExpense inserts a given expense into expenses table.

func (DB) UpdateDefaultBudget

func (db DB) UpdateDefaultBudget(amount string) error

UpdateDefaultBudget updates the default monthly budget amount.

Jump to

Keyboard shortcuts

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