dmmf

package
v0.0.0-...-0cffe04 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2020 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 Action

type Action struct {
	// Type describes a query or a mutation
	Type string
	Name types.String
}

Action describes a CRUD operation.

type ActionType

type ActionType struct {
	Name types.String
	List bool
}

ActionType describes a CRUD operation type.

type Datamodel

type Datamodel struct {
	Models []Model `json:"models"`
	Enums  []Enum  `json:"enums"`
}

Datamodel contains all types of the Prisma Datamodel.

type DatamodelFieldKind

type DatamodelFieldKind string

DatamodelFieldKind describes a scalar, object or enum.

const (
	DatamodelFieldKindScalar   DatamodelFieldKind = "scalar"
	DatamodelFieldKindRelation DatamodelFieldKind = "relation"
	DatamodelFieldKindEnum     DatamodelFieldKind = "enum"
)

DatamodelFieldKind values

func (DatamodelFieldKind) IncludeInStruct

func (v DatamodelFieldKind) IncludeInStruct() bool

IncludeInStruct shows whether to include a field in a model struct.

func (DatamodelFieldKind) IsRelation

func (v DatamodelFieldKind) IsRelation() bool

IsRelation returns whether field is a relation

type Document

type Document struct {
	Datamodel Datamodel `json:"datamodel"`
	Schema    Schema    `json:"schema"`
}

Document describes the root of the AST.

func (Document) Actions

func (Document) Actions() []Action

Actions returns all possible CRUD operations.

func (Document) Operators

func (Document) Operators() []Operator

Operators returns a list of all query operators such as NOT, OR, etc.

func (Document) Types

func (Document) Types() []Type

Types provides virtual types and their actions

func (Document) Variations

func (Document) Variations() []ActionType

Variations returns "One" and "Many".

type Enum

type Enum struct {
	Name   types.String `json:"name"`
	Values []EnumValue  `json:"values"`
	// DBName (optional)
	DBName types.String `json:"dBName"`
}

Enum describes an enumerated type.

type EnumValue

type EnumValue struct {
	Name types.String `json:"name"`
	// DBName (optional)
	DBName types.String `json:"dBName"`
}

EnumValue contains detailed information about an enum type.

type Field

type Field struct {
	Kind       FieldKind    `json:"kind"`
	Name       types.String `json:"name"`
	IsRequired bool         `json:"isRequired"`
	IsList     bool         `json:"isList"`
	IsUnique   bool         `json:"isUnique"`
	IsReadOnly bool         `json:"isReadOnly"`
	IsID       bool         `json:"isId"`
	Type       types.Type   `json:"type"`
	// DBName (optional)
	DBName      types.String `json:"dBName"`
	IsGenerated bool         `json:"isGenerated"`
	IsUpdatedAt bool         `json:"isUpdatedAt"`
	// RelationToFields (optional)
	RelationToFields []interface{} `json:"relationToFields"`
	// RelationOnDelete (optional)
	RelationOnDelete types.String `json:"relationOnDelete"`
	// RelationName (optional)
	RelationName types.String `json:"relationName"`
	// HasDefaultValue
	HasDefaultValue bool `json:"hasDefaultValue"`
}

Field describes properties of a single model field.

func (Field) RelationMethods

func (f Field) RelationMethods() []RelationMethod

RelationMethods returns a mapping for the PQL methods provided for relations

func (Field) RequiredOnCreate

func (f Field) RequiredOnCreate() bool

type FieldKind

type FieldKind string

FieldKind describes a scalar, object or enum.

const (
	FieldKindScalar FieldKind = "scalar"
	FieldKindObject FieldKind = "object"
	FieldKindEnum   FieldKind = "enum"
)

FieldKind values

func (FieldKind) IncludeInStruct

func (v FieldKind) IncludeInStruct() bool

IncludeInStruct shows whether to include a field in a model struct.

func (FieldKind) IsRelation

func (v FieldKind) IsRelation() bool

IsRelation returns whether field is a relation

type InputType

type InputType struct {
	Name types.String `json:"name"`
	// IsWhereType (optional)
	IsWhereType bool `json:"isWhereType"`
	// IsOrderType (optional)
	IsOrderType bool `json:"isOrderType"`
	// AtLeastOne (optional)
	AtLeastOne bool `json:"atLeastOne"`
	// AtMostOne (optional)
	AtMostOne bool        `json:"atMostOne"`
	Fields    []SchemaArg `json:"fields"`
}

InputType describes a GraphQL/PQL input type.

type Method

type Method struct {
	Name   string
	Action string
}

Method defines the method for the virtual types method

type Model

type Model struct {
	// Name describes the singular name of the model.
	Name       types.String `json:"name"`
	IsEmbedded bool         `json:"isEmbedded"`
	// DBName (optional)
	DBName types.String `json:"dbName"`
	Fields []Field      `json:"fields"`
}

Model describes a Prisma type model, which usually maps to a database table or collection.

func (Model) Actions

func (m Model) Actions() []string

func (Model) RelationFieldsPlusOne

func (m Model) RelationFieldsPlusOne() []Field

RelationFieldsPlusOne returns all fields plus an empty one, so it's easier to iterate through it in some gotpl files

type Operator

type Operator struct {
	Name   string
	Action string
}

Operator describes a query operator such as NOT, OR, etc.

type OutputType

type OutputType struct {
	Name   types.String  `json:"name"`
	Fields []SchemaField `json:"fields"`
	// IsEmbedded (optional)
	IsEmbedded bool `json:"isEmbedded"`
}

OutputType describes a GraphQL/PQL return type.

type RelationMethod

type RelationMethod struct {
	Name   string
	Action string
}

RelationMethod describes a method for relations

type Schema

type Schema struct {
	// RootQueryType (optional)
	RootQueryType types.String `json:"rootQueryType"`
	// RootMutationType (optional)
	RootMutationType types.String `json:"rootMutationType"`
	InputTypes       []InputType  `json:"inputTypes"`
	OutputTypes      []OutputType `json:"outputTypes"`
	Enums            []SchemaEnum `json:"enums"`
}

Schema provides the GraphQL/PQL AST.

func (*Schema) UniqueCompoundTypeByName

func (s *Schema) UniqueCompoundTypeByName(name string) InputType

func (*Schema) UniqueTypes

func (s *Schema) UniqueTypes() []InputType

type SchemaArg

type SchemaArg struct {
	Name      types.String    `json:"name"`
	InputType SchemaInputType `json:"inputType"`
	// IsRelationFilter (optional)
	IsRelationFilter bool `json:"isRelationFilter"`
}

SchemaArg provides the arguments of a given field.

type SchemaEnum

type SchemaEnum struct {
	Name   types.String   `json:"name"`
	Values []types.String `json:"values"`
	// DBName (optional)
	DBName types.String `json:"dBName"`
}

SchemaEnum describes an enumerated type.

type SchemaField

type SchemaField struct {
	Name       types.String     `json:"name"`
	OutputType SchemaOutputType `json:"outputType"`
	Args       []SchemaArg      `json:"args"`
}

SchemaField describes the information of an output type field.

type SchemaInputType

type SchemaInputType struct {
	IsRequired bool       `json:"isRequired"`
	IsList     bool       `json:"isList"`
	Type       types.Type `json:"type"` // this was declared as ArgType
	Kind       FieldKind  `json:"kind"`
}

SchemaInputType describes an input type of a given field.

type SchemaOutputType

type SchemaOutputType struct {
	Type       types.String `json:"type"`
	IsList     bool         `json:"isList"`
	IsRequired bool         `json:"isRequired"`
	Kind       FieldKind    `json:"kind"`
}

SchemaOutputType describes an output type of a given field.

type Type

type Type struct {
	Name    string
	Methods []Method
}

Type defines the data struct for the virtual types method

Jump to

Keyboard shortcuts

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