2
0
mirror of https://github.com/skanehira/tson synced 2024-11-15 12:13:04 +00:00
tson/gui/type.go

51 lines
646 B
Go
Raw Normal View History

2019-11-01 07:41:49 +00:00
package gui
2019-11-01 10:52:50 +00:00
type JSONType int
2019-11-01 07:41:49 +00:00
const (
2019-11-01 10:52:50 +00:00
Root JSONType = iota + 1
2019-11-01 07:41:49 +00:00
Object
Array
Key
Value
)
2019-11-01 10:52:50 +00:00
var jsonTypeMap = map[JSONType]string{
Object: "object",
Array: "array",
Key: "key",
Value: "value",
2019-11-01 07:41:49 +00:00
}
2019-11-01 10:52:50 +00:00
func (t JSONType) String() string {
return jsonTypeMap[t]
}
type ValueType int
const (
Int ValueType = iota + 1
String
Float
Boolean
2019-11-01 17:23:56 +00:00
Null
2019-11-01 10:52:50 +00:00
)
var valueTypeMap = map[ValueType]string{
Int: "int",
String: "string",
Float: "float",
Boolean: "boolean",
2019-11-01 17:23:56 +00:00
Null: "null",
2019-11-01 10:52:50 +00:00
}
func (v ValueType) String() string {
return valueTypeMap[v]
}
type Reference struct {
ID string
2019-11-01 10:52:50 +00:00
JSONType JSONType
ValueType ValueType
2019-11-01 07:41:49 +00:00
}