ResultMapper defined methods for a result mapper.
| 446 | |
| 447 | // ResultMapper defined methods for a result mapper. |
| 448 | type ResultMapper interface { |
| 449 | // All dumps all the results into the given slice, All() expects a pointer to |
| 450 | // slice of maps or structs. |
| 451 | // |
| 452 | // The behaviour of One() extends to each one of the results. |
| 453 | All(destSlice interface{}) error |
| 454 | |
| 455 | // One maps the row that is in the current query cursor into the |
| 456 | // given interface, which can be a pointer to either a map or a |
| 457 | // struct. |
| 458 | // |
| 459 | // If dest is a pointer to map, each one of the columns will create a new map |
| 460 | // key and the values of the result will be set as values for the keys. |
| 461 | // |
| 462 | // Depending on the type of map key and value, the results columns and values |
| 463 | // may need to be transformed. |
| 464 | // |
| 465 | // If dest if a pointer to struct, each one of the fields will be tested for |
| 466 | // a `db` tag which defines the column mapping. The value of the result will |
| 467 | // be set as the value of the field. |
| 468 | One(dest interface{}) error |
| 469 | } |
| 470 | |
| 471 | // BatchInserter provides an interface to do massive insertions in batches. |
| 472 | type BatchInserter interface { |