iris/_examples/mvc/overview/database/database.go
Gerasimos (Makis) Maropoulos 3fa022738b README: add 'run in the browser' button
after the quick start details, so it is visible always


Former-commit-id: 0c13135a01c2b883aa4a9629a507aaf622d22ade
2020-06-24 00:13:31 +03:00

21 lines
348 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")
}
}