-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathamelinium.db.html
227 lines (227 loc) · 112 KB
/
amelinium.db.html
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
220
221
222
223
224
225
226
227
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>amelinium.db 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">Amelinium</span> <span class="project-version">1.0.1</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><li class="depth-1 "><a href="20_hypermedia.html"><div class="inner"><span>Hypermedia-driven</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><a href="amelinium.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>amelinium</span></div></a></li><li class="depth-2 branch"><a href="amelinium.admin.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>admin</span></div></a></li><li class="depth-2"><a href="amelinium.api.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>api</span></div></a></li><li class="depth-3"><a href="amelinium.api.controller.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>controller</span></div></a></li><li class="depth-4"><a href="amelinium.api.controller.user.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>user</span></div></a></li><li class="depth-3"><a href="amelinium.api.url.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>url</span></div></a></li><li class="depth-2 branch"><a href="amelinium.app.html"><div class="inner"><span class="tree" style="top: -114px;"><span class="top" style="height: 123px;"></span><span class="bottom"></span></span><span>app</span></div></a></li><li class="depth-2"><a href="amelinium.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-3"><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-4 branch"><a href="amelinium.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-4 branch"><a href="amelinium.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-4 branch"><a href="amelinium.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-4"><a href="amelinium.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-3 branch"><a href="amelinium.auth.pwd.html"><div class="inner"><span class="tree" style="top: -145px;"><span class="top" style="height: 154px;"></span><span class="bottom"></span></span><span>pwd</span></div></a></li><li class="depth-3"><a href="amelinium.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-2"><a href="amelinium.common.html"><div class="inner"><span class="tree" style="top: -238px;"><span class="top" style="height: 247px;"></span><span class="bottom"></span></span><span>common</span></div></a></li><li class="depth-3 branch"><a href="amelinium.common.controller.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>controller</span></div></a></li><li class="depth-3"><a href="amelinium.common.oplog.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>oplog</span></div></a></li><li class="depth-4"><a href="amelinium.common.oplog.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-3 branch"><a href="amelinium.common.populators.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>populators</span></div></a></li><li class="depth-3"><a href="amelinium.common.swagger.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>swagger</span></div></a></li><li class="depth-2 branch"><a href="amelinium.core.html"><div class="inner"><span class="tree" style="top: -176px;"><span class="top" style="height: 185px;"></span><span class="bottom"></span></span><span>core</span></div></a></li><li class="depth-2 current"><a href="amelinium.db.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-3"><a href="amelinium.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-2 branch"><a href="amelinium.errors.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-2"><a href="amelinium.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-3"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>client</span></div></div></li><li class="depth-4"><a href="amelinium.http.client.twilio.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>twilio</span></div></a></li><li class="depth-3 branch"><a href="amelinium.http.handler.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>handler</span></div></a></li><li class="depth-3"><a href="amelinium.http.middleware.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>middleware</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.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-4 branch"><a href="amelinium.http.middleware.content.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>content</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.db.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.debug.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>debug</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.format.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>format</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.headers.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>headers</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.language.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>language</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.lazy-req.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>lazy-req</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.populators.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>populators</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.remote-ip.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>remote-ip</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.roles.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>roles</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.middleware.session.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>session</span></div></a></li><li class="depth-4"><a href="amelinium.http.middleware.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-3 branch"><a href="amelinium.http.router.html"><div class="inner"><span class="tree" style="top: -424px;"><span class="top" style="height: 433px;"></span><span class="bottom"></span></span><span>router</span></div></a></li><li class="depth-3"><a href="amelinium.http.server.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>server</span></div></a></li><li class="depth-4 branch"><a href="amelinium.http.server.jetty.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>jetty</span></div></a></li><li class="depth-4"><a href="amelinium.http.server.undertow.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>undertow</span></div></a></li><li class="depth-2"><a href="amelinium.i18n.html"><div class="inner"><span class="tree" style="top: -672px;"><span class="top" style="height: 681px;"></span><span class="bottom"></span></span><span>i18n</span></div></a></li><li class="depth-3"><a href="amelinium.i18n.pluralizers.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>pluralizers</span></div></a></li><li class="depth-2 branch"><a href="amelinium.identity.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>identity</span></div></a></li><li class="depth-2 branch"><a href="amelinium.locale.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>locale</span></div></a></li><li class="depth-2 branch"><a href="amelinium.logging.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>logging</span></div></a></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>model</span></div></div></li><li class="depth-3 branch"><a href="amelinium.model.confirmation.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>confirmation</span></div></a></li><li class="depth-3"><a href="amelinium.model.user.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>user</span></div></a></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>proto</span></div></div></li><li class="depth-3 branch"><a href="amelinium.proto.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-3 branch"><a href="amelinium.proto.errors.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-3 branch"><a href="amelinium.proto.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-3 branch"><a href="amelinium.proto.session.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>session</span></div></a></li><li class="depth-3"><a href="amelinium.proto.twilio.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>twilio</span></div></a></li><li class="depth-2 branch"><a href="amelinium.schemas.html"><div class="inner"><span class="tree" style="top: -176px;"><span class="top" style="height: 185px;"></span><span class="bottom"></span></span><span>schemas</span></div></a></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>server</span></div></div></li><li class="depth-3"><a href="amelinium.server.ssl.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>ssl</span></div></a></li><li class="depth-2 branch"><a href="amelinium.system.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>system</span></div></a></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>types</span></div></div></li><li class="depth-3 branch"><a href="amelinium.types.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-3 branch"><a href="amelinium.types.db.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>db</span></div></a></li><li class="depth-3 branch"><a href="amelinium.types.errors.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-3 branch"><a href="amelinium.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-3 branch"><a href="amelinium.types.session.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>session</span></div></a></li><li class="depth-3"><a href="amelinium.types.twilio.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>twilio</span></div></a></li><li class="depth-2 branch"><a href="amelinium.utils.html"><div class="inner"><span class="tree" style="top: -207px;"><span class="top" style="height: 216px;"></span><span class="bottom"></span></span><span>utils</span></div></a></li><li class="depth-2"><a href="amelinium.web.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>web</span></div></a></li><li class="depth-3"><a href="amelinium.web.controller.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>controller</span></div></a></li><li class="depth-4 branch"><a href="amelinium.web.controller.admin.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>admin</span></div></a></li><li class="depth-4"><a href="amelinium.web.controller.user.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>user</span></div></a></li><li class="depth-3 branch"><a href="amelinium.web.js.html"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>js</span></div></a></li><li class="depth-3 branch"><a href="amelinium.web.taggers.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>taggers</span></div></a></li><li class="depth-3"><a href="amelinium.web.url.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>url</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="amelinium.db.html#var--.3E"><div class="inner"><span>-></span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-.3C-"><div class="inner"><span><-</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-.3C-seq"><div class="inner"><span><-seq</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-.3C.3C-"><div class="inner"><span><<-</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-.3C.3C-*"><div class="inner"><span><<-*</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-.3Cd-do.21"><div class="inner"><span><d-do!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-.3Cd-exec.21"><div class="inner"><span><d-exec!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-.3Cd-exec-one.21"><div class="inner"><span><d-exec-one!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-.3Cdo.21"><div class="inner"><span><do!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-.3Cdq"><div class="inner"><span><dq</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-.3Cexec.21"><div class="inner"><span><exec!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-.3Cexec-one.21"><div class="inner"><span><exec-one!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-.3Cq"><div class="inner"><span><q</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-auth"><div class="inner"><span>auth</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-bindable-sym"><div class="inner"><span>bindable-sym</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-bindable-sym.3F"><div class="inner"><span>bindable-sym?</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-cache-create"><div class="inner"><span>cache-create</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-cache-evict.21"><div class="inner"><span>cache-evict!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-cache-lookup"><div class="inner"><span>cache-lookup</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-cache-lookup-coll"><div class="inner"><span>cache-lookup-coll</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-cache-prepare"><div class="inner"><span>cache-prepare</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-cached-setting-del"><div class="inner"><span>cached-setting-del</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-cached-setting-get"><div class="inner"><span>cached-setting-get</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-cached-setting-set"><div class="inner"><span>cached-setting-set</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-caches"><div class="inner"><span>caches</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-close.21"><div class="inner"><span>close!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-close-db"><div class="inner"><span>close-db</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-close-mig"><div class="inner"><span>close-mig</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-close-pool"><div class="inner"><span>close-pool</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-coerce-in"><div class="inner"><span>coerce-in</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-coerce-in*"><div class="inner"><span>coerce-in*</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-coerce-out"><div class="inner"><span>coerce-out</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-coerce-out*"><div class="inner"><span>coerce-out*</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-coerce-seq-in"><div class="inner"><span>coerce-seq-in</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-coerce-seq-in*"><div class="inner"><span>coerce-seq-in*</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-coerce-seq-out"><div class="inner"><span>coerce-seq-out</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-coerce-seq-out*"><div class="inner"><span>coerce-seq-out*</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-data-source.3F"><div class="inner"><span>data-source?</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-db-config.3F"><div class="inner"><span>db-config?</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-db-key-name"><div class="inner"><span>db-key-name</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-db-name"><div class="inner"><span>db-name</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-dbname-finder"><div class="inner"><span>dbname-finder</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-dbname-key-finder"><div class="inner"><span>dbname-key-finder</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-default-reporter"><div class="inner"><span>default-reporter</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-defcoercions"><div class="inner"><span>defcoercions</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-ds"><div class="inner"><span>ds</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-execute.21"><div class="inner"><span>execute!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-execute-one.21"><div class="inner"><span>execute-one!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-for-insert-multi-or"><div class="inner"><span>for-insert-multi-or</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-for-insert-or"><div class="inner"><span>for-insert-or</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-for-replace"><div class="inner"><span>for-replace</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-for-replace-multi"><div class="inner"><span>for-replace-multi</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-gen-builder"><div class="inner"><span>gen-builder</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-gen-builder-delayed"><div class="inner"><span>gen-builder-delayed</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-gen-qs-keyword"><div class="inner"><span>gen-qs-keyword</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-get-cached"><div class="inner"><span>get-cached</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-get-cached-coll"><div class="inner"><span>get-cached-coll</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-get-cached-coll-prop"><div class="inner"><span>get-cached-coll-prop</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-get-cached-prop"><div class="inner"><span>get-cached-prop</span></div></a></li><li class="depth-1"><a href="amelinium.db.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="amelinium.db.html#var-get-failed.3F"><div class="inner"><span>get-failed?</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-get-id"><div class="inner"><span>get-id</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-get-ids"><div class="inner"><span>get-ids</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-get-in-coercer"><div class="inner"><span>get-in-coercer</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-get-in-coercer*"><div class="inner"><span>get-in-coercer*</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-get-out-coercer"><div class="inner"><span>get-out-coercer</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-get-out-coercer*"><div class="inner"><span>get-out-coercer*</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-id-from-db"><div class="inner"><span>id-from-db</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-id-to-db"><div class="inner"><span>id-to-db</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-in-coercer"><div class="inner"><span>in-coercer</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-init-cache"><div class="inner"><span>init-cache</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-init-caches"><div class="inner"><span>init-caches</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-init-db"><div class="inner"><span>init-db</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-init-mig"><div class="inner"><span>init-mig</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-init-migrators"><div class="inner"><span>init-migrators</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-insert-multi-or.21"><div class="inner"><span>insert-multi-or!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-insert-or.21"><div class="inner"><span>insert-or!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-insert-or-ignore.21"><div class="inner"><span>insert-or-ignore!</span></div></a></li><li class="depth-1"><a href="amelinium.db.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="amelinium.db.html#var-insert-or-replace.21"><div class="inner"><span>insert-or-replace!</span></div></a></li><li class="depth-1"><a href="amelinium.db.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="amelinium.db.html#var-invalidate.21"><div class="inner"><span>invalidate!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-invalidate.2B.21"><div class="inner"><span>invalidate+!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-invalidator"><div class="inner"><span>invalidator</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-lazy-do"><div class="inner"><span>lazy-do</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-lazy-execute.21"><div class="inner"><span>lazy-execute!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-lazy-execute-one.21"><div class="inner"><span>lazy-execute-one!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-lazy-get-by-id"><div class="inner"><span>lazy-get-by-id</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-list-caches"><div class="inner"><span>list-caches</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-make-deleter"><div class="inner"><span>make-deleter</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-make-getter"><div class="inner"><span>make-getter</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-make-getter-coll"><div class="inner"><span>make-getter-coll</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-make-setter"><div class="inner"><span>make-setter</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-make-setting-deleter"><div class="inner"><span>make-setting-deleter</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-make-setting-getter"><div class="inner"><span>make-setting-getter</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-make-setting-setter"><div class="inner"><span>make-setting-setter</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-map-.3E"><div class="inner"><span>map-></span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-mem-assoc-existing.21"><div class="inner"><span>mem-assoc-existing!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-memoize"><div class="inner"><span>memoize</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-memoize.2B"><div class="inner"><span>memoize+</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-memoizer"><div class="inner"><span>memoizer</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-migrate.21"><div class="inner"><span>migrate!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-migration"><div class="inner"><span>migration</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-migration-databases"><div class="inner"><span>migration-databases</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-migration-index"><div class="inner"><span>migration-index</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-migrations"><div class="inner"><span>migrations</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-migrator-config"><div class="inner"><span>migrator-config</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-migrators"><div class="inner"><span>migrators</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-not-found.3F"><div class="inner"><span>not-found?</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-opts-lazy-map"><div class="inner"><span>opts-lazy-map</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-opts-lazy-simple-map"><div class="inner"><span>opts-lazy-simple-map</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-opts-lazy-simple-vec"><div class="inner"><span>opts-lazy-simple-vec</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-opts-lazy-slashed-map"><div class="inner"><span>opts-lazy-slashed-map</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-opts-lazy-slashed-vec"><div class="inner"><span>opts-lazy-slashed-vec</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-opts-lazy-vec"><div class="inner"><span>opts-lazy-vec</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-opts-map"><div class="inner"><span>opts-map</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-opts-simple-map"><div class="inner"><span>opts-simple-map</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-opts-simple-vec"><div class="inner"><span>opts-simple-vec</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-opts-slashed-map"><div class="inner"><span>opts-slashed-map</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-opts-slashed-vec"><div class="inner"><span>opts-slashed-vec</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-opts-vec"><div class="inner"><span>opts-vec</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-out-coercer"><div class="inner"><span>out-coercer</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-pool-datasource"><div class="inner"><span>pool-datasource</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-prep-db"><div class="inner"><span>prep-db</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-print-caches"><div class="inner"><span>print-caches</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-remove-caches"><div class="inner"><span>remove-caches</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-replace.21"><div class="inner"><span>replace!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-replace-multi.21"><div class="inner"><span>replace-multi!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-resume-db"><div class="inner"><span>resume-db</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-resume-pool"><div class="inner"><span>resume-pool</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-rollback.21"><div class="inner"><span>rollback!</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-seq-.3E"><div class="inner"><span>seq-></span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-simple-.3E"><div class="inner"><span>simple-></span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-suspend-db"><div class="inner"><span>suspend-db</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-suspend-pool"><div class="inner"><span>suspend-pool</span></div></a></li><li class="depth-1"><a href="amelinium.db.html#var-try-initialize-db"><div class="inner"><span>try-initialize-db</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">amelinium.db</h1><h4 class="added">added in 1.0.0</h4><div class="doc"><div class="markdown"><p>Cross-category databases and generators for Amelinium.</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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L336">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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L302">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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L370">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>[(amelinium.db/<- :users/id id)
(amelinium.db/<- :confirmations/email email)
(amelinium.db/<- :confirmations/expires expires)]
</code></pre>
<p>And then to:</p>
<pre><code>[(#<Fn@4d7e49d amelinium.model.user/id_to_db> id)
(amelinium.db/coerce-in* :confirmations/email email)
(#<Fn@3bf6fdc6 amelinium.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>amelinium.db/coerce-in*</code> was generated instead.</p>
<p>Let’s have a quick look at some real-world example:</p>
<pre><code>(amelinium.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 (amelinium.db/<- :confirmations/id id)]
[DB__confirmations_id_id_54377141
(amelinium.db/<- :confirmations/code code)
(amelinium.db/<- :confirmations/token token)
(amelinium.db/<- :confirmations/reason reason)
(amelinium.db/<- :confirmations/id-type id-type)
(amelinium.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 amelinium.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 amelinium.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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L582">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/amelinium/tree/1.0.1/src/amelinium/db.clj#L741">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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L942">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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L949">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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L956">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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L963">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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L909">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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L970">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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L977">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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L879">view source</a></div></div><div class="public anchor" id="var-auth"><h3>auth</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L67">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/amelinium/tree/1.0.1/src/amelinium/db.clj#L541">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/amelinium/tree/1.0.1/src/amelinium/db.clj#L549">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><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><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><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><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 get an initial map of entries. Returns a cache object.</p>
</div></div></div><div class="public anchor" id="var-cached-setting-del"><h3>cached-setting-del</h3><div class="usage"><code>(cached-setting-del cache deleter db entity-id)</code><code>(cached-setting-del cache deleter db entity-id setting-id)</code><code>(cached-setting-del cache deleter db entity-id setting-id & pairs)</code></div><div class="doc"><div class="markdown"><p>Deletes the cached result of calling the given setting deleter. Purges cache entry after operation succeeded.</p>
</div></div></div><div class="public anchor" id="var-cached-setting-get"><h3>cached-setting-get</h3><div class="usage"><code>(cached-setting-get cache getter db entity-id setting-id)</code><code>(cached-setting-get cache getter db entity-id setting-id & setting-ids)</code></div><div class="doc"><div class="markdown"><p>Gets the cached result of calling the given setting getter. Updates cache when necessary.</p>
</div></div></div><div class="public anchor" id="var-cached-setting-set"><h3>cached-setting-set</h3><div class="usage"><code>(cached-setting-set cache setter db entity-id setting-id value)</code><code>(cached-setting-set cache setter db entity-id setting-id value & pairs)</code></div><div class="doc"><div class="markdown"><p>Sets the cached result of calling the given setting setter. Purges cache entry after operation succeeded.</p>
</div></div></div><div class="public anchor" id="var-caches"><h3>caches</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L69">view source</a></div></div><div class="public anchor" id="var-close.21"><h3>close!</h3><div class="usage"><code>(close! obj)</code></div><div class="doc"><div class="markdown"><p>Calls <code>.close</code> on <code>obj</code> if it implements <code>java.io.Closeable</code> interface. Otherwise uses reflection to check if there is unary <code>.close</code> method, and if it is found, calls it passing <code>obj</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1297">view source</a></div></div><div class="public anchor" id="var-close-db"><h3>close-db</h3><div class="usage"><code>(close-db k config)</code></div><div class="doc"><div class="markdown"><p>Closes the database connection. Calls configured finalized (<code>:finalizer</code> key) before.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1382">view source</a></div></div><div class="public anchor" id="var-close-mig"><h3>close-mig</h3><div class="usage"><code>(close-mig k config)</code></div><div class="doc"><div class="markdown"><p>Closes database connection used for migration. Expects <code>config</code> to be an argument-less function returning database configuration.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1451">view source</a></div></div><div class="public anchor" id="var-close-pool"><h3>close-pool</h3><div class="usage"><code>(close-pool ds)</code></div><div class="doc"><div class="markdown"><p>Closes connection pool <code>ds</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1322">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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L237">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/amelinium/tree/1.0.1/src/amelinium/db.clj#L249">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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L254">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/amelinium/tree/1.0.1/src/amelinium/db.clj#L267">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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L272">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/amelinium/tree/1.0.1/src/amelinium/db.clj#L282">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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L287">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/amelinium/tree/1.0.1/src/amelinium/db.clj#L297">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"></div></div></div><div class="public anchor" id="var-db-config.3F"><h3>db-config?</h3><div class="usage"><code>(db-config? v)</code></div><div class="doc"><div class="markdown"><p>Returns true if a value of the given argument is an instance of DBConfig record type.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1092">view source</a></div></div><div class="public anchor" id="var-db-key-name"><h3>db-key-name</h3><div class="usage"><code>(db-key-name v)</code><code>(db-key-name v & more)</code></div><div class="doc"><div class="markdown"><p>Obtains the database (data source) key name from the given configuration data structure by using known patterns.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1157">view source</a></div></div><div class="public anchor" id="var-db-name"><h3>db-name</h3><div class="usage"><code>(db-name v)</code><code>(db-name v & more)</code></div><div class="doc"><div class="markdown"><p>Obtains the database (data source) name from the given configuration data structure by using known patterns.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1144">view source</a></div></div><div class="public anchor" id="var-dbname-finder"><h3>dbname-finder</h3><div class="usage"><code>(dbname-finder m)</code><code>(dbname-finder v)</code></div><div class="doc"><div class="markdown"><p>Finds a database name in the given map <code>m</code> or by taking it from <code>v</code> if it is a string or ident.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1123">view source</a></div></div><div class="public anchor" id="var-dbname-key-finder"><h3>dbname-key-finder</h3><div class="usage"><code>(dbname-key-finder m)</code><code>(dbname-key-finder v)</code></div><div class="doc"><div class="markdown"><p>Finds a database identifier in the given map <code>m</code> or by taking it from <code>v</code> if it is a string or ident.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1106">view source</a></div></div><div class="public anchor" id="var-default-reporter"><h3>default-reporter</h3><div class="usage"><code>(default-reporter db-k-name ds op id)</code></div><div class="doc"><div class="markdown"><p>Logs database migration event described by database identifier <code>db-k-name</code>, data source <code>ds</code>, operation (<code>:up</code> or <code>:down</code>) and migration identifier <code>id</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1412">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>amelinium.db/in-coercer</code> and two for <code>amelinium.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 amelinium.db/in-coercer :users/some-identifier [_] str)
(defmethod amelinium.db/in-coercer :users/some_identifier [_] str)
(defmethod amelinium.db/out-coercer :users/some-identifier [_] keyword)
(defmethod amelinium.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>:amelinium.db/any</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L764">view source</a></div></div><div class="public anchor" id="var-ds"><h3>ds</h3><div class="usage"><code>(ds v)</code></div><div class="doc"><div class="markdown"><p>Gets the data source from the DBConfig record. If the given argument is not an instance of DBConfig, it simply returns it.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1098">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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1006">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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1000">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><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><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><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><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>amelinium.db/column-by-index-fn</code> to coerce the results.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L850">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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L856">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/amelinium/tree/1.0.1/src/amelinium/db.clj#L514">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><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><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><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><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><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><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><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><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/amelinium/tree/1.0.1/src/amelinium/db.clj#L186">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/amelinium/tree/1.0.1/src/amelinium/db.clj#L177">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/amelinium/tree/1.0.1/src/amelinium/db.clj#L208">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/amelinium/tree/1.0.1/src/amelinium/db.clj#L199">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><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><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/amelinium/tree/1.0.1/src/amelinium/db.clj#L160">view source</a></div></div><div class="public anchor" id="var-init-cache"><h3>init-cache</h3><div class="usage"><code>(init-cache {:keys [size ttl seed]})</code></div><div class="doc"><div class="markdown"><p>Initializes single cache by parsing TTL and queue size.</p>
</div></div></div><div class="public anchor" id="var-init-caches"><h3>init-caches</h3><div class="usage"><code>(init-caches config)</code></div><div class="doc"><div class="markdown"><p>Initializes in-memory caches by resetting atoms associated with cache parameters.</p>
</div></div></div><div class="public anchor" id="var-init-db"><h3>init-db</h3><div class="usage"><code>(init-db k config)</code><code>(init-db k config ds-getter)</code><code>(init-db k config ds-getter ds-closer)</code><code>(init-db k config ds-getter ds-closer ds-suspender)</code><code>(init-db k config ds-getter ds-closer ds-suspender ds-resumer)</code></div><div class="doc"><div class="markdown"><p>Initializes database configuration <code>config</code> for the configuration key <code>k</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1353">view source</a></div></div><div class="public anchor" id="var-init-mig"><h3>init-mig</h3><div class="usage"><code>(init-mig k config)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1430">view source</a></div></div><div class="public anchor" id="var-init-migrators"><h3>init-migrators</h3><div class="usage"><code>(init-migrators config)</code></div><div class="doc"><div class="markdown"><p>Initializes migrators given in a <code>config</code> sequence. Calls each function found or <code>init-mig</code> if it’s not a function but migration configuration map.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1444">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><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><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><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><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><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><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><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><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><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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1012">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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L993">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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L986">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/amelinium/tree/1.0.1/src/amelinium/db.clj#L1016">view source</a></div></div><div class="public anchor" id="var-list-caches"><h3>list-caches</h3><div class="usage"><code>(list-caches)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L127">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"></div></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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1028">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/amelinium/tree/1.0.1/src/amelinium/db.clj#L1057">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"></div></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><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><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><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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L755">view source</a></div></div><div class="public anchor" id="var-mem-assoc-existing.21"><h3>mem-assoc-existing!</h3><div class="usage"><code>(mem-assoc-existing! f key k v)</code><code>(mem-assoc-existing! f key k v & kvs)</code></div><div class="doc"><div class="markdown"><p>Manual cache updater for functions memoized with <code>clojure.core.memoize</code>. Sets a key <code>k</code> to a value <code>v</code> in a map being a cached result of prior calling memoized function <code>f</code>. Will not associate any value if the caching key does not exist. The key should be passed as a vector in <code>key</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L131">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><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><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><div class="public anchor" id="var-migrate.21"><h3>migrate!</h3><div class="usage"><code>(migrate!)</code><code>(migrate! opts)</code></div><div class="doc"><div class="markdown"><p>Migrates all databases (or a database specified by a migrator function passed as an argument) up to the latest migration. Optional map of options can be passed which will be merged with each migration options.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1222">view source</a></div></div><div class="public anchor" id="var-migration"><h3>migration</h3><div class="usage"><code>(migration migrator-obj)</code></div><div class="doc"><div class="markdown"><p>Calls <code>migrator-obj</code> function without any arguments.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1176">view source</a></div></div><div class="public anchor" id="var-migration-databases"><h3>migration-databases</h3><div class="usage"><code>(migration-databases config)</code></div><div class="doc"><div class="markdown"><p>Returns distinct identifiers of all migration databases found in <code>config</code> sequence of functions by calling each function and extracting a value under <code>:dbkey</code> key of a returned map.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1198">view source</a></div></div><div class="public anchor" id="var-migration-index"><h3>migration-index</h3><div class="usage"><code>(migration-index)</code></div><div class="doc"><div class="markdown"><p>Gets a current value of ragtime-repl/migration-indexes.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1286">view source</a></div></div><div class="public anchor" id="var-migrations"><h3>migrations</h3><div class="usage"><code>(migrations)</code><code>(migrations migrators-vec)</code></div><div class="doc"><div class="markdown"><p>Takes a migrators vector (<code>migrators-vec</code>) or uses a default migrators vector (from a global variable <code>amelinium.db/migrators</code>) and calls all of them (without passing any arguments) gathering returned results in a vector.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1181">view source</a></div></div><div class="public anchor" id="var-migrator-config"><h3>migrator-config</h3><div class="usage"><code>(migrator-config config loader migration-dir)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1421">view source</a></div></div><div class="public anchor" id="var-migrators"><h3>migrators</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L68">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><div class="public anchor" id="var-opts-lazy-map"><h3>opts-lazy-map</h3><div class="usage"></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L873">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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L874">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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L871">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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L875">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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L872">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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L870">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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L864">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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L865">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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L867">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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L868">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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L869">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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L866">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/amelinium/tree/1.0.1/src/amelinium/db.clj#L167">view source</a></div></div><div class="public anchor" id="var-pool-datasource"><h3>pool-datasource</h3><div class="usage"><code>(pool-datasource db-props)</code></div><div class="doc"><div class="markdown"><p>Returns connection pool (<code>HikariDataSource</code>) object obtained from <code>db-props</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1313">view source</a></div></div><div class="public anchor" id="var-prep-db"><h3>prep-db</h3><div class="usage"><code>(prep-db config)</code></div><div class="doc"><div class="markdown"><p>Prepares database configuration.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1340">view source</a></div></div><div class="public anchor" id="var-print-caches"><h3>print-caches</h3><div class="usage"><code>(print-caches)</code><code>(print-caches caches-obj)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L123">view source</a></div></div><div class="public anchor" id="var-remove-caches"><h3>remove-caches</h3><div class="usage"><code>(remove-caches config)</code></div><div class="doc"><div class="markdown"><p>Removes cache structures.</p>
</div></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><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><div class="public anchor" id="var-resume-db"><h3>resume-db</h3><div class="usage"><code>(resume-db k config old-config old-impl)</code></div><div class="doc"><div class="markdown"><p>Resumes the database connection.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1402">view source</a></div></div><div class="public anchor" id="var-resume-pool"><h3>resume-pool</h3><div class="usage"><code>(resume-pool ds)</code></div><div class="doc"><div class="markdown"><p>Resumes connection pool <code>ds</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1332">view source</a></div></div><div class="public anchor" id="var-rollback.21"><h3>rollback!</h3><div class="usage"><code>(rollback!)</code><code>(rollback! opts)</code><code>(rollback! opts amount-or-id)</code></div><div class="doc"><div class="markdown"><p>Rolls back all databases or a database specified by a migrator function passed as an argument. Optional map of options can be passed which will be merged with each migration options. If a value is passed instead of a map or a function it will be used as an additional argument meaning a number of migrations or a migration ID.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1249">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>amelinium.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/amelinium/tree/1.0.1/src/amelinium/db.clj#L394">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"></div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L750">view source</a></div></div><div class="public anchor" id="var-suspend-db"><h3>suspend-db</h3><div class="usage"><code>(suspend-db k config)</code></div><div class="doc"><div class="markdown"><p>Suspends the database connection.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1393">view source</a></div></div><div class="public anchor" id="var-suspend-pool"><h3>suspend-pool</h3><div class="usage"><code>(suspend-pool ds)</code></div><div class="doc"><div class="markdown"><p>Suspends connection pool <code>ds</code>.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1327">view source</a></div></div><div class="public anchor" id="var-try-initialize-db"><h3>try-initialize-db</h3><div class="usage"><code>(try-initialize-db config)</code></div><div class="doc"><div class="markdown"><p>Tries to create a database described by <code>config</code> map if it does not exist yet.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/amelinium/tree/1.0.1/src/amelinium/db.clj#L1190">view source</a></div></div></div></body></html>