将值转换为数据库存储的字符串
(value: Any)
| 651 | |
| 652 | |
| 653 | def _value_to_string(value: Any) -> str: |
| 654 | """将值转换为数据库存储的字符串""" |
| 655 | if isinstance(value, SecretStr): |
| 656 | return value.get_secret_value() |
| 657 | elif isinstance(value, bool): |
| 658 | return "true" if value else "false" |
| 659 | elif isinstance(value, (dict, list)): |
| 660 | import json |
| 661 | return json.dumps(value) |
| 662 | elif value is None: |
| 663 | return "" |
| 664 | else: |
| 665 | return str(value) |
| 666 | |
| 667 | |
| 668 | def init_default_settings() -> None: |
no outgoing calls
no test coverage detected