Archived
1
0
Fork 0

feat(core): add database utils

This commit is contained in:
Dmitriy Pleshevskiy 2021-01-31 13:39:00 +03:00
parent bc3421b150
commit d8ed9fd25a
3 changed files with 13 additions and 9 deletions

View file

@ -4,6 +4,5 @@ version = "0.1.0"
authors = ["Dmitriy Pleshevskiy <dmitriy@ideascup.me>"] authors = ["Dmitriy Pleshevskiy <dmitriy@ideascup.me>"]
edition = "2018" edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
postgres = "0.19.0"

View file

@ -0,0 +1,9 @@
use postgres::{Client, NoTls, Error};
pub fn connect(connection_string: &str) -> Result<Client, Error> {
Client::connect(connection_string, NoTls)
}
pub fn apply_sql(client: &mut Client, sql_content: &str) -> Result<(), Error> {
client.batch_execute(sql_content)
}

View file

@ -1,7 +1,3 @@
#[cfg(test)] #![deny(clippy::all)]
mod tests {
#[test] pub mod database;
fn it_works() {
assert_eq!(2 + 2, 4);
}
}