Skip to content

feat(proto): support scanning uuid.UUID in Scan() #3425

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LinYuan201712
Copy link

What this PR does

Adds support for scanning Redis string/bytes values into uuid.UUID via the proto.Scan() function.

Why

Currently, scanning into *uuid.UUID fails even if the Redis string is a valid UUID. This PR enhances proto.Scan() to handle *uuid.UUID by parsing string/[]byte via uuid.Parse.

How

  • Extended the type switch in proto.Scan to detect *uuid.UUID
  • Uses util.BytesToString to convert input to string
  • Uses uuid.Parse to validate and assign
  • Added unit test: TestScanUUIDFromRedis

Related Issue

Fixes #3139 (or your own issue link)

@htemelski-redis
Copy link
Contributor

Hello @LinYuan201712
Thanks for opening the PR, it seems that you forgot to include the go.mod and go.sum files

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.

Can't get UUID with Scan()
2 participants