tools

package
v0.0.0-...-dbaf101 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: MIT Imports: 16 Imported by: 1

Documentation

Index

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 (c *Context) CheckPackage(pkg *types.Package)

func (*Context) IsWorker

func (c *Context) IsWorker(o types.Object) bool

func (*Context) MustCheckFolder

func (c *Context) MustCheckFolder(path string)

func (*Context) MustLoadOverseers

func (c *Context) MustLoadOverseers(path string)

func (*Context) MustRender

func (c *Context) MustRender() map[string][]byte

func (*Context) MustRenderAndWrite

func (c *Context) MustRenderAndWrite()

func (*Context) Printf

func (c *Context) Printf(format string, v ...interface{})

type Overseer

type Overseer struct {
	Name string
	Type types.Type
}

type Package

type Package struct {
	Name       string
	ID         string
	ImportPath string
	Path       string
	Workers    []*Worker
}

func NewPackage

func NewPackage() *Package

func (*Package) AddWorker

func (p *Package) AddWorker(w *Worker)

func (*Package) IsEmpty

func (p *Package) IsEmpty() bool

type Worker

type Worker struct {
	Name         string
	Type         string
	Introduction string
}

Jump to

Keyboard shortcuts

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