1 Star 0 Fork 0

MrCoder/openapi

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
model_ip_index.go 2.26 KB
一键复制 编辑 原始数据 按行查看 历史
MrCoder 提交于 2023-12-22 15:27 +08:00 . update
/*
NRF NFDiscovery Service
NRF NFDiscovery Service. © 2023, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
API version: 1.2.5
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package OpenAPI_Nnrf_NFDiscovery
import (
"encoding/json"
"fmt"
)
// IpIndex Represents the IP Index to be sent from UDM to the SMF (its value can be either an integer or a string)
type IpIndex struct {
int32 *int32
string *string
}
// Unmarshal JSON data into any of the pointers in the struct
func (dst *IpIndex) 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(IpIndex)")
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src *IpIndex) 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 NullableIpIndex struct {
value *IpIndex
isSet bool
}
func (v NullableIpIndex) Get() *IpIndex {
return v.value
}
func (v *NullableIpIndex) Set(val *IpIndex) {
v.value = val
v.isSet = true
}
func (v NullableIpIndex) IsSet() bool {
return v.isSet
}
func (v *NullableIpIndex) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableIpIndex(val *IpIndex) *NullableIpIndex {
return &NullableIpIndex{value: val, isSet: true}
}
func (v NullableIpIndex) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableIpIndex) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/konglinglong/openapi.git
git@gitee.com:konglinglong/openapi.git
konglinglong
openapi
openapi
e403a3c726a4

搜索帮助