Documentation
¶
Index ¶
- type Action
- type ActionType
- type Datamodel
- type DatamodelFieldKind
- type Document
- type Enum
- type EnumValue
- type Field
- type FieldKind
- type InputType
- type Mapping
- type Method
- type Model
- type ModelAction
- type Operator
- type OutputType
- type RelationMethod
- type Schema
- type SchemaArg
- type SchemaEnum
- type SchemaField
- type SchemaInputType
- type SchemaOutputType
- type Type
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 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 []Mapping `json:"mappings"`
}
Document describes the root of the AST.
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 ¶
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 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 Mapping ¶
type Mapping struct {
Model types.String `json:"model"`
// FindOne (optional)
FindOne types.String `json:"findOne"`
// FindMany (optional)
FindMany types.String `json:"findMany"`
// Create (optional)
Create types.String `json:"create"`
// Update (optional)
Update types.String `json:"update"`
// UpdateMany (optional)
UpdateMany types.String `json:"updateMany"`
// Upsert (optional)
Upsert types.String `json:"upsert"`
// Delete (optional)
Delete types.String `json:"delete"`
// DeleteMany (optional)
DeleteMany types.String `json:"deleteMany"`
}
Mapping provides information for CRUD methods to allow easy mapping to the query engine.
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) RelationFieldsPlusOne ¶ added in v0.0.2
RelationFieldsPlusOne returns all fields plus an empty one, so it's easier to iterate through it in some gotpl files
type ModelAction ¶
ModelAction describes a CRUD operation.
const ( ModelActionFindOne ModelAction = "findOne" ModelActionFindMany ModelAction = "findMany" ModelActionCreate ModelAction = "create" ModelActionUpdate ModelAction = "update" ModelActionUpdateMany ModelAction = "updateMany" ModelActionUpsert ModelAction = "upsert" ModelActionDelete ModelAction = "delete" ModelActionDeleteMany ModelAction = "deleteMany" )
ModelAction values
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 ¶
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.
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"` // note that in the serialized state we don't have the reference to MergedOutputTypes
IsList bool `json:"isList"`
IsRequired bool `json:"isRequired"`
Kind FieldKind `json:"kind"`
}
SchemaOutputType describes an output type of a given field.