Skip to main content

CombinedLexeme

This class represents a combination of two search lexemes or expressions using a specific connector, such as a logical operator. It provides functionality to compile the combined expression into SQL and supports logical inversion through the application of De Morgan's theorem.

Methods


as_sql()

@classmethod
def as_sql(
compiler: [SQLCompiler](../../../db/models/sql/compiler/sqlcompiler.md?sid=django_db_models_sql_compiler_sqlcompiler),
connection: DatabaseConnection
) - > tuple

Generates the SQL representation for the combined lexeme by compiling the left and right hand expressions and joining them with the appropriate connector.

Parameters

NameTypeDescription
compiler[SQLCompiler](../../../db/models/sql/compiler/sqlcompiler.md?sid=django_db_models_sql_compiler_sqlcompiler)The compiler instance used to generate the SQL string for the expressions.
connectionDatabaseConnectionThe current database connection used to handle backend-specific SQL generation.

Returns

TypeDescription
tupleA tuple containing the SQL placeholder string and a list containing the formatted combined SQL value.