{"id":15989902,"url":"https://github.com/stefanak-michal/lua-neo4j","last_synced_at":"2025-03-22T00:44:08.382Z","repository":{"id":43782394,"uuid":"460507293","full_name":"stefanak-michal/lua-neo4j","owner":"stefanak-michal","description":"Bolt protocol driver for Lua to communicate with graph databases.","archived":false,"fork":false,"pushed_at":"2022-12-13T09:54:38.000Z","size":61,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-26T18:51:07.201Z","etag":null,"topics":["amazon-neptune","bolt","driver","graph-database","lua","memgraph","neo4j"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stefanak-michal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"stefanak-michal","ko_fi":"michalstefanak"}},"created_at":"2022-02-17T16:04:50.000Z","updated_at":"2025-01-14T01:33:00.000Z","dependencies_parsed_at":"2023-01-28T10:46:14.197Z","dependency_job_id":null,"html_url":"https://github.com/stefanak-michal/lua-neo4j","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanak-michal%2Flua-neo4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanak-michal%2Flua-neo4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanak-michal%2Flua-neo4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stefanak-michal%2Flua-neo4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stefanak-michal","download_url":"https://codeload.github.com/stefanak-michal/lua-neo4j/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244126692,"owners_count":20402164,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amazon-neptune","bolt","driver","graph-database","lua","memgraph","neo4j"],"created_at":"2024-10-08T05:02:28.526Z","updated_at":"2025-03-17T23:31:21.572Z","avatar_url":"https://github.com/stefanak-michal.png","language":"Lua","funding_links":["https://github.com/sponsors/stefanak-michal","https://ko-fi.com/michalstefanak"],"categories":[],"sub_categories":[],"readme":"# Lua-Neo4j\n\nUnofficial library for communication with Neo4j database over bolt tcp protocol.\n\n[![Tests with a database](https://github.com/stefanak-michal/lua-neo4j/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/stefanak-michal/lua-neo4j/actions/workflows/main.yml)\n![](https://img.shields.io/github/stars/stefanak-michal/lua-neo4j) \n![](https://img.shields.io/github/v/release/stefanak-michal/lua-neo4j) \n![](https://img.shields.io/github/commits-since/stefanak-michal/lua-neo4j/latest)\n\n## Install\n\nDownload this repository and use source code from **src**.\n\nOr you can install it from https://luarocks.org/modules/stefanak-michal/bolt\n\n```\nluarocks install bolt\n```\n\n## Usage\n\n```lua\nlocal bolt = require('bolt')\nbolt.init({scheme = 'basic', principal = 'neo4j', credentials = 'neo4j'})\nlocal result, err = bolt.query('RETURN 1 as num, $str as str', {str = 'Hello'})\n```\n\n### Aura\n\n```lua\nlocal bolt = require('bolt')\nbolt.setHost('abcxyz.databases.neo4j.io') -- without neo4j+s://\nbolt.setSSL({mode = 'client', protocol = 'any', verify = 'none', dane = true})\nbolt.init({scheme = 'basic', principal = 'neo4j', credentials = 'password'})\nlocal result, err = bolt.query('RETURN 1 as num, $str as str', {str = 'Hello'})\n```\n\n_More options for Luasec (setSSL) described [here](https://github.com/brunoos/luasec/wiki/LuaSec-1.0.x#ssl_newcontext)._\n\n## Methods\n\n| Name | Description | Arguments |\n|:---:|:---:|:---:|\n| setHost | Set hostname for connection. | string ip = 127.0.0.1 |\n| setPort | Set port for connection. | int port = 7687 |\n| setSSL | set configuration for secure connection. | table params = nil |\n| setVersions | Set requested bolt versions. | number/string ... = 4.4, 4.3 |\n| | | |\n| init | Connect to database with credentials. | table auth [info](https://7687.org/bolt/bolt-protocol-message-specification-4.html#request-message---44---hello) |\n| query | Execute query and get records with associated keys. Shortcut for run and pull. | string cypher, table params, table extra |\n| run | Execute query and get meta informations. | string cypher, table params, table extra |\n| pull | Pull records from last run. Last record is meta informations. | table extra = {n = -1} |\n| discard | Discard records from last run. | table extra = {n = -1} |\n| begin | Begin transaction. | table extra = {} |\n| commit | Commit transaction. | |\n| rollback | Rollback transaction. | |\n| reset | Reset connection to initial state. | |\n| route | Send route message. | table routing, table bookmarks, string db |\n\n_Check official [documentation](https://7687.org/bolt/bolt-protocol-message-specification-4.html) for more informations._\n\n### Specific Neo4j types\n\nNeo4j support two array data types which are not available in Lua. Lua has only **table** type. You have to specify type with key **neotype** in your table. You can use helper functions to add it. Available types are **list**, **dictionary** and Neo4j [structures](https://github.com/stefanak-michal/lua-neo4j/blob/master/src/structures.lua). Response doesn't contains neotype key for list and dictionary.\n\n```lua\n-- List\nlocal result, err = bolt.query('RETURN $list AS list', {\n  ['list'] = bolt.list({34, 65})\n})\n-- Dictionary\nlocal result, err = bolt.query('RETURN $dict AS dict', {\n  ['dict'] = bolt.dictionary({['one'] = 1, ['two'] = 2})\n})\n```\n\nAnother issue is with **nil** while Neo4j has **null** type. If you set nil into table value in Lua, key is removed from table while Neo4j expects key _(in query parameters)_ even with null value. If you are looking how to set null we introduce to you another specific type. You can use helper function to generate it.\n\n```lua\nlocal result, err = bolt.query('RETURN $n AS n', {\n  ['n'] = bolt.null()\n})\n\n-- Response from server is not decoded into table with neotype, because Lua can handle missing key as nil.\n-- result: {1 = {}}\n```\n\n## Requires\n\n- [Lua](https://www.lua.org/manual/5.3/) \u003e= 5.3\n- [Luasocket](https://w3.impa.br/~diego/software/luasocket/)\n- [Luasec](https://github.com/brunoos/luasec) - if you need SSL\n- [Neo4j](https://neo4j.com/) \u003e= 3\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanak-michal%2Flua-neo4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefanak-michal%2Flua-neo4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefanak-michal%2Flua-neo4j/lists"}