/
positionJob.go
46 lines (40 loc) · 1.49 KB
/
positionJob.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
package positionjob
import (
"database/sql/driver"
"encoding/json"
"errors"
"time"
)
// Asset
type PositionJob struct {
PositionID *int `json:"positionId"` //1
JobID *int `json:"jobId"` //2
UUID string `json:"uuid"` //3
Name string `json:"name"` //4
AlternateName string `json:"alternateName"` //5
StartDate time.Time `json:"startDate"` //6
EndDate time.Time `json:"endDate"` //7
Description string `json:"description"` //8
StatusID *int `json:"statusId"` //9
ResponseStatus string `json:"responseStatus"` //10
RequestUrl string `json:"requestUrl"` //11
RequestBody string `json:"requestBody"` //12
RequestMethod string `json:"requestMethod"` //13
ResponseData string `json:"responseData"` //14
ResponseDataJson Attrs `json:"responseDataJson"` //15
CreatedBy string `json:"createdBy"` //16
CreatedAt time.Time `json:"createdAt"` //17
UpdatedBy string `json:"updatedBy"` //18
UpdatedAt time.Time `json:"updatedAt"` //19
}
type Attrs map[string]interface{}
func (a Attrs) Value() (driver.Value, error) {
return json.Marshal(a)
}
func (a *Attrs) Scan(value interface{}) error {
b, ok := value.([]byte)
if !ok {
return errors.New("type assertion to []byte failed")
}
return json.Unmarshal(b, &a)
}