MCPcopy Index your code
hub / github.com/sqlalchemy/sqlalchemy / FunctionAsBinary

Class FunctionAsBinary

lib/sqlalchemy/sql/functions.py:824–873  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

822
823
824class FunctionAsBinary(BinaryExpression[Any]):
825 _traverse_internals = [
826 ("sql_function", InternalTraversal.dp_clauseelement),
827 ("left_index", InternalTraversal.dp_plain_obj),
828 ("right_index", InternalTraversal.dp_plain_obj),
829 ("modifiers", InternalTraversal.dp_plain_dict),
830 ]
831
832 sql_function: FunctionElement[Any]
833 left_index: int
834 right_index: int
835
836 def _gen_cache_key(self, anon_map: Any, bindparams: Any) -> Any:
837 return ColumnElement._gen_cache_key(self, anon_map, bindparams)
838
839 def __init__(
840 self, fn: FunctionElement[Any], left_index: int, right_index: int
841 ) -> None:
842 self.sql_function = fn
843 self.left_index = left_index
844 self.right_index = right_index
845
846 self.operator = operators.function_as_comparison_op
847 self.type = sqltypes.BOOLEANTYPE
848 self.negate = None
849 self._is_implicitly_boolean = True
850 self.modifiers = util.immutabledict({})
851
852 @property
853 def left_expr(self) -> ColumnElement[Any]:
854 return self.sql_function.clauses.clauses[self.left_index - 1]
855
856 @left_expr.setter
857 def left_expr(self, value: ColumnElement[Any]) -> None:
858 self.sql_function.clauses.clauses[self.left_index - 1] = value
859
860 @property
861 def right_expr(self) -> ColumnElement[Any]:
862 return self.sql_function.clauses.clauses[self.right_index - 1]
863
864 @right_expr.setter
865 def right_expr(self, value: ColumnElement[Any]) -> None:
866 self.sql_function.clauses.clauses[self.right_index - 1] = value
867
868 if not TYPE_CHECKING:
869 # mypy can't accommodate @property to replace an instance
870 # variable
871
872 left = left_expr
873 right = right_expr
874
875
876class ScalarFunctionColumn(NamedColumn[_T]):

Callers 1

as_comparisonMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected