client_version.go
1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package domain
import "time"
// 客户端版本信息
type ClientVersion struct {
// dcc
Id int64 `json:"id"`
// 提交人
Commiter string `json:"commiter"`
// 项目名称
ProjectName string `json:"projectName"`
// 版本号
Version string `json:"version"`
// 标题
Title string `json:"title"`
// 其他备注信息
Remark string `json:"remark"`
// 客户端安装包信息
ClientPackageInfo []*ClientPackageInfo `json:"clientPackageInfo"`
// 创建时间
CreateTime time.Time `json:"createTime"`
}
type ClientVersionRepository interface {
Save(clientVersion *ClientVersion) (*ClientVersion, error)
Remove(clientVersion *ClientVersion) (*ClientVersion, error)
FindOne(queryOptions map[string]interface{}) (*ClientVersion, error)
Find(queryOptions map[string]interface{}) (int64, []*ClientVersion, error)
}
func (clientVersion *ClientVersion) Identify() interface{} {
if clientVersion.Id == 0 {
return nil
}
return clientVersion.Id
}
func (clientVersion *ClientVersion) Update(data map[string]interface{}) error {
if Id, ok := data["Id"]; ok {
clientVersion.Id = Id.(int64)
}
if commiter, ok := data["commiter"]; ok {
clientVersion.Commiter = commiter.(string)
}
if projectName, ok := data["projectName"]; ok {
clientVersion.ProjectName = projectName.(string)
}
if version, ok := data["version"]; ok {
clientVersion.Version = version.(string)
}
if title, ok := data["title"]; ok {
clientVersion.Title = title.(string)
}
if remark, ok := data["remark"]; ok {
clientVersion.Remark = remark.(string)
}
if clientPackageInfo, ok := data["clientPackageInfo"]; ok {
clientVersion.ClientPackageInfo = clientPackageInfo.([]*ClientPackageInfo)
}
if createTime, ok := data["createTime"]; ok {
clientVersion.CreateTime = createTime.(time.Time)
}
return nil
}