UNPKG

blow-collection

Version:

Simple in memory collection with Rx / Observable interface.

27 lines (23 loc) 976 B
# blow-collection [ ![Codeship Status for mchmielarski/blow-collection](https://codeship.com/projects/090fae40-a260-0133-6420-4efb0984f5a5/status?branch=master)](https://codeship.com/projects/128854) Simple in memory collection with Rx / Observable interface. ```typescript interface CollectionOptions { idKey?: string; idGenerator?: () => string | number; } class Collection<T> { constructor(options?: CollectionOptions); create(data: any): Observable<T>; update(where: QueryWhere, data: any): Observable<number>; updateOrCreate(data: any): Observable<T>; count(where: QueryWhere): Observable<number>; destroy(where: QueryWhere): Observable<number>; destroyById(id: any): Observable<boolean>; find(query?: QueryObject): Observable<T>; findOne(query: QueryObject): Observable<T>; findById(id: any): Observable<T>; findOrCreate(where: QueryWhere, data: any): Observable<T>; exists(id: any): Observable<boolean>; } ```