keechma

Keechma stack. Mention @U050986L9 or @U2J1PHYNM if you have any questions
Ahmed Hassan 2019-06-24T14:55:55.142800Z

Why this Keechma app is not able to run? https://gist.github.com/ahmed1hsn/7351ae6e1edaa64b9109ed19c8776af6

carkh 2019-06-24T15:08:46.143500Z

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

carkh 2019-06-24T15:10:03.144100Z

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

carkh 2019-06-24T15:12:22.144500Z

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

carkh 2019-06-24T15:13:08.145100Z

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

carkh 2019-06-24T15:13:15.145300Z

here is one i made for testing

carkh 2019-06-24T15:13:33.145400Z

carkh 2019-06-24T15:13:52.145900Z

no need to specify other fields than trhose required for normalisation

carkh 2019-06-24T15:15:07.146300Z

for now your params method shoudl just return true

carkh 2019-06-24T15:15:58.147200Z

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

carkh 2019-06-24T15:18:27.147900Z

here is the routes for this counters test app i made

carkh 2019-06-24T15:18:33.148Z

carkh 2019-06-24T15:19:16.148600Z

i wanted to always have a :page in my route

carkh 2019-06-24T15:19:28.148800Z

with counters being the default one

Ahmed Hassan 2019-06-24T17:42:52.149100Z

@carkh Thanks.

Ahmed Hassan 2019-06-24T18:01:43.149300Z

What defentitydb does exactly?

carkh 2019-06-24T18:20:31.149500Z

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

Ahmed Hassan 2019-06-24T18:29:19.150100Z

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

carkh 2019-06-24T18:30:42.150300Z

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

carkh 2019-06-24T18:30:49.150500Z

on the rest of your code i mean

carkh 2019-06-24T18:31:26.150700Z

though the fact that it's normalized already does that

Ahmed Hassan 2019-06-24T18:34:28.150900Z

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 Hassan 2019-06-24T18:34:57.151100Z

Perks of not having global application state.

carkh 2019-06-24T18:35:17.151300Z

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

carkh 2019-06-24T18:35:53.151500Z

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

carkh 2019-06-24T18:36:14.151800Z

oh but yes for different apps yes that can be done

Ahmed Hassan 2019-06-24T18:37:23.152Z

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

Ahmed Hassan 2019-06-24T18:38:20.152200Z

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

carkh 2019-06-24T18:38:58.152400Z

yes

carkh 2019-06-24T18:39:13.152600Z

depends on your use case

Ahmed Hassan 2019-06-24T18:39:44.152900Z

How does it help in facilitating data loading?

carkh 2019-06-24T18:40:38.153100Z

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

👍 1
carkh 2019-06-24T18:40:47.153300Z

normalising it

carkh 2019-06-24T18:41:30.153600Z

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

carkh 2019-06-24T18:42:31.153800Z

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

carkh 2019-06-24T18:42:58.154Z

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

carkh 2019-06-24T18:44:00.154200Z

that's the dalaloader that does this

carkh 2019-06-24T18:44:20.154400Z

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

Ahmed Hassan 2019-06-24T18:45:44.154600Z

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

carkh 2019-06-24T18:46:23.154800Z

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

carkh 2019-06-24T18:46:35.155Z

so you have the best of both worlds here

carkh 2019-06-24T18:46:57.155200Z

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