-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathio.randomseed.utils.db.coercion.html
More file actions
219 lines (219 loc) · 96.6 KB
/
io.randomseed.utils.db.coercion.html
File metadata and controls
219 lines (219 loc) · 96.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>io.randomseed.utils.db.coercion documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="css/highlight.css" /><script type="text/javascript" src="js/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script><link rel="stylesheet" type="text/css" href="css/randomseed.css" /></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a></h2><h1><a href="index.html"><span class="project-title"><span class="project-name">Random:utils</span> <span class="project-version">2.0.11</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="10_introduction.html"><div class="inner"><span>Introduction</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>io</span></div></div></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>randomseed</span></div></div></li><li class="depth-3"><a href="io.randomseed.utils.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>utils</span></div></a></li><li class="depth-4"><a href="io.randomseed.utils.auth.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>auth</span></div></a></li><li class="depth-5"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>algo</span></div></div></li><li class="depth-6 branch"><a href="io.randomseed.utils.auth.algo.append.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>append</span></div></a></li><li class="depth-6 branch"><a href="io.randomseed.utils.auth.algo.fail.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>fail</span></div></a></li><li class="depth-6 branch"><a href="io.randomseed.utils.auth.algo.pbkdf2.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>pbkdf2</span></div></a></li><li class="depth-6"><a href="io.randomseed.utils.auth.algo.scrypt.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>scrypt</span></div></a></li><li class="depth-5 branch"><a href="io.randomseed.utils.auth.locking.html"><div class="inner"><span class="tree" style="top: -145px;"><span class="top" style="height: 154px;"></span><span class="bottom"></span></span><span>locking</span></div></a></li><li class="depth-5 branch"><a href="io.randomseed.utils.auth.pwd.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>pwd</span></div></a></li><li class="depth-5 branch"><a href="io.randomseed.utils.auth.specs.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>specs</span></div></a></li><li class="depth-5"><a href="io.randomseed.utils.auth.types.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>types</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.utils.bot.html"><div class="inner"><span class="tree" style="top: -300px;"><span class="top" style="height: 309px;"></span><span class="bottom"></span></span><span>bot</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.utils.bus.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>bus</span></div></a></li><li class="depth-4"><a href="io.randomseed.utils.crypto.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>crypto</span></div></a></li><li class="depth-5"><a href="io.randomseed.utils.crypto.codecs.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>codecs</span></div></a></li><li class="depth-4"><a href="io.randomseed.utils.db.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-5 branch current"><a href="io.randomseed.utils.db.coercion.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>coercion</span></div></a></li><li class="depth-5 branch"><a href="io.randomseed.utils.db.sql.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>sql</span></div></a></li><li class="depth-5"><a href="io.randomseed.utils.db.types.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>types</span></div></a></li><li class="depth-6 branch"><a href="io.randomseed.utils.db.types.identity.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>identity</span></div></a></li><li class="depth-6"><a href="io.randomseed.utils.db.types.ip.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>ip</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.utils.fs.html"><div class="inner"><span class="tree" style="top: -176px;"><span class="top" style="height: 185px;"></span><span class="bottom"></span></span><span>fs</span></div></a></li><li class="depth-4"><a href="io.randomseed.utils.identity.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>identity</span></div></a></li><li class="depth-5 branch"><a href="io.randomseed.utils.identity.proto.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>proto</span></div></a></li><li class="depth-5"><a href="io.randomseed.utils.identity.types.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>types</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.utils.ip.html"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>ip</span></div></a></li><li class="depth-4"><a href="io.randomseed.utils.log.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>log</span></div></a></li><li class="depth-5"><a href="io.randomseed.utils.log.logback.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>logback</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.utils.map.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>map</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.utils.nop-cache.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>nop-cache</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.utils.qe.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>qe</span></div></a></li><li class="depth-4"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>reitit</span></div></div></li><li class="depth-5"><a href="io.randomseed.utils.reitit.http.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>http</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.utils.set.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>set</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.utils.time.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>time</span></div></a></li><li class="depth-4"><a href="io.randomseed.utils.validators.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>validators</span></div></a></li><li class="depth-5"><a href="io.randomseed.utils.validators.common.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>common</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.utils.var.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>var</span></div></a></li><li class="depth-4"><a href="io.randomseed.utils.vec.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>vec</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var--.3E"><div class="inner"><span>-></span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var--.3EQSlot"><div class="inner"><span>->QSlot</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-.3C-"><div class="inner"><span><-</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-.3C-seq"><div class="inner"><span><-seq</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-.3C.3C-"><div class="inner"><span><<-</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-.3C.3C-*"><div class="inner"><span><<-*</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-.3Cd-do.21"><div class="inner"><span><d-do!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-.3Cd-exec.21"><div class="inner"><span><d-exec!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-.3Cd-exec-one.21"><div class="inner"><span><d-exec-one!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-.3Cdo.21"><div class="inner"><span><do!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-.3Cdq"><div class="inner"><span><dq</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-.3Cexec.21"><div class="inner"><span><exec!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-.3Cexec-one.21"><div class="inner"><span><exec-one!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-.3Cq"><div class="inner"><span><q</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-bindable-sym"><div class="inner"><span>bindable-sym</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-bindable-sym.3F"><div class="inner"><span>bindable-sym?</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-cache-create"><div class="inner"><span>cache-create</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-cache-evict.21"><div class="inner"><span>cache-evict!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-cache-lookup"><div class="inner"><span>cache-lookup</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-cache-lookup-coll"><div class="inner"><span>cache-lookup-coll</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-cache-prepare"><div class="inner"><span>cache-prepare</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-coerce-in"><div class="inner"><span>coerce-in</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-coerce-in*"><div class="inner"><span>coerce-in*</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-coerce-out"><div class="inner"><span>coerce-out</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-coerce-out*"><div class="inner"><span>coerce-out*</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-coerce-seq-in"><div class="inner"><span>coerce-seq-in</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-coerce-seq-in*"><div class="inner"><span>coerce-seq-in*</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-coerce-seq-out"><div class="inner"><span>coerce-seq-out</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-coerce-seq-out*"><div class="inner"><span>coerce-seq-out*</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-data-source.3F"><div class="inner"><span>data-source?</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-defcoercions"><div class="inner"><span>defcoercions</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-execute.21"><div class="inner"><span>execute!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-execute-one.21"><div class="inner"><span>execute-one!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-for-insert-multi-or"><div class="inner"><span>for-insert-multi-or</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-for-insert-or"><div class="inner"><span>for-insert-or</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-for-replace"><div class="inner"><span>for-replace</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-for-replace-multi"><div class="inner"><span>for-replace-multi</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-gen-builder"><div class="inner"><span>gen-builder</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-gen-builder-delayed"><div class="inner"><span>gen-builder-delayed</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-gen-qs-keyword"><div class="inner"><span>gen-qs-keyword</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-get-cached"><div class="inner"><span>get-cached</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-get-cached-coll"><div class="inner"><span>get-cached-coll</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-get-cached-coll-prop"><div class="inner"><span>get-cached-coll-prop</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-get-cached-prop"><div class="inner"><span>get-cached-prop</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-get-cached-prop-or-default"><div class="inner"><span>get-cached-prop-or-default</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-get-failed.3F"><div class="inner"><span>get-failed?</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-get-id"><div class="inner"><span>get-id</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-get-ids"><div class="inner"><span>get-ids</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-get-in-coercer"><div class="inner"><span>get-in-coercer</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-get-in-coercer*"><div class="inner"><span>get-in-coercer*</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-get-out-coercer"><div class="inner"><span>get-out-coercer</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-get-out-coercer*"><div class="inner"><span>get-out-coercer*</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-id-from-db"><div class="inner"><span>id-from-db</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-id-to-db"><div class="inner"><span>id-to-db</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-in-coercer"><div class="inner"><span>in-coercer</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-insert-multi-or.21"><div class="inner"><span>insert-multi-or!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-insert-or.21"><div class="inner"><span>insert-or!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-insert-or-ignore.21"><div class="inner"><span>insert-or-ignore!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-insert-or-ignore-multi.21"><div class="inner"><span>insert-or-ignore-multi!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-insert-or-replace.21"><div class="inner"><span>insert-or-replace!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-insert-or-replace-multi.21"><div class="inner"><span>insert-or-replace-multi!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-invalidate.21"><div class="inner"><span>invalidate!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-invalidate.2B.21"><div class="inner"><span>invalidate+!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-invalidator"><div class="inner"><span>invalidator</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-lazy-do"><div class="inner"><span>lazy-do</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-lazy-execute.21"><div class="inner"><span>lazy-execute!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-lazy-execute-one.21"><div class="inner"><span>lazy-execute-one!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-lazy-get-by-id"><div class="inner"><span>lazy-get-by-id</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-make-deleter"><div class="inner"><span>make-deleter</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-make-getter"><div class="inner"><span>make-getter</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-make-getter-coll"><div class="inner"><span>make-getter-coll</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-make-setter"><div class="inner"><span>make-setter</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-make-setting-deleter"><div class="inner"><span>make-setting-deleter</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-make-setting-getter"><div class="inner"><span>make-setting-getter</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-make-setting-setter"><div class="inner"><span>make-setting-setter</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-map-.3E"><div class="inner"><span>map-></span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-map-.3EQSlot"><div class="inner"><span>map->QSlot</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-memoize"><div class="inner"><span>memoize</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-memoize.2B"><div class="inner"><span>memoize+</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-memoizer"><div class="inner"><span>memoizer</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-not-found.3F"><div class="inner"><span>not-found?</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-opts-lazy-map"><div class="inner"><span>opts-lazy-map</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-opts-lazy-simple-map"><div class="inner"><span>opts-lazy-simple-map</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-opts-lazy-simple-vec"><div class="inner"><span>opts-lazy-simple-vec</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-opts-lazy-slashed-map"><div class="inner"><span>opts-lazy-slashed-map</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-opts-lazy-slashed-vec"><div class="inner"><span>opts-lazy-slashed-vec</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-opts-lazy-vec"><div class="inner"><span>opts-lazy-vec</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-opts-map"><div class="inner"><span>opts-map</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-opts-simple-map"><div class="inner"><span>opts-simple-map</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-opts-simple-vec"><div class="inner"><span>opts-simple-vec</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-opts-slashed-map"><div class="inner"><span>opts-slashed-map</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-opts-slashed-vec"><div class="inner"><span>opts-slashed-vec</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-opts-vec"><div class="inner"><span>opts-vec</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-out-coercer"><div class="inner"><span>out-coercer</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-replace.21"><div class="inner"><span>replace!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-replace-multi.21"><div class="inner"><span>replace-multi!</span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-seq-.3E"><div class="inner"><span>seq-></span></div></a></li><li class="depth-1"><a href="io.randomseed.utils.db.coercion.html#var-simple-.3E"><div class="inner"><span>simple-></span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">io.randomseed.utils.db.coercion</h1><h4 class="added">added in 2.0.9</h4><div class="doc"><div class="markdown"><p>Random Utilities, databases coercers.</p>
</div></div><div class="public anchor" id="var--.3E"><h3>-></h3><div class="usage"><code>(-> table column v)</code><code>(-> table-column v)</code></div><div class="doc"><div class="markdown"><p>Coerces value <code>v</code> from a database type by calling a function returned by invoking <code>io.randomseed.utils.db/out-coercer</code> multimethod on a qualified keyword <code>table-column</code> (or a qualified keyword made out of <code>table</code> and <code>column</code>). If there is no coercer attached for the keyword, returns unchanged <code>v</code>.</p>
<p>If a coercer can be obtained at compile-time, a coercion function-call form will be generated. If a coercer can be obtained at compile-time and the given value is statically convertable, value resulting from applying coercion function will be generated immediately.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L249">view source</a></div></div><div class="public anchor" id="var--.3EQSlot"><h3>->QSlot</h3><div class="usage"><code>(->QSlot t c v)</code></div><div class="doc"><div class="markdown"><p>Positional factory function for class io.randomseed.utils.db.coercion.QSlot.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L331">view source</a></div></div><div class="public anchor" id="var-.3C-"><h3><-</h3><h4 class="type">macro</h4><div class="usage"><code>(<- table column v)</code><code>(<- table-column v)</code></div><div class="doc"><div class="markdown"><p>Coerces value <code>v</code> to a database type by calling a function returned by invoking <code>io.randomseed.utils.db/in-coercer</code> multimethod on a qualified keyword <code>table-column</code> (or a qualified keyword made out of <code>table</code> and <code>column</code>). If there is no coercer attached for the keyword, returns unchanged <code>v</code>.</p>
<p>If a coercer can be obtained at compile-time, a coercion function-call form will be generated. If a coercer can be obtained at compile-time and the given value is statically convertable, value resulting from applying coercion function will be generated immediately.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L215">view source</a></div></div><div class="public anchor" id="var-.3C-seq"><h3><-seq</h3><h4 class="type">macro</h4><div class="usage"><code>(<-seq table column coll)</code><code>(<-seq table-column coll)</code></div><div class="doc"><div class="markdown"><p>Coerces a sequence of values <code>coll</code> to database types by calling a function returned by invoking <code>io.randomseed.utils.db/in-coercer</code> multimethod on a qualified keyword <code>table-column</code> (or a qualified keyword made out of <code>table</code> and <code>column</code>). If there is no coercer attached for the keyword, returns unchanged <code>coll</code>.</p>
<p>If both, a table and a column can be used to establish coercion function at compile-time, a mapping form will be generated which uses that function.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L283">view source</a></div></div><div class="public anchor" id="var-.3C.3C-"><h3><<-</h3><h4 class="type">macro</h4><div class="usage"><code>(<<- & specs)</code></div><div class="doc"><div class="markdown"><p>Magical macro which converts a sequence of values with optional table and column specifications to a database-suitable formats. Pre-processing of arguments is executed at compile-time, further processing is performed at run-time.</p>
<p>Any type of argument is accepted but literal vectors, including nested vectors, are <strong>control structures</strong>. Their first elements are table names (for the first one), column names (for nested vectors) or both (when expressed using fully-qualified keywords).</p>
<p>Example: <code>(<<- 1 2 3 [:table-name [:column-name :val1 val2 (exp3) "val4"])</code></p>
<p><code>1</code>, <code>2</code> and <code>3</code> are regular values, <code>:table-name</code> is literally expressed table name for coercer, <code>:column-name</code> is literally expressed column name for coercer, other expressions are values to be coerced. Table and column names can be dynamic, expressed with symbols or call forms.</p>
<p>All macro arguments are sequentially transformed with the following rules:</p>
<ul>
<li>
<p>If there is a <strong>literal vector</strong> at <strong>1st level</strong>, its first element should be a table name. All elements of that vector will inherit that table name during conversion to a database-suitable format.</p>
</li>
<li>
<p>If there is a <strong>literal vector</strong> nested within existing vector its first element will be considered a <strong>column name</strong>. All elements of that vector will inherit that column name during conversion to a database-suitable format.</p>
</li>
<li>
<p>If the given literal vector contains a <strong>fully-qualified keyword</strong> at its first position then both <strong>table</strong> and <strong>column</strong> will be memorized to be applied during conversion of elements contained in that vector (table taken from a namespace and column from a name of the keyword).</p>
</li>
<li>
<p>If there is a table name inherited but no column specified, a value is not converted but returned as is, with the exception: when the value is expressed as a <strong>literal, simple symbol</strong> then a column name will be derived from its name.</p>
</li>
<li>
<p>A sub-vector may begin with an unspecified value <code>nil</code>. In such case it will group values to be converted but column name will not be set. The values will be left unconverted unless they are simple symbol forms; in such case column names will be derived from their names.</p>
</li>
</ul>
<p>Values used to set column and table names at the beginnings of vectors can be expressed with any valid code. However, literal strings or literal keywords (or symbols in case of identifier-derived column names) will be pre-processed at compile time. So, if both column and table name are expressed that way, the conversion specifier will be generated ahead.</p>
<p>Moreover, if apart from the above, a value to be coerced is expressed as a literal number, string, keyword, boolean, or a <code>nil</code>, it will be converted at compile-time.</p>
<p>Conversion of repeating atomic expressions sharing the same table and column name identifiers (including symbolic identifiers) will be performed in ad-hoc created <code>let</code> block, and the results will be referenced using auto-generated symbols replacing the original expressions. Therefore, conversion for repeated symbols (and other atomic expressions) will be performed just once.</p>
<p>Examples:</p>
<p><code>(<<- [:users [:id id] [:email email]])</code></p>
<p>The above will convert values expressed by <code>id</code> and <code>email</code> symbol forms using a variant of coercion multimethod registered for <code>:users/id</code> and <code>:users/email</code> keywords, accordingly.</p>
<p><code>(<<- [:users/id id [:email e]])</code></p>
<p>The above will convert values of <code>id</code> and <code>e</code> symbol forms using a variant of coercion multimethod registered for <code>:users/id</code> and <code>:users/email</code> keywords, accordingly.</p>
<p><code>(<<- [:users [:id id] [:confirmations/email email [:expires expires]])</code></p>
<p>The above will convert values of <code>id</code>, <code>email</code> and <code>expires</code> symbol forms using a variant of coercion multimethod registered for <code>:users/id</code>, <code>:confirmations/email</code>, and <code>:confirmations/expires</code> keywords, accordingly. We can see that second vector changes the table name to <code>confirmations</code> in its scope so later <code>expires</code> derives it and is converted with <code>:confirmations/expires</code> specification.</p>
<p>This is synonymous to:</p>
<p><code>(<<- [:users id] [:confirmations email expires])</code></p>
<p>As we can see, the <code>id</code> symbolic identifier is used to set the column name, same as <code>email</code> and <code>expires</code> symbols. The above code will be expanded to:</p>
<pre><code>[(io.randomseed.utils.db/<- :users/id id)
(io.randomseed.utils.db/<- :confirmations/email email)
(io.randomseed.utils.db/<- :confirmations/expires expires)]
</code></pre>
<p>And then to:</p>
<pre><code>[(#<Fn@4d7e49d myapp.model.user/id_to_db> id)
(io.randomseed.utils.db/coerce-in* :confirmations/email email)
(#<Fn@3bf6fdc6 myapp.model.confirmation/to_expiry> expires)]
</code></pre>
<p>We can see that coercers for <code>id</code> and <code>expires</code> symbols were resolved and function call forms were created at compile-time. That’s because <code>:users/id</code> and <code>:confirmations/expires</code> were recognized as existing dispatch values when calling <code>in-coercer</code> internally. A coercer for the <code>email</code> symbol (using <code>:confirmations/email</code> dispatch value) was not recognized at compile-time so the call to <code>io.randomseed.utils.db/coerce-in*</code> was generated instead.</p>
<p>Let’s have a quick look at some real-world example:</p>
<pre><code>(io.randomseed.utils.db/<<- [:confirmations id code token reason id-type expires id id])
</code></pre>
<p>And generated Clojure code (phase 1):</p>
<pre><code>(let [DB__confirmations_id_id_54377141 (io.randomseed.utils.db/<- :confirmations/id id)]
[DB__confirmations_id_id_54377141
(io.randomseed.utils.db/<- :confirmations/code code)
(io.randomseed.utils.db/<- :confirmations/token token)
(io.randomseed.utils.db/<- :confirmations/reason reason)
(io.randomseed.utils.db/<- :confirmations/id-type id-type)
(io.randomseed.utils.db/<- :confirmations/expires expires)
DB__confirmations_id_id_54377141
DB__confirmations_id_id_54377141])
</code></pre>
<p>And fully expanded:</p>
<pre><code>(let* [DB__confirmations_id_id_54377141 (#<Fn@5a424a5a io.randomseed.utils.identity/__GT_db> id)]
[DB__confirmations_id_id_54377141
(#<Fn@279d4dd9 io.randomseed.utils/safe_parse_long> code)
(#<Fn@7f1abd95 io.randomseed.utils/some_str> token)
(#<Fn@7f1abd95 io.randomseed.utils/some_str> reason)
(#<Fn@7f1abd95 io.randomseed.utils/some_str> id-type)
(#<Fn@4ac5d426 myapp.model.confirmation/to_expiry> expires)
DB__confirmations_id_id_54377141
DB__confirmations_id_id_54377141])
</code></pre>
<p>A SQL query which uses the sequence of values presented above needs one of them (identified with the <code>id</code>) to be repeated. We can observe that the macro generated <code>let</code> binding for it to assign the result of calling <code>io.randomseed.utils.identity/->db</code> on <code>id</code> to auto-generated symbol named <code>DB__confirmations_id_id_54377141</code>. This symbol is then re-used in output vector multiple times so the calculation is performed just once.</p>
<p>Also, other coercers were successfully resolved to function objects during macro expansion since we have static table and column specifiers given.</p>
<p>Rule of a thumb is: if you can express certain values or specifications with literal strings or keywords, it may speed things up.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L497">view source</a></div></div><div class="public anchor" id="var-.3C.3C-*"><h3><<-*</h3><h4 class="type">macro</h4><div class="usage"><code>(<<-* spec)</code><code>(<<-* spec & specs)</code></div><div class="doc"><div class="markdown"><p>Same as <code><<-</code> but its last argument should be a sequence to be concatenated with the results without any pre-processing.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L656">view source</a></div></div><div class="public anchor" id="var-.3Cd-do.21"><h3><d-do!</h3><h4 class="type">macro</h4><div class="usage"><code>(<d-do! f db query & params)</code></div><div class="doc"><div class="markdown"><p>Calls function <code>f</code>, passing <code>db</code> as a first argument and a sequence of: - a query (being a result of transforming <code>query</code> with <code>io.randomseed.utils.db.sql/build-query-dynamic</code>), - coerced parameters (being a result of transforming <code>params</code> with <code><<-</code>).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L874">view source</a></div></div><div class="public anchor" id="var-.3Cd-exec.21"><h3><d-exec!</h3><h4 class="type">macro</h4><div class="usage"><code>(<d-exec! db query & params)</code></div><div class="doc"><div class="markdown"><p>Calls <code>execute!</code>, passing <code>db</code> as a first argument and a sequence of: - a query (being a result of transforming <code>query</code> with <code>io.randomseed.utils.db.sql/build-query-dynamic</code>), - coerced parameters (being a result of transforming <code>params</code> with <code><<-</code>).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L881">view source</a></div></div><div class="public anchor" id="var-.3Cd-exec-one.21"><h3><d-exec-one!</h3><h4 class="type">macro</h4><div class="usage"><code>(<d-exec-one! db query & params)</code></div><div class="doc"><div class="markdown"><p>Calls <code>execute-one!</code>, passing <code>db</code> as a first argument and a sequence of: - a query (being a result of transforming <code>query</code> with <code>io.randomseed.utils.db.sql/build-query-dynamic</code>), - coerced parameters (being a result of transforming <code>params</code> with <code><<-</code>).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L888">view source</a></div></div><div class="public anchor" id="var-.3Cdo.21"><h3><do!</h3><h4 class="type">macro</h4><div class="usage"><code>(<do! f db query & params)</code></div><div class="doc"><div class="markdown"><p>Calls function <code>f</code> passing <code>db</code> as a first argument and a sequence of: - a query (being a result of transforming <code>query</code> with <code>io.randomseed.utils.db.sql/build-query</code>), - coerced parameters (being a result of transforming <code>params</code> with <code><<-</code>).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L895">view source</a></div></div><div class="public anchor" id="var-.3Cdq"><h3><dq</h3><h4 class="type">macro</h4><div class="usage"><code>(<dq query & params)</code></div><div class="doc"><div class="markdown"><p>Simple wrapper around <code>io.randomseed.utils.db.sql/build-query-dynamic</code> and <code><<-</code> macros. First argument should be a query (possibly grouped with a vector, if multiple arguments need to be passed), all other arguments are passed to <code><<-</code>.</p>
<p>Produces a sequence suitable to be used with <code>execute-*</code> family of functions (a parameterized query as its first element and coerced query parameters as other elements).</p>
<p>Intended to be used for dynamically generated database queries. Uses a bit slower but safer FIFO cache of default size (about 150k items).</p>
<p>Example:</p>
<pre><code>(<q ["select %(id) from %[u] where %(id) = ? AND %(t) = ?"
{:id :users/id, :u :users/id, :t :users/account-type}]
[:users [:id "42"] [:account-type :user]])
</code></pre>
<p>The above will return:</p>
<pre><code>("select `id` from `users` where `id` = ? AND `account_type` = ?" 42 "user")
</code></pre>
<p>Note that <code>"42"</code> and <code>:user</code> are values which are to be coerced (first with a coercer registered for <code>:users/id</code> and second with a coercer registered for <code>:users/account-type</code>). After the coercion resulting values (<code>42</code> and <code>"user"</code>) are placed in a sequence to become query parameters.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L841">view source</a></div></div><div class="public anchor" id="var-.3Cexec.21"><h3><exec!</h3><h4 class="type">macro</h4><div class="usage"><code>(<exec! db query & params)</code></div><div class="doc"><div class="markdown"><p>Calls <code>execute!</code>, passing <code>db</code> as a first argument and a sequence of: - a query (being a result of transforming <code>query</code> with <code>io.randomseed.utils.db.sql/build-query</code>), - coerced parameters (being a result of transforming <code>params</code> with <code><<-</code>).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L902">view source</a></div></div><div class="public anchor" id="var-.3Cexec-one.21"><h3><exec-one!</h3><h4 class="type">macro</h4><div class="usage"><code>(<exec-one! db query & params)</code></div><div class="doc"><div class="markdown"><p>Calls <code>execute-one!</code>, passing <code>db</code> as a first argument and a sequence of: - a query (being a result of transforming <code>query</code> with <code>io.randomseed.utils.db.sql/build-query</code>), - coerced parameters (being a result of transforming <code>params</code> with <code><<-</code>).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L909">view source</a></div></div><div class="public anchor" id="var-.3Cq"><h3><q</h3><h4 class="type">macro</h4><div class="usage"><code>(<q query & params)</code></div><div class="doc"><div class="markdown"><p>Simple wrapper around <code>io.randomseed.utils.db.sql/build-query</code> and <code><<-</code> macros. First argument should be a query (possibly grouped with a vector, if multiple arguments need to be passed), all other arguments are passed to <code><<-</code>.</p>
<p>Produces a sequence suitable to be used with <code>execute-*</code> family of functions (a parameterized query as its first element and coerced query parameters as other elements).</p>
<p>Example:</p>
<pre><code>(<q ["select %(id) from %[u] where %(id) = ? AND %(t) = ?"
{:id :users/id, :u :users/id, :t :users/account-type}]
[:users [:id "42" :account-type :user]])
</code></pre>
<p>The above will return:</p>
<pre><code>("select `id` from `users` where `id` = ? AND `account_type` = ?" 42 "user")
</code></pre>
<p>Note that <code>"42"</code> and <code>:user</code> are values which are to be coerced (first with a coercer registered for <code>:users/id</code> and second with a coercer registered for <code>:users/account-type</code>). After the coercion resulting values (<code>42</code> and <code>"user"</code>) are placed in a sequence to become query parameters.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L811">view source</a></div></div><div class="public anchor" id="var-bindable-sym"><h3>bindable-sym</h3><div class="usage"><code>(bindable-sym bindings qs v)</code></div><div class="doc"><div class="markdown"><p>Returns a bindable, auto-generated symbol for the table/column (from <code>qs</code>, which should be a <code>QSlot</code> record) and a value <code>v</code>. The unique identifier (obtained using <code>gen-qs-keyword</code>) must exists in <code>bindings</code> map. Otherwise, <code>nil</code> is returned.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L456">view source</a></div></div><div class="public anchor" id="var-bindable-sym.3F"><h3>bindable-sym?</h3><div class="usage"><code>(bindable-sym? bindings qs v)</code></div><div class="doc"><div class="markdown"><p>Returns <code>true</code> if a bindable, auto-generated symbol for the table/column (from <code>qs</code>, which should be a <code>QSlot</code> record) and a value <code>v</code> exist in <code>bindings</code> map. Otherwise it returns <code>false</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L464">view source</a></div></div><div class="public anchor" id="var-cache-create"><h3>cache-create</h3><div class="usage"><code>(cache-create ttl)</code><code>(cache-create ttl queue-size)</code><code>(cache-create ttl queue-size initial-map)</code></div><div class="doc"><div class="markdown"><p>Creates a cache object of the given TTL and/or queue size. Optionally it can get an initial map of entries. Returns cache object encapsulated in an atom.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L79">view source</a></div></div><div class="public anchor" id="var-cache-evict.21"><h3>cache-evict!</h3><div class="usage"><code>(cache-evict! cache-atom entry)</code><code>(cache-evict! cache-atom entry & more)</code></div><div class="doc"><div class="markdown"><p>Removes entry or entries from the cache. Returns the updated cache from the atom.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L89">view source</a></div></div><div class="public anchor" id="var-cache-lookup"><h3>cache-lookup</h3><div class="usage"><code>(cache-lookup cache id)</code><code>(cache-lookup cache id & ids)</code></div><div class="doc"><div class="markdown"><p>Looks for the entry of the given ID in a cache which should be a cache object encapsulated in an atom. For multiple IDs, calls <code>cache-lookup-coll</code>. If the entry was not found, returns <code>:io.randomseed.utils.db/not-found</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L125">view source</a></div></div><div class="public anchor" id="var-cache-lookup-coll"><h3>cache-lookup-coll</h3><div class="usage"><code>(cache-lookup-coll cache ids)</code></div><div class="doc"><div class="markdown"><p>Looks for a collection of entries identified by the given ID in a cache which should be a cache object encapsulated in an atom. Returns a map with identifiers as keys and values for all found entries. Entries which are missing in the cache are grouped under the <code>:io.randomseed.utils.db/not-found</code> key as a list.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L110">view source</a></div></div><div class="public anchor" id="var-cache-prepare"><h3>cache-prepare</h3><div class="usage"><code>(cache-prepare ttl)</code><code>(cache-prepare ttl queue-size)</code><code>(cache-prepare ttl queue-size initial-map)</code></div><div class="doc"><div class="markdown"><p>Prepares a cache object of the given TTL and/or queue size. Optionally it can be populated with an initial map of entries. Returns a cache object.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L60">view source</a></div></div><div class="public anchor" id="var-coerce-in"><h3>coerce-in</h3><div class="usage"><code>(coerce-in table column v)</code><code>(coerce-in table-column v)</code></div><div class="doc"><div class="markdown"><p>Coerces the given value <code>v</code> to a database type by calling a function returned by invoking <code>io.randomseed.utils.db/in-coercer</code> multimethod on a qualified keyword <code>table-column</code> (or a qualified keyword made out of <code>table</code> and <code>column</code>). If there is no coercer attached for the keyword, tries with a keyword created using the <code>column-kw</code> function. If there is no coercer, returns unchanged <code>v</code>.</p>
<p>Will immediately return the given value <code>v</code> if the coercer exists but it is set to <code>false</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L150">view source</a></div></div><div class="public anchor" id="var-coerce-in*"><h3>coerce-in*</h3><div class="usage"><code>(coerce-in* table-column v)</code></div><div class="doc"><div class="markdown"><p>Same as <code>coerce-in</code> but <code>table-column</code> must be a lisp-cased keyword (already a result of <code>colspec-kw</code> or <code>column-kw</code>).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L162">view source</a></div></div><div class="public anchor" id="var-coerce-out"><h3>coerce-out</h3><div class="usage"><code>(coerce-out table column v)</code><code>(coerce-out table-column v)</code></div><div class="doc"><div class="markdown"><p>Coerces the given value <code>v</code> from a database type by calling a function returned by invoking <code>io.randomseed.utils.db/out-coercer</code> multimethod on a qualified keyword <code>table-column</code> (or a qualified keyword made out of <code>table</code> and <code>column</code>). If there is no coercer attached for the keyword, tries with a keyword created using the <code>column-kw</code> function (to use column alone). If there is no coercer, returns unchanged <code>v</code>.</p>
<p>Will immediately return the given value <code>v</code> if the coercer exists but it is set to <code>false</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L167">view source</a></div></div><div class="public anchor" id="var-coerce-out*"><h3>coerce-out*</h3><div class="usage"><code>(coerce-out* table-column v)</code></div><div class="doc"><div class="markdown"><p>Same as <code>coerce-out</code> but <code>table-column</code> must be a lisp-cased keyword (already a result of <code>colspec-kw</code> or <code>column-kw</code>).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L180">view source</a></div></div><div class="public anchor" id="var-coerce-seq-in"><h3>coerce-seq-in</h3><div class="usage"><code>(coerce-seq-in table column coll)</code><code>(coerce-seq-in table-column coll)</code></div><div class="doc"><div class="markdown"><p>Coerces a sequence of values <code>coll</code> to database types by calling a function returned by invoking <code>io.randomseed.utils.db/in-coercer</code> multimethod on a qualified keyword <code>table-column</code> (or a qualified keyword made out of <code>table</code> and <code>column</code>). If there is no coercer attached for the keyword, tries with a keyword created using the <code>column-kw</code> function (to use column alone). If there is no coercer, returns unchanged <code>coll</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L185">view source</a></div></div><div class="public anchor" id="var-coerce-seq-in*"><h3>coerce-seq-in*</h3><div class="usage"><code>(coerce-seq-in* table-column coll)</code></div><div class="doc"><div class="markdown"><p>Same as <code>coerce-seq-in</code> but <code>table-column</code> must be a lisp-cased keyword (already a result of <code>colspec-kw</code> or <code>column-kw</code>).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L195">view source</a></div></div><div class="public anchor" id="var-coerce-seq-out"><h3>coerce-seq-out</h3><div class="usage"><code>(coerce-seq-out table column coll)</code><code>(coerce-seq-out table-column coll)</code></div><div class="doc"><div class="markdown"><p>Coerces a sequence of values <code>coll</code> from database types by calling a function returned by invoking <code>io.randomseed.utils.db/out-coercer</code> multimethod on a qualified keyword <code>table-column</code> (or a qualified keyword made out of <code>table</code> and <code>column</code>). If there is no coercer attached for the keyword, tries with a keyword created using the <code>column-kw</code> function (to use column alone). If there is no coercer, returns unchanged <code>coll</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L200">view source</a></div></div><div class="public anchor" id="var-coerce-seq-out*"><h3>coerce-seq-out*</h3><div class="usage"><code>(coerce-seq-out* table-column coll)</code></div><div class="doc"><div class="markdown"><p>Same as <code>coerce-seq-out</code> but <code>table-column</code> must be a lisp-cased keyword (already a result of <code>colspec-kw</code> or <code>column-kw</code>).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L210">view source</a></div></div><div class="public anchor" id="var-data-source.3F"><h3>data-source?</h3><div class="usage"><code>(data-source? v)</code></div><div class="doc"><div class="markdown"><p>Returns <code>true</code> if <code>v</code> is an instance of <code>javax.sql.DataSource</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L441">view source</a></div></div><div class="public anchor" id="var-defcoercions"><h3>defcoercions</h3><h4 class="type">macro</h4><div class="usage"><code>(defcoercions table & specs)</code></div><div class="doc"><div class="markdown"><p>Defines input and output coercions for a database table <code>table</code>. The <code>specs</code> should be an argument list consisting of triples in a form of <code>column-name</code>, <code>input-coercer</code>, <code>output-coercer</code>.</p>
<p>For each definition 4 multimethod implementations will be emitted, identified by a keyword having a namespace the same as the given table, and a name the same as currently processed column name, both in 2 variants: one for snake, and one for lisp case. Two multimethod definitions will be created for <code>io.randomseed.utils.db/in-coercer</code> and two for <code>io.randomseed.utils.db/out-coercer</code>.</p>
<p>If the given coercer is a literal <code>nil</code> or <code>false</code> value, it will be marked as undefined using <code>false</code> value. It is advised to use that approach instead of assigning <code>identity</code> function to express that coercion is not needed since it can cause compile-time calculations to short-circuit instead of generating fallback code.</p>
<p>Example:</p>
<p><code>(defcoercions :users :some-identifier str keyword)</code></p>
<p>The above will expand the following code:</p>
<pre><code>(defmethod io.randomseed.utils.db/in-coercer :users/some-identifier [_] str)
(defmethod io.randomseed.utils.db/in-coercer :users/some_identifier [_] str)
(defmethod io.randomseed.utils.db/out-coercer :users/some-identifier [_] keyword)
(defmethod io.randomseed.utils.db/out-coercer :users/some_identifier [_] keyword)
</code></pre>
<p>This will allow specialized database coercion functions to transformed values which are exchanged with a database.</p>
<p>Optionally coercions can be defined without a table name. In such case the table should be set to either <code>nil</code>, <code>false</code> or <code>:io.randomseed.utils.db/any</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L684">view source</a></div></div><div class="public anchor" id="var-execute.21"><h3>execute!</h3><div class="usage"><code>(execute! connectable sql-params opts)</code><code>(execute! connectable sql-params)</code></div><div class="doc"><div class="markdown"><p>Executes a SQL query via <code>next.jdbc/execute!</code> with coercing options (simple lisp-cased keys, map results). Returns a vector of result maps.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L945">view source</a></div></div><div class="public anchor" id="var-execute-one.21"><h3>execute-one!</h3><div class="usage"><code>(execute-one! connectable sql-params opts)</code><code>(execute-one! connectable sql-params)</code></div><div class="doc"><div class="markdown"><p>Executes a SQL query via <code>next.jdbc/execute-one!</code> with coercing options (simple lisp-cased keys, map result). Returns <code>nil</code> when no row is found.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L937">view source</a></div></div><div class="public anchor" id="var-for-insert-multi-or"><h3>for-insert-multi-or</h3><div class="usage"><code>(for-insert-multi-or table cols rows opts)</code></div><div class="doc"><div class="markdown"><p>Given a table name, a vector of column names, and a vector of row values (each row is a vector of its values), return a vector of the full <code>INSERT</code> SQL string and its parameters. Applies any <code>:table-fn</code> / <code>:column-fn</code> supplied in the options. If <code>:suffix</code> is provided in <code>opts</code>, that string is appended to the <code>INSERT IGNORE ...</code> statement. The <code>IGNORE</code> part can be replaced by supplying :alt-clause option key.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L750">view source</a></div></div><div class="public anchor" id="var-for-insert-or"><h3>for-insert-or</h3><div class="usage"><code>(for-insert-or table key-map opts)</code></div><div class="doc"><div class="markdown"><p>Given a table name and a hash map of column names and their values, return a vector of the full <code>INSERT OR IGNORE</code> SQL string and its parameters. Applies any <code>:table-fn</code> / <code>:column-fn</code> supplied in the options. If <code>:suffix</code> is provided in <code>opts</code>, that string is appended to the <code>INSERT ...</code> statement. If <code>:alt-clause</code> is provided in <code>opts</code>, it will replace the default IGNORE string.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L709">view source</a></div></div><div class="public anchor" id="var-for-replace"><h3>for-replace</h3><div class="usage"><code>(for-replace table key-map opts)</code></div><div class="doc"><div class="markdown"><p>Given a table name and a hash map of column names and their values, return a vector of the full <code>REPLACE</code> SQL string and its parameters. Applies any <code>:table-fn</code> / <code>:column-fn</code> supplied in the options. If <code>:suffix</code> is provided in <code>opts</code>, that string is appended to the <code>INSERT ...</code> statement.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L693">view source</a></div></div><div class="public anchor" id="var-for-replace-multi"><h3>for-replace-multi</h3><div class="usage"><code>(for-replace-multi table cols rows opts)</code></div><div class="doc"><div class="markdown"><p>Given a table name, a vector of column names, and a vector of row values (each row is a vector of its values), return a vector of the full <code>REPLACE</code> SQL string and its parameters. Applies any <code>:table-fn</code> / <code>:column-fn</code> supplied in the options. If <code>:suffix</code> is provided in <code>opts</code>, that string is appended to the <code>REPLACE ...</code> statement.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L727">view source</a></div></div><div class="public anchor" id="var-gen-builder"><h3>gen-builder</h3><div class="usage"><code>(gen-builder rs-builder)</code></div><div class="doc"><div class="markdown"><p>Generates result set builder on a basis of the given builder <code>rs-builder</code>. Uses <code>io.randomseed.utils.db/column-by-index-fn</code> to coerce the results.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L770">view source</a></div></div><div class="public anchor" id="var-gen-builder-delayed"><h3>gen-builder-delayed</h3><div class="usage"><code>(gen-builder-delayed rs-builder)</code></div><div class="doc"><div class="markdown"><p>Generates result set builder on a basis of the given builder <code>rs-builder</code>. Uses <code>io.randomseed.utils.db/delayed-column-by-index-fn</code> to coerce the results.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L776">view source</a></div></div><div class="public anchor" id="var-gen-qs-keyword"><h3>gen-qs-keyword</h3><div class="usage"><code>(gen-qs-keyword qs)</code><code>(gen-qs-keyword qs v)</code><code>(gen-qs-keyword t c v)</code></div><div class="doc"><div class="markdown"><p>Generates unique but deterministic symbolic name for <code>t</code> (presumably table name), <code>c</code> (column name) and <code>v</code> (value, being an identifier). Returns a keyword named like <code>DB__[t]_[c]_[v]_[nnnnnnn]</code> where <code>[t]</code>, <code>[c]</code> and <code>[v]</code> are string representations of the given argument values, and <code>[nnnnnnn]</code> is a numeric representation of combined hash of all values given as arguments.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L429">view source</a></div></div><div class="public anchor" id="var-get-cached"><h3>get-cached</h3><div class="usage"><code>(get-cached cache db-getter db id)</code><code>(get-cached cache db-getter db id & more)</code><code>(get-cached cache table db id)</code><code>(get-cached cache table db id & more)</code><code>(get-cached cache table db-getter db id)</code><code>(get-cached cache table db-getter db id & more)</code></div><div class="doc"><div class="markdown"><p>Returns a (possibly cached) sequence of maps requested using db-getter for the given IDs. A database connection and a table name can be passed to be used with the standard get-id getter function instead. When multiple IDs are given, calls get-cached-coll.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L601">view source</a></div></div><div class="public anchor" id="var-get-cached-coll"><h3>get-cached-coll</h3><div class="usage"><code>(get-cached-coll cache db-getter db ids)</code><code>(get-cached-coll cache table db ids)</code><code>(get-cached-coll cache table db-getter db ids)</code></div><div class="doc"><div class="markdown"><p>Returns a (possibly cached) sequence of maps requested using db-getter for the given IDs. When called with a table name it will be passed as a second argument to the given getter function. When no getter is given the standard one (get-ids) is used. Use make-getter-coll to create getter (with or without predefined table name).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L578">view source</a></div></div><div class="public anchor" id="var-get-cached-coll-prop"><h3>get-cached-coll-prop</h3><div class="usage"><code>(get-cached-coll-prop cache db-getter db property ids)</code><code>(get-cached-coll-prop cache table db property ids)</code><code>(get-cached-coll-prop cache table db-getter db property ids)</code></div><div class="doc"><div class="markdown"><p>Uses get-cached-coll to retrieve a map with keys being IDs and values being requested properties. If there is no data for the given ID, corresponding entry is not added to the resulting map. If the property does not exist, nil is added.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L625">view source</a></div></div><div class="public anchor" id="var-get-cached-prop"><h3>get-cached-prop</h3><div class="usage"><code>(get-cached-prop cache db-getter db property id)</code><code>(get-cached-prop cache db-getter db property id & more)</code><code>(get-cached-prop cache table db property id)</code><code>(get-cached-prop cache table db property id & more)</code><code>(get-cached-prop cache table db-getter db property id)</code><code>(get-cached-prop cache table db-getter db property id & more)</code></div><div class="doc"><div class="markdown"><p>Same as get-cached but retrieves a single property from the result by using the get function. When multiple IDs are given it calls get-cached-coll-prop to handle it.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L641">view source</a></div></div><div class="public anchor" id="var-get-cached-prop-or-default"><h3>get-cached-prop-or-default</h3><div class="usage"><code>(get-cached-prop-or-default cache db-getter db property default id)</code><code>(get-cached-prop-or-default cache db-getter db property default id & more)</code><code>(get-cached-prop-or-default cache table db property default id)</code><code>(get-cached-prop-or-default cache table db property default id & more)</code><code>(get-cached-prop-or-default cache table db-getter db property default id)</code><code>(get-cached-prop-or-default cache table db-getter db property default id & more)</code></div><div class="doc"><div class="markdown"><p>Same as get-cached-prop but when there is no entry for the given ID, it returns the given default value.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L661">view source</a></div></div><div class="public anchor" id="var-get-failed.3F"><h3>get-failed?</h3><div class="usage"><code>(get-failed? v)</code></div><div class="doc"><div class="markdown"><p>Returns true if getting from a database failed in post-processing phase (e.g. de-serialization) and the data were broken.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L877">view source</a></div></div><div class="public anchor" id="var-get-id"><h3>get-id</h3><div class="usage"><code>(get-id db table id)</code><code>(get-id db table id & more)</code></div><div class="doc"><div class="markdown"><p>Gets properties of the given ID from a database table. For multiple IDs, calls get-ids.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L568">view source</a></div></div><div class="public anchor" id="var-get-ids"><h3>get-ids</h3><div class="usage"><code>(get-ids db table ids)</code></div><div class="doc"><div class="markdown"><p>Gets a map of ID-to-properties from a database for the given IDs and a table. Assumes each result will be related to a single, unique ID.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L558">view source</a></div></div><div class="public anchor" id="var-get-in-coercer"><h3>get-in-coercer</h3><div class="usage"><code>(get-in-coercer table column)</code><code>(get-in-coercer table-column)</code></div><div class="doc"><div class="markdown"><p>Tries to obtain a database coercion function by calling <code>in-coercer</code> multimethod for column and table specified with <code>table</code> and <code>column</code>, or by a single <code>table-column</code>. Transforms arguments to a lisp-cased keyword. If there is no coercer for table and column, tries to getting one using the column alone.</p>
<p>Returns coercer when it is found. Returns <code>false</code> when a coercer is found but explicitly set to undefined. Returns <code>nil</code> when there is no coercer.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L99">view source</a></div></div><div class="public anchor" id="var-get-in-coercer*"><h3>get-in-coercer*</h3><div class="usage"><code>(get-in-coercer* table-column)</code></div><div class="doc"><div class="markdown"><p>Same as <code>get-in-coercer</code> but trusts that <code>table-column</code> is a fully-qualified keyword (already a result of <code>colspec-kw</code>).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L90">view source</a></div></div><div class="public anchor" id="var-get-out-coercer"><h3>get-out-coercer</h3><div class="usage"><code>(get-out-coercer table column)</code><code>(get-out-coercer table-column)</code></div><div class="doc"><div class="markdown"><p>Tries to obtain a database coercion function by calling <code>out-coercer</code> multimethod for column and table specified with <code>table</code> and <code>column</code>, or by a single <code>table-column</code>. Transforms arguments to a lisp-cased keyword. If there is no coercer for table and column, falls back to getting one using the column alone.</p>
<p>Returns coercer when it is found. Returns <code>false</code> when a coercer is found but explicitly set to undefined. Returns <code>nil</code> when there is no coercer.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L121">view source</a></div></div><div class="public anchor" id="var-get-out-coercer*"><h3>get-out-coercer*</h3><div class="usage"><code>(get-out-coercer* table-column)</code></div><div class="doc"><div class="markdown"><p>Same as <code>get-out-coercer</code> but trusts that <code>table-column</code> is a lisp-cased keyword (already a result of <code>colspec-kw</code>).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L112">view source</a></div></div><div class="public anchor" id="var-id-from-db"><h3>id-from-db</h3><div class="usage"><code>(id-from-db v)</code></div><div class="doc"><div class="markdown"><p>Converts the given ID retrieved from a database to a value suitable to be used in Clojure programs. If <code>v</code> is a number or a keyword, it is returned as is. Otherwise it is converted to a keyword.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L39">view source</a></div></div><div class="public anchor" id="var-id-to-db"><h3>id-to-db</h3><div class="usage"><code>(id-to-db v)</code></div><div class="doc"><div class="markdown"><p>Converts the given ID to a value suitable to be stored in a database. If <code>v</code> is a number, it is passed as is. Otherwise it is converted to a string.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L46">view source</a></div></div><div class="public anchor" id="var-in-coercer"><h3>in-coercer</h3><h4 class="type">multimethod</h4><div class="usage"><code>(in-coercer table-column v)</code><code>(in-coercer column v)</code></div><div class="doc"><div class="markdown"><p>Returns a coercer suitable for transforming the given argument <code>v</code> to a database-suitable value, assuming table and column specified by the given qualified keyword <code>table-column</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L73">view source</a></div></div><div class="public anchor" id="var-insert-multi-or.21"><h3>insert-multi-or!</h3><div class="usage"><code>(insert-multi-or! connectable table cols rows)</code><code>(insert-multi-or! connectable table cols rows opts)</code></div><div class="doc"><div class="markdown"><p>Syntactic sugar over <code>execute!</code> to make inserting columns/rows easier. Same as insert-or! but supports multiple rows to be inserted at once.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L789">view source</a></div></div><div class="public anchor" id="var-insert-or.21"><h3>insert-or!</h3><div class="usage"><code>(insert-or! connectable table key-map)</code><code>(insert-or! connectable table key-map opts)</code></div><div class="doc"><div class="markdown"><p>Syntactic sugar over <code>execute-one!</code> to make inserting hash maps easier. Given a connectable object, a table name, and a data hash map, inserts the data as a single row in the database and attempts to return a map of generated keys. By default it uses <code>INSERT OR IGNORE</code> but the <code>IGNORE</code> can be changed to anything by supplying :alt-clause option in opts map.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L775">view source</a></div></div><div class="public anchor" id="var-insert-or-ignore.21"><h3>insert-or-ignore!</h3><div class="usage"><code>(insert-or-ignore! connectable table key-map)</code><code>(insert-or-ignore! connectable table key-map opts)</code></div><div class="doc"><div class="markdown"><p>Syntactic sugar over <code>execute-one!</code> to make inserting hash maps easier. Given a connectable object, a table name, and a data hash map, inserts the data as a single row in the database and attempts to return a map of generated keys.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L827">view source</a></div></div><div class="public anchor" id="var-insert-or-ignore-multi.21"><h3>insert-or-ignore-multi!</h3><div class="usage"><code>(insert-or-ignore-multi! connectable table cols rows)</code><code>(insert-or-ignore-multi! connectable table cols rows opts)</code></div><div class="doc"><div class="markdown"><p>Syntactic sugar over <code>execute!</code> to make inserting columns/rows easier. Same as insert-multi! but supports :alt-clause option key.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L810">view source</a></div></div><div class="public anchor" id="var-insert-or-replace.21"><h3>insert-or-replace!</h3><div class="usage"><code>(insert-or-replace! connectable table key-map)</code><code>(insert-or-replace! connectable table key-map opts)</code></div><div class="doc"><div class="markdown"><p>Syntactic sugar over <code>execute-one!</code> to make inserting hash maps easier. Given a connectable object, a table name, and a data hash map, inserts the data as a single row in the database and attempts to return a map of generated keys.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L818">view source</a></div></div><div class="public anchor" id="var-insert-or-replace-multi.21"><h3>insert-or-replace-multi!</h3><div class="usage"><code>(insert-or-replace-multi! connectable table cols rows)</code><code>(insert-or-replace-multi! connectable table cols rows opts)</code></div><div class="doc"><div class="markdown"><p>Syntactic sugar over <code>execute!</code> to make inserting columns/rows easier. Same as insert-multi! but supports :alt-clause option key.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L802">view source</a></div></div><div class="public anchor" id="var-invalidate.21"><h3>invalidate!</h3><div class="usage"><code>(invalidate! f)</code><code>(invalidate! f key-params)</code></div><div class="doc"><div class="markdown"><p>Invalidates cache associated with memoized function <code>f</code>. If <code>key-params</code> are given it should be a cache key sequence or other structure (usually function arguments). If only function is given, it clears the whole cache.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L165">view source</a></div></div><div class="public anchor" id="var-invalidate.2B.21"><h3>invalidate+!</h3><div class="usage"><code>(invalidate+! f)</code><code>(invalidate+! f key-params)</code></div><div class="doc"><div class="markdown"><p>Invalidates cache associated with memoized function <code>f</code>. If <code>key-params</code> are given it should be a cache key sequence or other structure (usually function arguments), internally transformed to vector. If only function is given, it clears the whole cache. Supports functions memoized with <code>memoize+</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L178">view source</a></div></div><div class="public anchor" id="var-invalidator"><h3>invalidator</h3><div class="usage"><code>(invalidator f)</code></div><div class="doc"><div class="markdown"><p>Generates invalidation function for the given memoized function <code>f</code>. The invalidation function takes arguments in the same way as memoized function. If they match a value in the associated cache, the entry is evicted. Supports functions memoized with <code>memoize</code> and <code>memoize+</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L199">view source</a></div></div><div class="public anchor" id="var-lazy-do"><h3>lazy-do</h3><h4 class="type">macro</h4><div class="usage"><code>(lazy-do & cmd)</code></div><div class="doc"><div class="markdown"><p>Evaluates <code>cmd</code> and converts a non-nil result to a lazy map using <code>map/to-lazy</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L953">view source</a></div></div><div class="public anchor" id="var-lazy-execute.21"><h3>lazy-execute!</h3><div class="usage"><code>(lazy-execute! connectable sql-params opts)</code><code>(lazy-execute! connectable sql-params)</code></div><div class="doc"><div class="markdown"><p>Executes a SQL query via <code>next.jdbc/execute!</code> with lazy coercing options. Each result map in the returned vector is converted to a lazy map. Returns <code>nil</code> when no rows are found.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L927">view source</a></div></div><div class="public anchor" id="var-lazy-execute-one.21"><h3>lazy-execute-one!</h3><div class="usage"><code>(lazy-execute-one! connectable sql-params opts)</code><code>(lazy-execute-one! connectable sql-params)</code></div><div class="doc"><div class="markdown"><p>Executes a SQL query via <code>next.jdbc/execute-one!</code> with lazy coercing options. The result map is converted to a lazy map. Returns <code>nil</code> when no row is found.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L918">view source</a></div></div><div class="public anchor" id="var-lazy-get-by-id"><h3>lazy-get-by-id</h3><div class="usage"><code>(lazy-get-by-id connectable table pk)</code><code>(lazy-get-by-id connectable table pk opts)</code><code>(lazy-get-by-id connectable table pk pk-name opts)</code></div><div class="doc"><div class="markdown"><p>Like <code>next.jdbc/get-by-id</code> but supports lazy maps.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L958">view source</a></div></div><div class="public anchor" id="var-make-deleter"><h3>make-deleter</h3><div class="usage"><code>(make-deleter id-col)</code><code>(make-deleter table id-col)</code></div><div class="doc"><div class="markdown"><p>Creates a database deleter function that removes a row identified by <code>id-col</code>. If <code>table</code> is given, the table name is baked into the query.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L535">view source</a></div></div><div class="public anchor" id="var-make-getter"><h3>make-getter</h3><div class="usage"><code>(make-getter f opts id-col cols)</code><code>(make-getter f opts table id-col cols)</code><code>(make-getter f opts table id-col cols getter-coll-fn)</code></div><div class="doc"><div class="markdown"><p>Creates a coercion-aware database getter. Uses <code>f</code> (typically <code>execute-one!</code> or <code>lazy-execute-one!</code>) with the given <code>opts</code> to execute a SELECT query. When <code>table</code> is provided, it is baked into the query; otherwise it must be passed at call-time. When <code>getter-coll-fn</code> is provided, calls with extra IDs are delegated to it.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L970">view source</a></div></div><div class="public anchor" id="var-make-getter-coll"><h3>make-getter-coll</h3><div class="usage"><code>(make-getter-coll f opts id-col)</code><code>(make-getter-coll f opts id-col cols)</code><code>(make-getter-coll f opts table id-col cols)</code></div><div class="doc"><div class="markdown"><p>Creates a database getter suitable for use with <code>get-cached-coll-</code> family of functions. The returned function should accept an argument containing multiple identifiers.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L1003">view source</a></div></div><div class="public anchor" id="var-make-setter"><h3>make-setter</h3><div class="usage"><code>(make-setter id-col)</code><code>(make-setter table id-col)</code></div><div class="doc"><div class="markdown"><p>Creates a database setter function that updates a row identified by <code>id-col</code>. If <code>table</code> is given, the table name is baked into the function.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L520">view source</a></div></div><div class="public anchor" id="var-make-setting-deleter"><h3>make-setting-deleter</h3><div class="usage"><code>(make-setting-deleter table entity-column)</code></div><div class="doc"><div class="markdown"><p>Creates a setting deleter on a basis of the given table and entity column.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L980">view source</a></div></div><div class="public anchor" id="var-make-setting-getter"><h3>make-setting-getter</h3><div class="usage"><code>(make-setting-getter table entity-column)</code></div><div class="doc"><div class="markdown"><p>Returns a function which gets a setting for the given entity and de-serializes it to a Clojure data structure. Table name and entity column name must be quoted if needed before passing to this function.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L883">view source</a></div></div><div class="public anchor" id="var-make-setting-setter"><h3>make-setting-setter</h3><div class="usage"><code>(make-setting-setter table entity-column)</code></div><div class="doc"><div class="markdown"><p>Returns a function which stores one or more settings for a given entity in a database. Max. object size is 32 KB. Table name and entity column name must be quoted if needed before passing to this function.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L936">view source</a></div></div><div class="public anchor" id="var-map-.3E"><h3>map-></h3><div class="usage"><code>(map-> m)</code><code>(map-> table m)</code></div><div class="doc"><div class="markdown"><p>Coerces map values from database types using <code>out-coercer</code>. In the 1-arity form, each key is used as-is (must be qualified) to dispatch the coercer. In the 2-arity form, unqualified keys are qualified with <code>table</code> as the namespace.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L672">view source</a></div></div><div class="public anchor" id="var-map-.3EQSlot"><h3>map->QSlot</h3><div class="usage"><code>(map->QSlot m__8001__auto__)</code></div><div class="doc"><div class="markdown"><p>Factory function for class io.randomseed.utils.db.coercion.QSlot, taking a map of keywords to field values.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L331">view source</a></div></div><div class="public anchor" id="var-memoize"><h3>memoize</h3><div class="usage"><code>(memoize f)</code><code>(memoize f queue-size)</code><code>(memoize f queue-size ttl)</code></div><div class="doc"><div class="markdown"><p>Creates memoized version of a database accessing or other function. With only 1 argument defaults to a FIFO cache with length of 256 and TTL cache with expiration of 150 seconds. When 2 arguments are given it only creates FIFO cache of the given length, without TTL. When <code>queue-size</code> is <code>nil</code> or <= 0, the FIFO cache will not be created. When <code>ttl</code> is <code>nil</code> or <= 0, the TTL cache will not be created.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L136">view source</a></div></div><div class="public anchor" id="var-memoize.2B"><h3>memoize+</h3><div class="usage"><code>(memoize+ f)</code><code>(memoize+ f size)</code><code>(memoize+ f level1-size level2-size)</code></div><div class="doc"><div class="markdown"><p>Wrapper around <code>clojure.core.memoize/fifo</code> which uses fast, map-based memoization for cache size up to <code>level1-size</code> size, and then switches to slower memoization based on FIFO cache of <code>level2-size</code> size. The first level of cache is never purged automatically; once an element is there, it stays.</p>
<p>If only one size is given (<code>size</code>), the level-1 cache size will be set to 70% of it, and level-2 cache to 30% of it.</p>
<p>If no size is given, the level-1 cache will have a size of 89000 elements and level-2 cache will have a size of 39000 elements; both having a size of 128000 elements in total.</p>
<p>Be aware that caching key in level-1 cache is a vector of all arguments unless the argument count is greater than 8. In such case all extra arguments (expressed with native Clojure structure used for variadic function arguments) are grouped as 9th element of this vector.</p>
<p>To control caches associated with original function, use a metadata of the returned function object.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L211">view source</a></div></div><div class="public anchor" id="var-memoizer"><h3>memoizer</h3><div class="usage"><code>(memoizer config)</code><code>(memoizer f config)</code></div><div class="doc"><div class="markdown"><p>Creates a memoized functions with predefined TTL and queue size taken from config. If the function is not given it will try to dereference symbol present in the config under the <code>:memoizer</code> key. Uses <code>io.randomseed.utils.db/memoize</code> to initialize caches.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L149">view source</a></div></div><div class="public anchor" id="var-not-found.3F"><h3>not-found?</h3><div class="usage"><code>(not-found? e)</code></div><div class="doc"><div class="markdown"><p>Returns <code>true</code> when the given value equals to <code>:io.randomseed.utils.db/not-found</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L105">view source</a></div></div><div class="public anchor" id="var-opts-lazy-map"><h3>opts-lazy-map</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>next.jdbc options map: lisp-cased keys, map results, with delayed coercing builder.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L802">view source</a></div></div><div class="public anchor" id="var-opts-lazy-simple-map"><h3>opts-lazy-simple-map</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>next.jdbc options map: simple lisp-cased keys, map results, with delayed coercing builder.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L804">view source</a></div></div><div class="public anchor" id="var-opts-lazy-simple-vec"><h3>opts-lazy-simple-vec</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>next.jdbc options map: simple lisp-cased keys, vector results, with delayed coercing builder.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L798">view source</a></div></div><div class="public anchor" id="var-opts-lazy-slashed-map"><h3>opts-lazy-slashed-map</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>next.jdbc options map: lisp-cased slashed keys, map results, with delayed coercing builder.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L806">view source</a></div></div><div class="public anchor" id="var-opts-lazy-slashed-vec"><h3>opts-lazy-slashed-vec</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>next.jdbc options map: lisp-cased slashed keys, vector results, with delayed coercing builder.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L800">view source</a></div></div><div class="public anchor" id="var-opts-lazy-vec"><h3>opts-lazy-vec</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>next.jdbc options map: lisp-cased keys, vector results, with delayed coercing builder.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L796">view source</a></div></div><div class="public anchor" id="var-opts-map"><h3>opts-map</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>next.jdbc options map: lisp-cased keys, map results, with coercing builder.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L784">view source</a></div></div><div class="public anchor" id="var-opts-simple-map"><h3>opts-simple-map</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>next.jdbc options map: simple lisp-cased keys (no table prefix), map results, with coercing builder.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L786">view source</a></div></div><div class="public anchor" id="var-opts-simple-vec"><h3>opts-simple-vec</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>next.jdbc options map: simple lisp-cased keys, vector results, with coercing builder.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L790">view source</a></div></div><div class="public anchor" id="var-opts-slashed-map"><h3>opts-slashed-map</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>next.jdbc options map: lisp-cased slashed keys, map results, with coercing builder.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L792">view source</a></div></div><div class="public anchor" id="var-opts-slashed-vec"><h3>opts-slashed-vec</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>next.jdbc options map: lisp-cased slashed keys, vector results, with coercing builder.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L794">view source</a></div></div><div class="public anchor" id="var-opts-vec"><h3>opts-vec</h3><div class="usage"></div><div class="doc"><div class="markdown"><p>next.jdbc options map: lisp-cased keys, vector results, with coercing builder.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L788">view source</a></div></div><div class="public anchor" id="var-out-coercer"><h3>out-coercer</h3><h4 class="type">multimethod</h4><div class="usage"><code>(out-coercer table-column v)</code><code>(out-coercer column v)</code></div><div class="doc"><div class="markdown"><p>Returns a coercer suitable for transforming the given argument <code>v</code> read from a database, assuming table and column specified by the given qualified keyword <code>table-column</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L80">view source</a></div></div><div class="public anchor" id="var-replace.21"><h3>replace!</h3><div class="usage"><code>(replace! connectable table key-map)</code><code>(replace! connectable table key-map opts)</code></div><div class="doc"><div class="markdown"><p>Syntactic sugar over <code>execute-one!</code> to make inserting hash maps easier. Given a connectable object, a table name, and a data hash map, inserts the data as a single row in the database and attempts to return a map of generated keys. By default it uses <code>REPLACE</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L836">view source</a></div></div><div class="public anchor" id="var-replace-multi.21"><h3>replace-multi!</h3><div class="usage"><code>(replace-multi! connectable table cols rows)</code><code>(replace-multi! connectable table cols rows opts)</code></div><div class="doc"><div class="markdown"><p>Syntactic sugar over <code>execute!</code> to make inserting columns/rows easier. Same as replace! but supports multiple rows to be inserted at once.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db.clj#L849">view source</a></div></div><div class="public anchor" id="var-seq-.3E"><h3>seq-></h3><h4 class="type">macro</h4><div class="usage"><code>(seq-> table column coll)</code><code>(seq-> table-column coll)</code></div><div class="doc"><div class="markdown"><p>Coerces a sequence of values <code>coll</code> from database types by calling a function returned by invoking <code>io.randomseed.utils.db/out-coercer</code> multimethod on a qualified keyword <code>table-column</code> (or a qualified keyword made out of <code>table</code> and <code>column</code>). If there is no coercer attached for the keyword, returns unchanged <code>coll</code>.</p>
<p>If both, a table and a column can be used to establish coercion function at compile-time, a mapping form will be generated which uses that function.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L307">view source</a></div></div><div class="public anchor" id="var-simple-.3E"><h3>simple-></h3><div class="usage"><code>(simple-> table m)</code></div><div class="doc"><div class="markdown"><p>Coerces map values from database types using <code>out-coercer</code>, qualifying each key with <code>table</code> as the namespace. Returns a new map with coerced values.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/utils/tree/2.0.11/modules/db/src/io/randomseed/utils/db/coercion.clj#L665">view source</a></div></div></div></body></html>