Browse Source

SQLite

master
six 4 months ago
parent
commit
6b3a68235a
  1. 31
      code/src/main.rs

31
code/src/main.rs

@ -1,16 +1,35 @@ @@ -1,16 +1,35 @@
use std::io::stdin;
use std::fs;
use rusqlite::{Connection, Result};
use rusqlite::NO_PARAMS;
fn main() {
// Input to skills
// Input from cli
let mut input_string = String::new();
stdin().read_line(&mut input_string).ok().expect("Error while reading input.");
println!("{:?}", input_string);
// Read Skills - format?
let content = fs::read_to_string("../../skills.txt").expect("Error while reading file.");
println!("All skills:\n{}", content)
// Read Skills files -> sqlite?
//let content = fs::read_to_string("../../skills.txt").expect("Error while reading file.");
//println!("All skills:\n{}", content)
// List skill levels
// ...
let conn = Connection::open("irlpg.db")?;
conn.execute(
"create table if not exists skill_levels (
id integer primary key,
name text not null unique
)",
NO_PARAMS,
)?;
conn.execute(
"create table if not exists skills (
id integer primary key,
name text not null,
color_id integer not null references skill_levels(id)
)",
NO_PARAMS,
)?;
Ok(())
}

Loading…
Cancel
Save