-
Notifications
You must be signed in to change notification settings - Fork 0
/
io.randomseed.bankster.util.importer.html
39 lines (39 loc) · 20.1 KB
/
io.randomseed.bankster.util.importer.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
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>io.randomseed.bankster.util.importer 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">Bankster</span> <span class="project-version">1.2.16</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_data_structures.html"><div class="inner"><span>Data Structures</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>io</span></div></div></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>randomseed</span></div></div></li><li class="depth-3"><a href="io.randomseed.bankster.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>bankster</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.bankster.config.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>config</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.bankster.currency.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>currency</span></div></a></li><li class="depth-4"><a href="io.randomseed.bankster.money.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>money</span></div></a></li><li class="depth-5 branch"><a href="io.randomseed.bankster.money.inter-ops.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>inter-ops</span></div></a></li><li class="depth-5"><a href="io.randomseed.bankster.money.ops.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>ops</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.bankster.registry.html"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>registry</span></div></a></li><li class="depth-4 branch"><a href="io.randomseed.bankster.scale.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>scale</span></div></a></li><li class="depth-4"><a href="io.randomseed.bankster.util.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>util</span></div></a></li><li class="depth-5 branch"><a href="io.randomseed.bankster.util.fs.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>fs</span></div></a></li><li class="depth-5 branch current"><a href="io.randomseed.bankster.util.importer.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>importer</span></div></a></li><li class="depth-5"><a href="io.randomseed.bankster.util.map.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>map</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-countries-load"><div class="inner"><span>countries-load</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-currencies-load"><div class="inner"><span>currencies-load</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-currency-.3Emap"><div class="inner"><span>currency->map</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-default-countries-csv"><div class="inner"><span>default-countries-csv</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-default-currencies-csv"><div class="inner"><span>default-currencies-csv</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-default-data-reader-filename"><div class="inner"><span>default-data-reader-filename</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-default-dump-filename"><div class="inner"><span>default-dump-filename</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-default-export-filename"><div class="inner"><span>default-export-filename</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-default-handlers-namespace"><div class="inner"><span>default-handlers-namespace</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-default-handlers-pathname"><div class="inner"><span>default-handlers-pathname</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-default-reader-filenames"><div class="inner"><span>default-reader-filenames</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-default-resource-must-exist-file"><div class="inner"><span>default-resource-must-exist-file</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-default-resource-name"><div class="inner"><span>default-resource-name</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-dump"><div class="inner"><span>dump</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-export"><div class="inner"><span>export</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-handler-gen"><div class="inner"><span>handler-gen</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-joda-.3Ebankster-dump"><div class="inner"><span>joda->bankster-dump</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-joda-.3Ebankster-export"><div class="inner"><span>joda->bankster-export</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-joda-import"><div class="inner"><span>joda-import</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-localized-.3Emap"><div class="inner"><span>localized->map</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-readers-export"><div class="inner"><span>readers-export</span></div></a></li><li class="depth-1"><a href="io.randomseed.bankster.util.importer.html#var-registry-.3Emap"><div class="inner"><span>registry->map</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">io.randomseed.bankster.util.importer</h1><div class="doc"><div class="markdown"></div></div><div class="public anchor" id="var-countries-load"><h3>countries-load</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(countries-load)</code><code>(countries-load pathname)</code></div><div class="doc"><div class="markdown"><p>Reads CSV file in a format compliant with Joda Money and returns a map with currency to countries associations where countries are as sets. The pathname should be relative to resources directory.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L122">view source</a></div></div><div class="public anchor" id="var-currencies-load"><h3>currencies-load</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(currencies-load)</code><code>(currencies-load pathname)</code></div><div class="doc"><div class="markdown"><p>Reads CSV file compliant with Joda Money and returns a map with currency ID (keyword) as a key and currency data as its value (vector). The pathname should be relative to resources directory.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L136">view source</a></div></div><div class="public anchor" id="var-currency-.3Emap"><h3>currency->map</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(currency->map {:keys [:numeric :scale :kind :weight]})</code></div><div class="doc"><div class="markdown"><p>Takes a currency and returns a map suitable for putting into a configuration file. Extensions fields are ignored.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L166">view source</a></div></div><div class="public anchor" id="var-default-countries-csv"><h3>default-countries-csv</h3><h4 class="added">added in 1.0.0</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>Default CSV file with countries database.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L67">view source</a></div></div><div class="public anchor" id="var-default-currencies-csv"><h3>default-currencies-csv</h3><h4 class="added">added in 1.0.0</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>Default CSV file with currencies database.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L72">view source</a></div></div><div class="public anchor" id="var-default-data-reader-filename"><h3>default-data-reader-filename</h3><h4 class="added">added in 1.2.4</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>Default data reader filename (pure data).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L52">view source</a></div></div><div class="public anchor" id="var-default-dump-filename"><h3>default-dump-filename</h3><h4 class="added">added in 1.0.0</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>Default EDN dump file.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L37">view source</a></div></div><div class="public anchor" id="var-default-export-filename"><h3>default-export-filename</h3><h4 class="added">added in 1.0.0</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>Default EDN export file.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L42">view source</a></div></div><div class="public anchor" id="var-default-handlers-namespace"><h3>default-handlers-namespace</h3><h4 class="added">added in 1.0.0</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>Default namespace of a reader handlers.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L62">view source</a></div></div><div class="public anchor" id="var-default-handlers-pathname"><h3>default-handlers-pathname</h3><h4 class="added">added in 1.0.0</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>Default pathname of a reader handlers file.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L57">view source</a></div></div><div class="public anchor" id="var-default-reader-filenames"><h3>default-reader-filenames</h3><h4 class="added">added in 1.0.0</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>Default data reader filenames (Clojure code).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L47">view source</a></div></div><div class="public anchor" id="var-default-resource-must-exist-file"><h3>default-resource-must-exist-file</h3><h4 class="added">added in 1.0.0</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>Filename in a default resource container that must exist.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L32">view source</a></div></div><div class="public anchor" id="var-default-resource-name"><h3>default-resource-name</h3><h4 class="added">added in 1.0.0</h4><div class="usage"></div><div class="doc"><div class="markdown"><p>Name of a default resource container.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L27">view source</a></div></div><div class="public anchor" id="var-dump"><h3>dump</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(dump)</code><code>(dump registry)</code><code>(dump filename registry)</code></div><div class="doc"><div class="markdown"><p>For the given filename (defaults to default-dump-filename) and a registry (defaults to a global registry) creates a dump in EDN format.</p>
<p>Filename will be placed in the default directory of resources (the same that which config.edn).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L200">view source</a></div></div><div class="public anchor" id="var-export"><h3>export</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(export)</code><code>(export registry)</code><code>(export filename registry)</code></div><div class="doc"><div class="markdown"><p>For the given filename (defaults to default-dump-filename) and a registry (defaults to a global registry) creates a configuration file in EDN format.</p>
<p>Filename will be placed in the default directory of resources (the same which holds config.edn).</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L219">view source</a></div></div><div class="public anchor" id="var-handler-gen"><h3>handler-gen</h3><div class="usage"><code>(handler-gen names)</code></div><div class="doc"><div class="markdown"><p>Generates handler functions for tagged literals for each namespaced currency. Each function will have a prefixed name.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L261">view source</a></div></div><div class="public anchor" id="var-joda-.3Ebankster-dump"><h3>joda->bankster-dump</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(joda->bankster-dump)</code></div><div class="doc"><div class="markdown"><p>Reads Joda Money CSV files and creates a registry dump named resources/io/randomseed/bankster/registry-dump.edn.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L367">view source</a></div></div><div class="public anchor" id="var-joda-.3Ebankster-export"><h3>joda->bankster-export</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(joda->bankster-export)</code></div><div class="doc"><div class="markdown"><p>Reads Joda Money CSV files and creates a configuration file named resources/io/randomseed/bankster/registry-export.edn.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L374">view source</a></div></div><div class="public anchor" id="var-joda-import"><h3>joda-import</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(joda-import)</code><code>(joda-import countries-pathname currencies-pathname)</code></div><div class="doc"><div class="markdown"><p>Reads CSV files with countries and currencies definitions (Joda Money format) and returns a registry.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L147">view source</a></div></div><div class="public anchor" id="var-localized-.3Emap"><h3>localized->map</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(localized->map m)</code></div><div class="doc"><div class="markdown"><p>Takes a localized map entry (1st level) and returns a map suitable for putting into a configuration file.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L177">view source</a></div></div><div class="public anchor" id="var-readers-export"><h3>readers-export</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(readers-export)</code><code>(readers-export registry)</code><code>(readers-export registry filenames)</code><code>(readers-export registry filenames data-filename)</code><code>(readers-export registry filenames data-filename handlers-pathname handlers-namespace)</code></div><div class="doc"><div class="markdown"><p>Creates clojure source code files with reader functions for tagged literals handling on a basis of registry information and data reader map files referring to the created handlers.</p>
<p>The purpose of generation is primary to create handlers for literals in forms of #money/NS<a href="…">…</a>, where NS is a namespace that corresponds to a namespace of a currency. Possible namespaces are taken from a registry (a map from its field .cur-id->cur).</p>
<p>The function takes a registry (defaults to a global registry if not given), a sequence of reader filenames (defaults to default-reader-filenames), default handlers pathname (defaults to default-handlers-pathname) and default handlers namespace (defaults to default-handlers-namespace).</p>
<p>Default namespace is a namespace in which money handlers will be defined. These handlers will be written to a file which pathname is constructed using the following tactic:</p>
<ol>
<li>
<p>Obtain the directory of the first filename from the given filenames list using Java’s resource lookup. The assumption is it should be src directory of a project.</p>
</li>
<li>
<p>Append the file path passed as the handlers-pathname.</p>
</li>
</ol>
<p>As for data reader map files, their directory name is also based on the lookup of the first filename. Each filename will be populated with the same content which is a map associating tagged literal with a function.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L268">view source</a></div></div><div class="public anchor" id="var-registry-.3Emap"><h3>registry->map</h3><h4 class="added">added in 1.0.0</h4><div class="usage"><code>(registry->map)</code><code>(registry->map registry)</code></div><div class="doc"><div class="markdown"><p>Takes a registry and returns a map suitable for putting into a configuration file. Extensions fields are ignored. When registry is not given it uses the global one. Extension fields are ignored.</p>
</div></div><div class="src-link"><a href="https://github.com/randomseed-io/bankster/blob/1.2.16/src/io/randomseed/bankster/util/importer.clj#L184">view source</a></div></div></div></body></html>