Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EditOperation<T>

This operation edits an object in the database.

Usage

See Datastore.edit.

Type parameters

  • T: Model<T>

    The model of the Datastore. T must extend from Model.

Hierarchy

  • EditOperation

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

Private _data

_data: IEdit<T>

Data fields to set on _item.

Private _id

_id: string

Identifier of an object to edit. Same as _item.meta.id

Private _item

_item: T

Object to edit.

Private _store

_store: Datastore<T>

The datastore where the operation takes place.

Methods

edit

  • edit(): Promise<void>

id

  • id(id: string): this
  • Edits the item with the identifier passed as the argument.

    Parameters

    • id: string

      Identifier of an object to edit.

    Returns this

    Returns this operation again, to make chaining methods possible.

item

  • item(item: T): this
  • Edits the item passed as the argument.

    Parameters

    • item: T

      Object to edit.

    Returns this

    Returns this operation again, to make chaining methods possible.

run

  • run(): Promise<void>

with

  • with(data: IEdit<T>): this
  • Edits the item with the fields passed as the argument.

    All of data's fields are optional, and all non-null fields in _data will replace the corresponding fields in _item.

    Parameters

    • data: IEdit<T>

      Identifier of an object to edit.

    Returns this

    Returns this operation again, to make chaining methods possible.

Generated using TypeDoc