Documentation
¶
Index ¶
- type ContainsSubPathsErr
- type Element
- type InvalidOrderErr
- type ResourceSchema
- func (r *ResourceSchema) DisablePrecedingLevels()
- func (r *ResourceSchema) NewElement(key string, order int)
- func (r *ResourceSchema) Parse(url *url.URL) (map[string]string, error)
- func (r *ResourceSchema) SetAllowSubPaths(allowSubPaths bool)
- func (r *ResourceSchema) SetEnforceOrder(enforceOrder bool)
- func (r *ResourceSchema) SetPrecedingLevels(precedingLevels int) error
- type SubPathsAllowedErr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContainsSubPathsErr ¶
type ContainsSubPathsErr struct{}
ContainsSubPathsErr is returned, when SubPaths are present in the URL (unspecified Elements)
func (ContainsSubPathsErr) Error ¶
func (e ContainsSubPathsErr) Error() string
type Element ¶
type Element struct { Key string // Element key Order int // Order of the element in URL Resource Schema }
Element is an identifier before the value (eg. /users/john, where "users" is the element and "john" is the value)
type InvalidOrderErr ¶
type InvalidOrderErr struct{}
InvalidOrderErr is returned, when the Element order in parsed URL is invalid
func (InvalidOrderErr) Error ¶
func (e InvalidOrderErr) Error() string
type ResourceSchema ¶
type ResourceSchema struct {
// contains filtered or unexported fields
}
ResourceSchema contains elements that define its structure ( (Element.Key/Value) / (Element.Key/Value) / ... )
func NewResourceSchema ¶
func NewResourceSchema() ResourceSchema
NewResourceSchema initializes ResourceSchema and returns it
func (*ResourceSchema) DisablePrecedingLevels ¶
func (r *ResourceSchema) DisablePrecedingLevels()
DisablePrecedingLevels disables preceding level check
func (*ResourceSchema) NewElement ¶
func (r *ResourceSchema) NewElement(key string, order int)
NewElement creates a new element
func (*ResourceSchema) Parse ¶
Parse the URL into ResourceSchema
func (*ResourceSchema) SetAllowSubPaths ¶
func (r *ResourceSchema) SetAllowSubPaths(allowSubPaths bool)
SetAllowSubPaths allows Element + N-Elements
func (*ResourceSchema) SetEnforceOrder ¶
func (r *ResourceSchema) SetEnforceOrder(enforceOrder bool)
SetEnforceOrder enforces the Element.Order spec
func (*ResourceSchema) SetPrecedingLevels ¶
func (r *ResourceSchema) SetPrecedingLevels(precedingLevels int) error
SetPrecedingLevels sets the allowed levels before the elements
type SubPathsAllowedErr ¶
type SubPathsAllowedErr struct{}
SubPathsAllowedErr is returned, when you try to enforce preceding levels
func (SubPathsAllowedErr) Error ¶
func (e SubPathsAllowedErr) Error() string