feat: deal attributes with select and options
This commit is contained in:
@ -65,13 +65,14 @@ class RepUpdateMixin(Generic[EntityType, UpdateSchemaType], RepBaseMixin[EntityT
|
||||
data: UpdateSchemaType,
|
||||
with_commit: Optional[bool] = False,
|
||||
fields: Optional[list[str]] = None,
|
||||
set_if_value_is_not_none: Optional[bool] = True,
|
||||
) -> EntityType:
|
||||
if fields is None:
|
||||
fields = data.model_dump().keys()
|
||||
|
||||
for field in fields:
|
||||
value = getattr(data, field)
|
||||
if value is not None:
|
||||
if not set_if_value_is_not_none or value is not None:
|
||||
setattr(model, field, value)
|
||||
|
||||
if with_commit:
|
||||
|
||||
Reference in New Issue
Block a user