Documentation ¶
Index ¶
- Constants
- func CheckSqlError(err error)
- type AppInterface
- type BaseQuery
- type ComponentInterface
- type ConfigInterface
- type Configer
- type CrontabInterface
- type EventInterface
- type HandlerFunc
- type HookInterface
- type LogLevel
- type Logger
- type MaoConfigInterface
- type MaoLogInterface
- type Model
- func (this *Model) Alias(alias string) string
- func (this *Model) Cols(cols ...string) *Model
- func (this *Model) Create() bool
- func (this *Model) Delete() bool
- func (this *Model) Exists() bool
- func (this *Model) Get() bool
- func (this *Model) Match(column string, data any) *Model
- func (this *Model) Must(cols ...string) *Model
- func (this *Model) Omit(cols ...string) *Model
- func (this *Model) SetData(data any) *Model
- func (this *Model) SetTableName(tableName string)
- func (this *Model) TableName() string
- func (this *Model) Update() bool
- func (this *Model) Where(query string, args ...any) *Model
- type ModelInterface
- type Module
- type ModuleInterface
- type Permission
- type Router
- type RouterGroup
- func (this *RouterGroup) Any(relativePath string, handlers ...HandlerFunc) *Router
- func (this *RouterGroup) DELETE(relativePath string, handlers ...HandlerFunc) *Router
- func (this *RouterGroup) GET(relativePath string, handlers ...HandlerFunc) *Router
- func (this *RouterGroup) Group(relativePath string, handlers ...HandlerFunc) *RouterGroup
- func (this *RouterGroup) POST(relativePath string, handlers ...HandlerFunc) *Router
- func (this *RouterGroup) PUT(relativePath string, handlers ...HandlerFunc) *Router
- func (this *RouterGroup) Permission(code string, name string) *RouterGroup
- func (this *RouterGroup) Use(middleware ...HandlerFunc)
- type Server
- type SetSetTaskLiner
- type Taskline
- func (this *Taskline) FindPage(db *xorm.Session, listPtr interface{}, page, limit int) int64
- func (this *Taskline) Log() MaoLogInterface
- func (this *Taskline) MaoConfig() MaoConfigInterface
- func (this *Taskline) Mutex() *sync.Mutex
- func (this *Taskline) NewTaskLine() *Taskline
- func (this *Taskline) OrmModel(model ModelInterface) ModelInterface
- func (this *Taskline) OrmSession() *xorm.Session
- func (this *Taskline) OrmTable(bean any) *xorm.Session
- func (this *Taskline) PutHook(h HookInterface, args ...any)
- func (this *Taskline) RenderConfig(conf ConfigInterface) ConfigInterface
- func (this *Taskline) Transaction(fn func())
- type WebEngine
- type Webline
- func (this *Webline) BindCookie(objectPtr interface{})
- func (this *Webline) BindForm(objectPtr interface{})
- func (this *Webline) BindJSON(objectPtr interface{})
- func (this *Webline) BindQuery(objectPtr interface{})
- func (this *Webline) GetPermissionCode() string
- func (this *Webline) GetPermissionList() []*Permission
- func (this *Webline) IsMobile() bool
- func (this *Webline) JSON(code int32, result any, msg ...any)
Constants ¶
View Source
const ( DIR_CONFIG = "./config" DIR_RUNTIME = "./runtime" DIR_LOGS = "./logs" )
View Source
const ( CODE_WARN = 540 //错误警告 CODE_DB = 551 //数据库错误 CODE_SQL = 552 //sql错误 CODE_NOTEXISTS = 553 //数据不存在 CODE_CREATE = 554 //数据创建错误 CODE_UPDATE = 555 //数据更新错误 CODE_REMOVE = 556 //数据删除错误 CODE_INIT = 600 //启动错误 CODE_CONF = 601 //配置错误 CODE_LOG = 602 //日志错误 CODE_BIND = 603 //参数错误 )
错误代号
View Source
const (
RUN_MODE_DEVELOP = "develop"
)
Variables ¶
This section is empty.
Functions ¶
func CheckSqlError ¶
func CheckSqlError(err error)
Types ¶
type AppInterface ¶
type AppInterface interface { Init(*WebEngine) //站点初始化执行方法(可以放一些中间件处理的东西) ConfigFile() string //配置文件路径 Modules() []ModuleInterface //加载需要的模块 Install() error //安装入口 }
应用接口
type ComponentInterface ¶
type ComponentInterface interface { CompName() string //组件名称 Models() []ModelInterface //数据库模型 }
组件接口
type ConfigInterface ¶
type ConfigInterface interface { Default() ConfigInterface //默认配置 BeforeGet() //请求前 ConfigName() string //配置名称 ConfigAlias() string //配置别名 Validate() error //验证 }
配置接口
type Configer ¶
type Configer interface {
Config() ConfigInterface
}
type CrontabInterface ¶
type CrontabInterface interface { Name() string //任务名称 Schedule() string //定时时间表达式 Handler(*Taskline) //执行方法 }
定时任务接口
type EventInterface ¶
type EventInterface interface { Hook() HookInterface //钩子代号,必须对应 Handler(m *Taskline, args ...interface{}) //事件处理方法 }
事件接口
type HandlerFunc ¶
type HandlerFunc = func(*Webline)
type HookInterface ¶
钩子接口
type MaoConfigInterface ¶
type MaoConfigInterface interface { Core() *ini.File Get(c ConfigInterface) ConfigInterface GetByAlias(alias string) ConfigInterface Save(confPtr ConfigInterface) }
type MaoLogInterface ¶
type ModelInterface ¶
type ModelInterface interface { TableName() string PrimaryKey() any //主键 SetTableName(string) //设置表名 // contains filtered or unexported methods }
模型接口
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func (*Module) SetTaskline ¶
type ModuleInterface ¶
type ModuleInterface interface { Install() //执行安装操作 ModuleName() string //模块名称 Init(*WebEngine) //模块初始化,此处可放置路由 Crontabs() []CrontabInterface //定时任务 Components() []ComponentInterface //组件 Hooks() []HookInterface //钩子列表(注册后的事件才能使用) Events() []EventInterface //事件列表(自动寻找对应钩子) }
模块接口
type Permission ¶
type Permission struct { Name string `json:"name"` Code string `json:"code"` Childs []*Permission `json:"childs"` // contains filtered or unexported fields }
权限输出
type RouterGroup ¶
type RouterGroup struct {
// contains filtered or unexported fields
}
func (*RouterGroup) Any ¶
func (this *RouterGroup) Any(relativePath string, handlers ...HandlerFunc) *Router
func (*RouterGroup) DELETE ¶
func (this *RouterGroup) DELETE(relativePath string, handlers ...HandlerFunc) *Router
func (*RouterGroup) GET ¶
func (this *RouterGroup) GET(relativePath string, handlers ...HandlerFunc) *Router
GET请求
func (*RouterGroup) Group ¶
func (this *RouterGroup) Group(relativePath string, handlers ...HandlerFunc) *RouterGroup
func (*RouterGroup) POST ¶
func (this *RouterGroup) POST(relativePath string, handlers ...HandlerFunc) *Router
func (*RouterGroup) PUT ¶
func (this *RouterGroup) PUT(relativePath string, handlers ...HandlerFunc) *Router
func (*RouterGroup) Permission ¶
func (this *RouterGroup) Permission(code string, name string) *RouterGroup
权限配置使用
func (*RouterGroup) Use ¶
func (this *RouterGroup) Use(middleware ...HandlerFunc)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(app AppInterface) *Server
type Taskline ¶
type Taskline struct {
// contains filtered or unexported fields
}
func (*Taskline) OrmModel ¶
func (this *Taskline) OrmModel(model ModelInterface) ModelInterface
实例化一个对象【泛型】
func (*Taskline) RenderConfig ¶
func (this *Taskline) RenderConfig(conf ConfigInterface) ConfigInterface
初始化配置
type WebEngine ¶
type WebEngine struct {
RouterGroup
}
func (*WebEngine) MiddleSign ¶
func (this *WebEngine) MiddleSign() HandlerFunc
签名中间件 计算规则 sign=SHA256()
Click to show internal directories.
Click to hide internal directories.