From 003fe4d2e7582f09012101dcf1a302016ec8d374 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 14 Mar 2020 16:13:05 +0100 Subject: [PATCH] create config.datatype replacing typecheck --- config/datatype/types.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 config/datatype/types.go diff --git a/config/datatype/types.go b/config/datatype/types.go new file mode 100644 index 0000000..d015707 --- /dev/null +++ b/config/datatype/types.go @@ -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 +}