You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func (o *{{classname}}) Get{{name}}() *{{#isNumber}}float64{{/isNumber}}{{#isFloat}}float64{{/isFloat}}{{#isDouble}}float64{{/isDouble}}{{#isInteger}}int64{{/isInteger}}{{#isLong}}int64{{/isLong}}{{^isNumeric}}{{vendorExtensions.x-go-base-type}}{{/isNumeric}} {
123
-
if o == nil{{#isNullable}}{{^vendorExtensions.x-golang-is-container}} || o.{{name}}.Get() == nil{{/vendorExtensions.x-golang-is-container}}{{/isNullable}} {
123
+
if o == nil|| IsNil(o.{{name}}) {{#isNullable}}{{^vendorExtensions.x-golang-is-container}} || o.{{name}}.Get() == nil{{/vendorExtensions.x-golang-is-container}}{{/isNullable}} {
124
124
var ret *{{#isNumber}}float64{{/isNumber}}{{#isFloat}}float64{{/isFloat}}{{#isDouble}}float64{{/isDouble}}{{#isInteger}}int64{{/isInteger}}{{#isLong}}int64{{/isLong}}{{^isNumeric}}{{vendorExtensions.x-go-base-type}}{{/isNumeric}}
125
125
return ret
126
126
}
@@ -178,6 +178,9 @@ func (o *{{classname}}) Set{{name}}(v *{{#isNumber}}float64{{/isNumber}}{{#isFlo
178
178
o.{{name}} = v
179
179
{{/vendorExtensions.x-golang-is-container}}
180
180
{{^vendorExtensions.x-golang-is-container}}
181
+
if IsNil(o.{{name}}) {
182
+
o.{{name}} = new({{dataType}})
183
+
}
181
184
o.{{name}}.Set(&v)
182
185
{{/vendorExtensions.x-golang-is-container}}
183
186
{{/isNullable}}
@@ -193,7 +196,7 @@ func (o *{{classname}}) Set{{name}}(v *{{#isNumber}}float64{{/isNumber}}{{#isFlo
193
196
// Deprecated
194
197
{{/deprecated}}
195
198
func (o *{{classname}}) Get{{name}}() *{{#isNumber}}float64{{/isNumber}}{{#isFloat}}float64{{/isFloat}}{{#isDouble}}float64{{/isDouble}}{{#isInteger}}int64{{/isInteger}}{{#isLong}}int64{{/isLong}}{{^isNumeric}}{{vendorExtensions.x-go-base-type}}{{/isNumeric}} {
196
-
if o == nil{{^isNullable}} || IsNil(o.{{name}}){{/isNullable}}{{#isNullable}}{{^vendorExtensions.x-golang-is-container}} || IsNil(o.{{name}}.Get()){{/vendorExtensions.x-golang-is-container}}{{/isNullable}} {
199
+
if o == nil || IsNil(o.{{name}}){{#isNullable}}{{^vendorExtensions.x-golang-is-container}} || IsNil(o.{{name}}.Get()){{/vendorExtensions.x-golang-is-container}}{{/isNullable}} {
197
200
var ret *{{#isNumber}}float64{{/isNumber}}{{#isFloat}}float64{{/isFloat}}{{#isDouble}}float64{{/isDouble}}{{#isInteger}}int64{{/isInteger}}{{#isLong}}int64{{/isLong}}{{^isNumeric}}{{vendorExtensions.x-go-base-type}}{{/isNumeric}}
198
201
return ret
199
202
}
@@ -219,7 +222,7 @@ func (o *{{classname}}) Get{{name}}() *{{#isNumber}}float64{{/isNumber}}{{#isFlo
219
222
// Deprecated
220
223
{{/deprecated}}
221
224
func (o *{{classname}}) Get{{name}}Ok() (*{{#isNumber}}float64{{/isNumber}}{{#isFloat}}float64{{/isFloat}}{{#isDouble}}float64{{/isDouble}}{{#isInteger}}int64{{/isInteger}}{{#isLong}}int64{{/isLong}}{{^isNumeric}}{{vendorExtensions.x-go-base-type}}{{/isNumeric}}, bool) {
222
-
if o == nil{{^isNullable}} || IsNil(o.{{name}}){{/isNullable}}{{#isNullable}}{{#vendorExtensions.x-golang-is-container}} || IsNil(o.{{name}}){{/vendorExtensions.x-golang-is-container}}{{/isNullable}}{
225
+
if o == nil || IsNil(o.{{name}}) {
223
226
{{^isFreeFormObject}}
224
227
return nil, false
225
228
{{/isFreeFormObject}}
@@ -242,7 +245,7 @@ func (o *{{classname}}) Get{{name}}Ok() (*{{#isNumber}}float64{{/isNumber}}{{#is
242
245
243
246
// Has{{name}} returns a boolean if a field has been set.
244
247
func (o *{{classname}}) Has{{name}}() bool {
245
-
if o != nil &&{{^isNullable}}!IsNil(o.{{name}}){{/isNullable}}{{#isNullable}}{{#vendorExtensions.x-golang-is-container}}!IsNil(o.{{name}}){{/vendorExtensions.x-golang-is-container}}{{^vendorExtensions.x-golang-is-container}}o.{{name}}.IsSet(){{/vendorExtensions.x-golang-is-container}}{{/isNullable}} {
248
+
if o != nil &&!IsNil(o.{{name}}) && !IsNil(o.{{name}}){{#isNullable}}{{^vendorExtensions.x-golang-is-container}}&& o.{{name}}.IsSet(){{/vendorExtensions.x-golang-is-container}}{{/isNullable}} {
246
249
return true
247
250
}
248
251
@@ -259,6 +262,9 @@ func (o *{{classname}}) Set{{name}}(v *{{#isNumber}}float64{{/isNumber}}{{#isFlo
259
262
o.{{name}} = v
260
263
{{/vendorExtensions.x-golang-is-container}}
261
264
{{^vendorExtensions.x-golang-is-container}}
265
+
if IsNil(o.{{name}}) {
266
+
o.{{name}} = new({{dataType}})
267
+
}
262
268
o.{{name}}.Set(v)
263
269
{{/vendorExtensions.x-golang-is-container}}
264
270
{{/isNullable}}
@@ -270,11 +276,17 @@ func (o *{{classname}}) Set{{name}}(v *{{#isNumber}}float64{{/isNumber}}{{#isFlo
270
276
{{^vendorExtensions.x-golang-is-container}}
271
277
// Set{{name}}Nil sets the value for {{name}} to be an explicit nil
272
278
func (o *{{classname}}) Set{{name}}Nil() {
279
+
if IsNil(o.{{name}}) {
280
+
o.{{name}} = new({{dataType}})
281
+
}
273
282
o.{{name}}.Set(nil)
274
283
}
275
284
276
285
// Unset{{name}} ensures that no value is present for {{name}}, not even an explicit nil
0 commit comments