Documentation ¶
Index ¶
- func SerializeModel(backend db.Backend, m kit.Model) (*ApiModel, []*ApiModel, apperror.Error)
- func SerializeModels(backend db.Backend, models []kit.Model) ([]*ApiModel, []*ApiModel, apperror.Error)
- type ApiData
- func (d *ApiData) AddError(errs ...apperror.Error)
- func (d *ApiData) AddIncludedModel(s *Serializer, models ...kit.Model) apperror.Error
- func (d *ApiData) AddModel(s *Serializer, models ...kit.Model) apperror.Error
- func (d *ApiData) ReduceIncludedDuplicates()
- func (d *ApiData) ToMap() (map[string]interface{}, apperror.Error)
- type ApiError
- type ApiModel
- type ApiModelData
- type ApiModelsData
- type Serializer
- func (s *Serializer) MustSerializeResponse(response kit.Response) (interface{}, apperror.Error)
- func (s *Serializer) Name() string
- func (s *Serializer) SerializeModel(model kit.Model) (interface{}, []interface{}, apperror.Error)
- func (s *Serializer) SerializeResponse(response kit.Response) (interface{}, apperror.Error)
- func (s *Serializer) SerializeTransferData(transData kit.TransferData) (interface{}, apperror.Error)
- func (s *Serializer) UnserializeModel(collection string, rawData interface{}) (kit.Model, apperror.Error)
- func (s *Serializer) UnserializeRequest(rawData interface{}, request kit.Request) apperror.Error
- func (s *Serializer) UnserializeTransferData(rawData interface{}) (kit.TransferData, apperror.Error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SerializeModel ¶
Types ¶
type ApiData ¶
type ApiData struct { Data interface{} `json:"data"` Included []*ApiModel `json:"included,omitempty"` Meta map[string]interface{} `json:"meta,omitempty"` Errors []*ApiError `json:"errors,omitempty"` }
func (*ApiData) AddIncludedModel ¶
func (d *ApiData) AddIncludedModel(s *Serializer, models ...kit.Model) apperror.Error
func (*ApiData) AddModel ¶
func (d *ApiData) AddModel(s *Serializer, models ...kit.Model) apperror.Error
func (*ApiData) ReduceIncludedDuplicates ¶
func (d *ApiData) ReduceIncludedDuplicates()
type ApiError ¶
type ApiError struct { Code string `json:"code,omitempty"` Message string `json:"message,omitempty"` }
func SerializeError ¶
type ApiModel ¶
type ApiModel struct { Type string `json:"type"` Id string `json:"id"` Attributes map[string]interface{} `json:"attributes,omitempty"` Relationships map[string]map[string]interface{} `json:"relationships,omitempty"` }
func ApiModelFromMap ¶
func ApiModelFromMap(rawData interface{}) (*ApiModel, apperror.Error)
func ApiModelsFromData ¶
func (*ApiModel) AddRelation ¶
func (*ApiModel) GetRelation ¶
func (ApiModel) GetRelations ¶
type ApiModelData ¶
type ApiModelsData ¶
type Serializer ¶
type Serializer struct {
// contains filtered or unexported fields
}
func (*Serializer) MustSerializeResponse ¶
func (s *Serializer) MustSerializeResponse(response kit.Response) (interface{}, apperror.Error)
func (*Serializer) Name ¶
func (s *Serializer) Name() string
func (*Serializer) SerializeModel ¶
func (s *Serializer) SerializeModel(model kit.Model) (interface{}, []interface{}, apperror.Error)
SerializeModel converts a model into the target format.
func (*Serializer) SerializeResponse ¶
func (s *Serializer) SerializeResponse(response kit.Response) (interface{}, apperror.Error)
SerializeResponse converts a response with model data into the target format.
func (*Serializer) SerializeTransferData ¶
func (s *Serializer) SerializeTransferData(transData kit.TransferData) (interface{}, apperror.Error)
func (*Serializer) UnserializeModel ¶
func (s *Serializer) UnserializeModel(collection string, rawData interface{}) (kit.Model, apperror.Error)
func (*Serializer) UnserializeRequest ¶
func (s *Serializer) UnserializeRequest(rawData interface{}, request kit.Request) apperror.Error
UnserializeRequest converts request data into a request object.
func (*Serializer) UnserializeTransferData ¶
func (s *Serializer) UnserializeTransferData(rawData interface{}) (kit.TransferData, apperror.Error)
Click to show internal directories.
Click to hide internal directories.