util

package
v0.0.0-...-0672106 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var JSONSchema []byte

Functions

func LoadSchema

func LoadSchema(strict bool) (*jsonschema.Schema, error)

LoadSchema reads in the schema and parses it to a JSON Schema object.

If the `strict` parameter is true, then the schema object that results will throw errors whenever a parameter is present in a document that is not found in the schema (extra parameters will generate errors). Pass false to disable this behavior (and permit extra parameters).

Types

type PartialSchema

type PartialSchema struct {
	Properties       map[string]interface{}
	AuthorProperties map[string]interface{}
}

PartialSchema represents a few of the lists of properties found in the schema that we need to pass data to Solr.

The only purpose for which we load the schema is to query the lists of acceptable properties that may appear in a document or in an author object. We therefore just extract the "properties" keys from both of the object definitions and store them here.

func LoadPartialSchema

func LoadPartialSchema() (*PartialSchema, error)

LoadPartialSchema reads in the schema and parses it to a PartialSchema.

Note that since we are not doing full schema validation, this is by no means a complete parsing of the schema. If you want that, see LoadSchema. This function only extracts the few fields that we require to "clean" Mongo documents before passing them to Solr. (See sanitizeMongoDocument for more information.)

Jump to

Keyboard shortcuts

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