Skip to content

Commit e36471f

Browse files
naming optimization (#33)
* refactor(build/query): - rename the Builder's Add method to KeyValue. - rename the BsonBuilder function to NewBuilder. * refactor(build/update): - rename the Builder's Add method to KeyValue. - rename the BsonBuilder function to NewBuilder.
1 parent f0298af commit e36471f

14 files changed

+228
-228
lines changed

aggregator/aggregator_e2e_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ func TestAggregator_e2e_AggregateWithParse(t *testing.T) {
267267
require.ElementsMatch(t, []any{"1", "2"}, insertManyResult.InsertedIDs)
268268
},
269269
after: func(ctx context.Context, t *testing.T) {
270-
deleteResult, err := collection.DeleteMany(ctx, query.BsonBuilder().InString("_id", []string{"1", "2"}...).Build())
270+
deleteResult, err := collection.DeleteMany(ctx, query.NewBuilder().InString("_id", []string{"1", "2"}...).Build())
271271
require.NoError(t, err)
272272
require.Equal(t, int64(2), deleteResult.DeletedCount)
273273
},
@@ -291,7 +291,7 @@ func TestAggregator_e2e_AggregateWithParse(t *testing.T) {
291291
require.ElementsMatch(t, []any{"1", "2"}, insertManyResult.InsertedIDs)
292292
},
293293
after: func(ctx context.Context, t *testing.T) {
294-
deleteResult, err := collection.DeleteMany(ctx, query.BsonBuilder().InString("_id", []string{"1", "2"}...).Build())
294+
deleteResult, err := collection.DeleteMany(ctx, query.NewBuilder().InString("_id", []string{"1", "2"}...).Build())
295295
require.NoError(t, err)
296296
require.Equal(t, int64(2), deleteResult.DeletedCount)
297297
},
@@ -316,7 +316,7 @@ func TestAggregator_e2e_AggregateWithParse(t *testing.T) {
316316
require.ElementsMatch(t, []any{"1", "2"}, insertManyResult.InsertedIDs)
317317
},
318318
after: func(ctx context.Context, t *testing.T) {
319-
deleteResult, err := collection.DeleteMany(ctx, query.BsonBuilder().InString("_id", []string{"1", "2"}...).Build())
319+
deleteResult, err := collection.DeleteMany(ctx, query.NewBuilder().InString("_id", []string{"1", "2"}...).Build())
320320
require.NoError(t, err)
321321
require.Equal(t, int64(2), deleteResult.DeletedCount)
322322
},

builder/aggregation/logical_builder_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func Test_logicalBuilder_OrWithoutKey(t *testing.T) {
115115
},
116116
{
117117
name: "normal expressions",
118-
expressions: []any{query.BsonBuilder().Eq("x", 0).Build(), query.BsonBuilder().Expr(NewBuilder().EqWithoutKey(NewBuilder().DivideWithoutKey(1, "$x").Build(), 3).Build()).Build()},
118+
expressions: []any{query.NewBuilder().Eq("x", 0).Build(), query.NewBuilder().Expr(NewBuilder().EqWithoutKey(NewBuilder().DivideWithoutKey(1, "$x").Build(), 3).Build()).Build()},
119119
expected: bson.D{bson.E{Key: "$or", Value: []any{bson.D{bson.E{Key: "x", Value: bson.D{bson.E{Key: "$eq", Value: 0}}}}, bson.D{bson.E{Key: "$expr", Value: bson.D{bson.E{Key: "$eq", Value: []any{bson.D{bson.E{Key: "$divide", Value: []any{1, "$x"}}}, 3}}}}}}}},
120120
},
121121
}

0 commit comments

Comments
 (0)