essential_node

Function db

source
pub fn db(conf: &Config) -> Result<ConnectionPool, ConnPoolNewError>
Expand description

Create a new ConnectionPool from the given configuration.

Upon construction, the node’s database tables are created if they have not already been created.

## Example

let conf = Config::default();
let db = essential_node::db(&conf).unwrap();
for block in db.list_blocks(0..100).await.unwrap() {
    println!("Block: {block:?}");
}