boat
C++23 geospatial library
Loading...
Searching...
No Matches
boat::db Namespace Reference

Classes

struct  kind< T >
struct  catalog
struct  command
struct  source
struct  layer
struct  column
struct  index_key
struct  table
struct  bbox
struct  order_key
struct  page
struct  band
struct  raster
struct  id
class  query
struct  rowset
struct  variant
struct  kind
struct  kind< std::string >
struct  kind< blob >

Typedefs

using null = std::monostate
using variant_base = std::variant<null, int64_t, double, std::string, blob>

Functions

void read (variant const &in, geometry::ogc auto &out)
 Reads WKB from a blob; NULL resets the geometry.
void write (variant &out, geometry::ogc auto const &in)
 Stores WKB in a blob.
template<class T>
requires requires { read(in, out.emplace()); }
void read (variant const &in, std::optional< T > &out)
 NULL becomes std::nullopt.
template<class T>
requires requires { write(out, *in); }
void write (variant &out, std::optional< T > const &in)
 std::nullopt becomes NULL.
template<class Clock, class Duration>
void read (variant const &in, std::chrono::time_point< Clock, Duration > &out)
template<class Clock, class Duration>
void write (variant &out, std::chrono::time_point< Clock, Duration > in)
 Uses microsecond precision without a time-zone suffix.
auto & operator<< (ostream auto &out, rowset const &in)
auto & operator<< (ostream auto &out, table const &in)
auto & operator<< (ostream auto &out, raster const &in)
bool has_coord_sys (column const &col)
auto indices (table const &tbl)
geometry::matrix affine (raster const &r)
 Maps pixels to spatial coordinates.
template<class T>
table to_table ()
rowset to_rowset (std::ranges::input_range auto &&r)
 Uses aggregate field names as column names.
template<std::convertible_to< variant_base > T>
void read (variant const &in, T &out)
void write (variant &out, std::convertible_to< variant_base > auto const &in)
template<class T>
requires requires(T val) { read(var, val); }
T get (variant const &var)
variant to_variant (auto const &val)

Variables

template<class T>
constexpr auto view
 Columns must match the field count and order; scalars need one column.

Typedef Documentation

◆ null

using boat::db::null = std::monostate

◆ variant_base

using boat::db::variant_base = std::variant<null, int64_t, double, std::string, blob>

Function Documentation

◆ affine()

geometry::matrix boat::db::affine ( raster const & r)
inline

Maps pixels to spatial coordinates.

◆ get()

template<class T>
requires requires(T val) { read(var, val); }
T boat::db::get ( variant const & var)

◆ has_coord_sys()

bool boat::db::has_coord_sys ( column const & col)
inline

◆ indices()

auto boat::db::indices ( table const & tbl)
inline

◆ operator<<() [1/3]

auto & boat::db::operator<< ( ostream auto & out,
raster const & in )

◆ operator<<() [2/3]

auto & boat::db::operator<< ( ostream auto & out,
rowset const & in )

◆ operator<<() [3/3]

auto & boat::db::operator<< ( ostream auto & out,
table const & in )

◆ read() [1/4]

void boat::db::read ( variant const & in,
geometry::ogc auto & out )

Reads WKB from a blob; NULL resets the geometry.

◆ read() [2/4]

template<class Clock, class Duration>
void boat::db::read ( variant const & in,
std::chrono::time_point< Clock, Duration > & out )

Parses "YYYY-MM-DD HH:MM:SS[.ffffff]" without time-zone conversion. NULL becomes the clock epoch; excess fractional digits are ignored.

◆ read() [3/4]

template<class T>
requires requires { read(in, out.emplace()); }
void boat::db::read ( variant const & in,
std::optional< T > & out )

NULL becomes std::nullopt.

◆ read() [4/4]

template<std::convertible_to< variant_base > T>
void boat::db::read ( variant const & in,
T & out )

NULL becomes T{}.

Exceptions
std::bad_variant_accessif the stored type is incompatible.

◆ to_rowset()

rowset boat::db::to_rowset ( std::ranges::input_range auto && r)

Uses aggregate field names as column names.

◆ to_table()

template<class T>
table boat::db::to_table ( )

◆ to_variant()

variant boat::db::to_variant ( auto const & val)

◆ write() [1/4]

void boat::db::write ( variant & out,
geometry::ogc auto const & in )

Stores WKB in a blob.

◆ write() [2/4]

template<class Clock, class Duration>
void boat::db::write ( variant & out,
std::chrono::time_point< Clock, Duration > in )

Uses microsecond precision without a time-zone suffix.

◆ write() [3/4]

void boat::db::write ( variant & out,
std::convertible_to< variant_base > auto const & in )

◆ write() [4/4]

template<class T>
requires requires { write(out, *in); }
void boat::db::write ( variant & out,
std::optional< T > const & in )

std::nullopt becomes NULL.

Variable Documentation

◆ view

template<class T>
auto boat::db::view
constexpr
Initial value:
= std::views::transform([](range_of<variant> auto&& r) {
T ret;
auto it = std::ranges::begin(r);
auto vis = [&](auto& v) {
check(it != std::ranges::end(r), "out of fields");
read(*it++, v);
};
if constexpr (requires { read(*it, ret); })
vis(ret);
else
boost::pfr::for_each_field(ret, vis);
check(it == std::ranges::end(r), "out of fields");
return ret;
})
void read(variant const &in, geometry::ogc auto &out)
Reads WKB from a blob; NULL resets the geometry.
Definition geometry.hpp:12

Columns must match the field count and order; scalars need one column.