init
This commit is contained in:
@@ -0,0 +1,204 @@
|
||||
/*
|
||||
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"
|
||||
"bytes"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// checks if the GroupDB type satisfies the MappedNullable interface at compile time
|
||||
var _ MappedNullable = &GroupDB{}
|
||||
|
||||
// GroupDB struct for GroupDB
|
||||
type GroupDB struct {
|
||||
Name string `json:"name"`
|
||||
Id NullableInt32 `json:"id,omitempty"`
|
||||
}
|
||||
|
||||
type _GroupDB GroupDB
|
||||
|
||||
// NewGroupDB instantiates a new GroupDB object
|
||||
// This constructor will assign default values to properties that have it defined,
|
||||
// and makes sure properties required by API are set, but the set of arguments
|
||||
// will change when the set of required properties is changed
|
||||
func NewGroupDB(name string) *GroupDB {
|
||||
this := GroupDB{}
|
||||
this.Name = name
|
||||
return &this
|
||||
}
|
||||
|
||||
// NewGroupDBWithDefaults instantiates a new GroupDB object
|
||||
// This constructor will only assign default values to properties that have it defined,
|
||||
// but it doesn't guarantee that properties required by API are set
|
||||
func NewGroupDBWithDefaults() *GroupDB {
|
||||
this := GroupDB{}
|
||||
return &this
|
||||
}
|
||||
|
||||
// GetName returns the Name field value
|
||||
func (o *GroupDB) GetName() string {
|
||||
if o == nil {
|
||||
var ret string
|
||||
return ret
|
||||
}
|
||||
|
||||
return o.Name
|
||||
}
|
||||
|
||||
// GetNameOk returns a tuple with the Name field value
|
||||
// and a boolean to check if the value has been set.
|
||||
func (o *GroupDB) GetNameOk() (*string, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return &o.Name, true
|
||||
}
|
||||
|
||||
// SetName sets field value
|
||||
func (o *GroupDB) SetName(v string) {
|
||||
o.Name = v
|
||||
}
|
||||
|
||||
// GetId returns the Id field value if set, zero value otherwise (both if not set or set to explicit null).
|
||||
func (o *GroupDB) GetId() int32 {
|
||||
if o == nil || IsNil(o.Id.Get()) {
|
||||
var ret int32
|
||||
return ret
|
||||
}
|
||||
return *o.Id.Get()
|
||||
}
|
||||
|
||||
// GetIdOk returns a tuple with the Id field value if set, nil otherwise
|
||||
// and a boolean to check if the value has been set.
|
||||
// NOTE: If the value is an explicit nil, `nil, true` will be returned
|
||||
func (o *GroupDB) GetIdOk() (*int32, bool) {
|
||||
if o == nil {
|
||||
return nil, false
|
||||
}
|
||||
return o.Id.Get(), o.Id.IsSet()
|
||||
}
|
||||
|
||||
// HasId returns a boolean if a field has been set.
|
||||
func (o *GroupDB) HasId() bool {
|
||||
if o != nil && o.Id.IsSet() {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// SetId gets a reference to the given NullableInt32 and assigns it to the Id field.
|
||||
func (o *GroupDB) SetId(v int32) {
|
||||
o.Id.Set(&v)
|
||||
}
|
||||
// SetIdNil sets the value for Id to be an explicit nil
|
||||
func (o *GroupDB) SetIdNil() {
|
||||
o.Id.Set(nil)
|
||||
}
|
||||
|
||||
// UnsetId ensures that no value is present for Id, not even an explicit nil
|
||||
func (o *GroupDB) UnsetId() {
|
||||
o.Id.Unset()
|
||||
}
|
||||
|
||||
func (o GroupDB) MarshalJSON() ([]byte, error) {
|
||||
toSerialize,err := o.ToMap()
|
||||
if err != nil {
|
||||
return []byte{}, err
|
||||
}
|
||||
return json.Marshal(toSerialize)
|
||||
}
|
||||
|
||||
func (o GroupDB) ToMap() (map[string]interface{}, error) {
|
||||
toSerialize := map[string]interface{}{}
|
||||
toSerialize["name"] = o.Name
|
||||
if o.Id.IsSet() {
|
||||
toSerialize["id"] = o.Id.Get()
|
||||
}
|
||||
return toSerialize, nil
|
||||
}
|
||||
|
||||
func (o *GroupDB) UnmarshalJSON(data []byte) (err error) {
|
||||
// This validates that all required properties are included in the JSON object
|
||||
// by unmarshalling the object into a generic map with string keys and checking
|
||||
// that every required field exists as a key in the generic map.
|
||||
requiredProperties := []string{
|
||||
"name",
|
||||
}
|
||||
|
||||
allProperties := make(map[string]interface{})
|
||||
|
||||
err = json.Unmarshal(data, &allProperties)
|
||||
|
||||
if err != nil {
|
||||
return err;
|
||||
}
|
||||
|
||||
for _, requiredProperty := range(requiredProperties) {
|
||||
if _, exists := allProperties[requiredProperty]; !exists {
|
||||
return fmt.Errorf("no value given for required property %v", requiredProperty)
|
||||
}
|
||||
}
|
||||
|
||||
varGroupDB := _GroupDB{}
|
||||
|
||||
decoder := json.NewDecoder(bytes.NewReader(data))
|
||||
decoder.DisallowUnknownFields()
|
||||
err = decoder.Decode(&varGroupDB)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*o = GroupDB(varGroupDB)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
type NullableGroupDB struct {
|
||||
value *GroupDB
|
||||
isSet bool
|
||||
}
|
||||
|
||||
func (v NullableGroupDB) Get() *GroupDB {
|
||||
return v.value
|
||||
}
|
||||
|
||||
func (v *NullableGroupDB) Set(val *GroupDB) {
|
||||
v.value = val
|
||||
v.isSet = true
|
||||
}
|
||||
|
||||
func (v NullableGroupDB) IsSet() bool {
|
||||
return v.isSet
|
||||
}
|
||||
|
||||
func (v *NullableGroupDB) Unset() {
|
||||
v.value = nil
|
||||
v.isSet = false
|
||||
}
|
||||
|
||||
func NewNullableGroupDB(val *GroupDB) *NullableGroupDB {
|
||||
return &NullableGroupDB{value: val, isSet: true}
|
||||
}
|
||||
|
||||
func (v NullableGroupDB) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(v.value)
|
||||
}
|
||||
|
||||
func (v *NullableGroupDB) UnmarshalJSON(src []byte) error {
|
||||
v.isSet = true
|
||||
return json.Unmarshal(src, &v.value)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user