Documentation ¶
Index ¶
- func CompareConstraints(existing, constraints []*Constraint) []change.Change
- func CompareIndices(existing, indices []*Index) []change.Change
- func GetAbsoluteRootPathForTest() string
- func GetAbsoluteSchemaPathForTest() string
- func GetRawSchema(dirPath string, fromTest bool) ([]byte, error)
- func InverseFieldEdgeEqual(existing, inverseFieldEdge *InverseFieldEdge) bool
- func NodeEqual(existing, node *Node) bool
- func PatternEqual(existing, pattern *Pattern) bool
- func PolymorphicOptionsEqual(existing, p *PolymorphicOptions) bool
- type Action
- type ActionField
- type ActionType
- type AssocEdge
- type AssocEdgeGroup
- type Constraint
- type ConstraintType
- type CustomType
- type DBType
- type EdgeAction
- type Field
- type FieldEdge
- type FieldType
- type ForeignKey
- type ForeignKeyInfo
- type FullText
- type FullTextLanguage
- type FullTextWeight
- type Index
- type IndexType
- type InverseAssocEdge
- type InverseFieldEdge
- type Node
- type NullableItem
- type OnDeleteFkey
- type Pattern
- type PolymorphicOptions
- type Schema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareConstraints ¶ added in v0.0.39
func CompareConstraints(existing, constraints []*Constraint) []change.Change
func CompareIndices ¶ added in v0.0.39
TODO tests...
func GetAbsoluteRootPathForTest ¶
func GetAbsoluteRootPathForTest() string
func GetAbsoluteSchemaPathForTest ¶
func GetAbsoluteSchemaPathForTest() string
func GetRawSchema ¶ added in v0.0.37
func InverseFieldEdgeEqual ¶ added in v0.0.38
func InverseFieldEdgeEqual(existing, inverseFieldEdge *InverseFieldEdge) bool
func PatternEqual ¶ added in v0.0.38
func PolymorphicOptionsEqual ¶ added in v0.0.38
func PolymorphicOptionsEqual(existing, p *PolymorphicOptions) bool
Types ¶
type Action ¶
type Action struct { // Note that anytime anything changes here, have to update actionEqual in compare.go Operation ent.ActionOperation `json:"operation,omitempty"` Fields []string `json:"fields,omitempty"` ExcludedFields []string `json:"excludedFields,omitempty"` OptionalFields []string `json:"optionalFields,omitempty"` RequiredFields []string `json:"requiredFields,omitempty"` NoFields bool `json:"noFields,omitempty"` CustomActionName string `json:"actionName,omitempty"` CustomGraphQLName string `json:"graphQLName,omitempty"` CustomInputName string `json:"inputName,omitempty"` HideFromGraphQL bool `json:"hideFromGraphQL,omitempty"` ActionOnlyFields []*ActionField `json:"actionOnlyFields,omitempty"` }
func (*Action) GetTSStringOperation ¶
type ActionField ¶
type ActionField struct { // Note that anytime anything changes here, have to update actionOnlyFieldEqual in compare.go Name string Type ActionType Nullable bool ActionName string ExcludedFields []string // contains filtered or unexported fields }
func (*ActionField) GetEntType ¶
func (f *ActionField) GetEntType(inputName string) (enttype.TSGraphQLType, error)
func (*ActionField) MarshalJSON ¶ added in v0.0.38
func (f *ActionField) MarshalJSON() ([]byte, error)
func (*ActionField) UnmarshalJSON ¶
func (f *ActionField) UnmarshalJSON(data []byte) error
type ActionType ¶
type ActionType string
const ( // Note that these types should match ActionField.Type in schema.ts ActionTypeID ActionType = "ID" ActionTypeBoolean ActionType = "Boolean" ActionTypeInt ActionType = "Int" ActionTypeFloat ActionType = "Float" ActionTypeString ActionType = "String" ActionTypeTime ActionType = "Time" ActionTypeObject ActionType = "Object" )
type AssocEdge ¶
type AssocEdge struct { // Note that anytime anything changes here, have to update assocEdgeEqual in compare.go Name string `json:"name,omitempty"` SchemaName string `json:"schemaName,omitempty"` Symmetric bool `json:"symmetric,omitempty"` Unique bool `json:"unique,omitempty"` TableName string `json:"tableName,omitempty"` InverseEdge *InverseAssocEdge `json:"inverseEdge,omitempty"` EdgeActions []*EdgeAction `json:"edgeActions,omitempty"` // Go specific EntConfig *schemaparser.EntConfigInfo `json:"-"` HideFromGraphQL bool `json:"hideFromGraphQL,omitempty"` EdgeConstName string `json:"edgeConstName,omitempty"` PatternName string `json:"patternName,omitempty"` }
type AssocEdgeGroup ¶
type AssocEdgeGroup struct { // Note that anytime anything changes here, have to update assocEdgeGroupEqual in compare.go Name string `json:"name,omitempty"` GroupStatusName string `json:"groupStatusName,omitempty"` TableName string `json:"tableName,omitempty"` AssocEdges []*AssocEdge `json:"assocEdges,omitempty"` EdgeActions []*EdgeAction `json:"edgeActions,omitempty"` StatusEnums []string `json:"statusEnums,omitempty"` NullStateFn string `json:"nullStateFn,omitempty"` NullStates []string `json:"nullStates,omitempty"` // TS specific EdgeAction *EdgeAction `json:"edgeAction,omitempty"` // Go specific ActionEdges []string `json:"-"` }
func (*AssocEdgeGroup) AddAssocEdge ¶
func (g *AssocEdgeGroup) AddAssocEdge(edge *AssocEdge)
type Constraint ¶
type Constraint struct { // Note that anytime anything changes here, have to update constraintEqual in compare.go Name string `json:"name,omitempty"` Type ConstraintType `json:"type,omitempty"` Columns []string `json:"columns,omitempty"` ForeignKey *ForeignKeyInfo `json:"fkey,omitempty"` Condition string `json:"condition,omitempty"` }
func (*Constraint) GetConstraintTypeString ¶
func (c *Constraint) GetConstraintTypeString() string
type ConstraintType ¶
type ConstraintType string
const ( // Note that these type should match enum ConstraintType in schema.ts PrimaryKeyConstraint ConstraintType = "primary" ForeignKeyConstraint ConstraintType = "foreign" UniqueConstraint ConstraintType = "unique" CheckConstraint ConstraintType = "check" )
type CustomType ¶
type CustomType string
const ( EmailType CustomType = "email" PhoneType CustomType = "phone" PasswordType CustomType = "password" )
type DBType ¶
type DBType string
const ( // Note that these types should match enum DBType in schema.ts UUID DBType = "UUID" Int64ID DBType = "Int64ID" Boolean DBType = "Boolean" Int DBType = "Int" BigInt DBType = "BigInt" Float DBType = "Float" String DBType = "String" Timestamp DBType = "Timestamp" Timestamptz DBType = "Timestamptz" Time DBType = "Time" Timetz DBType = "Timetz" Date DBType = "Date" JSON DBType = "JSON" JSONB DBType = "JSONB" Enum DBType = "Enum" StringEnum DBType = "StringEnum" List DBType = "List" )
type EdgeAction ¶
type EdgeAction struct { // Note that anytime anything changes here, have to update edgeActionEqual in compare.go Operation ent.ActionOperation `json:"operation,omitempty"` CustomActionName string `json:"actionName,omitempty"` CustomGraphQLName string `json:"graphQLName,omitempty"` CustomInputName string `json:"inputName,omitempty"` HideFromGraphQL bool `json:"hideFromGraphQL,omitempty"` ActionOnlyFields []*ActionField `json:"actionOnlyFields,omitempty"` }
func (*EdgeAction) GetTSStringOperation ¶
func (e *EdgeAction) GetTSStringOperation() string
type Field ¶
type Field struct { // Note that anytime anything changes here, have to update fieldEqual in compare.go Name string `json:"name,omitempty"` Type *FieldType `json:"type,omitempty"` Nullable bool `json:"nullable,omitempty"` StorageKey string `json:"storageKey,omitempty"` // TODO need a way to indicate unique edge is Required also. this changes type generated in ent and graphql Unique bool `json:"unique,omitempty"` HideFromGraphQL bool `json:"hideFromGraphQL,omitempty"` Private bool `json:"private,omitempty"` GraphQLName string `json:"graphqlName,omitempty"` Index bool `json:"index,omitempty"` PrimaryKey bool `json:"primaryKey,omitempty"` DefaultToViewerOnCreate bool `json:"defaultToViewerOnCreate,omitempty"` FieldEdge *FieldEdge `json:"fieldEdge,omitempty"` // this only really makes sense on id fields... ForeignKey *ForeignKey `json:"foreignKey,omitempty"` ServerDefault interface{} `json:"serverDefault,omitempty"` // DisableUserEditable true == DefaultValueOnCreate required OR set in trigger DisableUserEditable bool `json:"disableUserEditable,omitempty"` DisableUserGraphQLEditable bool `json:"disableUserGraphQLEditable,omitempty"` HasDefaultValueOnCreate bool `json:"hasDefaultValueOnCreate,omitempty"` HasDefaultValueOnEdit bool `json:"hasDefaultValueOnEdit,omitempty"` HasFieldPrivacy bool `json:"hasFieldPrivacy"` Polymorphic *PolymorphicOptions `json:"polymorphic,omitempty"` DerivedWhenEmbedded bool `json:"derivedWhenEmbedded,omitempty"` DerivedFields []*Field `json:"derivedFields,omitempty"` // Go specific information here TagMap map[string]string `json:"-"` GoType types.Type `json:"-"` PkgPath string `json:"-"` DataTypePkgPath string `json:"-"` // set when parsed via tsent generate schema Import enttype.Import `json:"-"` PatternName string `json:"patternName,omitempty"` }
func (*Field) GetEntType ¶
func (f *Field) GetEntType() (enttype.TSGraphQLType, error)
type FieldEdge ¶
type FieldEdge struct { // Note that anytime anything changes here, have to update fieldEdgeEqual in compare.go Schema string `json:"schema,omitempty"` InverseEdge *InverseFieldEdge `json:"inverseEdge,omitempty"` DisableBuilderType bool `json:"disableBuilderType,omitempty"` }
func (*FieldEdge) InverseEdgeName ¶ added in v0.0.35
type FieldType ¶
type FieldType struct { // Note that anytime anything changes here, have to update fieldTypeEqual in compare.go DBType DBType `json:"dbType,omitempty"` // required when DBType == DBType.List ListElemType *FieldType `json:"listElemType,omitempty"` // required when DBType == DBType.Enum || DBType.StringEnum Values []string `json:"values,omitempty"` EnumMap map[string]string `json:"enumMap,omitempty"` Type string `json:"type,omitempty"` GraphQLType string `json:"graphQLType,omitempty"` // optional used by generator to specify different types e.g. email, phone, password CustomType CustomType `json:"customType,omitempty"` ImportType *tsimport.ImportPath `json:"importType,omitempty"` }
type ForeignKey ¶
type ForeignKey struct { // Note that anytime anything changes here, have to update foreignKeyEqual in compare.go Schema string `json:"schema,omitempty"` Column string `json:"column,omitempty"` Name string `json:"name,omitempty"` DisableIndex bool `json:"disableIndex,omitempty"` DisableBuilderType bool `json:"disableBuilderType,omitempty"` }
type ForeignKeyInfo ¶
type ForeignKeyInfo struct { // Note that anytime anything changes here, have to update foreignKeyInfoEqual in compare.go TableName string `json:"tableName,omitempty"` Columns []string `json:"columns,omitempty"` OnDelete OnDeleteFkey `json:"ondelete,omitempty"` }
type FullText ¶ added in v0.0.39
type FullText struct { GeneratedColumnName string `json:"generatedColumnName,omitempty"` Language FullTextLanguage `json:"language,omitempty"` LanguageColumn string `json:"languageColumn,omitempty"` IndexType IndexType `json:"indexType,omitempty"` Weights *FullTextWeight `json:"weights,omitempty"` }
type FullTextLanguage ¶ added in v0.0.39
type FullTextLanguage string
const ( // rename to search config? English FullTextLanguage = "english" French FullTextLanguage = "french" German FullTextLanguage = "german" Simple FullTextLanguage = "simple" )
type FullTextWeight ¶ added in v0.0.39
type FullTextWeight struct { A []string `json:"A,omitempty"` B []string `json:"B,omitempty"` C []string `json:"C,omitempty"` D []string `json:"D,omitempty"` }
func (*FullTextWeight) HasWeights ¶ added in v0.0.39
func (w *FullTextWeight) HasWeights() bool
type InverseAssocEdge ¶
type InverseAssocEdge struct { // Note that anytime anything changes here, have to update inverseAssocEdgeEqual in compare.go // TODO need to be able to mark this as unique // this is an easy way to get 1->many Name string `json:"name,omitempty"` EdgeConstName string `json:"edgeConstName,omitempty"` }
type InverseFieldEdge ¶ added in v0.0.35
type InverseFieldEdge struct { // Note that anytime anything changes here, have to update InverseFieldEdgeEqual in compare.go Name string `json:"name,omitempty"` TableName string `json:"tableName,omitempty"` HideFromGraphQL bool `json:"hideFromGraphQL,omitempty"` EdgeConstName string `json:"edgeConstName,omitempty"` }
type Node ¶
type Node struct { // Note that anytime anything changes here, have to update nodeEqual in compare.go TableName string `json:"tableName,omitempty"` Fields []*Field `json:"fields,omitempty"` AssocEdges []*AssocEdge `json:"assocEdges,omitempty"` AssocEdgeGroups []*AssocEdgeGroup `json:"assocEdgeGroups,omitempty"` Actions []*Action `json:"actions,omitempty"` EnumTable bool `json:"enumTable,omitempty"` DBRows []map[string]interface{} `json:"dbRows,omitempty"` Constraints []*Constraint `json:"constraints,omitempty"` Indices []*Index `json:"indices,omitempty"` HideFromGraphQL bool `json:"hideFromGraphQL,omitempty"` EdgeConstName string `json:"edgeConstName,omitempty"` PatternName string `json:"patternName,omitempty"` TransformsSelect bool `json:"transformsSelect,omitempty"` TransformsDelete bool `json:"transformsDelete,omitempty"` }
func (*Node) AddAssocEdge ¶
func (*Node) AddAssocEdgeGroup ¶
func (n *Node) AddAssocEdgeGroup(edgeGroup *AssocEdgeGroup)
type NullableItem ¶
type NullableItem string
const NullableContents NullableItem = "contents"
const NullableContentsAndList NullableItem = "contentsAndList"
const NullableTrue NullableItem = "true"
type OnDeleteFkey ¶
type OnDeleteFkey string
const ( // Note that these type should match enum ForeignKeyInfo.ondelete in schema.ts Restrict OnDeleteFkey = "RESTRICT" Cascade OnDeleteFkey = "CASCADE" SetNull OnDeleteFkey = "SET NULL" SetDefault OnDeleteFkey = "SET DEFAULT" NoAction OnDeleteFkey = "NO ACTION" )
type PolymorphicOptions ¶
type PolymorphicOptions struct { // Note that anytime anything changes here, have to update PolymorphicOptionsEqual in compare.go Types []string `json:"types,omitempty"` HideFromInverseGraphQL bool `json:"hideFromInverseGraphQL,omitempty"` DisableBuilderType bool `json:"disableBuilderType,omitempty"` }
Click to show internal directories.
Click to hide internal directories.