Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Remove ValueAsString? #21

Closed
rakyll opened this issue Oct 3, 2017 · 3 comments
Closed

Remove ValueAsString? #21

rakyll opened this issue Oct 3, 2017 · 3 comments
Assignees
Labels
Milestone

Comments

@rakyll
Copy link
Contributor

rakyll commented Oct 3, 2017

func (k *KeyString) ValueAsString(b []byte) string

is not accessing any of the Key fields and is doing a redundant job of casting a []byte into string.

/cc @acetechnologist

@rakyll rakyll added the tags label Oct 3, 2017
@rakyll rakyll self-assigned this Oct 3, 2017
@rakyll
Copy link
Contributor Author

rakyll commented Oct 4, 2017

I understand now that this is there if the Key implementation want to provide a custom serializer for the value.

@acetechnologist
Copy link
Contributor

Yes. For example when KeyInt64 and KeyBool are added they will need to have their own: ValueAsString(b []byte) string.
Which is not just a casting. For example:
For KeyInt64 []byte { 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1} could return "3"
For KeyBool []byte { 0 } could return "False"
For KeyBool []byte { 0 } could return "True"

@rakyll
Copy link
Contributor Author

rakyll commented Oct 4, 2017

I will add more godoc to explain what it does instead.

rakyll pushed a commit that referenced this issue Oct 19, 2017
- Rename TagSet to Tag.
- Remove ErrKeyNotFound but rather return a bool from
(*TagSet).StringValue. There are no other errors that can
be returned other than existence/nonexistence.

Fixes #47.
Fixes #21.
@rakyll rakyll added this to the R1 milestone Dec 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants