Skip to content

Commit

Permalink
Support exact max of select inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
piercefreeman committed Dec 5, 2024
1 parent 5d73592 commit d32891f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions iceaxe/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,13 @@ def select(
self, fields: tuple[T | Type[T], T2 | Type[T2]]
) -> QueryBuilder[tuple[T, T2], Literal["SELECT"]]: ...

@overload
def select(
# TypeVarTuples only match the typing of one-or-more elements, so we also
# need a overloaded signature for 3 elements.
self, fields: tuple[T | Type[T], T2 | Type[T2], T3 | Type[T3]]
) -> QueryBuilder[tuple[T, T2, T3], Literal["SELECT"]]: ...

@overload
def select(
self, fields: tuple[T | Type[T], T2 | Type[T2], T3 | Type[T3], *Ts]
Expand All @@ -144,12 +151,14 @@ def select(
| Type[T]
| tuple[T | Type[T]]
| tuple[T | Type[T], T2 | Type[T2]]
| tuple[T | Type[T], T2 | Type[T2], T3 | Type[T3]]
| tuple[T | Type[T], T2 | Type[T2], T3 | Type[T3], *Ts]
),
) -> (
QueryBuilder[T, Literal["SELECT"]]
| QueryBuilder[tuple[T], Literal["SELECT"]]
| QueryBuilder[tuple[T, T2], Literal["SELECT"]]
| QueryBuilder[tuple[T, T2, T3], Literal["SELECT"]]
| QueryBuilder[tuple[T, T2, T3, *Ts], Literal["SELECT"]]
):
"""
Expand Down

0 comments on commit d32891f

Please sign in to comment.