database

package
v0.179.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 35 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//PrismaBinaryVersion is taken from the commit sha of https://github.com/prisma/prisma-engines/releases/tag/4.15.0
	PrismaBinaryVersion = "8fbc245156db7124f997f4cecdd8d1219e360944"
	EngineURL           = "https://binaries.prisma.sh/all_commits/%s/%s/%s.gz"
)

Functions

func ConfigJson

func ConfigJson(config Configuration) json.RawMessage

func DeserializeRawResponse added in v0.160.0

func DeserializeRawResponse(response *bytes.Buffer) (*bytes.Buffer, error)

func InstallPrismaDependencies

func InstallPrismaDependencies(log *zap.Logger, wundergraphDir string) error

func IntrospectPrismaDatabase

func IntrospectPrismaDatabase(ctx context.Context, introspectionSchema, wundergraphDir string, loadPrismaSchemaFromDatabase bool, log *zap.Logger) (prismaSchema, graphqlSDL, dmmf string, err error)

func ReverseOriginSchemaCompatibility added in v0.133.0

func ReverseOriginSchemaCompatibility(doc *ast.Document) error

ReverseOriginSchemaCompatibility reverses the changes made to the schema by the origin schema compatibility It's currently not used because normalization doesn't work with the raw sql changes TODO: Fix normalization and use this function

Types

type BinaryEngine

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

func (*BinaryEngine) Close

func (e *BinaryEngine) Close()

func (*BinaryEngine) Execute

func (e *BinaryEngine) Execute(ctx context.Context, request []byte, w io.Writer) error

func (*BinaryEngine) WaitUntilReady added in v0.111.0

func (e *BinaryEngine) WaitUntilReady(ctx context.Context) error

type Configuration

type Configuration struct {
	DatabaseURL         string
	PrismaSchema        string
	GraphqlSchema       string
	CloseTimeoutSeconds int64
	JsonTypeFields      []SingleTypeField
	JsonInputVariables  []string
	WunderGraphDir      string
}

type Engine

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

func NewEngine

func NewEngine(client *http.Client, log *zap.Logger, wundergraphDir string) *Engine

func (*Engine) BinaryPlatformName added in v0.160.0

func (e *Engine) BinaryPlatformName() (string, error)

BinaryPlatformName returns the name of the prisma binary which should be used, for example "darwin" or "linux-openssl-1.1.x"

func (*Engine) FetchEngine added in v0.160.0

func (e *Engine) FetchEngine(toDir string, engineName string, binaryPlatformName string) error

func (*Engine) GetEngineURL added in v0.160.0

func (e *Engine) GetEngineURL(engineName string, binaryPlatformName string) string

func (*Engine) IntrospectDMMF

func (e *Engine) IntrospectDMMF(ctx context.Context) (dmmf string, err error)

func (*Engine) IntrospectGraphQLSchema

func (e *Engine) IntrospectGraphQLSchema(ctx context.Context) (schema string, err error)

func (*Engine) IntrospectPrismaDatabaseSchema

func (e *Engine) IntrospectPrismaDatabaseSchema(ctx context.Context, introspectionSchema string) (string, error)

func (*Engine) Request

func (e *Engine) Request(ctx context.Context, request []byte, rw io.Writer) (err error)

func (*Engine) StartQueryEngine

func (e *Engine) StartQueryEngine(schema string) error

func (*Engine) StopQueryEngine

func (e *Engine) StopQueryEngine()

func (*Engine) WaitUntilReady added in v0.111.0

func (e *Engine) WaitUntilReady(ctx context.Context) error

type Factory

type Factory struct {
	Client *http.Client

	Log *zap.Logger
	// contains filtered or unexported fields
}

func (*Factory) Planner

func (f *Factory) Planner(ctx context.Context) plan.DataSourcePlanner

func (*Factory) WithHTTPClient added in v0.112.0

func (f *Factory) WithHTTPClient(client *http.Client) *Factory

type GQLRequest

type GQLRequest struct {
	Query     string          `json:"query"`
	Variables json.RawMessage `json:"variables"`
}

type HybridEngine

type HybridEngine interface {
	Close()
	Execute(ctx context.Context, request []byte, w io.Writer) error
	WaitUntilReady(ctx context.Context) error
}

func NewHybridEngine

func NewHybridEngine(prismaSchema, wundergraphDir string, log *zap.Logger) (HybridEngine, error)

type IntrospectionParams added in v0.160.0

type IntrospectionParams struct {
	CompositeTypeDepth int      `json:"compositeTypeDepth"`
	Force              bool     `json:"force"`
	Schema             string   `json:"schema"`
	Schemas            []string `json:"schemas,omitempty"`
}

type IntrospectionRequest

type IntrospectionRequest struct {
	ID      int                 `json:"id"`
	JSONRPC string              `json:"jsonrpc"`
	Method  string              `json:"method"`
	Params  IntrospectionParams `json:"params"`
}

type IntrospectionResponse

type IntrospectionResponse struct {
	ID      int    `json:"id"`
	JSONRPC string `json:"jsonrpc"`
	Result  struct {
		DataModel string `json:"datamodel"`
	} `json:"result"`
	Error *struct {
		Code    int64  `json:"code"`
		Message string `json:"message"`
		Data    struct {
			Message string `json:"message"`
		} `json:"data"`
	} `json:"error"`
}

type LazyEngine

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

func (*LazyEngine) Execute

func (e *LazyEngine) Execute(ctx context.Context, request []byte, out io.Writer) error

func (*LazyEngine) Start

func (e *LazyEngine) Start(closer <-chan struct{})

type LazyEngineFactory

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

func (*LazyEngineFactory) Engine

func (f *LazyEngineFactory) Engine(prismaSchema, wundergraphDir string, closeTimeoutSeconds int64) *LazyEngine

type Planner

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

func (*Planner) ConfigureFetch

func (p *Planner) ConfigureFetch() plan.FetchConfiguration

func (*Planner) ConfigureSubscription

func (p *Planner) ConfigureSubscription() plan.SubscriptionConfiguration

func (*Planner) DataSourcePlanningBehavior

func (p *Planner) DataSourcePlanningBehavior() plan.DataSourcePlanningBehavior

func (*Planner) DownstreamResponseFieldAlias

func (p *Planner) DownstreamResponseFieldAlias(downstreamFieldRef int) (alias string, exists bool)

func (*Planner) EnterArgument

func (p *Planner) EnterArgument(_ int)

func (*Planner) EnterDocument

func (p *Planner) EnterDocument(_, _ *ast.Document)

func (*Planner) EnterField

func (p *Planner) EnterField(ref int)

func (*Planner) EnterInlineFragment

func (p *Planner) EnterInlineFragment(ref int)

func (*Planner) EnterOperationDefinition

func (p *Planner) EnterOperationDefinition(ref int)

func (*Planner) EnterSelectionSet

func (p *Planner) EnterSelectionSet(ref int)

func (*Planner) LeaveDocument

func (p *Planner) LeaveDocument(_, _ *ast.Document)

func (*Planner) LeaveField

func (p *Planner) LeaveField(ref int)

func (*Planner) LeaveInlineFragment

func (p *Planner) LeaveInlineFragment(_ int)

func (*Planner) LeaveOperationDefinition

func (p *Planner) LeaveOperationDefinition(_ int)

func (*Planner) LeaveSelectionSet

func (p *Planner) LeaveSelectionSet(_ int)

func (*Planner) Register

func (p *Planner) Register(visitor *plan.Visitor, configuration plan.DataSourceConfiguration, isNested bool) error

type PrismaType added in v0.160.0

type PrismaType string
const (
	Int      PrismaType = "int"
	BigInt   PrismaType = "bigint"
	Float    PrismaType = "float"
	Double   PrismaType = "double"
	String   PrismaType = "string"
	Enum     PrismaType = "enum"
	Bytes    PrismaType = "bytes"
	Bool     PrismaType = "bool"
	Char     PrismaType = "char"
	Decimal  PrismaType = "decimal"
	JSON     PrismaType = "json"
	XML      PrismaType = "xml"
	UUID     PrismaType = "uuid"
	Datetime PrismaType = "datetime"
	Date     PrismaType = "date"
	Time     PrismaType = "time"
	Array    PrismaType = "array"
	Null     PrismaType = "null"
)

type RawJsonVariableRenderer added in v0.133.0

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

func (*RawJsonVariableRenderer) GetKind added in v0.133.0

func (r *RawJsonVariableRenderer) GetKind() string

func (*RawJsonVariableRenderer) RenderVariable added in v0.133.0

func (r *RawJsonVariableRenderer) RenderVariable(_ context.Context, data []byte, out io.Writer) error

type SingleTypeField

type SingleTypeField struct {
	TypeName  string
	FieldName string
}

type Source

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

func (*Source) Load

func (s *Source) Load(ctx context.Context, input []byte, w io.Writer) (err error)

type TypedValue added in v0.160.0

type TypedValue struct {
	PrismaType  PrismaType  `json:"prisma__type"`
	PrismaValue interface{} `json:"prisma__value"`
}

Jump to

Keyboard shortcuts

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