| 1 |
Only in /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/: arithmetic.go |
| 2 |
Only in /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/: arithmetic_test.go |
| 3 |
diff -u /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/bind_variables.go /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/bind_variables.go |
| 4 |
--- /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/bind_variables.go 2018-06-05 08:45:47.000000000 -0700 |
| 5 |
+++ /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/bind_variables.go 2018-06-04 08:05:24.000000000 -0700 |
| 6 |
@@ -19,11 +19,10 @@ |
| 7 |
import ( |
| 8 |
"errors" |
| 9 |
"fmt" |
| 10 |
+ "reflect" |
| 11 |
"strconv" |
| 12 |
|
| 13 |
- "github.com/golang/protobuf/proto" |
| 14 |
- |
| 15 |
- querypb "vitess.io/vitess/go/vt/proto/query" |
| 16 |
+ "github.com/xwb1989/sqlparser/dependency/querypb" |
| 17 |
) |
| 18 |
|
| 19 |
// NullBindVariable is a bindvar with NULL value. |
| 20 |
@@ -253,9 +252,8 @@ |
| 21 |
} |
| 22 |
|
| 23 |
// BindVariablesEqual compares two maps of bind variables. |
| 24 |
-// For protobuf messages we have to use "proto.Equal". |
| 25 |
func BindVariablesEqual(x, y map[string]*querypb.BindVariable) bool { |
| 26 |
- return proto.Equal(&querypb.BoundQuery{BindVariables: x}, &querypb.BoundQuery{BindVariables: y}) |
| 27 |
+ return reflect.DeepEqual(&querypb.BoundQuery{BindVariables: x}, &querypb.BoundQuery{BindVariables: y}) |
| 28 |
} |
| 29 |
|
| 30 |
// CopyBindVariables returns a shallow-copy of the given bindVariables map. |
| 31 |
diff -u /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/bind_variables_test.go /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/bind_variables_test.go |
| 32 |
--- /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/bind_variables_test.go 2018-06-05 08:45:47.000000000 -0700 |
| 33 |
+++ /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/bind_variables_test.go 2018-06-04 08:05:24.000000000 -0700 |
| 34 |
@@ -21,16 +21,14 @@ |
| 35 |
"strings" |
| 36 |
"testing" |
| 37 |
|
| 38 |
- "github.com/golang/protobuf/proto" |
| 39 |
- |
| 40 |
- querypb "vitess.io/vitess/go/vt/proto/query" |
| 41 |
+ "github.com/xwb1989/sqlparser/dependency/querypb" |
| 42 |
) |
| 43 |
|
| 44 |
func TestProtoConversions(t *testing.T) { |
| 45 |
v := TestValue(Int64, "1") |
| 46 |
got := ValueToProto(v) |
| 47 |
want := &querypb.Value{Type: Int64, Value: []byte("1")} |
| 48 |
- if !proto.Equal(got, want) { |
| 49 |
+ if !reflect.DeepEqual(got, want) { |
| 50 |
t.Errorf("ValueToProto: %v, want %v", got, want) |
| 51 |
} |
| 52 |
gotback := ProtoToValue(got) |
| 53 |
@@ -240,7 +238,7 @@ |
| 54 |
t.Errorf("ToBindVar(%T(%v)) error: nil, want %s", tcase.in, tcase.in, tcase.err) |
| 55 |
continue |
| 56 |
} |
| 57 |
- if !proto.Equal(bv, tcase.out) { |
| 58 |
+ if !reflect.DeepEqual(bv, tcase.out) { |
| 59 |
t.Errorf("ToBindVar(%T(%v)): %v, want %s", tcase.in, tcase.in, bv, tcase.out) |
| 60 |
} |
| 61 |
} |
| 62 |
@@ -523,7 +521,7 @@ |
| 63 |
v, err = BindVariableToValue(&querypb.BindVariable{Type: querypb.Type_TUPLE}) |
| 64 |
wantErr := "cannot convert a TUPLE bind var into a value" |
| 65 |
if err == nil || err.Error() != wantErr { |
| 66 |
- t.Errorf(" BindVarToValue(TUPLE): (%v, %v), want %s", v, err, wantErr) |
| 67 |
+ t.Errorf(" BindVarToValue(TUPLE): %v, want %s", err, wantErr) |
| 68 |
} |
| 69 |
} |
| 70 |
|
| 71 |
Only in /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/: event_token.go |
| 72 |
Only in /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/: event_token_test.go |
| 73 |
diff -u /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/plan_value.go /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/plan_value.go |
| 74 |
--- /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/plan_value.go 2018-06-05 08:45:47.000000000 -0700 |
| 75 |
+++ /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/plan_value.go 2018-06-04 08:05:24.000000000 -0700 |
| 76 |
@@ -18,10 +18,10 @@ |
| 77 |
|
| 78 |
import ( |
| 79 |
"encoding/json" |
| 80 |
+ "errors" |
| 81 |
+ "fmt" |
| 82 |
|
| 83 |
- querypb "vitess.io/vitess/go/vt/proto/query" |
| 84 |
- vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc" |
| 85 |
- "vitess.io/vitess/go/vt/vterrors" |
| 86 |
+ "github.com/xwb1989/sqlparser/dependency/querypb" |
| 87 |
) |
| 88 |
|
| 89 |
// PlanValue represents a value or a list of values for |
| 90 |
@@ -87,7 +87,7 @@ |
| 91 |
case pv.ListKey != "" || pv.Values != nil: |
| 92 |
// This code is unreachable because the parser does not allow |
| 93 |
// multi-value constructs where a single value is expected. |
| 94 |
- return NULL, vterrors.New(vtrpcpb.Code_INVALID_ARGUMENT, "a list was supplied where a single value was expected") |
| 95 |
+ return NULL, errors.New("a list was supplied where a single value was expected") |
| 96 |
} |
| 97 |
return NULL, nil |
| 98 |
} |
| 99 |
@@ -95,10 +95,10 @@ |
| 100 |
func (pv PlanValue) lookupValue(bindVars map[string]*querypb.BindVariable) (*querypb.BindVariable, error) { |
| 101 |
bv, ok := bindVars[pv.Key] |
| 102 |
if !ok { |
| 103 |
- return nil, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "missing bind var %s", pv.Key) |
| 104 |
+ return nil, fmt.Errorf("missing bind var %s", pv.Key) |
| 105 |
} |
| 106 |
if bv.Type == querypb.Type_TUPLE { |
| 107 |
- return nil, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "TUPLE was supplied for single value bind var %s", pv.ListKey) |
| 108 |
+ return nil, fmt.Errorf("TUPLE was supplied for single value bind var %s", pv.ListKey) |
| 109 |
} |
| 110 |
return bv, nil |
| 111 |
} |
| 112 |
@@ -129,16 +129,16 @@ |
| 113 |
} |
| 114 |
// This code is unreachable because the parser does not allow |
| 115 |
// single value constructs where multiple values are expected. |
| 116 |
- return nil, vterrors.New(vtrpcpb.Code_INVALID_ARGUMENT, "a single value was supplied where a list was expected") |
| 117 |
+ return nil, errors.New("a single value was supplied where a list was expected") |
| 118 |
} |
| 119 |
|
| 120 |
func (pv PlanValue) lookupList(bindVars map[string]*querypb.BindVariable) (*querypb.BindVariable, error) { |
| 121 |
bv, ok := bindVars[pv.ListKey] |
| 122 |
if !ok { |
| 123 |
- return nil, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "missing bind var %s", pv.ListKey) |
| 124 |
+ return nil, fmt.Errorf("missing bind var %s", pv.ListKey) |
| 125 |
} |
| 126 |
if bv.Type != querypb.Type_TUPLE { |
| 127 |
- return nil, vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "single value was supplied for TUPLE bind var %s", pv.ListKey) |
| 128 |
+ return nil, fmt.Errorf("single value was supplied for TUPLE bind var %s", pv.ListKey) |
| 129 |
} |
| 130 |
return bv, nil |
| 131 |
} |
| 132 |
@@ -171,7 +171,7 @@ |
| 133 |
case l: |
| 134 |
return nil |
| 135 |
default: |
| 136 |
- return vterrors.New(vtrpcpb.Code_INVALID_ARGUMENT, "mismatch in number of column values") |
| 137 |
+ return errors.New("mismatch in number of column values") |
| 138 |
} |
| 139 |
} |
| 140 |
|
| 141 |
@@ -221,7 +221,7 @@ |
| 142 |
rows[i] = make([]Value, len(pvs)) |
| 143 |
} |
| 144 |
|
| 145 |
- // Using j because we're resolving by columns. |
| 146 |
+ // Using j becasue we're resolving by columns. |
| 147 |
for j, pv := range pvs { |
| 148 |
switch { |
| 149 |
case pv.Key != "": |
| 150 |
diff -u /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/plan_value_test.go /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/plan_value_test.go |
| 151 |
--- /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/plan_value_test.go 2018-06-05 08:45:47.000000000 -0700 |
| 152 |
+++ /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/plan_value_test.go 2018-06-04 08:05:24.000000000 -0700 |
| 153 |
@@ -21,7 +21,7 @@ |
| 154 |
"strings" |
| 155 |
"testing" |
| 156 |
|
| 157 |
- querypb "vitess.io/vitess/go/vt/proto/query" |
| 158 |
+ "github.com/xwb1989/sqlparser/dependency/querypb" |
| 159 |
) |
| 160 |
|
| 161 |
func TestPlanValueIsNull(t *testing.T) { |
| 162 |
Only in /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/: proto3.go |
| 163 |
Only in /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/: proto3_test.go |
| 164 |
Only in /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/: query_response.go |
| 165 |
Only in /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/: result.go |
| 166 |
Only in /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/: result_test.go |
| 167 |
diff -u /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/testing.go /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/testing.go |
| 168 |
--- /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/testing.go 2018-06-05 08:45:47.000000000 -0700 |
| 169 |
+++ /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/testing.go 2018-06-04 08:06:27.000000000 -0700 |
| 170 |
@@ -17,17 +17,14 @@ |
| 171 |
package sqltypes |
| 172 |
|
| 173 |
import ( |
| 174 |
- "bytes" |
| 175 |
- "fmt" |
| 176 |
- "strings" |
| 177 |
- |
| 178 |
- querypb "vitess.io/vitess/go/vt/proto/query" |
| 179 |
+ querypb "github.com/xwb1989/sqlparser/dependency/querypb" |
| 180 |
) |
| 181 |
|
| 182 |
// Functions in this file should only be used for testing. |
| 183 |
// This is an experiment to see if test code bloat can be |
| 184 |
// reduced and readability improved. |
| 185 |
|
| 186 |
+/* |
| 187 |
// MakeTestFields builds a []*querypb.Field for testing. |
| 188 |
// fields := sqltypes.MakeTestFields( |
| 189 |
// "a|b", |
| 190 |
@@ -110,6 +107,7 @@ |
| 191 |
} |
| 192 |
return results |
| 193 |
} |
| 194 |
+*/ |
| 195 |
|
| 196 |
// TestBindVariable makes a *querypb.BindVariable from |
| 197 |
// an interface{}.It panics on invalid input. |
| 198 |
@@ -131,6 +129,7 @@ |
| 199 |
return MakeTrusted(typ, []byte(val)) |
| 200 |
} |
| 201 |
|
| 202 |
+/* |
| 203 |
// PrintResults prints []*Results into a string. |
| 204 |
// This function should only be used for testing. |
| 205 |
func PrintResults(results []*Result) string { |
| 206 |
@@ -152,3 +151,4 @@ |
| 207 |
} |
| 208 |
return splits |
| 209 |
} |
| 210 |
+*/ |
| 211 |
diff -u /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/type.go /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/type.go |
| 212 |
--- /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/type.go 2018-06-05 08:45:47.000000000 -0700 |
| 213 |
+++ /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/type.go 2018-06-04 08:05:24.000000000 -0700 |
| 214 |
@@ -19,7 +19,7 @@ |
| 215 |
import ( |
| 216 |
"fmt" |
| 217 |
|
| 218 |
- querypb "vitess.io/vitess/go/vt/proto/query" |
| 219 |
+ "github.com/xwb1989/sqlparser/dependency/querypb" |
| 220 |
) |
| 221 |
|
| 222 |
// This file provides wrappers and support |
| 223 |
diff -u /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/type_test.go /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/type_test.go |
| 224 |
--- /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/type_test.go 2018-06-05 08:45:47.000000000 -0700 |
| 225 |
+++ /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/type_test.go 2018-06-04 08:05:24.000000000 -0700 |
| 226 |
@@ -19,7 +19,7 @@ |
| 227 |
import ( |
| 228 |
"testing" |
| 229 |
|
| 230 |
- querypb "vitess.io/vitess/go/vt/proto/query" |
| 231 |
+ "github.com/xwb1989/sqlparser/dependency/querypb" |
| 232 |
) |
| 233 |
|
| 234 |
func TestTypeValues(t *testing.T) { |
| 235 |
diff -u /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/value.go /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/value.go |
| 236 |
--- /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/value.go 2018-06-05 08:45:47.000000000 -0700 |
| 237 |
+++ /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/value.go 2018-06-04 08:05:24.000000000 -0700 |
| 238 |
@@ -23,10 +23,10 @@ |
| 239 |
"fmt" |
| 240 |
"strconv" |
| 241 |
|
| 242 |
- "vitess.io/vitess/go/bytes2" |
| 243 |
- "vitess.io/vitess/go/hack" |
| 244 |
+ "github.com/xwb1989/sqlparser/dependency/bytes2" |
| 245 |
+ "github.com/xwb1989/sqlparser/dependency/hack" |
| 246 |
|
| 247 |
- querypb "vitess.io/vitess/go/vt/proto/query" |
| 248 |
+ "github.com/xwb1989/sqlparser/dependency/querypb" |
| 249 |
) |
| 250 |
|
| 251 |
var ( |
| 252 |
@@ -48,7 +48,7 @@ |
| 253 |
} |
| 254 |
|
| 255 |
// Value can store any SQL value. If the value represents |
| 256 |
-// an integral type, the bytes are always stored as a canonical |
| 257 |
+// an integral type, the bytes are always stored as a cannonical |
| 258 |
// representation that matches how MySQL returns such values. |
| 259 |
type Value struct { |
| 260 |
typ querypb.Type |
| 261 |
@@ -126,7 +126,7 @@ |
| 262 |
return MakeTrusted(VarBinary, []byte(v)) |
| 263 |
} |
| 264 |
|
| 265 |
-// NewIntegral builds an integral type from a string representation. |
| 266 |
+// NewIntegral builds an integral type from a string representaion. |
| 267 |
// The type will be Int64 or Uint64. Int64 will be preferred where possible. |
| 268 |
func NewIntegral(val string) (n Value, err error) { |
| 269 |
signed, err := strconv.ParseInt(val, 0, 64) |
| 270 |
@@ -169,7 +169,7 @@ |
| 271 |
return v.typ |
| 272 |
} |
| 273 |
|
| 274 |
-// Raw returns the internal representation of the value. For newer types, |
| 275 |
+// Raw returns the internal represenation of the value. For newer types, |
| 276 |
// this may not match MySQL's representation. |
| 277 |
func (v Value) Raw() []byte { |
| 278 |
return v.val |
| 279 |
diff -u /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/value_test.go /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/value_test.go |
| 280 |
--- /Users/bramp/go/src/vitess.io/vitess/go//sqltypes/value_test.go 2018-06-05 08:45:47.000000000 -0700 |
| 281 |
+++ /Users/bramp/go/src/github.com/xwb1989/sqlparser//dependency/sqltypes/value_test.go 2018-06-04 08:05:24.000000000 -0700 |
| 282 |
@@ -22,7 +22,7 @@ |
| 283 |
"strings" |
| 284 |
"testing" |
| 285 |
|
| 286 |
- querypb "vitess.io/vitess/go/vt/proto/query" |
| 287 |
+ "github.com/xwb1989/sqlparser/dependency/querypb" |
| 288 |
) |
| 289 |
|
| 290 |
const ( |