re-generated

master
Charles Iliya Krempeaux 2017-05-19 15:30:14 -07:00
parent 40c8fd548d
commit 4f5871af53
1 changed files with 30 additions and 0 deletions

View File

@ -86,6 +86,24 @@ func (receiver NullableType) MarshalJSON() ([]byte, error) {
return json.Marshal(receiver.value)
}
func (receiver NullableType) WhenNone(fn func()) {
if NoneNullable() == receiver {
fn()
}
}
func (receiver NullableType) WhenNull(fn func()) {
if Null() == receiver {
fn()
}
}
func (receiver NullableType) WhenSome(fn func(string)) {
if NoneNullable() != receiver && Null() != receiver {
fn(receiver.value)
}
}
func (receiver *NullableType) UnmarshalJSON(b []byte) error {
if nil == receiver {
return errNilReceiver
@ -198,6 +216,18 @@ func (receiver *Type) UnmarshalJSON(b []byte) error {
return nil
}
func (receiver Type) WhenNone(fn func()) {
if None() == receiver {
fn()
}
}
func (receiver Type) WhenSome(fn func(string)) {
if None() != receiver {
fn(receiver.value)
}
}
func (receiver Type) Value() (driver.Value, error) {
if None() == receiver {
return nil, errNone