storage

package
v0.0.0-...-d38997b Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init() (*gorm.DB, error)

Init initializes DB connections..

Types

type Account

type Account struct {
	ID   uint        `gorm:"primaryKey"`
	Name string      `gorm:"type:varchar(255)"`
	Type AccountType `gorm:"type:tinyint"`
}

Account ...

type AccountType

type AccountType int

AccountType ...

const (
	ATBank AccountType
	ATCreditCard
	ATCash
	ATInvestment
)

Account types

type Category

type Category struct {
	ID          uint            `gorm:"primaryKey"`
	Category    string          `gorm:"type:varchar(128)"`
	SubCategory string          `gorm:"type:varchar(128)"`
	TxType      TransactionType `gorm:"type:tinyint"`
}

Category ...

type Ledger

type Ledger struct {
	ID          uint    `gorm:"primaryKey"`
	AccountID   uint    `gorm:"uniqueIndex:idx_account_version,priority:1"`
	Version     uint    `gorm:"uniqueIndex:idx_account_version,priority:2"`
	Balance     float64 `gorm:"type:decimal(18,3)"`
	SubCategory string  `gorm:"type:varchar(128)"`
	Amount      float64 `gorm:"type:decimal(18,3)"`
	TxTime      time.Time
}

Ledger ...

type TransactionType

type TransactionType int

TransactionType ...

const (
	TTExpense TransactionType
	TTIncome
	TTTransfer
	TTInvestment
)

Transaction types

func (TransactionType) String

func (t TransactionType) String() string

func (*TransactionType) UnmarshalJSON

func (t *TransactionType) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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