Copied in-memory collection with local queries and key-based CRUD operations.
Vue: data = [], key = "id". Dart: data is required; without keyOf only queries are supported. Construction copies the list. Duplicate keys, insertion of existing keys and key changes are rejected. update/remove with an unknown key fail; byKey returns undefined/null.
new TxArrayStore<T>(data?: readonly T[], key?: TxSelector<T>): TxArrayStore<T>| Member | Type / return | Behavior |
|---|---|---|
| data | T[] | Records or event payload. |
| key | TxSelector<T> | Stable key or selector; distinct from a widget key. |
| load | (o: TxLoadOptions<T>) => TxLoadResult<T> | Loads using the supplied options; DataSource uses current query state without arguments. Errors propagate. |
| byKey | (key: TxKey) => T | undefined | Reads a record by key; missing keys return undefined (Vue) or null (Dart). |
| insert | (item: T) => T | Inserts a record with a unique key and returns it. |
| update | (key: TxKey, changes: Partial<T>) => T & Partial<T> | Updates a notification or record. |
| remove | (key: TxKey) => void | Removes the record or recursively removes a file/directory tree. |
import { TxArrayStore } from '@tekocloud.de/tecexpress'
const store = new TxArrayStore([{ id: 1, text: 'One' }], 'id')
console.log(store.load({ take: 10 }), store.byKey(1))
store.insert({ id: 2, text: 'Two' })
store.update(2, { text: 'Updated' })
store.remove(2)