Documentation ¶
Index ¶
- func GetAbsoluteRootPathForTest() string
- func GetAbsoluteSchemaPathForTest() string
- 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 Index
- type InverseAssocEdge
- type Node
- type NullableItem
- type OnDeleteFkey
- type Pattern
- type PolymorphicOptions
- type Schema
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAbsoluteRootPathForTest ¶
func GetAbsoluteRootPathForTest() string
func GetAbsoluteSchemaPathForTest ¶
func GetAbsoluteSchemaPathForTest() string
Types ¶
type Action ¶
type Action struct { Operation ent.ActionOperation `json:"operation"` Fields []string `json:"fields"` CustomActionName string `json:"actionName"` CustomGraphQLName string `json:"graphQLName"` CustomInputName string `json:"inputName"` HideFromGraphQL bool `json:"hideFromGraphQL"` ActionOnlyFields []*ActionField `json:"actionOnlyFields"` }
func (*Action) GetTSStringOperation ¶
type ActionField ¶
type ActionField struct { Name string Type ActionType Nullable bool ActionName string // contains filtered or unexported fields }
func (*ActionField) GetEntType ¶
func (f *ActionField) GetEntType(inputName string) (enttype.TSGraphQLType, 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 { Name string `json:"name"` SchemaName string `json:"schemaName"` Symmetric bool `json:"symmetric"` Unique bool `json:"unique"` TableName string `json:"tableName"` InverseEdge *InverseAssocEdge `json:"inverseEdge"` EdgeActions []*EdgeAction `json:"edgeActions"` // Go specific EntConfig *schemaparser.EntConfigInfo HideFromGraphQL bool `json:"hideFromGraphQL"` EdgeConstName string `json:"edgeConstName"` PatternName string `json:"patternName"` }
type AssocEdgeGroup ¶
type AssocEdgeGroup struct { Name string `json:"name"` GroupStatusName string `json:"groupStatusName"` TableName string `json:"tableName"` AssocEdges []*AssocEdge `json:"assocEdges"` EdgeActions []*EdgeAction `json:"edgeActions"` StatusEnums []string `json:"statusEnums"` NullStateFn string `json:"nullStateFn"` NullStates []string `json:"nullStates"` // TS specific EdgeAction *EdgeAction `json:"edgeAction"` // Go specific ActionEdges []string }
func (*AssocEdgeGroup) AddAssocEdge ¶
func (g *AssocEdgeGroup) AddAssocEdge(edge *AssocEdge)
type Constraint ¶
type Constraint struct { Name string `json:"name"` Type ConstraintType `json:"type"` Columns []string `json:"columns"` ForeignKey *ForeignKeyInfo `json:"fkey"` Condition string `json:"condition"` }
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 { Operation ent.ActionOperation `json:"operation"` CustomActionName string `json:"actionName"` CustomGraphQLName string `json:"graphQLName"` CustomInputName string `json:"inputName"` HideFromGraphQL bool `json:"hideFromGraphQL"` ActionOnlyFields []*ActionField `json:"actionOnlyFields"` }
func (*EdgeAction) GetTSStringOperation ¶
func (e *EdgeAction) GetTSStringOperation() string
type Field ¶
type Field struct { Name string `json:"name"` Type *FieldType `json:"type"` Nullable bool `json:"nullable"` StorageKey string `json:"storageKey"` // TODO need a way to indicate unique edge is Required also. this changes type generated in ent and graphql Unique bool `json:"unique"` HideFromGraphQL bool `json:"hideFromGraphQL"` Private bool `json:"private"` GraphQLName string `json:"graphqlName"` Index bool `json:"index"` PrimaryKey bool `json:"primaryKey"` DefaultToViewerOnCreate bool `json:"defaultToViewerOnCreate"` FieldEdge *FieldEdge `json:"fieldEdge"` // this only really makes sense on id fields... ForeignKey *ForeignKey `json:"foreignKey"` ServerDefault interface{} `json:"serverDefault"` // DisableUserEditable true == DefaultValueOnCreate required OR set in trigger DisableUserEditable bool `json:"disableUserEditable"` HasDefaultValueOnCreate bool `json:"hasDefaultValueOnCreate"` HasDefaultValueOnEdit bool `json:"hasDefaultValueOnEdit"` Polymorphic *PolymorphicOptions `json:"polymorphic"` DerivedWhenEmbedded bool `json:"derivedWhenEmbedded"` DerivedFields []*Field `json:"derivedFields"` // Go specific information here TagMap map[string]string GoType types.Type PkgPath string DataTypePkgPath string // set when parsed via tsent generate schema Import enttype.Import }
func (*Field) GetEntType ¶
func (f *Field) GetEntType() (enttype.TSGraphQLType, error)
type FieldType ¶
type FieldType struct { DBType DBType `json:"dbType"` // required when DBType == DBType.List ListElemType *FieldType `json:"listElemType"` // required when DBType == DBType.Enum || DBType.StringEnum Values []string `json:"values"` EnumMap map[string]string `json:"enumMap"` Type string `json:"type"` GraphQLType string `json:"graphQLType"` // optional used by generator to specify different types e.g. email, phone, password CustomType CustomType `json:"customType"` ImportType *enttype.InputImportType `json:"importType"` }
type ForeignKey ¶
type ForeignKeyInfo ¶
type ForeignKeyInfo struct { TableName string `json:"tableName"` Columns []string `json:"columns"` OnDelete OnDeleteFkey `json:"ondelete"` }
type InverseAssocEdge ¶
type Node ¶
type Node struct { TableName *string `json:"tableName"` Fields []*Field `json:"fields"` AssocEdges []*AssocEdge `json:"assocEdges"` AssocEdgeGroups []*AssocEdgeGroup `json:"assocEdgeGroups"` Actions []*Action `json:"actions"` EnumTable bool `json:"enumTable"` DBRows []map[string]interface{} `json:"dbRows"` Constraints []*Constraint `json:"constraints"` Indices []*Index `json:"indices"` HideFromGraphQL bool `json:"hideFromGraphQL"` EdgeConstName string `json:"edgeConstName"` PatternName string `json:"patternName"` }
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 ¶
Click to show internal directories.
Click to hide internal directories.