data_structures¶
- class litestar.dto.data_structures.DTOData[原始碼]¶
基底類別:
Generic[T]DTO validated data and utility methods.
- create_instance(**kwargs: Any) T[原始碼]¶
Create an instance of the DTO validated data.
- 參數:
**kwargs¶ -- Additional data to create the instance with. Takes precedence over DTO validated data.
- class litestar.dto.data_structures.DTOFieldDefinition[原始碼]¶
基底類別:
FieldDefinitionA model field representation for purposes of generating a DTO backend model type.
- __init__(raw: Any, annotation: Any, type_wrappers: tuple[type, ...], origin: Any, args: tuple[Any, ...], metadata: tuple[Any, ...], instantiable_origin: Any, safe_generic_origin: Any, inner_types: tuple[FieldDefinition, ...], default: Any, extra: dict[str, Any], kwarg_definition: KwargDefinition | DependencyKwarg | None, name: str, model_name: str, default_factory: Callable[[], Any] | None, dto_field: DTOField, passthrough_constraints: bool) None¶
- passthrough_constraints: bool¶
Pass constraints of the source annotation to be validated by the DTO backend
- classmethod from_field_definition(field_definition: FieldDefinition, model_name: str, default_factory: Callable[[], Any] | None, dto_field: DTOField, passthrough_constraints: bool = True) DTOFieldDefinition[原始碼]¶
Create a
FieldDefinitionfrom aFieldDefinition.- 參數:
field_definition¶ -- A
FieldDefinitionto create aFieldDefinitionfrom.model_name¶ -- The name of the model.
default_factory¶ -- Default factory function, if any.
dto_field¶ -- DTOField instance.
passthrough_constraints¶ -- Pass constraints of the source annotation to be validated by the DTO backend
- 回傳:
A
FieldDefinitioninstance.