GetBool gets DBool or an error (also treats NULL as false, not an error).
(d Datum)
| 408 | |
| 409 | // GetBool gets DBool or an error (also treats NULL as false, not an error). |
| 410 | func GetBool(d Datum) (DBool, error) { |
| 411 | if v, ok := d.(*DBool); ok { |
| 412 | return *v, nil |
| 413 | } |
| 414 | if d == DNull { |
| 415 | return DBool(false), nil |
| 416 | } |
| 417 | return false, errors.AssertionFailedf("cannot convert %s to type %s", d.ResolvedType().SQLStringForError(), types.Bool) |
| 418 | } |
| 419 | |
| 420 | // ResolvedType implements the TypedExpr interface. |
| 421 | func (*DBool) ResolvedType() *types.T { |
nothing calls this directly
no test coverage detected
searching dependent graphs…