do_client_version.go
1.4 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
package domain
import "time"
// ClientVersion
type ClientVersion struct {
// 唯一标识
Id int64 `json:"id"`
// 提交人
Commiter int64 `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(dm *ClientVersion) (*ClientVersion, error)
Remove(dm *ClientVersion) (*ClientVersion, error)
FindOne(queryOptions map[string]interface{}) (*ClientVersion, error)
Find(queryOptions map[string]interface{}) (int64, []*ClientVersion, error)
}
func (m *ClientVersion) Identify() interface{} {
if m.Id == 0 {
return nil
}
return m.Id
}
func (m *ClientVersion) Update(data map[string]interface{}) error {
if projectName, ok := data["projectName"]; ok {
m.ProjectName = projectName.(string)
}
if version, ok := data["version"]; ok {
m.Version = version.(string)
}
if title, ok := data["title"]; ok {
m.Title = title.(string)
}
if remark, ok := data["remark"]; ok {
m.Remark = remark.(string)
}
if clientPackageInfo, ok := data["clientPackageInfo"]; ok {
m.ClientPackageInfo = clientPackageInfo.([]*ClientPackageInfo)
}
return nil
}