postgres

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BudgetPostgres

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

BudgetPostgres repository.

func NewBudgetRepository

func NewBudgetRepository(db *DB) *BudgetPostgres

NewBudgetRepository creates a new BudgetPostgres instance.

func (*BudgetPostgres) GetBaseBudget

func (bp *BudgetPostgres) GetBaseBudget(ctx context.Context) (*model.Budget, error)

GetBaseBudget returns base model.Budget.

func (*BudgetPostgres) GetBudgetByCodename

func (bp *BudgetPostgres) GetBudgetByCodename(ctx context.Context, name string) (*model.Budget, error)

GetBudgetByCodename returns model.Budget by codename.

type CategoryPostgres

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

CategoryPostgres repository.

func NewCategoryRepository

func NewCategoryRepository(db *DB) *CategoryPostgres

NewCategoryRepository creates a new CategoryPostgres instance.

func (*CategoryPostgres) GetAllCategories

func (c *CategoryPostgres) GetAllCategories(ctx context.Context) ([]*model.DBCategory, error)

GetAllCategories returns all model.DBCategory.

type DB

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

DB Postgres.

func New

func New(ctx context.Context, config *config.DB) (*DB, error)

New creates a new DB instance.

func (*DB) Connect

func (db *DB) Connect() (err error)

Connect to DB.

func (*DB) KeepAlive

func (db *DB) KeepAlive()

KeepAlive ...

type ExpensePostgres

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

ExpensePostgres repository.

func NewExpenseRepository

func NewExpenseRepository(db *DB) *ExpensePostgres

NewExpenseRepository creates a new ExpensePostgres instance.

func (*ExpensePostgres) CreateExpense

func (ep *ExpensePostgres) CreateExpense(ctx context.Context, expense *model.Expense) (*model.Expense, error)

CreateExpense creates a new model.Expense instance.

func (*ExpensePostgres) DeleteExpenseByID

func (ep *ExpensePostgres) DeleteExpenseByID(ctx context.Context, id int) error

DeleteExpenseByID deletes model.Expense instance by id.

func (*ExpensePostgres) GetAllExpensesByPeriod

func (ep *ExpensePostgres) GetAllExpensesByPeriod(ctx context.Context, period times.Period) (int, error)

GetAllExpensesByPeriod returns all model.Expense instances by period.

func (*ExpensePostgres) GetBaseExpensesByPeriod

func (ep *ExpensePostgres) GetBaseExpensesByPeriod(ctx context.Context, period times.Period) (int, error)

GetBaseExpensesByPeriod returns base model.Expense instances by period.

func (*ExpensePostgres) GetLastExpenses

func (ep *ExpensePostgres) GetLastExpenses(ctx context.Context) ([]*model.Expense, error)

GetLastExpenses returns last model.Expense instances.

Jump to

Keyboard shortcuts

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