| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package framework
- // IGroup 代表前缀分组
- type IGroup interface {
- Get(string, ControllerHandler)
- Post(string, ControllerHandler)
- Put(string, ControllerHandler)
- Delete(string, ControllerHandler)
- }
- // ==========================================================
- type Group struct {
- core *Core
- prefix string
- }
- // 初始化 Group
- func NewGroup(core *Core, prefix string) *Group {
- return &Group{
- core: core,
- prefix: prefix,
- }
- }
- func (g *Group) Get(uri string, handler ControllerHandler) {
- uri = g.prefix + uri
- g.core.Get(uri, handler)
- }
- func (g *Group) Post(uri string, handler ControllerHandler) {
- uri = g.prefix + uri
- g.core.Post(uri, handler)
- }
- func (g *Group) Put(uri string, handler ControllerHandler) {
- uri = g.prefix + uri
- g.core.Put(uri, handler)
- }
- func (g *Group) Delete(uri string, handler ControllerHandler) {
- uri = g.prefix + uri
- g.core.Delete(uri, handler)
- }
|