Captain Hook - Web hook server
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.
 
 
 
 
 

29 lines
444 B

package main
import (
"database/sql"
_ "github.com/go-sql-driver/mysql"
"io/ioutil"
)
func runSQL(db *sql.DB, name string) error {
b, err := ioutil.ReadFile(name)
if err != nil {
return err
}
statement, err := db.Prepare(string(b))
if err != nil {
return err
}
statement.Exec()
return nil
}
func createDB(db *sql.DB) error {
return runSQL(db, "setup.sql")
}
func dropDB(db *sql.DB) error {
return runSQL(db, "drop.sql")
}