-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathlocus_mmdb_data_raw.erl
103 lines (85 loc) · 3.17 KB
/
locus_mmdb_data_raw.erl
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
%% Copyright (c) 2021-2024 Guilherme Andrade
%%
%% Permission is hereby granted, free of charge, to any person obtaining a
%% copy of this software and associated documentation files (the "Software"),
%% to deal in the Software without restriction, including without limitation
%% the rights to use, copy, modify, merge, publish, distribute, sublicense,
%% and/or sell copies of the Software, and to permit persons to whom the
%% Software is furnished to do so, subject to the following conditions:
%%
%% The above copyright notice and this permission notice shall be included in
%% all copies or substantial portions of the Software.
%%
%% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
%% IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
%% FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
%% AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
%% LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
%% FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
%% DEALINGS IN THE SOFTWARE.
%%
%% locus is an independent project and has not been authorized, sponsored,
%% or otherwise approved by MaxMind.
%% @reference <a target="_parent" href="https://maxmind.github.io/MaxMind-DB/">
%% MaxMind DB File Format Specification</a>
%% @doc API for working with MMDB - raw data representation (it preserves
%% the original type for when it's necessary to distinguish between e.g.
%% `{uint32, 0}' and `{uint16, 0}', which `locus_mmdb_data' does not allow for.)
%%
-module(locus_mmdb_data_raw).
%% ------------------------------------------------------------------
%% Type Definitions
%% ------------------------------------------------------------------
-type value()
:: utf8_string()
| double()
| bytes()
| uint16()
| uint32()
| map_()
| int32()
| uint64()
| uint128()
| array()
| boolean_()
| float_().
-export_type([value/0]).
-type utf8_string() :: {utf8_string, locus_mmdb_data:utf8_string()}.
-export_type([utf8_string/0]).
-type double() :: {double, locus_mmdb_data:double()}.
-export_type([double/0]).
-type bytes() :: {bytes, locus_mmdb_data:bytes()}.
-export_type([bytes/0]).
-type uint16() :: {uint16, locus_mmdb_data:uint16()}.
-export_type([uint16/0]).
-type uint32() :: {uint32, locus_mmdb_data:uint32()}.
-export_type([uint32/0]).
-type map_() :: {map, #{locus_mmdb_data:utf8_string() => value()}}.
-export_type([map_/0]).
-type int32() :: {int32, locus_mmdb_data:int32()}.
-export_type([int32/0]).
-type uint64() :: {uint64, locus_mmdb_data:uint64()}.
-export_type([uint64/0]).
-type uint128() :: {uint128, locus_mmdb_data:uint128()}.
-export_type([uint128/0]).
-type array() :: {array, [value()]}.
-export_type([array/0]).
-type boolean_() :: {boolean, locus_mmdb_data:boolean_()}.
-export_type([boolean_/0]).
-type float_() :: {float, locus_mmdb_data:float_()}.
-export_type([float_/0]).
-type value_tag()
:: pointer
| utf8_string
| double
| bytes
| uint16
| uint32
| map
| int32
| uint64
| uint128
| array
| boolean
| float.
-export_type([value_tag/0]).