Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CategoryTemplate = template.Must(template.New("category").Parse(`// Generated By Abesh CLI At: {{.TimeStamp}}
package {{.PackageName}}
import "github.com/mkawserm/abesh/constant"
// Category of the service
const Category = string(constant.CategoryService)
`))
View Source
var ContractIdTemplate = template.Must(template.New("contractid").Parse(`// Generated By Abesh CLI At: {{.TimeStamp}}
// TODO: EDIT THIS FILE AND IMPLEMENT YOUR SERVICE
package {{.PackageName}}
// ContractId of the service
const ContractId = "abesh:{{.PackageName}}"
`))
View Source
var NameTemplate = template.Must(template.New("name").Parse(`// Generated By Abesh CLI At: {{.TimeStamp}}
// TODO: EDIT THIS FILE AND IMPLEMENT YOUR SERVICE
package {{.PackageName}}
// Name of the service
const Name = "abesh_{{.PackageName}}"
`))
View Source
var ServiceTemplate = template.Must(template.New("service").Parse(`// Generated By Abesh CLI At: {{.TimeStamp}}
// TODO: EDIT THIS FILE AND IMPLEMENT YOUR SERVICE
package {{.PackageName}}
import (
"context"
"github.com/mkawserm/abesh/iface"
"github.com/mkawserm/abesh/model"
"github.com/mkawserm/abesh/registry"
"{{.ModulePath}}/constant"
)
type {{.InterfaceName}} struct {
mCM model.ConfigMap
}
func ({{.InterfaceRune}} *{{.InterfaceName}}) Name() string {
return Name
}
func ({{.InterfaceRune}} *{{.InterfaceName}}) Version() string {
return constant.Version
}
func ({{.InterfaceRune}} *{{.InterfaceName}}) Category() string {
return Category
}
func ({{.InterfaceRune}} *{{.InterfaceName}}) ContractId() string {
return ContractId
}
func ({{.InterfaceRune}} *{{.InterfaceName}}) GetConfigMap() model.ConfigMap {
return {{.InterfaceRune}}.mCM
}
func ({{.InterfaceRune}} *{{.InterfaceName}}) SetConfigMap(cm model.ConfigMap) error {
{{.InterfaceRune}}.mCM = cm
return nil
}
func ({{.InterfaceRune}} *{{.InterfaceName}}) Setup() error {
return nil
}
func ({{.InterfaceRune}} *{{.InterfaceName}}) New() iface.ICapability {
return &{{.InterfaceName}}{}
}
func ({{.InterfaceRune}} *{{.InterfaceName}}) Serve(ctx context.Context, event *model.Event) (*model.Event, error) {
return model.GenerateOutputEvent(
event.Metadata,
{{.InterfaceRune}}.ContractId(),
"OK",
200,
"application/json",
[]byte("{}"),
), nil
}
func init() {
registry.GlobalRegistry().AddCapability(&{{.InterfaceName}}{})
}
`))
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.