GetDatabase attempts to return the DatabaseContext of the database. It will load the database if necessary.
(ctx context.Context, name string)
| 317 | |
| 318 | // GetDatabase attempts to return the DatabaseContext of the database. It will load the database if necessary. |
| 319 | func (sc *ServerContext) GetDatabase(ctx context.Context, name string) (*db.DatabaseContext, error) { |
| 320 | dbc, err := sc.GetActiveDatabase(name) |
| 321 | if err == base.ErrNotFound { |
| 322 | dbc, _, err := sc.GetInactiveDatabase(ctx, name) |
| 323 | return dbc, err |
| 324 | } |
| 325 | return dbc, err |
| 326 | } |
| 327 | |
| 328 | // GetActiveDatabase attempts to return the DatabaseContext of a loaded database. If not found, the database name will be |
| 329 | // validated to make sure it's valid and then an error returned. |