(v interface{})
| 433 | } |
| 434 | |
| 435 | func encodeFloat8(v interface{}) []byte { |
| 436 | buf := make([]byte, 8) |
| 437 | var f float64 |
| 438 | switch val := v.(type) { |
| 439 | case float64: |
| 440 | f = val |
| 441 | case float32: |
| 442 | f = float64(val) |
| 443 | case int: |
| 444 | f = float64(val) |
| 445 | case int32: |
| 446 | f = float64(val) |
| 447 | case int64: |
| 448 | f = float64(val) |
| 449 | default: |
| 450 | return nil |
| 451 | } |
| 452 | binary.BigEndian.PutUint64(buf, math.Float64bits(f)) |
| 453 | return buf |
| 454 | } |
| 455 | |
| 456 | // PostgreSQL epoch is 2000-01-01, Unix epoch is 1970-01-01 |
| 457 | // Difference in days: 10957 |
no outgoing calls