Files
dash/backend/dashapi/model_journal_entry.go
2022-11-07 15:33:08 +01:00

52 lines
1.4 KiB
Go

/*
* 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 JournalEntry struct {
Date string `json:"date"`
Thankful []string `json:"thankful,omitempty"`
LookingForward []string `json:"looking_forward,omitempty"`
BeenGreat []string `json:"been_great,omitempty"`
DoBetter []string `json:"do_better,omitempty"`
Journal string `json:"journal,omitempty"`
}
// AssertJournalEntryRequired checks if the required fields are not zero-ed
func AssertJournalEntryRequired(obj JournalEntry) error {
elements := map[string]interface{}{
"date": obj.Date,
}
for name, el := range elements {
if isZero := IsZeroValue(el); isZero {
return &RequiredError{Field: name}
}
}
return nil
}
// AssertRecurseJournalEntryRequired recursively checks if required fields are not zero-ed in a nested slice.
// Accepts only nested slice of JournalEntry (e.g. [][]JournalEntry), otherwise ErrTypeAssertionError is thrown.
func AssertRecurseJournalEntryRequired(objSlice interface{}) error {
return AssertRecurseInterfaceRequired(objSlice, func(obj interface{}) error {
aJournalEntry, ok := obj.(JournalEntry)
if !ok {
return ErrTypeAssertionError
}
return AssertJournalEntryRequired(aJournalEntry)
})
}