Documentation
¶
Index ¶
- func Client() *gorm.DB
- func Connect() error
- func Count[T any](query any, args ...any) (int64, error)
- func Create[T any](data *T) error
- func Delete[T any](query any, args ...any) error
- func DeleteByID[T any](id ...uint64) error
- func GetAll[T any](query any, args ...any) ([]T, error)
- func GetMany[T any](opt Option) ([]T, error)
- func GetOne[T any](query any, args ...any) (T, error)
- func GetOneByID[T any](id uint64) (T, error)
- func Update[T any](data *T, query any, args ...any) error
- func UpdateAll[T any](data *T, query any, args ...any) error
- func UpdateAllByID[T any](id uint64, data *T) error
- func UpdateByID[T any](id uint64, data *T) error
- type Area
- type BillDetails
- type BillLedger
- type BillType
- type File
- type FileDao
- type Option
- type TomatoPlan
- type TomatoPlanDao
- type TomatoTask
- type Travel
- type TravelDao
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteByID ¶
func GetOneByID ¶
func UpdateAllByID ¶ added in v0.0.2
func UpdateByID ¶
Types ¶
type Area ¶ added in v0.2.0
type Area struct {
ID uint64 `gorm:"primaryKey" json:"id"`
Name string `gorm:"index" json:"name"`
Level string `json:"level"` // 等级:country, province, city, district
AdCode string `gorm:"index" json:"adcode"`
Lng float64 `json:"lng"`
Lat float64 `json:"lat"`
Parent string `json:"parent"` // 父亲的 adcode
}
Area 行政区域
type BillDetails ¶
type BillDetails struct {
ID uint64 `gorm:"primaryKey" json:"id"`
Money float64 `gorm:"comment:金额" json:"money"`
Kind string `gorm:"comment:类型" json:"kind"` // income(收入) pay(支出)
Type string `gorm:"comment:分类" json:"type,omitempty"`
Ledger string `gorm:"comment:账本" json:"ledger,omitempty"`
Note string `gorm:"comment:备注" json:"note,omitempty"`
CreatedAt time.Time `gorm:"index,comment:创建时间" json:"created_at"`
}
BillDetails 明细
type BillLedger ¶ added in v0.1.0
type BillLedger struct {
ID uint64 `gorm:"primaryKey" json:"id"`
Name string `gorm:"comment:名称" json:"name"`
Note string `gorm:"comment:备注" json:"note,omitempty"`
Times int `gorm:"index,comment:使用次数" json:"times,omitempty"`
CreatedAt time.Time `gorm:"comment:创建时间" json:"created_at"`
IsDefault bool `gorm:"comment:默认账本" json:"is_default"`
Budget float64 `gorm:"comment:每月预算" json:"budget"`
}
BillType 账本
type BillType ¶ added in v0.1.0
type BillType struct {
ID uint64 `gorm:"primaryKey" json:"id"`
Name string `gorm:"comment:名称" json:"name"`
Note string `gorm:"comment:备注" json:"note,omitempty"`
Times int `gorm:"index,comment:使用次数" json:"times,omitempty"`
CreatedAt time.Time `gorm:"comment:创建时间" json:"created_at"`
}
BillType 分类
type File ¶ added in v0.2.0
type FileDao ¶ added in v0.2.0
type FileDao struct {
}
func NewFileDao ¶ added in v0.2.0
func NewFileDao() *FileDao
type TomatoPlan ¶ added in v0.3.0
type TomatoPlan struct {
ID uint64 `json:"id" gorm:"primaryKey"`
Title string `json:"title"`
Description string `json:"description"`
TomatoDuration int `json:"tomato_duration"` // 每个番茄的时长,单位为分钟
CreatedAt time.Time `json:"created_at" gorm:"index"`
Tasks []TomatoTask `json:"tasks" gorm:"foreignKey:PlanID"`
Predict int `json:"predict"` // 预估可投入的番茄数
Cost int `json:"cost"` // 实际投入的番茄数
CostTime int `json:"cost_time"` // 投入时间 = TomatoDuration * Cost
}
type TomatoPlanDao ¶ added in v0.3.0
type TomatoPlanDao struct {
}
func NewTomatoPlanDao ¶ added in v0.3.0
func NewTomatoPlanDao() *TomatoPlanDao
type TomatoTask ¶ added in v0.3.0
type TomatoTask struct {
ID uint64 `json:"id" gorm:"primaryKey"`
Title string `json:"title"`
Description string `json:"description"`
Status string `json:"status"` // todo,doing,done
CreatedAt time.Time `json:"created_at" gorm:"index"`
Predict int `json:"predict"` // 预估需要的番茄数
Cost int `json:"cost"` // 实际投入的番茄数
PlanID uint64 `json:"plan_id" gorm:"index"`
}
type TravelDao ¶ added in v0.2.0
type TravelDao struct {
}
func NewTravelDao ¶ added in v0.2.0
func NewTravelDao() *TravelDao
Click to show internal directories.
Click to hide internal directories.