You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The amount attribute is defined as :foo.tx/amount when it's a
spec, and just :tx/amount in the db. I want to have the same
identifier for the same attribute everywhere in my clojure code, so
amount would be called :foo.tx/amount everywhere. I also ran into this
same issue when writing a plugin to generate a json (de)serializer.
(defmeta-db
(engine/init-schema
'[^{:spec/tag-recursivetrue:datomic/tag-recursivetrue:json-serde/tag-recursivetrue}
tx
[^Integer amount]]))
(hodur-spec/defspecsmeta-db {:prefix:foo}) ;=> [:foo.tx/amount :foo/tx];; When I write my own plugin it needs the prefix arg
(defparse-json
(hodur-json/parser meta-db :tx {:prefix:foo}))
;; To use the same qualified name everywhere, I wrote a wrapper
(defschema
(my-hodur-datomic-wrapper/schema meta-db {:prefix:foo}))
Now I need to pass the prefix a bunch of places in the code. It would
be better to specify the prefix together with the rest of the data
model.
I think most plugins are going to want to refer to a canonical, unique,
qualified name for each attribute, so I feel like this
should be the responsibility of hugin-engine.
When using hodur I ran into an issue with names.
The
amount
attribute is defined as:foo.tx/amount
when it's aspec, and just
:tx/amount
in the db. I want to have the sameidentifier for the same attribute everywhere in my clojure code, so
amount would be called
:foo.tx/amount
everywhere. I also ran into thissame issue when writing a plugin to generate a json (de)serializer.
Now I need to pass the prefix a bunch of places in the code. It would
be better to specify the prefix together with the rest of the data
model.
I think most plugins are going to want to refer to a canonical, unique,
qualified name for each attribute, so I feel like this
should be the responsibility of
hugin-engine
.The api I want is the following:
When no ns-prefix is specified, default to the current namespace, like the spec plugin.
On the meta-api side, this would involve adding a
:<node-type>/qualified-name
to each entity.The downside to all this is that it would be a breaking change
for the datomic plugin and maybe others.
What do you think? How would you structure the namespaces?
The text was updated successfully, but these errors were encountered: