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

Remove the fmt.Fprint fallback when encoding command arguments #30

Closed
garyburd opened this issue Jun 17, 2013 · 6 comments
Closed

Remove the fmt.Fprint fallback when encoding command arguments #30

garyburd opened this issue Jun 17, 2013 · 6 comments

Comments

@garyburd
Copy link
Member

Change argument encoding to encode simple values using strconv and return an error for other values.

  • The fmt.Fprint encoding is not useful for structured values like []int32.
  • There is more than one useful encoding for structured values (json, msgpack, gob). The application should pick which encoding is used.
@garyburd
Copy link
Member Author

  • Consider using TextMarshaler (http://golang.org/s/go12encoding) as a fallback for structured values.
  • Encoding and decoding values is something that every application needs to do. Consider updating Scan and Args to help with structured values.

@the42
Copy link

the42 commented Jul 25, 2013

Unable to provide help, this would be a very helpful change. Switching from HMSET / AddFlat to manually JSON encode nested structs now.

@albrow
Copy link

albrow commented Aug 27, 2013

I support using json as a fallback.

  • Json enconding/decoding has been a feature of go for a long time, requires no extra dependencies, and is available for use now.
  • It works for nearly anything you could throw at it.
  • Lua scripting in redis can make use of the cjson library to parse json, whereas other formats would be unreadable on the lua scripting side. (EDIT: there's a msgpack library included as well.)
  • Json is a human readable format, making it easier to debug.

@garyburd would you consider accepting a pull request if I put something together?

@garyburd
Copy link
Member Author

@stephenalexbrowne I want to support arbitrary encoding formats with whatever mechanism is defined. JSON has a number of benefits, but the encoding is not ideal for all uses. Also, I want a corresponding feature for decoding values.

Let's discuss at https://groups.google.com/forum/#!forum/redigo

@albrow
Copy link

albrow commented Aug 27, 2013

@garyburd
Copy link
Member Author

garyburd commented Nov 4, 2013

New related issue: #46

@garyburd garyburd closed this as completed Nov 4, 2013
@gomodule gomodule locked and limited conversation to collaborators Dec 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants