Documentation ¶
Index ¶
- func ApplyExpand(entities interface{}, expand string, handler ExpandHandler) interface{}
- func ApplySelect(entities interface{}, selectQuery string) interface{}
- func ApplySkipTop(entities interface{}, skip, top string) interface{}
- func CreateODataResponse(w http.ResponseWriter, entitySet string, entities interface{})
- func CreateODataResponseSingle(w http.ResponseWriter, entitySet string, entity interface{})
- func EntityToMap(entity interface{}, expand string) map[string]interface{}
- func GenerateMetadata() string
- func ParseSelect(selectQuery string) string
- func RegisterEntity(entity Entity, handler EntityHandler)
- func RegisterEntityRelationship(entityName, relationshipName, targetEntityName, relationType string)
- func RegisterRoutes(router *chi.Mux)
- type DefaultExpandHandler
- type Entity
- type EntityHandler
- type ExpandHandler
- type OrderedFields
- type RelationshipInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyExpand ¶
func ApplyExpand(entities interface{}, expand string, handler ExpandHandler) interface{}
func ApplySelect ¶
func ApplySelect(entities interface{}, selectQuery string) interface{}
func ApplySkipTop ¶
func ApplySkipTop(entities interface{}, skip, top string) interface{}
func CreateODataResponse ¶
func CreateODataResponse(w http.ResponseWriter, entitySet string, entities interface{})
Helper function to create OData response for multiple entities
func CreateODataResponseSingle ¶
func CreateODataResponseSingle(w http.ResponseWriter, entitySet string, entity interface{})
Helper function to create OData response for a single entity
func EntityToMap ¶
func GenerateMetadata ¶
func GenerateMetadata() string
func ParseSelect ¶
func RegisterEntity ¶
func RegisterEntity(entity Entity, handler EntityHandler)
func RegisterEntityRelationship ¶
func RegisterEntityRelationship(entityName, relationshipName, targetEntityName, relationType string)
func RegisterRoutes ¶
func RegisterRoutes(router *chi.Mux)
Types ¶
type DefaultExpandHandler ¶
type DefaultExpandHandler struct{}
DefaultExpandHandler is a fallback handler that does nothing
func (DefaultExpandHandler) ExpandEntity ¶
func (h DefaultExpandHandler) ExpandEntity(entity OrderedFields, relationshipName string, subQuery string) interface{}
type EntityHandler ¶
type EntityHandler struct { GetEntityHandler func(http.ResponseWriter, *http.Request) GetEntityByIDHandler func(http.ResponseWriter, *http.Request, string) ExpandHandler }
func GetEntityHandler ¶
func GetEntityHandler(entityName string) (EntityHandler, bool)
type ExpandHandler ¶
type ExpandHandler interface {
ExpandEntity(entity OrderedFields, relationshipName string, subQuery string) interface{}
}
type OrderedFields ¶
OrderedFields represents a slice of key-value pairs to maintain field order
func ApplyExpandSingle ¶
func ApplyExpandSingle(entity interface{}, expand string, handler ExpandHandler) OrderedFields
func ApplySelectSingle ¶
func ApplySelectSingle(entity OrderedFields, selectedFields []string) OrderedFields
func EntityToOrderedFields ¶
func EntityToOrderedFields(entity interface{}, expand string) OrderedFields
func (OrderedFields) MarshalJSON ¶
func (of OrderedFields) MarshalJSON() ([]byte, error)
type RelationshipInfo ¶
Click to show internal directories.
Click to hide internal directories.