diff --git a/expr/node.go b/expr/node.go index 419b9dcc..b77933f6 100644 --- a/expr/node.go +++ b/expr/node.go @@ -1,11 +1,10 @@ -// Expression structures, ie the `a = b` type expression syntax -// including parser, node types, boolean logic check, functions. +// Package expr are Expression structures, ie the `a = b` type +// expression AST syntax including parser, node types, boolean logic check, functions. package expr import ( "fmt" "io" - "reflect" "strconv" "strings" "time" @@ -137,7 +136,7 @@ type ( Includer } - // ContextReaderis a key-value interface to read the context of message/row + // ContextReader is a key-value interface to read the context of message/row // using a Get("key") interface. Used by vm to evaluate messages ContextReader interface { Get(key string) (value.Value, bool) @@ -168,26 +167,22 @@ type ( ) type ( - - // Expr represents single part of an Expression, it is a generic AST structure - // that can be built in tree structure and JSON serialized to represent full AST - // as json. - Expr struct { - // The `Op` (aka token), and Args expressions are non - // nil if it is an expression - Op string `json:"op,omitempty"` - Args []*Expr `json:"args,omitempty"` - - // If op is 0, and args nil then exactly one of these should be set - Identity string `json:"ident,omitempty"` - Value string `json:"val,omitempty"` - // Really would like to use these instead of un-typed guesses above - // if we desire serialization into string representation that is fine - // Int int64 - // Float float64 - // Bool bool - } - + /* + // Expr represents single part of an Expression, it is a generic AST structure + // that can be built in tree structure and JSON serialized to represent full AST + // as json. + Expr struct { + // The `Op` (aka token), and Args expressions are non + // nil if it is an expression + Op string `json:"op,omitempty"` + Args []*Expr `json:"args,omitempty"` + + // If op is 0, and args nil then exactly one of these should be set + Identity string `json:"ident,omitempty"` + Value string `json:"val,omitempty"` + ValType int32 `json:"val_type"` + } + */ // Func Describes a function expression which wraps and allows native go functions // to be called in expression vm Func struct { @@ -247,7 +242,7 @@ type ( // value.Values can be strings, numbers, arrays, objects, etc ValueNode struct { Value value.Value - rv reflect.Value + //rv reflect.Value } // BinaryNode is x op y, two nodes (left, right) and an operator @@ -569,9 +564,9 @@ func (m *FuncNode) ChildrenArgs() []Node { func (m *FuncNode) NodePb() *NodePb { n := &FuncNodePb{} n.Name = m.Name - n.Args = make([]NodePb, len(m.Args)) + n.Args = make([]*NodePb, len(m.Args)) for i, a := range m.Args { - n.Args[i] = *a.NodePb() + n.Args[i] = a.NodePb() } return &NodePb{Fn: n} } @@ -600,7 +595,7 @@ func (m *FuncNode) FromPB(n *NodePb) Node { func (m *FuncNode) Expr() *Expr { fe := &Expr{Op: lex.TokenUdfExpr.String()} if len(m.Args) > 0 { - fe.Args = []*Expr{{Identity: m.Name}} + fe.Args = []*Expr{{Ident: m.Name}} fe.Args = append(fe.Args, ExprsFromNodes(m.Args)...) } return fe @@ -613,7 +608,7 @@ func (m *FuncNode) FromExpr(e *Expr) error { return fmt.Errorf("Expected function name in args but got none") } - m.Name = e.Args[0].Identity + m.Name = e.Args[0].Ident if len(e.Args) > 1 { args, err := NodesFromExprs(e.Args[1:]) @@ -733,11 +728,14 @@ func (m *NumberNode) FromPB(n *NodePb) Node { return nn } func (m *NumberNode) Expr() *Expr { - return &Expr{Value: m.Text} + if m.IsInt { + return &Expr{Val: m.Text, ValType: int32(value.IntType)} + } + return &Expr{Val: m.Text, ValType: int32(value.NumberType)} } func (m *NumberNode) FromExpr(e *Expr) error { - if len(e.Value) > 0 { - m.Text = e.Value + if len(e.Val) > 0 { + m.Text = e.Val return m.load() } return nil @@ -797,35 +795,23 @@ func (m *StringNode) Validate() error { return nil } func (m *StringNode) NodePb() *NodePb { n := &StringNodePb{} n.Text = m.Text - if m.noQuote { - n.Noquote = proto.Bool(true) - } - if m.Quote > 0 { - n.Quote = proto.Int32(int32(m.Quote)) - } + n.Noquote = m.noQuote + n.Quote = int32(m.Quote) return &NodePb{Sn: n} } func (m *StringNode) FromPB(n *NodePb) Node { - noQuote := false - quote := 0 - if n.Sn.Noquote != nil { - noQuote = *n.Sn.Noquote - } - if n.Sn.Quote != nil { - quote = int(*n.Sn.Quote) - } return &StringNode{ - noQuote: noQuote, + noQuote: n.Sn.Noquote, Text: n.Sn.Text, - Quote: byte(quote), + Quote: byte(n.Sn.Quote), } } func (m *StringNode) Expr() *Expr { - return &Expr{Value: m.Text} + return &Expr{Val: m.Text, ValType: int32(value.StringType)} } func (m *StringNode) FromExpr(e *Expr) error { - if len(e.Value) > 0 { - m.Text = e.Value + if len(e.Val) > 0 { + m.Text = e.Val } return nil } @@ -849,7 +835,7 @@ func (m *StringNode) Equal(n Node) bool { } func NewValueNode(val value.Value) *ValueNode { - return &ValueNode{Value: val, rv: reflect.ValueOf(val)} + return &ValueNode{Value: val} } func (m *ValueNode) NodeType() string { return "Value" } func (m *ValueNode) String() string { @@ -912,11 +898,11 @@ func (m *ValueNode) FromPB(n *NodePb) Node { return &ValueNode{} } func (m *ValueNode) Expr() *Expr { - return &Expr{Value: m.Value.ToString()} + return &Expr{Val: m.Value.ToString(), ValType: int32(m.Value.Type())} } func (m *ValueNode) FromExpr(e *Expr) error { - if len(e.Value) > 0 { - m.Value = value.NewStringValue(e.Value) + if len(e.Val) > 0 { + m.Value = value.NewStringValue(e.Val) return nil } return fmt.Errorf("unrecognized value") @@ -1033,37 +1019,35 @@ func (m *IdentityNode) Validate() error { return nil } func (m *IdentityNode) IdentityPb() *IdentityNodePb { n := &IdentityNodePb{} n.Text = m.Text - q := int32(m.Quote) - n.Quote = &q + n.Quote = int32(m.Quote) return n } func (m *IdentityNode) NodePb() *NodePb { return &NodePb{In: m.IdentityPb()} } func (m *IdentityNode) FromPB(n *NodePb) Node { - q := n.In.Quote - return &IdentityNode{Text: n.In.Text, Quote: byte(*q)} + return &IdentityNode{Text: n.In.Text, Quote: byte(n.In.Quote)} } func (m *IdentityNode) Expr() *Expr { if m.IsBooleanIdentity() { - return &Expr{Value: m.Text} + return &Expr{Val: m.Text, ValType: int32(value.BoolType)} } if m.HasLeftRight() { if IdentityMaybeQuote('`', m.left) != m.left { //u.Warnf("This will NOT round-trip l:%q r:%q original:%q text:%q", m.left, m.right, m.original, m.Text) } - return &Expr{Identity: fmt.Sprintf("%s.%s", m.left, m.right)} + return &Expr{Ident: fmt.Sprintf("%s.%s", m.left, m.right)} } - return &Expr{Identity: m.Text} + return &Expr{Ident: m.Text} } func (m *IdentityNode) FromExpr(e *Expr) error { - if len(e.Identity) > 0 { - m.Text = e.Identity + if len(e.Ident) > 0 { + m.Text = e.Ident m.load() return nil - } else if e.Value != "" { - m.Text = e.Value + } else if e.Val != "" { + m.Text = e.Val val := strings.ToLower(m.Text) if val != "true" && val != "false" { return fmt.Errorf("Value identities are either 'true' or 'false' but got %q", m.Text) @@ -1131,7 +1115,7 @@ func (m *IdentityNode) HasLeftRight() bool { return m.left != "" } -// Return left, right values if is of form `table.column` or `schema`.`table` and +// LeftRight Return left, right values if is of form `table.column` or `schema`.`table` and // also return true/false for if it even has left & right syntax func (m *IdentityNode) LeftRight() (string, string, bool) { if m.left == "" { @@ -1156,16 +1140,16 @@ func (m *NullNode) FromPB(n *NodePb) Node { return &NullNode{} } func (m *NullNode) Expr() *Expr { - return &Expr{Value: "NULL"} + return &Expr{Val: "NULL"} } func (m *NullNode) FromExpr(e *Expr) error { - if len(e.Identity) > 0 { - if strings.ToLower(e.Identity) == "null" { + if len(e.Ident) > 0 { + if strings.ToLower(e.Ident) == "null" { return nil } } - if len(e.Value) > 0 { - if strings.ToLower(e.Value) == "null" { + if len(e.Val) > 0 { + if strings.ToLower(e.Val) == "null" { return nil } } @@ -1196,10 +1180,10 @@ mul_op = "*" | "/" | "%" | "<<" | ">>" | "&" | "&^" . unary_op = "+" | "-" | "!" | "^" | "*" | "&" | "<-" . */ -// Create a Binary node -// @operator = * + - %/ / && || = == -// @operator = and, or, "is not" -// @lhArg, rhArg the left, right side of binary +// NewBinaryNode Create a Binary node +// @operator = * + - %/ / && || = == +// @operator = and, or, "is not" +// @lhArg, rhArg the left, right side of binary func NewBinaryNode(operator lex.Token, lhArg, rhArg Node) *BinaryNode { //u.Debugf("NewBinaryNode: %v %v %v", lhArg, operator, rhArg) return &BinaryNode{Args: []Node{lhArg, rhArg}, Operator: operator} @@ -1325,7 +1309,7 @@ func (m *BinaryNode) NodePb() *NodePb { n := &BinaryNodePb{} n.Paren = m.Paren n.Op = int32(m.Operator.T) - n.Args = []NodePb{*m.Args[0].NodePb(), *m.Args[1].NodePb()} + n.Args = []*NodePb{m.Args[0].NodePb(), m.Args[1].NodePb()} return &NodePb{Bn: n} } func (m *BinaryNode) FromPB(n *NodePb) Node { @@ -1353,6 +1337,9 @@ func (m *BinaryNode) FromExpr(e *Expr) error { if len(e.Args) == 0 { return fmt.Errorf("Invalid BinaryNode, expected args %+v", e) } + if e.Op == "*" { + m.Operator = lex.Token{T: lex.TokenMultiply, V: "*"} + } args, err := NodesFromExprs(e.Args) if err != nil { return err @@ -1370,7 +1357,9 @@ func (m *BinaryNode) Equal(n Node) bool { if m != nil && n == nil { return false } - if nt, ok := n.(*BinaryNode); ok { + //u.Debugf("%v %v", n, m) + switch nt := n.(type) { + case *BinaryNode: if nt.Operator.T != m.Operator.T { return false } @@ -1379,9 +1368,27 @@ func (m *BinaryNode) Equal(n Node) bool { return false } } - if nt.Paren != m.Paren { + // if nt.Paren != m.Paren { + // return false + // } + if len(m.Args) != len(nt.Args) { + return false + } + for i, arg := range nt.Args { + if !arg.Equal(m.Args[i]) { + return false + } + } + return true + case *BooleanNode: + if nt.Operator.T != m.Operator.T { return false } + if nt.Operator.V != m.Operator.V { + if strings.ToLower(nt.Operator.V) != strings.ToLower(m.Operator.V) { + return false + } + } if len(m.Args) != len(nt.Args) { return false } @@ -1396,8 +1403,8 @@ func (m *BinaryNode) Equal(n Node) bool { } // NewBooleanNode Create a boolean node -// @operator = AND, OR -// @args = nodes +// @operator = AND, OR +// @args = nodes func NewBooleanNode(operator lex.Token, args ...Node) *BooleanNode { //u.Debugf("NewBinaryNode: %v %v %v", lhArg, operator, rhArg) return &BooleanNode{Args: args, Operator: operator} @@ -1426,7 +1433,6 @@ func (m *BooleanNode) WriteDialect(w DialectWriter) { } else { m.writeToString(w, "") } - } func (m *BooleanNode) writeToString(w DialectWriter, negate string) { if len(negate) > 0 { @@ -1473,7 +1479,7 @@ func (m *BooleanNode) NodePb() *NodePb { n := &BooleanNodePb{} n.Op = int32(m.Operator.T) for _, arg := range m.Args { - n.Args = append(n.Args, *arg.NodePb()) + n.Args = append(n.Args, arg.NodePb()) } return &NodePb{Booln: n} } @@ -1518,7 +1524,26 @@ func (m *BooleanNode) Equal(n Node) bool { if m != nil && n == nil { return false } - if nt, ok := n.(*BooleanNode); ok { + switch nt := n.(type) { + case *BinaryNode: + if nt.Operator.T != m.Operator.T { + return false + } + if nt.Operator.V != m.Operator.V { + if strings.ToLower(nt.Operator.V) != strings.ToLower(m.Operator.V) { + return false + } + } + if len(m.Args) != len(nt.Args) { + return false + } + for i, arg := range nt.Args { + if !arg.Equal(m.Args[i]) { + return false + } + } + return true + case *BooleanNode: if nt.Operator.T != m.Operator.T { return false } @@ -1540,9 +1565,9 @@ func (m *BooleanNode) Equal(n Node) bool { return false } -// Create a Tri node +// NewTriNode Create a Tri node // -// @arg1 [NOT] BETWEEN @arg2 AND @arg3 +// @arg1 [NOT] BETWEEN @arg2 AND @arg3 // func NewTriNode(operator lex.Token, arg1, arg2, arg3 Node) *TriNode { return &TriNode{Args: []Node{arg1, arg2, arg3}, Operator: operator} @@ -1596,11 +1621,10 @@ func (m *TriNode) ChildrenArgs() []Node { return m.Args } func (m *TriNode) NodePb() *NodePb { - n := &TriNodePb{Args: make([]NodePb, len(m.Args))} + n := &TriNodePb{Args: make([]*NodePb, len(m.Args))} n.Op = int32(m.Operator.T) for i, arg := range m.Args { - n.Args[i] = *arg.NodePb() - //u.Debugf("TriNode NodePb: %T", arg) + n.Args[i] = arg.NodePb() } return &NodePb{Tn: n} } @@ -1665,7 +1689,7 @@ func (m *TriNode) Equal(n Node) bool { return false } -// Unary nodes +// NewUnary create Unary node // // NOT // ! @@ -1729,17 +1753,18 @@ func (m *UnaryNode) Validate() error { func (m *UnaryNode) ChildrenArgs() []Node { return []Node{m.Arg} } -func (m *UnaryNode) Collapse() Node { return m } + +//func (m *UnaryNode) Collapse() Node { return m } func (m *UnaryNode) NodePb() *NodePb { n := &UnaryNodePb{} - n.Arg = *m.Arg.NodePb() + n.Arg = m.Arg.NodePb() n.Op = int32(m.Operator.T) return &NodePb{Un: n} } func (m *UnaryNode) FromPB(n *NodePb) Node { return &UnaryNode{ Operator: tokenFromInt(n.Un.Op), - Arg: NodeFromNodePb(&n.Un.Arg), + Arg: NodeFromNodePb(n.Un.Arg), } } func (m *UnaryNode) Expr() *Expr { @@ -1836,18 +1861,17 @@ func (m *IncludeNode) Negated() bool { return m.negated } func (m *IncludeNode) Collapse() Node { return m } func (m *IncludeNode) NodePb() *NodePb { n := &IncludeNodePb{} - n.Identity = *m.Identity.IdentityPb() + n.Identity = m.Identity.IdentityPb() n.Op = int32(m.Operator.T) n.Negated = m.negated return &NodePb{Incn: n} } func (m *IncludeNode) FromPB(n *NodePb) Node { inid := n.Incn.Identity - q := n.Incn.Identity.Quote return &IncludeNode{ negated: n.Incn.Negated, Operator: tokenFromInt(n.Incn.Op), - Identity: &IdentityNode{Text: inid.Text, Quote: byte(*q)}, + Identity: &IdentityNode{Text: inid.Text, Quote: byte(n.Incn.Identity.Quote)}, } } func (m *IncludeNode) Expr() *Expr { @@ -1906,8 +1930,7 @@ func (m *IncludeNode) Equal(n Node) bool { return m.Identity.Equal(nt.Identity) } -// Create an array of Nodes which is a valid node type for boolean IN operator -// +// NewArrayNode Create an array of Nodes which is a valid node type for boolean IN operator func NewArrayNode() *ArrayNode { return &ArrayNode{Args: make([]Node, 0)} } @@ -1951,14 +1974,14 @@ func (m *ArrayNode) ChildrenArgs() []Node { } func (m *ArrayNode) Append(n Node) { m.Args = append(m.Args, n) } func (m *ArrayNode) NodePb() *NodePb { - n := &ArrayNodePb{Args: make([]NodePb, len(m.Args))} + n := &ArrayNodePb{Args: make([]*NodePb, len(m.Args))} iv := int32(0) if m.wraptype != "" && len(m.wraptype) == 1 { iv = int32(m.wraptype[0]) } - n.Wrap = &iv + n.Wrap = iv for i, arg := range m.Args { - n.Args[i] = *arg.NodePb() + n.Args[i] = arg.NodePb() } return &NodePb{An: n} } @@ -2082,10 +2105,10 @@ func NodesFromNodesPbPtr(pb []*NodePb) []Node { return nodes } -func NodesFromNodesPb(pb []NodePb) []Node { +func NodesFromNodesPb(pb []*NodePb) []Node { nodes := make([]Node, len(pb)) for i, pbn := range pb { - nodes[i] = NodeFromNodePb(&pbn) + nodes[i] = NodeFromNodePb(pbn) } return nodes } @@ -2214,26 +2237,45 @@ func NodeFromExpr(e *Expr) (Node, error) { return nil, err } - //u.Debugf("%T %s", n, n) - // Negateable nodes possibly can be collapsed to simpler form nn, isNegateable := n.(NegateableNode) if isNegateable { return nn.Collapse(), nil } + if un, ok := n.(*UnaryNode); ok { + nn, ok := un.Arg.(NegateableNode) + if ok { + nn.ReverseNegation() + return nn.Collapse(), nil + } + } return n, nil } - if e.Identity != "" { + if e.Ident != "" { n = &IdentityNode{} return n, n.FromExpr(e) } - if e.Value != "" { - switch e.Value { - case "true", "false": + if e.Val != "" { + //u.Debugf("%+v", e) + switch value.ValueType(e.ValType) { + case value.IntType, value.NumberType: + n = &NumberNode{} + case value.StringType: + n = &StringNode{} + case value.BoolType: n = &IdentityNode{} + case value.TimeType: + n = &ValueNode{} default: - n = &StringNode{} + switch e.Val { + case "NULL": + n = &NullNode{} + case "true", "false": + n = &IdentityNode{} + default: + n = &StringNode{} + } } return n, n.FromExpr(e) } diff --git a/expr/node.pb.go b/expr/node.pb.go index 1b5b0d64..756c9600 100644 --- a/expr/node.pb.go +++ b/expr/node.pb.go @@ -1,39 +1,33 @@ -// Code generated by protoc-gen-gogo. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: node.proto -// DO NOT EDIT! /* - Package expr is a generated protocol buffer package. - - It is generated from these files: - node.proto - - It has these top-level messages: - ExprPb - NodePb - BinaryNodePb - BooleanNodePb - IncludeNodePb - UnaryNodePb - FuncNodePb - TriNodePb - ArrayNodePb - StringNodePb - IdentityNodePb - NumberNodePb - ValueNodePb - NullNodePb +Package expr is a generated protocol buffer package. + +It is generated from these files: + node.proto + +It has these top-level messages: + Expr + NodePb + BinaryNodePb + BooleanNodePb + IncludeNodePb + UnaryNodePb + FuncNodePb + TriNodePb + ArrayNodePb + StringNodePb + IdentityNodePb + NumberNodePb + ValueNodePb + NullNodePb */ package expr import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import github_com_golang_protobuf_proto "github.com/golang/protobuf/proto" - -import io "io" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -46,3397 +40,577 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package -// The generic Expr -type ExprPb struct { - Op *int32 `protobuf:"varint,1,opt,name=op" json:"op,omitempty"` - Args []*ExprPb `protobuf:"bytes,2,rep,name=args" json:"args,omitempty"` - Ident *string `protobuf:"bytes,4,opt,name=ident" json:"ident,omitempty"` - Val *string `protobuf:"bytes,5,opt,name=val" json:"val,omitempty"` - Ival *int64 `protobuf:"varint,6,opt,name=ival" json:"ival,omitempty"` - Bval *bool `protobuf:"varint,7,opt,name=bval" json:"bval,omitempty"` - Fval *float64 `protobuf:"fixed64,8,opt,name=fval" json:"fval,omitempty"` - XXX_unrecognized []byte `json:"-"` +// Expr an S-Expression https://en.wikipedia.org/wiki/S-expression representation +// of the AST tree of expression. +// EITHER (op,args) OR (one of ident, val) will be present but not both. +type Expr struct { + Op string `protobuf:"bytes,1,opt,name=op" json:"op,omitempty"` + OpType int32 `protobuf:"varint,2,opt,name=opType" json:"opType,omitempty"` + Args []*Expr `protobuf:"bytes,3,rep,name=args" json:"args,omitempty"` + Ident string `protobuf:"bytes,4,opt,name=ident" json:"ident,omitempty"` + Val string `protobuf:"bytes,5,opt,name=val" json:"val,omitempty"` + ValType int32 `protobuf:"varint,6,opt,name=valType" json:"valType,omitempty"` +} + +func (m *Expr) Reset() { *m = Expr{} } +func (m *Expr) String() string { return proto.CompactTextString(m) } +func (*Expr) ProtoMessage() {} +func (*Expr) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +func (m *Expr) GetOp() string { + if m != nil { + return m.Op + } + return "" +} + +func (m *Expr) GetOpType() int32 { + if m != nil { + return m.OpType + } + return 0 } -func (m *ExprPb) Reset() { *m = ExprPb{} } -func (m *ExprPb) String() string { return proto.CompactTextString(m) } -func (*ExprPb) ProtoMessage() {} -func (*ExprPb) Descriptor() ([]byte, []int) { return fileDescriptorNode, []int{0} } +func (m *Expr) GetArgs() []*Expr { + if m != nil { + return m.Args + } + return nil +} -// The generic Node, must be exactly one of these types +func (m *Expr) GetIdent() string { + if m != nil { + return m.Ident + } + return "" +} + +func (m *Expr) GetVal() string { + if m != nil { + return m.Val + } + return "" +} + +func (m *Expr) GetValType() int32 { + if m != nil { + return m.ValType + } + return 0 +} + +// Node expression must be exactly one of these types type NodePb struct { - Bn *BinaryNodePb `protobuf:"bytes,1,opt,name=bn" json:"bn,omitempty"` - Booln *BooleanNodePb `protobuf:"bytes,2,opt,name=booln" json:"booln,omitempty"` - Un *UnaryNodePb `protobuf:"bytes,3,opt,name=un" json:"un,omitempty"` - Fn *FuncNodePb `protobuf:"bytes,4,opt,name=fn" json:"fn,omitempty"` - Tn *TriNodePb `protobuf:"bytes,5,opt,name=tn" json:"tn,omitempty"` - An *ArrayNodePb `protobuf:"bytes,6,opt,name=an" json:"an,omitempty"` - Nn *NumberNodePb `protobuf:"bytes,10,opt,name=nn" json:"nn,omitempty"` - Vn *ValueNodePb `protobuf:"bytes,11,opt,name=vn" json:"vn,omitempty"` - In *IdentityNodePb `protobuf:"bytes,12,opt,name=in" json:"in,omitempty"` - Sn *StringNodePb `protobuf:"bytes,13,opt,name=sn" json:"sn,omitempty"` - Incn *IncludeNodePb `protobuf:"bytes,14,opt,name=incn" json:"incn,omitempty"` - Niln *NullNodePb `protobuf:"bytes,15,opt,name=niln" json:"niln,omitempty"` - XXX_unrecognized []byte `json:"-"` + Bn *BinaryNodePb `protobuf:"bytes,1,opt,name=bn" json:"bn,omitempty"` + Booln *BooleanNodePb `protobuf:"bytes,2,opt,name=booln" json:"booln,omitempty"` + Un *UnaryNodePb `protobuf:"bytes,3,opt,name=un" json:"un,omitempty"` + Fn *FuncNodePb `protobuf:"bytes,4,opt,name=fn" json:"fn,omitempty"` + Tn *TriNodePb `protobuf:"bytes,5,opt,name=tn" json:"tn,omitempty"` + An *ArrayNodePb `protobuf:"bytes,6,opt,name=an" json:"an,omitempty"` + Nn *NumberNodePb `protobuf:"bytes,10,opt,name=nn" json:"nn,omitempty"` + Vn *ValueNodePb `protobuf:"bytes,11,opt,name=vn" json:"vn,omitempty"` + In *IdentityNodePb `protobuf:"bytes,12,opt,name=in" json:"in,omitempty"` + Sn *StringNodePb `protobuf:"bytes,13,opt,name=sn" json:"sn,omitempty"` + Incn *IncludeNodePb `protobuf:"bytes,14,opt,name=incn" json:"incn,omitempty"` + Niln *NullNodePb `protobuf:"bytes,15,opt,name=niln" json:"niln,omitempty"` } func (m *NodePb) Reset() { *m = NodePb{} } func (m *NodePb) String() string { return proto.CompactTextString(m) } func (*NodePb) ProtoMessage() {} -func (*NodePb) Descriptor() ([]byte, []int) { return fileDescriptorNode, []int{1} } +func (*NodePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } -// Binary Node, two child args -type BinaryNodePb struct { - Op int32 `protobuf:"varint,1,req,name=op" json:"op"` - Paren bool `protobuf:"varint,2,opt,name=paren" json:"paren"` - Args []NodePb `protobuf:"bytes,3,rep,name=args" json:"args"` - XXX_unrecognized []byte `json:"-"` +func (m *NodePb) GetBn() *BinaryNodePb { + if m != nil { + return m.Bn + } + return nil } -func (m *BinaryNodePb) Reset() { *m = BinaryNodePb{} } -func (m *BinaryNodePb) String() string { return proto.CompactTextString(m) } -func (*BinaryNodePb) ProtoMessage() {} -func (*BinaryNodePb) Descriptor() ([]byte, []int) { return fileDescriptorNode, []int{2} } +func (m *NodePb) GetBooln() *BooleanNodePb { + if m != nil { + return m.Booln + } + return nil +} -// Boolean Node, n child args -type BooleanNodePb struct { - Op int32 `protobuf:"varint,1,req,name=op" json:"op"` - Args []NodePb `protobuf:"bytes,2,rep,name=args" json:"args"` - XXX_unrecognized []byte `json:"-"` +func (m *NodePb) GetUn() *UnaryNodePb { + if m != nil { + return m.Un + } + return nil } -func (m *BooleanNodePb) Reset() { *m = BooleanNodePb{} } -func (m *BooleanNodePb) String() string { return proto.CompactTextString(m) } -func (*BooleanNodePb) ProtoMessage() {} -func (*BooleanNodePb) Descriptor() ([]byte, []int) { return fileDescriptorNode, []int{3} } +func (m *NodePb) GetFn() *FuncNodePb { + if m != nil { + return m.Fn + } + return nil +} -// Include Node, two child args -type IncludeNodePb struct { - Op int32 `protobuf:"varint,1,req,name=op" json:"op"` - Negated bool `protobuf:"varint,2,req,name=negated" json:"negated"` - Identity IdentityNodePb `protobuf:"bytes,3,req,name=identity" json:"identity"` - XXX_unrecognized []byte `json:"-"` +func (m *NodePb) GetTn() *TriNodePb { + if m != nil { + return m.Tn + } + return nil } -func (m *IncludeNodePb) Reset() { *m = IncludeNodePb{} } -func (m *IncludeNodePb) String() string { return proto.CompactTextString(m) } -func (*IncludeNodePb) ProtoMessage() {} -func (*IncludeNodePb) Descriptor() ([]byte, []int) { return fileDescriptorNode, []int{4} } +func (m *NodePb) GetAn() *ArrayNodePb { + if m != nil { + return m.An + } + return nil +} -// Unary Node, one child -type UnaryNodePb struct { - Op int32 `protobuf:"varint,1,req,name=op" json:"op"` - Paren bool `protobuf:"varint,2,opt,name=paren" json:"paren"` - Arg NodePb `protobuf:"bytes,3,req,name=arg" json:"arg"` - XXX_unrecognized []byte `json:"-"` +func (m *NodePb) GetNn() *NumberNodePb { + if m != nil { + return m.Nn + } + return nil } -func (m *UnaryNodePb) Reset() { *m = UnaryNodePb{} } -func (m *UnaryNodePb) String() string { return proto.CompactTextString(m) } -func (*UnaryNodePb) ProtoMessage() {} -func (*UnaryNodePb) Descriptor() ([]byte, []int) { return fileDescriptorNode, []int{5} } +func (m *NodePb) GetVn() *ValueNodePb { + if m != nil { + return m.Vn + } + return nil +} -// Func Node, args are children -type FuncNodePb struct { - Name string `protobuf:"bytes,1,req,name=name" json:"name"` - Args []NodePb `protobuf:"bytes,2,rep,name=args" json:"args"` - XXX_unrecognized []byte `json:"-"` +func (m *NodePb) GetIn() *IdentityNodePb { + if m != nil { + return m.In + } + return nil } -func (m *FuncNodePb) Reset() { *m = FuncNodePb{} } -func (m *FuncNodePb) String() string { return proto.CompactTextString(m) } -func (*FuncNodePb) ProtoMessage() {} -func (*FuncNodePb) Descriptor() ([]byte, []int) { return fileDescriptorNode, []int{6} } +func (m *NodePb) GetSn() *StringNodePb { + if m != nil { + return m.Sn + } + return nil +} -// Tri Node, may hve children -type TriNodePb struct { - Op int32 `protobuf:"varint,1,req,name=op" json:"op"` - Args []NodePb `protobuf:"bytes,2,rep,name=args" json:"args"` - XXX_unrecognized []byte `json:"-"` +func (m *NodePb) GetIncn() *IncludeNodePb { + if m != nil { + return m.Incn + } + return nil } -func (m *TriNodePb) Reset() { *m = TriNodePb{} } -func (m *TriNodePb) String() string { return proto.CompactTextString(m) } -func (*TriNodePb) ProtoMessage() {} -func (*TriNodePb) Descriptor() ([]byte, []int) { return fileDescriptorNode, []int{7} } +func (m *NodePb) GetNiln() *NullNodePb { + if m != nil { + return m.Niln + } + return nil +} -// Array Node -type ArrayNodePb struct { - Wrap *int32 `protobuf:"varint,1,req,name=wrap" json:"wrap,omitempty"` - Args []NodePb `protobuf:"bytes,3,rep,name=args" json:"args"` - XXX_unrecognized []byte `json:"-"` +// BinaryNodePb two child args and operation +type BinaryNodePb struct { + Op int32 `protobuf:"varint,1,opt,name=op" json:"op,omitempty"` + Paren bool `protobuf:"varint,2,opt,name=paren" json:"paren,omitempty"` + Args []*NodePb `protobuf:"bytes,3,rep,name=args" json:"args,omitempty"` } -func (m *ArrayNodePb) Reset() { *m = ArrayNodePb{} } -func (m *ArrayNodePb) String() string { return proto.CompactTextString(m) } -func (*ArrayNodePb) ProtoMessage() {} -func (*ArrayNodePb) Descriptor() ([]byte, []int) { return fileDescriptorNode, []int{8} } +func (m *BinaryNodePb) Reset() { *m = BinaryNodePb{} } +func (m *BinaryNodePb) String() string { return proto.CompactTextString(m) } +func (*BinaryNodePb) ProtoMessage() {} +func (*BinaryNodePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } -// String literal, no children -type StringNodePb struct { - Noquote *bool `protobuf:"varint,1,opt,name=noquote" json:"noquote,omitempty"` - Quote *int32 `protobuf:"varint,2,opt,name=quote" json:"quote,omitempty"` - Text string `protobuf:"bytes,3,opt,name=text" json:"text"` - XXX_unrecognized []byte `json:"-"` +func (m *BinaryNodePb) GetOp() int32 { + if m != nil { + return m.Op + } + return 0 } -func (m *StringNodePb) Reset() { *m = StringNodePb{} } -func (m *StringNodePb) String() string { return proto.CompactTextString(m) } -func (*StringNodePb) ProtoMessage() {} -func (*StringNodePb) Descriptor() ([]byte, []int) { return fileDescriptorNode, []int{9} } - -// Identity -type IdentityNodePb struct { - Quote *int32 `protobuf:"varint,1,opt,name=quote" json:"quote,omitempty"` - Text string `protobuf:"bytes,3,opt,name=text" json:"text"` - XXX_unrecognized []byte `json:"-"` +func (m *BinaryNodePb) GetParen() bool { + if m != nil { + return m.Paren + } + return false } -func (m *IdentityNodePb) Reset() { *m = IdentityNodePb{} } -func (m *IdentityNodePb) String() string { return proto.CompactTextString(m) } -func (*IdentityNodePb) ProtoMessage() {} -func (*IdentityNodePb) Descriptor() ([]byte, []int) { return fileDescriptorNode, []int{10} } +func (m *BinaryNodePb) GetArgs() []*NodePb { + if m != nil { + return m.Args + } + return nil +} -// Number Node -type NumberNodePb struct { - Isint bool `protobuf:"varint,1,opt,name=isint" json:"isint"` - Isfloat bool `protobuf:"varint,2,opt,name=isfloat" json:"isfloat"` - Iv int64 `protobuf:"varint,3,req,name=iv" json:"iv"` - Fv float64 `protobuf:"fixed64,4,req,name=fv" json:"fv"` - Text string `protobuf:"bytes,5,req,name=text" json:"text"` - XXX_unrecognized []byte `json:"-"` +// Boolean Node, n child args +type BooleanNodePb struct { + Op int32 `protobuf:"varint,1,opt,name=op" json:"op,omitempty"` + Args []*NodePb `protobuf:"bytes,2,rep,name=args" json:"args,omitempty"` } -func (m *NumberNodePb) Reset() { *m = NumberNodePb{} } -func (m *NumberNodePb) String() string { return proto.CompactTextString(m) } -func (*NumberNodePb) ProtoMessage() {} -func (*NumberNodePb) Descriptor() ([]byte, []int) { return fileDescriptorNode, []int{11} } +func (m *BooleanNodePb) Reset() { *m = BooleanNodePb{} } +func (m *BooleanNodePb) String() string { return proto.CompactTextString(m) } +func (*BooleanNodePb) ProtoMessage() {} +func (*BooleanNodePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } -// Value Node -type ValueNodePb struct { - Valuetype int32 `protobuf:"varint,1,req,name=valuetype" json:"valuetype"` - Value []byte `protobuf:"bytes,2,req,name=value" json:"value,omitempty"` - XXX_unrecognized []byte `json:"-"` +func (m *BooleanNodePb) GetOp() int32 { + if m != nil { + return m.Op + } + return 0 } -func (m *ValueNodePb) Reset() { *m = ValueNodePb{} } -func (m *ValueNodePb) String() string { return proto.CompactTextString(m) } -func (*ValueNodePb) ProtoMessage() {} -func (*ValueNodePb) Descriptor() ([]byte, []int) { return fileDescriptorNode, []int{12} } +func (m *BooleanNodePb) GetArgs() []*NodePb { + if m != nil { + return m.Args + } + return nil +} -// NullNode -type NullNodePb struct { - Niltype int32 `protobuf:"varint,1,opt,name=niltype" json:"niltype"` - XXX_unrecognized []byte `json:"-"` +// Include Node, two child args +type IncludeNodePb struct { + Op int32 `protobuf:"varint,1,opt,name=op" json:"op,omitempty"` + Negated bool `protobuf:"varint,2,opt,name=negated" json:"negated,omitempty"` + Identity *IdentityNodePb `protobuf:"bytes,3,opt,name=identity" json:"identity,omitempty"` } -func (m *NullNodePb) Reset() { *m = NullNodePb{} } -func (m *NullNodePb) String() string { return proto.CompactTextString(m) } -func (*NullNodePb) ProtoMessage() {} -func (*NullNodePb) Descriptor() ([]byte, []int) { return fileDescriptorNode, []int{13} } +func (m *IncludeNodePb) Reset() { *m = IncludeNodePb{} } +func (m *IncludeNodePb) String() string { return proto.CompactTextString(m) } +func (*IncludeNodePb) ProtoMessage() {} +func (*IncludeNodePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } -func init() { - proto.RegisterType((*ExprPb)(nil), "expr.ExprPb") - proto.RegisterType((*NodePb)(nil), "expr.NodePb") - proto.RegisterType((*BinaryNodePb)(nil), "expr.BinaryNodePb") - proto.RegisterType((*BooleanNodePb)(nil), "expr.BooleanNodePb") - proto.RegisterType((*IncludeNodePb)(nil), "expr.IncludeNodePb") - proto.RegisterType((*UnaryNodePb)(nil), "expr.UnaryNodePb") - proto.RegisterType((*FuncNodePb)(nil), "expr.FuncNodePb") - proto.RegisterType((*TriNodePb)(nil), "expr.TriNodePb") - proto.RegisterType((*ArrayNodePb)(nil), "expr.ArrayNodePb") - proto.RegisterType((*StringNodePb)(nil), "expr.StringNodePb") - proto.RegisterType((*IdentityNodePb)(nil), "expr.IdentityNodePb") - proto.RegisterType((*NumberNodePb)(nil), "expr.NumberNodePb") - proto.RegisterType((*ValueNodePb)(nil), "expr.ValueNodePb") - proto.RegisterType((*NullNodePb)(nil), "expr.NullNodePb") -} -func (m *ExprPb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *ExprPb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Op != nil { - data[i] = 0x8 - i++ - i = encodeVarintNode(data, i, uint64(*m.Op)) +func (m *IncludeNodePb) GetOp() int32 { + if m != nil { + return m.Op } - if len(m.Args) > 0 { - for _, msg := range m.Args { - data[i] = 0x12 - i++ - i = encodeVarintNode(data, i, uint64(msg.Size())) - n, err := msg.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.Ident != nil { - data[i] = 0x22 - i++ - i = encodeVarintNode(data, i, uint64(len(*m.Ident))) - i += copy(data[i:], *m.Ident) - } - if m.Val != nil { - data[i] = 0x2a - i++ - i = encodeVarintNode(data, i, uint64(len(*m.Val))) - i += copy(data[i:], *m.Val) - } - if m.Ival != nil { - data[i] = 0x30 - i++ - i = encodeVarintNode(data, i, uint64(*m.Ival)) - } - if m.Bval != nil { - data[i] = 0x38 - i++ - if *m.Bval { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - } - if m.Fval != nil { - data[i] = 0x41 - i++ - i = encodeFixed64Node(data, i, uint64(math.Float64bits(float64(*m.Fval)))) - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil + return 0 } -func (m *NodePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *NodePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Bn != nil { - data[i] = 0xa - i++ - i = encodeVarintNode(data, i, uint64(m.Bn.Size())) - n1, err := m.Bn.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if m.Booln != nil { - data[i] = 0x12 - i++ - i = encodeVarintNode(data, i, uint64(m.Booln.Size())) - n2, err := m.Booln.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if m.Un != nil { - data[i] = 0x1a - i++ - i = encodeVarintNode(data, i, uint64(m.Un.Size())) - n3, err := m.Un.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n3 - } - if m.Fn != nil { - data[i] = 0x22 - i++ - i = encodeVarintNode(data, i, uint64(m.Fn.Size())) - n4, err := m.Fn.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n4 +func (m *IncludeNodePb) GetNegated() bool { + if m != nil { + return m.Negated } - if m.Tn != nil { - data[i] = 0x2a - i++ - i = encodeVarintNode(data, i, uint64(m.Tn.Size())) - n5, err := m.Tn.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n5 - } - if m.An != nil { - data[i] = 0x32 - i++ - i = encodeVarintNode(data, i, uint64(m.An.Size())) - n6, err := m.An.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n6 - } - if m.Nn != nil { - data[i] = 0x52 - i++ - i = encodeVarintNode(data, i, uint64(m.Nn.Size())) - n7, err := m.Nn.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n7 - } - if m.Vn != nil { - data[i] = 0x5a - i++ - i = encodeVarintNode(data, i, uint64(m.Vn.Size())) - n8, err := m.Vn.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n8 - } - if m.In != nil { - data[i] = 0x62 - i++ - i = encodeVarintNode(data, i, uint64(m.In.Size())) - n9, err := m.In.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n9 - } - if m.Sn != nil { - data[i] = 0x6a - i++ - i = encodeVarintNode(data, i, uint64(m.Sn.Size())) - n10, err := m.Sn.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n10 - } - if m.Incn != nil { - data[i] = 0x72 - i++ - i = encodeVarintNode(data, i, uint64(m.Incn.Size())) - n11, err := m.Incn.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n11 - } - if m.Niln != nil { - data[i] = 0x7a - i++ - i = encodeVarintNode(data, i, uint64(m.Niln.Size())) - n12, err := m.Niln.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n12 - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil + return false } -func (m *BinaryNodePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *BinaryNodePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0x8 - i++ - i = encodeVarintNode(data, i, uint64(m.Op)) - data[i] = 0x10 - i++ - if m.Paren { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - if len(m.Args) > 0 { - for _, msg := range m.Args { - data[i] = 0x1a - i++ - i = encodeVarintNode(data, i, uint64(msg.Size())) - n, err := msg.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n - } +func (m *IncludeNodePb) GetIdentity() *IdentityNodePb { + if m != nil { + return m.Identity } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil + return nil } -func (m *BooleanNodePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *BooleanNodePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0x8 - i++ - i = encodeVarintNode(data, i, uint64(m.Op)) - if len(m.Args) > 0 { - for _, msg := range m.Args { - data[i] = 0x12 - i++ - i = encodeVarintNode(data, i, uint64(msg.Size())) - n, err := msg.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil +// Unary Node, one child +type UnaryNodePb struct { + Op int32 `protobuf:"varint,1,opt,name=op" json:"op,omitempty"` + Paren bool `protobuf:"varint,2,opt,name=paren" json:"paren,omitempty"` + Arg *NodePb `protobuf:"bytes,3,opt,name=arg" json:"arg,omitempty"` } -func (m *IncludeNodePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *IncludeNodePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0x8 - i++ - i = encodeVarintNode(data, i, uint64(m.Op)) - data[i] = 0x10 - i++ - if m.Negated { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - data[i] = 0x1a - i++ - i = encodeVarintNode(data, i, uint64(m.Identity.Size())) - n13, err := m.Identity.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n13 - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) +func (m *UnaryNodePb) Reset() { *m = UnaryNodePb{} } +func (m *UnaryNodePb) String() string { return proto.CompactTextString(m) } +func (*UnaryNodePb) ProtoMessage() {} +func (*UnaryNodePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *UnaryNodePb) GetOp() int32 { + if m != nil { + return m.Op } - return i, nil + return 0 } -func (m *UnaryNodePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *UnaryNodePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0x8 - i++ - i = encodeVarintNode(data, i, uint64(m.Op)) - data[i] = 0x10 - i++ - if m.Paren { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - data[i] = 0x1a - i++ - i = encodeVarintNode(data, i, uint64(m.Arg.Size())) - n14, err := m.Arg.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n14 - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) +func (m *UnaryNodePb) GetParen() bool { + if m != nil { + return m.Paren } - return i, nil + return false } -func (m *FuncNodePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err +func (m *UnaryNodePb) GetArg() *NodePb { + if m != nil { + return m.Arg } - return data[:n], nil -} - -func (m *FuncNodePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0xa - i++ - i = encodeVarintNode(data, i, uint64(len(m.Name))) - i += copy(data[i:], m.Name) - if len(m.Args) > 0 { - for _, msg := range m.Args { - data[i] = 0x12 - i++ - i = encodeVarintNode(data, i, uint64(msg.Size())) - n, err := msg.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil + return nil } -func (m *TriNodePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *TriNodePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0x8 - i++ - i = encodeVarintNode(data, i, uint64(m.Op)) - if len(m.Args) > 0 { - for _, msg := range m.Args { - data[i] = 0x12 - i++ - i = encodeVarintNode(data, i, uint64(msg.Size())) - n, err := msg.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil +// Func Node, args are children +type FuncNodePb struct { + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Args []*NodePb `protobuf:"bytes,2,rep,name=args" json:"args,omitempty"` } -func (m *ArrayNodePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *ArrayNodePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Wrap == nil { - return 0, new(github_com_golang_protobuf_proto.RequiredNotSetError) - } else { - data[i] = 0x8 - i++ - i = encodeVarintNode(data, i, uint64(*m.Wrap)) - } - if len(m.Args) > 0 { - for _, msg := range m.Args { - data[i] = 0x1a - i++ - i = encodeVarintNode(data, i, uint64(msg.Size())) - n, err := msg.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) +func (m *FuncNodePb) Reset() { *m = FuncNodePb{} } +func (m *FuncNodePb) String() string { return proto.CompactTextString(m) } +func (*FuncNodePb) ProtoMessage() {} +func (*FuncNodePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +func (m *FuncNodePb) GetName() string { + if m != nil { + return m.Name } - return i, nil + return "" } -func (m *StringNodePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *StringNodePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Noquote != nil { - data[i] = 0x8 - i++ - if *m.Noquote { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - } - if m.Quote != nil { - data[i] = 0x10 - i++ - i = encodeVarintNode(data, i, uint64(*m.Quote)) +func (m *FuncNodePb) GetArgs() []*NodePb { + if m != nil { + return m.Args } - data[i] = 0x1a - i++ - i = encodeVarintNode(data, i, uint64(len(m.Text))) - i += copy(data[i:], m.Text) - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil + return nil } -func (m *IdentityNodePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *IdentityNodePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Quote != nil { - data[i] = 0x8 - i++ - i = encodeVarintNode(data, i, uint64(*m.Quote)) - } - data[i] = 0x1a - i++ - i = encodeVarintNode(data, i, uint64(len(m.Text))) - i += copy(data[i:], m.Text) - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil +// TriNodePb, may have children +type TriNodePb struct { + Op int32 `protobuf:"varint,1,opt,name=op" json:"op,omitempty"` + Args []*NodePb `protobuf:"bytes,2,rep,name=args" json:"args,omitempty"` } -func (m *NumberNodePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *NumberNodePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0x8 - i++ - if m.Isint { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - data[i] = 0x10 - i++ - if m.Isfloat { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - data[i] = 0x18 - i++ - i = encodeVarintNode(data, i, uint64(m.Iv)) - data[i] = 0x21 - i++ - i = encodeFixed64Node(data, i, uint64(math.Float64bits(float64(m.Fv)))) - data[i] = 0x2a - i++ - i = encodeVarintNode(data, i, uint64(len(m.Text))) - i += copy(data[i:], m.Text) - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) +func (m *TriNodePb) Reset() { *m = TriNodePb{} } +func (m *TriNodePb) String() string { return proto.CompactTextString(m) } +func (*TriNodePb) ProtoMessage() {} +func (*TriNodePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } + +func (m *TriNodePb) GetOp() int32 { + if m != nil { + return m.Op } - return i, nil + return 0 } -func (m *ValueNodePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *ValueNodePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0x8 - i++ - i = encodeVarintNode(data, i, uint64(m.Valuetype)) - if m.Value == nil { - return 0, new(github_com_golang_protobuf_proto.RequiredNotSetError) - } else { - data[i] = 0x12 - i++ - i = encodeVarintNode(data, i, uint64(len(m.Value))) - i += copy(data[i:], m.Value) - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) +func (m *TriNodePb) GetArgs() []*NodePb { + if m != nil { + return m.Args } - return i, nil + return nil } -func (m *NullNodePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *NullNodePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0x8 - i++ - i = encodeVarintNode(data, i, uint64(m.Niltype)) - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeFixed64Node(data []byte, offset int, v uint64) int { - data[offset] = uint8(v) - data[offset+1] = uint8(v >> 8) - data[offset+2] = uint8(v >> 16) - data[offset+3] = uint8(v >> 24) - data[offset+4] = uint8(v >> 32) - data[offset+5] = uint8(v >> 40) - data[offset+6] = uint8(v >> 48) - data[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Node(data []byte, offset int, v uint32) int { - data[offset] = uint8(v) - data[offset+1] = uint8(v >> 8) - data[offset+2] = uint8(v >> 16) - data[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintNode(data []byte, offset int, v uint64) int { - for v >= 1<<7 { - data[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - data[offset] = uint8(v) - return offset + 1 -} -func (m *ExprPb) Size() (n int) { - var l int - _ = l - if m.Op != nil { - n += 1 + sovNode(uint64(*m.Op)) - } - if len(m.Args) > 0 { - for _, e := range m.Args { - l = e.Size() - n += 1 + l + sovNode(uint64(l)) - } - } - if m.Ident != nil { - l = len(*m.Ident) - n += 1 + l + sovNode(uint64(l)) - } - if m.Val != nil { - l = len(*m.Val) - n += 1 + l + sovNode(uint64(l)) - } - if m.Ival != nil { - n += 1 + sovNode(uint64(*m.Ival)) - } - if m.Bval != nil { - n += 2 - } - if m.Fval != nil { - n += 9 - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n +// Array Node +type ArrayNodePb struct { + Wrap int32 `protobuf:"varint,1,opt,name=wrap" json:"wrap,omitempty"` + Args []*NodePb `protobuf:"bytes,3,rep,name=args" json:"args,omitempty"` } -func (m *NodePb) Size() (n int) { - var l int - _ = l - if m.Bn != nil { - l = m.Bn.Size() - n += 1 + l + sovNode(uint64(l)) - } - if m.Booln != nil { - l = m.Booln.Size() - n += 1 + l + sovNode(uint64(l)) - } - if m.Un != nil { - l = m.Un.Size() - n += 1 + l + sovNode(uint64(l)) - } - if m.Fn != nil { - l = m.Fn.Size() - n += 1 + l + sovNode(uint64(l)) - } - if m.Tn != nil { - l = m.Tn.Size() - n += 1 + l + sovNode(uint64(l)) - } - if m.An != nil { - l = m.An.Size() - n += 1 + l + sovNode(uint64(l)) - } - if m.Nn != nil { - l = m.Nn.Size() - n += 1 + l + sovNode(uint64(l)) - } - if m.Vn != nil { - l = m.Vn.Size() - n += 1 + l + sovNode(uint64(l)) - } - if m.In != nil { - l = m.In.Size() - n += 1 + l + sovNode(uint64(l)) - } - if m.Sn != nil { - l = m.Sn.Size() - n += 1 + l + sovNode(uint64(l)) - } - if m.Incn != nil { - l = m.Incn.Size() - n += 1 + l + sovNode(uint64(l)) - } - if m.Niln != nil { - l = m.Niln.Size() - n += 1 + l + sovNode(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *BinaryNodePb) Size() (n int) { - var l int - _ = l - n += 1 + sovNode(uint64(m.Op)) - n += 2 - if len(m.Args) > 0 { - for _, e := range m.Args { - l = e.Size() - n += 1 + l + sovNode(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *BooleanNodePb) Size() (n int) { - var l int - _ = l - n += 1 + sovNode(uint64(m.Op)) - if len(m.Args) > 0 { - for _, e := range m.Args { - l = e.Size() - n += 1 + l + sovNode(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *IncludeNodePb) Size() (n int) { - var l int - _ = l - n += 1 + sovNode(uint64(m.Op)) - n += 2 - l = m.Identity.Size() - n += 1 + l + sovNode(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *UnaryNodePb) Size() (n int) { - var l int - _ = l - n += 1 + sovNode(uint64(m.Op)) - n += 2 - l = m.Arg.Size() - n += 1 + l + sovNode(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *FuncNodePb) Size() (n int) { - var l int - _ = l - l = len(m.Name) - n += 1 + l + sovNode(uint64(l)) - if len(m.Args) > 0 { - for _, e := range m.Args { - l = e.Size() - n += 1 + l + sovNode(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *TriNodePb) Size() (n int) { - var l int - _ = l - n += 1 + sovNode(uint64(m.Op)) - if len(m.Args) > 0 { - for _, e := range m.Args { - l = e.Size() - n += 1 + l + sovNode(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) +func (m *ArrayNodePb) Reset() { *m = ArrayNodePb{} } +func (m *ArrayNodePb) String() string { return proto.CompactTextString(m) } +func (*ArrayNodePb) ProtoMessage() {} +func (*ArrayNodePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } + +func (m *ArrayNodePb) GetWrap() int32 { + if m != nil { + return m.Wrap } - return n + return 0 } -func (m *ArrayNodePb) Size() (n int) { - var l int - _ = l - if m.Wrap != nil { - n += 1 + sovNode(uint64(*m.Wrap)) - } - if len(m.Args) > 0 { - for _, e := range m.Args { - l = e.Size() - n += 1 + l + sovNode(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) +func (m *ArrayNodePb) GetArgs() []*NodePb { + if m != nil { + return m.Args } - return n + return nil } -func (m *StringNodePb) Size() (n int) { - var l int - _ = l - if m.Noquote != nil { - n += 2 - } - if m.Quote != nil { - n += 1 + sovNode(uint64(*m.Quote)) - } - l = len(m.Text) - n += 1 + l + sovNode(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n +// String literal, no children +type StringNodePb struct { + Noquote bool `protobuf:"varint,1,opt,name=noquote" json:"noquote,omitempty"` + Quote int32 `protobuf:"varint,2,opt,name=quote" json:"quote,omitempty"` + Text string `protobuf:"bytes,3,opt,name=text" json:"text,omitempty"` } -func (m *IdentityNodePb) Size() (n int) { - var l int - _ = l - if m.Quote != nil { - n += 1 + sovNode(uint64(*m.Quote)) - } - l = len(m.Text) - n += 1 + l + sovNode(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *NumberNodePb) Size() (n int) { - var l int - _ = l - n += 2 - n += 2 - n += 1 + sovNode(uint64(m.Iv)) - n += 9 - l = len(m.Text) - n += 1 + l + sovNode(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) +func (m *StringNodePb) Reset() { *m = StringNodePb{} } +func (m *StringNodePb) String() string { return proto.CompactTextString(m) } +func (*StringNodePb) ProtoMessage() {} +func (*StringNodePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } + +func (m *StringNodePb) GetNoquote() bool { + if m != nil { + return m.Noquote } - return n + return false } -func (m *ValueNodePb) Size() (n int) { - var l int - _ = l - n += 1 + sovNode(uint64(m.Valuetype)) - if m.Value != nil { - l = len(m.Value) - n += 1 + l + sovNode(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) +func (m *StringNodePb) GetQuote() int32 { + if m != nil { + return m.Quote } - return n + return 0 } -func (m *NullNodePb) Size() (n int) { - var l int - _ = l - n += 1 + sovNode(uint64(m.Niltype)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) +func (m *StringNodePb) GetText() string { + if m != nil { + return m.Text } - return n + return "" } -func sovNode(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozNode(x uint64) (n int) { - return sovNode(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *ExprPb) Unmarshal(data []byte) error { - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ExprPb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ExprPb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Op = &v - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Args", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Args = append(m.Args, &ExprPb{}) - if err := m.Args[len(m.Args)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ident", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(data[iNdEx:postIndex]) - m.Ident = &s - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Val", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(data[iNdEx:postIndex]) - m.Val = &s - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Ival", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Ival = &v - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Bval", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Bval = &b - case 8: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Fval", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - iNdEx += 8 - v = uint64(data[iNdEx-8]) - v |= uint64(data[iNdEx-7]) << 8 - v |= uint64(data[iNdEx-6]) << 16 - v |= uint64(data[iNdEx-5]) << 24 - v |= uint64(data[iNdEx-4]) << 32 - v |= uint64(data[iNdEx-3]) << 40 - v |= uint64(data[iNdEx-2]) << 48 - v |= uint64(data[iNdEx-1]) << 56 - v2 := float64(math.Float64frombits(v)) - m.Fval = &v2 - default: - iNdEx = preIndex - skippy, err := skipNode(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNode - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } +// Identity +type IdentityNodePb struct { + Quote int32 `protobuf:"varint,1,opt,name=quote" json:"quote,omitempty"` + Text string `protobuf:"bytes,3,opt,name=text" json:"text,omitempty"` +} + +func (m *IdentityNodePb) Reset() { *m = IdentityNodePb{} } +func (m *IdentityNodePb) String() string { return proto.CompactTextString(m) } +func (*IdentityNodePb) ProtoMessage() {} +func (*IdentityNodePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *IdentityNodePb) GetQuote() int32 { + if m != nil { + return m.Quote } - return nil + return 0 } -func (m *NodePb) Unmarshal(data []byte) error { - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bn", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Bn == nil { - m.Bn = &BinaryNodePb{} - } - if err := m.Bn.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Booln", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Booln == nil { - m.Booln = &BooleanNodePb{} - } - if err := m.Booln.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Un", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Un == nil { - m.Un = &UnaryNodePb{} - } - if err := m.Un.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Fn", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Fn == nil { - m.Fn = &FuncNodePb{} - } - if err := m.Fn.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tn", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Tn == nil { - m.Tn = &TriNodePb{} - } - if err := m.Tn.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field An", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.An == nil { - m.An = &ArrayNodePb{} - } - if err := m.An.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Nn", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Nn == nil { - m.Nn = &NumberNodePb{} - } - if err := m.Nn.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Vn", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Vn == nil { - m.Vn = &ValueNodePb{} - } - if err := m.Vn.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field In", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.In == nil { - m.In = &IdentityNodePb{} - } - if err := m.In.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sn", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Sn == nil { - m.Sn = &StringNodePb{} - } - if err := m.Sn.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 14: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Incn", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Incn == nil { - m.Incn = &IncludeNodePb{} - } - if err := m.Incn.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Niln", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Niln == nil { - m.Niln = &NullNodePb{} - } - if err := m.Niln.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNode(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNode - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *IdentityNodePb) GetText() string { + if m != nil { + return m.Text } - return nil + return "" } -func (m *BinaryNodePb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BinaryNodePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BinaryNodePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) - } - m.Op = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.Op |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Paren", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Paren = bool(v != 0) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Args", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Args = append(m.Args, NodePb{}) - if err := m.Args[len(m.Args)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNode(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNode - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +// Number Node +type NumberNodePb struct { + Isint bool `protobuf:"varint,1,opt,name=isint" json:"isint,omitempty"` + Isfloat bool `protobuf:"varint,2,opt,name=isfloat" json:"isfloat,omitempty"` + Iv int64 `protobuf:"varint,3,opt,name=iv" json:"iv,omitempty"` + Fv float64 `protobuf:"fixed64,4,opt,name=fv" json:"fv,omitempty"` + Text string `protobuf:"bytes,5,opt,name=text" json:"text,omitempty"` } -func (m *BooleanNodePb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: BooleanNodePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BooleanNodePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) - } - m.Op = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.Op |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Args", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Args = append(m.Args, NodePb{}) - if err := m.Args[len(m.Args)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNode(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNode - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *NumberNodePb) Reset() { *m = NumberNodePb{} } +func (m *NumberNodePb) String() string { return proto.CompactTextString(m) } +func (*NumberNodePb) ProtoMessage() {} +func (*NumberNodePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } + +func (m *NumberNodePb) GetIsint() bool { + if m != nil { + return m.Isint } - return nil + return false } -func (m *IncludeNodePb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IncludeNodePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IncludeNodePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) - } - m.Op = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.Op |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Negated", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Negated = bool(v != 0) - hasFields[0] |= uint64(0x00000002) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Identity", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Identity.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000004) - default: - iNdEx = preIndex - skippy, err := skipNode(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNode - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000002) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000004) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *NumberNodePb) GetIsfloat() bool { + if m != nil { + return m.Isfloat } - return nil + return false } -func (m *UnaryNodePb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: UnaryNodePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UnaryNodePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) - } - m.Op = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.Op |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Paren", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Paren = bool(v != 0) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Arg", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Arg.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000002) - default: - iNdEx = preIndex - skippy, err := skipNode(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNode - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000002) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *NumberNodePb) GetIv() int64 { + if m != nil { + return m.Iv } - return nil + return 0 } -func (m *FuncNodePb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: FuncNodePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: FuncNodePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(data[iNdEx:postIndex]) - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Args", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Args = append(m.Args, NodePb{}) - if err := m.Args[len(m.Args)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNode(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNode - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *NumberNodePb) GetFv() float64 { + if m != nil { + return m.Fv } - return nil + return 0 } -func (m *TriNodePb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TriNodePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TriNodePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) - } - m.Op = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.Op |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Args", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Args = append(m.Args, NodePb{}) - if err := m.Args[len(m.Args)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNode(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNode - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *NumberNodePb) GetText() string { + if m != nil { + return m.Text } - return nil + return "" } -func (m *ArrayNodePb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ArrayNodePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ArrayNodePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Wrap", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Wrap = &v - hasFields[0] |= uint64(0x00000001) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Args", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Args = append(m.Args, NodePb{}) - if err := m.Args[len(m.Args)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNode(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNode - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +// Value Node +type ValueNodePb struct { + Valuetype int32 `protobuf:"varint,1,opt,name=valuetype" json:"valuetype,omitempty"` + Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` } -func (m *StringNodePb) Unmarshal(data []byte) error { - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: StringNodePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: StringNodePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Noquote", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Noquote = &b - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Quote", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Quote = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Text = string(data[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNode(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNode - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *ValueNodePb) Reset() { *m = ValueNodePb{} } +func (m *ValueNodePb) String() string { return proto.CompactTextString(m) } +func (*ValueNodePb) ProtoMessage() {} +func (*ValueNodePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } + +func (m *ValueNodePb) GetValuetype() int32 { + if m != nil { + return m.Valuetype } - return nil + return 0 } -func (m *IdentityNodePb) Unmarshal(data []byte) error { - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: IdentityNodePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IdentityNodePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Quote", wireType) - } - var v int32 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Quote = &v - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Text = string(data[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNode(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNode - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *ValueNodePb) GetValue() []byte { + if m != nil { + return m.Value } return nil } -func (m *NumberNodePb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NumberNodePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NumberNodePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Isint", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Isint = bool(v != 0) - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Isfloat", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Isfloat = bool(v != 0) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Iv", wireType) - } - m.Iv = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.Iv |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000001) - case 4: - if wireType != 1 { - return fmt.Errorf("proto: wrong wireType = %d for field Fv", wireType) - } - var v uint64 - if (iNdEx + 8) > l { - return io.ErrUnexpectedEOF - } - iNdEx += 8 - v = uint64(data[iNdEx-8]) - v |= uint64(data[iNdEx-7]) << 8 - v |= uint64(data[iNdEx-6]) << 16 - v |= uint64(data[iNdEx-5]) << 24 - v |= uint64(data[iNdEx-4]) << 32 - v |= uint64(data[iNdEx-3]) << 40 - v |= uint64(data[iNdEx-2]) << 48 - v |= uint64(data[iNdEx-1]) << 56 - m.Fv = float64(math.Float64frombits(v)) - hasFields[0] |= uint64(0x00000002) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Text", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Text = string(data[iNdEx:postIndex]) - iNdEx = postIndex - hasFields[0] |= uint64(0x00000004) - default: - iNdEx = preIndex - skippy, err := skipNode(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNode - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000002) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000004) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +// NullNode +type NullNodePb struct { + Niltype int32 `protobuf:"varint,1,opt,name=niltype" json:"niltype,omitempty"` } -func (m *ValueNodePb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ValueNodePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ValueNodePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Valuetype", wireType) - } - m.Valuetype = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.Valuetype |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Value = append(m.Value[:0], data[iNdEx:postIndex]...) - if m.Value == nil { - m.Value = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000002) - default: - iNdEx = preIndex - skippy, err := skipNode(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNode - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000002) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *NullNodePb) Reset() { *m = NullNodePb{} } +func (m *NullNodePb) String() string { return proto.CompactTextString(m) } +func (*NullNodePb) ProtoMessage() {} +func (*NullNodePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } + +func (m *NullNodePb) GetNiltype() int32 { + if m != nil { + return m.Niltype } - return nil + return 0 } -func (m *NullNodePb) Unmarshal(data []byte) error { - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NullNodePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NullNodePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Niltype", wireType) - } - m.Niltype = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.Niltype |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipNode(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNode - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +func init() { + proto.RegisterType((*Expr)(nil), "expr.Expr") + proto.RegisterType((*NodePb)(nil), "expr.NodePb") + proto.RegisterType((*BinaryNodePb)(nil), "expr.BinaryNodePb") + proto.RegisterType((*BooleanNodePb)(nil), "expr.BooleanNodePb") + proto.RegisterType((*IncludeNodePb)(nil), "expr.IncludeNodePb") + proto.RegisterType((*UnaryNodePb)(nil), "expr.UnaryNodePb") + proto.RegisterType((*FuncNodePb)(nil), "expr.FuncNodePb") + proto.RegisterType((*TriNodePb)(nil), "expr.TriNodePb") + proto.RegisterType((*ArrayNodePb)(nil), "expr.ArrayNodePb") + proto.RegisterType((*StringNodePb)(nil), "expr.StringNodePb") + proto.RegisterType((*IdentityNodePb)(nil), "expr.IdentityNodePb") + proto.RegisterType((*NumberNodePb)(nil), "expr.NumberNodePb") + proto.RegisterType((*ValueNodePb)(nil), "expr.ValueNodePb") + proto.RegisterType((*NullNodePb)(nil), "expr.NullNodePb") } -func skipNode(data []byte) (n int, err error) { - l := len(data) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowNode - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowNode - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if data[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowNode - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthNode - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowNode - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipNode(data[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthNode = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowNode = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("node.proto", fileDescriptorNode) } - -var fileDescriptorNode = []byte{ - // 741 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x54, 0xcf, 0x6f, 0xd3, 0x4a, - 0x10, 0x8e, 0x1d, 0xa7, 0x4d, 0xc6, 0x69, 0xfb, 0xde, 0xbe, 0xea, 0xc9, 0xea, 0x21, 0xaf, 0xb2, - 0x1e, 0x50, 0x21, 0x9a, 0x4a, 0x39, 0x70, 0xa7, 0x12, 0x45, 0x3d, 0x10, 0x50, 0xa1, 0xdc, 0xed, - 0x64, 0x9d, 0xae, 0xe4, 0x8e, 0x83, 0x63, 0x9b, 0xf6, 0xc0, 0x9d, 0x23, 0x47, 0xfe, 0xa4, 0x1c, - 0xf9, 0x0b, 0x10, 0x3f, 0xfe, 0x11, 0x76, 0x67, 0x6d, 0x67, 0x5d, 0x5a, 0x54, 0xd4, 0x43, 0xa4, - 0xec, 0xf7, 0x7d, 0x9e, 0xd9, 0x99, 0x6f, 0x76, 0x00, 0x30, 0x99, 0xf2, 0xe1, 0x3c, 0x4d, 0xb2, - 0x84, 0x39, 0xfc, 0x62, 0x9e, 0xee, 0xec, 0xcf, 0x44, 0x76, 0x96, 0x87, 0xc3, 0x49, 0x72, 0x7e, - 0x30, 0x4b, 0x66, 0xc9, 0x01, 0x91, 0x61, 0x1e, 0xd1, 0x89, 0x0e, 0xf4, 0x4f, 0x7f, 0xe4, 0x2f, - 0x2d, 0x58, 0x7b, 0x2a, 0xbf, 0x7b, 0x19, 0xb2, 0x6d, 0xb0, 0x93, 0xb9, 0x67, 0xed, 0x5a, 0x7b, - 0x9d, 0x43, 0x67, 0xf9, 0xe5, 0x3f, 0xeb, 0x44, 0x9e, 0xd9, 0x7d, 0x70, 0x82, 0x74, 0xb6, 0xf0, - 0xec, 0xdd, 0xf6, 0x9e, 0x3b, 0xea, 0x0f, 0x55, 0x92, 0xa1, 0xfe, 0xa2, 0x54, 0x11, 0xcf, 0x76, - 0xa0, 0x23, 0xa6, 0x1c, 0x33, 0xcf, 0x91, 0x01, 0x7a, 0x25, 0xa5, 0x21, 0xf6, 0x2f, 0xb4, 0x8b, - 0x20, 0xf6, 0x3a, 0x06, 0xa3, 0x00, 0xe6, 0x81, 0x23, 0x14, 0xb1, 0x26, 0x89, 0x76, 0x15, 0x4d, - 0x94, 0x4c, 0xa8, 0x98, 0x75, 0xc9, 0x74, 0x2b, 0x26, 0x2c, 0x99, 0x48, 0x31, 0x5d, 0xc9, 0x58, - 0x15, 0xa3, 0x10, 0xff, 0x83, 0x03, 0x6b, 0x63, 0xd9, 0x0e, 0x59, 0xca, 0x1e, 0xd8, 0x21, 0x52, - 0x29, 0xee, 0x88, 0xe9, 0x2b, 0x1f, 0x0a, 0x0c, 0xd2, 0x4b, 0xcd, 0x57, 0xe5, 0x85, 0xc8, 0x0e, - 0xa0, 0x13, 0x26, 0x49, 0x8c, 0xb2, 0x3e, 0x25, 0xfe, 0xa7, 0x14, 0x4b, 0x88, 0x07, 0xd8, 0x50, - 0x6b, 0x1d, 0x7b, 0x00, 0x76, 0x8e, 0x5e, 0x9b, 0xd4, 0x7f, 0x6b, 0xf5, 0xe9, 0xaf, 0x91, 0x73, - 0x94, 0x8d, 0xb3, 0x23, 0xa4, 0x6e, 0xb8, 0xa3, 0xbf, 0xb4, 0xf0, 0x28, 0xc7, 0x49, 0x53, 0x17, - 0x21, 0xbb, 0x07, 0x76, 0x86, 0xd4, 0x1b, 0x77, 0xb4, 0xa5, 0x75, 0xaf, 0x53, 0xd1, 0x94, 0x65, - 0x94, 0x37, 0x40, 0xea, 0x54, 0x9d, 0xf7, 0x49, 0x9a, 0x06, 0x57, 0xf2, 0x06, 0xa8, 0x6a, 0x47, - 0xf4, 0xc0, 0xac, 0x7d, 0x9c, 0x9f, 0x87, 0x3c, 0x6d, 0x2a, 0x91, 0x42, 0x16, 0xe8, 0xb9, 0x66, - 0xc8, 0x37, 0x41, 0x9c, 0xf3, 0xa6, 0xb0, 0x40, 0xf6, 0x10, 0x6c, 0x81, 0x5e, 0x9f, 0x84, 0xdb, - 0x5a, 0x78, 0xac, 0x8c, 0x15, 0xd9, 0x95, 0xf4, 0x82, 0xd2, 0x2f, 0xd0, 0xdb, 0x30, 0xd3, 0xbf, - 0xca, 0x52, 0x81, 0xb3, 0xa6, 0x72, 0x81, 0x6c, 0x5f, 0xba, 0x8f, 0x13, 0xf4, 0x36, 0xcd, 0xce, - 0x1f, 0xe3, 0x24, 0xce, 0xa7, 0xcd, 0x2b, 0x90, 0x4c, 0x5e, 0xc2, 0x41, 0x21, 0x8d, 0xda, 0x32, - 0x3b, 0x3a, 0xce, 0xe3, 0xb8, 0xa9, 0x55, 0x1a, 0xff, 0x0c, 0xfa, 0xa6, 0xdf, 0xf5, 0x68, 0xdb, - 0xe5, 0x68, 0xb7, 0x68, 0xb4, 0xe5, 0xc8, 0xce, 0x83, 0x94, 0x6b, 0xef, 0xbb, 0x25, 0xa1, 0xa1, - 0x7a, 0xec, 0xdb, 0xe6, 0xd8, 0x1b, 0x99, 0x5a, 0x7a, 0xec, 0xfd, 0xe7, 0xb0, 0xd1, 0x18, 0x96, - 0x1b, 0x52, 0x5d, 0xfb, 0x8a, 0xae, 0x09, 0xf7, 0x1e, 0x36, 0x1a, 0x1d, 0xb8, 0x21, 0xdc, 0x00, - 0xd6, 0x91, 0xcf, 0x82, 0x8c, 0x4f, 0x65, 0x44, 0xbb, 0xbe, 0x7b, 0x05, 0xb2, 0xc7, 0xd0, 0x15, - 0xa5, 0x41, 0xb2, 0x02, 0xfb, 0xb7, 0xb6, 0xb5, 0x4e, 0x6a, 0xad, 0xcf, 0xc1, 0x3d, 0xbd, 0x53, - 0xdb, 0xfe, 0x87, 0xb6, 0xac, 0xa3, 0xcc, 0x79, 0x5d, 0x99, 0x8a, 0xf6, 0xc7, 0x00, 0xab, 0xa7, - 0xa0, 0x5e, 0x34, 0x06, 0xe7, 0x9c, 0xf2, 0xf4, 0xaa, 0x6e, 0x28, 0xe4, 0xd6, 0x5d, 0x3b, 0x86, - 0x5e, 0xfd, 0x64, 0xee, 0x68, 0xc0, 0x0b, 0x70, 0x8d, 0x67, 0xa5, 0xee, 0xf6, 0x2e, 0x0d, 0xcc, - 0x70, 0x72, 0xc4, 0x14, 0x72, 0xeb, 0x01, 0x99, 0x42, 0xdf, 0x9c, 0x7f, 0xb2, 0x2e, 0x79, 0x9b, - 0x27, 0x19, 0xa7, 0xfd, 0x54, 0x2d, 0xb7, 0x0a, 0x54, 0xdd, 0xd5, 0xac, 0x6d, 0x2c, 0x62, 0x0d, - 0xa9, 0xdb, 0x64, 0xfc, 0x22, 0xa3, 0xed, 0x53, 0x77, 0x4a, 0x21, 0xfe, 0x11, 0x6c, 0x36, 0xad, - 0x5d, 0xc5, 0xb1, 0xfe, 0x24, 0xce, 0x47, 0x0b, 0xfa, 0xe6, 0xb6, 0xa0, 0xb5, 0xbe, 0x10, 0x72, - 0xad, 0x5b, 0xa6, 0xd9, 0x04, 0xa9, 0x52, 0xc4, 0x22, 0x8a, 0x93, 0x20, 0x6b, 0x8c, 0x42, 0x05, - 0x2a, 0x27, 0x44, 0x41, 0xb3, 0xd0, 0xae, 0x9c, 0x10, 0x85, 0x42, 0xa3, 0x42, 0xee, 0x45, 0xbb, - 0x5c, 0xdf, 0x12, 0x8d, 0x8a, 0xfa, 0x4a, 0x1d, 0x73, 0x08, 0xe8, 0x4a, 0xcf, 0xc0, 0x35, 0xb6, - 0x12, 0xf3, 0xa1, 0x57, 0xa8, 0x63, 0x76, 0x39, 0xe7, 0x0d, 0x97, 0x57, 0xb0, 0x4c, 0xd1, 0xa1, - 0x03, 0x3d, 0x8e, 0xfe, 0x89, 0x3e, 0xf8, 0x8f, 0x00, 0x56, 0xeb, 0x82, 0x7c, 0x10, 0x71, 0x19, - 0xc5, 0xaa, 0xa3, 0x54, 0xe0, 0xe1, 0xf6, 0xf2, 0xdb, 0xa0, 0xb5, 0xfc, 0x3e, 0xb0, 0x3e, 0xcb, - 0xdf, 0x57, 0xf9, 0xfb, 0xf4, 0x63, 0xd0, 0xfa, 0x19, 0x00, 0x00, 0xff, 0xff, 0xe8, 0xbc, 0x7b, - 0x5f, 0x70, 0x07, 0x00, 0x00, + +func init() { proto.RegisterFile("node.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 635 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0x4d, 0x6f, 0x13, 0x31, + 0x10, 0x55, 0xf6, 0x23, 0x6d, 0x66, 0xd3, 0x0f, 0x4c, 0x85, 0x7c, 0x40, 0x25, 0xac, 0x2a, 0x28, + 0x97, 0x0a, 0x85, 0x1b, 0x12, 0x87, 0x16, 0x81, 0xd4, 0x4b, 0x85, 0xb6, 0x1f, 0x77, 0xa7, 0xd9, + 0x44, 0x16, 0xdb, 0xf1, 0xe2, 0x78, 0x97, 0xf4, 0x5f, 0xf0, 0x93, 0xf8, 0x69, 0xc8, 0xe3, 0x75, + 0xe2, 0xa8, 0x20, 0x0a, 0xb7, 0x7d, 0xf6, 0xdb, 0xf7, 0x66, 0x9e, 0xc7, 0x06, 0x40, 0x35, 0x2d, + 0x4f, 0x6a, 0xad, 0x8c, 0x62, 0x49, 0xb9, 0xac, 0x75, 0xfe, 0xa3, 0x07, 0xc9, 0xa7, 0x65, 0xad, + 0xd9, 0x2e, 0x44, 0xaa, 0xe6, 0xbd, 0x51, 0xef, 0x78, 0x50, 0x44, 0xaa, 0x66, 0xcf, 0xa0, 0xaf, + 0xea, 0xab, 0xfb, 0xba, 0xe4, 0xd1, 0xa8, 0x77, 0x9c, 0x16, 0x1d, 0x62, 0x87, 0x90, 0x08, 0x3d, + 0x5f, 0xf0, 0x78, 0x14, 0x1f, 0x67, 0x63, 0x38, 0xb1, 0x2a, 0x27, 0x56, 0xa1, 0xa0, 0x75, 0x76, + 0x00, 0xa9, 0x9c, 0x96, 0x68, 0x78, 0x42, 0x52, 0x0e, 0xb0, 0x7d, 0x88, 0x5b, 0x51, 0xf1, 0x94, + 0xd6, 0xec, 0x27, 0xe3, 0xb0, 0xd5, 0x8a, 0x8a, 0x0c, 0xfa, 0x64, 0xe0, 0x61, 0xfe, 0x33, 0x86, + 0xfe, 0x85, 0x9a, 0x96, 0x5f, 0x26, 0x2c, 0x87, 0x68, 0x82, 0x54, 0x54, 0x36, 0x66, 0xce, 0xea, + 0x4c, 0xa2, 0xd0, 0xf7, 0x6e, 0xbf, 0x88, 0x26, 0xc8, 0xde, 0x40, 0x3a, 0x51, 0xaa, 0x42, 0xaa, + 0x33, 0x1b, 0x3f, 0xed, 0x68, 0x4a, 0x55, 0xa5, 0xc0, 0x8e, 0xe7, 0x18, 0xec, 0x25, 0x44, 0x0d, + 0xf2, 0x98, 0x78, 0x4f, 0x1c, 0xef, 0x3a, 0x54, 0x6b, 0x90, 0x8d, 0x20, 0x9a, 0x21, 0xd5, 0x9e, + 0x8d, 0xf7, 0x1d, 0xe5, 0x73, 0x83, 0xb7, 0x9e, 0x31, 0x43, 0xf6, 0x02, 0x22, 0x83, 0xd4, 0x49, + 0x36, 0xde, 0x73, 0x8c, 0x2b, 0x2d, 0x3d, 0xc1, 0x90, 0x8b, 0x40, 0x6a, 0x6a, 0xe5, 0x72, 0xaa, + 0xb5, 0x58, 0xb9, 0x08, 0xb4, 0x7d, 0x21, 0x72, 0x08, 0xfb, 0xba, 0x68, 0xee, 0x26, 0xa5, 0xf6, + 0x1c, 0x24, 0x99, 0x16, 0x79, 0x16, 0xca, 0xdc, 0x88, 0xaa, 0x29, 0x3d, 0xa5, 0x45, 0x76, 0x04, + 0x91, 0x44, 0x3e, 0x24, 0xca, 0x81, 0xa3, 0x9c, 0xdb, 0xb8, 0xa5, 0x59, 0x99, 0x49, 0x32, 0x5b, + 0x20, 0xdf, 0x09, 0xcd, 0x2e, 0x8d, 0x96, 0x38, 0xf7, 0x9c, 0x05, 0xb2, 0xd7, 0x90, 0x48, 0xbc, + 0x45, 0xbe, 0x1b, 0x66, 0x78, 0x8e, 0xb7, 0x55, 0x33, 0xf5, 0x86, 0x44, 0x60, 0x47, 0x90, 0xa0, + 0xac, 0x90, 0xef, 0x85, 0x09, 0x5d, 0x34, 0x55, 0xe5, 0x59, 0x76, 0x37, 0xbf, 0x81, 0x61, 0x78, + 0x4e, 0xc1, 0x70, 0xa5, 0x34, 0x5c, 0x07, 0x90, 0xd6, 0x42, 0x97, 0xee, 0xcc, 0xb6, 0x0b, 0x07, + 0xd8, 0x68, 0x63, 0xb4, 0x86, 0x9d, 0x76, 0xa7, 0x6b, 0x77, 0xf2, 0x53, 0xd8, 0xd9, 0x38, 0xd8, + 0x07, 0xc2, 0x5e, 0x22, 0xfa, 0xa3, 0xc4, 0x57, 0xd8, 0xd9, 0xe8, 0xeb, 0x81, 0x04, 0x87, 0x2d, + 0x2c, 0xe7, 0xc2, 0x94, 0xd3, 0xae, 0x3a, 0x0f, 0xd9, 0x5b, 0xd8, 0x96, 0x5d, 0xbc, 0xdd, 0x10, + 0xfd, 0x3e, 0xf4, 0x15, 0x2b, 0xbf, 0x84, 0xec, 0xfa, 0x9f, 0x63, 0x38, 0x84, 0x58, 0xe8, 0x79, + 0xe7, 0xb0, 0xd9, 0x82, 0xdd, 0xc8, 0xcf, 0x00, 0xd6, 0x23, 0xc9, 0x18, 0x24, 0x28, 0xee, 0xca, + 0xee, 0xe6, 0xd2, 0xf7, 0x23, 0x52, 0xf8, 0x00, 0x83, 0xd5, 0xd0, 0xfe, 0x47, 0x88, 0x1f, 0x21, + 0x0b, 0x46, 0xda, 0xd6, 0xf0, 0x5d, 0x0b, 0x2f, 0x41, 0xdf, 0x8f, 0x38, 0xcc, 0x02, 0x86, 0xe1, + 0x1c, 0x52, 0xf0, 0xea, 0x5b, 0xa3, 0x8c, 0x6b, 0xc6, 0x06, 0xef, 0xa0, 0xcd, 0xc9, 0xad, 0xbb, + 0xa7, 0xc8, 0x01, 0xeb, 0x6a, 0xca, 0xa5, 0xa1, 0xa0, 0x06, 0x05, 0x7d, 0xe7, 0xef, 0x61, 0x77, + 0xf3, 0x30, 0xd6, 0xff, 0xf6, 0xfe, 0xf6, 0xaf, 0x86, 0x61, 0x78, 0x09, 0xe9, 0x25, 0x5b, 0x48, + 0x34, 0x5d, 0x35, 0x0e, 0xd8, 0x2a, 0xe5, 0x62, 0x56, 0x29, 0x61, 0xfc, 0x78, 0x74, 0xd0, 0xc6, + 0x28, 0x5b, 0x52, 0x8c, 0x8b, 0x48, 0xb6, 0x16, 0xcf, 0x5a, 0x7a, 0x4a, 0x7a, 0x45, 0x34, 0x6b, + 0x57, 0x9e, 0x69, 0xe0, 0x79, 0x0a, 0x59, 0x70, 0xa9, 0xd9, 0x73, 0x18, 0xb4, 0x16, 0x1a, 0xfb, + 0x2c, 0xba, 0x82, 0xd7, 0x0b, 0xb6, 0x20, 0x02, 0x64, 0x3c, 0x2c, 0x1c, 0xc8, 0x5f, 0x01, 0xac, + 0xef, 0x1f, 0x85, 0x28, 0xab, 0xe0, 0x7f, 0x0f, 0x27, 0x7d, 0x7a, 0xf6, 0xdf, 0xfd, 0x0a, 0x00, + 0x00, 0xff, 0xff, 0xb8, 0xc9, 0xf2, 0x2f, 0x04, 0x06, 0x00, 0x00, } diff --git a/expr/node.proto b/expr/node.proto index 3bf8c81d..f8097bf8 100644 --- a/expr/node.proto +++ b/expr/node.proto @@ -1,118 +1,112 @@ -syntax = "proto2"; +syntax = "proto3"; package expr; +// protoc --go_out=. *.proto -// protoc --proto_path=$GOPATH/src:$GOPATH/src/github.com/gogo/protobuf/protobuf:. --gofast_out=. node.proto -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; -option (gogoproto.goproto_getters_all) = false; - -// The generic Expr -message ExprPb { - optional int32 op = 1 [(gogoproto.nullable) = true]; - repeated ExprPb args = 2 [(gogoproto.nullable) = true]; +// Expr an S-Expression https://en.wikipedia.org/wiki/S-expression representation +// of the AST tree of expression. +// EITHER (op,args) OR (one of ident, val) will be present but not both. +message Expr { + string op = 1; + int32 opType = 2; + repeated Expr args = 3; - optional string ident = 4 [(gogoproto.nullable) = true]; - optional string val = 5 [(gogoproto.nullable) = true]; - optional int64 ival = 6 [(gogoproto.nullable) = true]; - optional bool bval = 7 [(gogoproto.nullable) = true]; - optional double fval = 8 [(gogoproto.nullable) = true]; + string ident = 4; + string val = 5; + int32 valType = 6; } -// The generic Node, must be exactly one of these types +// Node expression must be exactly one of these types message NodePb { - optional BinaryNodePb bn = 1 [(gogoproto.nullable) = true]; - optional BooleanNodePb booln = 2 [(gogoproto.nullable) = true]; - optional UnaryNodePb un = 3 [(gogoproto.nullable) = true]; - optional FuncNodePb fn = 4 [(gogoproto.nullable) = true]; - optional TriNodePb tn = 5 [(gogoproto.nullable) = true]; - optional ArrayNodePb an = 6 [(gogoproto.nullable) = true]; - optional NumberNodePb nn = 10 [(gogoproto.nullable) = true]; - optional ValueNodePb vn = 11 [(gogoproto.nullable) = true]; - optional IdentityNodePb in = 12 [(gogoproto.nullable) = true]; - optional StringNodePb sn = 13 [(gogoproto.nullable) = true]; - optional IncludeNodePb incn = 14 [(gogoproto.nullable) = true]; - optional NullNodePb niln = 15 [(gogoproto.nullable) = true]; + BinaryNodePb bn = 1; + BooleanNodePb booln = 2; + UnaryNodePb un = 3; + FuncNodePb fn = 4; + TriNodePb tn = 5; + ArrayNodePb an = 6; + NumberNodePb nn = 10; + ValueNodePb vn = 11; + IdentityNodePb in = 12; + StringNodePb sn = 13; + IncludeNodePb incn = 14; + NullNodePb niln = 15; } -// Binary Node, two child args +// BinaryNodePb two child args and operation message BinaryNodePb { - required int32 op = 1 [(gogoproto.nullable) = false]; - optional bool paren = 2 [(gogoproto.nullable) = false]; - repeated NodePb args = 3 [(gogoproto.nullable) = false]; + int32 op = 1; + bool paren = 2; + repeated NodePb args = 3; } // Boolean Node, n child args message BooleanNodePb { - required int32 op = 1 [(gogoproto.nullable) = false]; - repeated NodePb args = 2 [(gogoproto.nullable) = false]; + int32 op = 1; + repeated NodePb args = 2; } // Include Node, two child args message IncludeNodePb { - required int32 op = 1 [(gogoproto.nullable) = false]; - required bool negated = 2 [(gogoproto.nullable) = false]; - required IdentityNodePb identity = 3 [(gogoproto.nullable) = false]; + int32 op = 1; + bool negated = 2; + IdentityNodePb identity = 3; } // Unary Node, one child message UnaryNodePb { - required int32 op = 1 [(gogoproto.nullable) = false]; - optional bool paren = 2 [(gogoproto.nullable) = false]; - required NodePb arg = 3 [(gogoproto.nullable) = false]; + int32 op = 1; + bool paren = 2; + NodePb arg = 3; } // Func Node, args are children message FuncNodePb { - required string name = 1 [(gogoproto.nullable) = false]; - repeated NodePb args = 2 [(gogoproto.nullable) = false]; + string name = 1; + repeated NodePb args = 2; } -// Tri Node, may hve children +// TriNodePb, may have children message TriNodePb { - required int32 op = 1 [(gogoproto.nullable) = false]; - repeated NodePb args = 2 [(gogoproto.nullable) = false]; + int32 op = 1; + repeated NodePb args = 2; } // Array Node message ArrayNodePb { - required int32 wrap = 1 [(gogoproto.nullable) = true]; - repeated NodePb args = 3 [(gogoproto.nullable) = false]; + int32 wrap = 1; + repeated NodePb args = 3; } // String literal, no children message StringNodePb { - optional bool noquote = 1 [(gogoproto.nullable) = true]; - optional int32 quote = 2 [(gogoproto.nullable) = true]; - optional string text = 3 [(gogoproto.nullable) = false]; + bool noquote = 1; + int32 quote = 2; + string text = 3; } // Identity message IdentityNodePb { - optional int32 quote = 1 [(gogoproto.nullable) = true]; - optional string text = 3 [(gogoproto.nullable) = false]; + int32 quote = 1; + string text = 3; } // Number Node message NumberNodePb { - optional bool isint = 1 [(gogoproto.nullable) = false]; - optional bool isfloat = 2 [(gogoproto.nullable) = false]; - required int64 iv = 3 [(gogoproto.nullable) = false]; - required double fv = 4 [(gogoproto.nullable) = false]; - required string text = 5 [(gogoproto.nullable) = false]; + bool isint = 1; + bool isfloat = 2; + int64 iv = 3; + double fv = 4; + string text = 5; } // Value Node message ValueNodePb { - required int32 valuetype = 1 [(gogoproto.nullable) = false]; - required bytes value = 2; + int32 valuetype = 1; + bytes value = 2; } // NullNode message NullNodePb { - optional int32 niltype = 1 [(gogoproto.nullable) = false]; + int32 niltype = 1; } diff --git a/expr/node_test.go b/expr/node_test.go index 6b47ec1f..cc2c3f13 100644 --- a/expr/node_test.go +++ b/expr/node_test.go @@ -30,7 +30,7 @@ func TestNodePb(t *testing.T) { exp, err := expr.ParseExpression(exprText) assert.Equal(t, err, nil, "Should not error parse expr but got ", err, "for ", exprText) pb := exp.NodePb() - assert.True(t, pb != nil, "was nil PB: %#v", exp) + assert.NotEqual(t, nil, pb, "was nil PB: %#v", exp) pbBytes, err := proto.Marshal(pb) assert.True(t, err == nil, "Should not error on proto.Marshal but got [%v] for %s pb:%#v", err, exprText, pb) n2, err := expr.NodeFromPb(pbBytes) @@ -40,6 +40,39 @@ func TestNodePb(t *testing.T) { } } +func TestNodePb2(t *testing.T) { + t.Parallel() + for _, et := range exprTests { + exprText := et.qlText + if et.ok { + n, err := expr.ParseExpression(exprText) + assert.Equal(t, err, nil, "Should not error parse expr but got ", err, "for ", exprText) + exp := n.Expr() + assert.NotEqual(t, nil, exp) + pbBytes, err := proto.Marshal(exp) + assert.Equal(t, nil, err, "Should not error on proto.Marshal but got [%v] for %s pb:%#v", err, exprText, exp) + exp2 := &expr.Expr{} + err = proto.Unmarshal(pbBytes, exp2) + assert.Equal(t, nil, err, exprText) + n2, err := expr.NodeFromExpr(exp2) + assert.Equal(t, nil, err, "Should not error but got %v for %v", err, exprText) + + if !n.Equal(n2) { + by, err := json.MarshalIndent(exp, "", " ") + assert.Equal(t, err, nil) + u.Debugf("%T %s", n, string(by)) + by, err = json.MarshalIndent(exp2, "", " ") + assert.Equal(t, err, nil) + u.Debugf("%T %s", n2, string(by)) + assert.True(t, n.Equal(n2), "Expected Equal but got\npre\t%v\npost\t%v", n, n2) + return + } + assert.True(t, n.Equal(n2), "Expected Equal but got\n\t%v\n\t%v", n, n2) + u.Infof("pre/post: \n\t%s\n\t%s", n, n2) + } + } +} + func TestExprRoundTrip(t *testing.T) { t.Parallel() for _, et := range exprTests { diff --git a/lex/dialect_sql_parse_test.go b/lex/dialect_sql_parse_test.go index 93397db1..8de88e98 100644 --- a/lex/dialect_sql_parse_test.go +++ b/lex/dialect_sql_parse_test.go @@ -4,6 +4,7 @@ import ( "testing" u "github.com/araddon/gou" + "github.com/gogo/protobuf/proto" "github.com/stretchr/testify/assert" "github.com/araddon/qlbridge/rel" @@ -18,7 +19,7 @@ func parseSqlTest(t *testing.T, sql string) { _, err2 := rel.ParseSqlSelect(sql) assert.Equal(t, nil, err2) pb := ss.ToPbStatement() - pbb, err := pb.Marshal() + pbb, err := proto.Marshal(pb) assert.Equal(t, nil, err) ss2, err := rel.SqlFromPb(pbb) assert.Equal(t, nil, err) diff --git a/plan/plan.go b/plan/plan.go index 54789c20..10a3de5d 100644 --- a/plan/plan.go +++ b/plan/plan.go @@ -434,24 +434,13 @@ func (m *Select) Marshal() ([]byte, error) { if err != nil { return nil, err } - return m.pbplan.Marshal() -} -func (m *Select) MarshalTo(data []byte) (int, error) { - err := m.serializeToPb() - if err != nil { - return 0, err - } - return m.pbplan.MarshalTo(data) -} -func (m *Select) Size() (n int) { - m.serializeToPb() - return m.pbplan.Size() + return proto.Marshal(m.pbplan) } func (m *Select) Unmarshal(data []byte) error { if m.pbplan == nil { m.pbplan = &PlanPb{Select: &SelectPb{}} } - return m.pbplan.Unmarshal(data) + return proto.Unmarshal(data, m.pbplan) } func (m *Select) serializeToPb() error { if m.pbplan == nil { @@ -706,21 +695,13 @@ func (m *Source) Equal(t Task) bool { } func (m *Source) Marshal() ([]byte, error) { m.serializeToPb() - return m.SourcePb.Marshal() -} -func (m *Source) MarshalTo(data []byte) (n int, err error) { - m.serializeToPb() - return m.SourcePb.MarshalTo(data) -} -func (m *Source) Size() (n int) { - m.serializeToPb() - return m.SourcePb.Size() + return proto.Marshal(m.SourcePb) } func (m *Source) Unmarshal(data []byte) error { if m.SourcePb == nil { m.SourcePb = &SourcePb{} } - return m.SourcePb.Unmarshal(data) + return proto.Unmarshal(data, m.SourcePb) } func (m *Source) serializeToPb() error { if m.pbplan == nil { diff --git a/plan/plan.pb.go b/plan/plan.pb.go index 29f0aa6e..c1092cad 100644 --- a/plan/plan.pb.go +++ b/plan/plan.pb.go @@ -1,38 +1,32 @@ -// Code generated by protoc-gen-gogo. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: plan.proto -// DO NOT EDIT! /* - Package plan is a generated protocol buffer package. - - It is generated from these files: - plan.proto - - It has these top-level messages: - PlanPb - SelectPb - ContextPb - SourcePb - WherePb - GroupByPb - HavingPb - OrderPb - JoinMergePb - JoinKeyPb +Package plan is a generated protocol buffer package. + +It is generated from these files: + plan.proto + +It has these top-level messages: + PlanPb + SelectPb + ContextPb + SourcePb + WherePb + GroupByPb + HavingPb + OrderPb + JoinMergePb + JoinKeyPb */ package plan import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/gogo/protobuf/gogoproto" import rel "github.com/araddon/qlbridge/rel" import expr "github.com/araddon/qlbridge/expr" -import github_com_golang_protobuf_proto "github.com/golang/protobuf/proto" - -import io "io" - // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = fmt.Errorf @@ -40,2462 +34,401 @@ var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. -const _ = proto.ProtoPackageIsVersion1 +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package -// The generic Node, must be exactly one of these types +// Plan must be exactly one type of plan type PlanPb struct { - Parallel bool `protobuf:"varint,1,req,name=parallel" json:"parallel"` - Select *SelectPb `protobuf:"bytes,3,opt,name=select" json:"select,omitempty"` - Source *SourcePb `protobuf:"bytes,4,opt,name=source" json:"source,omitempty"` - Where *WherePb `protobuf:"bytes,5,opt,name=where" json:"where,omitempty"` - Having *HavingPb `protobuf:"bytes,6,opt,name=having" json:"having,omitempty"` - GroupBy *GroupByPb `protobuf:"bytes,7,opt,name=groupBy" json:"groupBy,omitempty"` - Order *OrderPb `protobuf:"bytes,8,opt,name=order" json:"order,omitempty"` - JoinMerge *JoinMergePb `protobuf:"bytes,9,opt,name=joinMerge" json:"joinMerge,omitempty"` - JoinKey *JoinKeyPb `protobuf:"bytes,10,opt,name=joinKey" json:"joinKey,omitempty"` - Projection *rel.ProjectionPb `protobuf:"bytes,11,opt,name=projection" json:"projection,omitempty"` - Children []*PlanPb `protobuf:"bytes,12,rep,name=children" json:"children,omitempty"` - XXX_unrecognized []byte `json:"-"` + Parallel bool `protobuf:"varint,1,opt,name=parallel" json:"parallel,omitempty"` + Select *SelectPb `protobuf:"bytes,3,opt,name=select" json:"select,omitempty"` + Source *SourcePb `protobuf:"bytes,4,opt,name=source" json:"source,omitempty"` + Where *WherePb `protobuf:"bytes,5,opt,name=where" json:"where,omitempty"` + Having *HavingPb `protobuf:"bytes,6,opt,name=having" json:"having,omitempty"` + GroupBy *GroupByPb `protobuf:"bytes,7,opt,name=groupBy" json:"groupBy,omitempty"` + Order *OrderPb `protobuf:"bytes,8,opt,name=order" json:"order,omitempty"` + JoinMerge *JoinMergePb `protobuf:"bytes,9,opt,name=joinMerge" json:"joinMerge,omitempty"` + JoinKey *JoinKeyPb `protobuf:"bytes,10,opt,name=joinKey" json:"joinKey,omitempty"` + Projection *rel.ProjectionPb `protobuf:"bytes,11,opt,name=projection" json:"projection,omitempty"` + Children []*PlanPb `protobuf:"bytes,12,rep,name=children" json:"children,omitempty"` } func (m *PlanPb) Reset() { *m = PlanPb{} } func (m *PlanPb) String() string { return proto.CompactTextString(m) } func (*PlanPb) ProtoMessage() {} -func (*PlanPb) Descriptor() ([]byte, []int) { return fileDescriptorPlan, []int{0} } - -// Select Plan -type SelectPb struct { - Select *rel.SqlSelectPb `protobuf:"bytes,1,req,name=select" json:"select,omitempty"` - Context *ContextPb `protobuf:"bytes,2,opt,name=context" json:"context,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SelectPb) Reset() { *m = SelectPb{} } -func (m *SelectPb) String() string { return proto.CompactTextString(m) } -func (*SelectPb) ProtoMessage() {} -func (*SelectPb) Descriptor() ([]byte, []int) { return fileDescriptorPlan, []int{1} } - -// Context -type ContextPb struct { - Schema string `protobuf:"bytes,1,req,name=schema" json:"schema"` - Id uint64 `protobuf:"varint,2,req,name=id" json:"id"` - Fingerprint uint64 `protobuf:"varint,3,req,name=fingerprint" json:"fingerprint"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *ContextPb) Reset() { *m = ContextPb{} } -func (m *ContextPb) String() string { return proto.CompactTextString(m) } -func (*ContextPb) ProtoMessage() {} -func (*ContextPb) Descriptor() ([]byte, []int) { return fileDescriptorPlan, []int{2} } - -// Source Plan is a plan for single source of select query, of which -// many may exist (joins, sub-querys etc) -type SourcePb struct { - // do we need group-by, join, partition key for routing purposes? - NeedsHashableKey bool `protobuf:"varint,2,req,name=needsHashableKey" json:"needsHashableKey"` - // Is this final projection or not? non finals are partial-sub-query types - Final bool `protobuf:"varint,3,req,name=final" json:"final"` - // Is this plan complete as is? skip remaining plan walk steps - Complete bool `protobuf:"varint,4,req,name=complete" json:"complete"` - Join bool `protobuf:"varint,5,req,name=join" json:"join"` - SourceExec bool `protobuf:"varint,6,req,name=sourceExec" json:"sourceExec"` - Custom []byte `protobuf:"bytes,7,opt,name=custom" json:"custom,omitempty"` - SqlSource *rel.SqlSourcePb `protobuf:"bytes,8,opt,name=sqlSource" json:"sqlSource,omitempty"` - Projection *rel.ProjectionPb `protobuf:"bytes,9,opt,name=projection" json:"projection,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *SourcePb) Reset() { *m = SourcePb{} } -func (m *SourcePb) String() string { return proto.CompactTextString(m) } -func (*SourcePb) ProtoMessage() {} -func (*SourcePb) Descriptor() ([]byte, []int) { return fileDescriptorPlan, []int{3} } - -// Where Plan -type WherePb struct { - Select *rel.SqlSelectPb `protobuf:"bytes,1,opt,name=select" json:"select,omitempty"` - Final bool `protobuf:"varint,2,req,name=final" json:"final"` - XXX_unrecognized []byte `json:"-"` -} +func (*PlanPb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } -func (m *WherePb) Reset() { *m = WherePb{} } -func (m *WherePb) String() string { return proto.CompactTextString(m) } -func (*WherePb) ProtoMessage() {} -func (*WherePb) Descriptor() ([]byte, []int) { return fileDescriptorPlan, []int{4} } - -// Group By Plan -type GroupByPb struct { - Select *rel.SqlSelectPb `protobuf:"bytes,1,opt,name=select" json:"select,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *GroupByPb) Reset() { *m = GroupByPb{} } -func (m *GroupByPb) String() string { return proto.CompactTextString(m) } -func (*GroupByPb) ProtoMessage() {} -func (*GroupByPb) Descriptor() ([]byte, []int) { return fileDescriptorPlan, []int{5} } - -type HavingPb struct { - Select *rel.SqlSelectPb `protobuf:"bytes,1,opt,name=select" json:"select,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *HavingPb) Reset() { *m = HavingPb{} } -func (m *HavingPb) String() string { return proto.CompactTextString(m) } -func (*HavingPb) ProtoMessage() {} -func (*HavingPb) Descriptor() ([]byte, []int) { return fileDescriptorPlan, []int{6} } - -type OrderPb struct { - Select *rel.SqlSelectPb `protobuf:"bytes,1,opt,name=select" json:"select,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *OrderPb) Reset() { *m = OrderPb{} } -func (m *OrderPb) String() string { return proto.CompactTextString(m) } -func (*OrderPb) ProtoMessage() {} -func (*OrderPb) Descriptor() ([]byte, []int) { return fileDescriptorPlan, []int{7} } - -type JoinMergePb struct { - Having *expr.NodePb `protobuf:"bytes,1,opt,name=having" json:"having,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *JoinMergePb) Reset() { *m = JoinMergePb{} } -func (m *JoinMergePb) String() string { return proto.CompactTextString(m) } -func (*JoinMergePb) ProtoMessage() {} -func (*JoinMergePb) Descriptor() ([]byte, []int) { return fileDescriptorPlan, []int{8} } - -type JoinKeyPb struct { - Having *expr.NodePb `protobuf:"bytes,1,opt,name=having" json:"having,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *JoinKeyPb) Reset() { *m = JoinKeyPb{} } -func (m *JoinKeyPb) String() string { return proto.CompactTextString(m) } -func (*JoinKeyPb) ProtoMessage() {} -func (*JoinKeyPb) Descriptor() ([]byte, []int) { return fileDescriptorPlan, []int{9} } - -func init() { - proto.RegisterType((*PlanPb)(nil), "plan.PlanPb") - proto.RegisterType((*SelectPb)(nil), "plan.SelectPb") - proto.RegisterType((*ContextPb)(nil), "plan.ContextPb") - proto.RegisterType((*SourcePb)(nil), "plan.SourcePb") - proto.RegisterType((*WherePb)(nil), "plan.WherePb") - proto.RegisterType((*GroupByPb)(nil), "plan.GroupByPb") - proto.RegisterType((*HavingPb)(nil), "plan.HavingPb") - proto.RegisterType((*OrderPb)(nil), "plan.OrderPb") - proto.RegisterType((*JoinMergePb)(nil), "plan.JoinMergePb") - proto.RegisterType((*JoinKeyPb)(nil), "plan.JoinKeyPb") -} -func (m *PlanPb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err +func (m *PlanPb) GetParallel() bool { + if m != nil { + return m.Parallel } - return data[:n], nil + return false } -func (m *PlanPb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0x8 - i++ - if m.Parallel { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - if m.Select != nil { - data[i] = 0x1a - i++ - i = encodeVarintPlan(data, i, uint64(m.Select.Size())) - n1, err := m.Select.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if m.Source != nil { - data[i] = 0x22 - i++ - i = encodeVarintPlan(data, i, uint64(m.Source.Size())) - n2, err := m.Source.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if m.Where != nil { - data[i] = 0x2a - i++ - i = encodeVarintPlan(data, i, uint64(m.Where.Size())) - n3, err := m.Where.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n3 - } - if m.Having != nil { - data[i] = 0x32 - i++ - i = encodeVarintPlan(data, i, uint64(m.Having.Size())) - n4, err := m.Having.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n4 - } - if m.GroupBy != nil { - data[i] = 0x3a - i++ - i = encodeVarintPlan(data, i, uint64(m.GroupBy.Size())) - n5, err := m.GroupBy.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n5 - } - if m.Order != nil { - data[i] = 0x42 - i++ - i = encodeVarintPlan(data, i, uint64(m.Order.Size())) - n6, err := m.Order.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n6 - } - if m.JoinMerge != nil { - data[i] = 0x4a - i++ - i = encodeVarintPlan(data, i, uint64(m.JoinMerge.Size())) - n7, err := m.JoinMerge.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n7 - } - if m.JoinKey != nil { - data[i] = 0x52 - i++ - i = encodeVarintPlan(data, i, uint64(m.JoinKey.Size())) - n8, err := m.JoinKey.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n8 - } - if m.Projection != nil { - data[i] = 0x5a - i++ - i = encodeVarintPlan(data, i, uint64(m.Projection.Size())) - n9, err := m.Projection.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n9 - } - if len(m.Children) > 0 { - for _, msg := range m.Children { - data[i] = 0x62 - i++ - i = encodeVarintPlan(data, i, uint64(msg.Size())) - n, err := msg.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) +func (m *PlanPb) GetSelect() *SelectPb { + if m != nil { + return m.Select } - return i, nil + return nil } -func (m *SelectPb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err +func (m *PlanPb) GetSource() *SourcePb { + if m != nil { + return m.Source } - return data[:n], nil + return nil } -func (m *SelectPb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Select == nil { - return 0, new(github_com_golang_protobuf_proto.RequiredNotSetError) - } else { - data[i] = 0xa - i++ - i = encodeVarintPlan(data, i, uint64(m.Select.Size())) - n10, err := m.Select.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n10 - } - if m.Context != nil { - data[i] = 0x12 - i++ - i = encodeVarintPlan(data, i, uint64(m.Context.Size())) - n11, err := m.Context.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n11 - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) +func (m *PlanPb) GetWhere() *WherePb { + if m != nil { + return m.Where } - return i, nil + return nil } -func (m *ContextPb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err +func (m *PlanPb) GetHaving() *HavingPb { + if m != nil { + return m.Having } - return data[:n], nil + return nil } -func (m *ContextPb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0xa - i++ - i = encodeVarintPlan(data, i, uint64(len(m.Schema))) - i += copy(data[i:], m.Schema) - data[i] = 0x10 - i++ - i = encodeVarintPlan(data, i, uint64(m.Id)) - data[i] = 0x18 - i++ - i = encodeVarintPlan(data, i, uint64(m.Fingerprint)) - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) +func (m *PlanPb) GetGroupBy() *GroupByPb { + if m != nil { + return m.GroupBy } - return i, nil + return nil } -func (m *SourcePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err +func (m *PlanPb) GetOrder() *OrderPb { + if m != nil { + return m.Order } - return data[:n], nil + return nil } -func (m *SourcePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0x10 - i++ - if m.NeedsHashableKey { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - data[i] = 0x18 - i++ - if m.Final { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - data[i] = 0x20 - i++ - if m.Complete { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - data[i] = 0x28 - i++ - if m.Join { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - data[i] = 0x30 - i++ - if m.SourceExec { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - if m.Custom != nil { - data[i] = 0x3a - i++ - i = encodeVarintPlan(data, i, uint64(len(m.Custom))) - i += copy(data[i:], m.Custom) - } - if m.SqlSource != nil { - data[i] = 0x42 - i++ - i = encodeVarintPlan(data, i, uint64(m.SqlSource.Size())) - n12, err := m.SqlSource.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n12 - } - if m.Projection != nil { - data[i] = 0x4a - i++ - i = encodeVarintPlan(data, i, uint64(m.Projection.Size())) - n13, err := m.Projection.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n13 - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) +func (m *PlanPb) GetJoinMerge() *JoinMergePb { + if m != nil { + return m.JoinMerge } - return i, nil + return nil } -func (m *WherePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err +func (m *PlanPb) GetJoinKey() *JoinKeyPb { + if m != nil { + return m.JoinKey } - return data[:n], nil + return nil } -func (m *WherePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Select != nil { - data[i] = 0xa - i++ - i = encodeVarintPlan(data, i, uint64(m.Select.Size())) - n14, err := m.Select.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n14 - } - data[i] = 0x10 - i++ - if m.Final { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) +func (m *PlanPb) GetProjection() *rel.ProjectionPb { + if m != nil { + return m.Projection } - return i, nil + return nil } -func (m *GroupByPb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err +func (m *PlanPb) GetChildren() []*PlanPb { + if m != nil { + return m.Children } - return data[:n], nil + return nil } -func (m *GroupByPb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Select != nil { - data[i] = 0xa - i++ - i = encodeVarintPlan(data, i, uint64(m.Select.Size())) - n15, err := m.Select.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n15 - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil +// Select Plan +type SelectPb struct { + Select *rel.SqlSelectPb `protobuf:"bytes,1,opt,name=select" json:"select,omitempty"` + Context *ContextPb `protobuf:"bytes,2,opt,name=context" json:"context,omitempty"` } -func (m *HavingPb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} +func (m *SelectPb) Reset() { *m = SelectPb{} } +func (m *SelectPb) String() string { return proto.CompactTextString(m) } +func (*SelectPb) ProtoMessage() {} +func (*SelectPb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } -func (m *HavingPb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Select != nil { - data[i] = 0xa - i++ - i = encodeVarintPlan(data, i, uint64(m.Select.Size())) - n16, err := m.Select.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n16 - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) +func (m *SelectPb) GetSelect() *rel.SqlSelectPb { + if m != nil { + return m.Select } - return i, nil + return nil } -func (m *OrderPb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err +func (m *SelectPb) GetContext() *ContextPb { + if m != nil { + return m.Context } - return data[:n], nil + return nil } -func (m *OrderPb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Select != nil { - data[i] = 0xa - i++ - i = encodeVarintPlan(data, i, uint64(m.Select.Size())) - n17, err := m.Select.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n17 - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil +// Context +type ContextPb struct { + Schema string `protobuf:"bytes,1,opt,name=schema" json:"schema,omitempty"` + Id uint64 `protobuf:"varint,2,opt,name=id" json:"id,omitempty"` + Fingerprint uint64 `protobuf:"varint,3,opt,name=fingerprint" json:"fingerprint,omitempty"` } -func (m *JoinMergePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} +func (m *ContextPb) Reset() { *m = ContextPb{} } +func (m *ContextPb) String() string { return proto.CompactTextString(m) } +func (*ContextPb) ProtoMessage() {} +func (*ContextPb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } -func (m *JoinMergePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Having != nil { - data[i] = 0xa - i++ - i = encodeVarintPlan(data, i, uint64(m.Having.Size())) - n18, err := m.Having.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n18 +func (m *ContextPb) GetSchema() string { + if m != nil { + return m.Schema } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil + return "" } -func (m *JoinKeyPb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err +func (m *ContextPb) GetId() uint64 { + if m != nil { + return m.Id } - return data[:n], nil + return 0 } -func (m *JoinKeyPb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Having != nil { - data[i] = 0xa - i++ - i = encodeVarintPlan(data, i, uint64(m.Having.Size())) - n19, err := m.Having.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n19 - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) +func (m *ContextPb) GetFingerprint() uint64 { + if m != nil { + return m.Fingerprint } - return i, nil + return 0 } -func encodeFixed64Plan(data []byte, offset int, v uint64) int { - data[offset] = uint8(v) - data[offset+1] = uint8(v >> 8) - data[offset+2] = uint8(v >> 16) - data[offset+3] = uint8(v >> 24) - data[offset+4] = uint8(v >> 32) - data[offset+5] = uint8(v >> 40) - data[offset+6] = uint8(v >> 48) - data[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Plan(data []byte, offset int, v uint32) int { - data[offset] = uint8(v) - data[offset+1] = uint8(v >> 8) - data[offset+2] = uint8(v >> 16) - data[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintPlan(data []byte, offset int, v uint64) int { - for v >= 1<<7 { - data[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - data[offset] = uint8(v) - return offset + 1 +// Source Plan is a plan for single source of select query, of which +// many may exist (joins, sub-querys etc) +type SourcePb struct { + // do we need group-by, join, partition key for routing purposes? + NeedsHashableKey bool `protobuf:"varint,2,opt,name=needsHashableKey" json:"needsHashableKey,omitempty"` + // Is this final projection or not? non finals are partial-sub-query types + Final bool `protobuf:"varint,3,opt,name=final" json:"final,omitempty"` + // Is this plan complete as is? skip remaining plan walk steps + Complete bool `protobuf:"varint,4,opt,name=complete" json:"complete,omitempty"` + Join bool `protobuf:"varint,5,opt,name=join" json:"join,omitempty"` + SourceExec bool `protobuf:"varint,6,opt,name=sourceExec" json:"sourceExec,omitempty"` + Custom []byte `protobuf:"bytes,7,opt,name=custom,proto3" json:"custom,omitempty"` + SqlSource *rel.SqlSourcePb `protobuf:"bytes,8,opt,name=sqlSource" json:"sqlSource,omitempty"` + Projection *rel.ProjectionPb `protobuf:"bytes,9,opt,name=projection" json:"projection,omitempty"` } -func (m *PlanPb) Size() (n int) { - var l int - _ = l - n += 2 - if m.Select != nil { - l = m.Select.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if m.Source != nil { - l = m.Source.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if m.Where != nil { - l = m.Where.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if m.Having != nil { - l = m.Having.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if m.GroupBy != nil { - l = m.GroupBy.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if m.Order != nil { - l = m.Order.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if m.JoinMerge != nil { - l = m.JoinMerge.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if m.JoinKey != nil { - l = m.JoinKey.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if m.Projection != nil { - l = m.Projection.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if len(m.Children) > 0 { - for _, e := range m.Children { - l = e.Size() - n += 1 + l + sovPlan(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) + +func (m *SourcePb) Reset() { *m = SourcePb{} } +func (m *SourcePb) String() string { return proto.CompactTextString(m) } +func (*SourcePb) ProtoMessage() {} +func (*SourcePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *SourcePb) GetNeedsHashableKey() bool { + if m != nil { + return m.NeedsHashableKey } - return n + return false } -func (m *SelectPb) Size() (n int) { - var l int - _ = l - if m.Select != nil { - l = m.Select.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if m.Context != nil { - l = m.Context.Size() - n += 1 + l + sovPlan(uint64(l)) +func (m *SourcePb) GetFinal() bool { + if m != nil { + return m.Final } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n + return false } -func (m *ContextPb) Size() (n int) { - var l int - _ = l - l = len(m.Schema) - n += 1 + l + sovPlan(uint64(l)) - n += 1 + sovPlan(uint64(m.Id)) - n += 1 + sovPlan(uint64(m.Fingerprint)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) +func (m *SourcePb) GetComplete() bool { + if m != nil { + return m.Complete } - return n + return false } -func (m *SourcePb) Size() (n int) { - var l int - _ = l - n += 2 - n += 2 - n += 2 - n += 2 - n += 2 - if m.Custom != nil { - l = len(m.Custom) - n += 1 + l + sovPlan(uint64(l)) - } - if m.SqlSource != nil { - l = m.SqlSource.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if m.Projection != nil { - l = m.Projection.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) +func (m *SourcePb) GetJoin() bool { + if m != nil { + return m.Join } - return n + return false } -func (m *WherePb) Size() (n int) { - var l int - _ = l - if m.Select != nil { - l = m.Select.Size() - n += 1 + l + sovPlan(uint64(l)) +func (m *SourcePb) GetSourceExec() bool { + if m != nil { + return m.SourceExec } - n += 2 - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n + return false } -func (m *GroupByPb) Size() (n int) { - var l int - _ = l - if m.Select != nil { - l = m.Select.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) +func (m *SourcePb) GetCustom() []byte { + if m != nil { + return m.Custom } - return n + return nil } -func (m *HavingPb) Size() (n int) { - var l int - _ = l - if m.Select != nil { - l = m.Select.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) +func (m *SourcePb) GetSqlSource() *rel.SqlSourcePb { + if m != nil { + return m.SqlSource } - return n + return nil } -func (m *OrderPb) Size() (n int) { - var l int - _ = l - if m.Select != nil { - l = m.Select.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) +func (m *SourcePb) GetProjection() *rel.ProjectionPb { + if m != nil { + return m.Projection } - return n + return nil } -func (m *JoinMergePb) Size() (n int) { - var l int - _ = l - if m.Having != nil { - l = m.Having.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n +// Where Plan +type WherePb struct { + Select *rel.SqlSelectPb `protobuf:"bytes,1,opt,name=select" json:"select,omitempty"` + Final bool `protobuf:"varint,2,opt,name=final" json:"final,omitempty"` } -func (m *JoinKeyPb) Size() (n int) { - var l int - _ = l - if m.Having != nil { - l = m.Having.Size() - n += 1 + l + sovPlan(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) +func (m *WherePb) Reset() { *m = WherePb{} } +func (m *WherePb) String() string { return proto.CompactTextString(m) } +func (*WherePb) ProtoMessage() {} +func (*WherePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *WherePb) GetSelect() *rel.SqlSelectPb { + if m != nil { + return m.Select } - return n + return nil } -func sovPlan(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } +func (m *WherePb) GetFinal() bool { + if m != nil { + return m.Final } - return n -} -func sozPlan(x uint64) (n int) { - return sovPlan(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return false } -func (m *PlanPb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PlanPb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PlanPb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Parallel", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Parallel = bool(v != 0) - hasFields[0] |= uint64(0x00000001) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Select", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Select == nil { - m.Select = &SelectPb{} - } - if err := m.Select.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Source == nil { - m.Source = &SourcePb{} - } - if err := m.Source.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Where", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Where == nil { - m.Where = &WherePb{} - } - if err := m.Where.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Having", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Having == nil { - m.Having = &HavingPb{} - } - if err := m.Having.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GroupBy", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.GroupBy == nil { - m.GroupBy = &GroupByPb{} - } - if err := m.GroupBy.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Order", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Order == nil { - m.Order = &OrderPb{} - } - if err := m.Order.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field JoinMerge", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.JoinMerge == nil { - m.JoinMerge = &JoinMergePb{} - } - if err := m.JoinMerge.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field JoinKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.JoinKey == nil { - m.JoinKey = &JoinKeyPb{} - } - if err := m.JoinKey.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Projection", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Projection == nil { - m.Projection = &rel.ProjectionPb{} - } - if err := m.Projection.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Children", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Children = append(m.Children, &PlanPb{}) - if err := m.Children[len(m.Children)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPlan(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPlan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +// Group By Plan +type GroupByPb struct { + Select *rel.SqlSelectPb `protobuf:"bytes,1,opt,name=select" json:"select,omitempty"` } -func (m *SelectPb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SelectPb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SelectPb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Select", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Select == nil { - m.Select = &rel.SqlSelectPb{} - } - if err := m.Select.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Context", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Context == nil { - m.Context = &ContextPb{} - } - if err := m.Context.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPlan(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPlan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *GroupByPb) Reset() { *m = GroupByPb{} } +func (m *GroupByPb) String() string { return proto.CompactTextString(m) } +func (*GroupByPb) ProtoMessage() {} +func (*GroupByPb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +func (m *GroupByPb) GetSelect() *rel.SqlSelectPb { + if m != nil { + return m.Select } return nil } -func (m *ContextPb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ContextPb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ContextPb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Schema", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Schema = string(data[iNdEx:postIndex]) - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.Id |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000002) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Fingerprint", wireType) - } - m.Fingerprint = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.Fingerprint |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000004) - default: - iNdEx = preIndex - skippy, err := skipPlan(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPlan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000002) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000004) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +type HavingPb struct { + Select *rel.SqlSelectPb `protobuf:"bytes,1,opt,name=select" json:"select,omitempty"` } -func (m *SourcePb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SourcePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SourcePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NeedsHashableKey", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.NeedsHashableKey = bool(v != 0) - hasFields[0] |= uint64(0x00000001) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Final", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Final = bool(v != 0) - hasFields[0] |= uint64(0x00000002) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Complete", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Complete = bool(v != 0) - hasFields[0] |= uint64(0x00000004) - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Join", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Join = bool(v != 0) - hasFields[0] |= uint64(0x00000008) - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SourceExec", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.SourceExec = bool(v != 0) - hasFields[0] |= uint64(0x00000010) - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Custom", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Custom = append(m.Custom[:0], data[iNdEx:postIndex]...) - if m.Custom == nil { - m.Custom = []byte{} - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SqlSource", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.SqlSource == nil { - m.SqlSource = &rel.SqlSourcePb{} - } - if err := m.SqlSource.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Projection", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Projection == nil { - m.Projection = &rel.ProjectionPb{} - } - if err := m.Projection.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPlan(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPlan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000002) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000004) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000008) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000010) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *HavingPb) Reset() { *m = HavingPb{} } +func (m *HavingPb) String() string { return proto.CompactTextString(m) } +func (*HavingPb) ProtoMessage() {} +func (*HavingPb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +func (m *HavingPb) GetSelect() *rel.SqlSelectPb { + if m != nil { + return m.Select } return nil } -func (m *WherePb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WherePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WherePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Select", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Select == nil { - m.Select = &rel.SqlSelectPb{} - } - if err := m.Select.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Final", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Final = bool(v != 0) - hasFields[0] |= uint64(0x00000001) - default: - iNdEx = preIndex - skippy, err := skipPlan(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPlan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +type OrderPb struct { + Select *rel.SqlSelectPb `protobuf:"bytes,1,opt,name=select" json:"select,omitempty"` } -func (m *GroupByPb) Unmarshal(data []byte) error { - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: GroupByPb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GroupByPb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Select", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Select == nil { - m.Select = &rel.SqlSelectPb{} - } - if err := m.Select.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPlan(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPlan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *OrderPb) Reset() { *m = OrderPb{} } +func (m *OrderPb) String() string { return proto.CompactTextString(m) } +func (*OrderPb) ProtoMessage() {} +func (*OrderPb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } + +func (m *OrderPb) GetSelect() *rel.SqlSelectPb { + if m != nil { + return m.Select } return nil } -func (m *HavingPb) Unmarshal(data []byte) error { - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: HavingPb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: HavingPb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Select", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Select == nil { - m.Select = &rel.SqlSelectPb{} - } - if err := m.Select.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPlan(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPlan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +type JoinMergePb struct { + Having *expr.NodePb `protobuf:"bytes,1,opt,name=having" json:"having,omitempty"` } -func (m *OrderPb) Unmarshal(data []byte) error { - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: OrderPb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: OrderPb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Select", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Select == nil { - m.Select = &rel.SqlSelectPb{} - } - if err := m.Select.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPlan(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPlan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *JoinMergePb) Reset() { *m = JoinMergePb{} } +func (m *JoinMergePb) String() string { return proto.CompactTextString(m) } +func (*JoinMergePb) ProtoMessage() {} +func (*JoinMergePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } + +func (m *JoinMergePb) GetHaving() *expr.NodePb { + if m != nil { + return m.Having } return nil } -func (m *JoinMergePb) Unmarshal(data []byte) error { - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: JoinMergePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: JoinMergePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Having", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Having == nil { - m.Having = &expr.NodePb{} - } - if err := m.Having.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPlan(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPlan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +type JoinKeyPb struct { + Having *expr.NodePb `protobuf:"bytes,1,opt,name=having" json:"having,omitempty"` } -func (m *JoinKeyPb) Unmarshal(data []byte) error { - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: JoinKeyPb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: JoinKeyPb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Having", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPlan - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthPlan - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Having == nil { - m.Having = &expr.NodePb{} - } - if err := m.Having.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipPlan(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthPlan - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if iNdEx > l { - return io.ErrUnexpectedEOF +func (m *JoinKeyPb) Reset() { *m = JoinKeyPb{} } +func (m *JoinKeyPb) String() string { return proto.CompactTextString(m) } +func (*JoinKeyPb) ProtoMessage() {} +func (*JoinKeyPb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } + +func (m *JoinKeyPb) GetHaving() *expr.NodePb { + if m != nil { + return m.Having } return nil } -func skipPlan(data []byte) (n int, err error) { - l := len(data) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPlan - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPlan - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if data[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPlan - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthPlan - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowPlan - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipPlan(data[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} -var ( - ErrInvalidLengthPlan = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowPlan = fmt.Errorf("proto: integer overflow") -) +func init() { + proto.RegisterType((*PlanPb)(nil), "plan.PlanPb") + proto.RegisterType((*SelectPb)(nil), "plan.SelectPb") + proto.RegisterType((*ContextPb)(nil), "plan.ContextPb") + proto.RegisterType((*SourcePb)(nil), "plan.SourcePb") + proto.RegisterType((*WherePb)(nil), "plan.WherePb") + proto.RegisterType((*GroupByPb)(nil), "plan.GroupByPb") + proto.RegisterType((*HavingPb)(nil), "plan.HavingPb") + proto.RegisterType((*OrderPb)(nil), "plan.OrderPb") + proto.RegisterType((*JoinMergePb)(nil), "plan.JoinMergePb") + proto.RegisterType((*JoinKeyPb)(nil), "plan.JoinKeyPb") +} -var fileDescriptorPlan = []byte{ - // 602 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x54, 0x5b, 0x8e, 0xd3, 0x3c, - 0x18, 0x9d, 0xf4, 0x9a, 0x7c, 0xed, 0xff, 0x53, 0xc2, 0x08, 0x99, 0x79, 0x28, 0x55, 0xb8, 0xa8, - 0x30, 0x22, 0x11, 0x65, 0x07, 0x45, 0xc0, 0x68, 0x10, 0x43, 0xa5, 0x79, 0x40, 0xe2, 0x2d, 0x17, - 0x4f, 0x92, 0x91, 0x1b, 0xa7, 0x6e, 0x0a, 0x9d, 0x9d, 0xb0, 0x05, 0x76, 0xd2, 0x47, 0x56, 0x80, - 0xb8, 0x3c, 0xb0, 0x0d, 0x1c, 0x3b, 0x71, 0x5d, 0x24, 0x46, 0xe5, 0x21, 0x52, 0x72, 0x7c, 0x7c, - 0xfc, 0xf9, 0x3b, 0xe7, 0x0b, 0x40, 0x4e, 0xfc, 0xcc, 0xcd, 0x19, 0x2d, 0xa8, 0xdd, 0x2a, 0xdf, - 0x8f, 0x9e, 0xc4, 0x69, 0x91, 0xac, 0x02, 0x37, 0xa4, 0x73, 0x2f, 0xa6, 0x31, 0xf5, 0xc4, 0x62, - 0xb0, 0xba, 0x10, 0x5f, 0xe2, 0x43, 0xbc, 0xc9, 0x4d, 0x47, 0x8f, 0x34, 0xba, 0xcf, 0xfc, 0x28, - 0xa2, 0x99, 0xb7, 0x20, 0x01, 0x4b, 0xa3, 0x18, 0x7b, 0x0c, 0x13, 0x6f, 0xb9, 0x20, 0x15, 0xf5, - 0xf8, 0x3a, 0x2a, 0x5e, 0xe7, 0xcc, 0xcb, 0x68, 0x84, 0x25, 0xd9, 0xf9, 0xdc, 0x84, 0xce, 0x8c, - 0xd7, 0x33, 0x0b, 0xec, 0xdb, 0x60, 0xe6, 0x9c, 0x4f, 0x08, 0x26, 0xc8, 0x18, 0x35, 0xc6, 0xe6, - 0xb4, 0xb5, 0xf9, 0x7a, 0xf7, 0xc0, 0xbe, 0x0f, 0x9d, 0x25, 0x26, 0x38, 0x2c, 0x50, 0x73, 0x64, - 0x8c, 0x7b, 0x93, 0xff, 0x5d, 0x71, 0x99, 0x73, 0x81, 0xcd, 0x02, 0xc1, 0x32, 0x04, 0x8b, 0xae, - 0x58, 0x88, 0x51, 0x6b, 0x87, 0x25, 0x30, 0xc5, 0x72, 0xa0, 0xfd, 0x31, 0xc1, 0x0c, 0xa3, 0xb6, - 0x20, 0xfd, 0x27, 0x49, 0xef, 0x4a, 0x48, 0x57, 0x4a, 0xfc, 0x0f, 0x69, 0x16, 0xa3, 0x8e, 0xae, - 0x74, 0x22, 0x30, 0xc5, 0x7a, 0x08, 0xdd, 0x98, 0xd1, 0x55, 0x3e, 0xbd, 0x42, 0x5d, 0x41, 0xbb, - 0x21, 0x69, 0xaf, 0x24, 0xa8, 0x9f, 0x48, 0x59, 0x84, 0x19, 0x32, 0xf5, 0x13, 0xdf, 0x96, 0x90, - 0xe2, 0x3c, 0x06, 0xeb, 0x92, 0xa6, 0xd9, 0x1b, 0xcc, 0x62, 0x8c, 0x2c, 0xc1, 0xbb, 0x29, 0x79, - 0xa7, 0x35, 0xac, 0x9f, 0x5b, 0x72, 0x5f, 0xe3, 0x2b, 0x04, 0xfa, 0xb9, 0xa7, 0x12, 0x54, 0xbc, - 0x63, 0xee, 0x39, 0xa3, 0x97, 0xbc, 0x45, 0x29, 0xcd, 0x50, 0xaf, 0x12, 0xe5, 0x4e, 0xb9, 0x33, - 0x05, 0x6b, 0x57, 0x36, 0xc3, 0x24, 0x25, 0x11, 0xc3, 0x19, 0xea, 0x8f, 0x9a, 0x9c, 0xda, 0x97, - 0xaa, 0xd2, 0x1a, 0xc9, 0x72, 0xde, 0x83, 0x59, 0x37, 0x9d, 0x97, 0x51, 0x9b, 0x52, 0x5a, 0xd5, - 0x9b, 0x0c, 0x84, 0xf4, 0xf9, 0x82, 0xfc, 0x61, 0x0b, 0x2f, 0x37, 0xa4, 0x59, 0x81, 0xd7, 0x05, - 0x6a, 0xe8, 0xe5, 0x3e, 0x97, 0xa0, 0xd2, 0x3e, 0x03, 0x4b, 0x41, 0xf6, 0x21, 0x17, 0x0f, 0x13, - 0x3c, 0xf7, 0x85, 0xb8, 0x55, 0xe5, 0x60, 0x00, 0x8d, 0x34, 0xe2, 0x2a, 0x8d, 0x71, 0xab, 0x42, - 0xee, 0x40, 0xef, 0x82, 0x7b, 0x82, 0x59, 0xce, 0xd2, 0xac, 0x8c, 0x87, 0x5a, 0x72, 0x7e, 0x19, - 0xbc, 0xd8, 0xca, 0x7b, 0x7b, 0x08, 0x83, 0x0c, 0xe3, 0x68, 0x79, 0xe2, 0x2f, 0x13, 0x3f, 0x20, - 0xb8, 0x6c, 0x5e, 0x43, 0x4b, 0xd8, 0x2d, 0x68, 0x73, 0x1d, 0x9f, 0x08, 0x85, 0x1a, 0xe4, 0x71, - 0xe4, 0x09, 0xce, 0x09, 0x2e, 0xca, 0x48, 0x6d, 0x71, 0x1b, 0x5a, 0xa5, 0x01, 0x3c, 0x41, 0x5b, - 0x0c, 0x01, 0xc8, 0xf0, 0xbd, 0x58, 0xe3, 0x90, 0xc7, 0x66, 0xbb, 0xc2, 0xaf, 0x12, 0xae, 0x96, - 0x05, 0x9d, 0x8b, 0x94, 0xf4, 0xab, 0xae, 0xdc, 0x03, 0x8b, 0xcf, 0x8b, 0xac, 0xaf, 0x0a, 0xc6, - 0xb6, 0x81, 0x75, 0xd5, 0x0f, 0x76, 0x1c, 0xb4, 0xfe, 0xe2, 0xa0, 0xf3, 0x12, 0xba, 0x55, 0x7e, - 0x77, 0x4c, 0x31, 0xae, 0x31, 0x45, 0xdd, 0x57, 0x6b, 0x82, 0xf3, 0x0c, 0x2c, 0x95, 0xdd, 0x7d, - 0x95, 0x9c, 0x09, 0x98, 0xf5, 0x5c, 0xec, 0xbd, 0xe7, 0x29, 0x74, 0xab, 0xf8, 0xff, 0xc3, 0x96, - 0x9e, 0x36, 0x09, 0x7c, 0xa6, 0xea, 0x09, 0x95, 0xdb, 0xfa, 0x6e, 0xf9, 0x5b, 0x71, 0xcf, 0xf8, - 0x6f, 0x45, 0x6d, 0xf1, 0xc0, 0x52, 0x23, 0xb1, 0xcf, 0x86, 0xe9, 0xe1, 0xe6, 0xfb, 0xf0, 0x60, - 0xf3, 0x63, 0x68, 0x7c, 0xe1, 0xcf, 0x37, 0xfe, 0x7c, 0xfa, 0x39, 0x3c, 0xf8, 0x1d, 0x00, 0x00, - 0xff, 0xff, 0xed, 0x08, 0xa3, 0x5b, 0x39, 0x05, 0x00, 0x00, +func init() { proto.RegisterFile("plan.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 599 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xdd, 0x6e, 0xd3, 0x4c, + 0x10, 0x55, 0xdc, 0x34, 0xb1, 0x27, 0xf9, 0xfa, 0x95, 0x15, 0x42, 0xab, 0x5e, 0xa0, 0xc8, 0x20, + 0x94, 0x82, 0x64, 0xab, 0x2d, 0xbc, 0x00, 0x08, 0x51, 0x8a, 0x00, 0x6b, 0x2b, 0xc4, 0x25, 0xf2, + 0xcf, 0xd4, 0x76, 0xb5, 0xd9, 0x75, 0xd6, 0x0e, 0xb4, 0x4f, 0xc2, 0x3b, 0xf1, 0x54, 0x68, 0x77, + 0x6d, 0xc7, 0x50, 0x09, 0x35, 0x77, 0x3b, 0x67, 0xce, 0xfc, 0x78, 0xe6, 0x8c, 0x01, 0x2a, 0x1e, + 0x8b, 0xa0, 0x52, 0xb2, 0x91, 0x64, 0xac, 0xdf, 0x47, 0xc7, 0x79, 0xd9, 0x14, 0x9b, 0x24, 0x48, + 0xe5, 0x2a, 0x8c, 0x55, 0x9c, 0x65, 0x52, 0x84, 0x6b, 0x9e, 0xa8, 0x32, 0xcb, 0x31, 0x54, 0xc8, + 0xc3, 0x7a, 0xcd, 0x6d, 0xc0, 0xd1, 0x8b, 0x7f, 0x51, 0xf1, 0xa6, 0x52, 0xa1, 0x90, 0x19, 0x5a, + 0xb2, 0xff, 0x6b, 0x0f, 0x26, 0x11, 0x8f, 0x45, 0x94, 0x90, 0x23, 0x70, 0xab, 0x58, 0xc5, 0x9c, + 0x23, 0xa7, 0xa3, 0xc5, 0x68, 0xe9, 0xb2, 0xde, 0x26, 0xcf, 0x60, 0x52, 0x23, 0xc7, 0xb4, 0xa1, + 0x7b, 0x8b, 0xd1, 0x72, 0x76, 0x7a, 0x10, 0x98, 0x0e, 0x2f, 0x0d, 0x16, 0x25, 0xac, 0xf5, 0x1a, + 0x9e, 0xdc, 0xa8, 0x14, 0xe9, 0xf8, 0x0f, 0x9e, 0xc1, 0x0c, 0xcf, 0xbc, 0xc8, 0x13, 0xd8, 0xff, + 0x51, 0xa0, 0x42, 0xba, 0x6f, 0x68, 0xff, 0x59, 0xda, 0x57, 0x0d, 0x45, 0x09, 0xb3, 0x3e, 0x9d, + 0xac, 0x88, 0xbf, 0x97, 0x22, 0xa7, 0x93, 0x61, 0xb2, 0x73, 0x83, 0xe9, 0x64, 0xd6, 0x4b, 0x8e, + 0x61, 0x9a, 0x2b, 0xb9, 0xa9, 0x5e, 0xdf, 0xd2, 0xa9, 0x21, 0xfe, 0x6f, 0x89, 0xef, 0x2c, 0x18, + 0x25, 0xac, 0xf3, 0xeb, 0xba, 0x52, 0x65, 0xa8, 0xa8, 0x3b, 0xac, 0xfb, 0x59, 0x43, 0xba, 0xae, + 0xf1, 0x91, 0x10, 0xbc, 0x6b, 0x59, 0x8a, 0x8f, 0xa8, 0x72, 0xa4, 0x9e, 0x21, 0x3e, 0xb0, 0xc4, + 0x8b, 0x0e, 0x8e, 0x12, 0xb6, 0xe5, 0xe8, 0x06, 0xb4, 0xf1, 0x01, 0x6f, 0x29, 0x0c, 0x1b, 0xb8, + 0xb0, 0xa0, 0x6e, 0xa0, 0xf5, 0x93, 0x13, 0x80, 0x4a, 0xc9, 0x6b, 0x4c, 0x9b, 0x52, 0x0a, 0x3a, + 0x6b, 0x93, 0x2b, 0xe4, 0x41, 0xd4, 0xc3, 0x51, 0xc2, 0x06, 0x24, 0xb2, 0x04, 0x37, 0x2d, 0x4a, + 0x9e, 0x29, 0x14, 0x74, 0xbe, 0xd8, 0x5b, 0xce, 0x4e, 0xe7, 0x36, 0xbd, 0xdd, 0x1b, 0xeb, 0xbd, + 0xfe, 0x37, 0x70, 0xbb, 0x8d, 0x90, 0x65, 0xbf, 0xb1, 0x91, 0x29, 0x72, 0x68, 0x8a, 0x5c, 0xae, + 0xf9, 0x9d, 0x9d, 0x1d, 0xc3, 0x34, 0x95, 0xa2, 0xc1, 0x9b, 0x86, 0x3a, 0xc3, 0xee, 0xdf, 0x58, + 0x50, 0x77, 0xdf, 0xfa, 0xfd, 0x2f, 0xe0, 0xf5, 0x28, 0x79, 0x04, 0x93, 0x3a, 0x2d, 0x70, 0x15, + 0x9b, 0x0a, 0x1e, 0x6b, 0x2d, 0x72, 0x00, 0x4e, 0x99, 0x99, 0x54, 0x63, 0xe6, 0x94, 0x19, 0x59, + 0xc0, 0xec, 0xaa, 0x14, 0x39, 0xaa, 0x4a, 0x95, 0xc2, 0x0a, 0x68, 0xcc, 0x86, 0x90, 0xff, 0xd3, + 0x01, 0xb7, 0x93, 0x08, 0x79, 0x0e, 0x87, 0x02, 0x31, 0xab, 0xcf, 0xe3, 0xba, 0x88, 0x13, 0x8e, + 0x7a, 0xaa, 0x8e, 0x91, 0xe3, 0x1d, 0x9c, 0x3c, 0x84, 0xfd, 0xab, 0x52, 0xc4, 0xdc, 0x24, 0x75, + 0x99, 0x35, 0xb4, 0x90, 0x53, 0xb9, 0xaa, 0x38, 0x36, 0x56, 0x86, 0x2e, 0xeb, 0x6d, 0x42, 0x60, + 0xac, 0x57, 0x61, 0x74, 0xe7, 0x32, 0xf3, 0x26, 0x8f, 0x01, 0xac, 0x2c, 0xdf, 0xde, 0x60, 0x6a, + 0xb4, 0xe6, 0xb2, 0x01, 0xa2, 0x3f, 0x34, 0xdd, 0xd4, 0x8d, 0x5c, 0x19, 0x79, 0xcd, 0x59, 0x6b, + 0x91, 0x00, 0xbc, 0x7a, 0xcd, 0x6d, 0xe3, 0xad, 0xa0, 0xb6, 0x53, 0xee, 0x14, 0xbf, 0xa5, 0xfc, + 0xb5, 0x7b, 0xef, 0x1e, 0xbb, 0xf7, 0xdf, 0xc3, 0xb4, 0x3d, 0x8a, 0x1d, 0x16, 0xda, 0x4f, 0xc5, + 0x19, 0x4c, 0xc5, 0x7f, 0x05, 0x5e, 0x7f, 0x10, 0xf7, 0x4f, 0xe6, 0xbf, 0x04, 0xb7, 0x3b, 0xb8, + 0x1d, 0xa2, 0xce, 0x60, 0xda, 0x1e, 0xd5, 0x4e, 0x41, 0xb3, 0xc1, 0x81, 0x91, 0xa7, 0xfd, 0xf9, + 0xdb, 0xc0, 0x79, 0xa0, 0x7f, 0x5e, 0xc1, 0x27, 0x99, 0xe1, 0xf6, 0xf8, 0xfd, 0x13, 0xf0, 0xfa, + 0x33, 0xbb, 0x5f, 0x48, 0x32, 0x31, 0xbf, 0xbe, 0xb3, 0xdf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3c, + 0xd3, 0x6c, 0xd0, 0x66, 0x05, 0x00, 0x00, } diff --git a/plan/plan.proto b/plan/plan.proto index 1829822e..1f85c499 100644 --- a/plan/plan.proto +++ b/plan/plan.proto @@ -1,86 +1,80 @@ -syntax = "proto2"; +syntax = "proto3"; package plan; +// protoc --proto_path=$GOPATH/src:. --go_out=. *.proto -// protoc --proto_path=$GOPATH/src:$GOPATH/src/github.com/gogo/protobuf/protobuf:. --gofast_out=. plan.proto - -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; import "github.com/araddon/qlbridge/rel/sql.proto"; import "github.com/araddon/qlbridge/expr/node.proto"; //import "github.com/araddon/qlbridge/schema/schema.proto"; -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; -option (gogoproto.goproto_getters_all) = false; -// The generic Node, must be exactly one of these types +// Plan must be exactly one type of plan message PlanPb { - required bool parallel = 1 [(gogoproto.nullable) = false]; - optional SelectPb select = 3 [(gogoproto.nullable) = true]; - optional SourcePb source = 4 [(gogoproto.nullable) = true]; - optional WherePb where = 5 [(gogoproto.nullable) = true]; - optional HavingPb having = 6 [(gogoproto.nullable) = true]; - optional GroupByPb groupBy = 7 [(gogoproto.nullable) = true]; - optional OrderPb order = 8 [(gogoproto.nullable) = true]; - optional JoinMergePb joinMerge = 9 [(gogoproto.nullable) = true]; - optional JoinKeyPb joinKey = 10 [(gogoproto.nullable) = true]; - optional rel.ProjectionPb projection = 11 [(gogoproto.nullable) = true]; - repeated PlanPb children = 12 [(gogoproto.nullable) = true]; + bool parallel = 1; + SelectPb select = 3; + SourcePb source = 4; + WherePb where = 5; + HavingPb having = 6; + GroupByPb groupBy = 7; + OrderPb order = 8; + JoinMergePb joinMerge = 9; + JoinKeyPb joinKey = 10; + rel.ProjectionPb projection = 11; + repeated PlanPb children = 12; } // Select Plan message SelectPb { - required rel.SqlSelectPb select = 1 [(gogoproto.nullable) = true]; - optional ContextPb context = 2 [(gogoproto.nullable) = true]; + rel.SqlSelectPb select = 1; + ContextPb context = 2; } // Context message ContextPb { - required string schema = 1 [(gogoproto.nullable) = false]; - required uint64 id = 2 [(gogoproto.nullable) = false]; - required uint64 fingerprint = 3 [(gogoproto.nullable) = false]; + string schema = 1; + uint64 id = 2; + uint64 fingerprint = 3; } // Source Plan is a plan for single source of select query, of which // many may exist (joins, sub-querys etc) message SourcePb { // do we need group-by, join, partition key for routing purposes? - required bool needsHashableKey = 2 [(gogoproto.nullable) = false]; + bool needsHashableKey = 2; // Is this final projection or not? non finals are partial-sub-query types - required bool final = 3 [(gogoproto.nullable) = false]; + bool final = 3; // Is this plan complete as is? skip remaining plan walk steps - required bool complete = 4 [(gogoproto.nullable) = false]; - required bool join = 5 [(gogoproto.nullable) = false]; - required bool sourceExec = 6 [(gogoproto.nullable) = false]; - optional bytes custom = 7 [(gogoproto.nullable) = true]; - optional rel.SqlSourcePb sqlSource = 8; - optional rel.ProjectionPb projection = 9; + bool complete = 4; + bool join = 5; + bool sourceExec = 6; + bytes custom = 7; + rel.SqlSourcePb sqlSource = 8; + rel.ProjectionPb projection = 9; } // Where Plan message WherePb { - optional rel.SqlSelectPb select = 1 [(gogoproto.nullable) = true]; - required bool final = 2 [(gogoproto.nullable) = false]; + rel.SqlSelectPb select = 1; + bool final = 2; } // Group By Plan message GroupByPb { - optional rel.SqlSelectPb select = 1 [(gogoproto.nullable) = true]; + rel.SqlSelectPb select = 1; } message HavingPb { - optional rel.SqlSelectPb select = 1 [(gogoproto.nullable) = true]; + rel.SqlSelectPb select = 1; } message OrderPb { - optional rel.SqlSelectPb select = 1 [(gogoproto.nullable) = true]; + rel.SqlSelectPb select = 1; } message JoinMergePb { - optional expr.NodePb having = 1 [(gogoproto.nullable) = true]; + expr.NodePb having = 1; } message JoinKeyPb { - optional expr.NodePb having = 1 [(gogoproto.nullable) = true]; + expr.NodePb having = 1; } \ No newline at end of file diff --git a/rel/parse_sql_test.go b/rel/parse_sql_test.go index ebec9b98..004582c1 100644 --- a/rel/parse_sql_test.go +++ b/rel/parse_sql_test.go @@ -5,6 +5,7 @@ import ( "testing" u "github.com/araddon/gou" + "github.com/gogo/protobuf/proto" "github.com/stretchr/testify/assert" "github.com/araddon/qlbridge/expr" @@ -32,7 +33,7 @@ func parseSqlTest(t *testing.T, sql string) { _, err2 := rel.ParseSqlSelect(sql) assert.Equal(t, nil, err2) pb := ss.ToPbStatement() - pbb, err := pb.Marshal() + pbb, err := proto.Marshal(pb) assert.Equal(t, nil, err) ss2, err := rel.SqlFromPb(pbb) assert.Equal(t, nil, err) diff --git a/rel/sql.go b/rel/sql.go index 881cb175..f07bf4da 100644 --- a/rel/sql.go +++ b/rel/sql.go @@ -457,12 +457,8 @@ func resultColumnToPb(m *ResultColumn) *ResultColumnPb { if m.Col != nil { s.Column = m.Col.ToPB() } - if m.Final { - s.Final = &m.Final - } - if m.Star { - s.Star = &m.Star - } + s.Final = m.Final + s.Star = m.Star s.Name = m.Name s.ColPos = int32(m.ColPos) s.As = m.As @@ -847,31 +843,19 @@ func (m *Column) ToPB() *ColumnPb { n := ColumnPb{} n.SourceQuote = []byte{m.sourceQuoteByte} n.AsQuoteByte = []byte{m.asQuoteByte} - if len(m.originalAs) > 0 { - n.OriginalAs = &m.originalAs - } - if len(m.left) > 0 { - n.Left = &m.left - } - if len(m.right) > 0 { - n.Right = &m.right - } + n.OriginalAs = m.originalAs + n.Left = m.left + n.Right = m.right n.ParentIndex = int32(m.ParentIndex) n.Index = int32(m.Index) n.SourceIndex = int32(m.SourceIndex) if len(m.SourceField) > 0 { - n.SourceField = &m.SourceField + n.SourceField = m.SourceField } n.As = m.As - if len(m.Comment) > 0 { - n.Comment = &m.Comment - } - if len(m.Order) > 0 { - n.Order = &m.Order - } - if m.Star { - n.Star = &m.Star - } + n.Comment = m.Comment + n.Order = m.Order + n.Star = m.Star if m.Expr != nil { n.Expr = m.Expr.NodePb() } @@ -959,9 +943,7 @@ func sqlSelectToPbDepth(m *SqlSelect, depth int) *SqlSelectPb { s.IsAgg = m.isAgg s.Finalized = m.finalized s.Schemaqry = m.schemaqry - if len(m.Alias) > 0 { - s.Alias = &m.Alias - } + s.Alias = m.Alias if m.Where != nil { s.Where = SqlWhereToPb(m.Where) } @@ -995,7 +977,7 @@ func sqlSelectToPbDepth(m *SqlSelect, depth int) *SqlSelectPb { } } if m.Into != nil { - s.Into = &m.Into.Table + s.Into = m.Into.Table } return &s } @@ -1105,7 +1087,7 @@ func SqlSelectFromPb(pb *SqlSelectPb) *SqlSelect { finalized: pb.GetFinalized(), schemaqry: pb.GetSchemaqry(), } - if pb.Into != nil { + if pb.Into != "" { ss.Into = &SqlInto{pb.GetInto()} } if pb.Where != nil { @@ -1634,11 +1616,11 @@ func sqlSourceToPb(m *SqlSource) *SqlSourcePb { s.LeftOrRight = int32(m.LeftOrRight) s.JoinType = int32(m.JoinType) if len(m.alias) > 0 { - s.AliasInner = &m.alias + s.AliasInner = m.alias } - kvs := make([]KvInt, 0, len(m.colIndex)) + kvs := make([]*KvInt, 0, len(m.colIndex)) for k, v := range m.colIndex { - kvs = append(kvs, KvInt{K: k, V: int32(v)}) + kvs = append(kvs, &KvInt{K: k, V: int32(v)}) } s.ColIndex = kvs if len(m.joinNodes) > 0 { @@ -2000,7 +1982,7 @@ func statementFromPb(s *SqlStatementPb) SqlStatement { } return nil } -func MapIntFromPb(kv []KvInt) map[string]int { +func MapIntFromPb(kv []*KvInt) map[string]int { m := make(map[string]int, len(kv)) for _, kv := range kv { m[kv.K] = int(kv.V) diff --git a/rel/sql.pb.go b/rel/sql.pb.go index eaf11bac..06df9eb9 100644 --- a/rel/sql.pb.go +++ b/rel/sql.pb.go @@ -1,23 +1,22 @@ -// Code generated by protoc-gen-gogo. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: sql.proto -// DO NOT EDIT! /* - Package rel is a generated protocol buffer package. - - It is generated from these files: - sql.proto - - It has these top-level messages: - SqlStatementPb - SqlSelectPb - SqlSourcePb - SqlWherePb - ProjectionPb - ResultColumnPb - KvInt - ColumnPb - CommandColumnPb +Package rel is a generated protocol buffer package. + +It is generated from these files: + sql.proto + +It has these top-level messages: + SqlStatementPb + SqlSelectPb + SqlSourcePb + SqlWherePb + ProjectionPb + ResultColumnPb + KvInt + ColumnPb + CommandColumnPb */ package rel @@ -25,10 +24,6 @@ import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import expr "github.com/araddon/qlbridge/expr" -import _ "github.com/gogo/protobuf/gogoproto" - -import io "io" -import github_com_golang_protobuf_proto "github.com/golang/protobuf/proto" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -37,20 +32,21 @@ var _ = math.Inf // This is a compile-time assertion to ensure that this generated file // is compatible with the proto package it is being compiled against. -const _ = proto.ProtoPackageIsVersion1 +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // The generic SqlStatement, must be exactly one of these types type SqlStatementPb struct { - Select *SqlSelectPb `protobuf:"bytes,1,opt,name=select" json:"select,omitempty"` - Source *SqlSourcePb `protobuf:"bytes,2,opt,name=source" json:"source,omitempty"` - Projection *ProjectionPb `protobuf:"bytes,4,opt,name=projection" json:"projection,omitempty"` - XXX_unrecognized []byte `json:"-"` + Select *SqlSelectPb `protobuf:"bytes,1,opt,name=select" json:"select,omitempty"` + Source *SqlSourcePb `protobuf:"bytes,2,opt,name=source" json:"source,omitempty"` + Projection *ProjectionPb `protobuf:"bytes,4,opt,name=projection" json:"projection,omitempty"` } func (m *SqlStatementPb) Reset() { *m = SqlStatementPb{} } func (m *SqlStatementPb) String() string { return proto.CompactTextString(m) } func (*SqlStatementPb) ProtoMessage() {} -func (*SqlStatementPb) Descriptor() ([]byte, []int) { return fileDescriptorSql, []int{0} } +func (*SqlStatementPb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } func (m *SqlStatementPb) GetSelect() *SqlSelectPb { if m != nil { @@ -74,32 +70,31 @@ func (m *SqlStatementPb) GetProjection() *ProjectionPb { } type SqlSelectPb struct { - Db string `protobuf:"bytes,1,req,name=db" json:"db"` - Raw string `protobuf:"bytes,2,req,name=raw" json:"raw"` - Star bool `protobuf:"varint,3,req,name=star" json:"star"` - Distinct bool `protobuf:"varint,4,req,name=distinct" json:"distinct"` - Columns []*ColumnPb `protobuf:"bytes,5,rep,name=columns" json:"columns,omitempty"` - From []*SqlSourcePb `protobuf:"bytes,6,rep,name=from" json:"from,omitempty"` - Into *string `protobuf:"bytes,7,opt,name=into" json:"into,omitempty"` - Where *SqlWherePb `protobuf:"bytes,8,opt,name=where" json:"where,omitempty"` - Having *expr.NodePb `protobuf:"bytes,9,opt,name=having" json:"having,omitempty"` - GroupBy []*ColumnPb `protobuf:"bytes,11,rep,name=groupBy" json:"groupBy,omitempty"` - OrderBy []*ColumnPb `protobuf:"bytes,10,rep,name=orderBy" json:"orderBy,omitempty"` - Limit int32 `protobuf:"varint,12,opt,name=limit" json:"limit"` - Offset int32 `protobuf:"varint,13,opt,name=offset" json:"offset"` - Alias *string `protobuf:"bytes,14,opt,name=alias" json:"alias,omitempty"` - Projection *ProjectionPb `protobuf:"bytes,15,opt,name=projection" json:"projection,omitempty"` - IsAgg bool `protobuf:"varint,16,req,name=isAgg" json:"isAgg"` - Finalized bool `protobuf:"varint,17,req,name=finalized" json:"finalized"` - Schemaqry bool `protobuf:"varint,18,req,name=schemaqry" json:"schemaqry"` - With []byte `protobuf:"bytes,19,opt,name=with" json:"with,omitempty"` - XXX_unrecognized []byte `json:"-"` + Db string `protobuf:"bytes,1,opt,name=db" json:"db,omitempty"` + Raw string `protobuf:"bytes,2,opt,name=raw" json:"raw,omitempty"` + Star bool `protobuf:"varint,3,opt,name=star" json:"star,omitempty"` + Distinct bool `protobuf:"varint,4,opt,name=distinct" json:"distinct,omitempty"` + Columns []*ColumnPb `protobuf:"bytes,5,rep,name=columns" json:"columns,omitempty"` + From []*SqlSourcePb `protobuf:"bytes,6,rep,name=from" json:"from,omitempty"` + Into string `protobuf:"bytes,7,opt,name=into" json:"into,omitempty"` + Where *SqlWherePb `protobuf:"bytes,8,opt,name=where" json:"where,omitempty"` + Having *expr.NodePb `protobuf:"bytes,9,opt,name=having" json:"having,omitempty"` + GroupBy []*ColumnPb `protobuf:"bytes,10,rep,name=groupBy" json:"groupBy,omitempty"` + OrderBy []*ColumnPb `protobuf:"bytes,11,rep,name=orderBy" json:"orderBy,omitempty"` + Limit int32 `protobuf:"varint,12,opt,name=limit" json:"limit,omitempty"` + Offset int32 `protobuf:"varint,13,opt,name=offset" json:"offset,omitempty"` + Alias string `protobuf:"bytes,14,opt,name=alias" json:"alias,omitempty"` + Projection *ProjectionPb `protobuf:"bytes,15,opt,name=projection" json:"projection,omitempty"` + IsAgg bool `protobuf:"varint,16,opt,name=isAgg" json:"isAgg,omitempty"` + Finalized bool `protobuf:"varint,17,opt,name=finalized" json:"finalized,omitempty"` + Schemaqry bool `protobuf:"varint,18,opt,name=schemaqry" json:"schemaqry,omitempty"` + With []byte `protobuf:"bytes,19,opt,name=with,proto3" json:"with,omitempty"` } func (m *SqlSelectPb) Reset() { *m = SqlSelectPb{} } func (m *SqlSelectPb) String() string { return proto.CompactTextString(m) } func (*SqlSelectPb) ProtoMessage() {} -func (*SqlSelectPb) Descriptor() ([]byte, []int) { return fileDescriptorSql, []int{1} } +func (*SqlSelectPb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } func (m *SqlSelectPb) GetDb() string { if m != nil { @@ -144,8 +139,8 @@ func (m *SqlSelectPb) GetFrom() []*SqlSourcePb { } func (m *SqlSelectPb) GetInto() string { - if m != nil && m.Into != nil { - return *m.Into + if m != nil { + return m.Into } return "" } @@ -193,8 +188,8 @@ func (m *SqlSelectPb) GetOffset() int32 { } func (m *SqlSelectPb) GetAlias() string { - if m != nil && m.Alias != nil { - return *m.Alias + if m != nil { + return m.Alias } return "" } @@ -235,28 +230,27 @@ func (m *SqlSelectPb) GetWith() []byte { } type SqlSourcePb struct { - Final bool `protobuf:"varint,1,opt,name=final" json:"final"` - AliasInner *string `protobuf:"bytes,2,opt,name=aliasInner" json:"aliasInner,omitempty"` - Columns []*ColumnPb `protobuf:"bytes,3,rep,name=columns" json:"columns,omitempty"` - ColIndex []KvInt `protobuf:"bytes,4,rep,name=colIndex" json:"colIndex"` - JoinNodes []*expr.NodePb `protobuf:"bytes,5,rep,name=joinNodes" json:"joinNodes,omitempty"` - Source *SqlSelectPb `protobuf:"bytes,6,opt,name=source" json:"source,omitempty"` - Raw string `protobuf:"bytes,7,opt,name=raw" json:"raw"` - Name string `protobuf:"bytes,8,opt,name=name" json:"name"` - Alias string `protobuf:"bytes,9,opt,name=alias" json:"alias"` - Op int32 `protobuf:"varint,10,req,name=op" json:"op"` - LeftOrRight int32 `protobuf:"varint,11,req,name=leftOrRight" json:"leftOrRight"` - JoinType int32 `protobuf:"varint,12,req,name=joinType" json:"joinType"` - JoinExpr *expr.NodePb `protobuf:"bytes,13,opt,name=joinExpr" json:"joinExpr,omitempty"` - SubQuery *SqlSelectPb `protobuf:"bytes,14,opt,name=subQuery" json:"subQuery,omitempty"` - Seekable bool `protobuf:"varint,15,opt,name=seekable" json:"seekable"` - XXX_unrecognized []byte `json:"-"` + Final bool `protobuf:"varint,1,opt,name=final" json:"final,omitempty"` + AliasInner string `protobuf:"bytes,2,opt,name=aliasInner" json:"aliasInner,omitempty"` + Columns []*ColumnPb `protobuf:"bytes,3,rep,name=columns" json:"columns,omitempty"` + ColIndex []*KvInt `protobuf:"bytes,4,rep,name=colIndex" json:"colIndex,omitempty"` + JoinNodes []*expr.NodePb `protobuf:"bytes,5,rep,name=joinNodes" json:"joinNodes,omitempty"` + Source *SqlSelectPb `protobuf:"bytes,6,opt,name=source" json:"source,omitempty"` + Raw string `protobuf:"bytes,7,opt,name=raw" json:"raw,omitempty"` + Name string `protobuf:"bytes,8,opt,name=name" json:"name,omitempty"` + Alias string `protobuf:"bytes,9,opt,name=alias" json:"alias,omitempty"` + Op int32 `protobuf:"varint,10,opt,name=op" json:"op,omitempty"` + LeftOrRight int32 `protobuf:"varint,11,opt,name=leftOrRight" json:"leftOrRight,omitempty"` + JoinType int32 `protobuf:"varint,12,opt,name=joinType" json:"joinType,omitempty"` + JoinExpr *expr.NodePb `protobuf:"bytes,13,opt,name=joinExpr" json:"joinExpr,omitempty"` + SubQuery *SqlSelectPb `protobuf:"bytes,14,opt,name=subQuery" json:"subQuery,omitempty"` + Seekable bool `protobuf:"varint,15,opt,name=seekable" json:"seekable,omitempty"` } func (m *SqlSourcePb) Reset() { *m = SqlSourcePb{} } func (m *SqlSourcePb) String() string { return proto.CompactTextString(m) } func (*SqlSourcePb) ProtoMessage() {} -func (*SqlSourcePb) Descriptor() ([]byte, []int) { return fileDescriptorSql, []int{2} } +func (*SqlSourcePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } func (m *SqlSourcePb) GetFinal() bool { if m != nil { @@ -266,8 +260,8 @@ func (m *SqlSourcePb) GetFinal() bool { } func (m *SqlSourcePb) GetAliasInner() string { - if m != nil && m.AliasInner != nil { - return *m.AliasInner + if m != nil { + return m.AliasInner } return "" } @@ -279,7 +273,7 @@ func (m *SqlSourcePb) GetColumns() []*ColumnPb { return nil } -func (m *SqlSourcePb) GetColIndex() []KvInt { +func (m *SqlSourcePb) GetColIndex() []*KvInt { if m != nil { return m.ColIndex } @@ -364,16 +358,15 @@ func (m *SqlSourcePb) GetSeekable() bool { } type SqlWherePb struct { - Op int32 `protobuf:"varint,1,req,name=op" json:"op"` - Source *SqlSelectPb `protobuf:"bytes,2,opt,name=source" json:"source,omitempty"` - Expr *expr.NodePb `protobuf:"bytes,3,opt,name=Expr,json=expr" json:"Expr,omitempty"` - XXX_unrecognized []byte `json:"-"` + Op int32 `protobuf:"varint,1,opt,name=op" json:"op,omitempty"` + Source *SqlSelectPb `protobuf:"bytes,2,opt,name=source" json:"source,omitempty"` + Expr *expr.NodePb `protobuf:"bytes,3,opt,name=Expr" json:"Expr,omitempty"` } func (m *SqlWherePb) Reset() { *m = SqlWherePb{} } func (m *SqlWherePb) String() string { return proto.CompactTextString(m) } func (*SqlWherePb) ProtoMessage() {} -func (*SqlWherePb) Descriptor() ([]byte, []int) { return fileDescriptorSql, []int{3} } +func (*SqlWherePb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } func (m *SqlWherePb) GetOp() int32 { if m != nil { @@ -397,17 +390,16 @@ func (m *SqlWherePb) GetExpr() *expr.NodePb { } type ProjectionPb struct { - Distinct bool `protobuf:"varint,1,req,name=distinct" json:"distinct"` - Final bool `protobuf:"varint,2,req,name=final" json:"final"` - ColNames []string `protobuf:"bytes,3,rep,name=colNames" json:"colNames,omitempty"` - Columns []*ResultColumnPb `protobuf:"bytes,4,rep,name=columns" json:"columns,omitempty"` - XXX_unrecognized []byte `json:"-"` + Distinct bool `protobuf:"varint,1,opt,name=distinct" json:"distinct,omitempty"` + Final bool `protobuf:"varint,2,opt,name=final" json:"final,omitempty"` + ColNames []string `protobuf:"bytes,3,rep,name=colNames" json:"colNames,omitempty"` + Columns []*ResultColumnPb `protobuf:"bytes,4,rep,name=columns" json:"columns,omitempty"` } func (m *ProjectionPb) Reset() { *m = ProjectionPb{} } func (m *ProjectionPb) String() string { return proto.CompactTextString(m) } func (*ProjectionPb) ProtoMessage() {} -func (*ProjectionPb) Descriptor() ([]byte, []int) { return fileDescriptorSql, []int{4} } +func (*ProjectionPb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } func (m *ProjectionPb) GetDistinct() bool { if m != nil { @@ -438,24 +430,23 @@ func (m *ProjectionPb) GetColumns() []*ResultColumnPb { } type ResultColumnPb struct { - Final *bool `protobuf:"varint,1,opt,name=final" json:"final,omitempty"` - Name string `protobuf:"bytes,2,req,name=name" json:"name"` - ColPos int32 `protobuf:"varint,3,req,name=colPos" json:"colPos"` - Column *ColumnPb `protobuf:"bytes,4,opt,name=column" json:"column,omitempty"` - Star *bool `protobuf:"varint,5,opt,name=star" json:"star,omitempty"` - As string `protobuf:"bytes,6,req,name=as" json:"as"` - ValueType int32 `protobuf:"varint,7,req,name=valueType" json:"valueType"` - XXX_unrecognized []byte `json:"-"` + Final bool `protobuf:"varint,1,opt,name=final" json:"final,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` + ColPos int32 `protobuf:"varint,3,opt,name=colPos" json:"colPos,omitempty"` + Column *ColumnPb `protobuf:"bytes,4,opt,name=column" json:"column,omitempty"` + Star bool `protobuf:"varint,5,opt,name=star" json:"star,omitempty"` + As string `protobuf:"bytes,6,opt,name=as" json:"as,omitempty"` + ValueType int32 `protobuf:"varint,7,opt,name=valueType" json:"valueType,omitempty"` } func (m *ResultColumnPb) Reset() { *m = ResultColumnPb{} } func (m *ResultColumnPb) String() string { return proto.CompactTextString(m) } func (*ResultColumnPb) ProtoMessage() {} -func (*ResultColumnPb) Descriptor() ([]byte, []int) { return fileDescriptorSql, []int{5} } +func (*ResultColumnPb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } func (m *ResultColumnPb) GetFinal() bool { - if m != nil && m.Final != nil { - return *m.Final + if m != nil { + return m.Final } return false } @@ -482,8 +473,8 @@ func (m *ResultColumnPb) GetColumn() *ColumnPb { } func (m *ResultColumnPb) GetStar() bool { - if m != nil && m.Star != nil { - return *m.Star + if m != nil { + return m.Star } return false } @@ -503,15 +494,14 @@ func (m *ResultColumnPb) GetValueType() int32 { } type KvInt struct { - K string `protobuf:"bytes,1,req,name=k" json:"k"` - V int32 `protobuf:"varint,2,req,name=v" json:"v"` - XXX_unrecognized []byte `json:"-"` + K string `protobuf:"bytes,1,opt,name=k" json:"k,omitempty"` + V int32 `protobuf:"varint,2,opt,name=v" json:"v,omitempty"` } func (m *KvInt) Reset() { *m = KvInt{} } func (m *KvInt) String() string { return proto.CompactTextString(m) } func (*KvInt) ProtoMessage() {} -func (*KvInt) Descriptor() ([]byte, []int) { return fileDescriptorSql, []int{6} } +func (*KvInt) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } func (m *KvInt) GetK() string { if m != nil { @@ -528,29 +518,28 @@ func (m *KvInt) GetV() int32 { } type ColumnPb struct { - SourceQuote []byte `protobuf:"bytes,1,opt,name=sourceQuote" json:"sourceQuote,omitempty"` - AsQuoteByte []byte `protobuf:"bytes,2,opt,name=asQuoteByte" json:"asQuoteByte,omitempty"` - OriginalAs *string `protobuf:"bytes,3,opt,name=originalAs" json:"originalAs,omitempty"` - Left *string `protobuf:"bytes,4,opt,name=left" json:"left,omitempty"` - Right *string `protobuf:"bytes,5,opt,name=right" json:"right,omitempty"` - ParentIndex int32 `protobuf:"varint,6,opt,name=parentIndex" json:"parentIndex"` - Index int32 `protobuf:"varint,7,opt,name=index" json:"index"` - SourceIndex int32 `protobuf:"varint,8,opt,name=sourceIndex" json:"sourceIndex"` - SourceField *string `protobuf:"bytes,9,opt,name=sourceField" json:"sourceField,omitempty"` - As string `protobuf:"bytes,11,opt,name=as" json:"as"` - Comment *string `protobuf:"bytes,12,opt,name=comment" json:"comment,omitempty"` - Order *string `protobuf:"bytes,13,opt,name=order" json:"order,omitempty"` - Star *bool `protobuf:"varint,14,opt,name=star" json:"star,omitempty"` - Agg bool `protobuf:"varint,15,opt,name=agg" json:"agg"` - Expr *expr.NodePb `protobuf:"bytes,16,opt,name=Expr,json=expr" json:"Expr,omitempty"` - Guard *expr.NodePb `protobuf:"bytes,17,opt,name=Guard,json=guard" json:"Guard,omitempty"` - XXX_unrecognized []byte `json:"-"` + SourceQuote []byte `protobuf:"bytes,1,opt,name=sourceQuote,proto3" json:"sourceQuote,omitempty"` + AsQuoteByte []byte `protobuf:"bytes,2,opt,name=asQuoteByte,proto3" json:"asQuoteByte,omitempty"` + OriginalAs string `protobuf:"bytes,3,opt,name=originalAs" json:"originalAs,omitempty"` + Left string `protobuf:"bytes,4,opt,name=left" json:"left,omitempty"` + Right string `protobuf:"bytes,5,opt,name=right" json:"right,omitempty"` + ParentIndex int32 `protobuf:"varint,6,opt,name=parentIndex" json:"parentIndex,omitempty"` + Index int32 `protobuf:"varint,7,opt,name=index" json:"index,omitempty"` + SourceIndex int32 `protobuf:"varint,8,opt,name=sourceIndex" json:"sourceIndex,omitempty"` + SourceField string `protobuf:"bytes,9,opt,name=sourceField" json:"sourceField,omitempty"` + As string `protobuf:"bytes,11,opt,name=as" json:"as,omitempty"` + Comment string `protobuf:"bytes,12,opt,name=comment" json:"comment,omitempty"` + Order string `protobuf:"bytes,13,opt,name=order" json:"order,omitempty"` + Star bool `protobuf:"varint,14,opt,name=star" json:"star,omitempty"` + Agg bool `protobuf:"varint,15,opt,name=agg" json:"agg,omitempty"` + Expr *expr.NodePb `protobuf:"bytes,16,opt,name=Expr" json:"Expr,omitempty"` + Guard *expr.NodePb `protobuf:"bytes,17,opt,name=Guard" json:"Guard,omitempty"` } func (m *ColumnPb) Reset() { *m = ColumnPb{} } func (m *ColumnPb) String() string { return proto.CompactTextString(m) } func (*ColumnPb) ProtoMessage() {} -func (*ColumnPb) Descriptor() ([]byte, []int) { return fileDescriptorSql, []int{7} } +func (*ColumnPb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } func (m *ColumnPb) GetSourceQuote() []byte { if m != nil { @@ -567,22 +556,22 @@ func (m *ColumnPb) GetAsQuoteByte() []byte { } func (m *ColumnPb) GetOriginalAs() string { - if m != nil && m.OriginalAs != nil { - return *m.OriginalAs + if m != nil { + return m.OriginalAs } return "" } func (m *ColumnPb) GetLeft() string { - if m != nil && m.Left != nil { - return *m.Left + if m != nil { + return m.Left } return "" } func (m *ColumnPb) GetRight() string { - if m != nil && m.Right != nil { - return *m.Right + if m != nil { + return m.Right } return "" } @@ -609,8 +598,8 @@ func (m *ColumnPb) GetSourceIndex() int32 { } func (m *ColumnPb) GetSourceField() string { - if m != nil && m.SourceField != nil { - return *m.SourceField + if m != nil { + return m.SourceField } return "" } @@ -623,22 +612,22 @@ func (m *ColumnPb) GetAs() string { } func (m *ColumnPb) GetComment() string { - if m != nil && m.Comment != nil { - return *m.Comment + if m != nil { + return m.Comment } return "" } func (m *ColumnPb) GetOrder() string { - if m != nil && m.Order != nil { - return *m.Order + if m != nil { + return m.Order } return "" } func (m *ColumnPb) GetStar() bool { - if m != nil && m.Star != nil { - return *m.Star + if m != nil { + return m.Star } return false } @@ -665,15 +654,14 @@ func (m *ColumnPb) GetGuard() *expr.NodePb { } type CommandColumnPb struct { - Expr *expr.NodePb `protobuf:"bytes,1,opt,name=Expr,json=expr" json:"Expr,omitempty"` - Name string `protobuf:"bytes,2,req,name=name" json:"name"` - XXX_unrecognized []byte `json:"-"` + Expr *expr.NodePb `protobuf:"bytes,1,opt,name=Expr" json:"Expr,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` } func (m *CommandColumnPb) Reset() { *m = CommandColumnPb{} } func (m *CommandColumnPb) String() string { return proto.CompactTextString(m) } func (*CommandColumnPb) ProtoMessage() {} -func (*CommandColumnPb) Descriptor() ([]byte, []int) { return fileDescriptorSql, []int{8} } +func (*CommandColumnPb) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } func (m *CommandColumnPb) GetExpr() *expr.NodePb { if m != nil { @@ -700,3694 +688,70 @@ func init() { proto.RegisterType((*ColumnPb)(nil), "rel.ColumnPb") proto.RegisterType((*CommandColumnPb)(nil), "rel.CommandColumnPb") } -func (m *SqlStatementPb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *SqlStatementPb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Select != nil { - data[i] = 0xa - i++ - i = encodeVarintSql(data, i, uint64(m.Select.Size())) - n1, err := m.Select.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if m.Source != nil { - data[i] = 0x12 - i++ - i = encodeVarintSql(data, i, uint64(m.Source.Size())) - n2, err := m.Source.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if m.Projection != nil { - data[i] = 0x22 - i++ - i = encodeVarintSql(data, i, uint64(m.Projection.Size())) - n3, err := m.Projection.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n3 - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *SqlSelectPb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *SqlSelectPb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0xa - i++ - i = encodeVarintSql(data, i, uint64(len(m.Db))) - i += copy(data[i:], m.Db) - data[i] = 0x12 - i++ - i = encodeVarintSql(data, i, uint64(len(m.Raw))) - i += copy(data[i:], m.Raw) - data[i] = 0x18 - i++ - if m.Star { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - data[i] = 0x20 - i++ - if m.Distinct { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - if len(m.Columns) > 0 { - for _, msg := range m.Columns { - data[i] = 0x2a - i++ - i = encodeVarintSql(data, i, uint64(msg.Size())) - n, err := msg.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.From) > 0 { - for _, msg := range m.From { - data[i] = 0x32 - i++ - i = encodeVarintSql(data, i, uint64(msg.Size())) - n, err := msg.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.Into != nil { - data[i] = 0x3a - i++ - i = encodeVarintSql(data, i, uint64(len(*m.Into))) - i += copy(data[i:], *m.Into) - } - if m.Where != nil { - data[i] = 0x42 - i++ - i = encodeVarintSql(data, i, uint64(m.Where.Size())) - n4, err := m.Where.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n4 - } - if m.Having != nil { - data[i] = 0x4a - i++ - i = encodeVarintSql(data, i, uint64(m.Having.Size())) - n5, err := m.Having.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n5 - } - if len(m.OrderBy) > 0 { - for _, msg := range m.OrderBy { - data[i] = 0x52 - i++ - i = encodeVarintSql(data, i, uint64(msg.Size())) - n, err := msg.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.GroupBy) > 0 { - for _, msg := range m.GroupBy { - data[i] = 0x5a - i++ - i = encodeVarintSql(data, i, uint64(msg.Size())) - n, err := msg.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n - } - } - data[i] = 0x60 - i++ - i = encodeVarintSql(data, i, uint64(m.Limit)) - data[i] = 0x68 - i++ - i = encodeVarintSql(data, i, uint64(m.Offset)) - if m.Alias != nil { - data[i] = 0x72 - i++ - i = encodeVarintSql(data, i, uint64(len(*m.Alias))) - i += copy(data[i:], *m.Alias) - } - if m.Projection != nil { - data[i] = 0x7a - i++ - i = encodeVarintSql(data, i, uint64(m.Projection.Size())) - n6, err := m.Projection.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n6 - } - data[i] = 0x80 - i++ - data[i] = 0x1 - i++ - if m.IsAgg { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - data[i] = 0x88 - i++ - data[i] = 0x1 - i++ - if m.Finalized { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - data[i] = 0x90 - i++ - data[i] = 0x1 - i++ - if m.Schemaqry { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - if m.With != nil { - data[i] = 0x9a - i++ - data[i] = 0x1 - i++ - i = encodeVarintSql(data, i, uint64(len(m.With))) - i += copy(data[i:], m.With) - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *SqlSourcePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *SqlSourcePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0x8 - i++ - if m.Final { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - if m.AliasInner != nil { - data[i] = 0x12 - i++ - i = encodeVarintSql(data, i, uint64(len(*m.AliasInner))) - i += copy(data[i:], *m.AliasInner) - } - if len(m.Columns) > 0 { - for _, msg := range m.Columns { - data[i] = 0x1a - i++ - i = encodeVarintSql(data, i, uint64(msg.Size())) - n, err := msg.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.ColIndex) > 0 { - for _, msg := range m.ColIndex { - data[i] = 0x22 - i++ - i = encodeVarintSql(data, i, uint64(msg.Size())) - n, err := msg.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.JoinNodes) > 0 { - for _, msg := range m.JoinNodes { - data[i] = 0x2a - i++ - i = encodeVarintSql(data, i, uint64(msg.Size())) - n, err := msg.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.Source != nil { - data[i] = 0x32 - i++ - i = encodeVarintSql(data, i, uint64(m.Source.Size())) - n7, err := m.Source.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n7 - } - data[i] = 0x3a - i++ - i = encodeVarintSql(data, i, uint64(len(m.Raw))) - i += copy(data[i:], m.Raw) - data[i] = 0x42 - i++ - i = encodeVarintSql(data, i, uint64(len(m.Name))) - i += copy(data[i:], m.Name) - data[i] = 0x4a - i++ - i = encodeVarintSql(data, i, uint64(len(m.Alias))) - i += copy(data[i:], m.Alias) - data[i] = 0x50 - i++ - i = encodeVarintSql(data, i, uint64(m.Op)) - data[i] = 0x58 - i++ - i = encodeVarintSql(data, i, uint64(m.LeftOrRight)) - data[i] = 0x60 - i++ - i = encodeVarintSql(data, i, uint64(m.JoinType)) - if m.JoinExpr != nil { - data[i] = 0x6a - i++ - i = encodeVarintSql(data, i, uint64(m.JoinExpr.Size())) - n8, err := m.JoinExpr.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n8 - } - if m.SubQuery != nil { - data[i] = 0x72 - i++ - i = encodeVarintSql(data, i, uint64(m.SubQuery.Size())) - n9, err := m.SubQuery.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n9 - } - data[i] = 0x78 - i++ - if m.Seekable { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *SqlWherePb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *SqlWherePb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0x8 - i++ - i = encodeVarintSql(data, i, uint64(m.Op)) - if m.Source != nil { - data[i] = 0x12 - i++ - i = encodeVarintSql(data, i, uint64(m.Source.Size())) - n10, err := m.Source.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n10 - } - if m.Expr != nil { - data[i] = 0x1a - i++ - i = encodeVarintSql(data, i, uint64(m.Expr.Size())) - n11, err := m.Expr.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n11 - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ProjectionPb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *ProjectionPb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0x8 - i++ - if m.Distinct { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - data[i] = 0x10 - i++ - if m.Final { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - if len(m.ColNames) > 0 { - for _, s := range m.ColNames { - data[i] = 0x1a - i++ - l = len(s) - for l >= 1<<7 { - data[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - data[i] = uint8(l) - i++ - i += copy(data[i:], s) - } - } - if len(m.Columns) > 0 { - for _, msg := range m.Columns { - data[i] = 0x22 - i++ - i = encodeVarintSql(data, i, uint64(msg.Size())) - n, err := msg.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ResultColumnPb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *ResultColumnPb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Final != nil { - data[i] = 0x8 - i++ - if *m.Final { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - } - data[i] = 0x12 - i++ - i = encodeVarintSql(data, i, uint64(len(m.Name))) - i += copy(data[i:], m.Name) - data[i] = 0x18 - i++ - i = encodeVarintSql(data, i, uint64(m.ColPos)) - if m.Column != nil { - data[i] = 0x22 - i++ - i = encodeVarintSql(data, i, uint64(m.Column.Size())) - n12, err := m.Column.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n12 - } - if m.Star != nil { - data[i] = 0x28 - i++ - if *m.Star { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - } - data[i] = 0x32 - i++ - i = encodeVarintSql(data, i, uint64(len(m.As))) - i += copy(data[i:], m.As) - data[i] = 0x38 - i++ - i = encodeVarintSql(data, i, uint64(m.ValueType)) - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *KvInt) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *KvInt) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - data[i] = 0xa - i++ - i = encodeVarintSql(data, i, uint64(len(m.K))) - i += copy(data[i:], m.K) - data[i] = 0x10 - i++ - i = encodeVarintSql(data, i, uint64(m.V)) - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ColumnPb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *ColumnPb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.SourceQuote != nil { - data[i] = 0xa - i++ - i = encodeVarintSql(data, i, uint64(len(m.SourceQuote))) - i += copy(data[i:], m.SourceQuote) - } - if m.AsQuoteByte != nil { - data[i] = 0x12 - i++ - i = encodeVarintSql(data, i, uint64(len(m.AsQuoteByte))) - i += copy(data[i:], m.AsQuoteByte) - } - if m.OriginalAs != nil { - data[i] = 0x1a - i++ - i = encodeVarintSql(data, i, uint64(len(*m.OriginalAs))) - i += copy(data[i:], *m.OriginalAs) - } - if m.Left != nil { - data[i] = 0x22 - i++ - i = encodeVarintSql(data, i, uint64(len(*m.Left))) - i += copy(data[i:], *m.Left) - } - if m.Right != nil { - data[i] = 0x2a - i++ - i = encodeVarintSql(data, i, uint64(len(*m.Right))) - i += copy(data[i:], *m.Right) - } - data[i] = 0x30 - i++ - i = encodeVarintSql(data, i, uint64(m.ParentIndex)) - data[i] = 0x38 - i++ - i = encodeVarintSql(data, i, uint64(m.Index)) - data[i] = 0x40 - i++ - i = encodeVarintSql(data, i, uint64(m.SourceIndex)) - if m.SourceField != nil { - data[i] = 0x4a - i++ - i = encodeVarintSql(data, i, uint64(len(*m.SourceField))) - i += copy(data[i:], *m.SourceField) - } - data[i] = 0x5a - i++ - i = encodeVarintSql(data, i, uint64(len(m.As))) - i += copy(data[i:], m.As) - if m.Comment != nil { - data[i] = 0x62 - i++ - i = encodeVarintSql(data, i, uint64(len(*m.Comment))) - i += copy(data[i:], *m.Comment) - } - if m.Order != nil { - data[i] = 0x6a - i++ - i = encodeVarintSql(data, i, uint64(len(*m.Order))) - i += copy(data[i:], *m.Order) - } - if m.Star != nil { - data[i] = 0x70 - i++ - if *m.Star { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - } - data[i] = 0x78 - i++ - if m.Agg { - data[i] = 1 - } else { - data[i] = 0 - } - i++ - if m.Expr != nil { - data[i] = 0x82 - i++ - data[i] = 0x1 - i++ - i = encodeVarintSql(data, i, uint64(m.Expr.Size())) - n13, err := m.Expr.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n13 - } - if m.Guard != nil { - data[i] = 0x8a - i++ - data[i] = 0x1 - i++ - i = encodeVarintSql(data, i, uint64(m.Guard.Size())) - n14, err := m.Guard.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n14 - } - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *CommandColumnPb) Marshal() (data []byte, err error) { - size := m.Size() - data = make([]byte, size) - n, err := m.MarshalTo(data) - if err != nil { - return nil, err - } - return data[:n], nil -} - -func (m *CommandColumnPb) MarshalTo(data []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Expr != nil { - data[i] = 0xa - i++ - i = encodeVarintSql(data, i, uint64(m.Expr.Size())) - n15, err := m.Expr.MarshalTo(data[i:]) - if err != nil { - return 0, err - } - i += n15 - } - data[i] = 0x12 - i++ - i = encodeVarintSql(data, i, uint64(len(m.Name))) - i += copy(data[i:], m.Name) - if m.XXX_unrecognized != nil { - i += copy(data[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeFixed64Sql(data []byte, offset int, v uint64) int { - data[offset] = uint8(v) - data[offset+1] = uint8(v >> 8) - data[offset+2] = uint8(v >> 16) - data[offset+3] = uint8(v >> 24) - data[offset+4] = uint8(v >> 32) - data[offset+5] = uint8(v >> 40) - data[offset+6] = uint8(v >> 48) - data[offset+7] = uint8(v >> 56) - return offset + 8 -} -func encodeFixed32Sql(data []byte, offset int, v uint32) int { - data[offset] = uint8(v) - data[offset+1] = uint8(v >> 8) - data[offset+2] = uint8(v >> 16) - data[offset+3] = uint8(v >> 24) - return offset + 4 -} -func encodeVarintSql(data []byte, offset int, v uint64) int { - for v >= 1<<7 { - data[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - data[offset] = uint8(v) - return offset + 1 -} -func (m *SqlStatementPb) Size() (n int) { - var l int - _ = l - if m.Select != nil { - l = m.Select.Size() - n += 1 + l + sovSql(uint64(l)) - } - if m.Source != nil { - l = m.Source.Size() - n += 1 + l + sovSql(uint64(l)) - } - if m.Projection != nil { - l = m.Projection.Size() - n += 1 + l + sovSql(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SqlSelectPb) Size() (n int) { - var l int - _ = l - l = len(m.Db) - n += 1 + l + sovSql(uint64(l)) - l = len(m.Raw) - n += 1 + l + sovSql(uint64(l)) - n += 2 - n += 2 - if len(m.Columns) > 0 { - for _, e := range m.Columns { - l = e.Size() - n += 1 + l + sovSql(uint64(l)) - } - } - if len(m.From) > 0 { - for _, e := range m.From { - l = e.Size() - n += 1 + l + sovSql(uint64(l)) - } - } - if m.Into != nil { - l = len(*m.Into) - n += 1 + l + sovSql(uint64(l)) - } - if m.Where != nil { - l = m.Where.Size() - n += 1 + l + sovSql(uint64(l)) - } - if m.Having != nil { - l = m.Having.Size() - n += 1 + l + sovSql(uint64(l)) - } - if len(m.OrderBy) > 0 { - for _, e := range m.OrderBy { - l = e.Size() - n += 1 + l + sovSql(uint64(l)) - } - } - if len(m.GroupBy) > 0 { - for _, e := range m.GroupBy { - l = e.Size() - n += 1 + l + sovSql(uint64(l)) - } - } - n += 1 + sovSql(uint64(m.Limit)) - n += 1 + sovSql(uint64(m.Offset)) - if m.Alias != nil { - l = len(*m.Alias) - n += 1 + l + sovSql(uint64(l)) - } - if m.Projection != nil { - l = m.Projection.Size() - n += 1 + l + sovSql(uint64(l)) - } - n += 3 - n += 3 - n += 3 - if m.With != nil { - l = len(m.With) - n += 2 + l + sovSql(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SqlSourcePb) Size() (n int) { - var l int - _ = l - n += 2 - if m.AliasInner != nil { - l = len(*m.AliasInner) - n += 1 + l + sovSql(uint64(l)) - } - if len(m.Columns) > 0 { - for _, e := range m.Columns { - l = e.Size() - n += 1 + l + sovSql(uint64(l)) - } - } - if len(m.ColIndex) > 0 { - for _, e := range m.ColIndex { - l = e.Size() - n += 1 + l + sovSql(uint64(l)) - } - } - if len(m.JoinNodes) > 0 { - for _, e := range m.JoinNodes { - l = e.Size() - n += 1 + l + sovSql(uint64(l)) - } - } - if m.Source != nil { - l = m.Source.Size() - n += 1 + l + sovSql(uint64(l)) - } - l = len(m.Raw) - n += 1 + l + sovSql(uint64(l)) - l = len(m.Name) - n += 1 + l + sovSql(uint64(l)) - l = len(m.Alias) - n += 1 + l + sovSql(uint64(l)) - n += 1 + sovSql(uint64(m.Op)) - n += 1 + sovSql(uint64(m.LeftOrRight)) - n += 1 + sovSql(uint64(m.JoinType)) - if m.JoinExpr != nil { - l = m.JoinExpr.Size() - n += 1 + l + sovSql(uint64(l)) - } - if m.SubQuery != nil { - l = m.SubQuery.Size() - n += 1 + l + sovSql(uint64(l)) - } - n += 2 - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *SqlWherePb) Size() (n int) { - var l int - _ = l - n += 1 + sovSql(uint64(m.Op)) - if m.Source != nil { - l = m.Source.Size() - n += 1 + l + sovSql(uint64(l)) - } - if m.Expr != nil { - l = m.Expr.Size() - n += 1 + l + sovSql(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ProjectionPb) Size() (n int) { - var l int - _ = l - n += 2 - n += 2 - if len(m.ColNames) > 0 { - for _, s := range m.ColNames { - l = len(s) - n += 1 + l + sovSql(uint64(l)) - } - } - if len(m.Columns) > 0 { - for _, e := range m.Columns { - l = e.Size() - n += 1 + l + sovSql(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ResultColumnPb) Size() (n int) { - var l int - _ = l - if m.Final != nil { - n += 2 - } - l = len(m.Name) - n += 1 + l + sovSql(uint64(l)) - n += 1 + sovSql(uint64(m.ColPos)) - if m.Column != nil { - l = m.Column.Size() - n += 1 + l + sovSql(uint64(l)) - } - if m.Star != nil { - n += 2 - } - l = len(m.As) - n += 1 + l + sovSql(uint64(l)) - n += 1 + sovSql(uint64(m.ValueType)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *KvInt) Size() (n int) { - var l int - _ = l - l = len(m.K) - n += 1 + l + sovSql(uint64(l)) - n += 1 + sovSql(uint64(m.V)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ColumnPb) Size() (n int) { - var l int - _ = l - if m.SourceQuote != nil { - l = len(m.SourceQuote) - n += 1 + l + sovSql(uint64(l)) - } - if m.AsQuoteByte != nil { - l = len(m.AsQuoteByte) - n += 1 + l + sovSql(uint64(l)) - } - if m.OriginalAs != nil { - l = len(*m.OriginalAs) - n += 1 + l + sovSql(uint64(l)) - } - if m.Left != nil { - l = len(*m.Left) - n += 1 + l + sovSql(uint64(l)) - } - if m.Right != nil { - l = len(*m.Right) - n += 1 + l + sovSql(uint64(l)) - } - n += 1 + sovSql(uint64(m.ParentIndex)) - n += 1 + sovSql(uint64(m.Index)) - n += 1 + sovSql(uint64(m.SourceIndex)) - if m.SourceField != nil { - l = len(*m.SourceField) - n += 1 + l + sovSql(uint64(l)) - } - l = len(m.As) - n += 1 + l + sovSql(uint64(l)) - if m.Comment != nil { - l = len(*m.Comment) - n += 1 + l + sovSql(uint64(l)) - } - if m.Order != nil { - l = len(*m.Order) - n += 1 + l + sovSql(uint64(l)) - } - if m.Star != nil { - n += 2 - } - n += 2 - if m.Expr != nil { - l = m.Expr.Size() - n += 2 + l + sovSql(uint64(l)) - } - if m.Guard != nil { - l = m.Guard.Size() - n += 2 + l + sovSql(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *CommandColumnPb) Size() (n int) { - var l int - _ = l - if m.Expr != nil { - l = m.Expr.Size() - n += 1 + l + sovSql(uint64(l)) - } - l = len(m.Name) - n += 1 + l + sovSql(uint64(l)) - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovSql(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozSql(x uint64) (n int) { - return sovSql(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *SqlStatementPb) Unmarshal(data []byte) error { - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SqlStatementPb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SqlStatementPb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Select", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Select == nil { - m.Select = &SqlSelectPb{} - } - if err := m.Select.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Source == nil { - m.Source = &SqlSourcePb{} - } - if err := m.Source.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Projection", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Projection == nil { - m.Projection = &ProjectionPb{} - } - if err := m.Projection.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSql(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthSql - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SqlSelectPb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SqlSelectPb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SqlSelectPb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Db", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Db = string(data[iNdEx:postIndex]) - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Raw = string(data[iNdEx:postIndex]) - iNdEx = postIndex - hasFields[0] |= uint64(0x00000002) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Star", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Star = bool(v != 0) - hasFields[0] |= uint64(0x00000004) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Distinct", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Distinct = bool(v != 0) - hasFields[0] |= uint64(0x00000008) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Columns", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Columns = append(m.Columns, &ColumnPb{}) - if err := m.Columns[len(m.Columns)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field From", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.From = append(m.From, &SqlSourcePb{}) - if err := m.From[len(m.From)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Into", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(data[iNdEx:postIndex]) - m.Into = &s - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Where", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Where == nil { - m.Where = &SqlWherePb{} - } - if err := m.Where.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Having", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Having == nil { - m.Having = &expr.NodePb{} - } - if err := m.Having.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OrderBy", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OrderBy = append(m.OrderBy, &ColumnPb{}) - if err := m.OrderBy[len(m.OrderBy)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field GroupBy", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.GroupBy = append(m.GroupBy, &ColumnPb{}) - if err := m.GroupBy[len(m.GroupBy)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Limit", wireType) - } - m.Limit = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.Limit |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Offset", wireType) - } - m.Offset = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.Offset |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 14: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Alias", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(data[iNdEx:postIndex]) - m.Alias = &s - iNdEx = postIndex - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Projection", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Projection == nil { - m.Projection = &ProjectionPb{} - } - if err := m.Projection.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 16: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field IsAgg", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.IsAgg = bool(v != 0) - hasFields[0] |= uint64(0x00000010) - case 17: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Finalized", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Finalized = bool(v != 0) - hasFields[0] |= uint64(0x00000020) - case 18: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Schemaqry", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Schemaqry = bool(v != 0) - hasFields[0] |= uint64(0x00000040) - case 19: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field With", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.With = append(m.With[:0], data[iNdEx:postIndex]...) - if m.With == nil { - m.With = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSql(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthSql - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000002) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000004) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000008) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000010) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000020) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000040) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SqlSourcePb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SqlSourcePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SqlSourcePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Final", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Final = bool(v != 0) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AliasInner", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(data[iNdEx:postIndex]) - m.AliasInner = &s - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Columns", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Columns = append(m.Columns, &ColumnPb{}) - if err := m.Columns[len(m.Columns)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ColIndex", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ColIndex = append(m.ColIndex, KvInt{}) - if err := m.ColIndex[len(m.ColIndex)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field JoinNodes", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.JoinNodes = append(m.JoinNodes, &expr.NodePb{}) - if err := m.JoinNodes[len(m.JoinNodes)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Source == nil { - m.Source = &SqlSelectPb{} - } - if err := m.Source.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Raw", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Raw = string(data[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(data[iNdEx:postIndex]) - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Alias", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Alias = string(data[iNdEx:postIndex]) - iNdEx = postIndex - case 10: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) - } - m.Op = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.Op |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000001) - case 11: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LeftOrRight", wireType) - } - m.LeftOrRight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.LeftOrRight |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000002) - case 12: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field JoinType", wireType) - } - m.JoinType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.JoinType |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000004) - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field JoinExpr", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.JoinExpr == nil { - m.JoinExpr = &expr.NodePb{} - } - if err := m.JoinExpr.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 14: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubQuery", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.SubQuery == nil { - m.SubQuery = &SqlSelectPb{} - } - if err := m.SubQuery.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 15: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Seekable", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Seekable = bool(v != 0) - default: - iNdEx = preIndex - skippy, err := skipSql(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthSql - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000002) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000004) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SqlWherePb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: SqlWherePb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SqlWherePb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Op", wireType) - } - m.Op = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.Op |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Source", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Source == nil { - m.Source = &SqlSelectPb{} - } - if err := m.Source.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Expr", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Expr == nil { - m.Expr = &expr.NodePb{} - } - if err := m.Expr.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSql(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthSql - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ProjectionPb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ProjectionPb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProjectionPb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Distinct", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Distinct = bool(v != 0) - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Final", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Final = bool(v != 0) - hasFields[0] |= uint64(0x00000002) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ColNames", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ColNames = append(m.ColNames, string(data[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Columns", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Columns = append(m.Columns, &ResultColumnPb{}) - if err := m.Columns[len(m.Columns)-1].Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSql(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthSql - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000002) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ResultColumnPb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResultColumnPb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResultColumnPb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Final", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Final = &b - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(data[iNdEx:postIndex]) - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ColPos", wireType) - } - m.ColPos = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.ColPos |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000002) - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Column", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Column == nil { - m.Column = &ColumnPb{} - } - if err := m.Column.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Star", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Star = &b - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field As", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.As = string(data[iNdEx:postIndex]) - iNdEx = postIndex - hasFields[0] |= uint64(0x00000004) - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ValueType", wireType) - } - m.ValueType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.ValueType |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000008) - default: - iNdEx = preIndex - skippy, err := skipSql(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthSql - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000002) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000004) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000008) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *KvInt) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: KvInt: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: KvInt: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field K", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.K = string(data[iNdEx:postIndex]) - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field V", wireType) - } - m.V = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.V |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - hasFields[0] |= uint64(0x00000002) - default: - iNdEx = preIndex - skippy, err := skipSql(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthSql - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - if hasFields[0]&uint64(0x00000002) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ColumnPb) Unmarshal(data []byte) error { - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ColumnPb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ColumnPb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SourceQuote", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SourceQuote = append(m.SourceQuote[:0], data[iNdEx:postIndex]...) - if m.SourceQuote == nil { - m.SourceQuote = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AsQuoteByte", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AsQuoteByte = append(m.AsQuoteByte[:0], data[iNdEx:postIndex]...) - if m.AsQuoteByte == nil { - m.AsQuoteByte = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OriginalAs", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(data[iNdEx:postIndex]) - m.OriginalAs = &s - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Left", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(data[iNdEx:postIndex]) - m.Left = &s - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Right", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(data[iNdEx:postIndex]) - m.Right = &s - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ParentIndex", wireType) - } - m.ParentIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.ParentIndex |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Index", wireType) - } - m.Index = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.Index |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SourceIndex", wireType) - } - m.SourceIndex = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - m.SourceIndex |= (int32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SourceField", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(data[iNdEx:postIndex]) - m.SourceField = &s - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field As", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.As = string(data[iNdEx:postIndex]) - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Comment", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(data[iNdEx:postIndex]) - m.Comment = &s - iNdEx = postIndex - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Order", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(data[iNdEx:postIndex]) - m.Order = &s - iNdEx = postIndex - case 14: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Star", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - b := bool(v != 0) - m.Star = &b - case 15: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Agg", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Agg = bool(v != 0) - case 16: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Expr", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Expr == nil { - m.Expr = &expr.NodePb{} - } - if err := m.Expr.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 17: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Guard", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Guard == nil { - m.Guard = &expr.NodePb{} - } - if err := m.Guard.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSql(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthSql - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *CommandColumnPb) Unmarshal(data []byte) error { - var hasFields [1]uint64 - l := len(data) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: CommandColumnPb: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CommandColumnPb: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Expr", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Expr == nil { - m.Expr = &expr.NodePb{} - } - if err := m.Expr.Unmarshal(data[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSql - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthSql - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(data[iNdEx:postIndex]) - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - default: - iNdEx = preIndex - skippy, err := skipSql(data[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthSql - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, data[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return new(github_com_golang_protobuf_proto.RequiredNotSetError) - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipSql(data []byte) (n int, err error) { - l := len(data) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSql - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSql - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if data[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSql - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthSql - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSql - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := data[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipSql(data[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthSql = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowSql = fmt.Errorf("proto: integer overflow") -) -var fileDescriptorSql = []byte{ - // 1067 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x8c, 0x56, 0xcd, 0x6e, 0xdb, 0x46, - 0x10, 0x0e, 0x25, 0x51, 0x96, 0x56, 0x8e, 0xed, 0x6c, 0x82, 0x62, 0x61, 0x14, 0xae, 0x41, 0x14, - 0x81, 0xd1, 0x34, 0x52, 0x91, 0x1e, 0x7a, 0x8e, 0x83, 0xb6, 0x30, 0x0a, 0xa4, 0x8e, 0x5c, 0xa0, - 0x67, 0x4a, 0x5c, 0x51, 0x8c, 0x29, 0xae, 0xbc, 0x24, 0xe5, 0x38, 0x4f, 0xd2, 0x4b, 0x81, 0x5e, - 0x7b, 0xeb, 0x33, 0xf4, 0xe4, 0x63, 0x9f, 0xa0, 0xe8, 0x0f, 0xfa, 0x1e, 0x9d, 0x99, 0x25, 0x97, - 0x6b, 0x47, 0x72, 0x72, 0x10, 0xc0, 0xfd, 0xe6, 0xdb, 0xdd, 0x99, 0xd9, 0x6f, 0x66, 0xc4, 0xfa, - 0xf9, 0x45, 0x3a, 0x5c, 0x6a, 0x55, 0x28, 0xde, 0xd6, 0x32, 0xdd, 0x7f, 0x12, 0x27, 0xc5, 0xbc, - 0x9c, 0x0c, 0xa7, 0x6a, 0x31, 0x0a, 0x75, 0x18, 0x45, 0x2a, 0x1b, 0x5d, 0xa4, 0x13, 0x9d, 0x44, - 0xb1, 0x1c, 0xc9, 0x37, 0x4b, 0x3d, 0xca, 0x54, 0x24, 0xcd, 0x8e, 0xfd, 0xa7, 0x0e, 0x39, 0x56, - 0xb1, 0x1a, 0x11, 0x3c, 0x29, 0x67, 0xb4, 0xa2, 0x05, 0x7d, 0x19, 0x7a, 0xf0, 0xab, 0xc7, 0x76, - 0xce, 0x2e, 0xd2, 0xb3, 0x22, 0x2c, 0xe4, 0x42, 0x66, 0xc5, 0xe9, 0x84, 0x0f, 0x59, 0x37, 0x97, - 0xa9, 0x9c, 0x16, 0xc2, 0x3b, 0xf4, 0x8e, 0x06, 0xcf, 0xf6, 0x86, 0xe0, 0xc4, 0x10, 0x49, 0x84, - 0x9e, 0x4e, 0x8e, 0x3b, 0xd7, 0x7f, 0x7e, 0xe2, 0x8d, 0x2b, 0x16, 0xf1, 0x55, 0xa9, 0xa7, 0x52, - 0xb4, 0x6e, 0xf1, 0x09, 0x75, 0xf8, 0xb4, 0xe6, 0x5f, 0x31, 0x06, 0x77, 0xbf, 0x86, 0xad, 0x89, - 0xca, 0x44, 0x87, 0xf6, 0x3c, 0xa0, 0x3d, 0xa7, 0x16, 0xb6, 0x9b, 0x1c, 0x6a, 0xf0, 0x9b, 0xcf, - 0x06, 0x8e, 0x1b, 0xfc, 0x11, 0x6b, 0x45, 0x13, 0x70, 0xb2, 0x75, 0xd4, 0x27, 0xf6, 0xbd, 0x31, - 0xac, 0xf9, 0x47, 0xac, 0xad, 0xc3, 0x4b, 0xf0, 0xa5, 0x81, 0x11, 0xe0, 0x82, 0x75, 0xf2, 0x22, - 0xd4, 0xa2, 0x0d, 0x86, 0x5e, 0x65, 0x20, 0x84, 0x1f, 0xb2, 0x5e, 0x94, 0xe4, 0x45, 0x92, 0x41, - 0xc8, 0x1d, 0xc7, 0x6a, 0x51, 0xfe, 0x94, 0x6d, 0x4d, 0x55, 0x5a, 0x2e, 0xb2, 0x5c, 0xf8, 0x87, - 0x6d, 0xf0, 0xf7, 0x3e, 0xf9, 0xfb, 0x82, 0x30, 0xeb, 0x6b, 0xcd, 0xe1, 0x9f, 0xb1, 0xce, 0x4c, - 0xab, 0x85, 0xe8, 0x12, 0x77, 0x53, 0x3e, 0x88, 0x83, 0x6e, 0x25, 0x59, 0xa1, 0xc4, 0x16, 0xe4, - 0xa1, 0x5f, 0x5b, 0x10, 0xe1, 0x4f, 0x98, 0x7f, 0x39, 0x97, 0x5a, 0x8a, 0x1e, 0xa5, 0x68, 0xb7, - 0x3e, 0xe6, 0x47, 0x04, 0xed, 0x29, 0x86, 0x03, 0x57, 0x76, 0xe7, 0xe1, 0x2a, 0xc9, 0x62, 0xd1, - 0x27, 0xf6, 0xf6, 0x10, 0x85, 0x31, 0x7c, 0x09, 0xc2, 0x68, 0x1e, 0xc0, 0x30, 0x30, 0x1a, 0xa5, - 0x23, 0xa9, 0x8f, 0xaf, 0x04, 0xbb, 0x23, 0x9a, 0x8a, 0x83, 0xf4, 0x58, 0xab, 0x72, 0x09, 0xf4, - 0xc1, 0x1d, 0xf4, 0x8a, 0xc3, 0xf7, 0x99, 0x9f, 0x26, 0x8b, 0xa4, 0x10, 0xdb, 0xe0, 0x88, 0x5f, - 0xa5, 0xd2, 0x40, 0xfc, 0x63, 0xd6, 0x55, 0xb3, 0x59, 0x2e, 0x0b, 0x71, 0xdf, 0x31, 0x56, 0x18, - 0xee, 0x0c, 0xd3, 0x24, 0xcc, 0xc5, 0x8e, 0x93, 0x0b, 0x03, 0xdd, 0x12, 0xcd, 0xee, 0x07, 0x8b, - 0x06, 0x0f, 0x4d, 0xf2, 0xe7, 0x71, 0x2c, 0xf6, 0x9c, 0x97, 0x35, 0x10, 0x0f, 0x58, 0x7f, 0x96, - 0x64, 0x70, 0xc1, 0x5b, 0x19, 0x89, 0x07, 0x8e, 0xbd, 0x81, 0x91, 0x93, 0x4f, 0xe7, 0x72, 0x11, - 0x5e, 0xe8, 0x2b, 0xc1, 0x5d, 0x8e, 0x85, 0xf1, 0x0d, 0x2f, 0xa1, 0xea, 0xc4, 0x43, 0x70, 0x6b, - 0xbb, 0x7e, 0x43, 0x44, 0x82, 0xdf, 0x3b, 0x46, 0xb2, 0xd5, 0xcb, 0xa3, 0x37, 0x74, 0x34, 0x95, - 0x96, 0xf5, 0x86, 0x20, 0xfe, 0x29, 0x63, 0x14, 0xeb, 0x49, 0x96, 0x49, 0x4d, 0xb5, 0x54, 0xe7, - 0xc0, 0xc1, 0x5d, 0x29, 0xb6, 0x3f, 0x40, 0x8a, 0x9f, 0xb3, 0x1e, 0x7c, 0x9e, 0x64, 0x91, 0x7c, - 0x03, 0xda, 0x46, 0x3e, 0x23, 0xfe, 0x77, 0xab, 0x93, 0xac, 0xa8, 0x75, 0x5e, 0x33, 0xf8, 0x17, - 0xac, 0xff, 0x5a, 0x25, 0x19, 0xaa, 0xa6, 0x56, 0xfa, 0x3a, 0x21, 0x35, 0x24, 0xa7, 0xf8, 0xbb, - 0xef, 0x69, 0x16, 0xa6, 0xf8, 0xab, 0xea, 0x6c, 0xd4, 0xde, 0x54, 0x67, 0x16, 0x2e, 0x8c, 0xd6, - 0x6b, 0x03, 0x21, 0x8d, 0x2a, 0xfa, 0x8e, 0xa9, 0x52, 0x05, 0x74, 0x00, 0xb5, 0x04, 0x11, 0xb7, - 0xac, 0x96, 0x60, 0xcd, 0x1f, 0xb3, 0x41, 0x2a, 0x67, 0xc5, 0xf7, 0x7a, 0x9c, 0xc4, 0xf3, 0x02, - 0x44, 0xdb, 0x98, 0x5d, 0x03, 0xd6, 0x3d, 0x06, 0xf2, 0xc3, 0xd5, 0x52, 0x82, 0x58, 0x1b, 0x92, - 0x45, 0x21, 0x3a, 0xfa, 0xfe, 0x1a, 0x32, 0x40, 0x8a, 0x5d, 0x9f, 0x0e, 0xcb, 0xe1, 0xcf, 0x58, - 0x2f, 0x2f, 0x27, 0xaf, 0x4a, 0x09, 0x5a, 0xd9, 0xb9, 0x33, 0x1f, 0x96, 0x87, 0x5e, 0xe4, 0x52, - 0x9e, 0x87, 0x93, 0x54, 0x92, 0xae, 0x6d, 0xf7, 0xa9, 0xd1, 0xe0, 0x2d, 0x63, 0x4d, 0xd9, 0x57, - 0x31, 0x7b, 0xb7, 0x62, 0xde, 0xdc, 0x84, 0xd7, 0xbf, 0xc3, 0x63, 0xd6, 0xa1, 0xa8, 0xda, 0x1b, - 0xa3, 0xea, 0x20, 0x14, 0xfc, 0xec, 0xb1, 0x6d, 0xb7, 0xc2, 0x6e, 0x34, 0x4b, 0x6f, 0x6d, 0xb3, - 0xb4, 0x1a, 0x6f, 0xb9, 0x15, 0x67, 0x34, 0xbe, 0x4f, 0x72, 0x7c, 0x09, 0xef, 0x6a, 0xe4, 0xdb, - 0x1f, 0xdb, 0x35, 0xff, 0xb2, 0x51, 0xb6, 0x51, 0xea, 0x43, 0x8a, 0x61, 0x2c, 0xf3, 0x32, 0x2d, - 0x36, 0xe8, 0x3b, 0xf8, 0x0f, 0xe6, 0xd7, 0x4d, 0xc6, 0xba, 0x1a, 0xf3, 0xea, 0xfb, 0x6b, 0x99, - 0xb9, 0xd3, 0xc1, 0xc8, 0x0c, 0x5a, 0x13, 0x9c, 0x79, 0xaa, 0x72, 0x1a, 0x10, 0xb6, 0x35, 0x19, - 0x0c, 0x7a, 0x71, 0xd7, 0xdc, 0x58, 0xcd, 0xab, 0xb5, 0x45, 0x57, 0x51, 0xec, 0xa4, 0xf1, 0x9d, - 0xfb, 0xcd, 0xa4, 0x81, 0xb7, 0x03, 0x21, 0x77, 0xdd, 0x89, 0x05, 0x2a, 0x86, 0x16, 0xb3, 0x0a, - 0xd3, 0x52, 0x92, 0x10, 0xb7, 0x9c, 0xdb, 0x1b, 0x38, 0x18, 0x31, 0x9f, 0x4a, 0x96, 0x73, 0xe6, - 0x9d, 0xdf, 0x98, 0x79, 0xde, 0x39, 0x62, 0x2b, 0x0a, 0xa9, 0xde, 0xe8, 0xad, 0x82, 0x5f, 0x3a, - 0xac, 0x67, 0x53, 0x02, 0x15, 0x61, 0xde, 0xfd, 0x55, 0xa9, 0x0a, 0x49, 0x89, 0xa9, 0xfb, 0x94, - 0x6b, 0x40, 0x5e, 0x98, 0xd3, 0xe7, 0xf1, 0x55, 0x61, 0xa4, 0x64, 0x79, 0x8e, 0x01, 0x5b, 0x95, - 0xd2, 0x49, 0x8c, 0x29, 0x7d, 0x9e, 0x93, 0x86, 0x6c, 0xab, 0x6a, 0x70, 0xcc, 0x03, 0x96, 0x1b, - 0xa5, 0xcc, 0x8e, 0x36, 0x44, 0xf0, 0x89, 0x34, 0xd5, 0xa6, 0xef, 0x76, 0x7a, 0x82, 0xd0, 0x87, - 0x65, 0xa8, 0xe1, 0xaf, 0x88, 0x69, 0x5a, 0x5d, 0x67, 0x50, 0xb8, 0x06, 0x6a, 0xec, 0xc4, 0xd8, - 0x72, 0xe7, 0x0c, 0x41, 0x4d, 0xbc, 0xe6, 0x8c, 0x9e, 0x7b, 0x86, 0x63, 0x68, 0x78, 0xdf, 0x24, - 0x32, 0x8d, 0x9c, 0x0e, 0x63, 0xf3, 0x42, 0x86, 0xea, 0xdd, 0x06, 0x4e, 0x03, 0xc2, 0x77, 0x3b, - 0x40, 0xc1, 0x2e, 0xf0, 0x5f, 0x13, 0xcd, 0xba, 0x7e, 0xa3, 0x4d, 0x02, 0xd1, 0x43, 0x9a, 0xa1, - 0xd4, 0x3a, 0x6c, 0x94, 0x04, 0x59, 0x8d, 0xec, 0xbc, 0xa3, 0x11, 0xe8, 0x90, 0x21, 0x8c, 0x2b, - 0xb7, 0x15, 0x20, 0x60, 0x2b, 0x76, 0xef, 0xee, 0x8a, 0xe5, 0x47, 0xcc, 0xff, 0xb6, 0x0c, 0x35, - 0x0e, 0xb4, 0x4d, 0x44, 0x3f, 0x46, 0x42, 0x70, 0xc6, 0x76, 0x5f, 0x80, 0xab, 0x61, 0x16, 0x39, - 0x42, 0x31, 0x97, 0x78, 0xef, 0xb9, 0x64, 0x63, 0x1d, 0x1d, 0x3f, 0xba, 0xfe, 0xfb, 0xc0, 0xbb, - 0xfe, 0xe7, 0xc0, 0xfb, 0x03, 0x7e, 0x7f, 0xc1, 0xef, 0xa7, 0x7f, 0x0f, 0xee, 0xfd, 0x1f, 0x00, - 0x00, 0xff, 0xff, 0xa8, 0x40, 0xb5, 0x23, 0xd3, 0x0a, 0x00, 0x00, +func init() { proto.RegisterFile("sql.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 968 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x56, 0xff, 0x6e, 0xdb, 0x36, + 0x10, 0x86, 0x6c, 0xcb, 0x91, 0xce, 0xae, 0xe3, 0xb2, 0x43, 0x41, 0x04, 0xc3, 0x60, 0x68, 0xed, + 0x66, 0xec, 0x87, 0x83, 0x75, 0x4f, 0xd0, 0x14, 0x5b, 0x11, 0x0c, 0xe8, 0x5c, 0x76, 0xc0, 0xfe, + 0xa6, 0x2c, 0x5a, 0x56, 0x23, 0x89, 0x0e, 0x45, 0x39, 0xf1, 0x5e, 0x61, 0x0f, 0xb0, 0x87, 0x19, + 0x30, 0xec, 0x71, 0xf6, 0x18, 0x03, 0x8f, 0xb2, 0xcc, 0x38, 0xf6, 0xb0, 0xff, 0xee, 0xee, 0x3b, + 0x8a, 0x77, 0xbc, 0xef, 0x3b, 0x1b, 0xc2, 0xea, 0x36, 0x9f, 0xad, 0x95, 0xd4, 0x92, 0x74, 0x95, + 0xc8, 0x2f, 0xbe, 0x4e, 0x33, 0xbd, 0xaa, 0xe3, 0xd9, 0x42, 0x16, 0x97, 0x5c, 0xf1, 0x24, 0x91, + 0xe5, 0xe5, 0x6d, 0x1e, 0xab, 0x2c, 0x49, 0xc5, 0xa5, 0xb8, 0x5f, 0xab, 0xcb, 0x52, 0x26, 0xc2, + 0x9e, 0x88, 0xfe, 0xf0, 0x60, 0xf4, 0xe1, 0x36, 0xff, 0xa0, 0xb9, 0x16, 0x85, 0x28, 0xf5, 0x3c, + 0x26, 0x53, 0xe8, 0x57, 0x22, 0x17, 0x0b, 0x4d, 0xbd, 0x89, 0x37, 0x1d, 0xbc, 0x1a, 0xcf, 0x94, + 0xc8, 0x67, 0x26, 0x09, 0xa3, 0xf3, 0x98, 0x35, 0x38, 0x66, 0xca, 0x5a, 0x2d, 0x04, 0xed, 0x1c, + 0x64, 0x62, 0x14, 0x33, 0xd1, 0x22, 0xdf, 0x01, 0xac, 0x95, 0xfc, 0x28, 0x16, 0x3a, 0x93, 0x25, + 0xed, 0x61, 0xf6, 0x53, 0xcc, 0x9e, 0xb7, 0xe1, 0x79, 0xcc, 0x9c, 0xa4, 0xe8, 0xaf, 0x1e, 0x0c, + 0x9c, 0x4b, 0xc9, 0x08, 0x3a, 0x49, 0x8c, 0x25, 0x85, 0xac, 0x93, 0xc4, 0x64, 0x0c, 0x5d, 0xc5, + 0xef, 0xf0, 0xe6, 0x90, 0x19, 0x93, 0x10, 0xe8, 0x55, 0x9a, 0x2b, 0xda, 0x9d, 0x78, 0xd3, 0x80, + 0xa1, 0x4d, 0x2e, 0x20, 0x48, 0xb2, 0x4a, 0x67, 0xe5, 0x42, 0xe3, 0xb5, 0x01, 0x6b, 0x7d, 0xf2, + 0x25, 0x9c, 0x2d, 0x64, 0x5e, 0x17, 0x65, 0x45, 0xfd, 0x49, 0x77, 0x3a, 0x78, 0xf5, 0x04, 0x2b, + 0x7a, 0x83, 0xb1, 0x79, 0xcc, 0x76, 0x28, 0x79, 0x01, 0xbd, 0xa5, 0x92, 0x05, 0xed, 0x63, 0xd6, + 0xe3, 0x2e, 0x11, 0x35, 0xd7, 0x67, 0xa5, 0x96, 0xf4, 0x0c, 0x2b, 0x42, 0x9b, 0xbc, 0x04, 0xff, + 0x6e, 0x25, 0x94, 0xa0, 0x01, 0xb6, 0x7c, 0xbe, 0x3b, 0xfa, 0xab, 0x09, 0xce, 0x63, 0x66, 0x51, + 0xf2, 0x02, 0xfa, 0x2b, 0xbe, 0xc9, 0xca, 0x94, 0x86, 0x98, 0x37, 0x9c, 0x99, 0x39, 0xcd, 0xde, + 0xc9, 0x04, 0x1f, 0xd1, 0x62, 0xa6, 0xde, 0x54, 0xc9, 0x7a, 0x7d, 0xb5, 0xa5, 0x70, 0xb4, 0xde, + 0x06, 0x35, 0x89, 0x52, 0x25, 0x42, 0x5d, 0x6d, 0xe9, 0xe0, 0x68, 0x62, 0x83, 0x92, 0x4f, 0xc0, + 0xcf, 0xb3, 0x22, 0xd3, 0x74, 0x38, 0xf1, 0xa6, 0x3e, 0xb3, 0x0e, 0x79, 0x0e, 0x7d, 0xb9, 0x5c, + 0x56, 0x42, 0xd3, 0x27, 0x18, 0x6e, 0x3c, 0x93, 0xcd, 0xf3, 0x8c, 0x57, 0x74, 0x84, 0x1d, 0x5a, + 0xe7, 0x60, 0xb4, 0xe7, 0xff, 0x63, 0xb4, 0xe6, 0x43, 0x59, 0xf5, 0x3a, 0x4d, 0xe9, 0x18, 0x27, + 0x62, 0x1d, 0xf2, 0x29, 0x84, 0xcb, 0xac, 0xe4, 0x79, 0xf6, 0x9b, 0x48, 0xe8, 0x53, 0x44, 0xf6, + 0x01, 0x83, 0x56, 0x8b, 0x95, 0x28, 0xf8, 0xad, 0xda, 0x52, 0x62, 0xd1, 0x36, 0x60, 0xde, 0xfe, + 0x2e, 0xd3, 0x2b, 0xfa, 0x6c, 0xe2, 0x4d, 0x87, 0x0c, 0xed, 0xe8, 0x9f, 0xae, 0x25, 0x50, 0x33, + 0x25, 0x73, 0x2b, 0x7e, 0x0e, 0x39, 0x14, 0x30, 0xeb, 0x90, 0xcf, 0x00, 0xb0, 0x8f, 0xeb, 0xb2, + 0x14, 0xaa, 0x61, 0x93, 0x13, 0x71, 0x49, 0xd2, 0xfd, 0x4f, 0x92, 0x7c, 0x01, 0xc1, 0x42, 0xe6, + 0xd7, 0x65, 0x22, 0xee, 0x69, 0x0f, 0x33, 0x01, 0x33, 0x7f, 0xda, 0x5c, 0x97, 0x9a, 0xb5, 0x18, + 0xf9, 0x0a, 0xc2, 0x8f, 0x32, 0x2b, 0xcd, 0x6c, 0x77, 0xbc, 0x7b, 0x38, 0xee, 0x3d, 0xec, 0x08, + 0xac, 0x7f, 0x52, 0x8a, 0x56, 0x60, 0x8d, 0x1a, 0xce, 0x1e, 0xa8, 0xa1, 0xe4, 0x85, 0x65, 0x5e, + 0xc8, 0xd0, 0xde, 0x4f, 0x30, 0x74, 0x27, 0x38, 0x82, 0x8e, 0x5c, 0x53, 0xc0, 0x59, 0x77, 0xe4, + 0x9a, 0x4c, 0x60, 0x90, 0x8b, 0xa5, 0xfe, 0x59, 0xb1, 0x2c, 0x5d, 0x69, 0x3a, 0x40, 0xc0, 0x0d, + 0x19, 0x55, 0x99, 0x22, 0x7f, 0xd9, 0xae, 0x45, 0x43, 0x9d, 0xd6, 0x27, 0x53, 0x8b, 0xfd, 0x70, + 0xbf, 0x56, 0xc8, 0x9f, 0xc3, 0xf6, 0x5a, 0x94, 0x7c, 0x03, 0x41, 0x55, 0xc7, 0xef, 0x6b, 0xa1, + 0xb6, 0x48, 0xa9, 0x63, 0xfd, 0xb5, 0x19, 0xe6, 0xce, 0x4a, 0x88, 0x1b, 0x1e, 0xe7, 0x02, 0x59, + 0x16, 0xb0, 0xd6, 0x8f, 0x56, 0x00, 0x7b, 0x51, 0x35, 0xfd, 0x78, 0x6d, 0x3f, 0xa7, 0xd7, 0xd4, + 0xe1, 0x2b, 0x4e, 0xa0, 0x87, 0x75, 0x77, 0x8f, 0xd4, 0x8d, 0x48, 0xf4, 0xbb, 0x07, 0x43, 0x97, + 0xd7, 0x0f, 0x16, 0x8c, 0x77, 0xb0, 0x60, 0x5a, 0xc6, 0x75, 0x5c, 0xc6, 0x5d, 0x20, 0x51, 0xde, + 0xf1, 0x42, 0x58, 0x4a, 0x85, 0xac, 0xf5, 0xc9, 0xb7, 0x7b, 0xb6, 0x59, 0x0e, 0x3d, 0xc3, 0x5a, + 0x99, 0xa8, 0xea, 0x5c, 0x3f, 0xe2, 0x5c, 0xf4, 0xa7, 0x07, 0xa3, 0x87, 0xd8, 0x09, 0x96, 0xef, + 0xc8, 0xd0, 0x71, 0xc8, 0xf0, 0x1c, 0xfa, 0x0b, 0x99, 0xcf, 0x65, 0x85, 0xed, 0xfa, 0xac, 0xf1, + 0xc8, 0x4b, 0x8c, 0xd7, 0xc5, 0x6e, 0x4f, 0x1f, 0x10, 0xbe, 0x01, 0xdb, 0x6d, 0xeb, 0x3b, 0xdb, + 0x76, 0x04, 0x1d, 0x5e, 0x21, 0x57, 0x43, 0xd6, 0xe1, 0x95, 0x11, 0xed, 0x86, 0xe7, 0xb5, 0x40, + 0xa2, 0x9c, 0xe1, 0x2d, 0xfb, 0x40, 0xf4, 0x39, 0xf8, 0x28, 0x0e, 0x32, 0x04, 0xef, 0xa6, 0xd9, + 0xec, 0xde, 0x8d, 0xf1, 0x36, 0x58, 0xa8, 0xcf, 0xbc, 0x4d, 0xf4, 0x77, 0x17, 0x82, 0xb6, 0xb9, + 0x09, 0x0c, 0xec, 0xa4, 0xde, 0xd7, 0x52, 0x0b, 0x3c, 0x32, 0x64, 0x6e, 0xc8, 0x64, 0xf0, 0x0a, + 0xcd, 0xab, 0xad, 0xb6, 0xfd, 0x0e, 0x99, 0x1b, 0x32, 0x82, 0x97, 0x2a, 0x4b, 0xcd, 0xb3, 0xbc, + 0xb6, 0xad, 0x87, 0xcc, 0x89, 0x98, 0xbe, 0x0c, 0xd5, 0xb1, 0xf9, 0x90, 0xa1, 0x6d, 0x1e, 0x55, + 0xa1, 0x16, 0x7c, 0xab, 0x1b, 0x74, 0xcc, 0x5d, 0x6b, 0xae, 0x44, 0xa9, 0xad, 0xe8, 0xfb, 0x56, + 0x27, 0x4e, 0x08, 0x17, 0x1d, 0x62, 0xb6, 0x77, 0xeb, 0xec, 0xbb, 0xb0, 0xe7, 0x02, 0x7b, 0xce, + 0x09, 0xed, 0x33, 0x7e, 0xcc, 0x44, 0x9e, 0x34, 0x6a, 0x75, 0x43, 0xcd, 0x4b, 0x0f, 0xda, 0x97, + 0xa6, 0x86, 0x38, 0x85, 0xf9, 0x05, 0x47, 0x41, 0x86, 0x6c, 0xe7, 0x9a, 0x1a, 0x70, 0xdd, 0xa3, + 0x18, 0x43, 0x66, 0x9d, 0x76, 0x7a, 0x23, 0x67, 0x7a, 0x63, 0xe8, 0xf2, 0x34, 0x6d, 0xc4, 0x65, + 0xcc, 0x56, 0x0f, 0xe3, 0x53, 0x7a, 0x20, 0x11, 0xf8, 0x6f, 0x6b, 0xae, 0xec, 0xc2, 0x3e, 0x4c, + 0xb1, 0x50, 0xf4, 0x16, 0xce, 0xdf, 0xc8, 0xa2, 0xe0, 0x65, 0xe2, 0x0c, 0xd2, 0x7e, 0xd8, 0x3b, + 0xf9, 0xe1, 0x23, 0x8c, 0x8d, 0xfb, 0xf8, 0x9f, 0xe5, 0xfb, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, + 0x69, 0x20, 0x59, 0x68, 0xf2, 0x08, 0x00, 0x00, } diff --git a/rel/sql.proto b/rel/sql.proto index 103c32f7..ccc11e52 100644 --- a/rel/sql.proto +++ b/rel/sql.proto @@ -1,120 +1,109 @@ -syntax = "proto2"; +syntax = "proto3"; package rel; import "github.com/araddon/qlbridge/expr/node.proto"; -// protoc --proto_path=$GOPATH/src:$GOPATH/src/github.com/gogo/protobuf/protobuf:. --gofast_out=. sql.proto - -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; -option (gogoproto.goproto_getters_all) = true; - +// protoc --proto_path=$GOPATH/src:. --go_out=. *.proto // The generic SqlStatement, must be exactly one of these types message SqlStatementPb { - optional SqlSelectPb select = 1 [(gogoproto.nullable) = true]; - optional SqlSourcePb source = 2 [(gogoproto.nullable) = true]; - optional ProjectionPb projection = 4 [(gogoproto.nullable) = true]; + SqlSelectPb select = 1; + SqlSourcePb source = 2; + ProjectionPb projection = 4; } message SqlSelectPb { - required string db = 1 [(gogoproto.nullable) = false]; - required string raw = 2 [(gogoproto.nullable) = false]; - required bool star = 3 [(gogoproto.nullable) = false]; - required bool distinct = 4 [(gogoproto.nullable) = false]; - repeated ColumnPb columns = 5 [(gogoproto.nullable) = true]; - repeated SqlSourcePb from = 6 [(gogoproto.nullable) = true]; - optional string into = 7 [(gogoproto.nullable) = true]; - optional SqlWherePb where = 8 [(gogoproto.nullable) = true]; - optional expr.NodePb having = 9 [(gogoproto.nullable) = true]; - repeated ColumnPb groupBy = 10 [(gogoproto.nullable) = true]; - repeated ColumnPb orderBy = 11 [(gogoproto.nullable) = true]; - optional int32 limit = 12 [(gogoproto.nullable) = false]; - optional int32 offset = 13 [(gogoproto.nullable) = false]; - optional string alias = 14 [(gogoproto.nullable) = true]; - optional ProjectionPb projection = 15 [(gogoproto.nullable) = true]; - required bool isAgg = 16 [(gogoproto.nullable) = false]; - required bool finalized = 17 [(gogoproto.nullable) = false]; - required bool schemaqry = 18 [(gogoproto.nullable) = false]; - optional bytes with = 19 [(gogoproto.nullable) = true]; + string db = 1; + string raw = 2; + bool star = 3; + bool distinct = 4; + repeated ColumnPb columns = 5; + repeated SqlSourcePb from = 6; + string into = 7; + SqlWherePb where = 8; + expr.NodePb having = 9; + repeated ColumnPb groupBy = 10; + repeated ColumnPb orderBy = 11; + int32 limit = 12; + int32 offset = 13; + string alias = 14; + ProjectionPb projection = 15; + bool isAgg = 16; + bool finalized = 17; + bool schemaqry = 18; + bytes with = 19; } message SqlSourcePb { - optional bool final = 1 [(gogoproto.nullable) = false]; - optional string aliasInner = 2 [(gogoproto.nullable) = true]; - repeated ColumnPb columns = 3 [(gogoproto.nullable) = true]; - repeated KvInt colIndex = 4 [(gogoproto.nullable) = false]; - repeated expr.NodePb joinNodes = 5 [(gogoproto.nullable) = true]; - optional SqlSelectPb source = 6 [(gogoproto.nullable) = true]; - optional string raw = 7 [(gogoproto.nullable) = false]; - optional string name = 8 [(gogoproto.nullable) = false]; - optional string alias = 9 [(gogoproto.nullable) = false]; - required int32 op = 10 [(gogoproto.nullable) = false]; - required int32 leftOrRight = 11 [(gogoproto.nullable) = false]; - required int32 joinType = 12 [(gogoproto.nullable) = false]; - optional expr.NodePb joinExpr = 13 [(gogoproto.nullable) = true]; - optional SqlSelectPb subQuery = 14 [(gogoproto.nullable) = true]; - optional bool seekable = 15 [(gogoproto.nullable) = false]; + bool final = 1; + string aliasInner = 2; + repeated ColumnPb columns = 3; + repeated KvInt colIndex = 4; + repeated expr.NodePb joinNodes = 5; + SqlSelectPb source = 6; + string raw = 7; + string name = 8; + string alias = 9; + int32 op = 10; + int32 leftOrRight = 11; + int32 joinType = 12; + expr.NodePb joinExpr = 13; + SqlSelectPb subQuery = 14; + bool seekable = 15; } message SqlWherePb { - required int32 op = 1 [(gogoproto.nullable) = false]; - optional SqlSelectPb source = 2 [(gogoproto.nullable) = true]; - optional expr.NodePb Expr = 3 [(gogoproto.nullable) = true]; - //optional bytes Expr = 3 [(gogoproto.customtype) = "github.com/araddon/qlbridge/expr.NodePb", (gogoproto.nullable) = true]; + int32 op = 1; + SqlSelectPb source = 2; + expr.NodePb Expr = 3; } message ProjectionPb { - required bool distinct = 1 [(gogoproto.nullable) = false]; - required bool final = 2 [(gogoproto.nullable) = false]; + bool distinct = 1; + bool final = 2; repeated string colNames = 3; - repeated ResultColumnPb columns = 4 [(gogoproto.nullable) = true]; + repeated ResultColumnPb columns = 4; } message ResultColumnPb { - optional bool final = 1 [(gogoproto.nullable) = true]; - required string name = 2 [(gogoproto.nullable) = false]; - required int32 colPos = 3 [(gogoproto.nullable) = false]; - optional ColumnPb column = 4 [(gogoproto.nullable) = true]; - optional bool star = 5 [(gogoproto.nullable) = true]; - required string as = 6 [(gogoproto.nullable) = false]; - required int32 valueType = 7 [(gogoproto.nullable) = false]; + bool final = 1; + string name = 2; + int32 colPos = 3; + ColumnPb column = 4; + bool star = 5; + string as = 6; + int32 valueType = 7; } message KvInt { - required string k = 1 [(gogoproto.nullable) = false]; - required int32 v = 2 [(gogoproto.nullable) = false]; + string k = 1; + int32 v = 2; } message ColumnPb { - optional bytes sourceQuote = 1 [(gogoproto.nullable) = true]; - optional bytes asQuoteByte = 2 [(gogoproto.nullable) = true]; - optional string originalAs = 3 [(gogoproto.nullable) = true]; - optional string left = 4 [(gogoproto.nullable) = true]; - optional string right = 5 [(gogoproto.nullable) = true]; - optional int32 parentIndex = 6 [(gogoproto.nullable) = false]; - optional int32 index = 7 [(gogoproto.nullable) = false]; - optional int32 sourceIndex = 8 [(gogoproto.nullable) = false]; - optional string sourceField = 9 [(gogoproto.nullable) = true]; - optional string as = 11 [(gogoproto.nullable) = false]; - optional string comment = 12 [(gogoproto.nullable) = true]; - optional string order = 13 [(gogoproto.nullable) = true]; - optional bool star = 14 [(gogoproto.nullable) = true]; - optional bool agg = 15 [(gogoproto.nullable) = false]; - optional expr.NodePb Expr = 16 [(gogoproto.nullable) = true]; - optional expr.NodePb Guard = 17 [(gogoproto.nullable) = true]; - //optional bytes Guard = 17 [(gogoproto.customtype) = "github.com/araddon/qlbridge/expr.NodePb", (gogoproto.nullable) = true]; + bytes sourceQuote = 1; + bytes asQuoteByte = 2; + string originalAs = 3; + string left = 4; + string right = 5; + int32 parentIndex = 6; + int32 index = 7; + int32 sourceIndex = 8; + string sourceField = 9; + string as = 11; + string comment = 12; + string order = 13; + bool star = 14; + bool agg = 15; + expr.NodePb Expr = 16; + expr.NodePb Guard = 17; } message CommandColumnPb { - optional expr.NodePb Expr = 1 [(gogoproto.nullable) = true]; - required string name = 2 [(gogoproto.nullable) = false]; - //optional bytes Expr = 1 [(gogoproto.customtype) = "github.com/araddon/qlbridge/expr.NodePb", (gogoproto.nullable) = true]; + expr.NodePb Expr = 1; + string name = 2; } \ No newline at end of file