Eager Loading
Loading Relations
Section titled “Loading Relations”const users = await pulsabase.from(User) .with('posts') .with('profile', { select: ['avatar_url'] }) .find();// Each user → { id, name, posts: [...], profile: { avatar_url: '...' } }final users = await pulsabase.from('users') .withRelation('posts') .withRelation('profile', config: {'select': ['avatar_url']}) .find();Nested Relations
Section titled “Nested Relations”const posts = await pulsabase.from(Post) .with('author') .with('comments', { with: { author: { select: ['name'] } }, sort: [{ field: 'created_at', order: 'desc' }], limit: 5, }) .find();For SQL JOINs:
const result = await pulsabase.from(User) .join({ table: 'orders', type: 'LEFT', on: [{ left: 'users.id', operator: '=', right: 'orders.user_id' }], }) .select(['users.name', 'orders.total']) .find();final result = await pulsabase.from('users') .join({ 'table': 'orders', 'type': 'LEFT', 'on': [{'left': 'users.id', 'operator': '=', 'right': 'orders.user_id'}], }) .select(['users.name', 'orders.total']) .find();