Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionResponse ¶
type ActionResponse struct { BaseRestResponse Key string `json:"key,omitempty"` // The entity key (Id) Data string `json:"data,omitempty"` // Additional data }
ActionResponse message is returned for any action on entity with no return data (e.d. delete)
func NewActionResponse ¶
func NewActionResponse(key, data string) (er *ActionResponse)
NewActionResponse factory method
type BaseRestResponse ¶
type BaseRestResponse struct { Code int `json:"code"` // Error code (0 for success) Error string `json:"error,omitempty"` // Error message }
BaseRestResponse is a common structure for all response types
func NewErrorResponse ¶ added in v1.2.19
func NewErrorResponse(err error) (res *BaseRestResponse)
NewErrorResponse response with error
func (*BaseRestResponse) SetError ¶
func (res *BaseRestResponse) SetError(err error)
SetError sets error message
type EntitiesResponse ¶
type EntitiesResponse[T Entity] struct { BaseRestResponse Page int `json:"page"` // Current page (Bulk) number Size int `json:"size"` // Size of page (items in bulk) Pages int `json:"pages"` // Total number of pages Total int `json:"total"` // Total number of items in the query List []T `json:"list"` // List of objects in the current result set }
EntitiesResponse message is returned for any action returning multiple entities
func NewEntitiesResponse ¶
func NewEntitiesResponse[T Entity](entities []T, page, size, total int) *EntitiesResponse[T]
NewEntitiesResponse factory method
type EntityResponse ¶
type EntityResponse[T Entity] struct { BaseRestResponse Entity T `json:"entity"` // The entity }
EntityResponse message is returned for any create/update action on entity
func NewEntityResponse ¶
func NewEntityResponse[T Entity](entity T) (er *EntityResponse[T])
NewEntityResponse factory method
Click to show internal directories.
Click to hide internal directories.