Documentation ¶
Index ¶
- Variables
- func DeepCopy(dst, src interface{}) error
- func Existe(path string) bool
- func FindFilesFromStartPath(startPath string, rightFileName string, outStr *[]string)
- func FindProjectPathByPKGName(projectPKG string) string
- func FindPropertiesFile(confFileName string) string
- func FindStaticPath(ProjectPath string, rightPath string, outStr *string)
- func GetFunctionName(i interface{}) string
- func Inject(instance interface{})
- func IsDir(path string) bool
- func PanizzaWelcomePage() string
- func ReadConfigFromProperties(propertiesPath string) map[string]interface{}
- func RegistAspecter(aspect interface{})
- func RegisterComponents(been interface{})
- func RegisterController(i interface{}) interface{}
- func RegisterService(s interface{}) interface{}
- func UseTimePrint(ctx *HandleContext) func()
- type API
- type APIManeger
- type Aspect
- type Configer
- type ExceptionHandle
- type Filter
- type FilterFun
- type FilterImpl
- type Handle
- type HandleContext
- type Ioc
- func (ioc *Ioc) AddBeen(name string, singleton interface{})
- func (ioc *Ioc) GetBeen(name string) interface{}
- func (ioc *Ioc) GetPrototype(name string) (interface{}, error)
- func (ioc *Ioc) Inject(instance interface{}) interface{}
- func (ioc *Ioc) SetPrototypeFactory(name string, factory factory)
- func (ioc *Ioc) String() string
- type JSONArray
- type JSONObject
- type MDContext
- type ModelMap
- type PKGenarater
- type Panizza
- type ParamParser
- func (pp *ParamParser) Add(key string, value string)
- func (pp *ParamParser) Check(registRouter string, url string) bool
- func (pp *ParamParser) GetParams(registRouter string, url string)
- func (pp *ParamParser) Parame(key string) string
- func (pp *ParamParser) ParameBool(key string) bool
- func (pp *ParamParser) ParameFloat32(key string) (float64, error)
- func (pp *ParamParser) ParameFloat64(key string) (float64, error)
- func (pp *ParamParser) ParameInt(key string) (int, error)
- func (pp *ParamParser) ParameInt64(key string) (int64, error)
Constants ¶
This section is empty.
Variables ¶
var ( IocInstance = NewIoc() //导入ioc包的时候实例化的全局单例 ErrFactoryNotFound = errors.New("factory not found") )
var ApiTemplate1 = `` /* 1078-byte string literal not displayed */
var ApiTemplate2 = `` /* 1202-byte string literal not displayed */
var Aspecters = sync.Map{}
全局存放注册的Aspect
var GlobalApi = APIManeger{ APIMapper: []API{}, APILength: 0, }
var IsOpenController bool = false
controller开启
Functions ¶
func FindFilesFromStartPath ¶
从给定的目录下寻找某个文件,返回该文件绝对路径
func FindPropertiesFile ¶
寻找application.conf配置文件
func FindStaticPath ¶
从给定的目录下寻找某个文件夹,结果为该文件夹的绝对路径
func PanizzaWelcomePage ¶
func PanizzaWelcomePage() string
func RegisterController ¶
func RegisterController(i interface{}) interface{}
注册controller,传入结构体指针,此函数不应该recover():此函数运行成功就能保证运用运行起来
Types ¶
type APIManeger ¶
type Aspect ¶
type Aspect interface { Config() string //配置切面 return "xxxxx|xxxxx|xxxxx" xxxxx表示需要配置的目标函数名称 Before(ctx *HandleContext, HandleName string) //目标方法执行之前执行 After(ctx *HandleContext, HandleName string) //目标方法执行之后执行 AfterPanic(err interface{}, ctx *HandleContext, HandleName string) //目标方法出现异常后执行 }
type Configer ¶
type Configer map[string]interface{}
var AppConfig Configer
全局配置实例
func (*Configer) GetConfiger ¶
通过key获取配置文件中的配置
type ExceptionHandle ¶
type ExceptionHandle struct { }
func (*ExceptionHandle) ExceptionHandleRegist ¶
func (e *ExceptionHandle) ExceptionHandleRegist()
type Filter ¶
type Filter interface { Use(i interface{}) RunFilter(ctx *HandleContext) }
--------------------------------------------------------------------------------------------- Filter interface
type FilterFun ¶
--------------------------------------------------------------------------------------------- 静态资源访问的过滤器函数
type FilterImpl ¶
type FilterImpl struct {
FilterHandles []Handle
}
func (*FilterImpl) RunFilter ¶
func (mw *FilterImpl) RunFilter(ctx *HandleContext)
func (*FilterImpl) Use ¶
func (mw *FilterImpl) Use(s interface{})
type HandleContext ¶
type HandleContext struct { ResponseWriter *http.ResponseWriter Request *http.Request ParamParser Data sync.Map CloseHttp bool }
func NewHandleContext ¶
func NewHandleContext(w *http.ResponseWriter, r *http.Request) *HandleContext
func (*HandleContext) Bind ¶
func (ctx *HandleContext) Bind(i interface{}) error
传入结构体指针,把请求参数绑定到结构体内部
func (*HandleContext) JSON_write ¶
func (ctx *HandleContext) JSON_write(code int, e interface{})
--------------------------------------------------------------------------------------------- 传入map、array、slice、struct
func (*HandleContext) Str_write ¶
func (ctx *HandleContext) Str_write(code int, msg string)
向客户端写入一个字符串
type Ioc ¶
容器
func (*Ioc) Inject ¶
func (ioc *Ioc) Inject(instance interface{}) interface{}
注入依赖,此函数不应该recover():此函数运行成功就能保证运用运行起来
func (*Ioc) SetPrototypeFactory ¶
设置实例对象工厂
type JSONObject ¶
type JSONObject map[string]interface{}
func (*JSONObject) Put ¶
func (jo *JSONObject) Put(key string, val interface{})
type MDContext ¶
type MDContext struct { ResponseWriter http.ResponseWriter Request *http.Request Data interface{} }
---------------------------------------------------------------------------------------------
type ModelMap ¶
type ModelMap map[string]interface{}
---------------------------------------------------------------------------------------------
func (*ModelMap) AddAttribute ¶
type PKGenarater ¶
type PKGenarater struct { DB *sql.DB `inject:"db"` TableName string IdLength int PK string Sign string }
* idLength:主键生成的长度 table_name:表名,数据库内表的真实名字 pk:表的主键字段 sign: user00000012 中的user
func (*PKGenarater) GetPK ¶
func (p *PKGenarater) GetPK() (string, error)
type ParamParser ¶
func (*ParamParser) Add ¶
func (pp *ParamParser) Add(key string, value string)
func (*ParamParser) Check ¶
func (pp *ParamParser) Check(registRouter string, url string) bool
检查自定义路由与访问路由是否匹配,如果匹配则返回true, 若不匹配则返回false
func (*ParamParser) GetParams ¶
func (pp *ParamParser) GetParams(registRouter string, url string)
在Check方法通过之后便可以调用此方法获得url参数,参数放在对象的ParamMap之内
func (*ParamParser) Parame ¶
func (pp *ParamParser) Parame(key string) string
func (*ParamParser) ParameBool ¶
func (pp *ParamParser) ParameBool(key string) bool
func (*ParamParser) ParameFloat32 ¶
func (pp *ParamParser) ParameFloat32(key string) (float64, error)
func (*ParamParser) ParameFloat64 ¶
func (pp *ParamParser) ParameFloat64(key string) (float64, error)
func (*ParamParser) ParameInt64 ¶
func (pp *ParamParser) ParameInt64(key string) (int64, error)