Struct polodb_core::db::Database[][src]

pub struct Database { /* fields omitted */ }
Expand description

API wrapper for Rust-level

Use open API to open a database. A main database file will be generated in the path user provided.

When you own an instance of a Database, the instance holds a file descriptor of the database file. When the Database instance is dropped, the handle of the file will be released.

Collection

A Collection is a dataset of a kind of data. You can use create_collection to create a data collection. To obtain an exist collection, use collection,

Transaction

You an manually start a transaction by start_transaction method. If you don’t start it manually, a transaction will be automatically started in your every operation.

Example

use polodb_core::Database;

let mut db = Database::open_file("/tmp/test-polo.db").unwrap();
let test_collection = db.collection("test").unwrap();

Implementations

👎 Deprecated
👎 Deprecated

Return the version of package version in string. Defined in Cargo.toml.

Return an exist collection. If the collection is not exists, a new collection will be created.

Manually start a transaction. There are three types of transaction.

  • None: Auto transaction
  • Some(Transaction::Write): Write transaction
  • Some(Transaction::Read): Read transaction

When you pass None to type parameter. The PoloDB will go into auto mode. The PoloDB will go into read mode firstly, once the users execute write operations(insert/update/delete), the DB will turn into write mode.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.