mirror of
https://github.com/isar/rusqlite.git
synced 2025-10-18 20:42:26 +08:00
Upgrade to time v0.2 and put it behind a feature flag
This also removes the usage of time in the crate's top-level documentation example, as was done for the README in #625. Fix #653.
This commit is contained in:
committed by
Thom Chiovoloni
parent
464b8283b2
commit
b83d22e2b7
14
src/lib.rs
14
src/lib.rs
@@ -3,13 +3,11 @@
|
||||
//!
|
||||
//! ```rust
|
||||
//! use rusqlite::{params, Connection, Result};
|
||||
//! use time::Timespec;
|
||||
//!
|
||||
//! #[derive(Debug)]
|
||||
//! struct Person {
|
||||
//! id: i32,
|
||||
//! name: String,
|
||||
//! time_created: Timespec,
|
||||
//! data: Option<Vec<u8>>,
|
||||
//! }
|
||||
//!
|
||||
@@ -20,7 +18,6 @@
|
||||
//! "CREATE TABLE person (
|
||||
//! id INTEGER PRIMARY KEY,
|
||||
//! name TEXT NOT NULL,
|
||||
//! time_created TEXT NOT NULL,
|
||||
//! data BLOB
|
||||
//! )",
|
||||
//! params![],
|
||||
@@ -28,22 +25,19 @@
|
||||
//! let me = Person {
|
||||
//! id: 0,
|
||||
//! name: "Steven".to_string(),
|
||||
//! time_created: time::get_time(),
|
||||
//! data: None,
|
||||
//! };
|
||||
//! conn.execute(
|
||||
//! "INSERT INTO person (name, time_created, data)
|
||||
//! VALUES (?1, ?2, ?3)",
|
||||
//! params![me.name, me.time_created, me.data],
|
||||
//! "INSERT INTO person (name, data) VALUES (?1, ?2)",
|
||||
//! params![me.name, me.data],
|
||||
//! )?;
|
||||
//!
|
||||
//! let mut stmt = conn.prepare("SELECT id, name, time_created, data FROM person")?;
|
||||
//! let mut stmt = conn.prepare("SELECT id, name, data FROM person")?;
|
||||
//! let person_iter = stmt.query_map(params![], |row| {
|
||||
//! Ok(Person {
|
||||
//! id: row.get(0)?,
|
||||
//! name: row.get(1)?,
|
||||
//! time_created: row.get(2)?,
|
||||
//! data: row.get(3)?,
|
||||
//! data: row.get(2)?,
|
||||
//! })
|
||||
//! })?;
|
||||
//!
|
||||
|
Reference in New Issue
Block a user