ConfigureOptions
Defined in: config/index.ts:29
Configuration options for the ORM.
Properties
Section titled “Properties”database?
Section titled “database?”
optionaldatabase:SurrealLike
Defined in: config/index.ts:34
A pre-connected database instance. Use this when you already have a connected Surreal instance.
getDatabase()?
Section titled “getDatabase()?”
optionalgetDatabase: () =>SurrealLike|Promise<SurrealLike>
Defined in: config/index.ts:53
A factory function that returns or creates a database connection. Called lazily on first use. The result is cached.
Returns
Section titled “Returns”SurrealLike | Promise<SurrealLike>
Example
Section titled “Example”configure({ getDatabase: async () => { const db = new Surreal(); await db.connect("ws://localhost:8000"); await db.signin({ username: "root", password: "root" }); await db.use({ namespace: "test", database: "test" }); return db; }});