dmmf

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: 1 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
	InnerName  types.String
	List       bool
	ReturnList bool
}

ActionType describes a CRUD operation type.

type CoreType

type CoreType 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    []OuterInputType `json:"fields"`
}

CoreType describes a GraphQL/PQL input 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"`
	Mappings  Mappings  `json:"mappings"`
}

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() []string

func (Document) Variations

func (Document) Variations() []ActionType

Variations contains different query capabilities such as Unique, First and Many

func (Document) WriteTypes

func (Document) WriteTypes() []Type

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 EnumTypes

type EnumTypes struct {
	Prisma []SchemaEnum `json:"prisma"`
	Model  []SchemaEnum `json:"model"`
}

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 InputObjectType

type InputObjectType struct {
	Prisma []CoreType `json:"prisma"`
}

type Mappings

type Mappings struct {
	ModelOperations []ModelOperation `json:"modelOperations"`
	OtherOperations struct {
		Read  []string `json:"read"`
		Write []string `json:"write"`
	} `json:"otherOperations"`
}

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"`
	UniqueIndexes []UniqueIndex `json:"uniqueIndexes"`
	PrimaryKey    PrimaryKey    `json:"primaryKey"`
}

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 ModelOperation

type ModelOperation struct {
	Model      types.String `json:"model"`
	Aggregate  types.String `json:"aggregate"`
	CreateOne  types.String `json:"createOne"`
	DeleteMany types.String `json:"deleteMany"`
	DeleteOne  types.String `json:"deleteOne"`
	FindFirst  types.String `json:"findFirst"`
	FindMany   types.String `json:"findMany"`
	FindUnique types.String `json:"findUnique"`
	GroupBy    types.String `json:"groupBy"`
	UpdateMany types.String `json:"updateMany"`
	UpdateOne  types.String `json:"updateOne"`
	UpsertOne  types.String `json:"upsertOne"`
}

func (*ModelOperation) Namespace

func (m *ModelOperation) Namespace() string

type Operator

type Operator struct {
	Name   string
	Action string
}

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

type OuterInputType

type OuterInputType struct {
	Name       types.String      `json:"name"`
	InputTypes []SchemaInputType `json:"inputTypes"`
	// IsRelationFilter (optional)
	IsRelationFilter bool `json:"isRelationFilter"`
}

OuterInputType provides the arguments of a given field.

type OutputObject

type OutputObject struct {
	Prisma []OutputType `json:"prisma"`
}

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 PrimaryKey

type PrimaryKey struct {
	Name   types.String   `json:"name"`
	Fields []types.String `json:"fields"`
}

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"`
	InputObjectTypes  InputObjectType `json:"inputObjectTypes"`
	OutputObjectTypes OutputObject    `json:"outputObjectTypes"`
	EnumTypes         EnumTypes       `json:"enumTypes"`
}

Schema provides the GraphQL/PQL AST.

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 internal prisma type.

type SchemaField

type SchemaField struct {
	Name       types.String     `json:"name"`
	OutputType SchemaOutputType `json:"outputType"`
	Args       []OuterInputType `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"`
	Namespace  types.String `json:"namespace"`
	// can be "scalar", "inputObjectTypes" or "outputObjectTypes"
	Location string `json:"location"`
}

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

type UniqueIndex

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

Jump to

Keyboard shortcuts

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