package database import ( "context" "errors" "git.aiterp.net/rpdata/api/database/mongodb" "git.aiterp.net/rpdata/api/internal/config" "git.aiterp.net/rpdata/api/repositories" ) // ErrDriverUnrecognized is returned if the driver is not recognized var ErrDriverUnrecognized = errors.New("Driver not recognized, check your config or update rpdata") type Database interface { Changes() repositories.ChangeRepository Characters() repositories.CharacterRepository Tags() repositories.TagRepository Close(ctx context.Context) error } // Init sets up the database. func Init(config config.Database) (Database, error) { switch config.Driver { case "mongo", "mgo", "mongodb": return mongodb.Init(config) default: return nil, ErrDriverUnrecognized } }