mirror of https://github.com/dapr/go-sdk.git
Merge ca6e00ad25
into a3df75f17b
This commit is contained in:
commit
4023d12a8f
2
go.mod
2
go.mod
|
@ -4,7 +4,7 @@ go 1.23.6
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/dapr/dapr v1.15.0-rc.17
|
github.com/dapr/dapr v1.15.0-rc.17
|
||||||
github.com/dapr/durabletask-go v0.6.3
|
github.com/dapr/durabletask-go v0.7.1
|
||||||
github.com/go-chi/chi/v5 v5.1.0
|
github.com/go-chi/chi/v5 v5.1.0
|
||||||
github.com/golang/mock v1.6.0
|
github.com/golang/mock v1.6.0
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -2,8 +2,8 @@ github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK3
|
||||||
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
||||||
github.com/dapr/dapr v1.15.0-rc.17 h1:bR0rd4FH81IteuOHTWVNyl58ZuQTDp3DYaTtXnpZ6JA=
|
github.com/dapr/dapr v1.15.0-rc.17 h1:bR0rd4FH81IteuOHTWVNyl58ZuQTDp3DYaTtXnpZ6JA=
|
||||||
github.com/dapr/dapr v1.15.0-rc.17/go.mod h1:SD0AXom2XpX7pr8eYlbJ+gHfNREsflsrzCR19AZJ7/Q=
|
github.com/dapr/dapr v1.15.0-rc.17/go.mod h1:SD0AXom2XpX7pr8eYlbJ+gHfNREsflsrzCR19AZJ7/Q=
|
||||||
github.com/dapr/durabletask-go v0.6.3 h1:WHhSAw1YL4xneK3Jo5nGfmMaJxfFodIIF5q1rpkDDfs=
|
github.com/dapr/durabletask-go v0.7.1 h1:FiTlVVFh0UnYdqoFeUtgT7BszkGMA0eL0qjgfB7YOr0=
|
||||||
github.com/dapr/durabletask-go v0.6.3/go.mod h1:nTZ5fCbJLnZbVdi6Z2YxdDF1OgQZL3LroogGuetrwuA=
|
github.com/dapr/durabletask-go v0.7.1/go.mod h1:JhMyDybRUFmmgieGxCPeg9e2cWwtx4LwNXjD+LBtKYk=
|
||||||
github.com/dapr/kit v0.15.0 h1:446jrEOQV/0rt6FwmoKrifP3vav5+Uh/u38DqU8q+JM=
|
github.com/dapr/kit v0.15.0 h1:446jrEOQV/0rt6FwmoKrifP3vav5+Uh/u38DqU8q+JM=
|
||||||
github.com/dapr/kit v0.15.0/go.mod h1:HwFsBKEbcyLanWlDZE7u/jnaDCD/tU+n3pkFNUctQNw=
|
github.com/dapr/kit v0.15.0/go.mod h1:HwFsBKEbcyLanWlDZE7u/jnaDCD/tU+n3pkFNUctQNw=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
|
|
@ -94,7 +94,16 @@ func (wfc *WorkflowContext) CallChildWorkflow(workflow interface{}, opts ...call
|
||||||
// The value passed to the Await method must be a pointer or can be nil to ignore the returned value.
|
// The value passed to the Await method must be a pointer or can be nil to ignore the returned value.
|
||||||
// Alternatively, tasks can be awaited using the task.WhenAll or task.WhenAny methods, allowing the workflow
|
// Alternatively, tasks can be awaited using the task.WhenAll or task.WhenAny methods, allowing the workflow
|
||||||
// to block and wait for multiple tasks at the same time.
|
// to block and wait for multiple tasks at the same time.
|
||||||
func (wfc *WorkflowContext) CreateTimer(duration time.Duration) task.Task {
|
func (wfc *WorkflowContext) CreateTimer(duration time.Duration, opts ...createTimerOption) task.Task {
|
||||||
|
options := new(createTimerOptions)
|
||||||
|
for _, configure := range opts {
|
||||||
|
if err := configure(options); err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if options.name != nil {
|
||||||
|
return wfc.orchestrationContext.CreateTimer(duration, task.WithTimerName(*options.name))
|
||||||
|
}
|
||||||
return wfc.orchestrationContext.CreateTimer(duration)
|
return wfc.orchestrationContext.CreateTimer(duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,3 +148,16 @@ func NewTaskSlice(length int) []task.Task {
|
||||||
taskSlice := make([]task.Task, length)
|
taskSlice := make([]task.Task, length)
|
||||||
return taskSlice
|
return taskSlice
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type createTimerOption func(*createTimerOptions) error
|
||||||
|
|
||||||
|
type createTimerOptions struct {
|
||||||
|
name *string
|
||||||
|
}
|
||||||
|
|
||||||
|
func WithTimerName(name string) createTimerOption {
|
||||||
|
return func(opt *createTimerOptions) error {
|
||||||
|
opt.name = &name
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue