package
0.2.0
Repository: https://github.com/rs/rest-layer.git
Documentation: pkg.go.dev

# Packages

Package encoding is the intended hierarchy location for encoding Schema to other formats.
Package query provides tools to query a schema defined by github.com/rs/schema.

# Functions

Q is deprecated, use query.MustParsePredicate instead.
VerifyPassword compare a field of an item payload containing a hashed password with a clear text password and return true if they match.

# Variables

CreatedField is a common schema field configuration for "created" fields.
IDField is a common schema field configuration that generate an globally unique id for new item id.
NewID is a field hook handler that generates a new globally unique id if none exist, to be used in schema with OnInit.
Now is a field hook handler that returns the current time, to be used in schema with OnInit and OnUpdate.
PasswordField is a common schema field for passwords.
Tombstone is used to mark a field for removal.
UpdatedField is a common schema field configuration for "updated" fields.

# Structs

Array validates array values.
Bool validates Boolean based values.
Boundaries defines min/max for an integer.
Connection is a dummy validator to define a weak connection to another schema.
Dict validates objects with variadic keys.
Field specifies the info for a single field of a spec.
Float validates float based values.
Integer validates integer based values.
IP validates IP values.
Object validates objects which are defined by Schemas.
Param define an individual field parameter with its validator.
Password crypts a field password using bcrypt algorithm.
Reference validates the ID of a linked resource.
Schema defines fields for a document.
String validates string based values.
Time validates time based values.
URL validates URLs values.

# Interfaces

Compiler is similar to the Compiler interface, but intended for types that implements, or may hold, a reference.
FieldComparator must be implemented by a FieldValidator that is to allow comparison queries ($gt, $gte, $lt and $lte).
FieldGetter defines an interface for fetching sub-fields from a Schema or FieldValidator implementation that allows (JSON) object values.
FieldQueryValidator defines an interface for lightweight validation on field types, without applying constrains on the actual values.
FieldSerializer is used to convert the value between it's representation form and it internal storable form.
FieldValidator is an interface for all individual validators.
Predicate is an interface matching the query.Predicate type.
ReferenceChecker is used to retrieve a FieldValidator that can be used for validating referenced IDs.
Validator is an interface used to validate schema against actual data.

# Type aliases

AllOf validates that all the sub field validators validates.
AnyOf validates if any of the sub field validators validates.
ErrorMap contains a map of errors by field name.
ErrorSlice contains a concatenation of several errors.
FieldHandler is the piece of logic modifying the field value based on passed parameters.
Fields defines a map of name -> field pairs.
FieldValidatorFunc is an adapter to allow the use of ordinary functions as field validators.
LessFunc is a function that returns true only when value is less than other, and false in all other circumstances, including error conditions.
Null validates that the value is null.
Params defines param name => definition pairs allowed for a field.
ReferenceCheckerFunc is an adapter that allows ordinary functions to be used as reference checkers.