mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-03-15 06:20:50 +00:00
Simplify in-memory examples
This commit is contained in:
parent
e1be1eb3fd
commit
dfe55f4953
@ -9,7 +9,7 @@ The package provides an interface to [SQLite][1].
|
||||
```rust
|
||||
use std::path::Path;
|
||||
|
||||
let database = sqlite::open(&Path::new(":memory:")).unwrap();
|
||||
let database = sqlite::open(":memory:").unwrap();
|
||||
|
||||
database.execute(r#"
|
||||
CREATE TABLE `users` (id INTEGER, name VARCHAR(255));
|
||||
|
@ -5,7 +5,7 @@
|
||||
//! ```
|
||||
//! use std::path::Path;
|
||||
//!
|
||||
//! let database = sqlite::open(&Path::new(":memory:")).unwrap();
|
||||
//! let database = sqlite::open(":memory:").unwrap();
|
||||
//!
|
||||
//! database.execute(r#"
|
||||
//! CREATE TABLE `users` (id INTEGER, name VARCHAR(255));
|
||||
@ -99,7 +99,7 @@ pub type Result<T> = ::std::result::Result<T, Error>;
|
||||
|
||||
/// Open a connection to a new or existing database.
|
||||
#[inline]
|
||||
pub fn open<'l, P: std::convert::AsRef<std::path::Path>>(path: P) -> Result<Database<'l>> {
|
||||
pub fn open<'l, P: AsRef<std::path::Path>>(path: P) -> Result<Database<'l>> {
|
||||
Database::open(path)
|
||||
}
|
||||
|
||||
|
@ -9,13 +9,12 @@ macro_rules! ok(
|
||||
fn workflow() {
|
||||
use sqlite::Binding::*;
|
||||
use sqlite::State;
|
||||
use std::path::Path;
|
||||
|
||||
macro_rules! pair(
|
||||
($one:expr, $two:expr) => (($one, Some($two)));
|
||||
);
|
||||
|
||||
let database = ok!(sqlite::open(&Path::new(":memory:")));
|
||||
let database = ok!(sqlite::open(":memory:"));
|
||||
|
||||
let sql = r#"CREATE TABLE `users` (id INTEGER, name VARCHAR(255), age REAL);"#;
|
||||
ok!(database.execute(sql));
|
||||
|
Loading…
x
Reference in New Issue
Block a user