Skip to content
🚀 This documentation is for unreal-orm 1.0.0 alpha which requires SurrealDB 2.0 alpha SDK. For the stable version, see npm.

ConfigureOptions

Defined in: config/index.ts:29

Configuration options for the ORM.

optional database: SurrealLike

Defined in: config/index.ts:34

A pre-connected database instance. Use this when you already have a connected Surreal instance.


optional getDatabase: () => 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.

SurrealLike | Promise<SurrealLike>

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;
}
});