Skip to content

go-pluginx is flexible system for building native Go plugins

License

Notifications You must be signed in to change notification settings

xxlv/go-pluginx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How it works ?

Go Reference

Builder

  1. Create a Plugin Builder
builder = &plugins.PluginBuilder{
	Logger: slog.Default(),
}
  1. Build the Go Plugin
pluginBuilder.Build(context.TODO,payload, func(pi plugins.PluginInfo) {
    // when finish
})

The payload structure is defined as follows. If code is provided, it takes precedence.

type BuildPayload struct {
	Tenant string `json:"tenant"`
	Id     string `json:"id"`
	Title  string `json:"title" title:"Your tool title"`
	Code   string `json:"code" title:"Upload pure go code which in main package!"`
	SoFile string `json:"soFile"`
	Ext    any    `json:"ext"`
}

Multi-Tenant Plugin Loader

    options := engine.Options{
            Tenants: []engine.TenantOptions{
                {TenantID: "tenantA"},
            },
    }
	engine.NewLoader(options).Run()

About

go-pluginx is flexible system for building native Go plugins

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published