The result after join (table alias)

How to configure alias here? The result of the join return the original table name (library_level), but I expect libraryLevel, which is defined at the application level.
export const libraryLevel = sqliteTable('library_level', {
    id: integer('id').notNull().primaryKey(),
    name: text('name', { mode: 'text', length: 255 }).notNull().unique(),
});

export const user = sqliteTable('user', {
    id: integer('id').notNull().primaryKey(),
    email: text('email', { mode: 'text', length: 320 }).notNull().unique(),
    libraryLevelId: integer('library_level_id').references(() => libraryLevel.id),
});

///

const users = await context.db
    .select()
    .from(user)
    .leftJoin(libraryLevel, eq(user.libraryLevelId, libraryLevel.id))
    .all();

users[0]?.library_level

// instead of 

users[0]?.libraryError
Was this page helpful?