surrealpatch/sql/cork.go

1691 lines
36 KiB
Go
Raw Normal View History

2016-11-04 10:01:19 +00:00
// Copyright © 2016 Abcum Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package sql
import (
"bytes"
"fmt"
"github.com/abcum/cork"
"github.com/abcum/surreal/util/pack"
2016-11-04 10:01:19 +00:00
)
// ##################################################
// ##################################################
// ##################################################
// ##################################################
// ##################################################
// --------------------------------------------------
// Token
// --------------------------------------------------
func (this Token) MarshalText() (data []byte, err error) {
return []byte(this.String()), err
}
func (this Token) MarshalBinary() (data []byte, err error) {
return []byte(this.String()), err
}
func (this *Token) UnmarshalBinary(data []byte) (err error) {
*this = newToken(string(data))
return err
}
// --------------------------------------------------
// ALL
// --------------------------------------------------
func init() {
cork.Register(&All{})
}
func (this *All) ExtendCORK() byte {
return 0x01
}
func (this *All) MarshalCORK() (dst []byte, err error) {
return
}
func (this *All) UnmarshalCORK(src []byte) (err error) {
return
}
func (this All) MarshalText() (data []byte, err error) {
return []byte("*"), err
}
// --------------------------------------------------
2016-11-04 11:34:48 +00:00
// ANY
2016-11-04 10:01:19 +00:00
// --------------------------------------------------
func init() {
cork.Register(&Any{})
}
func (this *Any) ExtendCORK() byte {
return 0x02
}
func (this *Any) MarshalCORK() (dst []byte, err error) {
return
}
func (this *Any) UnmarshalCORK(src []byte) (err error) {
return
}
func (this Any) MarshalText() (data []byte, err error) {
return []byte("?"), err
}
// --------------------------------------------------
// ASC
// --------------------------------------------------
func init() {
cork.Register(&Asc{})
}
func (this *Asc) ExtendCORK() byte {
return 0x03
}
func (this *Asc) MarshalCORK() (dst []byte, err error) {
return
}
func (this *Asc) UnmarshalCORK(src []byte) (err error) {
return
}
func (this Asc) MarshalText() (data []byte, err error) {
return []byte("~ASC~"), err
}
// --------------------------------------------------
// DESC
// --------------------------------------------------
func init() {
cork.Register(&Desc{})
}
func (this *Desc) ExtendCORK() byte {
return 0x04
}
func (this *Desc) MarshalCORK() (dst []byte, err error) {
return
}
func (this *Desc) UnmarshalCORK(src []byte) (err error) {
return
}
func (this Desc) MarshalText() (data []byte, err error) {
return []byte("~DESC~"), err
}
// --------------------------------------------------
// NULL
// --------------------------------------------------
func init() {
cork.Register(&Null{})
}
func (this *Null) ExtendCORK() byte {
return 0x05
}
func (this *Null) MarshalCORK() (dst []byte, err error) {
return
}
func (this *Null) UnmarshalCORK(src []byte) (err error) {
return
}
func (this Null) MarshalText() (data []byte, err error) {
return []byte("~NULL~"), err
}
// --------------------------------------------------
// VOID
// --------------------------------------------------
func init() {
cork.Register(&Void{})
}
func (this *Void) ExtendCORK() byte {
return 0x06
}
func (this *Void) MarshalCORK() (dst []byte, err error) {
return
}
func (this *Void) UnmarshalCORK(src []byte) (err error) {
return
}
func (this Void) MarshalText() (data []byte, err error) {
return []byte("~VOID~"), err
}
// --------------------------------------------------
// EMPTY
// --------------------------------------------------
func init() {
cork.Register(&Empty{})
}
func (this *Empty) ExtendCORK() byte {
return 0x07
}
func (this *Empty) MarshalCORK() (dst []byte, err error) {
return
}
func (this *Empty) UnmarshalCORK(src []byte) (err error) {
return
}
func (this Empty) MarshalText() (data []byte, err error) {
return []byte("~EMPTY~"), err
}
// --------------------------------------------------
// FIELD
// --------------------------------------------------
func init() {
cork.Register(&Field{})
}
func (this *Field) ExtendCORK() byte {
return 0x08
}
func (this *Field) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Expr)
e.Encode(this.Alias)
return b.Bytes(), nil
}
func (this *Field) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Expr)
d.Decode(&this.Alias)
return
}
// --------------------------------------------------
// GROUP
// --------------------------------------------------
func init() {
cork.Register(&Group{})
}
func (this *Group) ExtendCORK() byte {
return 0x09
}
func (this *Group) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Expr)
return b.Bytes(), nil
}
func (this *Group) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Expr)
return
}
// --------------------------------------------------
// ORDER
// --------------------------------------------------
func init() {
cork.Register(&Order{})
}
func (this *Order) ExtendCORK() byte {
return 0x10
}
func (this *Order) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Expr)
e.Encode(this.Dir)
return b.Bytes(), nil
}
func (this *Order) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Expr)
d.Decode(&this.Dir)
return
}
// ##################################################
// ##################################################
// ##################################################
// ##################################################
// ##################################################
// --------------------------------------------------
// SubExpression
// --------------------------------------------------
func init() {
cork.Register(&SubExpression{})
}
func (this *SubExpression) ExtendCORK() byte {
return 0x21
}
func (this *SubExpression) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Expr)
return b.Bytes(), nil
}
func (this *SubExpression) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Expr)
return
}
// --------------------------------------------------
// FuncExpression
// --------------------------------------------------
func init() {
cork.Register(&FuncExpression{})
}
func (this *FuncExpression) ExtendCORK() byte {
return 0x22
}
func (this *FuncExpression) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Name)
e.Encode(this.Args)
return b.Bytes(), nil
}
func (this *FuncExpression) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Name)
d.Decode(&this.Args)
return
}
// --------------------------------------------------
// DataExpression
// --------------------------------------------------
func init() {
cork.Register(&DataExpression{})
}
func (this *DataExpression) ExtendCORK() byte {
return 0x23
}
func (this *DataExpression) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.LHS)
e.Encode(this.Op)
e.Encode(this.RHS)
return b.Bytes(), nil
}
func (this *DataExpression) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.LHS)
d.Decode(&this.Op)
d.Decode(&this.RHS)
return
}
// --------------------------------------------------
// BinaryExpression
// --------------------------------------------------
func init() {
cork.Register(&BinaryExpression{})
}
func (this *BinaryExpression) ExtendCORK() byte {
return 0x24
}
func (this *BinaryExpression) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.LHS)
e.Encode(this.Op)
e.Encode(this.RHS)
return b.Bytes(), nil
}
func (this *BinaryExpression) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.LHS)
d.Decode(&this.Op)
d.Decode(&this.RHS)
return
}
// --------------------------------------------------
// PathExpression
// --------------------------------------------------
func init() {
cork.Register(&PathExpression{})
}
func (this *PathExpression) ExtendCORK() byte {
return 0x25
}
func (this *PathExpression) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Expr)
return b.Bytes(), nil
}
func (this *PathExpression) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Expr)
return
}
// --------------------------------------------------
// PartExpression
// --------------------------------------------------
func init() {
cork.Register(&PartExpression{})
}
func (this *PartExpression) ExtendCORK() byte {
return 0x26
}
func (this *PartExpression) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Part)
return b.Bytes(), nil
}
func (this *PartExpression) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Part)
return
}
// --------------------------------------------------
// JoinExpression
// --------------------------------------------------
func init() {
cork.Register(&JoinExpression{})
}
func (this *JoinExpression) ExtendCORK() byte {
return 0x27
}
func (this *JoinExpression) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Join)
return b.Bytes(), nil
}
func (this *JoinExpression) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Join)
return
}
// --------------------------------------------------
// SubpExpression
// --------------------------------------------------
func init() {
cork.Register(&SubpExpression{})
}
func (this *SubpExpression) ExtendCORK() byte {
return 0x28
}
func (this *SubpExpression) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.What)
e.Encode(this.Name)
e.Encode(this.Cond)
return b.Bytes(), nil
}
func (this *SubpExpression) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.What)
d.Decode(&this.Name)
d.Decode(&this.Cond)
return
}
// --------------------------------------------------
// DiffExpression
// --------------------------------------------------
func init() {
cork.Register(&DiffExpression{})
}
func (this *DiffExpression) ExtendCORK() byte {
return 0x29
}
func (this *DiffExpression) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.JSON)
return b.Bytes(), nil
}
func (this *DiffExpression) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.JSON)
return
}
// --------------------------------------------------
// MergeExpression
// --------------------------------------------------
func init() {
cork.Register(&MergeExpression{})
}
func (this *MergeExpression) ExtendCORK() byte {
return 0x30
}
func (this *MergeExpression) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.JSON)
return b.Bytes(), nil
}
func (this *MergeExpression) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.JSON)
return
}
// --------------------------------------------------
// ContentExpression
// --------------------------------------------------
func init() {
cork.Register(&ContentExpression{})
}
func (this *ContentExpression) ExtendCORK() byte {
return 0x31
}
func (this *ContentExpression) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.JSON)
return b.Bytes(), nil
}
func (this *ContentExpression) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.JSON)
return
}
// ##################################################
// ##################################################
// ##################################################
// ##################################################
// ##################################################
// --------------------------------------------------
// Ident
// --------------------------------------------------
func init() {
cork.Register(&Ident{})
}
func (this Ident) String() string {
return this.ID
}
func (this *Ident) ExtendCORK() byte {
return 0x51
}
func (this *Ident) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.ID)
return b.Bytes(), nil
}
func (this *Ident) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.ID)
return
}
func (this Ident) MarshalText() (data []byte, err error) {
return []byte("ID:" + this.ID), err
}
// --------------------------------------------------
// Param
// --------------------------------------------------
func init() {
cork.Register(&Param{})
}
func (this Param) String() string {
return this.ID
}
func (this *Param) ExtendCORK() byte {
return 0x52
}
func (this *Param) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.ID)
return b.Bytes(), nil
}
func (this *Param) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.ID)
return
}
func (this Param) MarshalText() (data []byte, err error) {
return []byte("ID:" + this.ID), err
}
// --------------------------------------------------
// Table
// --------------------------------------------------
func init() {
cork.Register(&Table{})
}
func (this Table) String() string {
return this.TB
}
func (this *Table) ExtendCORK() byte {
return 0x53
}
func (this *Table) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.TB)
return b.Bytes(), nil
}
func (this *Table) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.TB)
return
}
func (this Table) MarshalText() (data []byte, err error) {
return []byte("TB:" + this.TB), err
}
// --------------------------------------------------
// Thing
// --------------------------------------------------
func init() {
cork.Register(&Thing{})
}
func (this Thing) Bytes() []byte {
return []byte(this.String())
}
func (this Thing) String() string {
return fmt.Sprintf("@%s:%v", this.TB, this.ID)
}
func (this *Thing) ExtendCORK() byte {
return 0x54
}
func (this *Thing) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.TB)
e.Encode(this.ID)
return b.Bytes(), nil
}
func (this *Thing) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.TB)
d.Decode(&this.ID)
return
}
func (this Thing) MarshalText() (data []byte, err error) {
return []byte(this.String()), err
}
// ##################################################
// ##################################################
// ##################################################
// ##################################################
// ##################################################
// --------------------------------------------------
// LiveStatement
// --------------------------------------------------
func init() {
cork.Register(&LiveStatement{})
}
func (this *LiveStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *LiveStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-04 10:01:19 +00:00
func (this *LiveStatement) ExtendCORK() byte {
return 0x71
}
func (this *LiveStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Expr)
e.Encode(this.What)
e.Encode(this.Cond)
e.Encode(this.Echo)
return b.Bytes(), nil
}
func (this *LiveStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Expr)
d.Decode(&this.What)
d.Decode(&this.Cond)
d.Decode(&this.Echo)
return
}
// --------------------------------------------------
// SelectStatement
// --------------------------------------------------
func init() {
cork.Register(&SelectStatement{})
}
func (this *SelectStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *SelectStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-04 10:01:19 +00:00
func (this *SelectStatement) ExtendCORK() byte {
return 0x72
}
func (this *SelectStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Expr)
e.Encode(this.What)
e.Encode(this.Cond)
e.Encode(this.Group)
e.Encode(this.Order)
e.Encode(this.Limit)
e.Encode(this.Start)
e.Encode(this.Version)
e.Encode(this.Echo)
return b.Bytes(), nil
}
func (this *SelectStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Expr)
d.Decode(&this.What)
d.Decode(&this.Cond)
d.Decode(&this.Group)
d.Decode(&this.Order)
d.Decode(&this.Limit)
d.Decode(&this.Start)
d.Decode(&this.Version)
d.Decode(&this.Echo)
return
}
// --------------------------------------------------
// CreateStatement
// --------------------------------------------------
func init() {
cork.Register(&CreateStatement{})
}
func (this *CreateStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *CreateStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-04 10:01:19 +00:00
func (this *CreateStatement) ExtendCORK() byte {
return 0x73
}
func (this *CreateStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.What)
e.Encode(this.Data)
e.Encode(this.Echo)
return b.Bytes(), nil
}
func (this *CreateStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.What)
d.Decode(&this.Data)
d.Decode(&this.Echo)
return
}
// --------------------------------------------------
// UpdateStatement
// --------------------------------------------------
func init() {
cork.Register(&UpdateStatement{})
}
func (this *UpdateStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *UpdateStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-04 10:01:19 +00:00
func (this *UpdateStatement) ExtendCORK() byte {
return 0x74
}
func (this *UpdateStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Hard)
e.Encode(this.What)
e.Encode(this.Data)
e.Encode(this.Cond)
e.Encode(this.Echo)
return b.Bytes(), nil
}
func (this *UpdateStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Hard)
d.Decode(&this.What)
d.Decode(&this.Data)
d.Decode(&this.Cond)
d.Decode(&this.Echo)
return
}
// --------------------------------------------------
// DeleteStatement
// --------------------------------------------------
func init() {
cork.Register(&DeleteStatement{})
}
func (this *DeleteStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *DeleteStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-04 10:01:19 +00:00
func (this *DeleteStatement) ExtendCORK() byte {
return 0x75
}
func (this *DeleteStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Hard)
e.Encode(this.What)
e.Encode(this.Cond)
e.Encode(this.Echo)
return b.Bytes(), nil
}
func (this *DeleteStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Hard)
d.Decode(&this.What)
d.Decode(&this.Cond)
d.Decode(&this.Echo)
return
}
// --------------------------------------------------
// RelateStatement
// --------------------------------------------------
func init() {
cork.Register(&RelateStatement{})
}
func (this *RelateStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *RelateStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-04 10:01:19 +00:00
func (this *RelateStatement) ExtendCORK() byte {
return 0x76
}
func (this *RelateStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Type)
e.Encode(this.From)
e.Encode(this.With)
e.Encode(this.Data)
e.Encode(this.Uniq)
e.Encode(this.Echo)
return b.Bytes(), nil
}
func (this *RelateStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Type)
d.Decode(&this.From)
d.Decode(&this.With)
d.Decode(&this.Data)
d.Decode(&this.Uniq)
d.Decode(&this.Echo)
return
}
// --------------------------------------------------
// DefineNamespaceStatement
// --------------------------------------------------
func init() {
cork.Register(&DefineNamespaceStatement{})
}
func (this *DefineNamespaceStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *DefineNamespaceStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
func (this *DefineNamespaceStatement) ExtendCORK() byte {
return 0x77
}
func (this *DefineNamespaceStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Name)
return b.Bytes(), nil
}
func (this *DefineNamespaceStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Name)
return
}
// --------------------------------------------------
// RemoveNamespaceStatement
// --------------------------------------------------
func init() {
cork.Register(&RemoveNamespaceStatement{})
}
func (this *RemoveNamespaceStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *RemoveNamespaceStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
func (this *RemoveNamespaceStatement) ExtendCORK() byte {
return 0x78
}
func (this *RemoveNamespaceStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Name)
return b.Bytes(), nil
}
func (this *RemoveNamespaceStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Name)
return
}
// --------------------------------------------------
// DefineDatabaseStatement
// --------------------------------------------------
func init() {
cork.Register(&DefineDatabaseStatement{})
}
func (this *DefineDatabaseStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *DefineDatabaseStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
func (this *DefineDatabaseStatement) ExtendCORK() byte {
return 0x79
}
func (this *DefineDatabaseStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Name)
return b.Bytes(), nil
}
func (this *DefineDatabaseStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Name)
return
}
// --------------------------------------------------
// RemoveDatabaseStatement
// --------------------------------------------------
func init() {
cork.Register(&RemoveDatabaseStatement{})
}
func (this *RemoveDatabaseStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *RemoveDatabaseStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
func (this *RemoveDatabaseStatement) ExtendCORK() byte {
return 0x80
}
func (this *RemoveDatabaseStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Name)
return b.Bytes(), nil
}
func (this *RemoveDatabaseStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Name)
return
}
2016-11-16 22:43:36 +00:00
// --------------------------------------------------
// DefineLoginStatement
// --------------------------------------------------
func init() {
cork.Register(&DefineLoginStatement{})
}
func (this *DefineLoginStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *DefineLoginStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-16 22:43:36 +00:00
func (this *DefineLoginStatement) ExtendCORK() byte {
return 0x81
}
func (this *DefineLoginStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Kind)
e.Encode(this.User)
e.Encode(this.Pass)
e.Encode(this.Code)
2016-11-16 22:43:36 +00:00
return b.Bytes(), nil
}
func (this *DefineLoginStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Kind)
d.Decode(&this.User)
d.Decode(&this.Pass)
d.Decode(&this.Code)
2016-11-16 22:43:36 +00:00
return
}
// --------------------------------------------------
// RemoveLoginStatement
// --------------------------------------------------
func init() {
cork.Register(&RemoveLoginStatement{})
}
func (this *RemoveLoginStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *RemoveLoginStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-16 22:43:36 +00:00
func (this *RemoveLoginStatement) ExtendCORK() byte {
return 0x82
}
func (this *RemoveLoginStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Kind)
e.Encode(this.User)
return b.Bytes(), nil
}
func (this *RemoveLoginStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Kind)
d.Decode(&this.User)
return
}
2016-11-16 22:47:23 +00:00
// --------------------------------------------------
// DefineTokenStatement
// --------------------------------------------------
func init() {
cork.Register(&DefineTokenStatement{})
}
func (this *DefineTokenStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *DefineTokenStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-16 22:47:23 +00:00
func (this *DefineTokenStatement) ExtendCORK() byte {
return 0x81
}
func (this *DefineTokenStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Kind)
e.Encode(this.Name)
e.Encode(this.Type)
e.Encode(this.Code)
2016-11-16 22:47:23 +00:00
return b.Bytes(), nil
}
func (this *DefineTokenStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Kind)
d.Decode(&this.Name)
d.Decode(&this.Type)
d.Decode(&this.Code)
2016-11-16 22:47:23 +00:00
return
}
// --------------------------------------------------
// RemoveTokenStatement
// --------------------------------------------------
func init() {
cork.Register(&RemoveTokenStatement{})
}
func (this *RemoveTokenStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *RemoveTokenStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-16 22:47:23 +00:00
func (this *RemoveTokenStatement) ExtendCORK() byte {
return 0x82
}
func (this *RemoveTokenStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Kind)
e.Encode(this.Name)
return b.Bytes(), nil
}
func (this *RemoveTokenStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Kind)
d.Decode(&this.Name)
return
}
2016-11-04 10:01:19 +00:00
// --------------------------------------------------
// DefineScopeStatement
// --------------------------------------------------
func init() {
cork.Register(&DefineScopeStatement{})
}
func (this *DefineScopeStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *DefineScopeStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-04 10:01:19 +00:00
func (this *DefineScopeStatement) ExtendCORK() byte {
return 0x81
2016-11-04 10:01:19 +00:00
}
func (this *DefineScopeStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Name)
e.Encode(this.Time)
e.Encode(this.Code)
2016-11-16 22:47:43 +00:00
e.Encode(this.Signup)
e.Encode(this.Signin)
2016-11-04 10:01:19 +00:00
return b.Bytes(), nil
}
func (this *DefineScopeStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Name)
d.Decode(&this.Time)
d.Decode(&this.Code)
2016-11-16 22:47:43 +00:00
d.Decode(&this.Signup)
d.Decode(&this.Signin)
2016-11-04 10:01:19 +00:00
return
}
// --------------------------------------------------
// RemoveScopeStatement
// --------------------------------------------------
func init() {
cork.Register(&RemoveScopeStatement{})
}
func (this *RemoveScopeStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *RemoveScopeStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-04 10:01:19 +00:00
func (this *RemoveScopeStatement) ExtendCORK() byte {
return 0x82
2016-11-04 10:01:19 +00:00
}
func (this *RemoveScopeStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Name)
return b.Bytes(), nil
}
func (this *RemoveScopeStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Name)
return
}
// --------------------------------------------------
// DefineTableStatement
// --------------------------------------------------
func init() {
cork.Register(&DefineTableStatement{})
}
func (this *DefineTableStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *DefineTableStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-04 10:01:19 +00:00
func (this *DefineTableStatement) ExtendCORK() byte {
return 0x83
2016-11-04 10:01:19 +00:00
}
func (this *DefineTableStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.What)
e.Encode(this.Full)
return b.Bytes(), nil
}
func (this *DefineTableStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.What)
d.Decode(&this.Full)
return
}
// --------------------------------------------------
// RemoveTableStatement
// --------------------------------------------------
func init() {
cork.Register(&RemoveTableStatement{})
}
func (this *RemoveTableStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *RemoveTableStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-04 10:01:19 +00:00
func (this *RemoveTableStatement) ExtendCORK() byte {
return 0x84
2016-11-04 10:01:19 +00:00
}
func (this *RemoveTableStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.What)
return b.Bytes(), nil
}
func (this *RemoveTableStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.What)
return
}
// --------------------------------------------------
// DefineFieldStatement
// --------------------------------------------------
func init() {
cork.Register(&DefineFieldStatement{})
}
func (this *DefineFieldStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *DefineFieldStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-04 10:01:19 +00:00
func (this *DefineFieldStatement) ExtendCORK() byte {
return 0x85
2016-11-04 10:01:19 +00:00
}
func (this *DefineFieldStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Name)
e.Encode(this.What)
e.Encode(this.Type)
e.Encode(this.Enum)
e.Encode(this.Code)
e.Encode(this.Min)
e.Encode(this.Max)
e.Encode(this.Match)
e.Encode(this.Default)
e.Encode(this.Notnull)
e.Encode(this.Readonly)
e.Encode(this.Mandatory)
e.Encode(this.Validate)
return b.Bytes(), nil
}
func (this *DefineFieldStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Name)
d.Decode(&this.What)
d.Decode(&this.Type)
d.Decode(&this.Enum)
d.Decode(&this.Code)
d.Decode(&this.Min)
d.Decode(&this.Max)
d.Decode(&this.Match)
d.Decode(&this.Default)
d.Decode(&this.Notnull)
d.Decode(&this.Readonly)
d.Decode(&this.Mandatory)
d.Decode(&this.Validate)
return
}
// --------------------------------------------------
// RemoveFieldStatement
// --------------------------------------------------
func init() {
cork.Register(&RemoveFieldStatement{})
}
func (this *RemoveFieldStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *RemoveFieldStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-04 10:01:19 +00:00
func (this *RemoveFieldStatement) ExtendCORK() byte {
return 0x86
2016-11-04 10:01:19 +00:00
}
func (this *RemoveFieldStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Name)
e.Encode(this.What)
return b.Bytes(), nil
}
func (this *RemoveFieldStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Name)
d.Decode(&this.What)
return
}
// --------------------------------------------------
// DefineIndexStatement
// --------------------------------------------------
func init() {
cork.Register(&DefineIndexStatement{})
}
func (this *DefineIndexStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *DefineIndexStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-04 10:01:19 +00:00
func (this *DefineIndexStatement) ExtendCORK() byte {
return 0x87
2016-11-04 10:01:19 +00:00
}
func (this *DefineIndexStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Name)
e.Encode(this.What)
e.Encode(this.Cols)
e.Encode(this.Uniq)
return b.Bytes(), nil
}
func (this *DefineIndexStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Name)
d.Decode(&this.What)
d.Decode(&this.Cols)
d.Decode(&this.Uniq)
return
}
// --------------------------------------------------
// RemoveIndexStatement
// --------------------------------------------------
func init() {
cork.Register(&RemoveIndexStatement{})
}
func (this *RemoveIndexStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *RemoveIndexStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-04 10:01:19 +00:00
func (this *RemoveIndexStatement) ExtendCORK() byte {
return 0x88
2016-11-04 10:01:19 +00:00
}
func (this *RemoveIndexStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Name)
e.Encode(this.What)
return b.Bytes(), nil
}
func (this *RemoveIndexStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Name)
d.Decode(&this.What)
return
}
// --------------------------------------------------
// DefineViewStatement
// --------------------------------------------------
func init() {
cork.Register(&DefineViewStatement{})
}
func (this *DefineViewStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *DefineViewStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-04 10:01:19 +00:00
func (this *DefineViewStatement) ExtendCORK() byte {
return 0x89
2016-11-04 10:01:19 +00:00
}
func (this *DefineViewStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Name)
e.Encode(this.Expr)
e.Encode(this.What)
e.Encode(this.Cond)
e.Encode(this.Group)
return b.Bytes(), nil
}
func (this *DefineViewStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Name)
d.Decode(&this.Expr)
d.Decode(&this.What)
d.Decode(&this.Cond)
d.Decode(&this.Group)
return
}
// --------------------------------------------------
// RemoveViewStatement
// --------------------------------------------------
func init() {
cork.Register(&RemoveViewStatement{})
}
func (this *RemoveViewStatement) Decode(src []byte) {
pack.Decode(src, &this)
}
func (this *RemoveViewStatement) Encode() (dst []byte) {
return pack.Encode(this)
}
2016-11-04 10:01:19 +00:00
func (this *RemoveViewStatement) ExtendCORK() byte {
return 0x90
2016-11-04 10:01:19 +00:00
}
func (this *RemoveViewStatement) MarshalCORK() (dst []byte, err error) {
b := bytes.NewBuffer(dst)
e := cork.NewEncoder(b)
e.Encode(this.Name)
return b.Bytes(), nil
}
func (this *RemoveViewStatement) UnmarshalCORK(src []byte) (err error) {
b := bytes.NewBuffer(src)
d := cork.NewDecoder(b)
d.Decode(&this.Name)
return
}