Documentation
¶
Index ¶
- Variables
- func BuildInitField(structName string) string
- func BuildNewStruct(structName string, fields Fields, oldFields []db2entity.Field) string
- func BuildPlugin(dir string) error
- func BuildPluginEnv(info *BuildPluginInfo, buildBeforeFunc func()) error
- func Clear(info *BuildPluginInfo) error
- func CopyFile(dstName, srcName string, packageName string) (bool, error)
- func ExecPlugin(v *viper.Viper, info *BuildPluginInfo) error
- func GenPlugin(structName string, fields []db2entity.Field, dir string) (string, error)
- func GetSortBody(structName string, fields []db2entity.Field) string
- func HandelPlural(v *viper.Viper, info *BuildPluginInfo) bool
- func HandleInitFieldsAndPool(v *viper.Viper, info *BuildPluginInfo) bool
- func HandleModel(v *viper.Viper) error
- func HandleNewStruct(info *BuildPluginInfo, newStrcut string) bool
- func HandlePluralPool(v *viper.Viper, info *BuildPluginInfo)
- func HandlePool(v *viper.Viper, info *BuildPluginInfo)
- func HandleVar(info *BuildPluginInfo, varName string, context *string) bool
- func WriteContent(v *viper.Viper, info *BuildPluginInfo) error
- type BuildPluginInfo
- type Field
- type Fields
- type InitFieldsReturn
- type Model
- type ModelPlugin
- type ModelRPC
- type ModelRPCServer
- type SortReturn
- type Test
- type Tests
- type Var
Constants ¶
This section is empty.
Variables ¶
View Source
var HandshakeConfig = go_plugin.HandshakeConfig{
ProtocolVersion: 1,
MagicCookieKey: "BASIC_PLUGIN",
MagicCookieValue: "hello",
}
Functions ¶
func BuildInitField ¶
func BuildNewStruct ¶
func BuildPlugin ¶
func BuildPluginEnv ¶
func BuildPluginEnv(info *BuildPluginInfo, buildBeforeFunc func()) error
@ 建立虚拟环境
func Clear ¶
func Clear(info *BuildPluginInfo) error
func ExecPlugin ¶
func ExecPlugin(v *viper.Viper, info *BuildPluginInfo) error
func HandleInitFieldsAndPool ¶
func HandleInitFieldsAndPool(v *viper.Viper, info *BuildPluginInfo) bool
初始化变量,生成临时对象池
func HandleModel ¶
func HandleNewStruct ¶
func HandleNewStruct(info *BuildPluginInfo, newStrcut string) bool
func WriteContent ¶
func WriteContent(v *viper.Viper, info *BuildPluginInfo) error
Types ¶
type BuildPluginInfo ¶
type BuildPluginInfo struct { InitField InitFieldsReturn // contains filtered or unexported fields }
func FindModel ¶
func FindModel(modelPath, modelName, modelNamePlural string) (*BuildPluginInfo, error)
@ 查找模型 @ 解析模型
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 SortReturn ¶
Click to show internal directories.
Click to hide internal directories.