mirror of
https://github.com/getml/sqlgen.git
synced 2026-01-05 00:49:58 -06:00
30 lines
689 B
C++
30 lines
689 B
C++
#ifndef SQLGEN_ITERATORBASE_HPP_
|
|
#define SQLGEN_ITERATORBASE_HPP_
|
|
|
|
#include <optional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "Result.hpp"
|
|
|
|
namespace sqlgen {
|
|
|
|
/// Abstract base class for an iterator to be returned by Connection::read(...).
|
|
struct IteratorBase {
|
|
virtual ~IteratorBase() = default;
|
|
|
|
/// Whether the end of the available data has been reached.
|
|
virtual bool end() const = 0;
|
|
|
|
/// Returns the next batch of rows.
|
|
/// If _batch_size is greater than the number of rows left, returns all
|
|
/// of the rows left.
|
|
virtual Result<std::vector<std::vector<std::optional<std::string>>>> next(
|
|
const size_t _batch_size) = 0;
|
|
};
|
|
|
|
} // namespace sqlgen
|
|
|
|
#endif
|
|
|