forked from treeverse/lakeFS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.go
97 lines (84 loc) · 2.44 KB
/
model.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
package catalog
import (
"database/sql/driver"
"encoding/json"
"time"
)
type Metadata map[string]string
type Repository struct {
Name string `db:"name"`
StorageNamespace string `db:"storage_namespace"`
DefaultBranch string `db:"default_branch"`
CreationDate time.Time `db:"creation_date"`
}
type Entry struct {
CommonLevel bool
Path string `db:"path"`
PhysicalAddress string `db:"physical_address"`
CreationDate time.Time `db:"creation_date"`
Size int64 `db:"size"`
Checksum string `db:"checksum"`
Metadata Metadata `db:"metadata"`
Expired bool `db:"is_expired"`
}
type CommitLog struct {
Reference string
Committer string `db:"committer"`
Message string `db:"message"`
CreationDate time.Time `db:"creation_date"`
Metadata Metadata `db:"metadata"`
Parents []string
}
type MergeResult struct {
Summary map[DifferenceType]int
Reference string
}
type commitLogRaw struct {
BranchName string `db:"branch_name"`
CommitID CommitID `db:"commit_id"`
PreviousCommitID CommitID `db:"previous_commit_id"`
Committer string `db:"committer"`
Message string `db:"message"`
CreationDate time.Time `db:"creation_date"`
Metadata Metadata `db:"metadata"`
MergeSourceBranchName string `db:"merge_source_branch_name"`
MergeSourceCommit CommitID `db:"merge_source_commit"`
}
type lineageCommit struct {
BranchID int64 `db:"branch_id"`
CommitID CommitID `db:"commit_id"`
}
type Branch struct {
Repository string `db:"repository"`
Name string `db:"name"`
}
type MultipartUpload struct {
Repository string `db:"repository"`
UploadID string `db:"upload_id"`
Path string `db:"path"`
CreationDate time.Time `db:"creation_date"`
PhysicalAddress string `db:"physical_address"`
}
func (j Metadata) Value() (driver.Value, error) {
if j == nil {
return json.Marshal(struct{}{})
}
return json.Marshal(j)
}
func (j *Metadata) Scan(src interface{}) error {
if src == nil {
return nil
}
data, ok := src.([]byte)
if !ok {
return ErrInvalidMetadataSrcFormat
}
return json.Unmarshal(data, j)
}
type DBReaderEntry struct {
BranchID int64 `db:"branch_id"`
Path string `db:"path"`
MinCommit CommitID `db:"min_commit"`
MaxCommit CommitID `db:"max_commit"`
RowCtid string `db:"ctid"`
}