MCPcopy Create free account
hub / github.com/PostHog/duckgres / init

Function init

server/types_test.go:21–31  ·  view source on GitHub ↗

In the all-in-one binary, duckdbservice's init() registers a normalizer that converts duckdb.Interval / duckdb.Decimal to arrowmap.IntervalValue / arrowmap.DecimalValue before encode*Funcs dispatch. We can't import duckdbservice from a server test (import cycle), so register the same hook here so Te

()

Source from the content-addressed store, hash-verified

19// duckdbservice from a server test (import cycle), so register the same
20// hook here so TestEncodeNumeric / TestEncodeInterval keep working.
21func init() {
22 RegisterValueNormalizer(func(v any) any {
23 switch x := v.(type) {
24 case duckdb.Interval:
25 return arrowmap.IntervalValue{Months: x.Months, Days: x.Days, Micros: x.Micros}
26 case duckdb.Decimal:
27 return arrowmap.DecimalValue{Value: x.Value, Scale: int(x.Scale)}
28 }
29 return v
30 })
31}
32
33func TestMapDuckDBType(t *testing.T) {
34 tests := []struct {

Callers

nothing calls this directly

Calls 1

RegisterValueNormalizerFunction · 0.85

Tested by

no test coverage detected