mirror of
https://github.com/fastapi/sqlmodel.git
synced 2025-08-15 18:28:12 +08:00
📝 Update docs for Decimal, use proper types (#719)
This commit is contained in:

committed by
GitHub

parent
50b0198423
commit
41495e30c7
@ -1,6 +1,6 @@
|
||||
from decimal import Decimal
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import condecimal
|
||||
from sqlmodel import Field, Session, SQLModel, create_engine, select
|
||||
|
||||
|
||||
@ -9,7 +9,7 @@ class Hero(SQLModel, table=True):
|
||||
name: str = Field(index=True)
|
||||
secret_name: str
|
||||
age: Optional[int] = Field(default=None, index=True)
|
||||
money: condecimal(max_digits=5, decimal_places=3) = Field(default=0)
|
||||
money: Decimal = Field(default=0, max_digits=5, decimal_places=3)
|
||||
|
||||
|
||||
sqlite_file_name = "database.db"
|
||||
|
Reference in New Issue
Block a user