2020-03-14 15:13:05 +00:00
|
|
|
package datatype
|
|
|
|
|
|
|
|
// Validator returns whether a given value fulfills a datatype
|
|
|
|
// and casts the value into a compatible type
|
|
|
|
type Validator func(value interface{}) (cast interface{}, valid bool)
|
|
|
|
|
2020-03-16 08:20:00 +00:00
|
|
|
// T builds a T from the type definition (from the
|
2020-03-14 15:13:05 +00:00
|
|
|
// configuration field "type") and returns NIL if the type
|
2020-03-16 08:20:00 +00:00
|
|
|
// definition does not match this T
|
|
|
|
type T interface {
|
2020-03-14 15:13:05 +00:00
|
|
|
Build(typeDefinition string) Validator
|
|
|
|
}
|