Documentation
¶
Overview ¶
Code generated by go generate; DO NOT EDIT. This file was generated by scripts/models/gen_nullable_types.go
Package nullable provides types what allows to determine if a JSON key has been set to null or not provided.
usr := struct { Name nullable.String `json:"name"` }{} data := []byte("{}") if err := json.Unmarshal(data, &usr); err != nil { log.Fatalf("unmarshaling failed: %s\n", err) } fmt.Println("name present", usr.Name.Present) // false fmt.Println("name valid", usr.Name.Valid) // false fmt.Println("name value", usr.Name.Value) // "" data = []byte("{\"name\":null}") if err := json.Unmarshal(data, &usr); err != nil { log.Fatalf("unmarshaling failed: %s\n", err) } fmt.Println("name present", usr.Name.Present) // true fmt.Println("name valid", usr.Name.Valid) // false fmt.Println("name value", usr.Name.Value) // "" data = []byte("{\"name\":\"John\"}") if err := json.Unmarshal(data, &usr); err != nil { log.Fatalf("unmarshaling failed: %s\n", err) } fmt.Println("name present", usr.Name.Present) // true fmt.Println("name valid", usr.Name.Valid) // true fmt.Println("name value", usr.Name.Value) // "John"
Code generated by go generate; DO NOT EDIT. This file was generated by scripts/models/gen_nullable_types.go
Code generated by go generate; DO NOT EDIT. This file was generated by scripts/models/gen_nullable_types.go
Code generated by go generate; DO NOT EDIT. This file was generated by scripts/models/gen_nullable_types.go
Code generated by go generate; DO NOT EDIT. This file was generated by scripts/models/gen_nullable_types.go
Code generated by go generate; DO NOT EDIT. This file was generated by scripts/models/gen_nullable_types.go
Code generated by go generate; DO NOT EDIT. This file was generated by scripts/models/gen_nullable_types.go
Code generated by go generate; DO NOT EDIT. This file was generated by scripts/models/gen_nullable_types.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bool ¶
type Bool struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null and valid bool Value bool }
Bool represents a bool that may be null or not present in json at all.
func (*Bool) ContextValidate ¶ added in v1.3.0
ContextValidate implements runtime.ContextValidatable from github.com/go-openapi/runtime
func (*Bool) Ptr ¶
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*Bool) UnmarshalJSON ¶
UnmarshalJSON implements json.Marshaler interface.
type BoolSlice ¶
type BoolSlice struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null Value []bool }
BoolSlice represents a []bool that may be null or not present in json at all.
func (*BoolSlice) ContextValidate ¶ added in v1.3.0
ContextValidate implements runtime.ContextValidatable from github.com/go-openapi/runtime
func (*BoolSlice) Ptr ¶ added in v1.3.0
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*BoolSlice) UnmarshalJSON ¶
UnmarshalJSON implements json.Marshaler interface.
type Float32 ¶
type Float32 struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null and valid float32 Value float32 }
Float32 represents a float32 that may be null or not present in json at all.
func (*Float32) ContextValidate ¶ added in v1.3.0
ContextValidate implements runtime.ContextValidatable from github.com/go-openapi/runtime
func (*Float32) Ptr ¶
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*Float32) UnmarshalJSON ¶
UnmarshalJSON implements json.Marshaler interface.
type Float32Slice ¶
type Float32Slice struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null Value []float32 }
Float32Slice represents a []float32 that may be null or not present in json at all.
func (*Float32Slice) ContextValidate ¶ added in v1.3.0
ContextValidate implements runtime.ContextValidatable from github.com/go-openapi/runtime
func (*Float32Slice) Ptr ¶ added in v1.3.0
func (f *Float32Slice) Ptr() *[]float32
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*Float32Slice) UnmarshalJSON ¶
func (f *Float32Slice) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Marshaler interface.
type Float64 ¶
type Float64 struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null and valid float64 Value float64 }
Float64 represents a float64 that may be null or not present in json at all.
func (*Float64) ContextValidate ¶ added in v1.3.0
ContextValidate implements runtime.ContextValidatable from github.com/go-openapi/runtime
func (*Float64) Ptr ¶
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*Float64) UnmarshalJSON ¶
UnmarshalJSON implements json.Marshaler interface.
type Float64Slice ¶
type Float64Slice struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null Value []float64 }
Float64Slice represents a []float64 that may be null or not present in json at all.
func (*Float64Slice) ContextValidate ¶ added in v1.3.0
ContextValidate implements runtime.ContextValidatable from github.com/go-openapi/runtime
func (*Float64Slice) Ptr ¶ added in v1.3.0
func (f *Float64Slice) Ptr() *[]float64
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*Float64Slice) UnmarshalJSON ¶
func (f *Float64Slice) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Marshaler interface.
type Int ¶
type Int struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null and valid int Value int }
Int represents a int that may be null or not present in json at all.
func (*Int) ContextValidate ¶ added in v1.3.0
ContextValidate implements runtime.ContextValidatable from github.com/go-openapi/runtime
func (*Int) Ptr ¶
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*Int) UnmarshalJSON ¶
UnmarshalJSON implements json.Marshaler interface.
type Int16 ¶
type Int16 struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null and valid int16 Value int16 }
Int16 represents a int16 that may be null or not present in json at all.
func (*Int16) ContextValidate ¶ added in v1.3.0
ContextValidate implements runtime.ContextValidatable from github.com/go-openapi/runtime
func (*Int16) Ptr ¶
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*Int16) UnmarshalJSON ¶
UnmarshalJSON implements json.Marshaler interface.
type Int16Slice ¶
type Int16Slice struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null Value []int16 }
Int16Slice represents a []int16 that may be null or not present in json at all.
func (*Int16Slice) ContextValidate ¶ added in v1.3.0
ContextValidate implements runtime.ContextValidatable from github.com/go-openapi/runtime
func (*Int16Slice) Ptr ¶ added in v1.3.0
func (i *Int16Slice) Ptr() *[]int16
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*Int16Slice) UnmarshalJSON ¶
func (i *Int16Slice) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Marshaler interface.
type Int32 ¶
type Int32 struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null and valid int32 Value int32 }
Int32 represents a int32 that may be null or not present in json at all.
func (*Int32) ContextValidate ¶ added in v1.3.0
ContextValidate implements runtime.ContextValidatable from github.com/go-openapi/runtime
func (*Int32) Ptr ¶
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*Int32) UnmarshalJSON ¶
UnmarshalJSON implements json.Marshaler interface.
type Int32Slice ¶
type Int32Slice struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null Value []int32 }
Int32Slice represents a []int32 that may be null or not present in json at all.
func (*Int32Slice) ContextValidate ¶ added in v1.3.0
ContextValidate implements runtime.ContextValidatable from github.com/go-openapi/runtime
func (*Int32Slice) Ptr ¶ added in v1.3.0
func (i *Int32Slice) Ptr() *[]int32
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*Int32Slice) UnmarshalJSON ¶
func (i *Int32Slice) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Marshaler interface.
type Int64 ¶
type Int64 struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null and valid int64 Value int64 }
Int64 represents a int64 that may be null or not present in json at all.
func (*Int64) ContextValidate ¶ added in v1.3.0
ContextValidate implements runtime.ContextValidatable from github.com/go-openapi/runtime
func (*Int64) Ptr ¶
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*Int64) UnmarshalJSON ¶
UnmarshalJSON implements json.Marshaler interface.
type Int64Slice ¶
type Int64Slice struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null Value []int64 }
Int64Slice represents a []int64 that may be null or not present in json at all.
func (*Int64Slice) ContextValidate ¶ added in v1.3.0
ContextValidate implements runtime.ContextValidatable from github.com/go-openapi/runtime
func (*Int64Slice) Ptr ¶ added in v1.3.0
func (i *Int64Slice) Ptr() *[]int64
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*Int64Slice) UnmarshalJSON ¶
func (i *Int64Slice) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Marshaler interface.
type IntSlice ¶
type IntSlice struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null Value []int }
IntSlice represents a []int that may be null or not present in json at all.
func (*IntSlice) ContextValidate ¶ added in v1.3.0
ContextValidate implements runtime.ContextValidatable from github.com/go-openapi/runtime
func (*IntSlice) Ptr ¶ added in v1.3.0
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*IntSlice) UnmarshalJSON ¶
UnmarshalJSON implements json.Marshaler interface.
type String ¶
type String struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null and valid string Value string }
String represents a string that may be null or not present in json at all.
func (*String) ContextValidate ¶ added in v1.3.0
ContextValidate implements runtime.ContextValidatable from github.com/go-openapi/runtime
func (*String) Ptr ¶
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*String) UnmarshalJSON ¶
UnmarshalJSON implements json.Marshaler interface.
type StringSlice ¶
type StringSlice struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null Value []string }
StringSlice represents a []string that may be null or not present in json at all.
func (*StringSlice) ContextValidate ¶ added in v1.3.0
ContextValidate implements runtime.ContextValidatable from github.com/go-openapi/runtime
func (*StringSlice) Ptr ¶ added in v1.3.0
func (s *StringSlice) Ptr() *[]string
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*StringSlice) UnmarshalJSON ¶
func (s *StringSlice) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Marshaler interface.
type Time ¶
type Time struct { Present bool // Present is true if key is present in json Valid bool // Valid is true if value is not null and valid time Value time.Time }
Time represents a time that may be null or not present in json at all.
func (*Time) Ptr ¶
Returns nil if not present or valid. Otherwise it will return a pointer to the value.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements json.Marshaler interface.