schemas added & lang models added
This commit is contained in:
@@ -14,13 +14,13 @@ T = TypeVar("T")
|
||||
class PostgresResponse(Generic[T]):
|
||||
"""
|
||||
Wrapper for PostgreSQL/SQLAlchemy query results.
|
||||
|
||||
|
||||
Attributes:
|
||||
query: SQLAlchemy query object
|
||||
first: Whether to return first result only
|
||||
data: Query results (lazy loaded)
|
||||
count: Total count of results
|
||||
|
||||
|
||||
Properties:
|
||||
all: All results as list
|
||||
first_item: First result only
|
||||
@@ -63,7 +63,11 @@ class PostgresResponse(Generic[T]):
|
||||
@property
|
||||
def all(self) -> List[T]:
|
||||
"""Get all results as list."""
|
||||
return self.data if isinstance(self.data, list) else [self.data] if self.data else []
|
||||
return (
|
||||
self.data
|
||||
if isinstance(self.data, list)
|
||||
else [self.data] if self.data else []
|
||||
)
|
||||
|
||||
@property
|
||||
def first_item(self) -> Optional[T]:
|
||||
|
||||
Reference in New Issue
Block a user