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

Set multiple field/value pairs for HSET #629

Closed
ash2k opened this issue Sep 4, 2024 · 2 comments
Closed

Set multiple field/value pairs for HSET #629

ash2k opened this issue Sep 4, 2024 · 2 comments

Comments

@ash2k
Copy link
Contributor

ash2k commented Sep 4, 2024

I have code that prepares field+value pairs (as a slice of structs) in advance and then I add them to HSET like this:

hsetCmd := b.client.B().Hset().Key(redisKey).FieldValue()
for _, kv := range kvs2fvs {
	hsetCmd.FieldValue(kv.field, kv.value)
}

FieldValue() just does an append. Would be nice to append the whole slice of field-values in one go. I need to reuse that slice for multiple hash keys, so I cannot just call FieldValue() as I construct pairs.

@rueian
Copy link
Collaborator

rueian commented Sep 4, 2024

Hi @ash2k,

We will have FieldValueIter in the next version
#625

@ash2k
Copy link
Contributor Author

ash2k commented Sep 4, 2024

Perfect! Thank you!

@ash2k ash2k closed this as completed Sep 4, 2024
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

No branches or pull requests

2 participants