16 lines
381 B
Go
16 lines
381 B
Go
package neo4jAPI
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/neo4j/neo4j-go-driver/v5/neo4j"
|
|
)
|
|
|
|
func NewConnection(uri string, username string, password string) (neo4j.DriverWithContext, error) {
|
|
driver, err := neo4j.NewDriverWithContext(uri, neo4j.BasicAuth(username, password, ""))
|
|
if err != nil {
|
|
return nil, fmt.Errorf("failed to create Neo4j driver: %v", err)
|
|
}
|
|
return driver, nil
|
|
|
|
}
|