mirror of
https://github.com/davidhalter/django-stubs.git
synced 2026-10-23 22:37:10 +08:00
Add stub for OpClass (#617)
This commit is contained in:
1 parent
248f1cccee
commit
6dd8384381
2 files changed
+18
-1
No files matched your search
@@ -2,7 +2,7 @@ from typing import Optional, Sequence, Union
|
|||||||
|
|
||||||
from django.db.models.query_utils import Q
|
from django.db.models.query_utils import Q
|
||||||
|
|
||||||
from django.db.models import Index
|
from django.db.models import Index, Func
|
||||||
from django.db.models.expressions import BaseExpression, Combinable
|
from django.db.models.expressions import BaseExpression, Combinable
|
||||||
|
|
||||||
|
|
||||||
@@ -88,3 +88,10 @@ class SpGistIndex(PostgresIndex):
|
|||||||
condition: Optional[Q] = ...,
|
condition: Optional[Q] = ...,
|
||||||
include: Optional[Sequence[str]] = ...,
|
include: Optional[Sequence[str]] = ...,
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
|
|
||||||
|
class OpClass(Func):
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
expression: Union[BaseExpression, Combinable, str],
|
||||||
|
name: str,
|
||||||
|
) -> None: ...
|
||||||
@@ -16,3 +16,13 @@
|
|||||||
- index: GistIndex
|
- index: GistIndex
|
||||||
- index: HashIndex
|
- index: HashIndex
|
||||||
- index: SpGistIndex
|
- index: SpGistIndex
|
||||||
|
|
||||||
|
- case: can_instantiate_opclass
|
||||||
|
main: |
|
||||||
|
from django.db.models import Index
|
||||||
|
from django.db.models.functions import Lower
|
||||||
|
from django.contrib.postgres.indexes import OpClass
|
||||||
|
Index(
|
||||||
|
OpClass(Lower('username'), name='varchar_pattern_ops'),
|
||||||
|
name='lower_username_idx',
|
||||||
|
)
|
||||||
Reference in new issue
Block a user