gen_plugin

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2021 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const ConfigTemplate = `` /* 474-byte string literal not displayed */
View Source
const HookTemplate = `` /* 542-byte string literal not displayed */
View Source
const MainTemplate = `` /* 774-byte string literal not displayed */

Variables

View Source
var Command = &cobra.Command{
	Use:   "plugin",
	Short: "code generator",
	Example: "The following command will generate a code template for the 'awesome' plugin, which makes use of OnBasicAuth and OnSubscribe hook and enables the configuration in ./plugin directory.\n" +
		"\n" +
		"gmqctl gen plugin -n awesome -H OnBasicAuth,OnSubscribe -c true -o ./plugin",
}

Functions

func ValidateHookName

func ValidateHookName(name string) error

ValidateHookName returns an error when the given hook name is invalid

func ValidateHooks

func ValidateHooks(str string) (names []string, err error)

ValidateHooks parse the input string into hook name slice. Return an error when any of the names is invalid.

Types

type Var

type Var struct {
	// Name is the plugin name. Snack style.
	Name string
	// StrutName is the struct name. Camel style.
	StrutName string
	// Receiver is the struct method receiver.
	Receiver string
	// Hooks is the hooks used in the plugin.
	Hooks []string
	// Config indicates whether the plugin use  configuration.
	Config bool
}

Var is the template variable for all templates

func (*Var) Execute

func (v *Var) Execute(file, tmplName, tmpl string) error

Execute executes the template into file with Var as variable.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL