Skip to content

Add WithDataConverter helper to relevant options #63

Open
@cludden

Description

@cludden
          I see u create PR, however i continue mind and detect case:
  • use custom DataConverter for workflow

For ctx have func WithDataConverter() and this func not set filds in ChildWorkflowOptions - this struct not have field for it

Question: can we assume that DataConverter - option, and implement method WithDataConverter fot exlude using ctx func at all ?

example:

ctx = ctx.WithDataConverter(ctx, converter)
opts = examplev1.NewExampleV1WorkflowOptions().WithChildOptions(options)
examplev1.NewExampleV1(ctx, &examplev1.ExampleV1Request{}, opts)

->

if we assume that DataConverter - option:

opts = examplev1.NewExampleV1WorkflowOptions().WithChildOptions(options).WithDataConverter(conveter)
examplev1.NewExampleV1(ctx, &examplev1.ExampleV1Request{}, opts)

// in generated code:
type ExampleV1ChildOptions struct {
	opts                     *workflow.ChildWorkflowOptions
	// ...
	dataConverter            *converter.DataConverter
}

func ExampleV1Child(ctx workflow.Context, req *ExampleV1Request, options ...*ExampleV1ChildOptions) (*ExampleV1ChildRun, error) {
	opts := &workflow.ChildWorkflowOptions{}
	if len(options) > 0 && options[0].opts != nil {
		opts = options[0].opts
	}
	if opts.TaskQueue == "" {
		opts.TaskQueue = XnsTaskQueue
	}
	// ...
	ctx = workflow.WithChildOptions(ctx, *opts)
	if c := options[0].dataConverter; c != nil {
		ctx = workflow.WithDataConverter(ctx, *c)
	} 
        // ...
}

Originally posted by @SeJIya in #58 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions