The type of the fractional indexing configuration
The synchronous Drizzle database client to use for queries (SQLite in sync mode)
The configuration for fractional indexing
An enhanced fractional indexing utility with Drizzle-specific synchronous methods
const db = drizzle(connection);
const taskFraci = drizzleFraciSync(db, defineDrizzleFraci({
fraciString({ lengthBase: BASE62, digitBase: BASE62 }),
tasks,
tasks.position,
{ userId: tasks.userId },
{ id: tasks.id }
}));
// Get indices for inserting at the beginning of a user's task list
// Note: No await needed since this is synchronous
const [a, b] = taskFraci.indicesForFirst({ userId: 123 });
const [newPosition] = taskFraci.generateKeyBetween(a, b);
drizzleFraci - The asynchronous version of this function
Creates a synchronous fractional indexing utility for Drizzle ORM. This function enhances a fractional indexing instance with Drizzle-specific methods for retrieving indices based on synchronous database queries.
This is the synchronous counterpart to the drizzleFraci function. Use this function when working with Bun SQLite. The API is identical except that methods return values directly instead of Promises.