Skip to content

Commit 721a981

Browse files
committed
task: replace pointy with native imp
1 parent da292b2 commit 721a981

File tree

4 files changed

+30
-42
lines changed

4 files changed

+30
-42
lines changed

appservices/appservices.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,3 +333,7 @@ func CheckResponse(r *http.Response) error {
333333

334334
return errorResponse
335335
}
336+
337+
func pointer[T any](x T) *T {
338+
return &x
339+
}

appservices/event_triggers_test.go

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"testing"
2222

2323
"github.com/go-test/deep"
24-
"github.com/openlyinc/pointy"
2524
)
2625

2726
func TestEventTriggers_List(t *testing.T) {
@@ -57,7 +56,7 @@ func TestEventTriggers_List(t *testing.T) {
5756
Type: "type",
5857
FunctionID: "1",
5958
FunctionName: "name",
60-
Disabled: pointy.Bool(false),
59+
Disabled: pointer(false),
6160
},
6261
}
6362

@@ -99,7 +98,7 @@ func TestEventTriggers_Get(t *testing.T) {
9998
Type: "type",
10099
FunctionID: "1",
101100
FunctionName: "name",
102-
Disabled: pointy.Bool(false),
101+
Disabled: pointer(false),
103102
}
104103

105104
if diff := deep.Equal(trigger, &expected); diff != nil {
@@ -118,20 +117,20 @@ func TestEventTriggers_CreateDatabase(t *testing.T) {
118117
Name: "Test event trigger",
119118
Type: "DATABASE",
120119
FunctionID: "60c2badbbd2b5c170e91292d",
121-
Disabled: pointy.Bool(false),
120+
Disabled: pointer(false),
122121
Config: &EventTriggerConfig{
123122
OperationTypes: []string{"INSERT", "UPDATE", "REPLACE", "DELETE"},
124123
Database: "database",
125124
Collection: "collection",
126125
ServiceID: "60c2badbbd2b5c170e91292c",
127126
Match: `{"updateDescription.updatedFields.status": {"$exists": true}}`,
128127
Project: `{"updateDescription.updatedFields.FieldA": 1, "operationType": 1}`,
129-
FullDocument: pointy.Bool(false),
130-
FullDocumentBeforeChange: pointy.Bool(false),
131-
TolerateResumeErrors: pointy.Bool(true),
132-
SkipCatchupEvents: pointy.Bool(true),
133-
MaximumThroughput: pointy.Bool(true),
134-
Unordered: pointy.Bool(false),
128+
FullDocument: pointer(false),
129+
FullDocumentBeforeChange: pointer(false),
130+
TolerateResumeErrors: pointer(true),
131+
SkipCatchupEvents: pointer(true),
132+
MaximumThroughput: pointer(true),
133+
Unordered: pointer(false),
135134
},
136135
EventProcessors: map[string]interface{}{
137136
"AWS_EVENTBRIDGE": map[string]interface{}{
@@ -239,7 +238,7 @@ func TestEventTriggers_CreateDatabase(t *testing.T) {
239238
Type: "DATABASE",
240239
FunctionID: "60c2badbbd2b5c170e91292d",
241240
FunctionName: "name",
242-
Disabled: pointy.Bool(false),
241+
Disabled: pointer(false),
243242
Config: EventTriggerConfig{
244243
OperationTypes: []string{"INSERT", "UPDATE", "REPLACE", "DELETE"},
245244
Database: "sample_airbnb",
@@ -254,12 +253,12 @@ func TestEventTriggers_CreateDatabase(t *testing.T) {
254253
"operationType": float64(1),
255254
"updateDescription.updatedFields.FieldA": float64(1),
256255
},
257-
FullDocument: pointy.Bool(false),
258-
FullDocumentBeforeChange: pointy.Bool(false),
259-
Unordered: pointy.Bool(false),
260-
TolerateResumeErrors: pointy.Bool(true),
261-
SkipCatchupEvents: pointy.Bool(true),
262-
MaximumThroughput: pointy.Bool(true),
256+
FullDocument: pointer(false),
257+
FullDocumentBeforeChange: pointer(false),
258+
Unordered: pointer(false),
259+
TolerateResumeErrors: pointer(true),
260+
SkipCatchupEvents: pointer(true),
261+
MaximumThroughput: pointer(true),
263262
ClusterName: "cluster name",
264263
},
265264
EventProcessors: map[string]interface{}{
@@ -271,7 +270,7 @@ func TestEventTriggers_CreateDatabase(t *testing.T) {
271270
},
272271
},
273272
},
274-
LastModified: pointy.Int64(int64(1623793011)),
273+
LastModified: pointer(int64(1623793011)),
275274
}
276275

277276
if diff := deep.Equal(updatedEventTriggersServiceOp, &expected); diff != nil {
@@ -290,7 +289,7 @@ func TestEventTriggers_CreateAuthentication(t *testing.T) {
290289
Name: "Test event trigger",
291290
Type: "AUTHENTICATION",
292291
FunctionID: "60c2badbbd2b5c170e91292d",
293-
Disabled: pointy.Bool(false),
292+
Disabled: pointer(false),
294293
Config: &EventTriggerConfig{
295294
OperationType: "LOGIN",
296295
Providers: []string{"anon-user", "local-userpass"},
@@ -379,7 +378,7 @@ func TestEventTriggers_CreateAuthentication(t *testing.T) {
379378
Type: "AUTHENTICATION",
380379
FunctionID: "60c2badbbd2b5c170e91292d",
381380
FunctionName: "name",
382-
Disabled: pointy.Bool(false),
381+
Disabled: pointer(false),
383382
Config: EventTriggerConfig{
384383
OperationType: "LOGIN",
385384
Providers: []string{"anon-user", "local-userpass"},
@@ -395,7 +394,7 @@ func TestEventTriggers_CreateAuthentication(t *testing.T) {
395394
},
396395
},
397396
},
398-
LastModified: pointy.Int64(int64(1623793011)),
397+
LastModified: pointer(int64(1623793011)),
399398
}
400399

401400
if diff := deep.Equal(updatedEventTriggersServiceOp, &expected); diff != nil {
@@ -414,7 +413,7 @@ func TestEventTriggers_CreateScheduled(t *testing.T) {
414413
Name: "Test event trigger",
415414
Type: "SCHEDULED",
416415
FunctionID: "60c2badbbd2b5c170e91292d",
417-
Disabled: pointy.Bool(false),
416+
Disabled: pointer(false),
418417
Config: &EventTriggerConfig{
419418
Schedule: "* * * * *",
420419
},
@@ -496,7 +495,7 @@ func TestEventTriggers_CreateScheduled(t *testing.T) {
496495
Type: "SCHEDULED",
497496
FunctionID: "60c2badbbd2b5c170e91292d",
498497
FunctionName: "name",
499-
Disabled: pointy.Bool(false),
498+
Disabled: pointer(false),
500499
Config: EventTriggerConfig{
501500
Schedule: "* * * * *",
502501
ScheduleType: "ADVANCED",
@@ -510,7 +509,7 @@ func TestEventTriggers_CreateScheduled(t *testing.T) {
510509
},
511510
},
512511
},
513-
LastModified: pointy.Int64(int64(1623793011)),
512+
LastModified: pointer(int64(1623793011)),
514513
}
515514

516515
if diff := deep.Equal(updatedEventTriggersServiceOp, &expected); diff != nil {
@@ -530,7 +529,7 @@ func TestEventTriggers_Update(t *testing.T) {
530529
Name: "Test event trigger update",
531530
Type: "Test event trigger update",
532531
FunctionID: "1",
533-
Disabled: pointy.Bool(false),
532+
Disabled: pointer(false),
534533
Config: &EventTriggerConfig{
535534
OperationTypes: []string{"INSERT", "UPDATE"},
536535
OperationType: "CREATE",
@@ -540,7 +539,7 @@ func TestEventTriggers_Update(t *testing.T) {
540539
ServiceID: "3",
541540
Match: `{"updateDescription.updatedFields.status": {"$exists": true}}`,
542541
Project: `{"updateDescription.updatedFields.FieldA": 1, "operationType": 1}`,
543-
FullDocument: pointy.Bool(false),
542+
FullDocument: pointer(false),
544543
Schedule: "weekday",
545544
},
546545
EventProcessors: map[string]interface{}{
@@ -616,7 +615,7 @@ func TestEventTriggers_Update(t *testing.T) {
616615
Type: "type",
617616
FunctionID: "1",
618617
FunctionName: "name",
619-
Disabled: pointy.Bool(false),
618+
Disabled: pointer(false),
620619
}
621620

622621
if diff := deep.Equal(updatedEventTriggersServiceOp, &expected); diff != nil {

go.mod

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ toolchain go1.23.1
77
require (
88
github.com/go-test/deep v1.1.1
99
github.com/google/go-querystring v1.1.0
10-
github.com/openlyinc/pointy v1.2.0
1110
go.mongodb.org/atlas v0.37.0
1211
)
1312

14-
require github.com/stretchr/testify v1.4.0 // indirect
15-
1613
// Incorrect release versioning
1714
retract v1.0.0

go.sum

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
1-
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
2-
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
31
github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U=
42
github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
53
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
64
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
75
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
86
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
9-
github.com/openlyinc/pointy v1.2.0 h1:vbb/WoPbshyTH8j3/XYu3enlZfv+NHxAD15qTm1zbk0=
10-
github.com/openlyinc/pointy v1.2.0/go.mod h1:JodZOTJoBNaAQHeU0F/SwA4PL0lg4pKF7fYFpX291P0=
11-
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
12-
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
13-
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
14-
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
15-
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
167
go.mongodb.org/atlas v0.37.0 h1:zQnO1o5+bVP9IotpAYpres4UjMD2F4nwNEFTZhNL4ck=
178
go.mongodb.org/atlas v0.37.0/go.mod h1:DJYtM+vsEpPEMSkQzJnFHrT0sP7ev6cseZc/GGjJYG8=
189
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
19-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
20-
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
21-
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

0 commit comments

Comments
 (0)