File tree Expand file tree Collapse file tree 2 files changed +1
-23
lines changed
Expand file tree Collapse file tree 2 files changed +1
-23
lines changed Original file line number Diff line number Diff line change 1- from typing import Optional , Tuple
2-
3- from pypika .terms import Term , ValueWrapper
4-
51from tortoise .indexes import PartialIndex
62
73
@@ -10,22 +6,6 @@ class PostgreSQLIndex(PartialIndex):
106 "CREATE INDEX {exists}{index_name} ON {table_name} USING{index_type}({fields}){extra};"
117 )
128
13- def __init__ (
14- self ,
15- * expressions : Term ,
16- fields : Optional [Tuple [str , ...]] = None ,
17- name : Optional [str ] = None ,
18- condition : Optional [dict ] = None ,
19- ) -> None :
20- super ().__init__ (* expressions , fields = fields , name = name )
21- if condition :
22- cond = " WHERE "
23- items = []
24- for k , v in condition .items ():
25- items .append (f"{ k } = { ValueWrapper (v )} " )
26- cond += " AND " .join (items )
27- self .extra = cond
28-
299
3010class BloomIndex (PostgreSQLIndex ):
3111 INDEX_TYPE = "BLOOM"
Original file line number Diff line number Diff line change @@ -71,8 +71,6 @@ def __init__(
7171 super ().__init__ (* expressions , fields = fields , name = name )
7272 if condition :
7373 cond = " WHERE "
74- items = []
75- for k , v in condition .items ():
76- items .append (f"{ k } = { ValueWrapper (v )} " )
74+ items = [f"{ k } = { ValueWrapper (v )} " for k , v in condition .items ()]
7775 cond += " AND " .join (items )
7876 self .extra = cond
You can’t perform that action at this time.
0 commit comments