Documentation ¶ Overview ¶ Package model 睡眠管理数据库 Index ¶ type SleepDB func Initialize(dbpath string) *SleepDB func Open(dbpath string) (*SleepDB, error) func (sdb *SleepDB) Close() error func (sdb *SleepDB) GetUp(gid, uid int64) (position int, sleepTime time.Duration) func (sdb *SleepDB) Sleep(gid, uid int64) (position int, awakeTime time.Duration) type SleepManage func (SleepManage) TableName() string Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ This section is empty. Types ¶ type SleepDB ¶ type SleepDB gorm.DB SleepDB 睡眠数据库 func Initialize ¶ func Initialize(dbpath string) *SleepDB Initialize 初始化 func Open ¶ func Open(dbpath string) (*SleepDB, error) Open 打开 func (*SleepDB) Close ¶ func (sdb *SleepDB) Close() error Close 关闭 func (*SleepDB) GetUp ¶ func (sdb *SleepDB) GetUp(gid, uid int64) (position int, sleepTime time.Duration) GetUp 更新起床时间 func (*SleepDB) Sleep ¶ func (sdb *SleepDB) Sleep(gid, uid int64) (position int, awakeTime time.Duration) Sleep 更新睡眠时间 type SleepManage ¶ type SleepManage struct { gorm.Model GroupID int64 `gorm:"column:group_id"` UserID int64 `gorm:"column:user_id"` SleepTime time.Time `gorm:"column:sleep_time"` } SleepManage 睡眠信息 func (SleepManage) TableName ¶ func (SleepManage) TableName() string TableName 表名 Source Files ¶ View all Source files model.go Click to show internal directories. Click to hide internal directories.