Skip to content

Commit d0ec7e3

Browse files
gaultierory-bot
authored andcommitted
chore: remove counting courier messages
GitOrigin-RevId: e053d3d2ff76e9368800441286c19b377ae84a19
1 parent b2677c8 commit d0ec7e3

File tree

3 files changed

+49
-13
lines changed

3 files changed

+49
-13
lines changed

.reports/dep-licenses.csv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@
33
"github.com/ory/x","Apache-2.0"
44
"github.com/stretchr/testify","MIT"
55
"go.opentelemetry.io/otel/sdk","Apache-2.0"
6-
"go.opentelemetry.io/otel/sdk","BSD-3-Clause"
76

oauth2/oauth2_auth_code_bench_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,10 @@ func BenchmarkAuthCode(b *testing.B) {
234234
)
235235

236236
return func(b *testing.B) {
237-
// pop.Debug = true
238237
code, _ := getAuthorizeCode(ctx, b, conf, nil, oauth2.SetAuthURLParam("nonce", nonce))
239238
require.NotEmpty(b, code)
240239

241240
_, err := conf.Exchange(ctx, code)
242-
// pop.Debug = false
243241
require.NoError(b, err)
244242
}
245243
}

oryx/pagination/keysetpagination_v2/page_token.go

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"encoding/json"
88
"time"
99

10+
"github.com/gofrs/uuid"
1011
"github.com/pkg/errors"
1112
"github.com/ssoready/hyrumtoken"
1213

@@ -21,13 +22,21 @@ type (
2122
cols []Column
2223
}
2324
jsonPageToken = struct {
24-
ExpiresAt time.Time `json:"e"`
25-
Cols []Column `json:"c"`
25+
ExpiresAt time.Time `json:"e"`
26+
Cols []jsonColumn `json:"c"`
27+
}
28+
jsonColumn = struct {
29+
Name string `json:"n"`
30+
Order Order `json:"o"`
31+
ValueAny any `json:"v"`
32+
ValueTime time.Time `json:"vt"`
33+
ValueUUID uuid.UUID `json:"vu"`
34+
ValueInt int64 `json:"vi"`
2635
}
2736
Column struct {
28-
Name string `json:"n"`
29-
Order Order `json:"o"`
30-
Value any `json:"v"`
37+
Name string
38+
Order Order
39+
Value any
3140
}
3241
)
3342

@@ -50,7 +59,23 @@ func (t PageToken) MarshalJSON() ([]byte, error) {
5059
}
5160
toEncode := jsonPageToken{
5261
ExpiresAt: now().Add(time.Hour).UTC(),
53-
Cols: t.cols,
62+
Cols: make([]jsonColumn, len(t.cols)),
63+
}
64+
for i, col := range t.cols {
65+
toEncode.Cols[i] = jsonColumn{
66+
Name: col.Name,
67+
Order: col.Order,
68+
}
69+
switch v := col.Value.(type) {
70+
case time.Time:
71+
toEncode.Cols[i].ValueTime = v
72+
case uuid.UUID:
73+
toEncode.Cols[i].ValueUUID = v
74+
case int64:
75+
toEncode.Cols[i].ValueInt = v
76+
default:
77+
toEncode.Cols[i].ValueAny = v
78+
}
5479
}
5580
return json.Marshal(toEncode)
5681
}
@@ -62,7 +87,23 @@ func (t *PageToken) UnmarshalJSON(data []byte) error {
6287
if err := json.Unmarshal(data, &rawToken); err != nil {
6388
return err
6489
}
65-
t.cols = rawToken.Cols
90+
t.cols = make([]Column, len(rawToken.Cols))
91+
for i, col := range rawToken.Cols {
92+
t.cols[i] = Column{
93+
Name: col.Name,
94+
Order: col.Order,
95+
}
96+
switch {
97+
case col.ValueAny != nil:
98+
t.cols[i].Value = col.ValueAny
99+
case !col.ValueTime.IsZero():
100+
t.cols[i].Value = col.ValueTime
101+
case col.ValueUUID != uuid.Nil:
102+
t.cols[i].Value = col.ValueUUID
103+
case col.ValueInt != 0:
104+
t.cols[i].Value = col.ValueInt
105+
}
106+
}
66107
now := time.Now
67108
if t.testNow != nil {
68109
now = t.testNow
@@ -73,6 +114,4 @@ func (t *PageToken) UnmarshalJSON(data []byte) error {
73114
return nil
74115
}
75116

76-
func NewPageToken(cols ...Column) PageToken {
77-
return PageToken{cols: cols}
78-
}
117+
func NewPageToken(cols ...Column) PageToken { return PageToken{cols: cols} }

0 commit comments

Comments
 (0)