Documentation
¶
Overview ¶
Package patch provides SCIM PATCH operation handling.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Applier ¶
type Applier struct {
// CaseSensitive controls whether attribute names are matched case-sensitively.
CaseSensitive bool
}
Applier applies PATCH operations to resources.
type Operation ¶
type Operation struct {
Op OperationType `json:"op"`
Path string `json:"path,omitempty"`
Value any `json:"value,omitempty"`
}
Operation represents a single SCIM PATCH operation.
func (Operation) MarshalJSON ¶
MarshalJSON implements custom JSON marshaling for Operation.
func (*Operation) UnmarshalJSON ¶
UnmarshalJSON implements custom JSON unmarshaling for Operation.
type OperationType ¶
type OperationType string
OperationType represents the type of a PATCH operation.
const ( OpAdd OperationType = "add" OpRemove OperationType = "remove" OpReplace OperationType = "replace" )
func ParseOperationType ¶
func ParseOperationType(s string) (OperationType, error)
ParseOperationType parses an operation type string.
type Path ¶
type Path struct {
// Attribute is the main attribute name.
Attribute string
// SubAttribute is the optional sub-attribute name.
SubAttribute string
// Filter is the optional filter for multi-valued attributes (e.g., "type eq 'work'").
Filter string
// URIPrefix is the optional schema URI prefix.
URIPrefix string
}
Path represents a parsed PATCH path.
func ParsePath ¶
ParsePath parses a SCIM PATCH path string. Supported formats:
- "attribute"
- "attribute.subAttribute"
- "attribute[filter]"
- "attribute[filter].subAttribute"
- "urn:schema:attribute"
- "urn:schema:attribute.subAttribute"
func (*Path) IsMultiValued ¶
IsMultiValued returns true if the path has a filter for multi-valued attributes.
type Request ¶
type Request struct {
Schemas []string `json:"schemas"`
Operations []Operation `json:"Operations"`
}
Request represents a SCIM PATCH request.
type TargetSelector ¶
type TargetSelector struct {
// All indicates all values should be affected.
All bool
// Index is a specific index in the array (0-based, -1 if not specified).
Index int
// FilterAttr is the attribute to match.
FilterAttr string
// FilterOp is the filter operator.
FilterOp string
// FilterValue is the value to match.
FilterValue any
}
TargetSelector represents a selector for multi-valued attribute targets.
func ParseFilter ¶
func ParseFilter(filter string) (*TargetSelector, error)
ParseFilter parses a filter expression from a path. Supported formats:
- "type eq 'work'"
- "value eq 'xxx'"
- "primary eq true"