package graph import ( "context" "git.dragse.it/anthrove/otter-space-sdk/internal" "github.com/neo4j/neo4j-go-driver/v5/neo4j" "github.com/neo4j/neo4j-go-driver/v5/neo4j/config" ) type graphConnection struct { driver neo4j.DriverWithContext graphDebug bool } func NewGraphConnection(graphDebug bool) OtterSpace { return &graphConnection{ driver: nil, graphDebug: graphDebug, } } func (g *graphConnection) Connect(ctx context.Context, endpoint string, username string, password string) error { driver, err := neo4j.NewDriverWithContext(endpoint, neo4j.BasicAuth(username, password, ""), logger(g.graphDebug)) if err != nil { return err } err = driver.VerifyAuthentication(ctx, nil) if err != nil { return err } g.driver = driver return nil } func logger(graphDebug bool) func(config *config.Config) { return func(config *config.Config) { config.Log = internal.NewGraphLogger(graphDebug) } }