Files
portal/openapi/model_location_inner.go
2026-06-22 11:38:29 +02:00

108 lines
2.2 KiB
Go

/*
FastAPI
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
API version: 0.1.0
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package openapi
import (
"encoding/json"
"fmt"
)
// LocationInner struct for LocationInner
type LocationInner struct {
Int32 *int32
String *string
}
// Unmarshal JSON data into any of the pointers in the struct
func (dst *LocationInner) UnmarshalJSON(data []byte) error {
var err error
// try to unmarshal JSON data into Int32
err = json.Unmarshal(data, &dst.Int32);
if err == nil {
jsonInt32, _ := json.Marshal(dst.Int32)
if string(jsonInt32) == "{}" { // empty struct
dst.Int32 = nil
} else {
return nil // data stored in dst.Int32, return on the first match
}
} else {
dst.Int32 = nil
}
// try to unmarshal JSON data into String
err = json.Unmarshal(data, &dst.String);
if err == nil {
jsonString, _ := json.Marshal(dst.String)
if string(jsonString) == "{}" { // empty struct
dst.String = nil
} else {
return nil // data stored in dst.String, return on the first match
}
} else {
dst.String = nil
}
return fmt.Errorf("data failed to match schemas in anyOf(LocationInner)")
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src LocationInner) MarshalJSON() ([]byte, error) {
if src.Int32 != nil {
return json.Marshal(&src.Int32)
}
if src.String != nil {
return json.Marshal(&src.String)
}
return nil, nil // no data in anyOf schemas
}
type NullableLocationInner struct {
value *LocationInner
isSet bool
}
func (v NullableLocationInner) Get() *LocationInner {
return v.value
}
func (v *NullableLocationInner) Set(val *LocationInner) {
v.value = val
v.isSet = true
}
func (v NullableLocationInner) IsSet() bool {
return v.isSet
}
func (v *NullableLocationInner) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableLocationInner(val *LocationInner) *NullableLocationInner {
return &NullableLocationInner{value: val, isSet: true}
}
func (v NullableLocationInner) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableLocationInner) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}