2019-05-16 08:25:32 -07:00
|
|
|
package types
|
|
|
|
|
2019-11-06 13:08:02 -08:00
|
|
|
import "regexp"
|
|
|
|
|
2020-02-19 01:56:22 -08:00
|
|
|
var (
|
|
|
|
// IsAlphaNumeric defines a regular expression for matching against alpha-numeric
|
|
|
|
// values.
|
|
|
|
IsAlphaNumeric = regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString
|
|
|
|
|
|
|
|
// IsAlphaLower defines regular expression to check if the string has lowercase
|
|
|
|
// alphabetic characters only.
|
|
|
|
IsAlphaLower = regexp.MustCompile(`^[a-z]+$`).MatchString
|
|
|
|
|
|
|
|
// IsAlphaUpper defines regular expression to check if the string has uppercase
|
|
|
|
// alphabetic characters only.
|
|
|
|
IsAlphaUpper = regexp.MustCompile(`^[A-Z]+$`).MatchString
|
|
|
|
|
|
|
|
// IsAlpha defines regular expression to check if the string has alphabetic
|
|
|
|
// characters only.
|
|
|
|
IsAlpha = regexp.MustCompile(`^[a-zA-Z]+$`).MatchString
|
|
|
|
|
|
|
|
// IsNumeric defines regular expression to check if the string has numeric
|
|
|
|
// characters only.
|
|
|
|
IsNumeric = regexp.MustCompile(`^[0-9]+$`).MatchString
|
|
|
|
)
|
2019-11-06 13:08:02 -08:00
|
|
|
|
2019-05-16 08:25:32 -07:00
|
|
|
// Router provides handlers for each transaction type.
|
|
|
|
type Router interface {
|
|
|
|
AddRoute(r string, h Handler) Router
|
2020-01-04 11:50:38 -08:00
|
|
|
Route(ctx Context, path string) Handler
|
2019-05-16 08:25:32 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// QueryRouter provides queryables for each query path.
|
|
|
|
type QueryRouter interface {
|
|
|
|
AddRoute(r string, h Querier) QueryRouter
|
|
|
|
Route(path string) Querier
|
|
|
|
}
|