Purge block-doc comments
This commit is contained in:
parent
15a776dd56
commit
29e97749bf
110
src/lib/lib.rs
110
src/lib/lib.rs
@ -1,59 +1,57 @@
|
|||||||
/*!
|
//! Rust-Postgres is a pure-Rust frontend for the popular PostgreSQL database. It
|
||||||
Rust-Postgres is a pure-Rust frontend for the popular PostgreSQL database. It
|
//! exposes a high level interface in the vein of JDBC or Go's `database/sql`
|
||||||
exposes a high level interface in the vein of JDBC or Go's `database/sql`
|
//! package.
|
||||||
package.
|
//!
|
||||||
|
//! ```rust,no_run
|
||||||
```rust,no_run
|
//! extern crate postgres;
|
||||||
extern crate postgres;
|
//! extern crate time;
|
||||||
extern crate time;
|
//!
|
||||||
|
//! use time::Timespec;
|
||||||
use time::Timespec;
|
//!
|
||||||
|
//! use postgres::{PostgresConnection, NoSsl};
|
||||||
use postgres::{PostgresConnection, NoSsl};
|
//! use postgres::types::ToSql;
|
||||||
use postgres::types::ToSql;
|
//!
|
||||||
|
//! struct Person {
|
||||||
struct Person {
|
//! id: i32,
|
||||||
id: i32,
|
//! name: String,
|
||||||
name: String,
|
//! time_created: Timespec,
|
||||||
time_created: Timespec,
|
//! data: Option<Vec<u8>>
|
||||||
data: Option<Vec<u8>>
|
//! }
|
||||||
}
|
//!
|
||||||
|
//! fn main() {
|
||||||
fn main() {
|
//! let conn = PostgresConnection::connect("postgresql://postgres@localhost",
|
||||||
let conn = PostgresConnection::connect("postgresql://postgres@localhost",
|
//! &NoSsl).unwrap();
|
||||||
&NoSsl).unwrap();
|
//!
|
||||||
|
//! conn.execute("CREATE TABLE person (
|
||||||
conn.execute("CREATE TABLE person (
|
//! id SERIAL PRIMARY KEY,
|
||||||
id SERIAL PRIMARY KEY,
|
//! name VARCHAR NOT NULL,
|
||||||
name VARCHAR NOT NULL,
|
//! time_created TIMESTAMP NOT NULL,
|
||||||
time_created TIMESTAMP NOT NULL,
|
//! data BYTEA
|
||||||
data BYTEA
|
//! )", []).unwrap();
|
||||||
)", []).unwrap();
|
//! let me = Person {
|
||||||
let me = Person {
|
//! id: 0,
|
||||||
id: 0,
|
//! name: "Steven".to_str(),
|
||||||
name: "Steven".to_str(),
|
//! time_created: time::get_time(),
|
||||||
time_created: time::get_time(),
|
//! data: None
|
||||||
data: None
|
//! };
|
||||||
};
|
//! conn.execute("INSERT INTO person (name, time_created, data)
|
||||||
conn.execute("INSERT INTO person (name, time_created, data)
|
//! VALUES ($1, $2, $3)",
|
||||||
VALUES ($1, $2, $3)",
|
//! [&me.name as &ToSql, &me.time_created as &ToSql,
|
||||||
[&me.name as &ToSql, &me.time_created as &ToSql,
|
//! &me.data as &ToSql]).unwrap();
|
||||||
&me.data as &ToSql]).unwrap();
|
//!
|
||||||
|
//! let stmt = conn.prepare("SELECT id, name, time_created, data FROM person")
|
||||||
let stmt = conn.prepare("SELECT id, name, time_created, data FROM person")
|
//! .unwrap();
|
||||||
.unwrap();
|
//! for row in stmt.query([]).unwrap() {
|
||||||
for row in stmt.query([]).unwrap() {
|
//! let person = Person {
|
||||||
let person = Person {
|
//! id: row[0u],
|
||||||
id: row[0u],
|
//! name: row[1u],
|
||||||
name: row[1u],
|
//! time_created: row[2u],
|
||||||
time_created: row[2u],
|
//! data: row[3u]
|
||||||
data: row[3u]
|
//! };
|
||||||
};
|
//! println!("Found person {}", person.name);
|
||||||
println!("Found person {}", person.name);
|
//! }
|
||||||
}
|
//! }
|
||||||
}
|
//! ```
|
||||||
```
|
|
||||||
*/
|
|
||||||
|
|
||||||
#![crate_id="github.com/sfackler/rust-postgres#postgres:0.0"]
|
#![crate_id="github.com/sfackler/rust-postgres#postgres:0.0"]
|
||||||
#![crate_type="rlib"]
|
#![crate_type="rlib"]
|
||||||
|
Loading…
Reference in New Issue
Block a user