V2
This commit is contained in:
47
backend/dashapi/model_tracking_item.go
Normal file
47
backend/dashapi/model_tracking_item.go
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Dash API
|
||||
*
|
||||
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
||||
*
|
||||
* API version: 0.1
|
||||
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
|
||||
*/
|
||||
|
||||
package dashapi
|
||||
|
||||
type TrackingItem struct {
|
||||
|
||||
Date string `json:"date"`
|
||||
|
||||
Type string `json:"type"`
|
||||
|
||||
Value string `json:"value"`
|
||||
}
|
||||
|
||||
// AssertTrackingItemRequired checks if the required fields are not zero-ed
|
||||
func AssertTrackingItemRequired(obj TrackingItem) error {
|
||||
elements := map[string]interface{}{
|
||||
"date": obj.Date,
|
||||
"type": obj.Type,
|
||||
"value": obj.Value,
|
||||
}
|
||||
for name, el := range elements {
|
||||
if isZero := IsZeroValue(el); isZero {
|
||||
return &RequiredError{Field: name}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// AssertRecurseTrackingItemRequired recursively checks if required fields are not zero-ed in a nested slice.
|
||||
// Accepts only nested slice of TrackingItem (e.g. [][]TrackingItem), otherwise ErrTypeAssertionError is thrown.
|
||||
func AssertRecurseTrackingItemRequired(objSlice interface{}) error {
|
||||
return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
|
||||
aTrackingItem, ok := obj.(TrackingItem)
|
||||
if !ok {
|
||||
return ErrTypeAssertionError
|
||||
}
|
||||
return AssertTrackingItemRequired(aTrackingItem)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user