GetBool gets DBool or an error (also treats NULL as false, not an error).
(d Datum)
| 359 | |
| 360 | // GetBool gets DBool or an error (also treats NULL as false, not an error). |
| 361 | func GetBool(d Datum) (DBool, error) { |
| 362 | if v, ok := d.(*DBool); ok { |
| 363 | return *v, nil |
| 364 | } |
| 365 | if d == DNull { |
| 366 | return DBool(false), nil |
| 367 | } |
| 368 | return false, errors.AssertionFailedf("cannot convert %s to type %s", d.ResolvedType(), types.Bool) |
| 369 | } |
| 370 | |
| 371 | // ResolvedType implements the TypedExpr interface. |
| 372 | func (*DBool) ResolvedType() *types.T { |