Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am ali-ince on github.
  • I am alithecoder (https://keybase.io/alithecoder) on keybase.
  • I have a public key ASAnpfmRNZEeKeswJIkX1mPE9igILivXob_tWUQUlmfUogo

To claim this, I am signing this object:

package main
import (
"fmt"
"log"
"os"
"time"
"github.com/fatih/structs"
"github.com/neo4j/neo4j-go-driver/neo4j"
@ali-ince
ali-ince / Dockerfile-seabolt-archlinux
Last active March 18, 2019 09:10
A Dockerfile that enables seabolt compilation on arch linux
FROM archlinux/base AS build-openssl-with-static
# Install required packages for re-building openssl with static libraries enabled
RUN pacman -Syyu --noconfirm base-devel asp && useradd -m -d /pkg-build pkg-build
# Update makepkg.conf to enable static libraries
RUN sed -i -e 's/!staticlibs/staticlibs/g' /etc/makepkg.conf
# Trust pgp key for the openssl source
RUN su -c "gpg --recv-keys 8657ABB260F056B1E5190839D9C4D26D0E604491" - pkg-build
# Export openssl package definition
RUN su -c "asp export openssl" - pkg-build
# Build and create a package that includes static libraries
var (
driver neo4j.Driver
err error
)
useConsoleLogger := func() func(config *neo4j.Config) {
return func(config *neo4j.Config) {
config.Log = neo4j.ConsoleLogger(neo4j.ERROR)
}
}
@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
package main
import (
"flag"
"fmt"
"log"
"os"
"strings"
"github.com/neo4j/neo4j-go-driver/neo4j"
var (
recordsProcessed interface{}
err error
)
if recordsProcessed, err = session.ReadTransaction(executeQuery); err != nil {
return err
}
fmt.Printf("\n%d records processed\n", recordsProcessed)
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 (
session neo4j.Session
err error
)
if session, err = driver.Session(neo4j.AccessModeRead); err != nil {
return err
}
defer session.Close()
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
}