38 lines
987 B
Rust
38 lines
987 B
Rust
//extern crate serde_json;
|
|
//extern crate tokio;
|
|
//extern crate tokio_postgres;
|
|
//use std::fs::File;
|
|
//mod parser;
|
|
//mod serializer;
|
|
//use std::fs;
|
|
//use std::io::prelude::*;
|
|
//use std::collections::HashMap;
|
|
//use tokio_postgres::types::ToSql;
|
|
//use tokio_postgres::{Error, NoTls};
|
|
//
|
|
//
|
|
//#[test]
|
|
//fn test_insert_json() {
|
|
// use serde_json::json;
|
|
// let mut client =
|
|
// tokio_postgres::connect("host=localhost user=postgres password=password", NoTls).unwrap();
|
|
// let john = json!({
|
|
// "name": "John Doe",
|
|
// "age": 43,
|
|
// "phones": [
|
|
// "+44 1234567",
|
|
// "+44 2345678"
|
|
// ],
|
|
// "empty": []
|
|
// });
|
|
//
|
|
// client
|
|
// .execute("DROP TABLE IF EXISTS json_dump", &[])
|
|
// .unwrap();
|
|
// client.execute(
|
|
// "CREATE TABLE json_dump ( ID serial NOT NULL PRIMARY KEY, data json NOT NULL)",
|
|
// &[],
|
|
// );
|
|
// client.query("INSERT INTO json_dump ( data ) VALUES ($1)", &[&john]);
|
|
//}
|