omniparser package - github.com/jf-tech/omniparser - Go Packages (original) (raw)

This section is empty.

This section is empty.

This section is empty.

Extension allows user of omniparser to add new schema handlers, and/or new custom functions in addition to the builtin handlers and functions.

Schema is an interface that represents a schema used by omniparser. One instance of Schema is associated with one and only one schema. The instance of Schema can be reused for ingesting and transforming multiple input files/streams, as long as they are all intended for the same schema. Each ingestion/transform, however, needs a separate instance of Transform. A Transform must not be shared and reused across different input files/streams. While the same instance of Schema can be shared across multiple threads, Transform is not multi-thread safe. All operations on it must be done within the same go routine.

NewSchema creates a new instance of Schema. Caller can use the optional Extensions for customization. NewSchema will scan through exts left to right to find the first extension with a schema handler (specified by CreateSchemaHandler field) that supports the input schema. If no ext provided or no ext with a handler that supports the schema, then NewSchema will fall back to builtin extension (currently for schema version 'omni.2.1'). If the input schema is still not supported by builtin extension, NewSchema will fail with ErrSchemaNotSupported. Each extension much be fully self-contained meaning all the custom functions it intends to use in the schemas supported by it must be included in the same extension.

Transform is an interface that represents one input stream ingestion and transform operation. An instance of a Transform must not be shared and reused among different input streams. An instance of a Transform must not be used across multiple goroutines.