You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
558 B
33 lines
558 B
package arango_db
|
|
|
|
import (
|
|
"context"
|
|
"log"
|
|
"net"
|
|
"strconv"
|
|
|
|
driver "github.com/arangodb/go-driver"
|
|
"github.com/arangodb/go-driver/http"
|
|
)
|
|
|
|
type Connection struct {
|
|
conn driver.Connection
|
|
ctx context.Context
|
|
}
|
|
|
|
func NewConnection(ctx context.Context, host string, port int) *Connection {
|
|
connString := "http://" + net.JoinHostPort(host, strconv.Itoa(port))
|
|
conn, err := http.NewConnection(http.ConnectionConfig{
|
|
Endpoints: []string{connString},
|
|
})
|
|
|
|
//
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
return &Connection{
|
|
ctx: ctx,
|
|
conn: conn,
|
|
}
|
|
}
|
|
|