finance

package
v0.0.0-...-2246c2a Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finance

type Finance struct {
	ID              int64           `json:"id"  deepcopier:"ID"`
	Title           string          `json:"title" deepcopier:"Title"`
	AccountID       int64           `json:"account_id" deepcopier:"FinanceAccountID"`
	Account         account.Account `gorm:"foreignKey:AccountID" json:"account"`
	Amount          float64         `json:"amount" deepcopier:"Amount"`
	Description     string          `json:"description" deepcopier:"Description"`
	UserID          int64           `json:"user_id" deepcopier:"UserID"`
	Type            string          `json:"type" deepcipier:"type"`
	TransactionDate string          `json:"transaction_date" deepcopier:"TransactionDate"`
	CreatedAt       time.Time       `json:"created_at"`
	UpdatedAt       time.Time       `json:"updated_at"`
	DeletedAt       gorm.DeletedAt  `json:"deleted_at"`
}

func (Finance) TableName

func (Finance) TableName() string

TableName ...

type GetAllFinanceReq

type GetAllFinanceReq struct {
	UserID    int64  `json:"user_id"`
	Page      int    `json:"page"`
	Limit     int    `json:"limit"`
	Title     string `json:"title"`
	StartDate string `json:"start_date"`
	EndDate   string `json:"end_date"`
	Type      string `json:"type"`
}

GetAllFinanceReq ...

type GetTotalTransaction

type GetTotalTransaction struct {
	UserID    int64  `json:"user_id" deepcopier:"UserID"`
	StartDate string `json:"start_date" deepcopier:"StartDate"`
	EndDate   string `json:"end_date" deepcopier:"EndDate"`
	Type      string `json:"type" deepcopier:"Type"`
}

GetTotalTransaction ...

type Repository

type Repository interface {
	// CreateFinance ...
	CreateFinance(ctx context.Context, finance Finance) (returnData Finance, err error)

	// GetAllFinance ...
	GetAllFinance(ctx context.Context, param GetAllFinanceReq) (returnData []Finance, err error)

	// CountTotalFinance ...
	CountTotalFinance(ctx context.Context, req GetAllFinanceReq) (total int64, err error)

	// UpdateFinance ...
	UpdateFinance(ctx context.Context, finance Finance) (returnData Finance, err error)

	// GetFinanceByID ...
	GetFinanceByID(ctx context.Context, id int64) (returnData Finance, err error)

	// DeleteFinanceByID ...
	DeleteFinanceByID(ctx context.Context, id int64) (err error)

	// GetTotalTransactionDaily ...
	GetTotalTransactionDaily(ctx context.Context, req GetTotalTransaction) (returnData []TotalTransactionRes, err error)

	// GetTotalTransactionMonthly ...
	GetTotalTransactionMonthly(ctx context.Context, req GetTotalTransaction) (returnData []TotalTransactionMonthlyRes, err error)
}

func NewDB

func NewDB(d *driversql.Database) Repository

func NewRepo

func NewRepo(db Repository) Repository

type Res

type Res struct {
	ID              int64           `json:"id"  deepcopier:"ID"`
	Title           string          `json:"title" deepcipier:"Title"`
	AccountID       int64           `json:"account_id" deepcopier:"AccountID"`
	FinanceAccount  account.Account `json:"finance_account"`
	Amount          float64         `json:"amount" deepcopier:"Amount"`
	Description     string          `json:"description" deepcopier:"Description"`
	UserID          int64           `json:"user_id" deepcopier:"UserID"`
	Type            string          `json:"type" deepcopier:"Type"`
	TransactionDate time.Time       `json:"transaction_date" deepcopier:"TransactionDate"`
	CreatedAt       time.Time       `json:"created_at"`
	UpdatedAt       time.Time       `json:"updated_at"`
}

type TotalTransactionMonthlyRes

type TotalTransactionMonthlyRes struct {
	Month    string  `json:"month" deepcopier:"Month"`
	MonthNum string  `json:"month_num" deepcopier:"MonthNum"`
	Year     string  `json:"year" deepcopier:"Year"`
	Total    float64 `json:"total" deepcopier:"Total"`
	Type     string  `json:"type" deepcopier:"Type"`
}

TotalTransactionMonthlyRes ...

type TotalTransactionRes

type TotalTransactionRes struct {
	TransactionDate time.Time `json:"transaction_date" deepcopier:"TransactionDate"`
	Total           float64   `json:"total" deepcopier:"Total"`
	Type            string    `json:"type" deepcopier:"Type"`
}

TotalTransactionRes ...

Jump to

Keyboard shortcuts

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