Documentation ¶
Index ¶
- Constants
- func HateoasList(response ResponseListI, parentResource Resource, resourceType string)
- func InjectHateoasLinksToObject(resource Resource, withLinks WithHateoasLinks)
- func PrepareCollectionAndNameResource(typeName string) (serviceName string, collectionResource Resource, objectResource Resource)
- type DbQuery
- type HateoasLink
- type HateoasLinksContainer
- type HateoasLinksItem
- type HateoasLinksStub
- type ObjectWithHateoasLinks
- type Operation
- func Add(name string) Operation
- func Bind(name string) Operation
- func Check(name string) Operation
- func Create(name string) Operation
- func Delete(name string) Operation
- func Exists(name string) Operation
- func Find(name string) Operation
- func Get(name string) Operation
- func List(name string) Operation
- func NamedResourceOperation(sampleResource Resource, resourceId string, op Operation) Operation
- func NamedSubresourceOperation(sampleResource Resource, resourceId string, subResourceName string, ...) Operation
- func OperationAsResource(sampleResource Resource, resourceName string, resourceId string, op Operation) Operation
- func Post(name string) Operation
- func Read(name string) Operation
- func SubresourceOperation(sampleResource Resource, resourceId string, subResourceName string, ...) Operation
- func Unbind(name string) Operation
- func Update(name string) Operation
- func UpdatePartial(name string) Operation
- type OperationBase
- func (o *OperationBase) AccessType() access_control.AccessType
- func (o *OperationBase) Exec(ctx op_context.Context, handler OperationHandler) error
- func (o *OperationBase) ExecInTenancy(ctx multitenancy.TenancyContext, handler TenancyOperationHandler) error
- func (o *OperationBase) Init(name string, accessType access_control.AccessType, testOnly ...bool)
- func (o *OperationBase) Name() string
- func (o *OperationBase) Resource() Resource
- func (o *OperationBase) SetResource(resource Resource)
- func (o *OperationBase) SetTestOnly(val bool)
- func (o *OperationBase) TestOnly() bool
- type OperationHandler
- type Query
- type QueryWithGroupBy
- type Resource
- func AddChildResource(resource Resource, childName string) Resource
- func GroupResource(resourceType string) Resource
- func NamedResource(resourceType string) Resource
- func NamedSubresource(sampleResource Resource, resourceId string, subResourceName string, ...) Resource
- func NewResourceWithNamedSubresource(resourceName string, subResourceName string, op ...Operation) Resource
- func NewResourceWithOp(resourceName string, op Operation) Resource
- func Subresource(sampleResource Resource, resourceId string, subResourceName string) Resource
- type ResourceBase
- func (r *ResourceBase) ActualPath() string
- func (r *ResourceBase) AddChild(child Resource, rebuild ...bool)
- func (r *ResourceBase) AddChildren(resources ...Resource)
- func (r *ResourceBase) AddOperation(operation Operation, getter ...bool)
- func (r *ResourceBase) AddOperations(operations ...Operation)
- func (r *ResourceBase) BuildActualPath(actualResourceIds map[string]string, service ...bool) string
- func (r *ResourceBase) Chain() []Resource
- func (r *ResourceBase) ChainHasResourceType(resourceType string) bool
- func (r *ResourceBase) ChainResourceId(resourceType string) string
- func (r *ResourceBase) Children() []Resource
- func (r *ResourceBase) Clone(withOperations bool) Resource
- func (r *ResourceBase) CloneChain(withOperations bool) Resource
- func (r *ResourceBase) EachOperation(handler func(operation Operation) error, recursive ...bool) error
- func (r *ResourceBase) FillActualPaths(actualResourceIds map[string]string)
- func (r *ResourceBase) FullActualPath() string
- func (r *ResourceBase) FullActualTenancyPath(tenancyPath string) string
- func (r *ResourceBase) FullPathPrototype() string
- func (r *ResourceBase) Getter() Operation
- func (r *ResourceBase) HasId() bool
- func (r *ResourceBase) Host() string
- func (r *ResourceBase) Id() string
- func (r *ResourceBase) Init(resourceType string, config ...ResourceConfig)
- func (r *ResourceBase) IsInTenancy() bool
- func (r *ResourceBase) IsService() bool
- func (r *ResourceBase) IsServicePart() bool
- func (r *ResourceBase) IsTenancy() bool
- func (r *ResourceBase) Operations() []Operation
- func (r *ResourceBase) ParameterSubstitution() string
- func (r *ResourceBase) Parent() Resource
- func (r *ResourceBase) PathPrototype() string
- func (r *ResourceBase) RebuildPaths()
- func (r *ResourceBase) RemoveOperation(name string)
- func (r *ResourceBase) RemoveOperations(accessType access_control.AccessType)
- func (r *ResourceBase) ReplaceOperation(op Operation)
- func (r *ResourceBase) ResetIds()
- func (r *ResourceBase) ServiceActualPath() string
- func (r *ResourceBase) ServicePathPrototype() string
- func (r *ResourceBase) ServiceResource() Resource
- func (r *ResourceBase) SetHasId(val bool)
- func (r *ResourceBase) SetHost(val string)
- func (r *ResourceBase) SetId(val string, rebuild ...bool)
- func (r *ResourceBase) SetParent(parent Resource, rebuild ...bool)
- func (r *ResourceBase) SetSetvice(val bool)
- func (r *ResourceBase) TenancyResourceInPath() Resource
- func (r *ResourceBase) Type() string
- type ResourceConfig
- type Response
- type ResponseBase
- type ResponseCount
- type ResponseExists
- type ResponseList
- type ResponseListI
- type ResponseStatus
- type ResponseStub
- type TenancyOperationHandler
- type UpdateCmd
- type WithDbQuery
- type WithGroupBy
- type WithHateoasLinks
Constants ¶
View Source
const ( TargetSelf = "self" TargetParent = "parent" TargetChild = "parent" )
View Source
const ForwardContext = "X-Forward-Context"
View Source
const ForwardOpSource = "X-Forward-Op-Source"
View Source
const ForwardSessionClient = "X-Forward-Session-Client"
View Source
const ForwardUserDisplay = "X-Forward-User-Display"
View Source
const ForwardUserId = "X-Forward-User-Id"
View Source
const ForwardUserLogin = "X-Forward-User-Login"
Variables ¶
This section is empty.
Functions ¶
func HateoasList ¶
func HateoasList(response ResponseListI, parentResource Resource, resourceType string)
func InjectHateoasLinksToObject ¶
func InjectHateoasLinksToObject(resource Resource, withLinks WithHateoasLinks)
Types ¶
type HateoasLink ¶
type HateoasLink struct { Target string `json:"target,omitempty"` Operation string `json:"operation,omitempty"` HttpMethod string `json:"http_method,omitempty"` Host string `json:"host,omitempty"` Path string `json:"path,omitempty"` }
func MakeHateoasLinks ¶
func MakeHateoasLinks(resource Resource, withTestOps ...bool) []*HateoasLink
type HateoasLinksContainer ¶
type HateoasLinksContainer struct {
HateoasLinks []*HateoasLink `json:"_links,omitempty" gorm:"-:all"`
}
func (*HateoasLinksContainer) SetHateoasLinks ¶
func (h *HateoasLinksContainer) SetHateoasLinks(links []*HateoasLink)
type HateoasLinksItem ¶
type HateoasLinksItem struct { common.IDBase HateoasLinksContainer }
type HateoasLinksStub ¶
type HateoasLinksStub struct { }
func (*HateoasLinksStub) SetHateoasLinks ¶
func (h *HateoasLinksStub) SetHateoasLinks(links []*HateoasLink)
type ObjectWithHateoasLinks ¶
type ObjectWithHateoasLinks interface { common.WithID WithHateoasLinks }
type Operation ¶
type Operation interface { Name() string SetResource(resource Resource) Resource() Resource AccessType() access_control.AccessType Exec(ctx op_context.Context, handler OperationHandler) error ExecInTenancy(ctx multitenancy.TenancyContext, handler TenancyOperationHandler) error TestOnly() bool SetTestOnly(val bool) }
func NamedResourceOperation ¶
func OperationAsResource ¶
func SubresourceOperation ¶
func UpdatePartial ¶
type OperationBase ¶
type OperationBase struct {
// contains filtered or unexported fields
}
func NewOperation ¶
func NewOperation(name string, accessType access_control.AccessType, testOnly ...bool) *OperationBase
func (*OperationBase) AccessType ¶
func (o *OperationBase) AccessType() access_control.AccessType
func (*OperationBase) Exec ¶
func (o *OperationBase) Exec(ctx op_context.Context, handler OperationHandler) error
func (*OperationBase) ExecInTenancy ¶
func (o *OperationBase) ExecInTenancy(ctx multitenancy.TenancyContext, handler TenancyOperationHandler) error
func (*OperationBase) Init ¶
func (o *OperationBase) Init(name string, accessType access_control.AccessType, testOnly ...bool)
func (*OperationBase) Name ¶
func (o *OperationBase) Name() string
func (*OperationBase) Resource ¶
func (o *OperationBase) Resource() Resource
func (*OperationBase) SetResource ¶
func (o *OperationBase) SetResource(resource Resource)
func (*OperationBase) SetTestOnly ¶
func (o *OperationBase) SetTestOnly(val bool)
func (*OperationBase) TestOnly ¶
func (o *OperationBase) TestOnly() bool
type OperationHandler ¶
type OperationHandler = func(ctx op_context.Context, operation Operation) error
type QueryWithGroupBy ¶
type QueryWithGroupBy struct { *DbQuery WithGroupBy }
type Resource ¶
type Resource interface { Host() string SetHost(val string) Type() string Id() string SetId(val string, rebuild ...bool) HasId() bool SetHasId(val bool) IsService() bool SetSetvice(val bool) IsServicePart() bool ServiceResource() Resource IsTenancy() bool IsInTenancy() bool TenancyResourceInPath() Resource SetParent(parent Resource, rebuild ...bool) Parent() Resource AddChild(resource Resource, rebuild ...bool) AddChildren(resources ...Resource) Children() []Resource AddOperation(operation Operation, getter ...bool) AddOperations(operations ...Operation) Operations() []Operation Getter() Operation EachOperation(handler func(operation Operation) error, recursive ...bool) error RemoveOperations(accessType access_control.AccessType) RemoveOperation(name string) ReplaceOperation(op Operation) PathPrototype() string ParameterSubstitution() string ActualPath() string FullPathPrototype() string FullActualPath() string FullActualTenancyPath(tenancyId string) string ServicePathPrototype() string ServiceActualPath() string BuildActualPath(actualResourceIds map[string]string, service ...bool) string FillActualPaths(actualResourceIds map[string]string) ResetIds() RebuildPaths() Chain() []Resource ChainResourceId(resourceType string) string ChainHasResourceType(resourceType string) bool Clone(withOperations bool) Resource CloneChain(withOperations bool) Resource }
func AddChildResource ¶
func GroupResource ¶
func NamedResource ¶
func NamedSubresource ¶
func NewResourceWithOp ¶
type ResourceBase ¶
type ResourceBase struct { ResourceConfig // contains filtered or unexported fields }
func NewResource ¶
func NewResource(resourceType string, config ...ResourceConfig) *ResourceBase
func NewTenancyResource ¶
func NewTenancyResource(tenancyResourceName ...string) *ResourceBase
func (*ResourceBase) ActualPath ¶
func (r *ResourceBase) ActualPath() string
func (*ResourceBase) AddChild ¶
func (r *ResourceBase) AddChild(child Resource, rebuild ...bool)
func (*ResourceBase) AddChildren ¶
func (r *ResourceBase) AddChildren(resources ...Resource)
func (*ResourceBase) AddOperation ¶
func (r *ResourceBase) AddOperation(operation Operation, getter ...bool)
func (*ResourceBase) AddOperations ¶
func (r *ResourceBase) AddOperations(operations ...Operation)
func (*ResourceBase) BuildActualPath ¶
func (r *ResourceBase) BuildActualPath(actualResourceIds map[string]string, service ...bool) string
func (*ResourceBase) Chain ¶
func (r *ResourceBase) Chain() []Resource
func (*ResourceBase) ChainHasResourceType ¶
func (r *ResourceBase) ChainHasResourceType(resourceType string) bool
func (*ResourceBase) ChainResourceId ¶
func (r *ResourceBase) ChainResourceId(resourceType string) string
func (*ResourceBase) Children ¶
func (r *ResourceBase) Children() []Resource
func (*ResourceBase) Clone ¶
func (r *ResourceBase) Clone(withOperations bool) Resource
func (*ResourceBase) CloneChain ¶
func (r *ResourceBase) CloneChain(withOperations bool) Resource
func (*ResourceBase) EachOperation ¶
func (r *ResourceBase) EachOperation(handler func(operation Operation) error, recursive ...bool) error
func (*ResourceBase) FillActualPaths ¶
func (r *ResourceBase) FillActualPaths(actualResourceIds map[string]string)
func (*ResourceBase) FullActualPath ¶
func (r *ResourceBase) FullActualPath() string
func (*ResourceBase) FullActualTenancyPath ¶
func (r *ResourceBase) FullActualTenancyPath(tenancyPath string) string
func (*ResourceBase) FullPathPrototype ¶
func (r *ResourceBase) FullPathPrototype() string
func (*ResourceBase) Getter ¶
func (r *ResourceBase) Getter() Operation
func (*ResourceBase) HasId ¶
func (r *ResourceBase) HasId() bool
func (*ResourceBase) Host ¶
func (r *ResourceBase) Host() string
func (*ResourceBase) Id ¶
func (r *ResourceBase) Id() string
func (*ResourceBase) Init ¶
func (r *ResourceBase) Init(resourceType string, config ...ResourceConfig)
func (*ResourceBase) IsInTenancy ¶
func (r *ResourceBase) IsInTenancy() bool
func (*ResourceBase) IsService ¶
func (r *ResourceBase) IsService() bool
func (*ResourceBase) IsServicePart ¶
func (r *ResourceBase) IsServicePart() bool
func (*ResourceBase) IsTenancy ¶
func (r *ResourceBase) IsTenancy() bool
func (*ResourceBase) Operations ¶
func (r *ResourceBase) Operations() []Operation
func (*ResourceBase) ParameterSubstitution ¶
func (r *ResourceBase) ParameterSubstitution() string
func (*ResourceBase) Parent ¶
func (r *ResourceBase) Parent() Resource
func (*ResourceBase) PathPrototype ¶
func (r *ResourceBase) PathPrototype() string
func (*ResourceBase) RebuildPaths ¶
func (r *ResourceBase) RebuildPaths()
func (*ResourceBase) RemoveOperation ¶
func (r *ResourceBase) RemoveOperation(name string)
func (*ResourceBase) RemoveOperations ¶
func (r *ResourceBase) RemoveOperations(accessType access_control.AccessType)
func (*ResourceBase) ReplaceOperation ¶
func (r *ResourceBase) ReplaceOperation(op Operation)
func (*ResourceBase) ResetIds ¶
func (r *ResourceBase) ResetIds()
func (*ResourceBase) ServiceActualPath ¶
func (r *ResourceBase) ServiceActualPath() string
func (*ResourceBase) ServicePathPrototype ¶
func (r *ResourceBase) ServicePathPrototype() string
func (*ResourceBase) ServiceResource ¶
func (r *ResourceBase) ServiceResource() Resource
func (*ResourceBase) SetHasId ¶
func (r *ResourceBase) SetHasId(val bool)
func (*ResourceBase) SetHost ¶
func (r *ResourceBase) SetHost(val string)
func (*ResourceBase) SetId ¶
func (r *ResourceBase) SetId(val string, rebuild ...bool)
func (*ResourceBase) SetParent ¶
func (r *ResourceBase) SetParent(parent Resource, rebuild ...bool)
func (*ResourceBase) SetSetvice ¶
func (r *ResourceBase) SetSetvice(val bool)
func (*ResourceBase) TenancyResourceInPath ¶
func (r *ResourceBase) TenancyResourceInPath() Resource
func (*ResourceBase) Type ¶
func (r *ResourceBase) Type() string
type ResourceConfig ¶
type Response ¶
type Response interface { WithHateoasLinks }
type ResponseBase ¶
type ResponseBase struct {
HateoasLinksContainer
}
type ResponseCount ¶
type ResponseCount struct {
Count int64 `json:"count,omitempty"`
}
type ResponseExists ¶
type ResponseExists struct { ResponseStub Exists bool `json:"exists"` }
type ResponseList ¶
type ResponseList[T common.WithID] struct { ResponseCount Items []T `json:"items"` ResponseBase ItemLinks []*HateoasLinksItem `json:"_item_links,omitempty"` }
func (*ResponseList[T]) ItemCount ¶
func (r *ResponseList[T]) ItemCount() int
func (*ResponseList[T]) ItemId ¶
func (r *ResponseList[T]) ItemId(index int) string
func (*ResponseList[T]) MakeItemLinks ¶
func (r *ResponseList[T]) MakeItemLinks()
func (*ResponseList[T]) SetItemLink ¶
func (r *ResponseList[T]) SetItemLink(index int, link *HateoasLinksItem)
type ResponseListI ¶
type ResponseStatus ¶
type ResponseStatus struct { ResponseStub Status string `json:"status"` }
type ResponseStub ¶
type ResponseStub struct {
HateoasLinksStub
}
type TenancyOperationHandler ¶
type TenancyOperationHandler = func(ctx multitenancy.TenancyContext, operation Operation) error
type WithDbQuery ¶
type WithDbQuery struct {
Query string `json:"query"`
}
type WithGroupBy ¶
type WithGroupBy struct {
GroupBy []string `json:"group_by"`
}
func (*WithGroupBy) Groups ¶
func (w *WithGroupBy) Groups() []string
type WithHateoasLinks ¶
type WithHateoasLinks interface {
SetHateoasLinks([]*HateoasLink)
}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.