Documentation ¶
Index ¶
- Constants
- func NewHttpServer(publicAsset *embed.FS) *httpServer
- func NewHttpServerMode(publicAsset *embed.FS, isDebug bool) *httpServer
- type EricServer
- func (s *EricServer) RegisterHttpRoute(httpRoute ...HttpRouteHandle) *EricServer
- func (s *EricServer) RegisterServerBuilder(builder ...*EricServerBuilder) *EricServer
- func (s *EricServer) SetResponseKey(codeKey, messageKey, dataKey string) *EricServer
- func (s *EricServer) SetStaticDir(httpDir, sourceDir string) *EricServer
- func (s *EricServer) SetStaticDirs(staticSource ...*StaticStaticResources) *EricServer
- func (s *EricServer) SetTemplate(sourceDir, subFix string) *EricServer
- func (s *EricServer) SetTlsConf(tlsConf *HttpTlsConf)
- func (s *EricServer) SetUploadDir(httpDIr, sourceDIr string) *EricServer
- func (s *EricServer) Start(host string, port int, nodeId int, mode MODE_CONST)
- type EricServerBuilder
- func (this *EricServerBuilder) RegisterHttpRoute(httpRoute ...HttpRouteHandle) *EricServerBuilder
- func (this *EricServerBuilder) SetNodeId(nodeId int)
- func (this *EricServerBuilder) SetResponseKey(codeKey, messageKey, dataKey string) *EricServerBuilder
- func (this *EricServerBuilder) SetServerName(serverName string)
- func (this *EricServerBuilder) SetStaticDir(httpDir, sourceDir string) *EricServerBuilder
- func (this *EricServerBuilder) SetStaticDirs(staticSource ...*StaticStaticResources) *EricServerBuilder
- func (this *EricServerBuilder) SetTemplate(sourceDir, subFix string) *EricServerBuilder
- func (this *EricServerBuilder) SetTlsConf(tlsConf *HttpTlsConf)
- func (this *EricServerBuilder) SetUploadDIr(httpDir, sourceDir string) *EricServerBuilder
- type Err
- type Errno
- type HttpRouteHandle
- type HttpTlsConf
- type KError
- type MODE_CONST
- type RpcParam
- type StaticStaticResources
Constants ¶
const ( DEFAULT_CODE_KEY = "code" DEFAULT_MSG_KEY = "message" DEFAULT_DATA_KEY = "data" )
Variables ¶
This section is empty.
Functions ¶
func NewHttpServer ¶
func NewHttpServerMode ¶
* 静态声明
Types ¶
type EricServer ¶
type EricServer struct {
// contains filtered or unexported fields
}
func NewEricServer ¶
func NewEricServer(publicAsset *embed.FS) *EricServer
func (*EricServer) RegisterHttpRoute ¶
func (s *EricServer) RegisterHttpRoute(httpRoute ...HttpRouteHandle) *EricServer
* 注册http路由
func (*EricServer) RegisterServerBuilder ¶
func (s *EricServer) RegisterServerBuilder(builder ...*EricServerBuilder) *EricServer
* 注册多个服务
func (*EricServer) SetResponseKey ¶
func (s *EricServer) SetResponseKey(codeKey, messageKey, dataKey string) *EricServer
* 设置json响应key @param string codeKey 响应code @param string messageKey 响应message @param string dataKey 响应data
func (*EricServer) SetStaticDir ¶
func (s *EricServer) SetStaticDir(httpDir, sourceDir string) *EricServer
* 设置静态目录 @param httpDir string js css 等http访问 @param sourceDir string js css 绝对路径
func (*EricServer) SetStaticDirs ¶
func (s *EricServer) SetStaticDirs(staticSource ...*StaticStaticResources) *EricServer
注册静态资源访问
func (*EricServer) SetTemplate ¶
func (s *EricServer) SetTemplate(sourceDir, subFix string) *EricServer
* 设置模板 @param sourceDir string 模板存放目录 @param subFix string 模板后缀
func (*EricServer) SetUploadDir ¶
func (s *EricServer) SetUploadDir(httpDIr, sourceDIr string) *EricServer
* 设置上传访问动态解析dir
func (*EricServer) Start ¶
func (s *EricServer) Start(host string, port int, nodeId int, mode MODE_CONST)
type EricServerBuilder ¶
type EricServerBuilder struct {
// contains filtered or unexported fields
}
*
func NewEricServerBuilder ¶
func NewEricServerBuilder(publicAsset *embed.FS, serverName string, serverMode MODE_CONST, host string, port int) *EricServerBuilder
func (*EricServerBuilder) RegisterHttpRoute ¶
func (this *EricServerBuilder) RegisterHttpRoute(httpRoute ...HttpRouteHandle) *EricServerBuilder
* 注册http路由
func (*EricServerBuilder) SetNodeId ¶
func (this *EricServerBuilder) SetNodeId(nodeId int)
func (*EricServerBuilder) SetResponseKey ¶
func (this *EricServerBuilder) SetResponseKey(codeKey, messageKey, dataKey string) *EricServerBuilder
* 设置json响应key @param string codeKey 响应code @param string messageKey 响应message @param string dataKey 响应data
func (*EricServerBuilder) SetServerName ¶
func (this *EricServerBuilder) SetServerName(serverName string)
func (*EricServerBuilder) SetStaticDir ¶
func (this *EricServerBuilder) SetStaticDir(httpDir, sourceDir string) *EricServerBuilder
* 设置静态目录 @param httpDir string js css 等http访问 @param sourceDir string js css 绝对路径
func (*EricServerBuilder) SetStaticDirs ¶
func (this *EricServerBuilder) SetStaticDirs(staticSource ...*StaticStaticResources) *EricServerBuilder
* 批量设置静态资源目录
func (*EricServerBuilder) SetTemplate ¶
func (this *EricServerBuilder) SetTemplate(sourceDir, subFix string) *EricServerBuilder
* 设置页面模板 @param sourceDir string 模板存放目录 @param subFix string 模板后缀
func (*EricServerBuilder) SetTlsConf ¶
func (this *EricServerBuilder) SetTlsConf(tlsConf *HttpTlsConf)
func (*EricServerBuilder) SetUploadDIr ¶
func (this *EricServerBuilder) SetUploadDIr(httpDir, sourceDir string) *EricServerBuilder
* 设置上传访问动态解析dir @param httpDir string http访问目录 @param sourceDir string string本地存放目录
type HttpRouteHandle ¶
type HttpTlsConf ¶
type HttpTlsConf struct {
// contains filtered or unexported fields
}
func NewHttpTlsConf ¶
func NewHttpTlsConf(certFilePath string, keyFilePath string) *HttpTlsConf
type MODE_CONST ¶
type MODE_CONST string
const ( MODE_CONST_DEV MODE_CONST = "dev" MODE_CONST_PRO MODE_CONST = "pro" )
type RpcParam ¶
type RpcParam struct { JsonVer string `json:"json_ver"` RequestId string `json:"request_id"` Version string `json:"ver"` }
*默认传参*