TerraOceanPlugin/GoBot/db.go

27 lines
557 B
Go

package main
import (
"database/sql"
"errors"
//Import this driver to be used by the SQL package.
_ "github.com/mattn/go-sqlite3"
)
var db *sql.DB
var errNotFound = errors.New("db: the requested entry was not found")
var errAlreadyExists = errors.New("db: attempting to write to an entry that already exists")
func init() {
var err error
db, err = sql.Open("sqlite3", "terraocean.db")
if err != nil {
panic(err)
}
_, err = db.Exec("CREATE TABLE IF NOT EXISTS invite (code TEXT, owner TEXT, used BOOLEAN)")
if err != nil {
panic(err)
}
}