Documentation
¶
Index ¶
- func ConvertAdapterStatus(resourceType, resourceID string, req *openapi.AdapterStatusCreateRequest) (*api.AdapterStatus, error)
- func ConvertResource(req *openapi.ResourceCreateRequest) (*api.Resource, error)
- func ConvertResourceWithOwner(req *openapi.ResourceCreateRequest, ownerID, ownerKind, ownerHref string) (*api.Resource, error)
- func FilterSingle(fields2Store []string, resource interface{}) (map[string]interface{}, *errors.ServiceError)
- func PresentAdapterStatus(adapterStatus *api.AdapterStatus) (openapi.AdapterStatus, error)
- func PresentResource(r *api.Resource) openapi.Resource
- func PresentResourceList(resources api.ResourceList, paging *api.PagingMeta) openapi.ResourceList
- func RegisterKind(objType interface{}, kindValue string)
- func RegisterPath(objType interface{}, pathValue string)
- type KindMappingFunc
- type PathMappingFunc
- type ProjectionList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertAdapterStatus ¶
func ConvertAdapterStatus( resourceType, resourceID string, req *openapi.AdapterStatusCreateRequest, ) (*api.AdapterStatus, error)
ConvertAdapterStatus converts openapi.AdapterStatusCreateRequest to api.AdapterStatus (GORM model)
func ConvertResource ¶ added in v0.3.0
func ConvertResource(req *openapi.ResourceCreateRequest) (*api.Resource, error)
ConvertResource converts an openapi.ResourceCreateRequest to an api.Resource GORM model. CreatedBy/UpdatedBy are set by the service layer from auth context.
func ConvertResourceWithOwner ¶ added in v0.3.0
func ConvertResourceWithOwner( req *openapi.ResourceCreateRequest, ownerID, ownerKind, ownerHref string, ) (*api.Resource, error)
ConvertResourceWithOwner converts a request to a child resource with owner references set.
func FilterSingle ¶ added in v0.3.1
func FilterSingle(fields2Store []string, resource interface{}) (map[string]interface{}, *errors.ServiceError)
FilterSingle returns a projected map containing only the requested fields from a single resource. This is the single-resource equivalent of SliceFilter.
func PresentAdapterStatus ¶
func PresentAdapterStatus(adapterStatus *api.AdapterStatus) (openapi.AdapterStatus, error)
PresentAdapterStatus converts api.AdapterStatus (GORM model) to openapi.AdapterStatus
func PresentResource ¶ added in v0.3.0
PresentResource converts an api.Resource GORM model to an openapi.Resource.
func PresentResourceList ¶ added in v0.3.0
func PresentResourceList(resources api.ResourceList, paging *api.PagingMeta) openapi.ResourceList
PresentResourceList converts a slice of resources and paging metadata to an openapi.ResourceList.
func RegisterKind ¶
func RegisterKind(objType interface{}, kindValue string)
func RegisterPath ¶
func RegisterPath(objType interface{}, pathValue string)
Types ¶
type KindMappingFunc ¶
type KindMappingFunc func(interface{}) string
type PathMappingFunc ¶
type PathMappingFunc func(interface{}) string
type ProjectionList ¶
type ProjectionList struct {
Items []map[string]interface{} `json:"items"`
Page int32 `json:"page"`
Size int32 `json:"size"`
Total int32 `json:"total"`
}
func SliceFilter ¶
func SliceFilter(fields2Store []string, model interface{}) (*ProjectionList, *errors.ServiceError)
SliceFilter returns a projected list containing requested fields from each item