Options
All
  • Public
  • Public/Protected
  • All
Menu

Base abstract entity, for all entitoies The generic parameter S is the schema of the document

Type parameters

  • S: object

    the document schema

Hierarchy

  • BaseEntity

Index

Constructors

constructor

Properties

_id

_id: string = ""

Private sloth

sloth: SlothData<S>

Methods

exists

  • exists(): Promise<boolean>
  • Returns whether the specified document exists in database Please note that this does not compare documents

    Returns Promise<boolean>

getDocument

  • getDocument(): any

Protected getProp

  • getProp(key: string): any

getProps

  • getProps(): S

Protected getRelationDescriptor

Protected getRelationEntity

  • getRelationEntity(keyName: keyof S): Promise<any>

isDirty

  • isDirty(): boolean

remove

  • remove(): Promise<boolean>
  • Remove a document from the database

    Returns Promise<boolean>

    a Promise that resolves into a boolean, true if document was removed, false if the document doesn't have a docId in its slothdata

Private removeEntityRelation

Private removeRelations

  • removeRelations(): Promise<void>

save

  • save(): Promise<S & object>
  • Saves document to database. If the document doesn't exist, create it. If it exists, update it. If the _id was changed (due to props changing), remove to old document and create a new one

    Returns Promise<S & object>

    a Promise resolving into document props

    • If the document was updated, the _rev prop would be defined and start with an index greater than 1
    • If the document was created, the _rev prop would be defined and start with 1
    • If the document was not updated, because it is not dirty, then no _rev property is returned

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc