Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 24 of 24 for fake_db (0.14 sec)

  1. docs/en/docs/tutorial/encoder.md

    For example, if you need to store it in a database.
    
    For that, **FastAPI** provides a `jsonable_encoder()` function.
    
    ## Using the `jsonable_encoder`
    
    Let's imagine that you have a database `fake_db` that only receives JSON compatible data.
    
    For example, it doesn't receive `datetime` objects, as those are not compatible with JSON.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 1.8K bytes
    - Viewed (0)
  2. docs/zh/docs/tutorial/encoder.md

    # JSON 兼容编码器
    
    在某些情况下,您可能需要将数据类型(如Pydantic模型)转换为与JSON兼容的数据类型(如`dict`、`list`等)。
    
    比如,如果您需要将其存储在数据库中。
    
    对于这种要求, **FastAPI**提供了`jsonable_encoder()`函数。
    
    ## 使用`jsonable_encoder`
    
    让我们假设你有一个数据库名为`fake_db`,它只能接收与JSON兼容的数据。
    
    例如,它不接收`datetime`这类的对象,因为这些对象与JSON不兼容。
    
    因此,`datetime`对象必须将转换为包含<a href="https://en.wikipedia.org/wiki/ISO_8601" class="external-link" target="_blank">ISO格式化</a>的`str`类型对象。
    
    同样,这个数据库也不会接收Pydantic模型(带有属性的对象),而只接收`dict`。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 17 05:59:11 GMT 2023
    - 1.7K bytes
    - Viewed (0)
  3. docs/em/docs/tutorial/encoder.md

    # 🎻 🔗 🔢
    
    📤 💼 🌐❔ 👆 5️⃣📆 💪 🗜 💽 🆎 (💖 Pydantic 🏷) 🕳 🔗 ⏮️ 🎻 (💖 `dict`, `list`, ♒️).
    
    🖼, 🚥 👆 💪 🏪 ⚫️ 💽.
    
    👈, **FastAPI** 🚚 `jsonable_encoder()` 🔢.
    
    ## ⚙️ `jsonable_encoder`
    
    ➡️ 🌈 👈 👆 ✔️ 💽 `fake_db` 👈 🕴 📨 🎻 🔗 💽.
    
    🖼, ⚫️ 🚫 📨 `datetime` 🎚, 👈 🚫 🔗 ⏮️ 🎻.
    
    , `datetime` 🎚 🔜 ✔️ 🗜 `str` ⚗ 💽 <a href="https://en.wikipedia.org/wiki/ISO_8601" class="external-link" target="_blank">💾 📁</a>.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 1.5K bytes
    - Viewed (0)
  4. cni/pkg/plugin/cnieventclient_test.go

    	IfName:      "ethBro",
    	ContainerID: "bbb-eee-www",
    }
    
    var (
    	fakeIP                 = net.ParseIP("99.9.9.9")
    	fakeGW                 = net.ParseIP("88.9.9.9")
    	fakeIDX                = 0
    	fakePrevResultIPConfig = cniv1.IPConfig{
    		Interface: &fakeIDX,
    		Address: net.IPNet{
    			IP: fakeIP,
    		},
    		Gateway: fakeGW,
    	}
    )
    
    func TestPushCNIAddEventSucceed(t *testing.T) {
    Go
    - Registered: Wed May 08 22:53:08 GMT 2024
    - Last Modified: Fri Jan 26 20:34:28 GMT 2024
    - 4.2K bytes
    - Viewed (0)
Back to top