surrealpatch/db/db.gen.go

483 lines
10 KiB
Go
Raw Normal View History

2020-11-16 08:48:02 +00:00
// +build go1.6
2017-11-16 20:53:39 +00:00
// Code generated by codecgen - DO NOT EDIT.
package db
import (
"errors"
codec1978 "github.com/ugorji/go/codec"
"runtime"
2018-04-14 18:24:25 +00:00
"strconv"
2017-11-16 20:53:39 +00:00
)
const (
// ----- content types ----
2020-12-09 22:21:16 +00:00
codecSelferCcUTF87046 = 1
codecSelferCcRAW7046 = 255
2017-11-16 20:53:39 +00:00
// ----- value types used ----
2020-12-09 22:21:16 +00:00
codecSelferValueTypeArray7046 = 10
codecSelferValueTypeMap7046 = 9
codecSelferValueTypeString7046 = 6
codecSelferValueTypeInt7046 = 2
codecSelferValueTypeUint7046 = 3
codecSelferValueTypeFloat7046 = 4
codecSelferValueTypeNil7046 = 1
codecSelferBitsize7046 = uint8(32 << (^uint(0) >> 63))
codecSelferDecContainerLenNil7046 = -2147483648
2017-11-16 20:53:39 +00:00
)
var (
2020-12-09 22:21:16 +00:00
errCodecSelferOnlyMapOrArrayEncodeToStruct7046 = errors.New(`only encoded map or array can be decoded into a struct`)
2017-11-16 20:53:39 +00:00
)
2020-12-09 22:21:16 +00:00
type codecSelfer7046 struct{}
2020-11-16 08:48:02 +00:00
2020-12-09 22:21:16 +00:00
func codecSelfer7046False() bool { return false }
func codecSelfer7046True() bool { return true }
2017-11-16 20:53:39 +00:00
func init() {
2020-11-16 08:48:02 +00:00
if codec1978.GenVersion != 20 {
2017-11-16 20:53:39 +00:00
_, file, _, _ := runtime.Caller(0)
2020-11-16 08:48:02 +00:00
ver := strconv.FormatInt(int64(codec1978.GenVersion), 10)
panic(errors.New("codecgen version mismatch: current: 20, need " + ver + ". Re-generate file: " + file))
2017-11-16 20:53:39 +00:00
}
}
func (x *Response) CodecEncodeSelf(e *codec1978.Encoder) {
2020-12-09 22:21:16 +00:00
var h codecSelfer7046
2020-11-16 08:48:02 +00:00
z, r := codec1978.GenHelper().Encoder(e)
2017-11-16 20:53:39 +00:00
_, _, _ = h, z, r
if x == nil {
r.EncodeNil()
} else {
2020-11-16 08:48:02 +00:00
yy2arr2 := z.EncBasicHandle().StructToArray
_ = yy2arr2
const yyr2 bool = false // struct tag has 'toArray'
var yyq2 = [4]bool{ // should field at this index be written?
x.Time != "", // time
x.Status != "", // status
x.Detail != "", // detail
len(x.Result) != 0, // result
}
_ = yyq2
if yyr2 || yy2arr2 {
z.EncWriteArrayStart(4)
z.EncWriteArrayElem()
if yyq2[0] {
r.EncodeString(string(x.Time))
} else {
r.EncodeString("")
2017-11-16 20:53:39 +00:00
}
2020-11-16 08:48:02 +00:00
z.EncWriteArrayElem()
if yyq2[1] {
r.EncodeString(string(x.Status))
2017-11-16 20:53:39 +00:00
} else {
2020-11-16 08:48:02 +00:00
r.EncodeString("")
2017-11-16 20:53:39 +00:00
}
2020-11-16 08:48:02 +00:00
z.EncWriteArrayElem()
if yyq2[2] {
r.EncodeString(string(x.Detail))
2017-11-16 20:53:39 +00:00
} else {
2020-11-16 08:48:02 +00:00
r.EncodeString("")
2017-11-16 20:53:39 +00:00
}
2020-11-16 08:48:02 +00:00
z.EncWriteArrayElem()
if yyq2[3] {
if x.Result == nil {
r.EncodeNil()
2017-11-16 20:53:39 +00:00
} else {
2020-11-16 08:48:02 +00:00
z.F.EncSliceIntfV(x.Result, e)
} // end block: if x.Result slice == nil
2019-11-20 14:16:56 +00:00
} else {
2020-11-16 08:48:02 +00:00
r.EncodeNil()
}
z.EncWriteArrayEnd()
} else {
var yynn2 int
for _, b := range yyq2 {
if b {
yynn2++
2017-11-16 20:53:39 +00:00
}
2019-11-20 13:20:27 +00:00
}
2020-11-16 08:48:02 +00:00
z.EncWriteMapStart(yynn2)
yynn2 = 0
if yyq2[0] {
z.EncWriteMapElemKey()
if z.IsJSONHandle() {
z.WriteStr("\"time\"")
2019-11-20 13:20:27 +00:00
} else {
2020-11-16 08:48:02 +00:00
r.EncodeString(`time`)
2017-11-16 20:53:39 +00:00
}
2020-11-16 08:48:02 +00:00
z.EncWriteMapElemValue()
r.EncodeString(string(x.Time))
2017-11-16 20:53:39 +00:00
}
2020-11-16 08:48:02 +00:00
if yyq2[1] {
z.EncWriteMapElemKey()
if z.IsJSONHandle() {
z.WriteStr("\"status\"")
2019-11-20 13:20:27 +00:00
} else {
2020-11-16 08:48:02 +00:00
r.EncodeString(`status`)
2019-11-20 14:16:56 +00:00
}
2020-11-16 08:48:02 +00:00
z.EncWriteMapElemValue()
r.EncodeString(string(x.Status))
}
if yyq2[2] {
z.EncWriteMapElemKey()
if z.IsJSONHandle() {
z.WriteStr("\"detail\"")
} else {
r.EncodeString(`detail`)
2019-11-20 14:16:56 +00:00
}
2020-11-16 08:48:02 +00:00
z.EncWriteMapElemValue()
r.EncodeString(string(x.Detail))
2019-11-20 14:16:56 +00:00
}
2020-11-16 08:48:02 +00:00
if yyq2[3] {
z.EncWriteMapElemKey()
if z.IsJSONHandle() {
z.WriteStr("\"result\"")
} else {
r.EncodeString(`result`)
}
z.EncWriteMapElemValue()
if x.Result == nil {
r.EncodeNil()
} else {
z.F.EncSliceIntfV(x.Result, e)
} // end block: if x.Result slice == nil
2017-11-16 20:53:39 +00:00
}
2020-11-16 08:48:02 +00:00
z.EncWriteMapEnd()
2017-11-16 20:53:39 +00:00
}
}
}
func (x *Response) CodecDecodeSelf(d *codec1978.Decoder) {
2020-12-09 22:21:16 +00:00
var h codecSelfer7046
2020-11-16 08:48:02 +00:00
z, r := codec1978.GenHelper().Decoder(d)
2017-11-16 20:53:39 +00:00
_, _, _ = h, z, r
2020-11-16 08:48:02 +00:00
yyct2 := r.ContainerType()
2020-12-09 22:21:16 +00:00
if yyct2 == codecSelferValueTypeNil7046 {
2020-11-16 08:48:02 +00:00
*(x) = Response{}
2020-12-09 22:21:16 +00:00
} else if yyct2 == codecSelferValueTypeMap7046 {
2020-11-16 08:48:02 +00:00
yyl2 := z.DecReadMapStart()
if yyl2 == 0 {
2017-11-16 20:53:39 +00:00
} else {
2020-11-16 08:48:02 +00:00
x.codecDecodeSelfFromMap(yyl2, d)
}
z.DecReadMapEnd()
2020-12-09 22:21:16 +00:00
} else if yyct2 == codecSelferValueTypeArray7046 {
2020-11-16 08:48:02 +00:00
yyl2 := z.DecReadArrayStart()
if yyl2 != 0 {
x.codecDecodeSelfFromArray(yyl2, d)
2017-11-16 20:53:39 +00:00
}
2020-11-16 08:48:02 +00:00
z.DecReadArrayEnd()
} else {
2020-12-09 22:21:16 +00:00
panic(errCodecSelferOnlyMapOrArrayEncodeToStruct7046)
2017-11-16 20:53:39 +00:00
}
}
func (x *Response) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
2020-12-09 22:21:16 +00:00
var h codecSelfer7046
2020-11-16 08:48:02 +00:00
z, r := codec1978.GenHelper().Decoder(d)
2017-11-16 20:53:39 +00:00
_, _, _ = h, z, r
var yyhl3 bool = l >= 0
for yyj3 := 0; ; yyj3++ {
if yyhl3 {
if yyj3 >= l {
break
}
} else {
2020-11-16 08:48:02 +00:00
if z.DecCheckBreak() {
2017-11-16 20:53:39 +00:00
break
}
}
2020-11-16 08:48:02 +00:00
z.DecReadMapElemKey()
2018-04-14 18:24:25 +00:00
yys3 := z.StringView(r.DecodeStringAsBytes())
2020-11-16 08:48:02 +00:00
z.DecReadMapElemValue()
2017-11-16 20:53:39 +00:00
switch yys3 {
case "time":
2020-11-16 08:48:02 +00:00
x.Time = (string)(string(r.DecodeStringAsBytes()))
2017-11-16 20:53:39 +00:00
case "status":
2020-11-16 08:48:02 +00:00
x.Status = (string)(string(r.DecodeStringAsBytes()))
2017-11-16 20:53:39 +00:00
case "detail":
2020-11-16 08:48:02 +00:00
x.Detail = (string)(string(r.DecodeStringAsBytes()))
2017-11-16 20:53:39 +00:00
case "result":
2020-11-16 08:48:02 +00:00
z.F.DecSliceIntfX(&x.Result, d)
2017-11-16 20:53:39 +00:00
default:
z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3
} // end for yyj3
}
func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
2020-12-09 22:21:16 +00:00
var h codecSelfer7046
2020-11-16 08:48:02 +00:00
z, r := codec1978.GenHelper().Decoder(d)
2017-11-16 20:53:39 +00:00
_, _, _ = h, z, r
2018-04-14 18:24:25 +00:00
var yyj9 int
var yyb9 bool
var yyhl9 bool = l >= 0
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
2017-11-16 20:53:39 +00:00
} else {
2020-11-16 08:48:02 +00:00
yyb9 = z.DecCheckBreak()
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
if yyb9 {
2020-11-16 08:48:02 +00:00
z.DecReadArrayEnd()
2017-11-16 20:53:39 +00:00
return
}
2020-11-16 08:48:02 +00:00
z.DecReadArrayElem()
x.Time = (string)(string(r.DecodeStringAsBytes()))
2018-04-14 18:24:25 +00:00
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
2017-11-16 20:53:39 +00:00
} else {
2020-11-16 08:48:02 +00:00
yyb9 = z.DecCheckBreak()
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
if yyb9 {
2020-11-16 08:48:02 +00:00
z.DecReadArrayEnd()
2017-11-16 20:53:39 +00:00
return
}
2020-11-16 08:48:02 +00:00
z.DecReadArrayElem()
x.Status = (string)(string(r.DecodeStringAsBytes()))
2018-04-14 18:24:25 +00:00
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
2017-11-16 20:53:39 +00:00
} else {
2020-11-16 08:48:02 +00:00
yyb9 = z.DecCheckBreak()
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
if yyb9 {
2020-11-16 08:48:02 +00:00
z.DecReadArrayEnd()
2017-11-16 20:53:39 +00:00
return
}
2020-11-16 08:48:02 +00:00
z.DecReadArrayElem()
x.Detail = (string)(string(r.DecodeStringAsBytes()))
2018-04-14 18:24:25 +00:00
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
2017-11-16 20:53:39 +00:00
} else {
2020-11-16 08:48:02 +00:00
yyb9 = z.DecCheckBreak()
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
if yyb9 {
2020-11-16 08:48:02 +00:00
z.DecReadArrayEnd()
2017-11-16 20:53:39 +00:00
return
}
2020-11-16 08:48:02 +00:00
z.DecReadArrayElem()
z.F.DecSliceIntfX(&x.Result, d)
2017-11-16 20:53:39 +00:00
for {
2018-04-14 18:24:25 +00:00
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
2017-11-16 20:53:39 +00:00
} else {
2020-11-16 08:48:02 +00:00
yyb9 = z.DecCheckBreak()
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
if yyb9 {
2017-11-16 20:53:39 +00:00
break
}
2020-11-16 08:48:02 +00:00
z.DecReadArrayElem()
2018-04-14 18:24:25 +00:00
z.DecStructFieldNotFound(yyj9-1, "")
2017-11-16 20:53:39 +00:00
}
2020-11-16 08:48:02 +00:00
}
func (x *Response) IsCodecEmpty() bool {
2020-12-09 22:21:16 +00:00
return !(x.Time != "" || x.Status != "" || x.Detail != "" || len(x.Result) != 0 || false)
2017-11-16 20:53:39 +00:00
}
func (x *Dispatch) CodecEncodeSelf(e *codec1978.Encoder) {
2020-12-09 22:21:16 +00:00
var h codecSelfer7046
2020-11-16 08:48:02 +00:00
z, r := codec1978.GenHelper().Encoder(e)
2017-11-16 20:53:39 +00:00
_, _, _ = h, z, r
if x == nil {
r.EncodeNil()
} else {
2020-11-16 08:48:02 +00:00
yy2arr2 := z.EncBasicHandle().StructToArray
_ = yy2arr2
const yyr2 bool = false // struct tag has 'toArray'
var yyq2 = [3]bool{ // should field at this index be written?
x.Query != "", // query
x.Action != "", // action
x.Result != nil, // result
}
_ = yyq2
if yyr2 || yy2arr2 {
z.EncWriteArrayStart(3)
z.EncWriteArrayElem()
if yyq2[0] {
r.EncodeString(string(x.Query))
} else {
r.EncodeString("")
2017-11-16 20:53:39 +00:00
}
2020-11-16 08:48:02 +00:00
z.EncWriteArrayElem()
if yyq2[1] {
r.EncodeString(string(x.Action))
2017-11-16 20:53:39 +00:00
} else {
2020-11-16 08:48:02 +00:00
r.EncodeString("")
2017-11-16 20:53:39 +00:00
}
2020-11-16 08:48:02 +00:00
z.EncWriteArrayElem()
if yyq2[2] {
z.EncFallback(x.Result)
2019-11-20 14:16:56 +00:00
} else {
2020-11-16 08:48:02 +00:00
r.EncodeNil()
}
z.EncWriteArrayEnd()
} else {
var yynn2 int
for _, b := range yyq2 {
if b {
yynn2++
2017-11-16 20:53:39 +00:00
}
}
2020-11-16 08:48:02 +00:00
z.EncWriteMapStart(yynn2)
yynn2 = 0
if yyq2[0] {
z.EncWriteMapElemKey()
if z.IsJSONHandle() {
z.WriteStr("\"query\"")
2017-11-16 20:53:39 +00:00
} else {
2020-11-16 08:48:02 +00:00
r.EncodeString(`query`)
2017-11-16 20:53:39 +00:00
}
2020-11-16 08:48:02 +00:00
z.EncWriteMapElemValue()
r.EncodeString(string(x.Query))
2017-11-16 20:53:39 +00:00
}
2020-11-16 08:48:02 +00:00
if yyq2[1] {
z.EncWriteMapElemKey()
if z.IsJSONHandle() {
z.WriteStr("\"action\"")
2019-11-20 13:20:27 +00:00
} else {
2020-11-16 08:48:02 +00:00
r.EncodeString(`action`)
2019-11-20 14:16:56 +00:00
}
2020-11-16 08:48:02 +00:00
z.EncWriteMapElemValue()
r.EncodeString(string(x.Action))
2019-11-20 14:16:56 +00:00
}
2020-11-16 08:48:02 +00:00
if yyq2[2] {
z.EncWriteMapElemKey()
if z.IsJSONHandle() {
z.WriteStr("\"result\"")
} else {
r.EncodeString(`result`)
}
z.EncWriteMapElemValue()
z.EncFallback(x.Result)
2017-11-16 20:53:39 +00:00
}
2020-11-16 08:48:02 +00:00
z.EncWriteMapEnd()
2017-11-16 20:53:39 +00:00
}
}
}
func (x *Dispatch) CodecDecodeSelf(d *codec1978.Decoder) {
2020-12-09 22:21:16 +00:00
var h codecSelfer7046
2020-11-16 08:48:02 +00:00
z, r := codec1978.GenHelper().Decoder(d)
2017-11-16 20:53:39 +00:00
_, _, _ = h, z, r
2020-11-16 08:48:02 +00:00
yyct2 := r.ContainerType()
2020-12-09 22:21:16 +00:00
if yyct2 == codecSelferValueTypeNil7046 {
2020-11-16 08:48:02 +00:00
*(x) = Dispatch{}
2020-12-09 22:21:16 +00:00
} else if yyct2 == codecSelferValueTypeMap7046 {
2020-11-16 08:48:02 +00:00
yyl2 := z.DecReadMapStart()
if yyl2 == 0 {
2017-11-16 20:53:39 +00:00
} else {
2020-11-16 08:48:02 +00:00
x.codecDecodeSelfFromMap(yyl2, d)
}
z.DecReadMapEnd()
2020-12-09 22:21:16 +00:00
} else if yyct2 == codecSelferValueTypeArray7046 {
2020-11-16 08:48:02 +00:00
yyl2 := z.DecReadArrayStart()
if yyl2 != 0 {
x.codecDecodeSelfFromArray(yyl2, d)
2017-11-16 20:53:39 +00:00
}
2020-11-16 08:48:02 +00:00
z.DecReadArrayEnd()
} else {
2020-12-09 22:21:16 +00:00
panic(errCodecSelferOnlyMapOrArrayEncodeToStruct7046)
2017-11-16 20:53:39 +00:00
}
}
func (x *Dispatch) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
2020-12-09 22:21:16 +00:00
var h codecSelfer7046
2020-11-16 08:48:02 +00:00
z, r := codec1978.GenHelper().Decoder(d)
2017-11-16 20:53:39 +00:00
_, _, _ = h, z, r
var yyhl3 bool = l >= 0
for yyj3 := 0; ; yyj3++ {
if yyhl3 {
if yyj3 >= l {
break
}
} else {
2020-11-16 08:48:02 +00:00
if z.DecCheckBreak() {
2017-11-16 20:53:39 +00:00
break
}
}
2020-11-16 08:48:02 +00:00
z.DecReadMapElemKey()
2018-04-14 18:24:25 +00:00
yys3 := z.StringView(r.DecodeStringAsBytes())
2020-11-16 08:48:02 +00:00
z.DecReadMapElemValue()
2017-11-16 20:53:39 +00:00
switch yys3 {
case "query":
2020-11-16 08:48:02 +00:00
x.Query = (string)(string(r.DecodeStringAsBytes()))
2017-11-16 20:53:39 +00:00
case "action":
2020-11-16 08:48:02 +00:00
x.Action = (string)(string(r.DecodeStringAsBytes()))
2017-11-16 20:53:39 +00:00
case "result":
2020-11-16 08:48:02 +00:00
z.DecFallback(&x.Result, true)
2017-11-16 20:53:39 +00:00
default:
z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3
} // end for yyj3
}
func (x *Dispatch) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
2020-12-09 22:21:16 +00:00
var h codecSelfer7046
2020-11-16 08:48:02 +00:00
z, r := codec1978.GenHelper().Decoder(d)
2017-11-16 20:53:39 +00:00
_, _, _ = h, z, r
2018-04-14 18:24:25 +00:00
var yyj8 int
var yyb8 bool
var yyhl8 bool = l >= 0
yyj8++
if yyhl8 {
yyb8 = yyj8 > l
2017-11-16 20:53:39 +00:00
} else {
2020-11-16 08:48:02 +00:00
yyb8 = z.DecCheckBreak()
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
if yyb8 {
2020-11-16 08:48:02 +00:00
z.DecReadArrayEnd()
2017-11-16 20:53:39 +00:00
return
}
2020-11-16 08:48:02 +00:00
z.DecReadArrayElem()
x.Query = (string)(string(r.DecodeStringAsBytes()))
2018-04-14 18:24:25 +00:00
yyj8++
if yyhl8 {
yyb8 = yyj8 > l
2017-11-16 20:53:39 +00:00
} else {
2020-11-16 08:48:02 +00:00
yyb8 = z.DecCheckBreak()
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
if yyb8 {
2020-11-16 08:48:02 +00:00
z.DecReadArrayEnd()
2017-11-16 20:53:39 +00:00
return
}
2020-11-16 08:48:02 +00:00
z.DecReadArrayElem()
x.Action = (string)(string(r.DecodeStringAsBytes()))
2018-04-14 18:24:25 +00:00
yyj8++
if yyhl8 {
yyb8 = yyj8 > l
2017-11-16 20:53:39 +00:00
} else {
2020-11-16 08:48:02 +00:00
yyb8 = z.DecCheckBreak()
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
if yyb8 {
2020-11-16 08:48:02 +00:00
z.DecReadArrayEnd()
2017-11-16 20:53:39 +00:00
return
}
2020-11-16 08:48:02 +00:00
z.DecReadArrayElem()
z.DecFallback(&x.Result, true)
2017-11-16 20:53:39 +00:00
for {
2018-04-14 18:24:25 +00:00
yyj8++
if yyhl8 {
yyb8 = yyj8 > l
2017-11-16 20:53:39 +00:00
} else {
2020-11-16 08:48:02 +00:00
yyb8 = z.DecCheckBreak()
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
if yyb8 {
2017-11-16 20:53:39 +00:00
break
}
2020-11-16 08:48:02 +00:00
z.DecReadArrayElem()
2018-04-14 18:24:25 +00:00
z.DecStructFieldNotFound(yyj8-1, "")
2017-11-16 20:53:39 +00:00
}
2020-11-16 08:48:02 +00:00
}
func (x *Dispatch) IsCodecEmpty() bool {
2020-12-09 22:21:16 +00:00
return !(x.Query != "" || x.Action != "" || x.Result != nil || false)
2017-11-16 20:53:39 +00:00
}