Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var WorkStatsMap = map[string]WorkStatus{"any": 0, "doing": 1, "todo": 2, "done": 3, "drop": 4}
WorkStatsMap .
View Source
var WorkStatsMapJSON = map[WorkStatus]string{1: "doing", 2: "todo", 3: "done", 4: "drop"}
WorkStatsMapJSON .
Functions ¶
This section is empty.
Types ¶
type BaseModel ¶
type BaseModel struct {
ID uint64 `json:"id" gorm:"type:bigint(20) unsigned auto_increment;not null;primary_key;comment:'主键id'"`
CreatedAt time.Time `json:"createdAt" gorm:"comment:'创建时间'"`
UpdatedAt time.Time `json:"updatedAt" gorm:"comment:'更新时间'"`
DeletedAt *time.Time `json:"-" gorm:"index;comment:'删除时间'"`
}
BaseModel extends gorm.Model, but change ID to sortable uuid
type GoalModel ¶
type GoalModel struct {
BaseModel
Title string `gorm:"not null;size:80"`
Description string
Status WorkStatus `gorm:"index:idx_status;"`
Minutes uint64
Missions []MissionModel `gorm:"foreignkey:GoalID"`
User UserModel `gorm:"foreignkey:UserID;save_associations:false"`
UserID uint64 `gorm:"index"`
}
GoalModel defines user info
type MissionModel ¶
type MissionModel struct {
BaseModel
User UserModel `gorm:"foreignkey:UserID;save_associations:false"`
UserID uint64 `gorm:"index"`
Goal GoalModel `gorm:"foreignkey:GoalID;save_associations:false"`
GoalID uint64 `gorm:"index"`
Title string
Description string
Status WorkStatus `gorm:"index"`
Minutes uint64
}
MissionModel defines mission
type RecordModel ¶
type RecordModel struct {
BaseModel
Content string
Review string
Mood string `gorm:"not null;size:10"`
Minutes uint16
Goal GoalModel `gorm:"foreignkey:GoalID;save_associations:false"`
GoalID uint64 `gorm:"index"`
Mission MissionModel `gorm:"foreignkey:MissionID;save_associations:false"`
MissionID uint64 `gorm:"index"`
User UserModel `gorm:"foreignkey:UserID;save_associations:false"`
UserID uint64 `gorm:"index"`
}
RecordModel is for user finished job. Record is not editable, since it will send to user's follower's timeline in next vision. For Minutes, one record can only have max minutes 480, which 8 hours
type TodoModel ¶
type TodoModel struct {
BaseModel
WorkStats
Content string
Goal GoalModel `gorm:"foreignkey:GoalID;save_associations:false"`
GoalID uint64 `gorm:"index"`
Mission MissionModel `gorm:"foreignkey:MissionID;save_associations:false"`
MissionID uint64 `gorm:"index"`
User UserModel `gorm:"foreignkey:UserID;save_associations:false"`
UserID uint64 `gorm:"index"`
}
TodoModel .
type UserModel ¶
type UserModel struct {
BaseModel
Name string `json:"name" gorm:"type:varchar(80)"`
AvatarURL string `json:"avatarUrl" gorm:"type:text"`
Minutes uint64 `json:"minutes"`
GithubToken string `json:"-" gorm:"type:char(40);"`
GithubID uint64 `json:"-" gorm:"unique_index;type:BIGINT"`
RefreshToken string `json:"-" gorm:"type:char(40);"`
}
UserModel defines user info
func (UserModel) MarshalJSON ¶
MarshalJSON implementation.
type WorkStats ¶
type WorkStats struct {
Status WorkStatus `gorm:"comment:'0:any, 1:doing, 2:todo, 3:done, 4:drop'"`
}
WorkStats .
type WorkStatus ¶
type WorkStatus uint8
WorkStatus is the enum of status for Goal and Mission
const ( // StatusAny . StatusAny WorkStatus = iota // StatusDoing . StatusDoing // StatusTodo . StatusTodo // StatusDone . StatusDone // StatusDrop . StatusDrop )
Click to show internal directories.
Click to hide internal directories.