Documentation
¶
Index ¶
- Constants
- Variables
- func CharsInRange(value string, minLimit, maxLimit int) bool
- func In[T comparable](value T, values []T) bool
- func Matches(value string, rx *regexp.Regexp) bool
- func MaxChars(value string, maxLimit int) bool
- func MaxRunes(value string, maxLimit int) bool
- func MinChars(value string, minLimit int) bool
- func MinRunes(value string, minLimit int) bool
- func Param(ctx context.Context, name string) string
- func RunesInRange(value string, minLimit, maxLimit int) bool
- func Uniques[T comparable](values []T) bool
- type Config
- func (config *Config) Bool(key string) (bool, error)
- func (config *Config) BoolOrDefault(key string, def bool) bool
- func (config *Config) Duration(key string) (time.Duration, error)
- func (config *Config) DurationOrDefault(key string, def time.Duration) time.Duration
- func (config *Config) Int(key string) (int, error)
- func (config *Config) IntOrDefault(key string, def int) int
- func (config *Config) Log() string
- func (config *Config) MustBool(key string) bool
- func (config *Config) MustDuration(key string) time.Duration
- func (config *Config) MustInt(key string) int
- func (config *Config) MustString(key string) string
- func (config *Config) MustTime(key string) time.Time
- func (config *Config) MustURL(key string) *url.URL
- func (config *Config) SetBool(key string, value bool)
- func (config *Config) SetDuration(key string, value time.Duration)
- func (config *Config) SetInt(key string, value int)
- func (config *Config) SetString(key string, value string)
- func (config *Config) SetTime(key string, value time.Time)
- func (config *Config) SetURL(key string, value *url.URL)
- func (config *Config) String(key string) (string, error)
- func (config *Config) StringOrDefault(key string, def string) string
- func (config *Config) Time(key string) (time.Time, error)
- func (config *Config) TimeOrDefault(key string, def time.Time) time.Time
- func (config *Config) URL(key string) (*url.URL, error)
- func (config *Config) URLOrDefault(key string, def *url.URL) *url.URL
- type Group
- type Handler
- type Middleware
- type Router
- func (router *Router) Group(middlewares ...Middleware) *Group
- func (router *Router) Handle(path string, handler Handler, methods ...string)
- func (router *Router) Run(addr string, timeout time.Duration, logger *log.Logger) error
- func (router *Router) ServeHTTP(response http.ResponseWriter, request *http.Request)
- func (router *Router) Use(middlewares ...Middleware)
- type Validator
- type Values
Constants ¶
View Source
const TraceIDHeader = "X-Trace-ID"
Variables ¶
View Source
var (
EmailRX = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
)
Functions ¶
func CharsInRange ¶
func In ¶
func In[T comparable](value T, values []T) bool
func RunesInRange ¶
func Uniques ¶
func Uniques[T comparable](values []T) bool
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func (*Config) DurationOrDefault ¶
func (*Config) MustString ¶
func (*Config) StringOrDefault ¶
func (*Config) TimeOrDefault ¶
type Middleware ¶
type Router ¶
type Router struct {
NotFound Handler
MethodNotAllowed Handler
Options Handler
// contains filtered or unexported fields
}
func NewRouter ¶
func NewRouter(middlewares ...Middleware) *Router
func (*Router) Group ¶
func (router *Router) Group(middlewares ...Middleware) *Group
func (*Router) ServeHTTP ¶
func (router *Router) ServeHTTP(response http.ResponseWriter, request *http.Request)
func (*Router) Use ¶
func (router *Router) Use(middlewares ...Middleware)
type Validator ¶
func NewValidator ¶
func NewValidator() *Validator
func (*Validator) AddFieldError ¶
func (*Validator) AddNonFieldError ¶
Click to show internal directories.
Click to hide internal directories.