connection

package
v4.12.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	// contains filtered or unexported fields
}

Connection networking layer accessing weaviate using http requests

func NewConnection

func NewConnection(scheme string, host string, httpClient *http.Client, headers map[string]string) *Connection

NewConnection based on scheme://host if httpClient is nil a default client will be used

func (*Connection) RunREST

func (con *Connection) RunREST(ctx context.Context, path string,
	restMethod string, requestBody interface{},
) (*ResponseData, error)

RunREST executes a http request path: expects a resource path e.g. `/schema/things` restMethod: as they are defined in constants in the *http* package Returns:

a response that may be parsed into a struct after the fact
error if there was a network issue

func (*Connection) RunRESTExternal

func (con *Connection) RunRESTExternal(ctx context.Context, hostAndPath string, restMethod string, requestBody interface{}) (*ResponseData, error)

func (*Connection) WaitForWeaviate

func (con *Connection) WaitForWeaviate(startupTimeout time.Duration) error

WaitForWeaviate waits until weaviate is started up and ready

type GrpcClient

type GrpcClient struct {
	// contains filtered or unexported fields
}

func NewGrpcClient

func NewGrpcClient(host string, secured bool, headers map[string]string,
	gRPCVersionSupport *db.GRPCVersionSupport,
) (*GrpcClient, error)

func (*GrpcClient) BatchObjects

func (c *GrpcClient) BatchObjects(ctx context.Context, objects []*models.Object,
	consistencyLevel string,
) ([]models.ObjectsGetResponse, error)

type ResponseData

type ResponseData struct {
	Body       []byte
	StatusCode int
}

ResponseData encapsulation of the http request body and status

func (*ResponseData) DecodeBodyIntoTarget

func (rd *ResponseData) DecodeBodyIntoTarget(target interface{}) error

DecodeBodyIntoTarget unmarshall body into target var successful if err is nil

Jump to

Keyboard shortcuts

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