readManyFrom()
Function
readManyFrom<S, EntityType, IDType>(queryEntity:
QueryEntity
<S
,EntityType
,IDType
>, ids:IDType
[]):Read
<EntityType
[]>
Create a new Read by selecting multiple entities from a QueryEntity using an array of ids:
const entities$: Read<EntityData[]> = readManyFrom(queryEntity, ['id1', 'id2']);
Source: akita-read/src/lib/read-many-from.ts:19
Type parameters
Parameter | Default | Description |
---|---|---|
S extends EntityState <any , any > | - | entity state used by the queryEntity |
EntityType | getEntityType <S > | - |
IDType | getIDType <S > | - |
Parameters
Parameter | Type | Description |
---|---|---|
queryEntity | QueryEntity <S , EntityType , IDType > | QueryEntity to select from |
ids | IDType [] | array of entity ids to select |
Returns
Read
<EntityType
[]>
Returns a new Read that emits a array containing all selected entities that exist.
readManyFrom<S, R, EntityType, IDType>( queryEntity:
QueryEntity
<S
,EntityType
,IDType
>, ids:IDType
[], projection:Function
):Read
<R
[]>
Create a new Read by selecting multiple entities from a QueryEntity using an array of ids and extracting the value using a given projection:
const names$: Read<string[]> = readEntityFrom(queryEntity, ['id1', 'id2'], (entity) => entity.name);
Source: akita-read/src/lib/read-many-from.ts:40
Type parameters
Parameter | Default | Description |
---|---|---|
S extends EntityState <any , any > | - | entity state used by the queryEntity |
R | - | returned type of the projection |
EntityType | getEntityType <S > | - |
IDType | getIDType <S > | - |
Parameters
Parameter | Type | Description |
---|---|---|
queryEntity | QueryEntity <S , EntityType , IDType > | QueryEntity to select from |
ids | IDType [] | array of entity ids to select |
projection | (entity: EntityType ) => R | projection to pick from the entity |
Returns
Read
<R
[]>
Returns a new Read that emits the result of the projection or undefined
if the entity does not exist