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

fix: let Set to support custom type #3105

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

oldme-git
Copy link

Dear review:
Thanks for your reviewing

Set and other Set function can't use custom type. e.g.

func TestI(t *testing.T) {
  type myInt int
  var i myInt = 123

  err := rdb.Set(ctx, "key", i, 0).Err()
  if err != nil {
    t.Fatal(err)
  }
}

result: redis: can't marshal * (implement encoding.BinaryMarshaler)

It should add rereflect assertion after type assertion. I did it for performance and other types of considerations. for examole: time.Time or encoding.BinaryMarshaler

Have a good day!

fixed: #3104

@ndyakov
Copy link
Collaborator

ndyakov commented Feb 6, 2025

Hello @oldme-git, Would you mind adding a test case per type added in the reflect select ?

@ndyakov ndyakov self-requested a review February 6, 2025 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set and Set* don't support custom type
2 participants