Documentation ¶
Index ¶
- Variables
- type EsimFactory
- type InitFieldsReturn
- type Model
- type ModelPlugin
- type ModelRPC
- type ModelRPCServer
- type Option
- type Plural
- type PoolTpl
- type RPCPluginStructField
- func (rps *RPCPluginStructField) Close()
- func (rps *RPCPluginStructField) GenInitFieldStr(getType reflect.Type, fieldLink, initName string, specFilds *pkg.Fields) []string
- func (rps *RPCPluginStructField) HandleField(fields []pkg.Field, data interface{})
- func (rps *RPCPluginStructField) KindToInit(refType reflect.Type) string
- func (rps *RPCPluginStructField) SetFilesName(filesName []string)
- func (rps *RPCPluginStructField) SetPackName(packName string)
- func (rps *RPCPluginStructField) SetStructDir(structDir string)
- func (rps *RPCPluginStructField) SetStructFileName(structFileName string)
- func (rps *RPCPluginStructField) SetStructInfo(s *structInfo)
- func (rps *RPCPluginStructField) SetStructName(structName string)
- type SortReturn
- type StructFieldIface
Constants ¶
This section is empty.
Variables ¶
var HandshakeConfig = plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "BASIC_PLUGIN",
MagicCookieValue: "hello",
}
Functions ¶
This section is empty.
Types ¶
type EsimFactory ¶
type EsimFactory struct { // struct name which be search StructName string // Struct will be create NewStructInfo *structInfo ReleaseStr string InitField *InitFieldsReturn NewPluralStr string ReleasePluralStr string TypePluralStr string // option start Option1 string Option2 string Option3 string Option4 string Option5 string OptionParam string WithNew bool SpecFieldInitStr string ReturnStr string StructTpl templates.StructInfo // contains filtered or unexported fields }
+-----------+-----------+. | firstPart | package | | | import | | ----------| ----------| | secondPart| var | | | | | ----------| ----------| | thirdPart | struct | | | funcBody | | ----------| ----------|
func NewEsimFactory ¶
func NewEsimFactory(options ...Option) *EsimFactory
func (*EsimFactory) Close ¶
func (ef *EsimFactory) Close()
type InitFieldsReturn ¶
type ModelPlugin ¶
type ModelPlugin struct { // Impl Injection Impl Model }
This is the implementation of plugin.Plugin so we can serve/consume this
This has two methods: Server must return an RPC server for this plugin type. We construct a ModelRPCServer for this.
Client must return an implementation of our interface that communicates over an RPC client. We return ModelRPC for this.
Ignore MuxBroker. That is used to create more multiplexed streams on our plugin connection and is a more advanced use case.
func (ModelPlugin) Client ¶
func (ModelPlugin) Client(b *plugin.MuxBroker, c *rpc.Client) (interface{}, error)
func (*ModelPlugin) Server ¶
func (p *ModelPlugin) Server(*plugin.MuxBroker) (interface{}, error)
type ModelRPC ¶
type ModelRPC struct {
// contains filtered or unexported fields
}
Here is an implementation that talks over RPC.
type ModelRPCServer ¶
type ModelRPCServer struct { // This is the real implementation Impl Model }
Here is the RPC server that ModelRPC talks to, conforming to the requirements of net/rpc.
func (*ModelRPCServer) InitField ¶
func (s *ModelRPCServer) InitField(args interface{}, resp *string) error
func (*ModelRPCServer) Sort ¶
func (s *ModelRPCServer) Sort(args interface{}, resp *string) error
type Option ¶
type Option func(*EsimFactory)
func WithEsimFactoryLogger ¶
func WithEsimFactoryTpl ¶
func WithEsimFactoryWriter ¶
func WithEsimFactoryWriter(writer filedir.IfaceWriter) Option
type Plural ¶
type Plural struct { PluralName string StructName string Star string // contains filtered or unexported fields }
func (Plural) ReleaseString ¶
func (Plural) TypeString ¶
type PoolTpl ¶
type PoolTpl struct { VarPoolName string StructName string // contains filtered or unexported fields }
func NewPoolTpl ¶
func NewPoolTpl() PoolTpl
type RPCPluginStructField ¶
type RPCPluginStructField struct { StructName string StructFileName string StrcutInfo *structInfo Fields []pkg.Field // contains filtered or unexported fields }
func NewRPCPluginStructField ¶
func NewRPCPluginStructField(writer filedir.IfaceWriter, logger log.Logger) *RPCPluginStructField
func (*RPCPluginStructField) Close ¶
func (rps *RPCPluginStructField) Close()
func (*RPCPluginStructField) GenInitFieldStr ¶
func (*RPCPluginStructField) HandleField ¶
func (rps *RPCPluginStructField) HandleField(fields []pkg.Field, data interface{})
func (*RPCPluginStructField) KindToInit ¶
func (rps *RPCPluginStructField) KindToInit(refType reflect.Type) string
func (*RPCPluginStructField) SetFilesName ¶
func (rps *RPCPluginStructField) SetFilesName(filesName []string)
func (*RPCPluginStructField) SetPackName ¶
func (rps *RPCPluginStructField) SetPackName(packName string)
func (*RPCPluginStructField) SetStructDir ¶
func (rps *RPCPluginStructField) SetStructDir(structDir string)
func (*RPCPluginStructField) SetStructFileName ¶
func (rps *RPCPluginStructField) SetStructFileName(structFileName string)
func (*RPCPluginStructField) SetStructInfo ¶
func (rps *RPCPluginStructField) SetStructInfo(s *structInfo)
func (*RPCPluginStructField) SetStructName ¶
func (rps *RPCPluginStructField) SetStructName(structName string)