Open puneet-fractl opened 1 year ago
@fractlrao @puneet-fractl Does this imply that the instance is always generated by (or passes through) a resolver that know how to auto-generate the correct value for the attribute? I think there could be three possibilities here -
(defn generate-user-hash [instance]
(hash (str (:UserName instance) ":" (:Email instance))))
(entity :User
{:Username :Kernel/String
:Email :Kernel/Email
:Hash {:auto-generated true
:generator generate-user-hash}})
I think for (1) the spec should be :auto-increment true
. For (2) the :generator
is omitted.
What if it's :optional
by default?
The developer may mark an :auto-generated
attribute as :optional
, but marking an :auto-increment
field should be an error. This ensures that this model is always used with a compliant store. Moreover, an auto-increment field is often used as identity.
These attributes can not be written by the user but will be provided by the system. Ex.