@cryptotaxi247 / kubo / commits / 89826a39b

feat: add NewOptionalInteger function

Missing method to create OptionalInteger

myml committed Feb 11, 2023 at 13:58 UTC 89826a39b08ea186118bc7d0fb507c53388166f5
1 file changed +5
config/types.go
+5
@@ -306,6 +306,11 @@ type OptionalInteger struct {
306 value *int64
307 }
308
309 +// NewOptionalInteger returns an OptionalInteger from a int64
310 +func NewOptionalInteger(v int64) *OptionalInteger {
311 + return &OptionalInteger{value: &v}
312 +}
313 +
314 // WithDefault resolves the integer with the given default.
315 func (p *OptionalInteger) WithDefault(defaultValue int64) (value int64) {
316 if p == nil || p.value == nil {