github.com/nyan233/littlerpc@v0.4.6-0.20230316182519-0c8d5c48abaf/core/middle/plugin/doc.go (about)

     1  // Package plugin is plugin interface
     2  //
     3  //	Plugin Context never private, the context is the request internal global shared
     4  //	able usage private type for access self data, server plugin example:
     5  //	type xxPluginService struct {}
     6  //
     7  //	-->HandleReceive(...,kvAppend,...)
     8  //	-->kvAppend(xxPluginService{},"hello world")
     9  //
    10  //	---->HandleCall(pCtx,...)
    11  //	---->value,_ := pCtx.Value(xxPluginService{}).(string)
    12  //	---->value == "hello world"
    13  package plugin
    14  
    15  type InjectServerPlugin func(name string, plugin ServerPlugin)
    16  
    17  type InjectClientPlugin func(name string, plugin ClientPlugin)