diff --git a/model/t_uid/t_uid.go b/model/t_uid/t_uid.go index 146790c..2c42750 100644 --- a/model/t_uid/t_uid.go +++ b/model/t_uid/t_uid.go @@ -10,15 +10,15 @@ import ( ) type t_uid struct { - F_id int64 `gorm:"column:F_id;primaryKey"` // ID范围id - F_pid int64 `gorm:"column:F_pid"` // ID范围的前一个范围id - F_type string `gorm:"column:F_type"` // ID类型 - F_prefix string `gorm:"column:F_prefix"` // ID前缀(type+prefix+range_start唯一) - F_range_start int64 `gorm:"column:F_range_start"` // ID范围的起始id - F_range_length int `gorm:"column:F_range_length"` // ID范围的长度 - F_range_owner string `gorm:"column:F_range_owner"` // ID范围的拥有者,一般是机器id - F_create_time time.Time `gorm:"column:F_create_time"` // 记录创建时间 - F_modify_time time.Time `gorm:"column:F_modify_time"` // 记录更新时间 + F_id int64 `gorm:"column:f_id;primaryKey"` // ID范围id + F_pid int64 `gorm:"column:f_pid"` // ID范围的前一个范围id + F_type string `gorm:"column:f_type"` // ID类型 + F_prefix string `gorm:"column:f_prefix"` // ID前缀(type+prefix+range_start唯一) + F_range_start int64 `gorm:"column:f_range_start"` // ID范围的起始id + F_range_length int `gorm:"column:f_range_length"` // ID范围的长度 + F_range_owner string `gorm:"column:f_range_owner"` // ID范围的拥有者,一般是机器id + F_create_time time.Time `gorm:"column:f_create_time"` // 记录创建时间 + F_modify_time time.Time `gorm:"column:f_modify_time"` // 记录更新时间 } type typeInfo struct { @@ -28,11 +28,11 @@ type typeInfo struct { var table string = "t_uid" // id range table name var typeSupported = map[string]typeInfo{ - "SIGNID": typeInfo{ + "SIGNID": { Name: "SIGNID", RangeLength: 3, }, - "USERID": typeInfo{ + "USERID": { Name: "USERID", RangeLength: 3, }, @@ -70,14 +70,14 @@ func CreateIdRange(db *gorm.DB, typ, prefix string) (start int64, length int, er lock = clause.Locking{Strength: "UPDATE"} root = t_uid{} rootcond = map[string]interface{}{ - "F_type": fmt.Sprintf("%s#ROOT", typ), - "F_prefix": prefix, - "F_pid": 0, + "f_type": fmt.Sprintf("%s#ROOT", typ), + "f_prefix": prefix, + "f_pid": 0, } rootattr = map[string]interface{}{ - "F_range_start": -length, - "F_range_length": length, - "F_range_owner": "0", + "f_range_start": -length, + "f_range_length": length, + "f_range_owner": "0", } selfid = "TODO" )