README: add trailing commas and rid of some whitespace (for consistency)

This commit is contained in:
Tshepang Lekhonkhobe
2016-06-01 17:40:27 +02:00
parent 8a0fed9749
commit 1a1275767b

View File

@@ -22,13 +22,11 @@ use postgres::{Connection, SslMode};
struct Person {
id: i32,
name: String,
data: Option<Vec<u8>>
data: Option<Vec<u8>>,
}
fn main() {
let conn = Connection::connect("postgres://postgres@localhost", SslMode::None)
.unwrap();
let conn = Connection::connect("postgres://postgres@localhost", SslMode::None).unwrap();
conn.execute("CREATE TABLE person (
id SERIAL PRIMARY KEY,
name VARCHAR NOT NULL,
@@ -37,16 +35,15 @@ fn main() {
let me = Person {
id: 0,
name: "Steven".to_string(),
data: None
data: None,
};
conn.execute("INSERT INTO person (name, data) VALUES ($1, $2)",
&[&me.name, &me.data]).unwrap();
for row in &conn.query("SELECT id, name, data FROM person", &[]).unwrap() {
let person = Person {
id: row.get(0),
name: row.get(1),
data: row.get(2)
data: row.get(2),
};
println!("Found person {}", person.name);
}