Documentation ¶
Index ¶
- Variables
- func CacheParams(params ...interface{}) string
- func ConfigDir() (string, error)
- func ExpandTilde(path string) (string, error)
- func HomeDir() (string, error)
- func NewHttpHost(router *httprouter.Router, options ...*plugins.Options) (plugins.Host, error)
- func ZipFileHandler(zc *ZipContainer, f RequestTemplateDataFunc, prefix ...string) http.HandlerFunc
- type CacheMap
- type FullResponse
- type HttpPlugin
- type Opts
- type RPCHttpHandler
- type RPCHttpResponseHandler
- type Request
- type RequestId
- type RequestTemplateDataFunc
- type ResponseData
- type ResponseHeader
- type TemplateDataFunc
- type ZipContainer
- type ZipFileSystem
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ExpandTilde ¶
ExpandTilde replaces tilde symbol in path by user home directory
func NewHttpHost ¶
NewHttpHost creates plugins.Host instance for HttpPlugins to connect
func ZipFileHandler ¶
func ZipFileHandler(zc *ZipContainer, f RequestTemplateDataFunc, prefix ...string) http.HandlerFunc
ZipFileHandler returns a http.HandlerFunc for serving files from zip container
Types ¶
type CacheMap ¶
type FullResponse ¶
type FullResponse struct { Status int Hdr http.Header Body []byte // contains filtered or unexported fields }
FullResponse is marshallable struct for http.ResponseWriter
func NewFullResponse ¶
func NewFullResponse() *FullResponse
func (*FullResponse) Header ¶
func (r *FullResponse) Header() http.Header
Header implements http.ResponseWriter.Header() method
func (*FullResponse) HttpResponse ¶
func (r *FullResponse) HttpResponse() (*http.Response, error)
HttpResponse returns a http.Response struct, parsed from common.FullResponse
func (*FullResponse) Write ¶
func (r *FullResponse) Write(data []byte) (int, error)
Write implements http.ResponseWriter.Write() method
func (*FullResponse) WriteHeader ¶
func (r *FullResponse) WriteHeader(s int)
WriteHeader implements http.ResponseWriter.WriteHeader() method
func (*FullResponse) WriteTo ¶
func (r *FullResponse) WriteTo(res http.ResponseWriter) error
WriteTo writes completed FullResponse into http.ResponseWriter
type HttpPlugin ¶
type HttpPlugin interface { Router() *httprouter.Router GET(path string, handle httprouter.Handle) HEAD(path string, handle httprouter.Handle) POST(path string, handle httprouter.Handle) PUT(path string, handle httprouter.Handle) PATCH(path string, handle httprouter.Handle) DELETE(path string, handle httprouter.Handle) Call(serviceMethod string, args interface{}, reply interface{}) error Logger() *log.Logger Serve() OnServe(func()) OnStop(func()) }
HttpPlugin is used for serving HTTP requests from main application.
type Opts ¶
type Opts struct {
// contains filtered or unexported fields
}
type RPCHttpHandler ¶
type RPCHttpHandler struct {
// contains filtered or unexported fields
}
RPCHttpHandler implements Http Handler RPC service
func (*RPCHttpHandler) Handle ¶
func (rh *RPCHttpHandler) Handle(req *Request, _ *int) error
type RPCHttpResponseHandler ¶
type RPCHttpResponseHandler struct {
// contains filtered or unexported fields
}
func (*RPCHttpResponseHandler) WriteData ¶
func (p *RPCHttpResponseHandler) WriteData(data ResponseData, cnt *int) error
func (*RPCHttpResponseHandler) WriteHeader ¶
func (p *RPCHttpResponseHandler) WriteHeader(header ResponseHeader, _ *int) error
type Request ¶
Request is marshallable struct for http.Request
func NewRequest ¶
NewRequest creates new common.Request, parsed from http.Request
type RequestTemplateDataFunc ¶
RequestTemplateDataFunc is a request-depended callback function for retrieve template's render params
type ResponseData ¶
ResponseData is marshallable struct for http.ResponseWriter.Write method
type ResponseHeader ¶
ResponseHeader is marshallable struct for http.ResponseWriter.WriteHeader method
type TemplateDataFunc ¶
type TemplateDataFunc func() interface{}
TemplateDataFunc is a callback function for retrieve template's render params
type ZipContainer ¶
type ZipContainer struct {
// contains filtered or unexported fields
}
ZipContainer is a container for zip data implements io.Closer
func NewZipContainer ¶
func NewZipContainer(zipData string, options ...*Opts) (*ZipContainer, error)
func OpenZipContainer ¶
func OpenZipContainer(filename string, options ...*Opts) (*ZipContainer, error)
noinspection GoUnusedExportedFunction
func (*ZipContainer) Close ¶
func (zc *ZipContainer) Close() error
Close implements io.Closer Close() method Closes zip file when ZipContainer created from zip file
func (*ZipContainer) Walk ¶
func (zc *ZipContainer) Walk(root string, walkFn filepath.WalkFunc) error
Walk walks the file tree rooted at root, calling walkFn for each file or directory in the tree, including root. All errors that arise visiting files and directories are filtered by walkFn. The files are walked in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient.
type ZipFileSystem ¶
type ZipFileSystem interface { http.FileSystem FromTemplate(name string) bool FromImmutable(name string) bool FromStaticCompressed(name string, method string) bool FileContent(name string) ([]byte, error) }
func NewZipFileSystem ¶
func NewZipFileSystem(zc *ZipContainer, f ...TemplateDataFunc) ZipFileSystem