(defprofile lagénorhynque
:id @lagenorhynque
:reading "/laʒenɔʁɛ̃k/"
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
| user> (require '[clojure.spec.alpha :as s] | |
| '[clojure.spec.test.alpha :as stest]) | |
| nil | |
| user> (s/def :contact/name string?) | |
| :contact/name | |
| user> (s/def :contact-info/type keyword?) | |
| :contact-info/type | |
| user> (s/def :contact-info/email-contact-info string?) | |
| :contact-info/email-contact-info | |
| user> (s/def :contact-info/postal-contact-info string?) |
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
| dev> (let [count (volatile! 0) | |
| t1 (Thread. #(dotimes [_ 1000] (vswap! count inc))) | |
| t2 (Thread. #(dotimes [_ 1000] (vswap! count inc)))] | |
| (.start t1) | |
| (.start t2) | |
| (.join t1) | |
| (.join t2) | |
| @count) | |
| 1577 | |
| dev> (let [count (atom 0) |
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
| {-# LANGUAGE NamedFieldPuns #-} | |
| module Model where | |
| data User = User { firstName :: !String | |
| , lastName :: !String | |
| } | |
| deriving Show | |
| fullName :: User -> String |
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
| dev> (q #:venia{:operation #:operation{:type :query | |
| :name "MemberById"} | |
| :variables [#:variable{:type :ID! | |
| :name "id"}] | |
| :queries [[:member_by_id {:id :$id} | |
| [:member_name | |
| [:ratings [[:game [:name | |
| [:rating_summary [:count | |
| :average]] | |
| [:designers [:name |
(defprofile lagénorhynque
:aliases [カマイルカ🐬]
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
| lagenorhynchus@lagenorhynque-mbp:code$ mkdir hy-playground | |
| lagenorhynchus@lagenorhynque-mbp:code$ cd hy-playground/ | |
| lagenorhynchus@lagenorhynque-mbp:hy-playground$ pipenv install hy | |
| Creating a virtualenv for this project… | |
| Pipfile: /Users/lagenorhynchus/code/hy-playground/Pipfile | |
| Using /usr/local/Cellar/pipenv/2018.11.26/libexec/bin/python3.7 (3.7.2) to create virtualenv… | |
| ⠇ Creating virtual environment...Already using interpreter /usr/local/Cellar/pipenv/2018.11.26/libexec/bin/python3.7 | |
| Using real prefix '/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7' | |
| New python executable in /Users/lagenorhynchus/.local/share/virtualenvs/hy-playground-K-WGms8b/bin/python3.7 | |
| Also creating executable in /Users/lagenorhynchus/.local/share/virtualenvs/hy-playground-K-WGms8b/bin/python |
今年9月のShibuya.lisp lispmeetup #68で「Interceptors: Into the Core of Pedestal」と題してClojureのサービス/API開発ライブラリ"Pedestal"を簡単に紹介する発表をしました。
最近、Webアプリ開発の仕事でプロジェクトの基盤構築にDuct、API機能開発にPedestalという構成でClojureによるREST APIを開発していて、個人的にもなかなか便利だと感じています。
そこで今回はこのPedestalについて、ちょうど日本語情報も見当たらないので簡単にまとめてみます。
GitHubリポジトリのREADMEには
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
| (t/deftest test-list-users | |
| (with-system [sys (helper/test-system)] | |
| (with-db-data [sys {:user db-data/user}] | |
| (t/testing "ユーザの一覧が取得できる" | |
| (t/testing "ユーザ名指定あり" | |
| (let [{:keys [status body]} | |
| (helper/http-post sys "/graphql" | |
| (venia/graphql-query | |
| {:venia/queries [[:users {:name "曜"} | |
| [:id |