MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / asInt

Function asInt

cmd/cql-proxy/resolver/resolver.go:479–517  ·  view source on GitHub ↗
(v interface{})

Source from the content-addressed store, hash-verified

477}
478
479func asInt(v interface{}) int64 {
480 switch d := v.(type) {
481 case bool:
482 if d {
483 return 1
484 }
485
486 return 0
487 case int:
488 return int64(d)
489 case int8:
490 return int64(d)
491 case int16:
492 return int64(d)
493 case int32:
494 return int64(d)
495 case int64:
496 return d
497 case uint:
498 return int64(d)
499 case uint8:
500 return int64(d)
501 case uint16:
502 return int64(d)
503 case uint32:
504 return int64(d)
505 case uint64:
506 return int64(d)
507 case float32:
508 return int64(d)
509 case float64:
510 return int64(d)
511 case string:
512 i, _ := strconv.ParseInt(d, 10, 64)
513 return i
514 }
515
516 return 0
517}
518
519func asBool(v interface{}) bool {
520 switch d := v.(type) {

Callers 1

ResolveOrderByFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected