Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckRequired ¶
CheckRequired returns an error if at least one required attribute of res was not asserted by the client
func GetUniqueAttributes ¶
GetUniqueAttributes is ... (todo) > add support to multi key indexes
Types ¶
type Context ¶
A Context represents a set of definitions related to a Path
func Contexts ¶
Contexts returns a slice of Context given a resource type rt.
It flattens the attributes of rt's schemas returning their Context representations. When a fx is provided it returns all the attributes statisfying fx(attribute).
func (*Context) Set ¶
Set value to valuer at destination path of this context
Value should be datatype.DataTyper or []datatype.DataTyper or nil. Furthermore attribute's characteristics are not enforced nor checked according to DataTypes rules when used within maps.
However, when context is pointing to a sub-attribute and parent attribute is missing, parent's value will be created with respect of attribute definition in order to accomodate the nested sub-attribute's value.
Value will be not set if it's not possibile to accomodate the sub-attribute's value in any way (eg. trying to set a sub-attribute's value in a map that's not respecting the parent attribute's definition).
Usage example: Parse("emails.type").Context(res.ResourceType()).Set(datatype.String("home"), res) for each complex value within "emails" (it's a multi value), the value of "type" sub-attribute will be set to "home".
type Path ¶
A Path represents a parsed SCIM attribute path as per https://tools.ietf.org/html/rfc7644#section-3.10
func Paths ¶
Paths returns a slice of Path given a resource type rt.
It flattens the attributes of rt's schemas returning their contextualized Path representations. When a fx is provided it returns only the attribute paths statisfying fx(attribute).
func Projection ¶
Projection computes a set of attribute paths
The logic it enables is the one described within the RFC at sections:
- https://tools.ietf.org/html/rfc7644#section-3.4.2.5
- https://tools.ietf.org/html/rfc7644#section-3.4.3
- https://tools.ietf.org/html/rfc7644#section-3.9
In short the logic is (D - E - N) ∪ A where:
I: { i | i explicitly included by the user }
E: { e | e explicitly excluded by the user }
N: { n | n.Returned == "never" }
A: { a | a.Returned == "always" }
D: I if I != ∅ || { d | d.Returned == "default" }
Furthermore, attributes with Mutability == "writeOnly" cannot be returned too. So, pragmatically, they are treated as Returned == "never", as per: - https://tools.ietf.org/html/rfc7643#section-7
func (Path) Context ¶
func (p Path) Context(rt *core.ResourceType) (ctx *Context)
Context fetches from rt a suitable Context for p, if any.
Nil when p is an unknown path attribute.
func (Path) IsSubAttribute ¶
IsSubAttribute returns true if the path refers to an attribute with a parent
While p.Name refers to the name of the parent, p.Sub refers to the name of its children.