selfLeftJoin method
Query
selfLeftJoin(
- dynamic tableName, {
- dynamic baseColumnName,
- dynamic columnName,
- Query function(
- Query q,
- String tableName,
- String baseTableName
)?,
})
Implementation
Query selfLeftJoin(tableName, {baseColumnName, columnName, Query Function(Query q, String tableName, String baseTableName)? function}) {
if (function != null) {
final rand = getRandomString(9);
_joinQuery += ' LEFT JOIN $tableName $rand ON ';
final que = Query(table: tableName);
que.table = tableName;
que._self = true;
Query q = function(que, tableName, rand);
_select += q._select;
_joinQuery += q._joinQuery.replaceAll('{TABLE_COLUMN_FILL}', rand) + ' ' + q._lastQuery.replaceAll('WHERE', 'AND');
} else {
final rand = getRandomString(9);
_joinQuery += ' LEFT JOIN $tableName $rand ON ';
_joinQuery += tableName + '.' + columnName;
_joinQuery += '=';
_joinQuery += rand + '.' + baseColumnName;
}
return this;
}