You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
499 B

6 years ago
package WorstCaptcha
import (
"os"
"fmt"
"database/sql"
_ "github.com/mattn/go-sqlite3"
)
type Db struct {
client *sql.DB
}
func NewDb() Db {
dir, _ := os.Getwd()
db, err := sql.Open("sqlite3", dir + "/worstcaptcha.db")
if err != nil {
fmt.Println("Failed to open database:", err)
os.Exit(1)
}
db.Exec(`
CREATE TABLE IF NOT EXISTS (
"id" integer NOT NULL PRIMARY KEY,
"word" text,
"identifier" text,
"added" datetime
);
`)
return Db{db}
}