prorm API Reference
    Preparing search index...

    Interface QueryOptions

    Options for a raw query: how to interpret the result, what to bind, and whether to map rows onto a model.

    interface QueryOptions {
        plain?: boolean;
        raw?: boolean;
        type?: QueryTypes;
        nest?: boolean;
        replacements?: Record<string, any>;
        bind?: Record<string, any>;
        transaction?: Transaction;
        logging?: boolean | ((sql: string, time?: number) => void);
        using?: string;
        mapToModel?: boolean;
        model?: ModelStatic<any>;
        retry?: RetryOptions;
        timeout?: number;
    }
    Index
    plain?: boolean
    raw?: boolean
    type?: QueryTypes
    nest?: boolean
    replacements?: Record<string, any>
    bind?: Record<string, any>
    transaction?: Transaction
    logging?: boolean | ((sql: string, time?: number) => void)
    using?: string
    mapToModel?: boolean

    Map raw query results to a model instance When true, maps the result rows to ModelInstance objects using the provided model

    false
    
    // Map raw results to model
    const users = await prorm.query('SELECT * FROM users', {
    model: User,
    mapToModel: true
    });
    model?: ModelStatic<any>

    Model to use for mapping raw results to model instances Used together with mapToModel to create ModelInstance objects from raw query results

    retry?: RetryOptions

    Retry options for failed queries Allows retrying queries that fail due to transient errors (e.g., connection issues)

    // Retry up to 3 times with default error matching
    await prorm.query('SELECT * FROM users', {
    retry: { max: 3 }
    });
    // Retry only on specific error patterns
    await prorm.query('SELECT * FROM users', {
    retry: { max: 3, match: ['Connection refused', 'Too many connections'] }
    });
    timeout?: number

    Query timeout in milliseconds