Big_map
A lazily deserialised map that is intended to store large amounts of
data. Here, "lazily" means that storage is read or written per key on
demand. Therefore there are no map
, fold
, and iter
operations as
there are in Map.
Compared to strict maps, which have a high upfront gas cost to deserialise all the data and then have cheaper access costs thereafter, lazily deserialised maps spread this cost out across each access, increasing the per-access gas costs, but providing a cheaper overall cost when only a small portion of a large dataset is needed.
let empty: big_map<'key, 'value>
Create an empty big map.
let literal: (items: list<['key, 'value]>) => big_map<'key, 'value>
Create a non-empty big_map.
let find_opt: (key: 'key, big_map: big_map <'key, 'value>) => option <'value>
Retrieve a value from a big map with the given key.
Because the key may be missing in the big map, the result is an optional value.
let mem: (key: 'key, big_map: big_map <'key, 'value>) => bool
Test whether a given key exists within a big map.
let update: (key: 'key, value: option<'value>, big_map: big_map<'key, 'value>) => big_map<'key, 'value>
Note: when None
is used as a value, the value is removed from the big_map.
let get_and_update: (key: 'key, value: option<'value>, big_map: big_map<'key, 'value>) => [option<'value>, big_map<'key, 'value>]
Similar to update
but it also returns the value that was previously stored in the big_map
let add: (key: 'key, value: 'value, big_map: big_map<'key, 'value>) => big_map<'key, 'value>
let remove: (key: 'key, big_map: big_map<'key, 'value>) => big_map<'key, 'value>