You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Libs(Go): add convenience constructor for static nullable strings (#1497)
Fixes <#1198>
While this isn't quite the type of change that was requested in #1198,
I'm hopeful it'll reduce a bit of the friction.
A new constructor is now available as `svix.StaticNullableString()`
which gives an `openapi.NullableString`.
Note that the return type (not a pointer) is inconsistent with the rest
of the functions that act as primative constructors, and in fact goes
against the convention of constructors returning pointers to the value
they initialize.
The issue was raised, however, that all the places in the lib where a
`NullableString` is needed, we'd have to dereference it anyway.
Since this alt constructor is all about convenience, we may as well
break convention. _In for a penny, in for a pound..._
The net effect is instead of:
```go
appIn := svix.ApplicationIn{
...
Uid: *svix.NullableString(svix.String("myuid"))
}
```
folks will now be able to write:
```go
appIn := svix.ApplicationIn{
...
Uid: svix.StaticNullableString("myuid")
}
```
0 commit comments