docudb  1.0
Loading...
Searching...
No Matches
docudb::database Struct Reference

Represents the database. More...

#include <docudb.hpp>

Public Member Functions

 database ()=default
 Constructs an empty database object.
 
 database (database const &)=delete
 
databaseoperator= (database const &)=delete
 
 database (database &&)
 
databaseoperator= (database &&)
 
 database (std::string_view connection_string)
 Constructs a new database object.
 
 database (std::string_view connection_string, open_mode mode, threading_mode thread_mode)
 Constructs a new database object.
 
 ~database ()
 Destroys the database object.
 
db_collection collection (std::string_view name) const
 Gets a collection by name.
 
std::vector< db_collectioncollections () const
 Gets all collections.
 
void load_extensions () const
 Load docudb's sqlite3 extensions (e.g. regexp)
 
void backup_to (database &dest, std::function< void(int, int)> progress=[](int, int){}) const
 Backup the current database into the destination database.
 
std::string filename_database () const noexcept
 Returns the database file name.
 
std::string filename_journal () const noexcept
 Returns the database journal file name.
 
std::string filename_wal () const noexcept
 Returns the database write-ahead log file name.
 

Detailed Description

Represents the database.

Definition at line 867 of file docudb.hpp.

Constructor & Destructor Documentation

◆ database() [1/5]

docudb::database::database ( )
default

Constructs an empty database object.

◆ database() [2/5]

docudb::database::database ( database const & )
delete

◆ database() [3/5]

docudb::database::database ( database && )

◆ database() [4/5]

docudb::database::database ( std::string_view connection_string)
explicit

Constructs a new database object.

Parameters
connection_stringA valid connection string to the database (e.g. the database file path or :memory:).

◆ database() [5/5]

docudb::database::database ( std::string_view connection_string,
open_mode mode,
threading_mode thread_mode )
explicit

Constructs a new database object.

Parameters
connection_stringA valid connection string to the database (e.g. the database file path or :memory:).
modeThe mode for opening the database file.
thread_modeThe threading model for the connection.

◆ ~database()

docudb::database::~database ( )

Destroys the database object.

Member Function Documentation

◆ backup_to()

void docudb::database::backup_to ( database & dest,
std::function< void(int, int)> progress = [](int, int){} ) const

Backup the current database into the destination database.

Parameters
nameThe destination database.
progressProgress callback void progress(int remaining, int total) { ... }

◆ collection()

db_collection docudb::database::collection ( std::string_view name) const

Gets a collection by name.

Parameters
nameThe name of the collection.
Returns
db_collection The collection object.

◆ collections()

std::vector< db_collection > docudb::database::collections ( ) const

Gets all collections.

Returns
std::vector<db_collection> The collection list.

◆ filename_database()

std::string docudb::database::filename_database ( ) const
noexcept

Returns the database file name.

◆ filename_journal()

std::string docudb::database::filename_journal ( ) const
noexcept

Returns the database journal file name.

◆ filename_wal()

std::string docudb::database::filename_wal ( ) const
noexcept

Returns the database write-ahead log file name.

◆ load_extensions()

void docudb::database::load_extensions ( ) const

Load docudb's sqlite3 extensions (e.g. regexp)

◆ operator=() [1/2]

database & docudb::database::operator= ( database && )

◆ operator=() [2/2]

database & docudb::database::operator= ( database const & )
delete

The documentation for this struct was generated from the following file: