atomic

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package atomic provides APOC atomic operations.

This package implements all apoc.atomic.* functions for atomic updates and operations on nodes and relationships.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareAndSwap

func CompareAndSwap(node *Node, property string, expected, newValue interface{}) bool

CompareAndSwap atomically compares and swaps a property value.

Example:

apoc.atomic.compareAndSwap(node, 'status', 'pending', 'active') => success

Types

type Node

type Node struct {
	ID         int64
	Labels     []string
	Properties map[string]interface{}
}

Node represents a graph node.

func Add

func Add(node *Node, property string, value interface{}) *Node

Add atomically adds a value to a numeric property.

Example:

apoc.atomic.add(node, 'counter', 5) => updated node

func Concat

func Concat(node *Node, property string, value string) *Node

Concat atomically concatenates a value to a string property.

Example:

apoc.atomic.concat(node, 'name', ' Jr.') => updated node

func Decrement

func Decrement(node *Node, property string) *Node

Decrement atomically decrements a numeric property by 1.

Example:

apoc.atomic.decrement(node, 'counter') => updated node

func Increment

func Increment(node *Node, property string) *Node

Increment atomically increments a numeric property by 1.

Example:

apoc.atomic.increment(node, 'counter') => updated node

func Insert

func Insert(node *Node, property string, position int, value interface{}) *Node

Insert atomically inserts a value into a list property.

Example:

apoc.atomic.insert(node, 'tags', 2, 'new-tag') => updated node

func Remove

func Remove(node *Node, property string, position int) *Node

Remove atomically removes a value from a list property.

Example:

apoc.atomic.remove(node, 'tags', 1) => updated node

func Subtract

func Subtract(node *Node, property string, value interface{}) *Node

Subtract atomically subtracts a value from a numeric property.

Example:

apoc.atomic.subtract(node, 'counter', 3) => updated node

func Update

func Update(node *Node, property string, value interface{}) *Node

Update atomically updates a property with a new value.

Example:

apoc.atomic.update(node, 'status', 'active') => updated node

type Relationship

type Relationship struct {
	ID         int64
	Type       string
	StartNode  int64
	EndNode    int64
	Properties map[string]interface{}
}

Relationship represents a graph relationship.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL