surrealpatch/db/db.gen.go

610 lines
12 KiB
Go
Raw Normal View History

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 ----
codecSelferCcUTF84219 = 1
codecSelferCcRAW4219 = 0
2017-11-16 20:53:39 +00:00
// ----- value types used ----
codecSelferValueTypeArray4219 = 10
codecSelferValueTypeMap4219 = 9
codecSelferValueTypeString4219 = 6
codecSelferValueTypeInt4219 = 2
codecSelferValueTypeUint4219 = 3
codecSelferValueTypeFloat4219 = 4
codecSelferBitsize4219 = uint8(32 << (^uint(0) >> 63))
2017-11-16 20:53:39 +00:00
)
var (
errCodecSelferOnlyMapOrArrayEncodeToStruct4219 = errors.New(`only encoded map or array can be decoded into a struct`)
2017-11-16 20:53:39 +00:00
)
type codecSelfer4219 struct{}
2017-11-16 20:53:39 +00:00
func init() {
if codec1978.GenVersion != 8 {
_, file, _, _ := runtime.Caller(0)
2018-04-14 18:24:25 +00:00
panic("codecgen version mismatch: current: 8, need " + strconv.FormatInt(int64(codec1978.GenVersion), 10) + ". Re-generate file: " + file)
2017-11-16 20:53:39 +00:00
}
if false { // reference the types, but skip this branch at build/run time
}
}
func (x *Response) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer4219
2017-11-16 20:53:39 +00:00
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
if x == nil {
r.EncodeNil()
} else {
if false {
2017-12-08 10:05:21 +00:00
} else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
z.EncExtension(x, yyxt1)
2017-11-16 20:53:39 +00:00
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
_, _ = yysep2, yy2arr2
2018-04-14 18:24:25 +00:00
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
2017-11-16 20:53:39 +00:00
if yyr2 || yy2arr2 {
r.WriteArrayStart(4)
} else {
2018-04-14 18:24:25 +00:00
var yynn2 int
2017-11-16 20:53:39 +00:00
for _, b := range yyq2 {
if b {
yynn2++
}
}
r.WriteMapStart(yynn2)
yynn2 = 0
}
if yyr2 || yy2arr2 {
r.WriteArrayElem()
if yyq2[0] {
if false {
} else {
r.EncodeString(codecSelferCcUTF84219, string(x.Time))
2017-11-16 20:53:39 +00:00
}
} else {
r.EncodeString(codecSelferCcUTF84219, "")
2017-11-16 20:53:39 +00:00
}
} else {
if yyq2[0] {
r.WriteMapElemKey()
r.EncodeString(codecSelferCcUTF84219, `time`)
2017-11-16 20:53:39 +00:00
r.WriteMapElemValue()
if false {
} else {
r.EncodeString(codecSelferCcUTF84219, string(x.Time))
2017-11-16 20:53:39 +00:00
}
}
}
if yyr2 || yy2arr2 {
r.WriteArrayElem()
if yyq2[1] {
if false {
} else {
r.EncodeString(codecSelferCcUTF84219, string(x.Status))
2017-11-16 20:53:39 +00:00
}
} else {
r.EncodeString(codecSelferCcUTF84219, "")
2017-11-16 20:53:39 +00:00
}
} else {
if yyq2[1] {
r.WriteMapElemKey()
r.EncodeString(codecSelferCcUTF84219, `status`)
2017-11-16 20:53:39 +00:00
r.WriteMapElemValue()
if false {
} else {
r.EncodeString(codecSelferCcUTF84219, string(x.Status))
2017-11-16 20:53:39 +00:00
}
}
}
if yyr2 || yy2arr2 {
r.WriteArrayElem()
if yyq2[2] {
if false {
} else {
r.EncodeString(codecSelferCcUTF84219, string(x.Detail))
2017-11-16 20:53:39 +00:00
}
} else {
r.EncodeString(codecSelferCcUTF84219, "")
2017-11-16 20:53:39 +00:00
}
} else {
if yyq2[2] {
r.WriteMapElemKey()
r.EncodeString(codecSelferCcUTF84219, `detail`)
2017-11-16 20:53:39 +00:00
r.WriteMapElemValue()
if false {
} else {
r.EncodeString(codecSelferCcUTF84219, string(x.Detail))
2017-11-16 20:53:39 +00:00
}
}
}
if yyr2 || yy2arr2 {
r.WriteArrayElem()
if yyq2[3] {
if x.Result == nil {
r.EncodeNil()
} else {
if false {
} else {
z.F.EncSliceIntfV(x.Result, e)
}
}
} else {
r.EncodeNil()
}
} else {
if yyq2[3] {
r.WriteMapElemKey()
r.EncodeString(codecSelferCcUTF84219, `result`)
2017-11-16 20:53:39 +00:00
r.WriteMapElemValue()
if x.Result == nil {
r.EncodeNil()
} else {
if false {
} else {
z.F.EncSliceIntfV(x.Result, e)
}
}
}
}
if yyr2 || yy2arr2 {
r.WriteArrayEnd()
} else {
r.WriteMapEnd()
}
}
}
}
func (x *Response) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer4219
2017-11-16 20:53:39 +00:00
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
if false {
2017-12-08 10:05:21 +00:00
} else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
z.DecExtension(x, yyxt1)
2017-11-16 20:53:39 +00:00
} else {
yyct2 := r.ContainerType()
if yyct2 == codecSelferValueTypeMap4219 {
2017-11-16 20:53:39 +00:00
yyl2 := r.ReadMapStart()
if yyl2 == 0 {
r.ReadMapEnd()
} else {
x.codecDecodeSelfFromMap(yyl2, d)
}
} else if yyct2 == codecSelferValueTypeArray4219 {
2017-11-16 20:53:39 +00:00
yyl2 := r.ReadArrayStart()
if yyl2 == 0 {
r.ReadArrayEnd()
} else {
x.codecDecodeSelfFromArray(yyl2, d)
}
} else {
panic(errCodecSelferOnlyMapOrArrayEncodeToStruct4219)
2017-11-16 20:53:39 +00:00
}
}
}
func (x *Response) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer4219
2017-11-16 20:53:39 +00:00
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyhl3 bool = l >= 0
for yyj3 := 0; ; yyj3++ {
if yyhl3 {
if yyj3 >= l {
break
}
} else {
if r.CheckBreak() {
break
}
}
r.ReadMapElemKey()
2018-04-14 18:24:25 +00:00
yys3 := z.StringView(r.DecodeStringAsBytes())
2017-11-16 20:53:39 +00:00
r.ReadMapElemValue()
switch yys3 {
case "time":
if r.TryDecodeAsNil() {
x.Time = ""
} else {
2018-04-14 18:24:25 +00:00
x.Time = (string)(r.DecodeString())
2017-11-16 20:53:39 +00:00
}
case "status":
if r.TryDecodeAsNil() {
x.Status = ""
} else {
2018-04-14 18:24:25 +00:00
x.Status = (string)(r.DecodeString())
2017-11-16 20:53:39 +00:00
}
case "detail":
if r.TryDecodeAsNil() {
x.Detail = ""
} else {
2018-04-14 18:24:25 +00:00
x.Detail = (string)(r.DecodeString())
2017-11-16 20:53:39 +00:00
}
case "result":
if r.TryDecodeAsNil() {
x.Result = nil
} else {
if false {
} else {
2018-04-14 18:24:25 +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
r.ReadMapEnd()
}
func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer4219
2017-11-16 20:53:39 +00:00
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = 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 {
2018-04-14 18:24:25 +00:00
yyb9 = r.CheckBreak()
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
r.ReadArrayEnd()
return
}
r.ReadArrayElem()
if r.TryDecodeAsNil() {
x.Time = ""
} else {
2018-04-14 18:24:25 +00:00
x.Time = (string)(r.DecodeString())
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
2017-11-16 20:53:39 +00:00
} else {
2018-04-14 18:24:25 +00:00
yyb9 = r.CheckBreak()
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
r.ReadArrayEnd()
return
}
r.ReadArrayElem()
if r.TryDecodeAsNil() {
x.Status = ""
} else {
2018-04-14 18:24:25 +00:00
x.Status = (string)(r.DecodeString())
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
2017-11-16 20:53:39 +00:00
} else {
2018-04-14 18:24:25 +00:00
yyb9 = r.CheckBreak()
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
r.ReadArrayEnd()
return
}
r.ReadArrayElem()
if r.TryDecodeAsNil() {
x.Detail = ""
} else {
2018-04-14 18:24:25 +00:00
x.Detail = (string)(r.DecodeString())
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
2017-11-16 20:53:39 +00:00
} else {
2018-04-14 18:24:25 +00:00
yyb9 = r.CheckBreak()
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
r.ReadArrayEnd()
return
}
r.ReadArrayElem()
if r.TryDecodeAsNil() {
x.Result = nil
} else {
if false {
} else {
2018-04-14 18:24:25 +00:00
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 {
2018-04-14 18:24:25 +00:00
yyb9 = r.CheckBreak()
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
}
r.ReadArrayElem()
2018-04-14 18:24:25 +00:00
z.DecStructFieldNotFound(yyj9-1, "")
2017-11-16 20:53:39 +00:00
}
r.ReadArrayEnd()
}
func (x *Dispatch) CodecEncodeSelf(e *codec1978.Encoder) {
var h codecSelfer4219
2017-11-16 20:53:39 +00:00
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
if x == nil {
r.EncodeNil()
} else {
if false {
2017-12-08 10:05:21 +00:00
} else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
z.EncExtension(x, yyxt1)
2017-11-16 20:53:39 +00:00
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
_, _ = yysep2, yy2arr2
2018-04-14 18:24:25 +00:00
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
2017-11-16 20:53:39 +00:00
if yyr2 || yy2arr2 {
r.WriteArrayStart(3)
} else {
2018-04-14 18:24:25 +00:00
var yynn2 int
2017-11-16 20:53:39 +00:00
for _, b := range yyq2 {
if b {
yynn2++
}
}
r.WriteMapStart(yynn2)
yynn2 = 0
}
if yyr2 || yy2arr2 {
r.WriteArrayElem()
if yyq2[0] {
if false {
} else {
r.EncodeString(codecSelferCcUTF84219, string(x.Query))
2017-11-16 20:53:39 +00:00
}
} else {
r.EncodeString(codecSelferCcUTF84219, "")
2017-11-16 20:53:39 +00:00
}
} else {
if yyq2[0] {
r.WriteMapElemKey()
r.EncodeString(codecSelferCcUTF84219, `query`)
2017-11-16 20:53:39 +00:00
r.WriteMapElemValue()
if false {
} else {
r.EncodeString(codecSelferCcUTF84219, string(x.Query))
2017-11-16 20:53:39 +00:00
}
}
}
if yyr2 || yy2arr2 {
r.WriteArrayElem()
if yyq2[1] {
if false {
} else {
r.EncodeString(codecSelferCcUTF84219, string(x.Action))
2017-11-16 20:53:39 +00:00
}
} else {
r.EncodeString(codecSelferCcUTF84219, "")
2017-11-16 20:53:39 +00:00
}
} else {
if yyq2[1] {
r.WriteMapElemKey()
r.EncodeString(codecSelferCcUTF84219, `action`)
2017-11-16 20:53:39 +00:00
r.WriteMapElemValue()
if false {
} else {
r.EncodeString(codecSelferCcUTF84219, string(x.Action))
2017-11-16 20:53:39 +00:00
}
}
}
if yyr2 || yy2arr2 {
r.WriteArrayElem()
if yyq2[2] {
if x.Result == nil {
r.EncodeNil()
} else {
if false {
} else {
z.EncFallback(x.Result)
}
}
} else {
r.EncodeNil()
}
} else {
if yyq2[2] {
r.WriteMapElemKey()
r.EncodeString(codecSelferCcUTF84219, `result`)
2017-11-16 20:53:39 +00:00
r.WriteMapElemValue()
if x.Result == nil {
r.EncodeNil()
} else {
if false {
} else {
z.EncFallback(x.Result)
}
}
}
}
if yyr2 || yy2arr2 {
r.WriteArrayEnd()
} else {
r.WriteMapEnd()
}
}
}
}
func (x *Dispatch) CodecDecodeSelf(d *codec1978.Decoder) {
var h codecSelfer4219
2017-11-16 20:53:39 +00:00
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
if false {
2017-12-08 10:05:21 +00:00
} else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
z.DecExtension(x, yyxt1)
2017-11-16 20:53:39 +00:00
} else {
yyct2 := r.ContainerType()
if yyct2 == codecSelferValueTypeMap4219 {
2017-11-16 20:53:39 +00:00
yyl2 := r.ReadMapStart()
if yyl2 == 0 {
r.ReadMapEnd()
} else {
x.codecDecodeSelfFromMap(yyl2, d)
}
} else if yyct2 == codecSelferValueTypeArray4219 {
2017-11-16 20:53:39 +00:00
yyl2 := r.ReadArrayStart()
if yyl2 == 0 {
r.ReadArrayEnd()
} else {
x.codecDecodeSelfFromArray(yyl2, d)
}
} else {
panic(errCodecSelferOnlyMapOrArrayEncodeToStruct4219)
2017-11-16 20:53:39 +00:00
}
}
}
func (x *Dispatch) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
var h codecSelfer4219
2017-11-16 20:53:39 +00:00
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
var yyhl3 bool = l >= 0
for yyj3 := 0; ; yyj3++ {
if yyhl3 {
if yyj3 >= l {
break
}
} else {
if r.CheckBreak() {
break
}
}
r.ReadMapElemKey()
2018-04-14 18:24:25 +00:00
yys3 := z.StringView(r.DecodeStringAsBytes())
2017-11-16 20:53:39 +00:00
r.ReadMapElemValue()
switch yys3 {
case "query":
if r.TryDecodeAsNil() {
x.Query = ""
} else {
2018-04-14 18:24:25 +00:00
x.Query = (string)(r.DecodeString())
2017-11-16 20:53:39 +00:00
}
case "action":
if r.TryDecodeAsNil() {
x.Action = ""
} else {
2018-04-14 18:24:25 +00:00
x.Action = (string)(r.DecodeString())
2017-11-16 20:53:39 +00:00
}
case "result":
if r.TryDecodeAsNil() {
x.Result = nil
} else {
if false {
} else {
2018-04-14 18:24:25 +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
r.ReadMapEnd()
}
func (x *Dispatch) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
var h codecSelfer4219
2017-11-16 20:53:39 +00:00
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = 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 {
2018-04-14 18:24:25 +00:00
yyb8 = r.CheckBreak()
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
r.ReadArrayEnd()
return
}
r.ReadArrayElem()
if r.TryDecodeAsNil() {
x.Query = ""
} else {
2018-04-14 18:24:25 +00:00
x.Query = (string)(r.DecodeString())
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
yyj8++
if yyhl8 {
yyb8 = yyj8 > l
2017-11-16 20:53:39 +00:00
} else {
2018-04-14 18:24:25 +00:00
yyb8 = r.CheckBreak()
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
r.ReadArrayEnd()
return
}
r.ReadArrayElem()
if r.TryDecodeAsNil() {
x.Action = ""
} else {
2018-04-14 18:24:25 +00:00
x.Action = (string)(r.DecodeString())
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
yyj8++
if yyhl8 {
yyb8 = yyj8 > l
2017-11-16 20:53:39 +00:00
} else {
2018-04-14 18:24:25 +00:00
yyb8 = r.CheckBreak()
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
r.ReadArrayEnd()
return
}
r.ReadArrayElem()
if r.TryDecodeAsNil() {
x.Result = nil
} else {
if false {
} else {
2018-04-14 18:24:25 +00:00
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 {
2018-04-14 18:24:25 +00:00
yyb8 = r.CheckBreak()
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
}
r.ReadArrayElem()
2018-04-14 18:24:25 +00:00
z.DecStructFieldNotFound(yyj8-1, "")
2017-11-16 20:53:39 +00:00
}
r.ReadArrayEnd()
}