models

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExpenseTransaction  TransactionType = "Expense"
	IncomeTransaction   TransactionType = "Income"
	TransferTransaction TransactionType = "Transfer"

	LoanSubcategoryID   string = "fin-loan"
	LoanRecoverySubID   string = "fin-recover"
	BorrowSubcategoryID string = "fin-borrow"
	BorrowReturnSubID   string = "fin-return"
)

Variables

View Source
var TxnCategories = []TxnCategory{
	{ID: "food", Name: "Food"},
	{ID: "house", Name: "Housing"},
	{ID: "ent", Name: "Entertainment"},
	{ID: "pc", Name: "Personal Care"},
	{ID: "trv", Name: "Travel"},
	{ID: "fin", Name: "Financial"},
	{ID: "misc", Name: "Miscellaneous"},
}
View Source
var TxnSubcategories []TxnSubcategory

Functions

func ErrCommonResponse added in v1.0.1

func ErrCommonResponse(err error) string

func IsErrBadRequest

func IsErrBadRequest(err error) bool

func IsErrConflict

func IsErrConflict(err error) bool

func IsErrNotFound

func IsErrNotFound(err error) bool

func ParseStatusError

func ParseStatusError(err error) (int, string)

Types

type Account

type Account struct {
	ID               int64 `db:"id,pk autoincr"`
	UserID           int64 `db:",uqs"`
	Type             AccountType
	ShortName        string `db:",uqs"`
	Name             string
	Balance          float64
	LastTxnAmount    float64
	LastTxnTimestamp int64
}

type AccountType

type AccountType string
const (
	CashAccount AccountType = "Cash"
	BankAccount AccountType = "Bank"
)

type DebtorsCreditors added in v1.0.1

type DebtorsCreditors struct {
	ID               int64  `db:"id,pk"`
	UserID           int64  `db:",uqs"`
	NickName         string `db:",uqs"`
	FullName         string
	Email            string `db:"email,uqs"`
	ContactInfo      string
	Balance          float64
	LastTxnTimestamp int64
}

type ErrAccountAlreadyExist

type ErrAccountAlreadyExist struct {
	ShortName string
}

func (ErrAccountAlreadyExist) Error

func (err ErrAccountAlreadyExist) Error() string

type ErrAccountNotFound

type ErrAccountNotFound struct {
	AccID string
}

func (ErrAccountNotFound) Error

func (err ErrAccountNotFound) Error() string

type ErrDebtorCreditorAlreadyExist added in v1.0.1

type ErrDebtorCreditorAlreadyExist struct {
	UserID   int64
	NickName string
}

func (ErrDebtorCreditorAlreadyExist) Error added in v1.0.1

type ErrDebtorCreditorNotFound added in v1.0.1

type ErrDebtorCreditorNotFound struct {
	UserID   int64
	NickName string
}

func (ErrDebtorCreditorNotFound) Error added in v1.0.1

func (err ErrDebtorCreditorNotFound) Error() string

type ErrPetAdoptionNotFound

type ErrPetAdoptionNotFound struct {
	PetID string
}

func (ErrPetAdoptionNotFound) Error

func (err ErrPetAdoptionNotFound) Error() string

type ErrPetNotFound

type ErrPetNotFound struct {
	ID   string
	Name string
}

func (ErrPetNotFound) Error

func (err ErrPetNotFound) Error() string

type ErrShelterAlreadyExist

type ErrShelterAlreadyExist struct {
	ID   string
	Name string
}

func (ErrShelterAlreadyExist) Error

func (err ErrShelterAlreadyExist) Error() string

type ErrShelterNotFound

type ErrShelterNotFound struct {
	ID   string
	Name string
}

func (ErrShelterNotFound) Error

func (err ErrShelterNotFound) Error() string

type ErrUserAlreadyExist

type ErrUserAlreadyExist struct {
	Username string
	Email    string
}

func (ErrUserAlreadyExist) Error

func (err ErrUserAlreadyExist) Error() string

type ErrUserNotAuthenticated

type ErrUserNotAuthenticated struct{}

func (ErrUserNotAuthenticated) Error

func (err ErrUserNotAuthenticated) Error() string

type ErrUserNotFound

type ErrUserNotFound struct {
	ID       string
	Username string
	Email    string
}

func (ErrUserNotFound) Error

func (err ErrUserNotFound) Error() string

type ErrUserPasswordMismatch

type ErrUserPasswordMismatch struct{}

func (ErrUserPasswordMismatch) Error

type Event

type Event struct {
	ID        int64 `db:"id,pk autoincr"`
	UserID    int64
	Message   string
	Timestamp int64
}

type Expense

type Expense struct {
	ID          string    `json:"id"`
	Amount      float64   `json:"amount"`
	Description string    `json:"description"`
	Date        time.Time `json:"date"`
}

type StatusError

type StatusError struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
}

func (StatusError) Error

func (err StatusError) Error() string

type Transaction

type Transaction struct {
	ID                 int64 `db:"id,pk autoincr"`
	UserID             int64
	Amount             float64
	SubcategoryID      string
	Type               TransactionType
	SrcID              string
	DstID              string
	DebtorCreditorName string
	Timestamp          int64
	Remarks            string
}

type TransactionType

type TransactionType string

type TxnCategory

type TxnCategory struct {
	ID   string `db:",pk"`
	Name string
}

type TxnSubcategory

type TxnSubcategory struct {
	ID    string `db:",pk"`
	Name  string
	CatID string
}

type User

type User struct {
	ID         int64  `db:"id,pk"`
	TelegramID int64  `db:",uq"`
	Username   string `db:",uq"`
	FirstName  string
	LastName   string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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