vst

package
v1.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2022 License: Apache-2.0 Imports: 15 Imported by: 6

Documentation

Overview

Package vst implements driver.Connection using a VelocyStream connection.

This connection uses VelocyStream (with optional TLS) to connect to the ArangoDB database. It encodes its contents as Velocypack.

Creating an Insecure Connection

To create a VST connection, use code like this.

// Create a VST connection to the database
conn, err := vst.NewConnection(vst.ConnectionConfig{
	Endpoints: []string{"http://localhost:8529"},
})
if err != nil {
	// Handle error
}

The resulting connection is used to create a client which you will use for normal database requests.

// Create a client
c, err := driver.NewClient(driver.ClientConfig{
	Connection: conn,
})
if err != nil {
	// Handle error
}

Creating a Secure Connection

To create a secure VST connection, use code like this.

// Create a VST over TLS connection to the database
conn, err := vst.NewConnection(vst.ConnectionConfig{
	Endpoints: []string{"https://localhost:8529"},
	TLSConfig: &tls.Config{
		InsecureSkipVerify: trueWhenUsingNonPublicCertificates,
	},
})
if err != nil {
	// Handle error
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConnection

func NewConnection(config ConnectionConfig) (driver.Connection, error)

NewConnection creates a new Velocystream connection based on the given configuration settings.

func NewVstBodyBuilder

func NewVstBodyBuilder() *vstBody

Types

type ConnectionConfig

type ConnectionConfig struct {
	// Endpoints holds 1 or more URL's used to connect to the database.
	// In case of a connection to an ArangoDB cluster, you must provide the URL's of all coordinators.
	Endpoints []string
	// TLSConfig holds settings used to configure a TLS (HTTPS) connection.
	// This is only used for endpoints using the HTTPS scheme.
	TLSConfig *tls.Config
	// Transport allows the use of a custom round tripper.
	// If Transport is not of type `*http.Transport`, the `TLSConfig` property is not used.
	// Otherwise a `TLSConfig` property other than `nil` will overwrite the `TLSClientConfig`
	// property of `Transport`.
	// Use the Version field in Transport to switch between Velocypack 1.0 / 1.1.
	// Note that Velocypack 1.1 requires ArangoDB 3.2 or higher.
	// Note that Velocypack 1.0 does not support JWT authentication.
	Transport protocol.TransportConfig
	// Cluster configuration settings
	cluster.ConnectionConfig
}

ConnectionConfig provides all configuration options for a Velocypack connection.

Directories

Path Synopsis
Package protocol implements the VelocyStream protocol (it is not intended to be used directly).
Package protocol implements the VelocyStream protocol (it is not intended to be used directly).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL