surrealpatch/db/db.gen.go

639 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 ----
2019-11-20 14:16:56 +00:00
codecSelferCcUTF88369 = 1
codecSelferCcRAW8369 = 255
2017-11-16 20:53:39 +00:00
// ----- value types used ----
2019-11-20 14:16:56 +00:00
codecSelferValueTypeArray8369 = 10
codecSelferValueTypeMap8369 = 9
codecSelferValueTypeString8369 = 6
codecSelferValueTypeInt8369 = 2
codecSelferValueTypeUint8369 = 3
codecSelferValueTypeFloat8369 = 4
codecSelferBitsize8369 = uint8(32 << (^uint(0) >> 63))
2017-11-16 20:53:39 +00:00
)
var (
2019-11-20 14:16:56 +00:00
errCodecSelferOnlyMapOrArrayEncodeToStruct8369 = errors.New(`only encoded map or array can be decoded into a struct`)
2017-11-16 20:53:39 +00:00
)
2019-11-20 14:16:56 +00:00
type codecSelfer8369 struct{}
2017-11-16 20:53:39 +00:00
func init() {
2019-11-20 14:16:56 +00:00
if codec1978.GenVersion != 10 {
2017-11-16 20:53:39 +00:00
_, file, _, _ := runtime.Caller(0)
2019-11-20 14:16:56 +00:00
panic("codecgen version mismatch: current: 10, need " + strconv.FormatInt(int64(codec1978.GenVersion), 10) + ". Re-generate file: " + file)
}
if false {
var _ byte = 0 // reference the types, but skip this branch at build/run time
2017-11-16 20:53:39 +00:00
}
}
func (x *Response) CodecEncodeSelf(e *codec1978.Encoder) {
2019-11-20 14:16:56 +00:00
var h codecSelfer8369
2017-11-16 20:53:39 +00:00
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
if x == nil {
r.EncodeNil()
} else {
2019-11-20 14:16:56 +00:00
if false {
} else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
z.EncExtension(x, yyxt1)
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
_, _ = yysep2, 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
2017-11-16 20:53:39 +00:00
}
2019-11-20 14:16:56 +00:00
_ = yyq2
if yyr2 || yy2arr2 {
r.WriteArrayStart(4)
2017-11-16 20:53:39 +00:00
} else {
2019-11-20 14:16:56 +00:00
var yynn2 int
for _, b := range yyq2 {
if b {
yynn2++
}
}
r.WriteMapStart(yynn2)
yynn2 = 0
2017-11-16 20:53:39 +00:00
}
2019-11-20 14:16:56 +00:00
if yyr2 || yy2arr2 {
r.WriteArrayElem()
if yyq2[0] {
if false {
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, string(x.Time))
}
2017-11-16 20:53:39 +00:00
} else {
2019-11-20 14:16:56 +00:00
r.EncodeStringEnc(codecSelferCcUTF88369, "")
}
2017-11-16 20:53:39 +00:00
} else {
2019-11-20 14:16:56 +00:00
if yyq2[0] {
r.WriteMapElemKey()
if z.IsJSONHandle() {
z.WriteStr("\"time\"")
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, `time`)
}
r.WriteMapElemValue()
if false {
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, string(x.Time))
}
2017-11-16 20:53:39 +00:00
}
}
2019-11-20 14:16:56 +00:00
if yyr2 || yy2arr2 {
r.WriteArrayElem()
if yyq2[1] {
if false {
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, string(x.Status))
}
2017-11-16 20:53:39 +00:00
} else {
2019-11-20 14:16:56 +00:00
r.EncodeStringEnc(codecSelferCcUTF88369, "")
2017-11-16 20:53:39 +00:00
}
2019-11-20 14:16:56 +00:00
} else {
if yyq2[1] {
r.WriteMapElemKey()
if z.IsJSONHandle() {
z.WriteStr("\"status\"")
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, `status`)
}
r.WriteMapElemValue()
if false {
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, string(x.Status))
}
2017-11-16 20:53:39 +00:00
}
2019-11-20 13:20:27 +00:00
}
2019-11-20 14:16:56 +00:00
if yyr2 || yy2arr2 {
r.WriteArrayElem()
if yyq2[2] {
if false {
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, string(x.Detail))
}
2019-11-20 13:20:27 +00:00
} else {
2019-11-20 14:16:56 +00:00
r.EncodeStringEnc(codecSelferCcUTF88369, "")
}
} else {
if yyq2[2] {
r.WriteMapElemKey()
if z.IsJSONHandle() {
z.WriteStr("\"detail\"")
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, `detail`)
}
r.WriteMapElemValue()
if false {
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, string(x.Detail))
}
2017-11-16 20:53:39 +00:00
}
}
2019-11-20 14:16:56 +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)
}
}
2019-11-20 13:20:27 +00:00
} else {
r.EncodeNil()
2019-11-20 14:16:56 +00:00
}
} else {
if yyq2[3] {
r.WriteMapElemKey()
if z.IsJSONHandle() {
z.WriteStr("\"result\"")
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, `result`)
}
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()
2017-11-16 20:53:39 +00:00
}
}
}
}
func (x *Response) CodecDecodeSelf(d *codec1978.Decoder) {
2019-11-20 14:16:56 +00:00
var h codecSelfer8369
2017-11-16 20:53:39 +00:00
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
2019-11-20 14:16:56 +00:00
if false {
} else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
z.DecExtension(x, yyxt1)
} else {
yyct2 := r.ContainerType()
if yyct2 == codecSelferValueTypeMap8369 {
yyl2 := r.ReadMapStart()
if yyl2 == 0 {
r.ReadMapEnd()
} else {
x.codecDecodeSelfFromMap(yyl2, d)
}
} else if yyct2 == codecSelferValueTypeArray8369 {
yyl2 := r.ReadArrayStart()
if yyl2 == 0 {
r.ReadArrayEnd()
} else {
x.codecDecodeSelfFromArray(yyl2, d)
}
2017-11-16 20:53:39 +00:00
} else {
2019-11-20 14:16:56 +00:00
panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8369)
2017-11-16 20:53:39 +00:00
}
}
}
func (x *Response) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
2019-11-20 14:16:56 +00:00
var h codecSelfer8369
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 {
2019-11-20 14:16:56 +00:00
if r.CheckBreak() {
2017-11-16 20:53:39 +00:00
break
}
}
2019-11-20 14:16:56 +00:00
r.ReadMapElemKey()
2018-04-14 18:24:25 +00:00
yys3 := z.StringView(r.DecodeStringAsBytes())
2019-11-20 14:16:56 +00:00
r.ReadMapElemValue()
2017-11-16 20:53:39 +00:00
switch yys3 {
case "time":
2019-11-20 14:16:56 +00:00
if r.TryDecodeAsNil() {
x.Time = ""
} else {
x.Time = (string)(r.DecodeString())
}
2017-11-16 20:53:39 +00:00
case "status":
2019-11-20 14:16:56 +00:00
if r.TryDecodeAsNil() {
x.Status = ""
} else {
x.Status = (string)(r.DecodeString())
}
2017-11-16 20:53:39 +00:00
case "detail":
2019-11-20 14:16:56 +00:00
if r.TryDecodeAsNil() {
x.Detail = ""
} else {
x.Detail = (string)(r.DecodeString())
}
2017-11-16 20:53:39 +00:00
case "result":
2019-11-20 14:16:56 +00:00
if r.TryDecodeAsNil() {
x.Result = nil
} else {
if false {
} else {
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
2019-11-20 14:16:56 +00:00
r.ReadMapEnd()
2017-11-16 20:53:39 +00:00
}
func (x *Response) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
2019-11-20 14:16:56 +00:00
var h codecSelfer8369
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 {
2019-11-20 14:16:56 +00:00
yyb9 = r.CheckBreak()
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
if yyb9 {
2019-11-20 14:16:56 +00:00
r.ReadArrayEnd()
2017-11-16 20:53:39 +00:00
return
}
2019-11-20 14:16:56 +00:00
r.ReadArrayElem()
if r.TryDecodeAsNil() {
x.Time = ""
} else {
x.Time = (string)(r.DecodeString())
}
2018-04-14 18:24:25 +00:00
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
2017-11-16 20:53:39 +00:00
} else {
2019-11-20 14:16:56 +00:00
yyb9 = r.CheckBreak()
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
if yyb9 {
2019-11-20 14:16:56 +00:00
r.ReadArrayEnd()
2017-11-16 20:53:39 +00:00
return
}
2019-11-20 14:16:56 +00:00
r.ReadArrayElem()
if r.TryDecodeAsNil() {
x.Status = ""
} else {
x.Status = (string)(r.DecodeString())
}
2018-04-14 18:24:25 +00:00
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
2017-11-16 20:53:39 +00:00
} else {
2019-11-20 14:16:56 +00:00
yyb9 = r.CheckBreak()
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
if yyb9 {
2019-11-20 14:16:56 +00:00
r.ReadArrayEnd()
2017-11-16 20:53:39 +00:00
return
}
2019-11-20 14:16:56 +00:00
r.ReadArrayElem()
if r.TryDecodeAsNil() {
x.Detail = ""
} else {
x.Detail = (string)(r.DecodeString())
}
2018-04-14 18:24:25 +00:00
yyj9++
if yyhl9 {
yyb9 = yyj9 > l
2017-11-16 20:53:39 +00:00
} else {
2019-11-20 14:16:56 +00:00
yyb9 = r.CheckBreak()
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
if yyb9 {
2019-11-20 14:16:56 +00:00
r.ReadArrayEnd()
2017-11-16 20:53:39 +00:00
return
}
2019-11-20 14:16:56 +00:00
r.ReadArrayElem()
if r.TryDecodeAsNil() {
x.Result = nil
} else {
if false {
} else {
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 {
2019-11-20 14:16:56 +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
}
2019-11-20 14:16:56 +00:00
r.ReadArrayElem()
2018-04-14 18:24:25 +00:00
z.DecStructFieldNotFound(yyj9-1, "")
2017-11-16 20:53:39 +00:00
}
2019-11-20 14:16:56 +00:00
r.ReadArrayEnd()
2017-11-16 20:53:39 +00:00
}
func (x *Dispatch) CodecEncodeSelf(e *codec1978.Encoder) {
2019-11-20 14:16:56 +00:00
var h codecSelfer8369
2017-11-16 20:53:39 +00:00
z, r := codec1978.GenHelperEncoder(e)
_, _, _ = h, z, r
if x == nil {
r.EncodeNil()
} else {
2019-11-20 14:16:56 +00:00
if false {
} else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
z.EncExtension(x, yyxt1)
} else {
yysep2 := !z.EncBinary()
yy2arr2 := z.EncBasicHandle().StructToArray
_, _ = yysep2, 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
2017-11-16 20:53:39 +00:00
}
2019-11-20 14:16:56 +00:00
_ = yyq2
if yyr2 || yy2arr2 {
r.WriteArrayStart(3)
2017-11-16 20:53:39 +00:00
} else {
2019-11-20 14:16:56 +00:00
var yynn2 int
for _, b := range yyq2 {
if b {
yynn2++
}
2017-11-16 20:53:39 +00:00
}
2019-11-20 14:16:56 +00:00
r.WriteMapStart(yynn2)
yynn2 = 0
2017-11-16 20:53:39 +00:00
}
2019-11-20 14:16:56 +00:00
if yyr2 || yy2arr2 {
r.WriteArrayElem()
if yyq2[0] {
if false {
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, string(x.Query))
}
2017-11-16 20:53:39 +00:00
} else {
2019-11-20 14:16:56 +00:00
r.EncodeStringEnc(codecSelferCcUTF88369, "")
}
} else {
if yyq2[0] {
r.WriteMapElemKey()
if z.IsJSONHandle() {
z.WriteStr("\"query\"")
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, `query`)
}
r.WriteMapElemValue()
if false {
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, string(x.Query))
}
2017-11-16 20:53:39 +00:00
}
}
2019-11-20 14:16:56 +00:00
if yyr2 || yy2arr2 {
r.WriteArrayElem()
if yyq2[1] {
if false {
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, string(x.Action))
}
2017-11-16 20:53:39 +00:00
} else {
2019-11-20 14:16:56 +00:00
r.EncodeStringEnc(codecSelferCcUTF88369, "")
}
} else {
if yyq2[1] {
r.WriteMapElemKey()
if z.IsJSONHandle() {
z.WriteStr("\"action\"")
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, `action`)
}
r.WriteMapElemValue()
if false {
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, string(x.Action))
}
2017-11-16 20:53:39 +00:00
}
}
2019-11-20 14:16:56 +00:00
if yyr2 || yy2arr2 {
r.WriteArrayElem()
if yyq2[2] {
if x.Result == nil {
r.EncodeNil()
} else {
if false {
} else {
z.EncFallback(x.Result)
}
}
2019-11-20 13:20:27 +00:00
} else {
2019-11-20 14:16:56 +00:00
r.EncodeNil()
2019-11-20 13:20:27 +00:00
}
2019-11-20 14:16:56 +00:00
} else {
if yyq2[2] {
r.WriteMapElemKey()
if z.IsJSONHandle() {
z.WriteStr("\"result\"")
} else {
r.EncodeStringEnc(codecSelferCcUTF88369, `result`)
}
r.WriteMapElemValue()
if x.Result == nil {
r.EncodeNil()
} else {
if false {
} else {
z.EncFallback(x.Result)
}
}
}
}
if yyr2 || yy2arr2 {
r.WriteArrayEnd()
} else {
r.WriteMapEnd()
2017-11-16 20:53:39 +00:00
}
}
}
}
func (x *Dispatch) CodecDecodeSelf(d *codec1978.Decoder) {
2019-11-20 14:16:56 +00:00
var h codecSelfer8369
2017-11-16 20:53:39 +00:00
z, r := codec1978.GenHelperDecoder(d)
_, _, _ = h, z, r
2019-11-20 14:16:56 +00:00
if false {
} else if yyxt1 := z.Extension(z.I2Rtid(x)); yyxt1 != nil {
z.DecExtension(x, yyxt1)
} else {
yyct2 := r.ContainerType()
if yyct2 == codecSelferValueTypeMap8369 {
yyl2 := r.ReadMapStart()
if yyl2 == 0 {
r.ReadMapEnd()
} else {
x.codecDecodeSelfFromMap(yyl2, d)
}
} else if yyct2 == codecSelferValueTypeArray8369 {
yyl2 := r.ReadArrayStart()
if yyl2 == 0 {
r.ReadArrayEnd()
} else {
x.codecDecodeSelfFromArray(yyl2, d)
}
2017-11-16 20:53:39 +00:00
} else {
2019-11-20 14:16:56 +00:00
panic(errCodecSelferOnlyMapOrArrayEncodeToStruct8369)
2017-11-16 20:53:39 +00:00
}
}
}
func (x *Dispatch) codecDecodeSelfFromMap(l int, d *codec1978.Decoder) {
2019-11-20 14:16:56 +00:00
var h codecSelfer8369
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 {
2019-11-20 14:16:56 +00:00
if r.CheckBreak() {
2017-11-16 20:53:39 +00:00
break
}
}
2019-11-20 14:16:56 +00:00
r.ReadMapElemKey()
2018-04-14 18:24:25 +00:00
yys3 := z.StringView(r.DecodeStringAsBytes())
2019-11-20 14:16:56 +00:00
r.ReadMapElemValue()
2017-11-16 20:53:39 +00:00
switch yys3 {
case "query":
2019-11-20 14:16:56 +00:00
if r.TryDecodeAsNil() {
x.Query = ""
} else {
x.Query = (string)(r.DecodeString())
}
2017-11-16 20:53:39 +00:00
case "action":
2019-11-20 14:16:56 +00:00
if r.TryDecodeAsNil() {
x.Action = ""
} else {
x.Action = (string)(r.DecodeString())
}
2017-11-16 20:53:39 +00:00
case "result":
2019-11-20 14:16:56 +00:00
if r.TryDecodeAsNil() {
x.Result = nil
} else {
if false {
} else {
z.DecFallback(&x.Result, true)
}
}
2017-11-16 20:53:39 +00:00
default:
z.DecStructFieldNotFound(-1, yys3)
} // end switch yys3
} // end for yyj3
2019-11-20 14:16:56 +00:00
r.ReadMapEnd()
2017-11-16 20:53:39 +00:00
}
func (x *Dispatch) codecDecodeSelfFromArray(l int, d *codec1978.Decoder) {
2019-11-20 14:16:56 +00:00
var h codecSelfer8369
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 {
2019-11-20 14:16:56 +00:00
yyb8 = r.CheckBreak()
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
if yyb8 {
2019-11-20 14:16:56 +00:00
r.ReadArrayEnd()
2017-11-16 20:53:39 +00:00
return
}
2019-11-20 14:16:56 +00:00
r.ReadArrayElem()
if r.TryDecodeAsNil() {
x.Query = ""
} else {
x.Query = (string)(r.DecodeString())
}
2018-04-14 18:24:25 +00:00
yyj8++
if yyhl8 {
yyb8 = yyj8 > l
2017-11-16 20:53:39 +00:00
} else {
2019-11-20 14:16:56 +00:00
yyb8 = r.CheckBreak()
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
if yyb8 {
2019-11-20 14:16:56 +00:00
r.ReadArrayEnd()
2017-11-16 20:53:39 +00:00
return
}
2019-11-20 14:16:56 +00:00
r.ReadArrayElem()
if r.TryDecodeAsNil() {
x.Action = ""
} else {
x.Action = (string)(r.DecodeString())
}
2018-04-14 18:24:25 +00:00
yyj8++
if yyhl8 {
yyb8 = yyj8 > l
2017-11-16 20:53:39 +00:00
} else {
2019-11-20 14:16:56 +00:00
yyb8 = r.CheckBreak()
2017-11-16 20:53:39 +00:00
}
2018-04-14 18:24:25 +00:00
if yyb8 {
2019-11-20 14:16:56 +00:00
r.ReadArrayEnd()
2017-11-16 20:53:39 +00:00
return
}
2019-11-20 14:16:56 +00:00
r.ReadArrayElem()
if r.TryDecodeAsNil() {
x.Result = nil
} else {
if false {
} else {
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 {
2019-11-20 14:16:56 +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
}
2019-11-20 14:16:56 +00:00
r.ReadArrayElem()
2018-04-14 18:24:25 +00:00
z.DecStructFieldNotFound(yyj8-1, "")
2017-11-16 20:53:39 +00:00
}
2019-11-20 14:16:56 +00:00
r.ReadArrayEnd()
2017-11-16 20:53:39 +00:00
}