Browse Source

InsertToken

master
Elis Axelsson 4 years ago
parent
commit
368c25d03f
1 changed files with 15 additions and 5 deletions
  1. +15
    -5
      src/WorstCaptcha/Db.go

+ 15
- 5
src/WorstCaptcha/Db.go 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)
}

Loading…
Cancel
Save