| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Data dominates. If you’ve chosen the right data structures and organized things well, the algorithms will almost always be self-evident. Data structures, not algorithms, are central to programming. – Rob Pike
Bad programmers worry about the code. Good programmers worry about data structures and their relationships. – Linus Torvalds
Walkable is a serious way to fetch data from SQL for Clojure: Datomic® pull (Graphql-ish) syntax, Clojure flavored filtering and more.
Ever imagined sending queries like this to your SQL database?
{% mdtabs title="Query" %}
[{[:person/by-id 1]
[:person/id
:person/name
:person/age
{:person/pet [:pet/name :pet/favorite-location]}]}]{% mdtab title="Data" %} Table "person":
| id | name | age |
|---|---|---|
| 1 | Mary | 20 |
| 2 | John | 15 |
Table "pet":
| id | name | favorite_location |
|---|---|---|
| 10 | Tom | garden |
| 20 | Jerry | kitchen |
Table "person_pet":
| person_id | pet_id |
|---|---|
| 1 | 10 |
| 2 | 20 |
{% mdtab title="Result" %}
{[:person/by-id 1]
{:person/id 1
:person/name "Mary"
:person/age 20
:person/pet {:pet/name "Tom"
:pet/favorite-location "garden"}}}{% endmdtabs %}
or a bit more sophisticated:
{% mdtabs title="Query" %}
`[{(:articles/all {:filters [:and [:= false :article/hidden]
{:article/author [:= :user/username "lucy"]}]})
[:article/title
:article/created-date
{:article/author [:user/id :user/username :user/karma]}]}]{% mdtab title="Data" %} Table "article":
| id | title | author_id | hidden | created_date |
|---|---|---|---|---|
| 1 | Hello world | 10 | false | 2018-10-11 |
| 2 | Welcome | 20 | false | 2018-11-10 |
| 3 | Unfinished | 20 | true | 2018-09-20 |
Table "user":
| id | username | karma |
|---|---|---|
| 10 | mark | 21 |
| 20 | lucy | 42 |
{% mdtab title="Result" %}
[{:articles/all
[{:article/title "Welcome"
:article/created-date "2018-11-10"
:article/author {:user/id 20
:user/username "lucy"
:user/karma 42}}]}]{% endmdtabs %}
Yes, you can. Have your data fetched in your Clojure mission critical app with confidence. Even more, build the query part of a fulcro server or REST api in minutes today! Call it from your Clojurescript app without worrying about SQL injection.
You can learn about the above query language here
{% hint style="info" %}
People may have the impression that Walkable (and Pathom) is specific to om.next. That is NOT the case! Walkable requires a query language that is expressive and based off data structure. Om.next's EDN query language (EQL) happens to satisfy that.
Walkable's goal is to become the ultimate SQL library for buiding APIs.
{% endhint %}
Walkable comes with some optimizations:
More optimization will be added. Check github issues for progress.
Currently Walkable only takes care of reading from the database, NOT
making mutations to it. I think it varies from applications to
applications. If you can think of any pattern of doing it, please
open an issue.
I'm available for questions on #walkable clojurians channel. I'm also on #fulcro and Clojureverse
Copyright © 2018 - 2019 Hoàng Minh Thắng
Datomic® is a registered trademark of Cognitect, Inc.
| Back | FazBrowse Home | New Git URL |