This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(db/transact {:post/title "5 things you should know about Coast on Clojure" | |
:post/id 1}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(db/transact {:post/title "3 things you should know about Coast on Clojure" | |
:post/body "1. It's great. 2. It's tremendous. 3. It's making web development fun again." | |
:post/author-id 2}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(db/pull '[author/id | |
author/email | |
author/name | |
{(:author/posts :order post/created-at desc | |
:limit 10) [post/id | |
post/title | |
post/body]}] | |
[:author/name "Cody Coast"]) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(db/pull '[author/id | |
author/email | |
author/name | |
{:author/posts [post/title | |
post/body]}] | |
[:author/name "Cody Coast"]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(db/q '[:pull [author/id | |
author/email | |
author/name | |
{:author/posts [post/title | |
post/body]}] | |
:where [author/name ?author/name]] | |
{:author/name "Cody Coast"}) | |
; => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns your-project | |
(:require [coast.db :as db])) | |
(db/q '[:select author/id | |
author/name | |
post/id | |
post/title | |
post/body | |
:joins author/posts | |
:where [author/name ?author/name] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{:db/ident :author/email | |
:db/type "text"} | |
{:db/ident :author/name | |
:db/type "text"} | |
{:db/rel :author/posts | |
:db/type :many | |
:db/joins :post/author} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns core | |
(:require [clojure.string :as string] | |
[markdown.core :as md] | |
[clojure.java.io :as io] | |
[clojure.data.xml :as xml])) | |
(def pattern #"__([\w-]+)__") | |
(defn replacement [match m] | |
(let [fallback (first match) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns switch | |
(:require [clojure.pprint :as pprint])) | |
(defn project-clj-map [filename] | |
(->> (slurp filename) | |
(read-string) | |
(drop 1) | |
(partition 2) | |
(map vec) | |
(into {}))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns your-proj.views.posts | |
(:require [your-proj.components :as c] | |
[coast.core :as coast])) | |
(defn post [m] | |
(let [{:keys [id title body created-at]} m] | |
[:tr | |
[:td id] | |
[:td title] | |
[:td body] |