-
Notifications
You must be signed in to change notification settings - Fork 2.8k
/
type.go
105 lines (98 loc) · 2.94 KB
/
type.go
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
// Copyright 2019 Drone IO, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package repos
import (
"database/sql"
"encoding/json"
"github.com/drone/drone/core"
"github.com/jmoiron/sqlx/types"
)
type nullBuild struct {
ID sql.NullInt64
RepoID sql.NullInt64
ConfigID sql.NullInt64
Trigger sql.NullString
Number sql.NullInt64
Parent sql.NullInt64
Status sql.NullString
Error sql.NullString
Event sql.NullString
Action sql.NullString
Link sql.NullString
Timestamp sql.NullInt64
Title sql.NullString
Message sql.NullString
Before sql.NullString
After sql.NullString
Ref sql.NullString
Fork sql.NullString
Source sql.NullString
Target sql.NullString
Author sql.NullString
AuthorName sql.NullString
AuthorEmail sql.NullString
AuthorAvatar sql.NullString
Sender sql.NullString
Params types.JSONText
Cron sql.NullString
Deploy sql.NullString
DeployID sql.NullInt64
Debug sql.NullBool
Started sql.NullInt64
Finished sql.NullInt64
Created sql.NullInt64
Updated sql.NullInt64
Version sql.NullInt64
}
func (b *nullBuild) value() *core.Build {
params := map[string]string{}
json.Unmarshal(b.Params, ¶ms)
build := &core.Build{
ID: b.ID.Int64,
RepoID: b.RepoID.Int64,
Trigger: b.Trigger.String,
Number: b.Number.Int64,
Parent: b.Parent.Int64,
Status: b.Status.String,
Error: b.Error.String,
Event: b.Event.String,
Action: b.Action.String,
Link: b.Link.String,
Timestamp: b.Timestamp.Int64,
Title: b.Title.String,
Message: b.Message.String,
Before: b.Before.String,
After: b.After.String,
Ref: b.Ref.String,
Fork: b.Fork.String,
Source: b.Source.String,
Target: b.Target.String,
Author: b.Author.String,
AuthorName: b.AuthorName.String,
AuthorEmail: b.AuthorEmail.String,
AuthorAvatar: b.AuthorAvatar.String,
Sender: b.Sender.String,
Params: params,
Cron: b.Cron.String,
Deploy: b.Deploy.String,
DeployID: b.DeployID.Int64,
Debug: b.Debug.Bool,
Started: b.Started.Int64,
Finished: b.Finished.Int64,
Created: b.Created.Int64,
Updated: b.Updated.Int64,
Version: b.Version.Int64,
}
return build
}