-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.go
56 lines (45 loc) · 1.07 KB
/
types.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
package json2schema
type group struct {
schema
}
type field struct {
schema
}
/*
ArrayGroupSchema is interface of array group schemas
*/
type ArrayGroupSchema interface {
SetChildrenSchema(Schema) ArrayGroupSchema
}
type arrayGroupSchema struct {
group
ChildrenSchema Schema `json:"children_schema"`
}
func (arrayGroupSchema arrayGroupSchema) SetChildrenSchema(schema Schema) ArrayGroupSchema {
arrayGroupSchema.ChildrenSchema = schema
return arrayGroupSchema
}
/*
ObjectGroupSchema is interface of object group schemas
*/
type ObjectGroupSchema interface {
AppendChild(...Schema) ObjectGroupSchema
}
type objectGroupSchema struct {
group
Children []Schema `json:"children"`
}
func (objectGroupSchema objectGroupSchema) AppendChild(data ...Schema) ObjectGroupSchema {
objectGroupSchema.Children = append(objectGroupSchema.Children, data...)
return objectGroupSchema
}
type textFieldSchema struct {
field
}
type optionFieldSchema struct {
field
}
type selectFieldSchema struct { //TODO:: Options ro bayad explode kone.
field
Options []optionFieldSchema `json:"options"`
}