Skip to content

Commit ab6d3c1

Browse files
Merge pull request #36 from chenmingyong0423/feature/update
refactor: rename BsonBuilder to NewBuilder
2 parents 2cbe9d8 + 11f2d3b commit ab6d3c1

9 files changed

+120
-120
lines changed

builder/aggregation/aggregation_stage_builder_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,13 +576,13 @@ func TestStageBuilder_Facet(t *testing.T) {
576576
// //]
577577
// name: "replacementDocument of bson.D",
578578
// value: bsonx.NewD().
579-
// Add("categorizedByTags", StageBsonBuilder().Unwind("$tags", nil).SortByCount("$tags").Build()).
580-
// Add("categorizedByPrice", StageBsonBuilder().Match(
579+
// Add("categorizedByTags", StageNewBuilder().Unwind("$tags", nil).SortByCount("$tags").Build()).
580+
// Add("categorizedByPrice", StageNewBuilder().Match(
581581
// NewBuilder().KeyValue("price", NewBuilder().KeyValue("$exists", 1).Build()).Build()).Bucket("$price", []any{0, 150, 200, 300, 400}, &BucketOptions{
582582
// DefaultKey: "Other",
583583
// Output: NewBuilder().KeyValue("count", NewBuilder().Sum(1).Build()).KeyValue("titles", NewBuilder().Push("$title").Build()).Build(),
584584
// }).Build()).
585-
// Add("categorizedByYears(Auto)", StageBsonBuilder().BucketAuto("$year", 4, nil).Build()).Build(),
585+
// Add("categorizedByYears(Auto)", StageNewBuilder().BucketAuto("$year", 4, nil).Build()).Build(),
586586
// want: mongo.Pipeline{bson.D{bson.E{Key: "$facet", Value: bson.D{
587587
// bson.E{Key: "categorizedByTags", Value: mongo.Pipeline{
588588
// bson.D{bson.E{Key: "$unwind", Value: "$tags"}},

builder/query/array_query_builder_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func Test_arrayQueryBuilder_ElemMatch(t *testing.T) {
2525
assert.Equal(t, bson.D{{Key: "age", Value: bson.D{bson.E{Key: "$elemMatch", Value: bson.D{bson.E{Key: "$gt", Value: 1}}}}}}, NewBuilder().ElemMatch("age", NewBuilder().KeyValue("$gt", 1).Build()).Build())
2626
}
2727

28-
func TestBsonBuilder_All(t *testing.T) {
28+
func TestNewBuilder_All(t *testing.T) {
2929

3030
testCases := []struct {
3131
name string
@@ -80,7 +80,7 @@ func TestBsonBuilder_All(t *testing.T) {
8080
}
8181
}
8282

83-
func TestBsonBuilder_AllUint(t *testing.T) {
83+
func TestNewBuilder_AllUint(t *testing.T) {
8484

8585
testCases := []struct {
8686
name string
@@ -136,7 +136,7 @@ func TestBsonBuilder_AllUint(t *testing.T) {
136136
}
137137
}
138138

139-
func TestBsonBuilder_AllUint8(t *testing.T) {
139+
func TestNewBuilder_AllUint8(t *testing.T) {
140140

141141
testCases := []struct {
142142
name string
@@ -191,7 +191,7 @@ func TestBsonBuilder_AllUint8(t *testing.T) {
191191
}
192192
}
193193

194-
func TestBsonBuilder_AllUint16(t *testing.T) {
194+
func TestNewBuilder_AllUint16(t *testing.T) {
195195

196196
testCases := []struct {
197197
name string
@@ -246,7 +246,7 @@ func TestBsonBuilder_AllUint16(t *testing.T) {
246246
}
247247
}
248248

249-
func TestBsonBuilder_AllUint32(t *testing.T) {
249+
func TestNewBuilder_AllUint32(t *testing.T) {
250250

251251
testCases := []struct {
252252
name string
@@ -301,7 +301,7 @@ func TestBsonBuilder_AllUint32(t *testing.T) {
301301
}
302302
}
303303

304-
func TestBsonBuilder_AllUint64(t *testing.T) {
304+
func TestNewBuilder_AllUint64(t *testing.T) {
305305

306306
testCases := []struct {
307307
name string
@@ -356,7 +356,7 @@ func TestBsonBuilder_AllUint64(t *testing.T) {
356356
}
357357
}
358358

359-
func TestBsonBuilder_AllInt(t *testing.T) {
359+
func TestNewBuilder_AllInt(t *testing.T) {
360360

361361
testCases := []struct {
362362
name string
@@ -411,7 +411,7 @@ func TestBsonBuilder_AllInt(t *testing.T) {
411411
}
412412
}
413413

414-
func TestBsonBuilder_AllInt8(t *testing.T) {
414+
func TestNewBuilder_AllInt8(t *testing.T) {
415415

416416
testCases := []struct {
417417
name string
@@ -467,7 +467,7 @@ func TestBsonBuilder_AllInt8(t *testing.T) {
467467
}
468468
}
469469

470-
func TestBsonBuilder_AllInt16(t *testing.T) {
470+
func TestNewBuilder_AllInt16(t *testing.T) {
471471
testCases := []struct {
472472
name string
473473
key string
@@ -521,7 +521,7 @@ func TestBsonBuilder_AllInt16(t *testing.T) {
521521
}
522522
}
523523

524-
func TestBsonBuilder_AllInt32(t *testing.T) {
524+
func TestNewBuilder_AllInt32(t *testing.T) {
525525

526526
testCases := []struct {
527527
name string
@@ -576,7 +576,7 @@ func TestBsonBuilder_AllInt32(t *testing.T) {
576576
}
577577
}
578578

579-
func TestBsonBuilder_AllInt64(t *testing.T) {
579+
func TestNewBuilder_AllInt64(t *testing.T) {
580580

581581
testCases := []struct {
582582
name string
@@ -631,7 +631,7 @@ func TestBsonBuilder_AllInt64(t *testing.T) {
631631
}
632632
}
633633

634-
func TestBsonBuilder_AllFloat32(t *testing.T) {
634+
func TestNewBuilder_AllFloat32(t *testing.T) {
635635

636636
testCases := []struct {
637637
name string
@@ -686,7 +686,7 @@ func TestBsonBuilder_AllFloat32(t *testing.T) {
686686
}
687687
}
688688

689-
func TestBsonBuilder_AllFloat64(t *testing.T) {
689+
func TestNewBuilder_AllFloat64(t *testing.T) {
690690

691691
testCases := []struct {
692692
name string
@@ -741,7 +741,7 @@ func TestBsonBuilder_AllFloat64(t *testing.T) {
741741
}
742742
}
743743

744-
func TestBsonBuilder_AllString(t *testing.T) {
744+
func TestNewBuilder_AllString(t *testing.T) {
745745

746746
testCases := []struct {
747747
name string

builder/query/comparison_query_builder_test.go

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func Test_comparisonQueryBuilder(t *testing.T) {
4141
assert.Equal(t, bson.D{bson.E{Key: "k1", Value: bson.D{bson.E{Key: NeOp, Value: "v1"}}}}, NewBuilder().Ne("k1", "v1").Build())
4242
}
4343

44-
func TestBsonBuilder_In(t *testing.T) {
44+
func TestNewBuilder_In(t *testing.T) {
4545
testCases := []struct {
4646
name string
4747
key string
@@ -80,7 +80,7 @@ func TestBsonBuilder_In(t *testing.T) {
8080
}
8181
}
8282

83-
func TestBsonBuilder_InUint(t *testing.T) {
83+
func TestNewBuilder_InUint(t *testing.T) {
8484
testCases := []struct {
8585
name string
8686
key string
@@ -119,7 +119,7 @@ func TestBsonBuilder_InUint(t *testing.T) {
119119
}
120120
}
121121

122-
func TestBsonBuilder_InUint8(t *testing.T) {
122+
func TestNewBuilder_InUint8(t *testing.T) {
123123
testCases := []struct {
124124
name string
125125
key string
@@ -158,7 +158,7 @@ func TestBsonBuilder_InUint8(t *testing.T) {
158158
}
159159
}
160160

161-
func TestBsonBuilder_InUint16(t *testing.T) {
161+
func TestNewBuilder_InUint16(t *testing.T) {
162162
testCases := []struct {
163163
name string
164164
key string
@@ -197,7 +197,7 @@ func TestBsonBuilder_InUint16(t *testing.T) {
197197
}
198198
}
199199

200-
func TestBsonBuilder_InUint32(t *testing.T) {
200+
func TestNewBuilder_InUint32(t *testing.T) {
201201
testCases := []struct {
202202
name string
203203
key string
@@ -236,7 +236,7 @@ func TestBsonBuilder_InUint32(t *testing.T) {
236236
}
237237
}
238238

239-
func TestBsonBuilder_InUint64(t *testing.T) {
239+
func TestNewBuilder_InUint64(t *testing.T) {
240240
testCases := []struct {
241241
name string
242242
key string
@@ -275,7 +275,7 @@ func TestBsonBuilder_InUint64(t *testing.T) {
275275
}
276276
}
277277

278-
func TestBsonBuilder_InInt(t *testing.T) {
278+
func TestNewBuilder_InInt(t *testing.T) {
279279
testCases := []struct {
280280
name string
281281
key string
@@ -314,7 +314,7 @@ func TestBsonBuilder_InInt(t *testing.T) {
314314
}
315315
}
316316

317-
func TestBsonBuilder_InInt8(t *testing.T) {
317+
func TestNewBuilder_InInt8(t *testing.T) {
318318
testCases := []struct {
319319
name string
320320
key string
@@ -353,7 +353,7 @@ func TestBsonBuilder_InInt8(t *testing.T) {
353353
}
354354
}
355355

356-
func TestBsonBuilder_InInt16(t *testing.T) {
356+
func TestNewBuilder_InInt16(t *testing.T) {
357357
testCases := []struct {
358358
name string
359359
key string
@@ -392,7 +392,7 @@ func TestBsonBuilder_InInt16(t *testing.T) {
392392
}
393393
}
394394

395-
func TestBsonBuilder_InInt32(t *testing.T) {
395+
func TestNewBuilder_InInt32(t *testing.T) {
396396
testCases := []struct {
397397
name string
398398
key string
@@ -431,7 +431,7 @@ func TestBsonBuilder_InInt32(t *testing.T) {
431431
}
432432
}
433433

434-
func TestBsonBuilder_InInt64(t *testing.T) {
434+
func TestNewBuilder_InInt64(t *testing.T) {
435435
testCases := []struct {
436436
name string
437437
key string
@@ -470,7 +470,7 @@ func TestBsonBuilder_InInt64(t *testing.T) {
470470
}
471471
}
472472

473-
func TestBsonBuilder_InFloat32(t *testing.T) {
473+
func TestNewBuilder_InFloat32(t *testing.T) {
474474
testCases := []struct {
475475
name string
476476
key string
@@ -510,7 +510,7 @@ func TestBsonBuilder_InFloat32(t *testing.T) {
510510
}
511511
}
512512

513-
func TestBsonBuilder_InFloat64(t *testing.T) {
513+
func TestNewBuilder_InFloat64(t *testing.T) {
514514
testCases := []struct {
515515
name string
516516
key string
@@ -550,7 +550,7 @@ func TestBsonBuilder_InFloat64(t *testing.T) {
550550
}
551551
}
552552

553-
func TestBsonBuilder_InString(t *testing.T) {
553+
func TestNewBuilder_InString(t *testing.T) {
554554
testCases := []struct {
555555
name string
556556
key string
@@ -590,7 +590,7 @@ func TestBsonBuilder_InString(t *testing.T) {
590590
}
591591
}
592592

593-
func TestBsonBuilder_Nin(t *testing.T) {
593+
func TestNewBuilder_Nin(t *testing.T) {
594594
testCases := []struct {
595595
name string
596596
key string
@@ -629,7 +629,7 @@ func TestBsonBuilder_Nin(t *testing.T) {
629629
}
630630
}
631631

632-
func TestBsonBuilder_NinUint(t *testing.T) {
632+
func TestNewBuilder_NinUint(t *testing.T) {
633633
testCases := []struct {
634634
name string
635635
key string
@@ -669,7 +669,7 @@ func TestBsonBuilder_NinUint(t *testing.T) {
669669
}
670670
}
671671

672-
func TestBsonBuilder_NinUint8(t *testing.T) {
672+
func TestNewBuilder_NinUint8(t *testing.T) {
673673
testCases := []struct {
674674
name string
675675
key string
@@ -709,7 +709,7 @@ func TestBsonBuilder_NinUint8(t *testing.T) {
709709
}
710710
}
711711

712-
func TestBsonBuilder_NinUint16(t *testing.T) {
712+
func TestNewBuilder_NinUint16(t *testing.T) {
713713
testCases := []struct {
714714
name string
715715
key string
@@ -749,7 +749,7 @@ func TestBsonBuilder_NinUint16(t *testing.T) {
749749
}
750750
}
751751

752-
func TestBsonBuilder_NinUint32(t *testing.T) {
752+
func TestNewBuilder_NinUint32(t *testing.T) {
753753
testCases := []struct {
754754
name string
755755
key string
@@ -791,7 +791,7 @@ func TestBsonBuilder_NinUint32(t *testing.T) {
791791
}
792792
}
793793

794-
func TestBsonBuilder_NinUint64(t *testing.T) {
794+
func TestNewBuilder_NinUint64(t *testing.T) {
795795
testCases := []struct {
796796
name string
797797
key string
@@ -834,7 +834,7 @@ func TestBsonBuilder_NinUint64(t *testing.T) {
834834
}
835835
}
836836

837-
func TestBsonBuilder_NinInt(t *testing.T) {
837+
func TestNewBuilder_NinInt(t *testing.T) {
838838
testCases := []struct {
839839
name string
840840
key string
@@ -877,7 +877,7 @@ func TestBsonBuilder_NinInt(t *testing.T) {
877877
}
878878
}
879879

880-
func TestBsonBuilder_NinInt8(t *testing.T) {
880+
func TestNewBuilder_NinInt8(t *testing.T) {
881881
testCases := []struct {
882882
name string
883883
key string
@@ -920,7 +920,7 @@ func TestBsonBuilder_NinInt8(t *testing.T) {
920920
}
921921
}
922922

923-
func TestBsonBuilder_NinInt16(t *testing.T) {
923+
func TestNewBuilder_NinInt16(t *testing.T) {
924924
testCases := []struct {
925925
name string
926926
key string
@@ -963,7 +963,7 @@ func TestBsonBuilder_NinInt16(t *testing.T) {
963963
}
964964
}
965965

966-
func TestBsonBuilder_NinInt32(t *testing.T) {
966+
func TestNewBuilder_NinInt32(t *testing.T) {
967967
testCases := []struct {
968968
name string
969969
key string
@@ -1006,7 +1006,7 @@ func TestBsonBuilder_NinInt32(t *testing.T) {
10061006
}
10071007
}
10081008

1009-
func TestBsonBuilder_NinInt64(t *testing.T) {
1009+
func TestNewBuilder_NinInt64(t *testing.T) {
10101010
testCases := []struct {
10111011
name string
10121012
key string
@@ -1049,7 +1049,7 @@ func TestBsonBuilder_NinInt64(t *testing.T) {
10491049
}
10501050
}
10511051

1052-
func TestBsonBuilder_NinFloat32(t *testing.T) {
1052+
func TestNewBuilder_NinFloat32(t *testing.T) {
10531053
testCases := []struct {
10541054
name string
10551055
key string
@@ -1092,7 +1092,7 @@ func TestBsonBuilder_NinFloat32(t *testing.T) {
10921092
}
10931093
}
10941094

1095-
func TestBsonBuilder_NinFloat64(t *testing.T) {
1095+
func TestNewBuilder_NinFloat64(t *testing.T) {
10961096
testCases := []struct {
10971097
name string
10981098
key string
@@ -1135,7 +1135,7 @@ func TestBsonBuilder_NinFloat64(t *testing.T) {
11351135
}
11361136
}
11371137

1138-
func TestBsonBuilder_NinString(t *testing.T) {
1138+
func TestNewBuilder_NinString(t *testing.T) {
11391139
testCases := []struct {
11401140
name string
11411141
key string

0 commit comments

Comments
 (0)