Skip to content

Commit 176824f

Browse files
authored
clj code blocks -> clojure code blocks
1 parent 61d16b5 commit 176824f

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

README.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ This library aims to extend the features of honeysql to support postgres specifi
4141
</dependency>
4242
```
4343
### REPL
44-
```clj
44+
```clojure
4545
(require '[honeysql.core :as sql]
4646
'[honeysql.helpers :refer :all]
4747
'[honeysql-postgres.helpers :as psqlh])
@@ -54,7 +54,7 @@ The query creation and usage is exactly the same as honeysql.
5454

5555
### upsert
5656
`upsert` can be written either way. You can make use of `do-update-set!` over `do-update-set`, if you want to modify the some column values in case of conflicts.
57-
```clj
57+
```clojure
5858
(-> (insert-into :distributors)
5959
(values [{:did 5 :dname "Gizmo Transglobal"}
6060
{:did 6 :dname "Associated Computing, Inc"}])
@@ -74,7 +74,7 @@ The query creation and usage is exactly the same as honeysql.
7474

7575
### insert into with alias
7676
`insert-into-as` can be used to write insert statements with table name aliased.
77-
```clj
77+
```clojure
7878
(-> (psqlh/insert-into-as :distributors :d)
7979
(values [{:did 5 :dname "Gizmo Transglobal"}
8080
{:did 6 :dname "Associated Computing, Inc"}])
@@ -88,7 +88,7 @@ The query creation and usage is exactly the same as honeysql.
8888

8989
### over
9090
You can make use of `over` to write window functions where it takes in vectors with aggregator functions and window functions along with optional alias like `(over [aggregator-function window-function alias])`, the can be coupled with the `window` clause to write window-function functions with alias that is later defines the window-function, like `(-> (over [aggregator-function :w]) (window :w window-function))`.
91-
```clj
91+
```clojure
9292
(-> (select :id)
9393
(psqlh/over
9494
[(sql/call :avg :salary) (-> (partition-by :department) (order-by [:designation])) :Average]
@@ -101,7 +101,7 @@ You can make use of `over` to write window functions where it takes in vectors w
101101

102102
### create view
103103
`create-view` can be used to create views
104-
```clj
104+
```clojure
105105
(-> (psqlh/create-view :metro)
106106
(select :*)
107107
(from :cities)
@@ -112,7 +112,7 @@ You can make use of `over` to write window functions where it takes in vectors w
112112

113113
### create table
114114
`create-table` and `with-columns` can be used to create tables along with the SQL functions, where `create-table` takes a table name as argument and `with-columns` takes a vector of vectors as argument, where the vectors describe the column properties as `[:column-name :datatype :constraints ... ]`.
115-
```clj
115+
```clojure
116116
(-> (psqlh/create-table :films)
117117
(psqlh/with-columns [[:code (sql/call :char 5) (sql/call :constraint :firstkey) (sql/call :primary-key)]
118118
[:title (sql/call :varchar 40) (sql/call :not nil)]
@@ -125,14 +125,14 @@ You can make use of `over` to write window functions where it takes in vectors w
125125

126126
### drop table
127127
`drop-table` is used to drop tables
128-
```clj
128+
```clojure
129129
(sql/format (psqlh/drop-table :cities :towns :vilages))
130130
=> ["DROP TABLE cities, towns, vilages"]
131131
```
132132

133133
### alter table
134134
use `alter-table` along with `add-column` & `drop-column` to modify table level details
135-
```clj
135+
```clojure
136136
(-> (psqlh/alter-table :employees)
137137
(psqlh/add-column :address :text)
138138
sql/format)
@@ -146,7 +146,7 @@ use `alter-table` along with `add-column` & `drop-column` to modify table level
146146

147147
### create-extension
148148
`create-extension` can be used to create extensions with a given keyword.
149-
```clj
149+
```clojure
150150
(-> (create-extension :uuid-ossp :if-not-exists? true)
151151
(sql/format :allow-dashed-names? true
152152
:quoting :ansi))
@@ -156,7 +156,7 @@ use `alter-table` along with `add-column` & `drop-column` to modify table level
156156

157157
### drop-extension
158158
`drop-extension` is used to drop extensions.
159-
```clj
159+
```clojure
160160
(-> (drop-extension :uuid-ossp)
161161
(sql/format :allow-dashed-names? true
162162
:quoting :ansi))
@@ -166,15 +166,15 @@ use `alter-table` along with `add-column` & `drop-column` to modify table level
166166
### pattern matching
167167
The `ilike` and `not-ilike` operators can be used to query data using a pattern matching technique.
168168
- like
169-
```clj
169+
```clojure
170170
(-> (select :name)
171171
(from :products)
172172
(where [:ilike :name "%name%"])
173173
sql/format)
174174
=> ["SELECT * FROM products WHERE name ILIKE ?" "%name%"]
175175
```
176176
- not-ilike
177-
```clj
177+
```clojure
178178
(-> (select :name)
179179
(from :products)
180180
(where [:not-ilike :name "%name%"])
@@ -183,7 +183,7 @@ The `ilike` and `not-ilike` operators can be used to query data using a pattern
183183
```
184184
### except
185185

186-
```clj
186+
```clojure
187187

188188
(sql/format
189189
{:except
@@ -196,56 +196,56 @@ The `ilike` and `not-ilike` operators can be used to query data using a pattern
196196
### SQL functions
197197
The following are the SQL functions added in `honeysql-postgres`
198198
- not
199-
```clj
199+
```clojure
200200
(sql/format (sql/call :not nil))
201201
=> ["NOT NULL"]
202202
```
203203
- primary-key
204-
```clj
204+
```clojure
205205
(sql/format (sql/call :primary-key))
206206
=> ["PRIMARY KEY"]
207207

208208
(sql/format (sql/call :primary-key :arg1 :arg2 ... ))
209209
=> ["PRIMARY KEY (arg1, arg2, ... )"]
210210
```
211211
- unique
212-
```clj
212+
```clojure
213213
(sql/format (sql/call :unique))
214214
=> ["UNIQUE"]
215215

216216
(sql/format (sql/call :unique :arg1 :arg2 ... ))
217217
=> ["UNIQUE (arg1, arg2, ... )"]
218218
```
219219
- foreign-key
220-
```clj
220+
```clojure
221221
(sql/format (sql/call :foreign-key))
222222
=> ["FOREIGN KEY"]
223223

224224
(sql/format (sql/call :foreign-key :arg1 :arg2 ... ))
225225
=> ["FOREIGN KEY (arg1, arg2, ... )"]
226226
```
227227
- references
228-
```clj
228+
```clojure
229229
(sql/format (sql/call :references :reftable :refcolumn))
230230
=> ["REFERENCES reftable(refcolumn)"]
231231
```
232232
- constraint
233-
```clj
233+
```clojure
234234
(sql/format (sql/call :constraint :name))
235235
=> ["CONSTRAINT name"]
236236
```
237237
- default
238-
```clj
238+
```clojure
239239
(sql/format (sql/call :default value))
240240
=> ["DEFAULT value"]
241241
```
242242
- nextval
243-
```clj
243+
```clojure
244244
(sql/format (sql/call :nextval value))
245245
=> ["nextval('value')"]
246246
```
247247
- check
248-
```clj
248+
```clojure
249249
(sql/format (sql/call :check [:= :a :b]))
250250
=> ["CHECK(a = b)"]
251251

0 commit comments

Comments
 (0)