Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶ added in v1.5.0
func Register(seq int, name string, handler HandlerFunc)
func UseValue ¶ added in v1.4.1
Example ¶
package main import ( pkgCtl "github.com/RealFax/pkg-ctl" ) var ctx = pkgCtl.New() func main() { c, ok := pkgCtl.Use(ctx) if !ok { return } c.Set("K", "V") catch, ok := pkgCtl.UseValue[string](c, "K") if !ok { return } if catch != "V" { // fail } // success }
Output:
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() func main() { c, ok := pkgCtl.Use(ctx) if !ok { // not pkgCtl.Context return } // call pkgCtl.Context api c.Get("Key") }
Output:
func (*Context) ListenAndDestroy ¶ added in v1.4.0
type HandlerFunc ¶ added in v1.2.0
type Option ¶ added in v1.5.0
type Option func(*Context)
func WithLogger ¶ added in v1.5.0
func WithValues ¶ added in v1.5.0
type UnimplementedHandler ¶ added in v1.5.0
type UnimplementedHandler struct{}
func (UnimplementedHandler) Async ¶ added in v1.5.0
func (h UnimplementedHandler) Async() bool
func (UnimplementedHandler) Create ¶ added in v1.5.0
func (h UnimplementedHandler) Create() error
func (UnimplementedHandler) Destroy ¶ added in v1.5.0
func (h UnimplementedHandler) Destroy() error
func (UnimplementedHandler) Start ¶ added in v1.5.0
func (h UnimplementedHandler) Start() error
type Unit ¶
type Unit struct { Seq int Name string Handle HandlerFunc }
Click to show internal directories.
Click to hide internal directories.