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

Function encodeBool

server/types.go:305–319  ·  view source on GitHub ↗
(v interface{})

Source from the content-addressed store, hash-verified

303}
304
305func encodeBool(v interface{}) []byte {
306 var b bool
307 switch val := v.(type) {
308 case bool:
309 b = val
310 case int, int8, int16, int32, int64:
311 b = val != 0
312 default:
313 return []byte{0}
314 }
315 if b {
316 return []byte{1}
317 }
318 return []byte{0}
319}
320
321func encodeInt2(v interface{}) []byte {
322 buf := make([]byte, 2)

Callers 2

TestEncodeBoolFunction · 0.85
encodeBinaryFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestEncodeBoolFunction · 0.68