Help us shape the future of Go! Take the 2026 Go Developer Survey

actions

package
v0.1.121 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: MIT Imports: 14 Imported by: 3

Documentation

Index

Constants

View Source
const (
	NewWorkspace = "workspace.new"
	AddModule    = "module.add"
	AddService   = "service.add"
)

Variables

This section is empty.

Functions

func As

func As[T any](t any) (*T, error)

func Load

func Load[T Action](content []byte) (*T, error)

Load function, *T must satisfy Action

func RegisterBuilder added in v0.1.20

func RegisterBuilder(typeName string, builder BuilderFunc)

func Run

func Run(ctx context.Context, action Action, space *Space) (any, error)

func SetActionTracker added in v0.0.61

func SetActionTracker(actionTracker *ActionTracker)

func Validate

func Validate(_ context.Context, input proto.Message) error

Validate action input

Types

type Action

type Action interface {
	Run(ctx context.Context, space *Space) (any, error)
	Command() string
}

func CreateAction

func CreateAction(content []byte) (Action, error)

type ActionSave

type ActionSave struct {
	Command string          `json:"command"`
	Data    json.RawMessage `json:"data"`
}

type ActionStep

type ActionStep struct {
	Step   int
	Data   *json.RawMessage `json:"data"`
	Action Action
}

type ActionTracker

type ActionTracker struct {
	Dir    string
	Replay bool
}

func NewActionTracker

func NewActionTracker(ctx context.Context, location string, group string) (*ActionTracker, error)

func (*ActionTracker) GetActions

func (tracker *ActionTracker) GetActions(_ context.Context) ([]Action, error)

func (*ActionTracker) NextStep

func (tracker *ActionTracker) NextStep() int

func (*ActionTracker) Save

func (tracker *ActionTracker) Save(action Action) error

func (*ActionTracker) WithDir added in v0.0.52

func (tracker *ActionTracker) WithDir(dir string)

type BuilderFunc added in v0.1.20

type BuilderFunc func(content []byte) (Action, error)

func Wrap

func Wrap[T Action]() BuilderFunc

Wrap function with a constraint that *T satisfies Action

type Config

type Config struct {
	Kind string `json:"kind"`
}

type Space added in v0.1.89

type Space struct {
	Workspace *resources.Workspace
	Module    *resources.Module
}

func (*Space) OnModule added in v0.1.89

func (space *Space) OnModule(module *resources.Module)

func (*Space) OnWorkspace added in v0.1.89

func (space *Space) OnWorkspace(workspace *resources.Workspace)

Jump to

Keyboard shortcuts

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