Closed YAGregor closed 5 months ago
Thanks! LGTM. Please update changelog also.
Totals | |
---|---|
Change from base Build 8858003658: | 0.02% |
Covered Lines: | 5758 |
Relevant Lines: | 6453 |
I've done the change log, do you think we should update the doc? Seems that this behavior is natural, and there is no need to @long2ice
@YAGregor hi!
Please rebase PR on actual develop and resolve conflict in Changelog Changes should go to 0.21.0 section
allow Field's default value not only be callable, literal value, but also async function
Description
when set Field's default keyword option to async function, then while save and create model, if the field never set, the field will be set as the async function's result
Motivation and Context
I write a model and I want a serial of unique, auto increasing serial names generate from redis (by aioredis), but the field's default do not support retrieve value from async function, I have to override create method, that's cumbersome.
and tortoise is an async orm, it should support async first.
How Has This Been Tested?
I create a new model for new test case, test model's behavior when combine async default with
save
,create
, and when default field value was covered by set attribute.I run tests on linux, include sqlite's test cases.
Almost no effect.
Checklist: