presenters

package
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

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

func PresentResource(r *api.Resource) openapi.Resource

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL