| 84 | |
| 85 | |
| 86 | class SearchConfig(Expression): |
| 87 | def __init__(self, config): |
| 88 | super().__init__() |
| 89 | if not hasattr(config, "resolve_expression"): |
| 90 | config = Value(config) |
| 91 | self.config = config |
| 92 | |
| 93 | @classmethod |
| 94 | def from_parameter(cls, config): |
| 95 | if config is None or isinstance(config, cls): |
| 96 | return config |
| 97 | return cls(config) |
| 98 | |
| 99 | def get_source_expressions(self): |
| 100 | return [self.config] |
| 101 | |
| 102 | def set_source_expressions(self, exprs): |
| 103 | (self.config,) = exprs |
| 104 | |
| 105 | def as_sql(self, compiler, connection): |
| 106 | sql, params = compiler.compile(self.config) |
| 107 | return "%s::regconfig" % sql, params |
| 108 | |
| 109 | |
| 110 | class SearchVectorCombinable: |
no outgoing calls