entity_kit v0.4.1 Manganese.EntityKit.Structs.EntitiesCollection

Link to this section Summary

Functions

Retrieve an entity from the collection.

Combine two collections into one.

Create an empty entities collection.

Add multiple entities of the same type to the collection.

Add an entity to the collection.

Link to this section Types

Link to this type

t()

t() :: %Manganese.EntityKit.Structs.EntitiesCollection{
  entities: %{optional(atom()) => %{optional(integer()) => term()}}
}

Link to this section Functions

Link to this function

get_entity(entities_collection, entity_type, id)

get_entity(t(), atom(), pos_integer()) :: term() | nil

Retrieve an entity from the collection.

If no entity of the given type and ID pair exist, nil is returned instead.

Link to this function

map(entities_collection, mapper)

map(t(), (term() -> term())) :: t()
Link to this function

merge(entities_collection1, entities_collection2)

merge(t(), t()) :: t()

Combine two collections into one.

If an entity of the same type and ID pair is present in both collections, the value in entities_collection2 will take precedence.

Link to this function

new()

new() :: t()

Create an empty entities collection.

Link to this function

put_entities(entities_collection, entity_type, entities)

put_entities(t(), atom(), [term()]) :: t()

Add multiple entities of the same type to the collection.

If an entity of the given type and ID pair already exist, it will be overwritten with the new value.

Link to this function

put_entity(entities_collection, entity_type, entity)

put_entity(t(), atom(), term()) :: t()

Add an entity to the collection.

If the entity of the given type and ID pair already exist, it will be overwritten with the new value.