Versions in this module Expand all Collapse all v1 v1.1.0 Jan 20, 2019 Changes in this version type AppServer + func NewDefaults() *AppServer v1.0.0 Oct 28, 2018 Changes in this version + const DefaultHttpRequestID + const DefaultHttpRequestTimeout + const DefaultHttpResponseTimeout + const DefaultMaxHeaderBytes + const DefaultMaxHttpRequestIDLen + const DefaultMaxMultiformBytes + const RednerXmlContentType + const RenderDefaultContentType + const RenderJsonContentType + const RenderJsonPContentType + const SchemaConfig + var DefaultLoggerConfig = &LoggerConfig + var DefaultSectionConfig = &SectionConfig + var DefaultServerConfig = &ServerConfig + var ErrConfigSection = errors.New("Config section does not exist!") + var ErrHash = errors.New("The hash function does not linked into the binary!") + var ErrHeaderFlushed = errors.New("Response headers have been written!") + var ErrSettingsKey = errors.New("Settings key is duplicated!") + var FindModeConfigFile = func(runMode, srcPath string) string + func IsGIDHex(s string) bool + type AppConfig struct + Mode RunMode + Name string + Sections map[RunMode]*json.RawMessage + func NewAppConfig(filename string) (*AppConfig, error) + func NewAppConfigFromDefault() (*AppConfig, error) + func NewAppConfigFromString(s string) (*AppConfig, error) + func (config *AppConfig) RunMode() RunMode + func (config *AppConfig) RunName() string + func (config *AppConfig) Section() *SectionConfig + func (config *AppConfig) SetMode(mode RunMode) + func (config *AppConfig) UnmarshalJSON(v interface{}) error + type AppLogger struct + func NewAppLogger(output, filename string) *AppLogger + func (alog *AppLogger) New(requestID string) Logger + func (alog *AppLogger) RequestID() string + func (alog *AppLogger) Reuse(lg Logger) + type AppParams struct + func NewAppParams(r *http.Request, params httpdispatch.Params) *AppParams + func NewParams(r *http.Request) *AppParams + func (p *AppParams) File(name string) (multipart.File, *multipart.FileHeader, error) + func (p *AppParams) Get(name string) string + func (p *AppParams) GetBool(name string) (bool, error) + func (p *AppParams) GetFloat(name string) (float64, error) + func (p *AppParams) GetInt(name string) (int, error) + func (p *AppParams) GetInt16(name string) (int16, error) + func (p *AppParams) GetInt32(name string) (int32, error) + func (p *AppParams) GetInt64(name string) (int64, error) + func (p *AppParams) GetInt8(name string) (int8, error) + func (p *AppParams) GetUint16(name string) (uint16, error) + func (p *AppParams) GetUint32(name string) (uint32, error) + func (p *AppParams) GetUint64(name string) (uint64, error) + func (p *AppParams) GetUint8(name string) (uint8, error) + func (p *AppParams) Gob(v interface{}) error + func (p *AppParams) HasForm(name string) bool + func (p *AppParams) HasQuery(name string) bool + func (p *AppParams) Json(v interface{}) error + func (p *AppParams) Post(name string) string + func (p *AppParams) RawBody() ([]byte, error) + func (p *AppParams) Xml(v interface{}) error + type AppRoute struct + func NewAppRoute(prefix string, server *AppServer) *AppRoute + func (r *AppRoute) Any(path string, handler Middleware) + func (r *AppRoute) CleanModdilewares() + func (r *AppRoute) DELETE(path string, handler Middleware) + func (r *AppRoute) GET(path string, handler Middleware) + func (r *AppRoute) Group(prefix string, middlewares ...Middleware) *AppRoute + func (r *AppRoute) HEAD(path string, handler Middleware) + func (r *AppRoute) Handle(method string, uri string, handler Middleware) + func (r *AppRoute) Handler(method, uri string, handler http.Handler) + func (r *AppRoute) HandlerFunc(method, uri string, handler http.HandlerFunc) + func (r *AppRoute) Middlewares() []Middleware + func (r *AppRoute) MockHandle(method string, path string, response http.ResponseWriter, handler Middleware) + func (r *AppRoute) OPTIONS(path string, handler Middleware) + func (r *AppRoute) PATCH(path string, handler Middleware) + func (r *AppRoute) POST(path string, handler Middleware) + func (r *AppRoute) PUT(path string, handler Middleware) + func (r *AppRoute) ProxyHandle(method string, path string, proxy *httputil.ReverseProxy, ...) + func (r *AppRoute) Resource(resource string, controller interface{}) *AppRoute + func (r *AppRoute) ServeHTTP(resp http.ResponseWriter, req *http.Request) + func (r *AppRoute) SetHandler(handler Handler) + func (r *AppRoute) Static(path, root string) + func (r *AppRoute) Use(middlewares ...Middleware) + type AppServer struct + func New(runMode, srcPath string) *AppServer + func NewAppServer(config Configer, logger Logger) *AppServer + func NewWithConfiger(config Configer) *AppServer + func NewWithLogger(config Configer, logger Logger) *AppServer + func (s *AppServer) Config() Configer + func (s *AppServer) Mode() string + func (s *AppServer) Run() + func (s *AppServer) RunWithHandler(handler Handler) + func (s *AppServer) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Configer interface + RunMode func() RunMode + RunName func() string + Section func() *SectionConfig + SetMode func(mode RunMode) + UnmarshalJSON func(v interface{}) error + type Context struct + Logger Logger + Params *AppParams + Request *http.Request + Response Responser + func NewContext() *Context + func (c *Context) Abort() + func (c *Context) Action() string + func (c *Context) AddHeader(key, value string) + func (c *Context) Controller() string + func (c *Context) Get(key string) (v interface{}, ok bool) + func (c *Context) GetFinal(key string) (v interface{}, ok bool) + func (c *Context) HasHeader(key string) bool + func (c *Context) HasRawHeader(key string) bool + func (c *Context) HashedReturn(hasher crypto.Hash, body ...interface{}) error + func (c *Context) Header(key string) string + func (c *Context) Json(data interface{}) error + func (c *Context) JsonP(callback string, data interface{}) error + func (c *Context) MustGet(key string) interface{} + func (c *Context) MustGetFinal(key string) interface{} + func (c *Context) MustSetFinal(key string, value interface{}) + func (c *Context) Next() + func (c *Context) RawHeader(key string) string + func (c *Context) Redirect(location string) + func (c *Context) Render(w Render, data interface{}) error + func (c *Context) RequestID() string + func (c *Context) RequestURI() string + func (c *Context) Return(body ...interface{}) error + func (c *Context) Set(key string, value interface{}) + func (c *Context) SetFinal(key string, value interface{}) error + func (c *Context) SetHeader(key, value string) + func (c *Context) SetStatus(code int) + func (c *Context) Text(data interface{}) error + func (c *Context) Xml(data interface{}) error + type ContextHandle struct + func NewContextHandle(server *AppServer, handler http.HandlerFunc, filters []Middleware) *ContextHandle + func (ch *ContextHandle) Handle(w http.ResponseWriter, r *http.Request, params httpdispatch.Params) + type ControllerCreate interface + Create func(c *Context) + type ControllerDestroy interface + Destroy func(c *Context) + type ControllerDispatch interface + DISPATCH func(c *Context) + type ControllerExplore interface + Explore func(c *Context) + type ControllerID interface + ID func() string + type ControllerIndex interface + Index func(c *Context) + type ControllerShow interface + Show func(c *Context) + type ControllerUpdate interface + Update func(c *Context) + type DefaultRender struct + func (render *DefaultRender) ContentType() string + func (render *DefaultRender) Render(v interface{}) error + type FakeHandle struct + func NewFakeHandle(server *AppServer, handler http.HandlerFunc, filters []Middleware, ...) *FakeHandle + func (ch *FakeHandle) Handle(w http.ResponseWriter, r *http.Request, params httpdispatch.Params) + type GID string + func GIDHex(s string) GID + func NewGID() GID + func NewGIDWithTime(t time.Time) GID + func (id GID) Counter() int32 + func (id GID) Hex() string + func (id GID) Mac() []byte + func (id GID) Pid() uint16 + func (id GID) String() string + func (id GID) Time() time.Time + func (id GID) Valid() bool + type Handler interface + Handle func(string, string, httpdispatch.Handler) + ServeFiles func(string, http.FileSystem) + type HashRender struct + func (render *HashRender) ContentType() string + func (render *HashRender) Render(v interface{}) error + type JsonRender struct + func (render *JsonRender) ContentType() string + func (render *JsonRender) Render(v interface{}) error + type JsonpRender struct + func (render *JsonpRender) ContentType() string + func (render *JsonpRender) Render(v interface{}) error + type Logger interface + Debug func(v ...interface{}) + Debugf func(format string, v ...interface{}) + Error func(v ...interface{}) + Errorf func(format string, v ...interface{}) + Fatal func(v ...interface{}) + Fatalf func(format string, v ...interface{}) + Info func(v ...interface{}) + Infof func(format string, v ...interface{}) + New func(requestID string) Logger + Panic func(v ...interface{}) + Panicf func(format string, v ...interface{}) + Print func(v ...interface{}) + Printf func(format string, v ...interface{}) + RequestID func() string + Reuse func(log Logger) + SetColor func(color bool) + SetLevelByName func(level string) error + Warn func(v ...interface{}) + Warnf func(format string, v ...interface{}) + type LoggerConfig struct + FilterFields []string + LevelName string + Output string + func (l *LoggerConfig) Level() logger.Level + type Middleware func(ctx *Context) + type Render interface + ContentType func() string + Render func(v interface{}) error + func NewDefaultRender(w Responser) Render + func NewHashRender(w Responser, hasher crypto.Hash) Render + func NewJsonRender(w Responser) Render + func NewJsonpRender(w Responser, callback string) Render + func NewTextRender(w Responser) Render + func NewXmlRender(w Responser) Render + type Response struct + func (r *Response) Before(filter ResponseFilter) + func (r *Response) Flush() + func (r *Response) FlushHeader() + func (r *Response) HeaderFlushed() bool + func (r *Response) Reset(w http.ResponseWriter) + func (r *Response) Size() int + func (r *Response) Status() int + func (r *Response) Write(data []byte) (size int, err error) + func (r *Response) WriteHeader(code int) + type ResponseFilter func(w Responser, b []byte) []byte + type Responser interface + Before func(filter ResponseFilter) + FlushHeader func() + HeaderFlushed func() bool + Reset func(w http.ResponseWriter) + Size func() int + Status func() int + func NewResponse(w http.ResponseWriter) Responser + type RunMode string + const Development + const Production + const Test + func (mode RunMode) IsDevelopment() bool + func (mode RunMode) IsProduction() bool + func (mode RunMode) IsTest() bool + func (mode RunMode) IsValid() bool + func (mode RunMode) String() string + type SectionConfig struct + Logger *LoggerConfig + Server *ServerConfig + type ServerConfig struct + Addr string + MaxHeaderBytes int + Port int + RTimeout int + RequestID string + Slowdown int + Ssl bool + SslCert string + SslKey string + Throttle int + WTimeout int + type StatusCoder interface + StatusCode func() int + type TextRender struct + func (render *TextRender) ContentType() string + func (render *TextRender) Render(v interface{}) error + type XmlRender struct + func (render *XmlRender) ContentType() string + func (render *XmlRender) Render(v interface{}) error