internal

### Type parameters

- #### Q

### Hierarchy

- SetBlock
  - Builder

## Index

### Constructors

- constructor

### Methods

- set
- setLabels
- setValues
- setVariables

## Constructors

### constructor

- new SetBlock(chain: function, wrapper?: WrapperClause): SetBlock

- - Defined in builder.ts:30

  #### Parameters

  - ##### chain: function

    - - (clause: Clause): Q

      - #### Parameters

        - ##### clause: Clause

        #### Returns Q

  - ##### Optional wrapper: WrapperClause

  #### Returns SetBlock

## Methods

### set

- set(properties: SetProperties, options?: SetOptions): Q

- - Defined in builder.ts:80

  Adds a set clause to the query.

  `set` lets you updates a nodes labels and properties in one clause. Most of the time it will be easier to use one of the variants such as `setLabels`, `setValues` or `setVariables`.

  This function accepts three different kind of properties, each of which is described in more detail in the variants.

      query.set({
        labels: {
          sale: 'Active',
        },
        variables: {
          sale: {
            activatedAt: 'timestamp()',
          },
        },
        values: {
          sale: {
            activatedBy: user.id,
          },
        },
      })
      // SET sale:Active, sale.activatedAt = timestamp(), sale.activatedBy = $userId

  `set` also accepts an options object which currently only contains a single setting: `override`. Override controls whether the `=` or `+=` operator is used in the set clause. `true` causes the existing object to be cleared and replaced by the new object. `false` on the other hand will merge the existing and new objects together, with new properties replacing the ones on the existing object. The default value of override is a little inconsistent and it will be improved in the next major version. If you don't pass any settings object, override will default to `true`. If you pass an options object without an `override` key, override will be `false`. In future versions, override will always default to `false` to be more consistent with `setVariables` and `setValues`.

  #### Parameters

  - ##### properties: SetProperties

  - ##### Optional options: SetOptions

  #### Returns Q

### setLabels

- setLabels(labels: Dictionary<Many<string>>): Q

- - Defined in builder.ts:102

  Adds labels to a node using a set clause.

      query.setLabels({
        sale: 'Active',
      })
      // SET sale:Active

  `setLabels` accepts a dictionary where the keys are nodes to be updated and the value is a single label or an array of labels to add to the node.

  #### Parameters

  - ##### labels: Dictionary<Many<string>>

  #### Returns Q

### setValues

- setValues(values: Dictionary<any>, merge?: undefined | false | true): Q

- - Defined in builder.ts:131

  Updates a node from parameters using a set clause. This function treats all values as parameters which is different to `setVariables` which assumes values are cypher variables.

      query.setValues({
        'sale.activatedBy': user.id,
      })
      // SET sale.activatedBy += $userId

  `setValues` accepts a dictionary where the keys are nodes or property names to be updated.

  To use the `+=` operator to merge properties of a node, you can pass `true` to the merge option.

      query.setValues({
        'sale': { active: true },
      }, true)
      // SET sale += $sale

  #### Parameters

  - ##### values: Dictionary<any>

  - ##### Optional merge: undefined | false | true

  #### Returns Q

### setVariables

- setVariables(variables: Dictionary<string | Dictionary<string>>, merge?: undefined | false | true): Q

- - Defined in builder.ts:159

  Updates a node from a variable that was previously declared in the query using a set clause. This function only accepts strings as its values which are not escaped in any way so beware. If you want to store some user supplied information in the database, `setValues` is the function you want.

      query.setVariables({
        'sale.activatedAt': 'timestamp()',
      })
      // SET sale.activatedAt = timestamp()

  Note how values are inserted into the query, as is.

  To use the `+=` operator to merge properties of a node, you can pass `true` to the merge option.

      query.setVariables({
        'sale': 'newSaleDetails'
      }, true)
      // SET sale += newSaleDetails

  #### Parameters

  - ##### variables: Dictionary<string | Dictionary<string>>

  - ##### Optional merge: undefined | false | true

  #### Returns Q

Generated using TypeDoc