mirror of
https://github.com/chaisql/chai.git
synced 2025-10-17 05:00:46 +08:00
clean up some docs and code, including: (#479)
- typo fixes - docstring format fixes - unused variables fixes - introducing first usages of testutil.ParseDocumentPaths function, which was previously unused
This commit is contained in:
@@ -108,11 +108,11 @@ func (e *NamedExpr) String() string {
|
|||||||
type Function interface {
|
type Function interface {
|
||||||
Expr
|
Expr
|
||||||
|
|
||||||
// Returns the list of parameters this function has received.
|
// Params returns the list of parameters this function has received.
|
||||||
Params() []Expr
|
Params() []Expr
|
||||||
}
|
}
|
||||||
|
|
||||||
// A Aggregator is an expression that aggregates documents into one result.
|
// An Aggregator is an expression that aggregates documents into one result.
|
||||||
type Aggregator interface {
|
type Aggregator interface {
|
||||||
Expr
|
Expr
|
||||||
|
|
||||||
|
@@ -241,7 +241,7 @@ func (c *CountAggregator) Aggregate(env *environment.Environment) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Eval returns the result of the aggregation as an integer.
|
// Eval returns the result of the aggregation as an integer.
|
||||||
func (c *CountAggregator) Eval(env *environment.Environment) (types.Value, error) {
|
func (c *CountAggregator) Eval(_ *environment.Environment) (types.Value, error) {
|
||||||
return types.NewIntegerValue(c.Count), nil
|
return types.NewIntegerValue(c.Count), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -342,7 +342,7 @@ func (m *MinAggregator) Aggregate(env *environment.Environment) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Eval return the minimum value.
|
// Eval return the minimum value.
|
||||||
func (m *MinAggregator) Eval(env *environment.Environment) (types.Value, error) {
|
func (m *MinAggregator) Eval(_ *environment.Environment) (types.Value, error) {
|
||||||
if m.Min == nil {
|
if m.Min == nil {
|
||||||
return types.NewNullValue(), nil
|
return types.NewNullValue(), nil
|
||||||
}
|
}
|
||||||
@@ -446,7 +446,7 @@ func (m *MaxAggregator) Aggregate(env *environment.Environment) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Eval return the maximum value.
|
// Eval return the maximum value.
|
||||||
func (m *MaxAggregator) Eval(env *environment.Environment) (types.Value, error) {
|
func (m *MaxAggregator) Eval(_ *environment.Environment) (types.Value, error) {
|
||||||
if m.Max == nil {
|
if m.Max == nil {
|
||||||
return types.NewNullValue(), nil
|
return types.NewNullValue(), nil
|
||||||
}
|
}
|
||||||
@@ -553,7 +553,7 @@ func (s *SumAggregator) Aggregate(env *environment.Environment) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Eval return the aggregated sum.
|
// Eval return the aggregated sum.
|
||||||
func (s *SumAggregator) Eval(env *environment.Environment) (types.Value, error) {
|
func (s *SumAggregator) Eval(_ *environment.Environment) (types.Value, error) {
|
||||||
if s.SumF != nil {
|
if s.SumF != nil {
|
||||||
return types.NewDoubleValue(*s.SumF), nil
|
return types.NewDoubleValue(*s.SumF), nil
|
||||||
}
|
}
|
||||||
@@ -641,7 +641,7 @@ func (s *AvgAggregator) Aggregate(env *environment.Environment) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Eval returns the aggregated average as a double.
|
// Eval returns the aggregated average as a double.
|
||||||
func (s *AvgAggregator) Eval(env *environment.Environment) (types.Value, error) {
|
func (s *AvgAggregator) Eval(_ *environment.Environment) (types.Value, error) {
|
||||||
if s.Counter == 0 {
|
if s.Counter == 0 {
|
||||||
return types.NewDoubleValue(0), nil
|
return types.NewDoubleValue(0), nil
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// A ScalarDefinition is the definition type for functions which operates on scalar values in contrast to other SQL functions
|
// A ScalarDefinition is the definition type for functions which operates on scalar values in contrast to other SQL functions
|
||||||
// such as the SUM aggregator wich operates on expressions instead.
|
// such as the SUM aggregator which operates on expressions instead.
|
||||||
//
|
//
|
||||||
// This difference allows to simply define them with a CallFn function that takes multiple document.Value and
|
// This difference allows to simply define them with a CallFn function that takes multiple document.Value and
|
||||||
// return another types.Value, rather than having to manually evaluate expressions (see Definition).
|
// return another types.Value, rather than having to manually evaluate expressions (see Definition).
|
||||||
|
@@ -14,8 +14,7 @@ type StreamStmt struct {
|
|||||||
ReadOnly bool
|
ReadOnly bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run returns a result containing the stream. The stream will be executed by calling the Iterate method of
|
// Prepare implements the Preparer interface.
|
||||||
// the result.
|
|
||||||
func (s *StreamStmt) Prepare(ctx *Context) (Statement, error) {
|
func (s *StreamStmt) Prepare(ctx *Context) (Statement, error) {
|
||||||
st, err := planner.Optimize(s.Stream, ctx.Catalog)
|
st, err := planner.Optimize(s.Stream, ctx.Catalog)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@@ -101,7 +101,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
testutil.MakeDocuments(t, `{"a": 1, "b": 2}`, `{"a": 2, "b": 2}`),
|
testutil.MakeDocuments(t, `{"a": 1, "b": 2}`, `{"a": 2, "b": 2}`),
|
||||||
testutil.MakeDocuments(t, `{"a": 2, "b": 2}`),
|
testutil.MakeDocuments(t, `{"a": 2, "b": 2}`),
|
||||||
stream.Ranges{
|
stream.Ranges{
|
||||||
stream.Range{Max: testutil.ExprList(t, `[2, 2]`), Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")}},
|
stream.Range{Max: testutil.ExprList(t, `[2, 2]`), Paths: testutil.ParseDocumentPaths(t, "a", "b")},
|
||||||
},
|
},
|
||||||
false, false,
|
false, false,
|
||||||
},
|
},
|
||||||
@@ -110,7 +110,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
testutil.MakeDocuments(t, `{"a": 1, "b": 2}`, `{"a": 2, "b": 2}`),
|
testutil.MakeDocuments(t, `{"a": 1, "b": 2}`, `{"a": 2, "b": 2}`),
|
||||||
testutil.MakeDocuments(t, `{"a": 2, "b": 2}`),
|
testutil.MakeDocuments(t, `{"a": 2, "b": 2}`),
|
||||||
stream.Ranges{
|
stream.Ranges{
|
||||||
stream.Range{Max: testutil.ExprList(t, `[2, 2.2]`), Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")}},
|
stream.Range{Max: testutil.ExprList(t, `[2, 2.2]`), Paths: testutil.ParseDocumentPaths(t, "a", "b")},
|
||||||
},
|
},
|
||||||
false, false,
|
false, false,
|
||||||
},
|
},
|
||||||
@@ -128,7 +128,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
testutil.MakeDocuments(t, `{"a": 1, "b": 2}`, `{"a": 2, "b": 2}`),
|
testutil.MakeDocuments(t, `{"a": 1, "b": 2}`, `{"a": 2, "b": 2}`),
|
||||||
testutil.MakeDocuments(t, `{"a": 1, "b": 2}`),
|
testutil.MakeDocuments(t, `{"a": 1, "b": 2}`),
|
||||||
stream.Ranges{
|
stream.Ranges{
|
||||||
stream.Range{Max: testutil.ExprList(t, `[1, 2]`), Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")}},
|
stream.Range{Max: testutil.ExprList(t, `[1, 2]`), Paths: testutil.ParseDocumentPaths(t, "a", "b")},
|
||||||
},
|
},
|
||||||
false, false,
|
false, false,
|
||||||
},
|
},
|
||||||
@@ -137,7 +137,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
testutil.MakeDocuments(t, `{"a": 1, "b": 2}`, `{"a": 2, "b": 2}`),
|
testutil.MakeDocuments(t, `{"a": 1, "b": 2}`, `{"a": 2, "b": 2}`),
|
||||||
testutil.MakeDocuments(t),
|
testutil.MakeDocuments(t),
|
||||||
stream.Ranges{
|
stream.Ranges{
|
||||||
stream.Range{Max: testutil.ExprList(t, `[1.1, 2]`), Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")}},
|
stream.Range{Max: testutil.ExprList(t, `[1.1, 2]`), Paths: testutil.ParseDocumentPaths(t, "a", "b")},
|
||||||
},
|
},
|
||||||
false, false,
|
false, false,
|
||||||
},
|
},
|
||||||
@@ -164,7 +164,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
testutil.MakeDocuments(t, `{"a": 1, "b": 1}`, `{"a": 2, "b": 2}`),
|
testutil.MakeDocuments(t, `{"a": 1, "b": 1}`, `{"a": 2, "b": 2}`),
|
||||||
testutil.MakeDocuments(t, `{"a": 2, "b": 2}`),
|
testutil.MakeDocuments(t, `{"a": 2, "b": 2}`),
|
||||||
stream.Ranges{
|
stream.Ranges{
|
||||||
stream.Range{Min: testutil.ExprList(t, `[1]`), Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")}, Exclusive: true},
|
stream.Range{Min: testutil.ExprList(t, `[1]`), Paths: testutil.ParseDocumentPaths(t, "a", "b"), Exclusive: true},
|
||||||
},
|
},
|
||||||
false, false,
|
false, false,
|
||||||
},
|
},
|
||||||
@@ -175,7 +175,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
stream.Ranges{
|
stream.Ranges{
|
||||||
stream.Range{
|
stream.Range{
|
||||||
Min: testutil.ExprList(t, `[2, 1]`),
|
Min: testutil.ExprList(t, `[2, 1]`),
|
||||||
Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")},
|
Paths: testutil.ParseDocumentPaths(t, "a", "b"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
false, false,
|
false, false,
|
||||||
@@ -187,7 +187,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
stream.Ranges{
|
stream.Ranges{
|
||||||
stream.Range{
|
stream.Range{
|
||||||
Min: testutil.ExprList(t, `[2, 1.5]`),
|
Min: testutil.ExprList(t, `[2, 1.5]`),
|
||||||
Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")},
|
Paths: testutil.ParseDocumentPaths(t, "a", "b"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
false, false,
|
false, false,
|
||||||
@@ -213,7 +213,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
stream.Range{
|
stream.Range{
|
||||||
Min: testutil.ExprList(t, `[1, 1]`),
|
Min: testutil.ExprList(t, `[1, 1]`),
|
||||||
Max: testutil.ExprList(t, `[2, 2]`),
|
Max: testutil.ExprList(t, `[2, 2]`),
|
||||||
Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")},
|
Paths: testutil.ParseDocumentPaths(t, "a", "b"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
false, false,
|
false, false,
|
||||||
@@ -226,7 +226,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
stream.Range{
|
stream.Range{
|
||||||
Min: testutil.ExprList(t, `[1, 1]`),
|
Min: testutil.ExprList(t, `[1, 1]`),
|
||||||
Max: testutil.ExprList(t, `[2, 2]`),
|
Max: testutil.ExprList(t, `[2, 2]`),
|
||||||
Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")},
|
Paths: testutil.ParseDocumentPaths(t, "a", "b"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
false, false,
|
false, false,
|
||||||
@@ -253,7 +253,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
stream.Ranges{
|
stream.Ranges{
|
||||||
stream.Range{
|
stream.Range{
|
||||||
Max: testutil.ExprList(t, `[2, 2]`),
|
Max: testutil.ExprList(t, `[2, 2]`),
|
||||||
Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")},
|
Paths: testutil.ParseDocumentPaths(t, "a", "b"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
true, false,
|
true, false,
|
||||||
@@ -283,7 +283,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
stream.Ranges{
|
stream.Ranges{
|
||||||
stream.Range{
|
stream.Range{
|
||||||
Min: testutil.ExprList(t, `[1, 1]`),
|
Min: testutil.ExprList(t, `[1, 1]`),
|
||||||
Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")},
|
Paths: testutil.ParseDocumentPaths(t, "a", "b"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
true, false,
|
true, false,
|
||||||
@@ -309,7 +309,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
stream.Range{
|
stream.Range{
|
||||||
Min: testutil.ExprList(t, `[1, 1]`),
|
Min: testutil.ExprList(t, `[1, 1]`),
|
||||||
Max: testutil.ExprList(t, `[2, 2]`),
|
Max: testutil.ExprList(t, `[2, 2]`),
|
||||||
Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")},
|
Paths: testutil.ParseDocumentPaths(t, "a", "b"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
true, false,
|
true, false,
|
||||||
@@ -321,7 +321,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
stream.Ranges{
|
stream.Ranges{
|
||||||
stream.Range{
|
stream.Range{
|
||||||
Max: testutil.ExprList(t, `[1]`),
|
Max: testutil.ExprList(t, `[1]`),
|
||||||
Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")},
|
Paths: testutil.ParseDocumentPaths(t, "a", "b"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
false, false,
|
false, false,
|
||||||
@@ -335,7 +335,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
Max: testutil.ExprList(t, `[1]`),
|
Max: testutil.ExprList(t, `[1]`),
|
||||||
Exclusive: false,
|
Exclusive: false,
|
||||||
Exact: false,
|
Exact: false,
|
||||||
Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")},
|
Paths: testutil.ParseDocumentPaths(t, "a", "b"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
true, false,
|
true, false,
|
||||||
@@ -346,7 +346,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
testutil.MakeDocuments(t, `{"a": 1, "b": 2, "c": 1}`, `{"a": 1, "b": 2, "c": 9223372036854775807}`),
|
testutil.MakeDocuments(t, `{"a": 1, "b": 2, "c": 1}`, `{"a": 1, "b": 2, "c": 9223372036854775807}`),
|
||||||
stream.Ranges{
|
stream.Ranges{
|
||||||
stream.Range{
|
stream.Range{
|
||||||
Max: testutil.ExprList(t, `[1, 2]`), Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b"), testutil.ParseDocumentPath(t, "c")},
|
Max: testutil.ExprList(t, `[1, 2]`), Paths: testutil.ParseDocumentPaths(t, "a", "b", "c"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
false, false,
|
false, false,
|
||||||
@@ -356,7 +356,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
testutil.MakeDocuments(t, `{"a": 1, "b": -2}`, `{"a": -2, "b": 2}`, `{"a": 1, "b": 1}`),
|
testutil.MakeDocuments(t, `{"a": 1, "b": -2}`, `{"a": -2, "b": 2}`, `{"a": 1, "b": 1}`),
|
||||||
testutil.MakeDocuments(t, `{"a": 1, "b": -2}`, `{"a": 1, "b": 1}`),
|
testutil.MakeDocuments(t, `{"a": 1, "b": -2}`, `{"a": 1, "b": 1}`),
|
||||||
stream.Ranges{
|
stream.Ranges{
|
||||||
stream.Range{Min: testutil.ExprList(t, `[1]`), Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")}},
|
stream.Range{Min: testutil.ExprList(t, `[1]`), Paths: testutil.ParseDocumentPaths(t, "a", "b")},
|
||||||
},
|
},
|
||||||
false, false,
|
false, false,
|
||||||
},
|
},
|
||||||
@@ -365,7 +365,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
testutil.MakeDocuments(t, `{"a": 1, "b": -2, "c": 0}`, `{"a": -2, "b": 2, "c": 1}`, `{"a": 1, "b": 1, "c": 2}`),
|
testutil.MakeDocuments(t, `{"a": 1, "b": -2, "c": 0}`, `{"a": -2, "b": 2, "c": 1}`, `{"a": 1, "b": 1, "c": 2}`),
|
||||||
testutil.MakeDocuments(t, `{"a": 1, "b": -2, "c": 0}`, `{"a": 1, "b": 1, "c": 2}`),
|
testutil.MakeDocuments(t, `{"a": 1, "b": -2, "c": 0}`, `{"a": 1, "b": 1, "c": 2}`),
|
||||||
stream.Ranges{
|
stream.Ranges{
|
||||||
stream.Range{Min: testutil.ExprList(t, `[1]`), Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b"), testutil.ParseDocumentPath(t, "c")}},
|
stream.Range{Min: testutil.ExprList(t, `[1]`), Paths: testutil.ParseDocumentPaths(t, "a", "b", "c")},
|
||||||
},
|
},
|
||||||
false, false,
|
false, false,
|
||||||
},
|
},
|
||||||
@@ -374,7 +374,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
testutil.MakeDocuments(t, `{"a": 1, "b": -2}`, `{"a": -2, "b": 2}`, `{"a": 1, "b": 1}`),
|
testutil.MakeDocuments(t, `{"a": 1, "b": -2}`, `{"a": -2, "b": 2}`, `{"a": 1, "b": 1}`),
|
||||||
testutil.MakeDocuments(t, `{"a": 1, "b": 1}`, `{"a": 1, "b": -2}`),
|
testutil.MakeDocuments(t, `{"a": 1, "b": 1}`, `{"a": 1, "b": -2}`),
|
||||||
stream.Ranges{
|
stream.Ranges{
|
||||||
stream.Range{Min: testutil.ExprList(t, `[1]`), Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")}},
|
stream.Range{Min: testutil.ExprList(t, `[1]`), Paths: testutil.ParseDocumentPaths(t, "a", "b")},
|
||||||
},
|
},
|
||||||
true, false,
|
true, false,
|
||||||
},
|
},
|
||||||
@@ -386,7 +386,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
stream.Range{
|
stream.Range{
|
||||||
Min: testutil.ExprList(t, `[1]`),
|
Min: testutil.ExprList(t, `[1]`),
|
||||||
Max: testutil.ExprList(t, `[2]`),
|
Max: testutil.ExprList(t, `[2]`),
|
||||||
Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")},
|
Paths: testutil.ParseDocumentPaths(t, "a", "b"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
false, false,
|
false, false,
|
||||||
@@ -399,7 +399,7 @@ func testIndexScan(t *testing.T, getOp func(db *database.Database, tx *database.
|
|||||||
stream.Range{
|
stream.Range{
|
||||||
Min: testutil.ExprList(t, `[1]`),
|
Min: testutil.ExprList(t, `[1]`),
|
||||||
Max: testutil.ExprList(t, `[2]`),
|
Max: testutil.ExprList(t, `[2]`),
|
||||||
Paths: []document.Path{testutil.ParseDocumentPath(t, "a"), testutil.ParseDocumentPath(t, "b")},
|
Paths: testutil.ParseDocumentPaths(t, "a", "b"),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
true, false,
|
true, false,
|
||||||
|
@@ -192,7 +192,7 @@ func ExprRunner(t *testing.T, testfile string) {
|
|||||||
} else {
|
} else {
|
||||||
t.Run("NOK "+stmt.Expr, func(t *testing.T) {
|
t.Run("NOK "+stmt.Expr, func(t *testing.T) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
// parse the given epxr
|
// parse the given expr
|
||||||
e, err := parser.NewParser(strings.NewReader(stmt.Expr)).ParseExpr()
|
e, err := parser.NewParser(strings.NewReader(stmt.Expr)).ParseExpr()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
require.Regexp(t, regexp.MustCompile(regexp.QuoteMeta(stmt.Res)), err.Error())
|
require.Regexp(t, regexp.MustCompile(regexp.QuoteMeta(stmt.Res)), err.Error())
|
||||||
|
@@ -20,7 +20,7 @@ type ValueType uint8
|
|||||||
|
|
||||||
// List of supported value types.
|
// List of supported value types.
|
||||||
const (
|
const (
|
||||||
// denote the absence of type
|
// AnyValue denotes the absence of type
|
||||||
AnyValue ValueType = 0x00
|
AnyValue ValueType = 0x00
|
||||||
|
|
||||||
NullValue ValueType = 0x05
|
NullValue ValueType = 0x05
|
||||||
@@ -87,7 +87,7 @@ type Document interface {
|
|||||||
// If the given function returns an error, the iteration stops.
|
// If the given function returns an error, the iteration stops.
|
||||||
Iterate(fn func(field string, value Value) error) error
|
Iterate(fn func(field string, value Value) error) error
|
||||||
// GetByField returns a value by field name.
|
// GetByField returns a value by field name.
|
||||||
// Must return ErrFieldNotFound if the field doesnt exist.
|
// Must return ErrFieldNotFound if the field doesn't exist.
|
||||||
GetByField(field string) (Value, error)
|
GetByField(field string) (Value, error)
|
||||||
|
|
||||||
// MarshalJSON implements the json.Marshaler interface.
|
// MarshalJSON implements the json.Marshaler interface.
|
||||||
|
Reference in New Issue
Block a user