Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterModels()
- type Budget
- func (b *Budget) Insert(budgetAccountID int) error
- func (b *Budget) SelectByUID(uid string) error
- func (b *Budget) SelectCurrent(budgetAccountID int) error
- func (b *Budget) UpdateOnEntry(credit float32, debit float32, count int) error
- func (b *Budget) UpdateOnExpense(credit float32, debit float32, count int) error
- func (b *Budget) UpdateOnIncome(credit float32, debit float32, count int) error
- func (b *Budget) Validate() error
- type BudgetAccount
- type Budgets
- type EntryClass
- type EntryClasses
- type ErrIncompleteQuery
- type Expense
- type ExpenseFormData
- type Expenses
- type Income
- type IncomeFormData
- type IncomeList
- type SafeUser
- type SignInData
- type SignUpData
- type User
Constants ¶
View Source
const ( IncomeTypeName = "income" ExpenseTypeName = "expense" )
Variables ¶
View Source
var EntryClassTypeNames = map[int]string{ 0: ExpenseTypeName, 1: IncomeTypeName, }
Functions ¶
func RegisterModels ¶
func RegisterModels()
Types ¶
type Budget ¶
type Budget struct { ID int UID string Balance float32 TotalIncome float32 TotalExpenses float32 EntryCount int IncomeCount int ExpenseCount int BudgetAccountID int CreatedAt time.Time UpdatedAt time.Time }
func (*Budget) SelectByUID ¶
func (*Budget) SelectCurrent ¶
func (*Budget) UpdateOnEntry ¶
func (*Budget) UpdateOnExpense ¶
func (*Budget) UpdateOnIncome ¶
type BudgetAccount ¶
func (*BudgetAccount) Insert ¶
func (b *BudgetAccount) Insert(userID int) error
func (*BudgetAccount) SelectByUserID ¶
func (b *BudgetAccount) SelectByUserID(userID int) error
type EntryClass ¶
type EntryClass struct { ID int `json:"id"` UID string `json:"uid"` Name string `json:"name"` Type int CreatedAt time.Time UpdatedAt time.Time }
func (*EntryClass) Insert ¶
func (e *EntryClass) Insert() error
func (*EntryClass) InsertIfNotExists ¶
func (e *EntryClass) InsertIfNotExists() error
func (*EntryClass) SelectByID ¶
func (e *EntryClass) SelectByID(id int) error
func (*EntryClass) TypeName ¶
func (e *EntryClass) TypeName() string
type EntryClasses ¶
type EntryClasses []EntryClass
type ErrIncompleteQuery ¶
type ErrIncompleteQuery struct{}
func (ErrIncompleteQuery) Error ¶
func (e ErrIncompleteQuery) Error() string
type Expense ¶
type Expense struct { ID int `json:"id"` Amount float32 `json:"amount"` Description string `json:"description"` BudgetID int `json:"budgetId"` EntryClassID int `json:"entryClassId"` CreatedAt time.Time `json:"createAt"` UpdatedAt time.Time `json:"updatedAt"` }
func (*Expense) Insert ¶
func (e *Expense) Insert(expenseFormData ExpenseFormData, budgetID int) error
func (*Expense) SelectByID ¶
func (*Expense) Update ¶
func (e *Expense) Update(expenseFormData ExpenseFormData) error
type ExpenseFormData ¶
type ExpenseFormData struct { Amount float32 `json:"amount"` Description string `json:"description"` EntryClassID int `json:"entryClassId"` }
func (ExpenseFormData) Validate ¶
func (e ExpenseFormData) Validate() error
type Income ¶
type Income struct { ID int `json:"id"` Amount float32 `json:"amount"` Description string `json:"description"` BudgetID int `json:"budgetId"` EntryClassID int `json:"entryClassId"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
func (*Income) SelectByID ¶
func (*Income) Update ¶
func (i *Income) Update(incomeFormData IncomeFormData) error
type IncomeFormData ¶
type IncomeFormData struct { Amount float32 `json:"amount"` Description string `json:"description"` EntryClassID int `json:"entryClassId"` }
func (IncomeFormData) Validate ¶
func (i IncomeFormData) Validate() error
type IncomeList ¶
type IncomeList []Income
func (*IncomeList) Index ¶
func (il *IncomeList) Index(budgetID int) error
type SafeUser ¶
type SafeUser struct { Username string Name string Email string Image sql.NullString }
type SignInData ¶
type SignUpData ¶
type SignUpData struct { Username string Name string Email string Password string PasswordConfirmation string }
func (*SignUpData) Validate ¶
func (s *SignUpData) Validate() error
type User ¶
type User struct { ID int Username string Name string Email string Password string Image sql.NullString CreatedAt time.Time UpdatedAt time.Time }
func (*User) GetSafeUser ¶
func (*User) Insert ¶
func (u *User) Insert(signUpData SignUpData) error
func (*User) SelectByEmail ¶
func (*User) SelectByID ¶
Click to show internal directories.
Click to hide internal directories.