Skip to content

Commit

Permalink
feat: ref machine in ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
phr3nzy committed May 23, 2024
1 parent 7928319 commit f6aedc1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ type MachineContext[S, T any] struct {
Services S
PreviousResult *StepResponse[S, T]
State T
Machine *Machine[S, T]
}

type MachineConfig[S, T any] struct {
Expand All @@ -33,13 +34,15 @@ func NewMachine[S, T any](
initialContext *MachineContext[S, T],
config *MachineConfig[S, T],
) *Machine[S, T] {
return &Machine[S, T]{
m := &Machine[S, T]{
Name: name,
Steps: steps,
InitialContext: initialContext,
Context: initialContext,
Config: config,
}
m.Context.Machine = m
return m
}

func (m *Machine[S, T]) AddStep(step Step[S, T]) {
Expand Down

0 comments on commit f6aedc1

Please sign in to comment.