Skip to content

Commit f49323d

Browse files
committed
chore: handle nullable fields
1 parent 0cbb76c commit f49323d

File tree

8 files changed

+1106
-1066
lines changed

8 files changed

+1106
-1066
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ require (
3636
github.com/jackc/pgx/v4 v4.18.3
3737
github.com/joho/godotenv v1.5.1
3838
github.com/muesli/reflow v0.3.0
39+
github.com/oapi-codegen/nullable v1.1.0
3940
github.com/oapi-codegen/oapi-codegen/v2 v2.4.1
4041
github.com/oapi-codegen/runtime v1.1.1
4142
github.com/slack-go/slack v0.17.0

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,8 @@ github.com/nunnatsa/ginkgolinter v0.19.1/go.mod h1:jkQ3naZDmxaZMXPWaS9rblH+i+GWX
735735
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
736736
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
737737
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
738+
github.com/oapi-codegen/nullable v1.1.0 h1:eAh8JVc5430VtYVnq00Hrbpag9PFRGWLjxR1/3KntMs=
739+
github.com/oapi-codegen/nullable v1.1.0/go.mod h1:KUZ3vUzkmEKY90ksAmit2+5juDIhIZhfDl+0PwOQlFY=
738740
github.com/oapi-codegen/oapi-codegen/v2 v2.4.1 h1:ykgG34472DWey7TSjd8vIfNykXgjOgYJZoQbKfEeY/Q=
739741
github.com/oapi-codegen/oapi-codegen/v2 v2.4.1/go.mod h1:N5+lY1tiTDV3V1BeHtOxeWXHoPVeApvsvjJqegfoaz8=
740742
github.com/oapi-codegen/runtime v1.1.1 h1:EXLHh0DXIJnWhdRPN2w4MXAzFyE4CskzhNLUmtpMYro=

internal/link/link.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,11 +242,11 @@ func linkPooler(ctx context.Context, projectRef string, fsys afero.Fs) error {
242242
func updatePoolerConfig(config api.SupavisorConfigResponse) {
243243
utils.Config.Db.Pooler.ConnectionString = config.ConnectionString
244244
utils.Config.Db.Pooler.PoolMode = cliConfig.PoolMode(config.PoolMode)
245-
if config.DefaultPoolSize != nil {
246-
utils.Config.Db.Pooler.DefaultPoolSize = cast.IntToUint(*config.DefaultPoolSize)
245+
if value, err := config.DefaultPoolSize.Get(); err == nil {
246+
utils.Config.Db.Pooler.DefaultPoolSize = cast.IntToUint(value)
247247
}
248-
if config.MaxClientConn != nil {
249-
utils.Config.Db.Pooler.MaxClientConn = cast.IntToUint(*config.MaxClientConn)
248+
if value, err := config.MaxClientConn.Get(); err == nil {
249+
utils.Config.Db.Pooler.MaxClientConn = cast.IntToUint(value)
250250
}
251251
}
252252

pkg/api/types.cfg.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
package: api
22
generate:
33
models: true
4+
output-options:
5+
nullable-type: true
46
output: pkg/api/types.gen.go

pkg/api/types.gen.go

Lines changed: 401 additions & 400 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/config/auth.go

Lines changed: 341 additions & 309 deletions
Large diffs are not rendered by default.

pkg/config/auth_test.go

Lines changed: 353 additions & 352 deletions
Large diffs are not rendered by default.

pkg/config/updater_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"testing"
77

88
"github.com/h2non/gock"
9+
"github.com/oapi-codegen/nullable"
910
"github.com/stretchr/testify/assert"
1011
"github.com/stretchr/testify/require"
1112
v1API "github.com/supabase/cli/pkg/api"
@@ -168,7 +169,7 @@ func TestUpdateAuthConfig(t *testing.T) {
168169
Get("/v1/projects/test-project/config/auth").
169170
Reply(http.StatusOK).
170171
JSON(v1API.AuthConfigResponse{
171-
SiteUrl: cast.Ptr("http://localhost:3000"),
172+
SiteUrl: nullable.NewNullableWithValue("http://localhost:3000"),
172173
})
173174
gock.New(server).
174175
Patch("/v1/projects/test-project/config/auth").

0 commit comments

Comments
 (0)