engine

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

README

Engine

This package refers to the handling of the Prisma query engine. It handles the lifecycle of starting the engine, sending requests to it, and shutting it down.

The main implementation is the QueryEngine, which refers to the rust query engine. Alternative implementations are the data proxy, which is a remote query engine hosted by Prisma, and a mock engine used for testing.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data added in v0.2.0

type Data struct {
	Result json.RawMessage `json:"result"`
}

type DataProxyEngine added in v0.13.0

type DataProxyEngine struct {

	// Schema contains the prisma Schema
	Schema string
	// contains filtered or unexported fields
}

func NewDataProxyEngine added in v0.13.0

func NewDataProxyEngine(schema, connectionURL string) *DataProxyEngine

func (*DataProxyEngine) Batch added in v0.13.0

func (e *DataProxyEngine) Batch(ctx context.Context, payload interface{}, into interface{}) error

func (*DataProxyEngine) Connect added in v0.13.0

func (e *DataProxyEngine) Connect() error

func (*DataProxyEngine) Disconnect added in v0.13.0

func (e *DataProxyEngine) Disconnect() error

func (*DataProxyEngine) Do added in v0.13.0

func (e *DataProxyEngine) Do(ctx context.Context, payload interface{}, into interface{}) error

func (*DataProxyEngine) Name added in v0.13.0

func (e *DataProxyEngine) Name() string

type Engine

type Engine interface {
	Connect() error
	Disconnect() error
	Do(ctx context.Context, payload interface{}, into interface{}) error
	Batch(ctx context.Context, payload interface{}, into interface{}) error
	Name() string
}

type GQLBatchRequest added in v0.3.0

type GQLBatchRequest struct {
	Batch       []GQLRequest `json:"batch"`
	Transaction bool         `json:"transaction"`
}

GQLBatchRequest is the payload for GraphQL queries

type GQLBatchResponse added in v0.3.0

type GQLBatchResponse struct {
	Errors []GQLError    `json:"errors"`
	Result []GQLResponse `json:"batchResult"`
}

type GQLError

type GQLError struct {
	Message    string                 `json:"error"` // note: the query-engine uses 'error' instead of 'message'
	Path       []string               `json:"path"`
	Extensions map[string]interface{} `json:"query"`
}

GQLError is a GraphQL Error

func (*GQLError) RawMessage added in v0.16.2

func (e *GQLError) RawMessage() string

type GQLRequest

type GQLRequest struct {
	Query     string                 `json:"query"`
	Variables map[string]interface{} `json:"variables"`
}

GQLRequest is the payload for GraphQL queries

type GQLResponse

type GQLResponse struct {
	Data       Data                   `json:"data"`
	Errors     []GQLError             `json:"errors"`
	Extensions map[string]interface{} `json:"extensions"`
}

GQLResponse is the default GraphQL response

type QueryEngine added in v0.2.0

type QueryEngine struct {

	// Schema contains the prisma Schema
	Schema string
	// contains filtered or unexported fields
}

func NewQueryEngine added in v0.13.0

func NewQueryEngine(schema string, hasBinaryTargets bool) *QueryEngine

func (*QueryEngine) Batch added in v0.3.0

func (e *QueryEngine) Batch(ctx context.Context, payload interface{}, v interface{}) error

Do sends the http Request to the query engine and unmarshals the response

func (*QueryEngine) Connect added in v0.2.0

func (e *QueryEngine) Connect() error

func (*QueryEngine) Disconnect added in v0.2.0

func (e *QueryEngine) Disconnect() error

func (*QueryEngine) Do added in v0.2.0

func (e *QueryEngine) Do(ctx context.Context, payload interface{}, v interface{}) error

Do sends the http Request to the query engine and unmarshals the response

func (*QueryEngine) Name added in v0.2.0

func (e *QueryEngine) Name() string

func (*QueryEngine) ReplaceSchema added in v0.2.0

func (e *QueryEngine) ReplaceSchema(replace func(schema string) string)

deprecated

func (*QueryEngine) Request added in v0.2.0

func (e *QueryEngine) Request(ctx context.Context, method string, path string, payload interface{}) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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