Options
All
  • Public
  • Public/Protected
  • All
Menu

WriteTransaction performs a mutating bulk transaction on the underlying store.

Hierarchy

  • Transaction<WriteTransactionRequest, WriteTransactionReply>
    • WriteTransaction

Index

Constructors

constructor

  • new WriteTransaction(config: Config, client: Client<WriteTransactionRequest, WriteTransactionReply>, dbID: Buffer, modelName: string): WriteTransaction

Methods

create

  • create<T>(values: any[]): Promise<undefined | string[]>
  • create creates a new model instance in the given store.

    Type parameters

    • T

    Parameters

    • values: any[]

      An array of model instances as JSON/JS objects.

    Returns Promise<undefined | string[]>

delete

  • delete(IDs: string[]): Promise<void>
  • delete deletes an existing model instance from the given store.

    Parameters

    • IDs: string[]

      An array of instance ids to delete.

    Returns Promise<void>

end

  • end(): Promise<void>
  • end completes (flushes) the transaction. All operations between start and end will be applied as a single transaction upon a call to end.

    Returns Promise<void>

find

  • find queries the store for entities matching the given query parameters. See Query for options.

    Type parameters

    • T

    Parameters

    • query: QueryJSON

      The object that describes the query. See Query for options. Alternatively, see QueryJSON for the basic interface.

    Returns Promise<InstanceList<T>>

findByID

  • findByID<T>(ID: string): Promise<undefined | Instance<T>>
  • findByID queries the store for the id of an instance.

    Type parameters

    • T

    Parameters

    • ID: string

      The id of the instance to search for.

    Returns Promise<undefined | Instance<T>>

has

  • has(IDs: string[]): Promise<boolean>
  • has checks whether a given instance exists in the given store.

    Parameters

    • IDs: string[]

      An array of instance ids to check for.

    Returns Promise<boolean>

save

  • save(values: any[]): Promise<void>
  • save saves changes to an existing model instance in the given store.

    Parameters

    • values: any[]

      An array of model instances as JSON/JS objects. Each model instance must have a valid existing ID property.

    Returns Promise<void>

start

  • start(): Promise<void>
  • start begins the transaction. All operations between start and end will be applied as a single transaction upon a call to end.

    Returns Promise<void>