InsertToken

master
Elis Axelsson 2016-04-27 16:34:01 +02:00
parent 21b8539317
commit 368c25d03f
1 changed files with 15 additions and 5 deletions

View File

@ -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)
}