Documentation ¶
Index ¶
- type Action
- type ActionType
- type CoreType
- type Datamodel
- type DatamodelFieldKind
- type Document
- type Enum
- type EnumTypes
- type EnumValue
- type Field
- type FieldKind
- type InputObjectType
- type Mappings
- type Method
- type Model
- type ModelOperation
- type Operator
- type OuterInputType
- type OutputObject
- type OutputType
- type PrimaryKey
- type RelationMethod
- type Schema
- type SchemaEnum
- type SchemaField
- type SchemaInputType
- type SchemaOutputType
- type Type
- type UniqueIndex
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionType ¶
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 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) OperatorActions ¶ added in v0.28.0
func (Document) Variations ¶
func (Document) Variations() []ActionType
Variations contains different query capabilities such as Unique, First and Many
func (Document) WriteTypes ¶
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(key PrimaryKey) 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 ¶
IncludeInStruct shows whether to include a field in a model struct.
func (FieldKind) IsRelation ¶
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 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) RelationFieldsPlusOne ¶
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"` FindRaw types.String `json:"findRaw"` // MongoDB only AggregateRaw types.String `json:"aggregateRaw"` // MongoDB only }
func (*ModelOperation) Namespace ¶
func (m *ModelOperation) Namespace() string
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 ¶
func (PrimaryKey) IsFieldInPrimary ¶ added in v0.22.0
func (k PrimaryKey) IsFieldInPrimary(field types.String) bool
type RelationMethod ¶
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.