-
Notifications
You must be signed in to change notification settings - Fork 0
/
smodel.go
40 lines (34 loc) · 777 Bytes
/
smodel.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
package amoeba
type Type string
const (
TypeInt Type = "integer"
TypeBoolean Type = "boolean"
TypeFloat Type = "float"
TypeMap Type = "map"
TypeArray Type = "array"
TypeStruct Type = "object"
TypeString Type = "string"
)
// Schema represents JSON schema. Value and Key are additional
type Schema struct {
JsonType string `json:"type"`
Properties map[string]*Schema
Value string
Key string
Default interface{}
Items *Schema
encoder encoderFunc `json:"-"`
}
func (s *Schema) mustBe(expected Type) {
// TODO
//if Kind(f&flagKindMask) != expected {
// panic(&ValueError{methodName(), f.kind()})
//}
}
func (s *Schema) kind() Type {
return Type(s.JsonType)
}
func (s *Schema) IsNil() bool {
// TODO
return false
}