0.0.2 • Published 5 years ago

@betterthings/es-document v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

ESDocument

A small implementation of an Elasticsearch document base class.

API

  • static get(id: string): Promise<Document | null>

  • static mget(ids: string[]): Promise<Array<Document | null>>

  • static search(body: object): Promise<{ total: number, data: Document[] }>: works great with bodybuilder.

  • static create(): Document: creating a document. Never call the constructor directly! You can implement static afterCreate(obj: Document) instead.

The return value of these static methods are typed to be the instance type of the class the method is called on. In test.ts, the TypeScript compiler correctly infers the type to be User, so you can benefit from editor tooling in VS Code and other editors.

The instances of Document have the following base functionality:

  • isNew(): boolean

  • getDocId(): string

  • store(): Promise<void>

0.0.2

5 years ago

0.0.1-2

6 years ago

0.0.1-1

7 years ago

0.0.1-0

7 years ago