This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-15
Channels
- # aws (4)
- # beginners (98)
- # boot (23)
- # cider (63)
- # cljsrn (3)
- # clojure (259)
- # clojure-boston (1)
- # clojure-dev (2)
- # clojure-italy (6)
- # clojure-nl (17)
- # clojure-russia (1)
- # clojure-serbia (1)
- # clojure-spec (36)
- # clojure-uk (74)
- # clojurescript (11)
- # cursive (2)
- # datascript (12)
- # datomic (36)
- # defnpodcast (1)
- # devops (1)
- # docs (1)
- # emacs (15)
- # euroclojure (3)
- # fulcro (13)
- # graphql (1)
- # juxt (2)
- # lumo (27)
- # off-topic (46)
- # onyx (23)
- # pedestal (6)
- # planck (2)
- # portkey (27)
- # re-frame (18)
- # reagent (12)
- # remote-jobs (2)
- # ring-swagger (11)
- # rum (4)
- # shadow-cljs (104)
- # spacemacs (4)
- # sql (3)
- # tools-deps (5)
- # vim (45)
Hi @tonsky, I saw that re-posh’s TODO example attaches a :app/type
attribute to the entity. I had the same doubt as @eslachance, so I was wondering if that is a good way to have some kind of distinction of the kind (table) of the entity.
Actually what I think I'd like is... some examples of this. tbh I'm not sure it will work for me, I can accept that datascript might not be the right store for me.
Did you see this https://github.com/denistakeda/re-posh/blob/master/examples/todomvc/src/cljs/todomvc/db.cljs ? It might help.
Hmm. I'll have to study that a bit!
Give it a little time. This paradigm may feel a little odd at first coming from SQL, but it's actually much simpler and more flexible. It's actually a benefit that you only have to specify the attrs and can mix and match things, because it means you can get polymorphism for free, something that can get messy in SQL. And ultimately, it's less work for you to do up front. At the end of the day though, if you want your data to conform to some notion of tables or entity types, this is generally pretty easy to accomplish, and you get to be pretty thoughtful and in more control of how you do that.
You will see that is quite simple and what Tonsky said about everything being an entity hopefully will make sense 🙂
yes, you can maintain :app/type attr for every entity to be sure which is which. In practice, though, I found that it’s rarely needed
Cool, thank you. If I don’t use the :app/type
attr, but I want to query all artists, how could I do that? In DataScript/Datomic we define ‘meaning’ to attrs, is that right? So we can share attrs among entities and it means that some other entity could use the :artist/name
attr. If I query for entities with that attribute I will get other entities that are not of the ‘artist type’, right?
Is it right to think that for that to work I would have to attach an :app/type
attr to artist so I can guarantee that I only get entities of that ‘type’?