mirror of
https://github.com/fastapi/fastapi.git
synced 2026-03-07 08:28:52 -05:00
118 lines
3.8 KiB
Markdown
118 lines
3.8 KiB
Markdown
# ➡ 🔢 & 🔢 🔬
|
||
|
||
🎏 🌌 👈 👆 💪 📣 🌅 🔬 & 🗃 🔢 🔢 ⏮️ `Query`, 👆 💪 📣 🎏 🆎 🔬 & 🗃 ➡ 🔢 ⏮️ `Path`.
|
||
|
||
## 🗄 ➡
|
||
|
||
🥇, 🗄 `Path` ⚪️➡️ `fastapi`:
|
||
|
||
{* ../../docs_src/path_params_numeric_validations/tutorial001.py hl[3] *}
|
||
|
||
## 📣 🗃
|
||
|
||
👆 💪 📣 🌐 🎏 🔢 `Query`.
|
||
|
||
🖼, 📣 `title` 🗃 💲 ➡ 🔢 `item_id` 👆 💪 🆎:
|
||
|
||
{* ../../docs_src/path_params_numeric_validations/tutorial001.py hl[10] *}
|
||
|
||
/// note
|
||
|
||
➡ 🔢 🕧 ✔ ⚫️ ✔️ 🍕 ➡.
|
||
|
||
, 👆 🔜 📣 ⚫️ ⏮️ `...` ™ ⚫️ ✔.
|
||
|
||
👐, 🚥 👆 📣 ⚫️ ⏮️ `None` ⚖️ ⚒ 🔢 💲, ⚫️ 🔜 🚫 📉 🕳, ⚫️ 🔜 🕧 🚚.
|
||
|
||
///
|
||
|
||
## ✔ 🔢 👆 💪
|
||
|
||
➡️ 💬 👈 👆 💚 📣 🔢 🔢 `q` ✔ `str`.
|
||
|
||
& 👆 🚫 💪 📣 🕳 🙆 👈 🔢, 👆 🚫 🤙 💪 ⚙️ `Query`.
|
||
|
||
✋️ 👆 💪 ⚙️ `Path` `item_id` ➡ 🔢.
|
||
|
||
🐍 🔜 😭 🚥 👆 🚮 💲 ⏮️ "🔢" ⏭ 💲 👈 🚫 ✔️ "🔢".
|
||
|
||
✋️ 👆 💪 🏤-✔ 👫, & ✔️ 💲 🍵 🔢 (🔢 🔢 `q`) 🥇.
|
||
|
||
⚫️ 🚫 🤔 **FastAPI**. ⚫️ 🔜 🔍 🔢 👫 📛, 🆎 & 🔢 📄 (`Query`, `Path`, ♒️), ⚫️ 🚫 💅 🔃 ✔.
|
||
|
||
, 👆 💪 📣 👆 🔢:
|
||
|
||
{* ../../docs_src/path_params_numeric_validations/tutorial002.py hl[7] *}
|
||
|
||
## ✔ 🔢 👆 💪, 🎱
|
||
|
||
🚥 👆 💚 📣 `q` 🔢 🔢 🍵 `Query` 🚫 🙆 🔢 💲, & ➡ 🔢 `item_id` ⚙️ `Path`, & ✔️ 👫 🎏 ✔, 🐍 ✔️ 🐥 🎁 ❕ 👈.
|
||
|
||
🚶♀️ `*`, 🥇 🔢 🔢.
|
||
|
||
🐍 🏆 🚫 🕳 ⏮️ 👈 `*`, ✋️ ⚫️ 🔜 💭 👈 🌐 📄 🔢 🔜 🤙 🇨🇻 ❌ (🔑-💲 👫), 💭 <abbr title="From: K-ey W-ord Arg-uments"><code>kwargs</code></abbr>. 🚥 👫 🚫 ✔️ 🔢 💲.
|
||
|
||
{* ../../docs_src/path_params_numeric_validations/tutorial003.py hl[7] *}
|
||
|
||
## 🔢 🔬: 👑 🌘 ⚖️ 🌓
|
||
|
||
⏮️ `Query` & `Path` (& 🎏 👆 🔜 👀 ⏪) 👆 💪 📣 🔢 ⚛.
|
||
|
||
📥, ⏮️ `ge=1`, `item_id` 🔜 💪 🔢 🔢 "`g`🅾 🌘 ⚖️ `e`🅾" `1`.
|
||
|
||
{* ../../docs_src/path_params_numeric_validations/tutorial004.py hl[8] *}
|
||
|
||
## 🔢 🔬: 🌘 🌘 & 🌘 🌘 ⚖️ 🌓
|
||
|
||
🎏 ✔:
|
||
|
||
* `gt`: `g`🅾 `t`👲
|
||
* `le`: `l`👭 🌘 ⚖️ `e`🅾
|
||
|
||
{* ../../docs_src/path_params_numeric_validations/tutorial005.py hl[9] *}
|
||
|
||
## 🔢 🔬: 🎈, 🌘 🌘 & 🌘 🌘
|
||
|
||
🔢 🔬 👷 `float` 💲.
|
||
|
||
📥 🌐❔ ⚫️ ▶️️ ⚠ 💪 📣 <abbr title="greater than"><code>gt</code></abbr> & 🚫 <abbr title="greater than or equal"><code>ge</code></abbr>. ⏮️ ⚫️ 👆 💪 🚚, 🖼, 👈 💲 🔜 👑 🌘 `0`, 🚥 ⚫️ 🌘 🌘 `1`.
|
||
|
||
, `0.5` 🔜 ☑ 💲. ✋️ `0.0` ⚖️ `0` 🔜 🚫.
|
||
|
||
& 🎏 <abbr title="less than"><code>lt</code></abbr>.
|
||
|
||
{* ../../docs_src/path_params_numeric_validations/tutorial006.py hl[11] *}
|
||
|
||
## 🌃
|
||
|
||
⏮️ `Query`, `Path` (& 🎏 👆 🚫 👀) 👆 💪 📣 🗃 & 🎻 🔬 🎏 🌌 ⏮️ [🔢 🔢 & 🎻 🔬](query-params-str-validations.md){.internal-link target=_blank}.
|
||
|
||
& 👆 💪 📣 🔢 🔬:
|
||
|
||
* `gt`: `g`🅾 `t`👲
|
||
* `ge`: `g`🅾 🌘 ⚖️ `e`🅾
|
||
* `lt`: `l`👭 `t`👲
|
||
* `le`: `l`👭 🌘 ⚖️ `e`🅾
|
||
|
||
/// info
|
||
|
||
`Query`, `Path`, & 🎏 🎓 👆 🔜 👀 ⏪ 🏿 ⚠ `Param` 🎓.
|
||
|
||
🌐 👫 💰 🎏 🔢 🌖 🔬 & 🗃 👆 ✔️ 👀.
|
||
|
||
///
|
||
|
||
/// note | 📡 ℹ
|
||
|
||
🕐❔ 👆 🗄 `Query`, `Path` & 🎏 ⚪️➡️ `fastapi`, 👫 🤙 🔢.
|
||
|
||
👈 🕐❔ 🤙, 📨 👐 🎓 🎏 📛.
|
||
|
||
, 👆 🗄 `Query`, ❔ 🔢. & 🕐❔ 👆 🤙 ⚫️, ⚫️ 📨 👐 🎓 🌟 `Query`.
|
||
|
||
👫 🔢 📤 (↩️ ⚙️ 🎓 🔗) 👈 👆 👨🎨 🚫 ™ ❌ 🔃 👫 🆎.
|
||
|
||
👈 🌌 👆 💪 ⚙️ 👆 😐 👨🎨 & 🛠️ 🧰 🍵 ✔️ 🚮 🛃 📳 🤷♂ 📚 ❌.
|
||
|
||
///
|