-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Hey @KyGost, I wanted to suggest improvements to multisql.
In this example:
use gluesql::prelude::*;
fn main() {
let storage = SledStorage::new("data/doc-db").unwrap();
let mut glue = Glue::new(storage);
let sqls = vec![
"DROP TABLE IF EXISTS Glue;",
"CREATE TABLE Glue (id INTEGER);",
"INSERT INTO Glue VALUES (100);",
"INSERT INTO Glue VALUES (200);",
"SELECT * FROM Glue WHERE id > 100;",
];
for sql in sqls {
let output = glue.execute(sql).unwrap();
println!("{:?}", output)
}
}
While this is great for basic stuff, I wanted to suggest a more cleaner alternative.
Here is my suggestion to use commands to execute stuff such as select
etc etc. Here is my example (this is pseudo code):
glue.drop(["Glue"]);
glue.create("Glue", vec![id: INTEGER]); // Takes two arguments, one is for the table name, the other is for column names
glue.insert("Glue", vec!(100);
glue.insert("Glue", vec!(200);
glue.select("Glue", ["*"], [id > 100, id == 100]; // table_name, columns, condition(s)
Unless if there was a way to do this already?
Metadata
Metadata
Assignees
Labels
No labels