Documentation ¶
Overview ¶
Code generated for package logschema by go-bindata DO NOT EDIT. (@generated) sources: schema.json
Index ¶
- Constants
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func DiffWalk(from, to *ValueSchema, walk func(c Change) bool, basePath ...string)
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func ValidateSchema(s *Schema) error
- func ValidationErrors(err error) (result []gojsonschema.ResultError)
- type Change
- type CyclicReferenceError
- type FieldDiff
- type FieldSchema
- type NativeParser
- type Parser
- type Schema
- type ValueSchema
- type ValueType
Constants ¶
const ( // AddField is the type of change when a field was added. AddField = "AddField" // DeleteField is the type of change when a field was removed. DeleteField = "DeleteField" // UpdateFieldMeta is the type of change when a field's metadata was changed (i.e. Required, Description). UpdateFieldMeta = "UpdateFieldMeta" // UpdateValue is the type of change when a field's value type has changed. UpdateValue = "UpdateValue" // UpdateValueMeta is the type of change when metadata about a field's value type has changed (i.e. TimeFormat, IsEventTime, Indicators). UpdateValueMeta = "UpdateValueMeta" // UpdateParser is the type of change when a schema's Parser has changed. UpdateParser = "UpdateParser" // UpdateMeta is the type of change when a schema's metadata has changed (i.e. Schema, Description, ReferenceURL). UpdateMeta = "UpdateMeta" )
nolint:lll
const MaxDepth = 64
MaxDepth is the maximum nesting depth for a ValueSchema
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func DiffWalk ¶
func DiffWalk(from, to *ValueSchema, walk func(c Change) bool, basePath ...string)
DiffWalk recursively iterates two value schemas and calls `walk` when a change is found. The `basePath` argument is used prepended to the path on each change. You can abort a walk by returning false from the callback.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
func ValidateSchema ¶
ValidateSchema validates the schema using the JSON schema in schema.json
func ValidationErrors ¶
func ValidationErrors(err error) (result []gojsonschema.ResultError)
Types ¶
type CyclicReferenceError ¶
type CyclicReferenceError struct {
// contains filtered or unexported fields
}
func (*CyclicReferenceError) Cycle ¶
func (e *CyclicReferenceError) Cycle() []string
func (*CyclicReferenceError) Error ¶
func (e *CyclicReferenceError) Error() string
func (*CyclicReferenceError) Path ¶
func (e *CyclicReferenceError) Path() string
func (*CyclicReferenceError) Ref ¶
func (e *CyclicReferenceError) Ref() string
type FieldDiff ¶
type FieldDiff struct { A *FieldSchema B *FieldSchema }
func DiffFields ¶
func DiffFields(a, b []FieldSchema) (d []FieldDiff)
DiffFields returns the union of all fields in both sets as list of pairs.
Fields are paired by name. Each pair contains two FieldSchema pointers `A` and `B`. If a field is found in both `a` and `b`, `A` will point to the field in `a` and `B` will point to the field in `b` If a field is only found in `a`, `A` will point to the field in `a` and `B` will be nil If a field is only found in `b`, `A` will be nil and `B` will point to the field in `b`
This function is useful to use when operating on a union of two field sets without losing information about the origin of each field (i.e. when diffing sets of fields)
type FieldSchema ¶
type FieldSchema struct { Name string `json:"name" yaml:"name"` Required bool `json:"required,omitempty" yaml:"required,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` ValueSchema `yaml:",inline"` }
type NativeParser ¶ added in v1.16.0
type NativeParser struct {
Name string `json:"name" yaml:"name"`
}
type Parser ¶
type Parser struct { CSV *preprocessors.CSVMatchConfig `json:"csv,omitempty" yaml:"csv,omitempty"` FastMatch *preprocessors.FastMatchConfig `json:"fastmatch,omitempty" yaml:"fastmatch,omitempty"` Regex *preprocessors.RegexConfig `json:"regex,omitempty" yaml:"regex,omitempty"` Native *NativeParser `json:"native,omitempty" taml:"native,omitempty"` }
type Schema ¶
type Schema struct { Schema string `json:"schema,omitempty" yaml:"schema,omitempty"` Parser *Parser `json:"parser,omitempty" yaml:"parser,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` ReferenceURL string `json:"referenceURL,omitempty" yaml:"referenceURL,omitempty"` Version int `json:"version" yaml:"version"` Definitions map[string]*ValueSchema `json:"definitions,omitempty" yaml:"definitions,omitempty"` Fields []FieldSchema `json:"fields" yaml:"fields"` }
type ValueSchema ¶
type ValueSchema struct { Type ValueType `json:"type" yaml:"type"` Fields []FieldSchema `json:"fields,omitempty" yaml:"fields,omitempty"` Element *ValueSchema `json:"element,omitempty" yaml:"element,omitempty"` Target string `json:"target,omitempty" yaml:"target,omitempty"` Indicators []string `json:"indicators,omitempty" yaml:"indicators,omitempty"` TimeFormat string `json:"timeFormat,omitempty" yaml:"timeFormat,omitempty"` IsEventTime bool `json:"isEventTime,omitempty" yaml:"isEventTime,omitempty"` }
func InferJSONValueSchema ¶
func InferJSONValueSchema(x interface{}) *ValueSchema
InferJSONValueSchema infers the Value Schema for a JSON value.
It will return `nil` if `x` is `nil` or if it is not one of the types defined in https://golang.org/pkg/encoding/json/#Unmarshal. If distinction between integer numbers and float numbers is required, the value should be unmarshalled using `json.Number` (e.g. json.Decoder.UseNumber()).
func InferTypeValueSchema ¶ added in v1.16.0
func InferTypeValueSchema(typ reflect.Type) (*ValueSchema, error)
func Merge ¶
func Merge(a, b *ValueSchema) *ValueSchema
Merge merges to value schemas to a a common schema that can handle both values. The returned value is a fully independent ValueSchema (deep copy). It panics if values a or b are not fully resolved via `Resolve().
func Ref ¶
func Ref(target string) ValueSchema
func Resolve ¶
func Resolve(schema *Schema) (*ValueSchema, error)
Resolve returns a copy of a ValueSchema with all references resolved from a manifest. It fails if a references cannot be resolved, if the nesting level exceeds MaxDepth or if there is a cyclic reference.
func (*ValueSchema) Clone ¶
func (v *ValueSchema) Clone() *ValueSchema
func (*ValueSchema) NonEmpty ¶
func (v *ValueSchema) NonEmpty() *ValueSchema
NonEmpty scrubs the ValueSchema from any empty object/array schemas.
type ValueType ¶
type ValueType string
const ( TypeObject ValueType = "object" TypeArray ValueType = "array" TypeTimestamp ValueType = "timestamp" TypeRef ValueType = "ref" TypeString ValueType = "string" TypeBoolean ValueType = "boolean" TypeInt ValueType = "int" TypeSmallInt ValueType = "smallint" TypeBigInt ValueType = "bigint" TypeFloat ValueType = "float" TypeJSON ValueType = "json" )