Documentation ¶
Index ¶
- func CompareSchemas(s1, s2 *Schema) (change.ChangeMap, error)
- type ConstGroupInfo
- type ConstInfo
- type EnumInfo
- type NodeData
- func (nodeData *NodeData) ForeignImport(imp string) bool
- func (nodeData *NodeData) GetActionByGraphQLName(graphQLName string) action.Action
- func (nodeData *NodeData) GetAssociationEdgeByName(edgeName string) *edge.AssociationEdge
- func (obj *NodeData) GetConstantGroups() map[string]*ConstGroupInfo
- func (nodeData *NodeData) GetDestinationEdgeByName(edgeName string) edge.ConnectionEdge
- func (nodeData *NodeData) GetFieldByName(fieldName string) *field.Field
- func (nodeData *NodeData) GetFieldEdgeByName(edgeName string) *edge.FieldEdge
- func (nodeData *NodeData) GetFieldLoaderName(field *field.Field) string
- func (nodeData *NodeData) GetFieldQueryName(field *field.Field) (string, error)
- func (nodeData *NodeData) GetForeignKeyEdgeByName(edgeName string) *edge.ForeignKeyEdge
- func (nodeData *NodeData) GetImportPathsForDependencies() []*tsimport.ImportPath
- func (nodeData *NodeData) GetImportsForBaseFile() ([]*tsimport.ImportPath, error)
- func (nodeData *NodeData) GetImportsForQueryBaseFile(s *Schema) ([]*tsimport.ImportPath, error)
- func (nodeData *NodeData) GetNodeInstance() string
- func (nodeData *NodeData) GetNodeLoaders() []*loader
- func (nodeData *NodeData) GetQuotedTableName() string
- func (obj *NodeData) GetSortedConstantGroups() []*ConstGroupInfo
- func (nodeData *NodeData) GetTSEnums() []*enum.Enum
- func (nodeData *NodeData) GetTableName() string
- func (nodeData *NodeData) GetUniqueNodes() []uniqueNodeInfo
- func (nodeData *NodeData) HasAssocGroups() bool
- func (nodeData *NodeData) HasAssociationEdges() bool
- func (nodeData *NodeData) HasJSONField() bool
- func (nodeData *NodeData) HasPrivateField() bool
- type NodeDataInfo
- type NodeMapInfo
- type PatternInfo
- func (obj *PatternInfo) GetConstantGroups() map[string]*ConstGroupInfo
- func (p *PatternInfo) GetImportsForQueryBaseFile(s *Schema) ([]*tsimport.ImportPath, error)
- func (p *PatternInfo) GetNodeInstance() string
- func (obj *PatternInfo) GetSortedConstantGroups() []*ConstGroupInfo
- func (p *PatternInfo) GetSortedEdges() []*edge.AssociationEdge
- type Schema
- func (s *Schema) EnumNameExists(enum string) bool
- func (s *Schema) GetActionFromGraphQLName(graphQLName string) action.Action
- func (s *Schema) GetAssocEdgeByName(entConfig, edgeName string) (*edge.AssociationEdge, error)
- func (s *Schema) GetEdges() map[string]*ent.AssocEdgeData
- func (s *Schema) GetEdgesToUpdate() []*ent.AssocEdgeData
- func (s *Schema) GetFieldByName(entConfig, fieldName string) (*field.Field, error)
- func (s *Schema) GetInputSchema() *input.Schema
- func (s *Schema) GetNewEdges() []*ent.AssocEdgeData
- func (s *Schema) GetNodeDataForNode(nodeName string) (*NodeData, error)
- func (s *Schema) GetNodeDataFromGraphQLName(nodeName string) *NodeData
- func (s *Schema) GetNodeDataFromTableName(tableName string) *NodeData
- func (s *Schema) NameExists(k string) bool
- func (s *Schema) NodeNameExists(nodeName string) bool
- type WithConst
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareSchemas ¶ added in v0.0.38
CompareSchemas takes 2 schemas and returns a list of changes in the schema not an exhaustive list, exists (for now) only to speed up file generation and so only checks for artifacts that will affect file generation over time, we'll update this to check more properties and be used in more places
Types ¶
type ConstGroupInfo ¶
func (*ConstGroupInfo) CreateNewType ¶
func (cg *ConstGroupInfo) CreateNewType() bool
func (*ConstGroupInfo) GetSortedConstants ¶
func (cg *ConstGroupInfo) GetSortedConstants() []*ConstInfo
type EnumInfo ¶
type EnumInfo struct { Enum *enum.Enum GQLEnum *enum.GQLEnum NodeData *NodeData // InputNode needed to generate columns etc for db columns // Presence of this indicates should be in its own file // e.g. lookup table enums // we only use this as a flag InputNode *input.Node Pattern *input.Pattern }
func (*EnumInfo) LookupTableEnum ¶
func (*EnumInfo) OwnEnumFile ¶ added in v0.0.37
OwnEnumFile: LookupTable enums or enums from patterns get their own file
type NodeData ¶
type NodeData struct { nodeinfo.NodeInfo PackageName string FieldInfo *field.FieldInfo EdgeInfo *edge.EdgeInfo TableName string ActionInfo *action.ActionInfo HideFromGraphQL bool EnumTable bool DBRows []map[string]interface{} // fine to just reuse input constraints for now Constraints []*input.Constraint // same as above. fine to just reuse Indices []*input.Index // contains filtered or unexported fields }
func (*NodeData) ForeignImport ¶ added in v0.0.38
func (*NodeData) GetActionByGraphQLName ¶
func (*NodeData) GetAssociationEdgeByName ¶
func (nodeData *NodeData) GetAssociationEdgeByName(edgeName string) *edge.AssociationEdge
func (*NodeData) GetConstantGroups ¶
func (obj *NodeData) GetConstantGroups() map[string]*ConstGroupInfo
func (*NodeData) GetDestinationEdgeByName ¶
func (nodeData *NodeData) GetDestinationEdgeByName(edgeName string) edge.ConnectionEdge
func (*NodeData) GetFieldByName ¶
func (*NodeData) GetFieldEdgeByName ¶
func (*NodeData) GetFieldLoaderName ¶
func (*NodeData) GetFieldQueryName ¶
func (*NodeData) GetForeignKeyEdgeByName ¶
func (nodeData *NodeData) GetForeignKeyEdgeByName(edgeName string) *edge.ForeignKeyEdge
func (*NodeData) GetImportPathsForDependencies ¶
func (nodeData *NodeData) GetImportPathsForDependencies() []*tsimport.ImportPath
TODO kill this GetImportPathsForDependencies returns imports needed in dependencies e.g. actions and builders
func (*NodeData) GetImportsForBaseFile ¶
func (nodeData *NodeData) GetImportsForBaseFile() ([]*tsimport.ImportPath, error)
TODO kill this GetImportsForBaseFile returns list of imports needed in the base generated file
func (*NodeData) GetImportsForQueryBaseFile ¶
func (nodeData *NodeData) GetImportsForQueryBaseFile(s *Schema) ([]*tsimport.ImportPath, error)
TODO kill this
func (*NodeData) GetNodeInstance ¶
func (*NodeData) GetNodeLoaders ¶
func (nodeData *NodeData) GetNodeLoaders() []*loader
func (*NodeData) GetQuotedTableName ¶
func (*NodeData) GetSortedConstantGroups ¶
func (obj *NodeData) GetSortedConstantGroups() []*ConstGroupInfo
func (*NodeData) GetTSEnums ¶
func (*NodeData) GetTableName ¶
func (*NodeData) GetUniqueNodes ¶
func (nodeData *NodeData) GetUniqueNodes() []uniqueNodeInfo
GetUniqueNodes returns node info that this Node has edges to
func (*NodeData) HasAssocGroups ¶
func (*NodeData) HasAssociationEdges ¶
func (*NodeData) HasJSONField ¶
HasJSONField returns a boolean indicating if this Node has any JSON fields If so, we disable StructScan because we don't implement driver.Value and calling row.StructScan() will fail since the datatype in the db doesn't map to what's in the struct
func (*NodeData) HasPrivateField ¶
type NodeDataInfo ¶
type NodeDataInfo struct { NodeData *NodeData ShouldCodegen bool // contains filtered or unexported fields }
NodeDataInfo stores information related to a particular Node
type NodeMapInfo ¶
type NodeMapInfo map[string]*NodeDataInfo
NodeMapInfo holds all the information about the schema It's a mapping of "packageName" to NodeDataInfo objects
func (NodeMapInfo) HideFromGraphQL ¶
func (m NodeMapInfo) HideFromGraphQL(edge edge.Edge) bool
type PatternInfo ¶
type PatternInfo struct { Name string `json:"name"` AssocEdges map[string]*edge.AssociationEdge `json:"assocEdges"` // contains filtered or unexported fields }
func (*PatternInfo) GetConstantGroups ¶
func (obj *PatternInfo) GetConstantGroups() map[string]*ConstGroupInfo
func (*PatternInfo) GetImportsForQueryBaseFile ¶
func (p *PatternInfo) GetImportsForQueryBaseFile(s *Schema) ([]*tsimport.ImportPath, error)
func (*PatternInfo) GetNodeInstance ¶
func (p *PatternInfo) GetNodeInstance() string
func (*PatternInfo) GetSortedConstantGroups ¶
func (obj *PatternInfo) GetSortedConstantGroups() []*ConstGroupInfo
func (*PatternInfo) GetSortedEdges ¶
func (p *PatternInfo) GetSortedEdges() []*edge.AssociationEdge
type Schema ¶
type Schema struct { Nodes NodeMapInfo Patterns map[string]*PatternInfo // unlike Nodes, the key is "EnumName" instead of "EnumNameConfig" // confusing but gets us closer to what we want Enums map[string]*EnumInfo // contains filtered or unexported fields }
Schema is the representation of the parsed schema. Has everything needed to
func Parse ¶
func Parse(p schemaparser.Parser, specificConfigs ...string) (*Schema, error)
Given a schema file parser, Parse parses the schema to return the completely parsed schema
func ParseFromInputSchema ¶
ParseFromInputSchema takes the schema that has been parsed from whatever input source and provides the schema we have that's checked and conforms to everything we expect
func ParsePackage ¶
func (*Schema) EnumNameExists ¶
func (*Schema) GetActionFromGraphQLName ¶
func (*Schema) GetAssocEdgeByName ¶
func (s *Schema) GetAssocEdgeByName(entConfig, edgeName string) (*edge.AssociationEdge, error)
below really only exist for tests but yolo
func (*Schema) GetEdges ¶
func (s *Schema) GetEdges() map[string]*ent.AssocEdgeData
GetEdges returns all the edges in the schema
func (*Schema) GetEdgesToUpdate ¶
func (s *Schema) GetEdgesToUpdate() []*ent.AssocEdgeData
GetEdgesToUpdate returns edges in the schema that have changed which need to be updated
func (*Schema) GetFieldByName ¶
func (*Schema) GetInputSchema ¶ added in v0.0.38
func (*Schema) GetNewEdges ¶
func (s *Schema) GetNewEdges() []*ent.AssocEdgeData
GetNewEdges only exists for testing purposes to differentiate between existing and new edges
func (*Schema) GetNodeDataForNode ¶
func (*Schema) GetNodeDataFromGraphQLName ¶
func (*Schema) GetNodeDataFromTableName ¶
func (*Schema) NameExists ¶
func (*Schema) NodeNameExists ¶
type WithConst ¶
type WithConst interface { GetNodeInstance() string GetConstantGroups() map[string]*ConstGroupInfo // contains filtered or unexported methods }