Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/federkasten/kormas
Utility functions for Korma (A Clojure Library for Tasty SQL)
https://github.com/federkasten/kormas
Last synced: 22 days ago
JSON representation
Utility functions for Korma (A Clojure Library for Tasty SQL)
- Host: GitHub
- URL: https://github.com/federkasten/kormas
- Owner: federkasten
- License: apache-2.0
- Created: 2014-11-10T09:32:32.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-11-08T00:17:03.000Z (almost 9 years ago)
- Last Synced: 2024-07-27T08:02:57.713Z (3 months ago)
- Language: Clojure
- Size: 203 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# kormas
Utility functions for [Korma (A Clojure Library for Tasty SQL)][korma]
```
[kormas "0.1.1"]
```## Usage
```clojure
(require '[kormas.core :refer [definit mysql-db-config]])
(require '[kormas.util :refer [swap transform-key]])
``````clojure
(definit db-init
[user password];; db
(defdb main-db
(mysql (mysql-db-config {:user user
:password password
:host "localhost"
:db "mydb"})));; entities
(defentity myuser
(database main-db)
(prepare (fn [v]
(-> v
(swap :status keyword)
(swap :enable #(= 0 %)))))
(transform (fn [v]
(-> v
(swap :status str)
(swap :enable #(if % 0 1)))))))
```## License
Copyright [Takashi AOKI][tak.sh]
Licensed under the [Apache License, Version 2.0][apache-license-2.0].
[korma]: http://sqlkorma.com/
[tak.sh]: http://tak.sh
[apache-license-2.0]: http://www.apache.org/licenses/LICENSE-2.0.html