Fork me on GitHub
#datomic
<
2016-07-10
>
bhagany20:07:17

pretty sure this is going to be a "no", but - is there any way to use the log api with the rest api?

val_waeselynck21:07:46

@lvh OK, I think I understand, correct me if I'm wrong. You want to store REST configuration in Datomic.

val_waeselynck21:07:29

Basically, you'd like global defaults for the configuration, as well as resource-scoped / endpoint-scoped configuration to override it.

val_waeselynck21:07:58

The way I would do it would be to have entities representing the global configuration, the resources and the endpoints, attributes for the options (e/g :rest.config/consumes) and a to-one ref attribute representing configuration hierarchy (similar to Javascript's prototypal inheritance, e.g :rest.options/parent).

val_waeselynck21:07:56

I would then write something that generically climbs the inheritance chain to find the value for an option.

val_waeselynck21:07:32

If you're querying from Datalog, you could use a recursive rule, e.g :

val_waeselynck21:07:30

If you're querying from Clojure with Entities, I'd walk the inheritance chain manually, e.g :

val_waeselynck21:07:44

(or you could use a transducer of course :))

val_waeselynck21:07:21

@lvh does this answer your questions ?

marshall22:07:13

@bhagany: I believe the log in query is supported via REST http://docs.datomic.com/log.html#log-in-query I'm not at a computer to test currently.

bhagany22:07:40

@marshall: Aha, it hadn't occurred to me to try inside query. I'll give it a shot. Thanks!

bhagany22:07:22

@marshall: hrm, on second thought, doing that appears to require passing the log as a data source to query. I don't see a way to do that via REST.

lvh23:07:46

@val_waeselynck: I think so! Thanks!

lvh23:07:59

find-opt was the missing piece