create config.datatype replacing typecheck

This commit is contained in:
Adrien Marquès 2020-03-14 16:13:05 +01:00
parent a6f5083f0d
commit 003fe4d2e7
Signed by: xdrm-brackets
GPG Key ID: D75243CA236D825E
1 changed files with 12 additions and 0 deletions

12
config/datatype/types.go Normal file
View File

@ -0,0 +1,12 @@
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)
// Builder builds a DataType from the type definition (from the
// configuration field "type") and returns NIL if the type
// definition does not match this DataType
type Builder interface {
Build(typeDefinition string) Validator
}