transform

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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AST

type AST struct {

	// Scalars describe a list of scalar types, such as Int, String, DateTime, etc.
	Scalars []string `json:"scalars"`

	// Enums contains all enums
	Enums []Enum `json:"enums"`

	// Models contains top-level information including fields and their respective filters
	Models []Model `json:"models"`

	// ReadFilters describe a list of scalar types and the respective read operations
	ReadFilters []Filter `json:"readFilters"`

	// WriteFilters describe a list of scalar types and the respective read operations
	WriteFilters []Filter `json:"writeFilters"`

	// OrderBys describe a list of what FindMany operations can order by
	OrderBys []OrderBy `json:"orderBys"`
	// contains filtered or unexported fields
}

func New

func New(document *dmmf.Document) *AST

func (*AST) ReadFilter

func (r *AST) ReadFilter(scalar string, isList bool) *Filter

ReadFilter returns a filter for a read operation by scalar

func (*AST) WriteFilter

func (r *AST) WriteFilter(scalar string, isList bool) *Filter

WriteFilter returns a filter for a read operation by scalar

type Enum

type Enum struct {
	Name   types.String   `json:"name"`
	Values []types.String `json:"values"`
}

type Field

type Field struct {

	// Prisma indicates whether this is a pseudo field used for Prisma-specific actions, e.g. 'Relevance_'
	Prisma bool `json:"prisma"`

	dmmf.Field
}

type Filter

type Filter struct {
	// Name of a filter, which can be a scala like `Int`, or a field name like `Age`
	Name string
	// Methods describe filter methods, such as `Equals`, `In` or `Contains`
	Methods []Method
}

Filter defines the data struct for the virtual types method

type Index

type Index struct {
	Name         types.String   `json:"name"`
	InternalName string         `json:"internalName"`
	Fields       []types.String `json:"fields"`
}

type Method

type Method struct {
	// Name of the filter method ot use publicly, such as `Equals` or `Contains`
	Name string
	// Action of the filter for internal use in the query engine, e.g. `equals` or `contains`
	Action string
	// IsList defines whether the filter accepts a scalar or a slice of scalars
	IsList bool
	// Deprecated contains a description of what else to use, as this method will be removed in the future
	// If empty, this method is not deprecated
	Deprecated string
	// Type describes the type for this method. If empty, default to the parent scalar type.
	Type types.Type
}

Method defines the method for the virtual types method

type Model

type Model struct {
	Name    types.String `json:"name"`
	Fields  []Field      `json:"fields"`
	Indexes []Index      `json:"indexes"`

	// TODO remove this and apply all required data directly to model
	OldModel dmmf.Model `json:"-"`
}

type OrderBy added in v0.13.0

type OrderBy struct {
}

Jump to

Keyboard shortcuts

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