package generator

Import Path
	/tools/generator (on go.dev)

Dependency Relation
	imports 37 packages, and imported by 7 packages

Involved Source Files gen_grafana.go Package generator generates state-machine schemas and grafana dashboards. gen_starter.go lint.go schema-v3.go
Package-Level Type Names (total 8)
/* sort by: | */
func GenHandlers(pkg string, _ *Args, handlers ...Handlers) string
Group is a state group extracted from a groups struct. Name string States S func ExtractGroupsOrdered(obj any) []Group
Handlers any States S func GenHandlers(pkg string, _ *Args, handlers ...Handlers) string
LintResult is the outcome of [LintSchemaOrder]. Added lists the states which were added to the schema. Changed is true when Src differs from the input. Reordered is true when existing schema entries changed their order. Src is the linted source (equal to the input when Changed is false). func LintSchemaOrder(filename string, src []byte) (*LintResult, error)
type S = am.S ([])
Global bool Groups []string Mach *am.Machine N is the first letter of Name Name string State1 -> Rel -> State2,State3 StateTags map[string][]string States []string StatesAuto []string StatesMulti []string (*SchemaGenerator) GroupsEnter(e *am.Event) bool (*SchemaGenerator) InheritEnter(e *am.Event) bool Output renders the generated schema file using github.com/dave/jennifer. func NewSchemaGenerator(ctx context.Context, param cli.SchemaParams) (*SchemaGenerator, error)
ExportName string Groups any Schema am.Schema States am.States func GenSchemaV3(schemas []SchemaV3) string
SyncTracer is [am.Tracer] for tracing new submachines and syncing the Grafana dashboard. TracerNoOp *am.TracerNoOp TracerNoOp.Id string ( SyncTracer) HandlerEnd(transition *machine.Transition, emitter string, handler string) ( SyncTracer) HandlerStart(transition *machine.Transition, emitter string, handler string) ( SyncTracer) Inheritable() bool ( SyncTracer) MachineDispose(machID string) (*SyncTracer) MachineInit(mach am.Api) context.Context ( SyncTracer) MutationQueued(machine machine.Api, mutation *machine.Mutation) (*SyncTracer) NewSubmachine(parent, mach am.Api) ( SyncTracer) QueueEnd(machine machine.Api) ( SyncTracer) SchemaChange(machine machine.Api, old machine.Schema) (*SyncTracer) TracerId() string ( SyncTracer) TransitionEnd(transition *machine.Transition) ( SyncTracer) TransitionFinals(transition *machine.Transition) ( SyncTracer) TransitionInit(transition *machine.Transition) ( SyncTracer) TransitionStart(transition *machine.Transition) ( SyncTracer) VerifyStates(machine machine.Api) *SyncTracer : github.com/pancsta/asyncmachine-go/pkg/machine.Tracer
Package-Level Functions (total 17)
ExportedFields returns a slice of exported field names for a given struct.
ExtractGroups takes any struct and recursively extracts []string fields.
ExtractGroupsOrdered is like ExtractGroups, but preserves the struct declaration order (embedded fields first).
func GenHandlers(pkg string, _ *Args, handlers ...Handlers) string
GenSchemaV3 generates a status v1 schema from an initialized v2 schema.
GenStarterFiles generates all file contents for a starter kit project without writing them to disk. Returns a map of relative file path -> content.
GenStarterKit writes all starter files to disk.
LintSchemaOrder orders the entries of every am.Schema literal in src according to the field order of the matching {Name}StatesDef struct and adds entries for missing states. The result is gofmt-ed.
MachDashboardEnv binds a Grafana dashboard generator to the [mach], based on environment variables: - AM_GRAFANA_URL: the Grafana URL - AM_GRAFANA_TOKEN: the Grafana API token - AM_SERVICE: the service name This tracer is inherited by submachines, and this function applies only to top-level machines.
SchemaFileToParams reads the YAML schema file specified in params and converts it to StatesParams.
func WriteHandlers(schema string) error
func WriteSchemaV3(pkg string, schema string) error