1 Star 0 Fork 0

吕冰 / influxdb

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
crud_log.go 883 Bytes
一键复制 编辑 原始数据 按行查看 历史
package influxdb
import (
"time"
)
// CRUDLogSetter is the interface to set the crudlog.
type CRUDLogSetter interface {
SetCreatedAt(now time.Time)
SetUpdatedAt(now time.Time)
}
// CRUDLog is the struct to store crud related ops.
type CRUDLog struct {
CreatedAt time.Time `json:"createdAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
// SetCreatedAt set the created time.
func (log *CRUDLog) SetCreatedAt(now time.Time) {
log.CreatedAt = now
}
// SetUpdatedAt set the updated time.
func (log *CRUDLog) SetUpdatedAt(now time.Time) {
log.UpdatedAt = now
}
// TimeGenerator represents a generator for now.
type TimeGenerator interface {
// Now creates the generated time.
Now() time.Time
}
// RealTimeGenerator will generate the real time.
type RealTimeGenerator struct{}
// Now returns the current time.
func (g RealTimeGenerator) Now() time.Time {
return time.Now()
}
Go
1
https://gitee.com/lyu_bing/influxdb.git
git@gitee.com:lyu_bing/influxdb.git
lyu_bing
influxdb
influxdb
master

搜索帮助