-
Notifications
You must be signed in to change notification settings - Fork 500
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
Added NullUniqueIdentifier struct to work with GUIDs that can be null #635
base: master
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #635 +/- ##
==========================================
- Coverage 71.98% 71.97% -0.02%
==========================================
Files 24 25 +1
Lines 5469 5491 +22
==========================================
+ Hits 3937 3952 +15
- Misses 1309 1314 +5
- Partials 223 225 +2
Continue to review full report at Codecov.
|
} | ||
|
||
err := nui.UniqueIdentifier.Scan(v) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converting any possible scan error into a Null value doesn't seem right to me, error checking should be more specific
Optimize In performance by reducing allocations for common queries
The changes in denisenkom#635 changed the some of the output types of In to pointers. This takes less time but it also changed the types in the output of In in a way that I think is more aggressive than I would have preferred. I'm also not 100% convinced that using pointers to types like `int` and `string` would provide an overall performance benefit when you factor in GC. Despite that, timings did get worse: pre-change: ``` BenchmarkIn-4 3136129 376 ns/op 272 B/op 4 allocs/op BenchmarkIn1k-4 171588 6602 ns/op 19488 B/op 3 allocs/op BenchmarkIn1kInt-4 157549 7502 ns/op 19488 B/op 3 allocs/op BenchmarkIn1kString-4 155502 7604 ns/op 19488 B/op 3 allocs/op ``` post-change: ``` BenchmarkIn-4 3007132 396 ns/op 272 B/op 4 allocs/op BenchmarkIn1k-4 175978 6768 ns/op 19488 B/op 3 allocs/op BenchmarkIn1kInt-4 120422 10125 ns/op 19488 B/op 3 allocs/op BenchmarkIn1kString-4 108813 10755 ns/op 19488 B/op 3 allocs/op ``` I'd prefer to keep `[]int{..}` producing ints instead of `*int` even if it means losing ~25% of perf on these special cased functions.
I'm working with the excecution of stored procedures, if the execution generates an transaction the answer will include a GUID, if it do not generates an transaction it does not mean there is an error, so I can or can't receive an unique identifier, thats why I think would be nice to include this data type in this proyect.