Files
wallet-go-api/pkg/models/wallets.go
Fran Jurmanović ebcb507629 optimized wallet header calculation for better performance
160 ms for three wallets over 9500 transactions
2021-06-15 20:13:34 +02:00

28 lines
711 B
Go

package models
type Wallet struct {
tableName struct{} `pg:"wallets,alias:wallets"`
BaseModel
Name string `json:"name" pg:"name"`
UserID string `json:"userId" pg:"user_id"`
User *UserReturnInfo `json:"user" pg:"rel:has-one,fk:user_id"`
}
type NewWalletBody struct {
Name string `json:"name" form:"name"`
UserID string `json:"userId" form:"userId"`
}
type WalletHeader struct {
WalletId string `json:"walletId"`
CurrentBalance int `json:"currentBalance"`
LastMonth int `json:"lastMonth"`
NextMonth int `json:"nextMonth"`
Currency string `json:"currency"`
}
type WalletTransactions struct {
WalletId string
Transactions []Transaction
}