Initial commit

This commit is contained in:
Adrian Macneil 2015-11-25 10:57:58 -08:00
commit 9cfc758ca1
14 changed files with 697 additions and 0 deletions

21
driver/shared/shared.go Normal file
View file

@ -0,0 +1,21 @@
package shared
import (
"database/sql"
"net/url"
)
// DatabaseName returns the database name from a URL
func DatabaseName(u *url.URL) string {
name := u.Path
if len(name) > 0 && name[:1] == "/" {
name = name[1:len(name)]
}
return name
}
// Transaction can represent a database or open transaction
type Transaction interface {
Exec(query string, args ...interface{}) (sql.Result, error)
}