Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DisallowOperationOnPathPolicy ¶
DisallowOperationOnPathPolicy disallows specified operations on path.
func (DisallowOperationOnPathPolicy) GetDetails ¶
func (d DisallowOperationOnPathPolicy) GetDetails() string
GetDetails returns the name of this policy.
func (DisallowOperationOnPathPolicy) Test ¶
func (d DisallowOperationOnPathPolicy) Test(operationSpec OperationSpec) bool
Test if given operation specification is valid or not.
type DisallowPathPolicy ¶
DisallowPathPolicy specifies a path that is not allowed.
func (DisallowPathPolicy) GetDetails ¶
func (d DisallowPathPolicy) GetDetails() string
GetDetails returns the name of this policy.
func (DisallowPathPolicy) Test ¶
func (d DisallowPathPolicy) Test(operationSpec OperationSpec) bool
Test if given operation specification is valid or not.
type ForceOperationOnPathPolicy ¶ added in v1.2.1
ForceOperationOnPathPolicy force specified operation on path.
func (ForceOperationOnPathPolicy) GetDetails ¶ added in v1.2.1
func (d ForceOperationOnPathPolicy) GetDetails() string
GetDetails returns the name of this policy.
func (ForceOperationOnPathPolicy) Test ¶ added in v1.2.1
func (d ForceOperationOnPathPolicy) Test(operationSpec OperationSpec) bool
Test if given operation specification is valid or not.
type ForceRegexMatchPolicy ¶
ForceRegexMatchPolicy forces the value of a specif path to match expression.
func (ForceRegexMatchPolicy) GetDetails ¶
func (f ForceRegexMatchPolicy) GetDetails() string
GetDetails returns the name of this policy.
func (ForceRegexMatchPolicy) Test ¶
func (f ForceRegexMatchPolicy) Test(operationSpec OperationSpec) bool
Test if given operation specification is valid or not.
type ForceTypeOnPathPolicy ¶
ForceTypeOnPathPolicy forces the value of a specif path to be from given type.
func (ForceTypeOnPathPolicy) GetDetails ¶
func (f ForceTypeOnPathPolicy) GetDetails() string
GetDetails returns the name of this policy.
func (ForceTypeOnPathPolicy) Test ¶
func (f ForceTypeOnPathPolicy) Test(operationSpec OperationSpec) bool
Test if given operation specification is valid or not.
type Operation ¶
type Operation string
const ( // RemoveOperation is an operation to remove the value at the target location. // Requires `path`. RemoveOperation Operation = "remove" // AddOperation add a value or array to an array at the target location. // Requires `path` and `value`. Target of the path must be an array. AddOperation Operation = "add" // ReplaceOperation replaces the value at the target location // with a new value. Requires `path` and `value`. ReplaceOperation Operation = "replace" // MoveOperation removes the value at a specified location and // adds it to the target location. Requires `from` and `path`. MoveOperation Operation = "move" // CopyOperation copies the value from a specified location to the // target location. Requires `from` and `path`. CopyOperation Operation = "copy" )
type OperationSpec ¶
type OperationSpec struct { From Path `json:"from"` Path Path `json:"path"` Value interface{} `json:"value"` Operation Operation `json:"op"` //nolint:tagliatelle }
OperationSpec specify an path operation.
type Parser ¶
type Parser struct {
Policies []Policy
}
Parser that can parse patch operation to generate mongo queries.
type Path ¶
type Path string
type Policy ¶
type Policy interface { GetDetails() string Test(operationSpec OperationSpec) bool }
Policy specifies the interface for an policy.
type StrictPathPolicy ¶
StrictPathPolicy forces path to be strictly one of.
func (StrictPathPolicy) GetDetails ¶
func (s StrictPathPolicy) GetDetails() string
GetDetails returns the name of this policy.
func (StrictPathPolicy) Test ¶
func (s StrictPathPolicy) Test(operationSpec OperationSpec) bool
Test if given operation specification is valid or not.