Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func RegisterHandler ¶
func RegisterHandler(seq int, name string, handler HandlerFunc)
Example ¶
package main
import (
pkgCtl "github.com/RealFax/pkg-ctl"
)
func main() {
pkgCtl.RegisterHandler(-1, "test-loader", func(c *pkgCtl.Context) pkgCtl.Handler {
c.Set("ctx1", false)
return nil
})
}
Types ¶
type Context ¶ added in v1.4.0
type Context struct {
context.Context
CancelFunc context.CancelFunc
// contains filtered or unexported fields
}
func Use ¶ added in v1.4.0
Example ¶
package main
import (
pkgCtl "github.com/RealFax/pkg-ctl"
)
var ctx = pkgCtl.New(nil)
func main() {
c, ok := pkgCtl.Use(ctx)
if !ok {
// not pkgCtl.Context
return
}
// call pkgCtl.Context api
c.Get("Key")
}
func (*Context) ListenAndDestroy ¶ added in v1.4.0
type DestroyUnit ¶
type HandlerFunc ¶ added in v1.2.0
type Unit ¶
type Unit struct {
Seq int
Name string
Handle HandlerFunc
}
Click to show internal directories.
Click to hide internal directories.