Documentation ¶
Overview ¶
This package implements modification and evaluation of Resource
Index ¶
- func Add(resource *prop.Resource, path string, value interface{}) error
- func Delete(resource *prop.Resource, path string) error
- func Evaluate(resource *prop.Resource, filter string) (bool, error)
- func Register(resourceType *spec.ResourceType)
- func Replace(resource *prop.Resource, path string, value interface{}) error
- func SeekSortTarget(resource *prop.Resource, by *expr.Expression) (prop.Property, error)
- type Pagination
- type Projection
- type Sort
- type SortOrder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
Add value to SCIM resource at the given SCIM path. If SCIM path is empty, value will be added to the root of the resource. The supplied value must be compatible with the target property attribute, otherwise error will be returned.
func Delete ¶
Delete value from the SCIM resource at the specified SCIM path. The path cannot be empty.
func Evaluate ¶
Evaluate the resource with the given SCIM filter and return the boolean result or an error.
func Register ¶
func Register(resourceType *spec.ResourceType)
Register calls expr.RegisterURN for the main schema ids and all schema extension ids in the resource type.
func Replace ¶
Replace value in SCIM resource at the given SCIM path. If SCIM path is empty, the root of the resource will be replaced. The supplied value must be compatible with the target property attribute, otherwise error will be returned.
func SeekSortTarget ¶
Find the actual sort target inferred by the sortBy parameter. 'resource' points to the Resource whose value is being sorted. 'by' is the compiled sortBy path. Depending on the sortBy parameter, the actual sort target varies in several cases.
First, if the sortBy parameter refers to a simple type inside a singular complex type, it will be the sort target. For instance,
sortBy=name.familyName
Given the following resource snippet:
{ "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"], "id": "FA33AA7E-99DB-4446-A2CD-050133B442DA", "userName": "imulab", "name": { "familyName": "Qiu", "givenName": "David" } }
The value "Qiu" will be used to sort the resource. This also applies to any top level singular simple types, as this project treats top-level container as a virtual complex property as well.
Second, if the sortBy parameter refers to a simple type inside a multiValued complex type, the sort target will be the value whose accompanying primary attribute was set to 'true', or the first value. For instance,
sortBy=emails.value
Given the following resource snippet:
{ "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"], "id": "FA33AA7E-99DB-4446-A2CD-050133B442DA", "userName": "imulab", "emails": [ { "value": "foo@bar.com" }, { "value": "bar@foo.com", "primary": true } ] }
The value "bar@foo.com" will be used to sort the resource, because its accompany primary attribute is true.
However, if none of the primary attribute was set to true, like:
{ "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"], "id": "FA33AA7E-99DB-4446-A2CD-050133B442DA", "userName": "imulab", "emails": [ { "value": "foo@bar.com" }, { "value": "bar@foo.com" } ] }
In this case, "foo@bar.com" will be used to sort the resource, because it is the first value.
Third, if the sortBy parameter refers to multiValued simple type, the sort target will be its first element. For instance,
sortBy=schemas
Given the following resource snippet:
{ "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User", "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User"], "id": "FA33AA7E-99DB-4446-A2CD-050133B442DA", "userName": "imulab", "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": { "employeeNumber": "11250" } }
The value "urn:ietf:params:scim:schemas:core:2.0:User" will be used to sort the resource because it is the first element.
Other sortBy parameters that does not fall into the above three categories are considered to be invalid.
Types ¶
type Pagination ¶
Option to paginate.
type Projection ¶
Option to include or exclude attributes in the return. At most one can be specified.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
This package implements compilers for SCIM path and SCIM filters, and defines the basic data structure for their representation in memory.
|
This package implements compilers for SCIM path and SCIM filters, and defines the basic data structure for their representation in memory. |