Skip to content

Instantly share code, notes, and snippets.

@cigitia
Last active January 27, 2016 21:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cigitia/8bcb34ffe6bda347f1d0 to your computer and use it in GitHub Desktop.
Save cigitia/8bcb34ffe6bda347f1d0 to your computer and use it in GitHub Desktop.
Examples of singleton idents being useful within data in the om.next default database format
(def db-1
{:ui.active-tab
[:ui.accounts-tab/by-id nil] ; May also be [:ui.post-tab/by-id :_2329cc] or [:ui.post-tab/by-id :_a73f92]
:ui.tab/order
[[:ui.post-tab/by-id :_2329cc] [:ui.accounts-tab/by-id nil] [:ui.post-tab/by-id :_a73f92]]
:ui.accounts-tab/by-id
{nil {:ui.accounts-tab/x "The accounts tab"}}
:ui.post-tab/by-id
{:_a73f92 {:ui.post-tab/x "A post"}}
:_2329cc {:ui.post-tab/x "Another post"}})
(def db-2
{:ui.active-tab
[:ui.accounts-tab/by-id '_] ; May also be [:ui.post-tab/by-id :_2329cc] or [:ui.post-tab/by-id :_a73f92]
:ui.tab/order
[[:ui.post-tab/by-id :_2329cc] [:ui.accounts-tab/by-id '_] [:ui.post-tab/by-id :_a73f92]]
:ui.accounts-tab/by-id
{:ui.accounts-tab/x "The accounts tab"}
:ui.post-tab/by-id
{:_a73f92 {:ui.post-tab/x "A post"}}
:_2329cc {:ui.post-tab/x "Another post"}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment