forked from mfcochauxlaberge/jsonapi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.go
More file actions
42 lines (37 loc) · 663 Bytes
/
schema.go
File metadata and controls
42 lines (37 loc) · 663 Bytes
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
package jsonapi
import "database/sql"
// Type ...
type Type struct {
Name string
Fields []string
Attrs map[string]Attr
Rels map[string]Rel
Default Resource
}
// Attr ...
type Attr struct {
Name string
Type string
Null bool
Default sql.NullString
}
// Rel ...
type Rel struct {
Name string
Type string
ToOne bool
InverseName string
InverseType string
InverseToOne bool
}
// Inverse ...
func (r *Rel) Inverse() Rel {
return Rel{
Name: r.InverseName,
Type: r.InverseType,
ToOne: r.InverseToOne,
InverseName: r.Name,
InverseType: r.Type,
InverseToOne: r.ToOne,
}
}