"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Dialect = void 0;
class Dialect {
    constructor() {
        this.REPLACE_ORDER_BY = new RegExp('order\\s+by\\s+[^,\\s]+(\\s+asc|\\s+desc)?(\\s*,\\s*[^,\\s]+(\\s+asc|\\s+desc)?)*', 'gim');
    }
    /**
     * 获取查总数的sql
     *
     * @param sql 原始SQL
     * @return 分页 count SQL
     */
    getCountSql(sql) {
        return ('select count(1) from ( \n' +
            sql.replace(this.REPLACE_ORDER_BY, '') +
            '\n ) count_');
    }
}
exports.Dialect = Dialect;
