Skip to content

Instantly share code, notes, and snippets.

View fbiville's full-sized avatar

Florent Biville fbiville

View GitHub Profile
@fbiville
fbiville / changeLog.xml
Created March 19, 2024 10:08
Liquibase Workshop
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:neo4j="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
<changeSet id="remove-constraints-" author="liquibase-fan">
<neo4j:cypher>CALL apoc.schema.assert({Movie:['tagline'], Movie:['released'], Person:['name'], Movie:['imdbRating'], User:['name'], Movie:['title'], Movie:['year']}, {}, true)</neo4j:cypher>
</changeSet>
@fbiville
fbiville / function-equality.go
Created March 9, 2023 11:06
DeepEqual and functions
package main
import (
"fmt"
"reflect"
)
func main() {
foo2 := foo
@fbiville
fbiville / container.go
Last active July 1, 2022 11:47
Cypher merge is not sufficient to guarantee uniqueness
package container
import (
"context"
"fmt"
"github.com/neo4j/neo4j-go-driver/v4/neo4j"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/wait"
)
@fbiville
fbiville / main.go
Created May 17, 2022 15:32
Simple Neo4j program
package main
import (
"fmt"
"github.com/neo4j/neo4j-go-driver/v4/neo4j"
"io"
"os"
"strings"
)
@fbiville
fbiville / main.go
Created April 19, 2022 15:38
Go Neo4j Driver - 5.0 context.Context example
package main
import (
"context"
"fmt"
"github.com/neo4j/neo4j-go-driver/v5/neo4j"
"time"
)
func main() {
@fbiville
fbiville / EXAMPLE
Last active September 3, 2021 16:20
Check a Cypher query against a particular Neo4j version
# INPUT
versions=('3.5' '4.0' '4.1' '4.2' '4.3')
for version in "${versions[@]}"; do
./check-query.sh "CALL db.indexes()" "${version}";
done
# OUTPUT
### Neo4j 3.5
+--------------------------------------------------------------------------------------------------------------+
| description | indexName | tokenNames | properties | state | type | progress | provider | id | failureMessage |
@fbiville
fbiville / tz_testing.go
Created June 18, 2021 10:34
Get a time zone offset from a time zone name
// +build testing
package main
import "C"
import "time"
//export time_zone_offset_seconds
func time_zone_offset_seconds(tzName *C.char) C.int {
location, err := time.LoadLocation(C.GoString(tzName))
if err != nil {
@fbiville
fbiville / docker-start.sh
Last active February 19, 2021 15:52
Get Neo4j with Movies dataset
#!/usr/bin/env bash
set -euo pipefail
function main() {
local neo4j_version="${1}"
local data_url="${2}"
local local_movies_path
local_movies_path=$(download_movies_data "${data_url}")
@fbiville
fbiville / driver.go
Last active November 27, 2020 09:24
Medium blog post - snippet 2
import (
"github.com/neo4j-examples/golang-neo4j-realworld-example/pkg/users"
"github.com/neo4j/neo4j-go-driver/v4/neo4j"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"golang.org/x/crypto/bcrypt"
"io"
)
var driver neo4j.Driver
@fbiville
fbiville / testcontainers.go
Created November 27, 2020 09:20
Medium blogpost code snippet 1
import (
"context"
"fmt"
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/wait"
)
func startContainer(ctx context.Context, username, password string) (testcontainers.Container, error) {
request := testcontainers.ContainerRequest{
Image: "neo4j", // get latest Neo4j Docker image