What: add spec for array ops with []uint8 or []byte type#128
What: add spec for array ops with []uint8 or []byte type#128domodwyer merged 2 commits intoglobalsign:developmentfrom
Conversation
|
Hi @mcspring You make a really good point about the array ops and thanks for the PR (with tests!) - there's a conflict on the branch though but should be good to merge after. Dom |
|
|
||
| var ( | ||
| // spec for []uint8 or []byte encoding | ||
| arrayOps = map[string]bool{ |
There was a problem hiding this comment.
One nitpick here ( sorry! )
IIRC map[string]struct{} could be used here, and that one has an optimised lookup code when you want to only check for the presence of an element.
this would transform the map lookups to
if _, ok := arrayOps[name]; ok {
[...]
}
Which is not as clean. I'll let you make a call here. I haven't benchmarked the code, so I can't tell how much faster it is, but it is the idiomatic go way of doing things FWIW.
There was a problem hiding this comment.
I think the way will cause one more alloc, which can be avoid from previous.
Why: * mongodb aquires array for $in/$nin/$all ops How: * encode with array for spec
|
@domodwyer synced yet. |
|
Looks good to me - thanks @mcspring Dom |
Why:
How: