models

package
v0.0.0-...-894796f Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	ID        uint       `json:"id" gorm:"primary_key"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	DeletedAt *time.Time `sql:"index" json:"-"`
}

BaseModel BaseModel

type Bill

type Bill struct {
	BaseModel
	Name       string          `json:"name" gorm:"not null"`                     //账单名称
	Amount     decimal.Decimal `json:"amount" gorm:"notnull;type:decimal(10,2)"` //账单金额
	BillTypeID uint            `json:"bill_type_id" gorm:"not null"`             //账单类型ID,外键
	BillType   *BillType       `json:"bill_type" gorm:"foreignKey:BillTypeID"`   //账单类型
	Date       time.Time       `json:"date" gorm:"not null"`                     //账单日期
	Remark     string          `json:"remark"`                                   //账单备注
	UserID     uint            `json:"user_id" gorm:"not null"`                  //用户ID
	Owner      User            `json:"-" gorm:"foreignKey:UserID"`               //用户
	Income     bool            `json:"income" gorm:"not null"`                   //是否是收入项目
}

Bill 账单Model

type BillType

type BillType struct {
	BaseModel
	Name  string `json:"name" gorm:"not_null"`  //账单类型名称
	Image string `json:"image"`                 //账单类型图片
	Owner uint   `json:"owner" gorm:"not_null"` //账单类型拥有者,可为空,表示共有,此类账单类型不可删除
}

BillType 账单类型Model

type User

type User struct {
	BaseModel
	Username  string `json:"username" gorm:"unique;not null"`
	Password  string `json:"-" gorm:"not null"`
	Telephone string `json:"telephone" gorm:"unique;not null"`
	Nickname  string `json:"nickname"`
}

Jump to

Keyboard shortcuts

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