Examples

Page 26 of 50

Browse code examples

sqlSnippet

Merge Join Plan Ordering

Feed a Merge Join with pre-sorted inputs: when both sides have matching index order the planner merges streams in one pass without a hash table.

goSnippet

Exact Ratios With big.Rat

Represent rates as big.Rat rational numbers so one-third stays exact in division, comparison, and re-float, instead of drifting through float64.

goSnippet

Defer In Loops Delays Cleanup

See why defer inside a loop holds every resource until the function returns, and how extracting the iteration body closes each file on schedule.

goSnippet

Select Files With Glob Patterns

Match file names against shell-style patterns with filepath.Glob and fs.Glob, getting sorted results and an empty slice rather than an error on no match.

goSnippet

Float NaN And Inf Guards

Sqrt of negatives yields NaN that fails every comparison, overflow yields Inf; IsNaN and IsInf guards keep NaN out of aggregated sums before it spreads.