modeler

package
v2.16.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ModelValidationError

type ModelValidationError struct {
	// contains filtered or unexported fields
}

ModelValidationError represents an error resulting from a field having a value that doesn't satisfy a prescribed constraint.

func (ModelValidationError) Error

func (e ModelValidationError) Error() string

type Modeler

type Modeler struct {
	// contains filtered or unexported fields
}

Modeler is a utility for populating an arbitrary model's fields with values from a map[string]string.

func NewModeler

func NewModeler(prefix string, fieldTag string, constraintTag string, warnOnValidationError bool) *Modeler

NewModeler returns a pointer to a new Modeler, confgiured with the provided map key prefix and struct tag key.

func (*Modeler) MapToModel

func (m *Modeler) MapToModel(data map[string]string, initialContext string, out interface{}) error

MapToModel populates the provided model with values from the provided map.

type NilLiteralModelError

type NilLiteralModelError struct {
}

NilLiteralModelError represents a failed attempt to populate a "model" because a nil literal was passed to the modeler instead of a struct pointer.

func (NilLiteralModelError) Error

func (e NilLiteralModelError) Error() string

type NilModelError

type NilModelError struct {
	// contains filtered or unexported fields
}

NilModelError represents a failed attempt to populate a "model" because a nil pointer was passed to the modeler instead of a struct pointer.

func (NilModelError) Error

func (e NilModelError) Error() string

type NonPointerModelError

type NonPointerModelError struct {
	// contains filtered or unexported fields
}

NonPointerModelError represents a failed attempt to populate a model because something other than a pointer was passed to the modeler.

func (NonPointerModelError) Error

func (e NonPointerModelError) Error() string

type NonStructPointerModelError

type NonStructPointerModelError struct {
	// contains filtered or unexported fields
}

NonStructPointerModelError represents a failed attempt to populate a model because something other than a pointer was passed to the modeler.

func (NonStructPointerModelError) Error

Jump to

Keyboard shortcuts

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