# Module key2value

- Description
- Data Types
- Function Index
- Function Details

### Key2Value

Maintain 2 lookups for 2 separate keys and 1 value.

Copyright © 2011-2020 Michael Truog

Version: 2.0.2 May 26 2021 18:41:37 ------------------------------------------------------------------------

Authors: Michael Truog (`mjtruog at protonmail dot com`).

## Description

### Key2Value

Maintain 2 lookups for 2 separate keys and 1 value. The interface creates a bidirectional lookup where key1 can store multiple key2 associations to the same value. The supplied data structure module must have dict interface functions (unless the module is maps).

## Data Types

### dict_proxy()

`dict_proxy(Key, Value) = dict:dict(Key, Value)`

### key1()

`key1() = any()`

### key2()

`key2() = any()`

### key2value()

`key2value(Key1, Key2, Value) = key2value_dict(Key1, Key2, Value) | #key2value{module = module(), lookup1 = any(), lookup2 = any()}`

### key2value_dict()

`key2value_dict(Key1, Key2, Value) = {key2value, dict, dict_proxy(Key1, {[Key2], Value}), dict_proxy(Key2, {[Key1], Value})}`

### value()

`value() = any()`

## Function Index

erase/3 |
erase1/2 |
erase2/2 |
fetch1/2 |
fetch2/2 |
find1/2 |
find2/2 |
fold1/3 |
fold2/3 |
is_key1/2 |
is_key2/2 |
new/0 |
new/1 |
size1/1 |
size2/1 |
store/4 |
update1/3 |
update2/3 |

## Function Details

### erase/3

`erase(K1::key1(), K2::key2(), State::key2value(key1(), key2(), value())) -> key2value(key1(), key2(), value())`

### erase1/2

`erase1(K::key1(), State::key2value(key1(), key2(), value())) -> key2value(key1(), key2(), value())`

### erase2/2

`erase2(K::key2(), State::key2value(key1(), key2(), value())) -> key2value(key1(), key2(), value())`

### fetch1/2

`fetch1(K::key1(), Key2value::key2value(key1(), key2(), value())) -> {list(), any()}`

### fetch2/2

`fetch2(K::key2(), Key2value::key2value(key1(), key2(), value())) -> {list(), any()}`

### find1/2

`find1(K::key1(), State::key2value(key1(), key2(), value())) -> {ok, {list(), any()}} | error`

### find2/2

`find2(K::key2(), State::key2value(key1(), key2(), value())) -> {ok, {list(), any()}} | error`

### fold1/3

`fold1(F::fun((key1(), [key2()], value(), any()) -> any()), A0::any(), State::key2value(key1(), key2(), value())) -> any()`

### fold2/3

`fold2(F::fun(([key1()], key2(), value(), any()) -> any()), A0::any(), State::key2value(key1(), key2(), value())) -> any()`

### is_key1/2

`is_key1(K::key1(), Key2value::key2value(key1(), key2(), value())) -> boolean()`

### is_key2/2

`is_key2(K::key2(), Key2value::key2value(key1(), key2(), value())) -> boolean()`

### new/0

`new() -> key2value_dict(key1(), key2(), value())`

### new/1

`new(Module::atom()) -> key2value(key1(), key2(), value())`

### size1/1

`size1(Key2value::key2value(key1(), key2(), value())) -> non_neg_integer()`

### size2/1

`size2(Key2value::key2value(key1(), key2(), value())) -> non_neg_integer()`

### store/4

`store(K1::key1(), K2::key2(), V::value(), Key2value::key2value(key1(), key2(), value())) -> key2value(key1(), key2(), value())`

### update1/3

`update1(K1::key1(), F::fun((value()) -> value()), Key2value::key2value(key1(), key2(), value())) -> key2value(key1(), key2(), value())`

### update2/3

`update2(K2::key2(), F::fun((value()) -> value()), Key2value::key2value(key1(), key2(), value())) -> key2value(key1(), key2(), value())`

Generated by EDoc