2017-03-28 08:53:06 +00:00
|
|
|
package sql
|
|
|
|
|
|
|
|
import (
|
2017-07-15 16:51:02 +00:00
|
|
|
"github.com/drone/drone/store/datastore/sql/mysql"
|
2017-03-28 09:13:13 +00:00
|
|
|
"github.com/drone/drone/store/datastore/sql/postgres"
|
2017-03-28 08:53:06 +00:00
|
|
|
"github.com/drone/drone/store/datastore/sql/sqlite"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Supported database drivers
|
|
|
|
const (
|
2017-03-28 09:13:13 +00:00
|
|
|
DriverSqlite = "sqlite3"
|
2017-03-28 08:53:06 +00:00
|
|
|
DriverMysql = "mysql"
|
|
|
|
DriverPostgres = "postgres"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Lookup returns the named sql statement compatible with
|
|
|
|
// the specified database driver.
|
|
|
|
func Lookup(driver string, name string) string {
|
|
|
|
switch driver {
|
2017-03-28 09:13:13 +00:00
|
|
|
case DriverPostgres:
|
|
|
|
return postgres.Lookup(name)
|
2017-07-15 16:51:02 +00:00
|
|
|
case DriverMysql:
|
|
|
|
return mysql.Lookup(name)
|
2017-03-28 08:53:06 +00:00
|
|
|
default:
|
|
|
|
return sqlite.Lookup(name)
|
|
|
|
}
|
|
|
|
}
|