Fork me on GitHub
#keechma
<
2019-06-24
>
carkh15:06:46

does this even compile ? get-in lacks a parameter in params method of your controller

carkh15:06:03

there is a lein template to make a basic keechma app, though i never used that

carkh15:06:22

the edb schema, although you don't use it yet is wrong too

carkh15:06:08

as far as i understand it, for each "table" you define the id and relations

carkh15:06:15

here is one i made for testing

Ahmed Hassan18:06:43

What defentitydb does exactly?

carkh18:06:31

i creates a bunch of accessor functions for the tables you defined with the schema

Ahmed Hassan18:06:19

This is great, so you don't have to mention Schema everytime.

carkh18:06:42

means you can change the schema and have minimal impact on your code

carkh18:06:49

on the rest of your code i mean

carkh18:06:26

though the fact that it's normalized already does that

Ahmed Hassan18:06:28

It opens many cool possibilities, such as you can have different Schemas in their namespaces, you can make as many DB's you want with with their respective Schemas per DB. Although you don't need it most of the time.

Ahmed Hassan18:06:57

Perks of not having global application state.

carkh18:06:17

mhh possibly, though we're really using this to facilitate data loading

carkh18:06:53

so you'll need to somehow bring it all together when instanciating your app

carkh18:06:14

oh but yes for different apps yes that can be done

Ahmed Hassan18:06:23

Like example given on Keechma blog where main application only starts when user session is present.

Ahmed Hassan18:06:20

In this case you can have different schema'd DBs for both two apps.

carkh18:06:13

depends on your use case

Ahmed Hassan18:06:44

How does it help in facilitating data loading?

carkh18:06:38

the data loader uses your schema ot distribute the data it downloads from the server(s) into those tables you defined

👍 4
carkh18:06:47

normalising it

carkh18:06:30

in my test app, i had several counters which each had a collection of clicks (with date of the click)

carkh18:06:31

they were downloaded from the server as [{:id 1 :name "counter1" :clicks [{:id 1 :timestamp "..."}]}]

carkh18:06:58

and were automatically normalised so that clicks ended in their own table

carkh18:06:00

that's the dalaloader that does this

carkh18:06:20

well i think the entitydb must do the normalising, but they work hand in hand

Ahmed Hassan18:06:44

Entitydb seems more structured than re-frame atom due to schema.

carkh18:06:23

yes, but you still can use the rest of the database as you would in re-frame

carkh18:06:35

so you have the best of both worlds here

carkh18:06:57

some data just won't be a natural fit for normalization

carkh15:06:52

no need to specify other fields than trhose required for normalisation

carkh15:06:07

for now your params method shoudl just return true

carkh15:06:58

you can use it to decide if you want the controller running in this context, by returning true or false

carkh15:06:27

here is the routes for this counters test app i made

carkh15:06:16

i wanted to always have a :page in my route

carkh15:06:28

with counters being the default one