Created
October 1, 2018 21:36
-
-
Save berfarah/4b9407d46654c3427c106e7f6b5df479 to your computer and use it in GitHub Desktop.
Iterative Optimization on Hot Paths: Optimization 4: Preventing escape of complex data types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func makeWhere(table *Table, filter Filter) (*SimpleWhere, error) { | |
for name, value := range filter { | |
// ... | |
- l = append(l, whereElem{column: column, value: column.Descriptor.Valuer(reflect.ValueOf(value))}) | |
+ v, err := column.Descriptor.Valuer(reflect.ValueOf(value)).Value() | |
+ if err != nil { | |
+ return nil, err | |
+ } | |
+ l = append(l, whereElem{column: column, value: v}) | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment