2018-05-22 17:56:55 +00:00
|
|
|
package checker
|
|
|
|
|
|
|
|
// Matcher returns whether a type 'name' matches a type
|
|
|
|
type Matcher func(name string) bool
|
|
|
|
|
|
|
|
// Checker returns whether 'value' is valid to this Type
|
|
|
|
// note: it is a pointer because it can be formatted by the checker if matches
|
|
|
|
// to provide indulgent type check if needed
|
|
|
|
type Checker func(value interface{}) bool
|
|
|
|
|
|
|
|
// Type contains all necessary methods
|
|
|
|
// for a type provided by user/developer
|
|
|
|
type Type struct {
|
|
|
|
Match func(string) bool
|
|
|
|
Check func(interface{}) bool
|
|
|
|
}
|
|
|
|
|
2018-07-08 23:34:21 +00:00
|
|
|
// Registry represents a registry containing all available
|
2018-05-22 17:56:55 +00:00
|
|
|
// Type-s to be used by the framework according to the configuration
|
2018-07-08 23:34:21 +00:00
|
|
|
type Registry struct {
|
2018-05-22 17:56:55 +00:00
|
|
|
Types []Type // registered Type-s
|
|
|
|
}
|