Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Atom ¶
type Atom struct {
Name string // who
Type AtomType // what
Locator Locator // where
// contains filtered or unexported fields
}
Atom represents a single element of an input document that can be mutated.
type Descriptor ¶
type Descriptor struct {
Name string // name of this schema descriptor (pdf, zip, websocket, whatever)
Atoms []Atom // what the document with this schema is made of
}
Descriptor describes the structure of an input document in terms of atoms, their types, how to locate them, and optional mutation constraints.
func LoadDescriptor ¶
func LoadDescriptor(path string) (d Descriptor, err error)
func (Descriptor) Prepare ¶
func (d Descriptor) Prepare(doc Document) error
type Document ¶
type Document struct {
Path string
Data []byte // aren't we all just a pointless array of bytes in this entropic universe after all?
Size uint
Gen uint // generation number
}
func LoadDocument ¶
type Locator ¶
type Locator struct {
sync.Mutex
Type LocatorType
Data string
// contains filtered or unexported fields
}
Locator represents a strategy to locate a single atom inside a document, by its offset, a XPath expression, etc.
type LocatorType ¶
type LocatorType string
const ( ByOffset LocatorType = "offset" ByExact LocatorType = "exact" ByRE LocatorType = "re" )
TODO: define and implement more locator types (?)
Click to show internal directories.
Click to hide internal directories.