builder

package
v0.17.0-otel-1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Value

func Value(value interface{}) []byte

Types

type Field

type Field struct {
	// The Name of the field.
	Name string

	// List saves whether the fields is a list of items
	List bool

	// WrapList saves whether the a list field should be wrapped in an object
	WrapList bool

	// Value contains the field value. if nil, fields will contain a subselection.
	Value interface{}

	// Fields contains a subselection of fields. If not nil, value will be undefined.
	Fields []Field
}

func TransformEquals

func TransformEquals(fields []Field) []Field

type Input

type Input struct {
	Name     string
	Fields   []Field
	Value    interface{}
	WrapList bool
}

type Output

type Output struct {
	Name string

	// Inputs (optional) to provide arguments to a field
	Inputs []Input

	Outputs []Output
}

Output can be a single Name or can have nested fields

type Query

type Query struct {
	// Engine holds the implementation of how queries are processed
	Engine engine.Engine

	// Operation describes the PQL operation: query, mutation or subscription
	Operation string

	// Name describes the operation; useful for tracing
	Name string

	// Method describes a crud operation
	Method string

	// Model contains the Prisma model Name
	Model string

	// Inputs contains function arguments
	Inputs []Input

	// Outputs contains the return fields
	Outputs []Output

	// Start time of the request for tracing
	Start time.Time

	TxResult chan []byte
}

func NewQuery

func NewQuery() Query

func (Query) Build

func (q Query) Build() string

func (Query) BuildInner

func (q Query) BuildInner() string

func (Query) Do

func (q Query) Do(ctx context.Context, payload interface{}, into interface{}) error

func (Query) Exec

func (q Query) Exec(ctx context.Context, into interface{}) error

Jump to

Keyboard shortcuts

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