Packages

Ecspanse is an Entity Component System (ECS) library for Elixir, offering a suite of features including: flexible queries with multiple filters, dynamic bidirectional relationships, versatile tagging capabilities, system event subscriptions, or asynchronous system execution.

Current section

Files

Jump to
ecspanse lib ecspanse component children.ex
Raw

lib/ecspanse/component/children.ex

defmodule Ecspanse.Component.Children do
@moduledoc """
The `Children` component is a special component provided by the framework
to maintain references to an entity's child entities.
Dedicated queries and commands are provided to interact with this component.
An empty `Children` component is automatically added upon entity creation,
even if no child entities are defined at the time of creation.
> #### Ecspanse parent-child relationships are **bidirectional associations** {: .info}
"""
use Ecspanse.Component,
state: [entities: []]
@typedoc """
Entity's children list.
"""
@type t :: %__MODULE__{
entities: list(Ecspanse.Entity.t())
}
end