How to use the neo4j-driver.types function in neo4j-driver

To help you get started, we’ve selected a few neo4j-driver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neo4j / neo4j-browser / src / browser / modules / Stream / CypherFrame / helpers.js View on Github external
function isNeo4jValue (value) {
  switch (get(value, 'constructor')) {
    case neo4j.types.Date:
    case neo4j.types.DateTime:
    case neo4j.types.Duration:
    case neo4j.types.LocalDateTime:
    case neo4j.types.LocalTime:
    case neo4j.types.Time:
    case neo4j.types.Integer: // not exposed in typings but still there
      return true
    default:
      return false
  }
}
github neo4j / neo4j-browser / src / browser / modules / Stream / CypherFrame / helpers.js View on Github external
function isNeo4jValue (value) {
  switch (get(value, 'constructor')) {
    case neo4j.types.Date:
    case neo4j.types.DateTime:
    case neo4j.types.Duration:
    case neo4j.types.LocalDateTime:
    case neo4j.types.LocalTime:
    case neo4j.types.Time:
    case neo4j.types.Integer: // not exposed in typings but still there
      return true
    default:
      return false
  }
}
github neo4j / neo4j-browser / src / browser / modules / Stream / CypherFrame / helpers.js View on Github external
export const isGraphItem = (types = neo4j.types, item) => {
  return (
    item instanceof types.Node ||
    item instanceof types.Relationship ||
    item instanceof types.Path ||
    item instanceof types.PathSegment ||
    item instanceof neo4j.types.Date ||
    item instanceof neo4j.types.DateTime ||
    item instanceof neo4j.types.Duration ||
    item instanceof neo4j.types.LocalDateTime ||
    item instanceof neo4j.types.LocalTime ||
    item instanceof neo4j.types.Time ||
    item instanceof neo4j.types.Point
  )
}
github neo4j-contrib / neovis.js / src / neovis.js View on Github external
for (let obj of v.segments) {
								this._addNode(await this.buildNodeVisObject(obj.start));
								this._addNode(await this.buildNodeVisObject(obj.end));
								this._addEdge(this.buildEdgeVisObject(obj.relationship));
							}

						} else if (v instanceof Array) {
							for (let obj of v) {
								this._consoleLog('Array element constructor:');
								this._consoleLog(obj && obj.constructor.name);
								if (obj instanceof Neo4j.types.Node) {
									let node = await this.buildNodeVisObject(obj);
									this._addNode(node);

								} else if (obj instanceof Neo4j.types.Relationship) {
									let edge = this.buildEdgeVisObject(obj);

									this._addEdge(edge);
								}
							}
						}
					});
					dataBuildPromises.push(Promise.all(dataPromises));
github neo4j / neo4j-browser / src / shared / services / bolt / boltMappings.js View on Github external
export const recursivelyTypeGraphItems = (item, types = neo4j.types) => {
  if (item === null || item === undefined) {
    return item
  }
  if (['number', 'string', 'boolean'].indexOf(typeof item) !== -1) {
    return item
  }
  if (Array.isArray(item)) {
    return item.map(i => recursivelyTypeGraphItems(i, types))
  }
  if (item instanceof types.Node) {
    const tmp = copyAndType(item, types)
    safetlyAddObjectProp(tmp, reservedTypePropertyName, 'Node')
    return tmp
  }
  if (item instanceof types.PathSegment) {
    const tmp = copyAndType(item, types)
github neo4j / neo4j-browser / src / browser / modules / Stream / CypherFrame / helpers.js View on Github external
export const isGraphItem = (types = neo4j.types, item) => {
  return (
    item instanceof types.Node ||
    item instanceof types.Relationship ||
    item instanceof types.Path ||
    item instanceof types.PathSegment ||
    item instanceof neo4j.types.Date ||
    item instanceof neo4j.types.DateTime ||
    item instanceof neo4j.types.Duration ||
    item instanceof neo4j.types.LocalDateTime ||
    item instanceof neo4j.types.LocalTime ||
    item instanceof neo4j.types.Time ||
    item instanceof neo4j.types.Point
  )
}
github neo4j / neo4j-browser / src / shared / services / bolt / bolt.js View on Github external
const records = result.records.map(record => {
    const typedRecord = new neo4j.types.Record(
      record.keys,
      record._fields,
      record._fieldLookup
    )
    if (typedRecord._fields) {
      typedRecord._fields = mappings.applyGraphTypes(typedRecord._fields)
    }
    return typedRecord
  })
  const summary = mappings.applyGraphTypes(result.summary)
github neo4j / neo4j-browser / src / shared / services / bolt / boltMappings.js View on Github external
export function extractFromNeoObjects(obj, converters) {
  if (
    obj instanceof neo4j.types.Node ||
    obj instanceof neo4j.types.Relationship
  ) {
    return obj.properties
  } else if (obj instanceof neo4j.types.Path) {
    return [].concat.apply([], extractPathForRows(obj, converters))
  }
  return obj
}