InsertToken
parent
21b8539317
commit
368c25d03f
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue