Qore MapperUtil Module Reference 1.0.1
Loading...
Searching...
No Matches
MapperUtil.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* Mapper.qm Copyright 2014 - 2023 Qore Technologies, s.r.o.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23*/
24
25// minimum required Qore version
26
27// require type definitions everywhere
28
29// enable all warnings
30
31// do not use "$" for vars
32
33
56namespace Mapper {
58 const MapperKeyInfo = {
59 "code": <MapperRuntimeKeyInfo>{
60 "desc": "a code block for generating the field output programmatically",
61 "value_type": "mapper-code",
62 },
63 "constant": <MapperRuntimeKeyInfo>{
64 "desc": "a constant value for the output field",
65 "value_type": "any",
66 "requires_field_type": True,
67 "unique_roles": "*",
68 },
69 "default": <MapperRuntimeKeyInfo>{
70 "desc": "the default value for the field if no input is provided",
71 "value_type": "any",
72 "requires_field_type": True,
73 },
74 "index": <MapperRuntimeKeyInfo>{
75 "desc": "the index number of the row; an integer value will be added to the current row number, a string "
76 "will be prepended to the current row number",
77 "value_type": "any",
78 "unique_roles": "*",
79 },
80 "name": <MapperRuntimeKeyInfo>{
81 "desc": "the name of the input field; dot notation accepted",
82 "value_type": "string",
83 "unique_roles": "value",
84 },
85 "runtime": <MapperRuntimeKeyInfo>{
86 "desc": "the name of the field in the runtime hash where to take the value from",
87 "value_type": "string",
88 "unique_roles": "*",
89 },
90 "submapper": <MapperRuntimeKeyInfo>{
91 "desc": "the name or identifier of a submapper that will provide a list of values for this field (cannot "
92 "be used with bulk APIs)",
93 "value_type": "string",
94 "unique_roles": "submapper",
95 },
96 "submapper_auto_input": <MapperRuntimeKeyInfo>{
97 "desc": "use the input provider from the submapper for the output of the field; requires "
98 "\"submapper_options\" to provide input configuration for the submapper",
99 "value_type": "bool",
100 "requires_roles": ("submapper", "submapper_options"),
101 },
102 "submapper_options": <MapperRuntimeKeyInfo>{
103 "desc": "allows a parent mapper to affect the options of the submapper based on current data; use "
104 "\"$local:input.<field>\" to refer to mapped data in the current parent mapper input row to affect "
105 "submapper options",
106 "value_type": "hash",
107 "unique_roles": ("submapper_options"),
108 "requires_roles": "submapper",
109 },
110 "trunc": <MapperRuntimeKeyInfo>{
111 "desc": "if True and the input is longer than the output field permits, the input will be "
112 "silently truncated",
113 "value_type": "bool",
114 },
115 "type_options": <MapperRuntimeKeyInfo>{
116 "desc": "a hash of type options; this must correspond to option values for the output data type",
117 "value_type": "option_hash",
118 },
119 "use_input_record": <MapperRuntimeKeyInfo>{
120 "desc": "The entire input record will be used for the output field mapping; only compatible with hash "
121 "output fields",
122 "value_type": "bool",
123 "unique_roles": "*",
124 "returns_type": "hash",
125 },
126 };
127
129 public hashdecl MapperRuntimeKeyInfo {
131 string desc;
132
134 string value_type = "string";
135
137 *hash<string, bool> conflicting_keys;
138
141
143
146 *softlist<string> unique_roles;
147
149 *softlist<string> requires_roles;
150
153
155
178 *code handler;
179 };
180};
All the definitions in the MapperUtil module are contained in the Mapper namespace.
Definition: MapperUtil.qm.dox.h:56
const MapperKeyInfo
Mapper standard field key info hash.
Definition: MapperUtil.qm.dox.h:58
Describes a runtime mapper field key.
Definition: MapperUtil.qm.dox.h:129
*string returns_type
If the key provides a value that returns a specific type.
Definition: MapperUtil.qm.dox.h:152
*hash< string, bool > conflicting_keys
Hash of conflicting keys, if any.
Definition: MapperUtil.qm.dox.h:137
*softlist< string > requires_roles
If the key can only be used if one or more other keys supplying the given roles are also present.
Definition: MapperUtil.qm.dox.h:149
bool requires_field_type
If the type of the value for the key must be the same as the field type.
Definition: MapperUtil.qm.dox.h:140
*softlist< string > unique_roles
If the key provides some unique functionality.
Definition: MapperUtil.qm.dox.h:146
*code handler
The code to handle the key at runtime.
Definition: MapperUtil.qm.dox.h:178
string value_type
The type of value that must be assigned to this key.
Definition: MapperUtil.qm.dox.h:134
string desc
A description of the key.
Definition: MapperUtil.qm.dox.h:131