|
|
|
@ -23,13 +23,23 @@ func NewDb() Db {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
db.Exec(`
|
|
|
|
|
CREATE TABLE IF NOT EXISTS (
|
|
|
|
|
"id" integer NOT NULL PRIMARY KEY,
|
|
|
|
|
"word" text,
|
|
|
|
|
"identifier" text,
|
|
|
|
|
"added" datetime
|
|
|
|
|
CREATE TABLE IF NOT EXISTS tokens (
|
|
|
|
|
"id" integer NOT NULL PRIMARY KEY,
|
|
|
|
|
"word" text,
|
|
|
|
|
"token" text
|
|
|
|
|
);
|
|
|
|
|
`)
|
|
|
|
|
|
|
|
|
|
return Db{db}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (d *Db) InsertToken(word string, token string) {
|
|
|
|
|
stmt, _ := d.Client.Prepare(`
|
|
|
|
|
INSERT INTO tokens("word", "token")
|
|
|
|
|
VALUES (?, ?)
|
|
|
|
|
`)
|
|
|
|
|
|
|
|
|
|
defer stmt.Close()
|
|
|
|
|
|
|
|
|
|
stmt.Exec(word, token)
|
|
|
|
|
}
|
|
|
|
|