patch

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2017 License: MIT Imports: 6 Imported by: 332

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AfterLastIndexToken

type AfterLastIndexToken struct{}

type AfterModifier

type AfterModifier struct{}

type ArrayIndex

type ArrayIndex struct {
	Index     int
	Modifiers []Modifier
	Array     []interface{}
}

func (ArrayIndex) Concrete

func (i ArrayIndex) Concrete() (int, error)

type ArrayInsertion

type ArrayInsertion struct {
	Index     int
	Modifiers []Modifier
	Array     []interface{}
}

func (ArrayInsertion) Concrete

func (i ArrayInsertion) Concrete() (ArrayInsertionIndex, error)

type ArrayInsertionIndex

type ArrayInsertionIndex struct {
	// contains filtered or unexported fields
}

func (ArrayInsertionIndex) Update

func (i ArrayInsertionIndex) Update(array []interface{}, obj interface{}) []interface{}

type BeforeModifier

type BeforeModifier struct{}

type DescriptiveOp

type DescriptiveOp struct {
	Op       Op
	ErrorMsg string
}

func (DescriptiveOp) Apply

func (op DescriptiveOp) Apply(doc interface{}) (interface{}, error)

type ErrOp

type ErrOp struct {
	Err error
}

func (ErrOp) Apply

func (op ErrOp) Apply(_ interface{}) (interface{}, error)

type FindOp

type FindOp struct {
	Path Pointer
}

func (FindOp) Apply

func (op FindOp) Apply(doc interface{}) (interface{}, error)

type IndexToken

type IndexToken struct {
	Index     int
	Modifiers []Modifier
}

type KeyToken

type KeyToken struct {
	Key      string
	Optional bool
}

type MatchingIndexToken

type MatchingIndexToken struct {
	Key       string
	Value     string
	Optional  bool
	Modifiers []Modifier
}

type Modifier

type Modifier interface {
	// contains filtered or unexported methods
}

type NextModifier

type NextModifier struct{}

type Op

type Op interface {
	Apply(interface{}) (interface{}, error)
}

type OpDefinition

type OpDefinition struct {
	Type  string       `json:",omitempty"`
	Path  *string      `json:",omitempty"`
	Value *interface{} `json:",omitempty"`

	Error *string `json:",omitempty"`
}

OpDefinition struct is useful for JSON and YAML unmarshaling

type OpMissingIndexErr

type OpMissingIndexErr struct {
	Idx int
	Obj []interface{}
}

func (OpMissingIndexErr) Error

func (e OpMissingIndexErr) Error() string

type Ops

type Ops []Op

func NewOpsFromDefinitions

func NewOpsFromDefinitions(opDefs []OpDefinition) (Ops, error)

func (Ops) Apply

func (ops Ops) Apply(doc interface{}) (interface{}, error)

type Pointer

type Pointer struct {
	// contains filtered or unexported fields
}

More or less based on https://tools.ietf.org/html/rfc6901

func MustNewPointerFromString

func MustNewPointerFromString(str string) Pointer

func NewPointer

func NewPointer(tokens []Token) Pointer

func NewPointerFromString

func NewPointerFromString(str string) (Pointer, error)

func (Pointer) IsSet

func (p Pointer) IsSet() bool

func (Pointer) String

func (p Pointer) String() string

func (Pointer) Tokens

func (p Pointer) Tokens() []Token

func (*Pointer) UnmarshalFlag

func (p *Pointer) UnmarshalFlag(data string) error

UnmarshalFlag satisfies go-flags flag interface

type PrevModifier

type PrevModifier struct{}

type RemoveOp

type RemoveOp struct {
	Path Pointer
}

func (RemoveOp) Apply

func (op RemoveOp) Apply(doc interface{}) (interface{}, error)

type ReplaceOp

type ReplaceOp struct {
	Path  Pointer
	Value interface{} // will be cloned using yaml library
}

func (ReplaceOp) Apply

func (op ReplaceOp) Apply(doc interface{}) (interface{}, error)

type RootToken

type RootToken struct{}

type Token

type Token interface {
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL