Installation
MemoryService
The main service class for in-memory operations.Constructor
MemoryServiceOptions
Configuration options for the Memory adapter
string
default:"id"
Name of the id field property
MemoryServiceStore<T>
Initial data store object with id as keys. Default is
{}number
default:"0"
Starting value for auto-generated ids
PaginationParams
Pagination settings with
default and max page sizeboolean | string[]
Allow multiple updates. Can be
true, false, or an array of method names(query: any) => any
Custom query matcher function. Default uses
sift(sort: any) => any
Custom sorting function. Default uses built-in sorter
Service Methods
find
Retrieve multiple records from memory.ServiceParams
Paginated<Result> | Result[]
Paginated results or array depending on settings
get
Retrieve a single record by id.Id
required
The record id to retrieve
ServiceParams
Additional query filters to match
Result
The found record
create
Create one or more new records.Data | Data[]
required
Record data to create. If id is not provided, it will be auto-generated
Result | Result[]
The created record(s)
update
Completely replace a record.Id
required
The record id to update
Data
required
Complete record data to replace with
Result
The updated record
patch
Partially update one or multiple records.Id | null
required
The record id to patch, or
null to patch multiple records matching the queryPatchData
required
Partial data to merge with existing record(s)
Result | Result[]
The patched record(s)
remove
Remove one or multiple records.Id | null
required
The record id to remove, or
null to remove multiple recordsResult | Result[]
The removed record(s)
MemoryAdapter
The base adapter class thatMemoryService extends.
Properties
store
Direct access to the in-memory data store.Methods
getEntries
Retrieve all entries matching a query.Result[]
Array of all matching entries
Query Syntax
The Memory adapter supports MongoDB-style query syntax via thesift library.