package function type Function struct { namespace string name string commands []string } func MkFunction(name string, commands ...string) Function { return Function{ name: name, commands: commands, } } func MkFunctionWithNamespace(namespace, name string, commands ...string) Function { return Function{ namespace: namespace, name: name, commands: commands, } } func (f Function) Type() string { return "function" } func (f Function) Name() string { return f.name } func (f Function) Commands() []string { commands := make([]string, len(f.commands)) copy(commands, f.commands) return commands } func (f Function) AddCommand(command string) Function { f.commands = append(f.commands, command) return f } func (f Function) AddCommands(commands ...string) Function { f.commands = append(f.commands, commands...) return f }