Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go: XREAD. #2882

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Go: XREAD. #2882

wants to merge 8 commits into from

Conversation

Yury-Fridlyand
Copy link
Collaborator

@Yury-Fridlyand Yury-Fridlyand commented Dec 28, 2024

TODO

  • XREAD with options

Issue link

This Pull Request is linked to issue (URL): #2834

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one issue.
  • Commit message has a detailed description of what changed and why.
  • Tests are added or updated.
  • CHANGELOG.md and documentation files are updated.
  • Destination branch is correct - main or release
  • Commits will be squashed upon merging.

Signed-off-by: Yury-Fridlyand <[email protected]>
@Yury-Fridlyand Yury-Fridlyand added the go golang wrapper label Dec 28, 2024
Signed-off-by: Yury-Fridlyand <[email protected]>
@Yury-Fridlyand Yury-Fridlyand marked this pull request as ready for review January 4, 2025 02:09
@Yury-Fridlyand Yury-Fridlyand requested a review from a team as a code owner January 4, 2025 02:09
Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: Yury-Fridlyand <[email protected]>
Signed-off-by: Yury-Fridlyand <[email protected]>
Comment on lines +524 to +530
converters := mapConverter[map[string][][]string]{
mapConverter[[][]string]{
arrayConverter[[]string]{
arrayConverter[string]{},
},
},
}
Copy link
Collaborator

@umit umit Jan 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yury-Fridlyand I think that we can make the method chain here more readable as shown below.

converter := NewConverterBuilder().
        WithMapConverter[map[string][][]string]().
        WithMapConverter[[][]string]().
        WithArrayConverter[[]string]().
        WithArrayConverter[string]().
        Build()

res, err := converter.convert(data1)
if err != nil {
    return nil, err
}
  
// Pseudo ConverterBuilder
type ConverterBuilder struct {
    converter responseConverter
}

func NewConverterBuilder() *ConverterBuilder {
    return &ConverterBuilder{}
}

func (b *ConverterBuilder) WithMapConverter[T any]() *ConverterBuilder {
    b.converter = mapConverter[T]{next: b.converter}
    return b
}

func (b *ConverterBuilder) WithArrayConverter[T any]() *ConverterBuilder {
    b.converter = arrayConverter[T]{next: b.converter}
    return b
}

func (b *ConverterBuilder) Build() responseConverter {
    return b.converter
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go golang wrapper
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants