Skip to content

Instantly share code, notes, and snippets.

@ali-ince
ali-ince / Program.cs
Created October 18, 2017 12:52
Neo4j - Large Results
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Neo4j.Driver.V1;
namespace Test
{
class Program
@ali-ince
ali-ince / Program.cs
Last active May 9, 2018 13:56
SNI Test Code
using System;
using System.Net;
using System.Net.Security;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
namespace SNI.Test.Local
{
package main
import (
"flag"
"os"
"github.com/neo4j/neo4j-go-driver/neo4j"
)
var (
var (
driver neo4j.Driver
err error
)
if driver, err = neo4j.NewDriver(uri, neo4j.BasicAuth(username, password, ""), func(config *neo4j.Config) {
config.Log = neo4j.ConsoleLogger(neo4j.ERROR)
}); err != nil {
return err
}
var (
session neo4j.Session
err error
)
if session, err = driver.Session(neo4j.AccessModeRead); err != nil {
return err
}
defer session.Close()
func executeQuery(tx neo4j.Transaction) (interface{}, error) {
var (
counter int
result neo4j.Result
err error
)
if result, err = tx.Run(query, nil); err != nil {
return nil, err
}
var (
recordsProcessed interface{}
err error
)
if recordsProcessed, err = session.ReadTransaction(executeQuery); err != nil {
return err
}
fmt.Printf("\n%d records processed\n", recordsProcessed)
package main
import (
"flag"
"fmt"
"log"
"os"
"strings"
"github.com/neo4j/neo4j-go-driver/neo4j"
@ali-ince
ali-ince / Dockerfile
Last active November 7, 2019 00:17
# start from golang image based on alpine-3.8
FROM golang:1.10-alpine3.8 AS dev-build
# add our cgo dependencies
RUN apk add --no-cache ca-certificates cmake make g++ openssl-dev git curl pkgconfig
# clone latest seabolt 1.7 source code
RUN git clone -b 1.7 https://github.com/neo4j-drivers/seabolt.git /seabolt
# invoke cmake build and install artifacts - default location is /usr/local
WORKDIR /seabolt/build
# CMAKE_INSTALL_LIBDIR=lib is a hack where we override default lib64 to lib to workaround a defect
# in our generated pkg-config file
var (
driver neo4j.Driver
err error
)
useConsoleLogger := func() func(config *neo4j.Config) {
return func(config *neo4j.Config) {
config.Log = neo4j.ConsoleLogger(neo4j.ERROR)
}
}