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

Function encodeInt8

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

Source from the content-addressed store, hash-verified

379}
380
381func encodeInt8(v interface{}) []byte {
382 buf := make([]byte, 8)
383 var n int64
384 switch val := v.(type) {
385 case int:
386 n = int64(val)
387 case int8:
388 n = int64(val)
389 case int16:
390 n = int64(val)
391 case int32:
392 n = int64(val)
393 case int64:
394 n = val
395 case uint8:
396 n = int64(val)
397 case uint16:
398 n = int64(val)
399 case uint32:
400 n = int64(val)
401 case uint64:
402 n = int64(val)
403 case float32:
404 n = int64(val)
405 case float64:
406 n = int64(val)
407 default:
408 return nil
409 }
410 binary.BigEndian.PutUint64(buf, uint64(n))
411 return buf
412}
413
414func encodeFloat4(v interface{}) []byte {
415 buf := make([]byte, 4)

Callers 2

TestEncodeInt8Function · 0.85
encodeBinaryFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestEncodeInt8Function · 0.68