prorm API Reference
    Preparing search index...

    Class ViewBuilder

    Builder for creating database views

    Index
    • Set the primary model to select from Accepts model class or table name string

      Parameters

      • model: string | { tableName?: string; name?: string }

      Returns ViewBuilder

      .from(User)
      .from('users')
    • Add all columns from a model

      Parameters

      • model: string | { tableName?: string; name?: string }
      • Optionalopts: { prefix?: string }

      Returns ViewBuilder

    • Add a join to the view

      Parameters

      • opts: {
            model: string | { tableName?: string; name?: string };
            type?: "FULL" | "INNER" | "LEFT" | "RIGHT";
            on: Record<string, any>;
            as?: string;
        }

      Returns ViewBuilder

      .join({ model: Post, type: 'LEFT', on: { userId: 'users.id' } })
      .join({ model: 'posts', type: 'LEFT', on: { userId: 'users.id' } })