Documentation
¶
Index ¶
Constants ¶
Variables ¶
View Source
var ( ErrNoOo = errors.New("operations object is nil") ErrNoTarget = errors.New("target is nil") ErrOoPathMissing = errors.New("'path' field is missing in operations object") ErrOoValueMissing = errors.New("'value' field is missing in operations object") ErrOoFromMissing = errors.New("'from' field is missing in operations object") )
Functions ¶
func Do ¶
func Do(obj *OpObj, target dom.ContainerBuilder) error
Do perform patch operation against designated target. Object is modified in place, or error is returned.
func NewPathParser ¶ added in v1.0.66
func NewPathSerializer ¶ added in v1.0.66
func NewPathSerializer() path.Serializer
Types ¶
type OpObj ¶
type OpObj struct {
Op Op
From *Path // copy,move
Path Path // test,copy,move,replace,remove,add
Value dom.Node // test,replace,add
}
OpObj is operation object containing all necessary data to perform patch operation
type Path ¶
type Path []PathSegment
func MustParsePath ¶
func (Path) Eval ¶
Eval evaluates path within provided target dom.Container. Call to this function returns pair, where one part is series of Nodes encountered while walking from root of target dom.Container down the path, second part is final Node. If path does not fully resolve, second part will be nil, while first part will contain all Nodes up to point where resolution stopped.
func (Path) LastSegment ¶
func (p Path) LastSegment() PathSegment
type PathSegment ¶
type PathSegment string
func (PathSegment) IsNumeric ¶
func (ps PathSegment) IsNumeric() (int, bool)
TODO add support for "-" - the "last" item designation
Click to show internal directories.
Click to hide internal directories.