mirror of
https://github.com/kataras/iris.git
synced 2025-01-24 03:01:03 +01:00
d55bb34766
Former-commit-id: f73cbf6010595c639f6c5b5119e2ec41bc9802a5
23 lines
353 B
Go
23 lines
353 B
Go
package database
|
|
|
|
import (
|
|
"app/environment"
|
|
)
|
|
|
|
// DB example database interface.
|
|
type DB interface {
|
|
Exec(q string) error
|
|
}
|
|
|
|
// NewDB returns a database based on "env".
|
|
func NewDB(env environment.Env) DB {
|
|
switch env {
|
|
case environment.PROD:
|
|
return &mysql{}
|
|
case environment.DEV:
|
|
return &sqlite{}
|
|
default:
|
|
panic("unknown environment")
|
|
}
|
|
}
|