-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Is your feature request related to a problem? Please describe.
Many times I just want to define my methods on the schema and have them available to all model types.
Could we allow for that?
Example:
class Booking(BaseModel):
id: str = Field()
start: datetime = Field()
end: datetime = Field()
@computed_field
@property
def duration_secs(self) -> float:
"""The duration in seconds"""
return (self.end - self.start).total_seconds()
SqlBooking = SQLModel("SqlBooking", Booking)Metadata
Metadata
Assignees
Labels
No labels