Documentation ¶
Index ¶
- Variables
- type Context
- func (c *Context) CheckPackage(pkg *types.Package)
- func (c *Context) IsWorker(o types.Object) bool
- func (c *Context) MustCheckFolder(path string)
- func (c *Context) MustLoadOverseers(path string)
- func (c *Context) MustRender() map[string][]byte
- func (c *Context) MustRenderAndWrite()
- func (c *Context) Printf(format string, v ...interface{})
- type Overseer
- type Package
- type Worker
Constants ¶
This section is empty.
Variables ¶
View Source
var Template = template.Must(template.New("main").Parse(`package {{.Name}}
//Auto generated code for hiring workers.
//DO NOT EDIT THIS FILE.
import worker "github.com/herb-go/worker"
func init() {
{{- $id := .ID}}
{{- range $key, $value := .Workers }}
//Worker "{{$id}}.{{$value.Name}}"
{{- if not $value.Introduction }}
//You can add Introduction by add comment in form WORKER({{$value.Name}}):Introduction
{{- end}}
worker.Hire("{{$id}}.{{$value.Name}}", &{{$value.Name}}){{- if $value.Introduction }}.
WithIntroduction({{$value.Introduction}})
{{- end}}
{{ end }}
}`))
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct { Ignored map[string]bool Writer io.Writer Overseers map[string]*Overseer OverseersPath string WorkerSuff string Root string Checked map[string]bool Result []*Package Filename string FileMode os.FileMode Marker string Assignable bool GomodFolder string Importer types.Importer // contains filtered or unexported fields }
func NewContext ¶
func NewContext() *Context
func (*Context) CheckPackage ¶
func (*Context) MustCheckFolder ¶
func (*Context) MustLoadOverseers ¶
func (*Context) MustRender ¶
func (*Context) MustRenderAndWrite ¶
func (c *Context) MustRenderAndWrite()
type Package ¶
func NewPackage ¶
func NewPackage() *Package
Click to show internal directories.
Click to hide internal directories.