Documentation ¶
Index ¶
- func CompareSchemas(s1, s2 *Schema) (change.ChangeMap, error)
- type CanViewerSeeInfo
- type ConstGroupInfo
- type ConstInfo
- type Container
- type EnumInfo
- type NodeData
- func (nodeData *NodeData) BuilderEdges(s *Schema) []*edge.AssociationEdge
- func (nodeData *NodeData) FieldsWithEditFieldPrivacy() bool
- func (nodeData *NodeData) FieldsWithFieldPrivacy() bool
- func (nodeData *NodeData) GenerateGetIDInBuilder() bool
- func (nodeData *NodeData) GetActionByGraphQLName(graphQLName string) action.Action
- func (nodeData *NodeData) GetActionInfo() *action.ActionInfo
- func (nodeData *NodeData) GetAssociationEdgeByName(edgeName string) *edge.AssociationEdge
- func (nodeData *NodeData) GetBuilderMixinInfo(s *Schema) (*mixinInfo, error)
- func (nodeData *NodeData) GetCanViewerDoInfo() map[string]action.Action
- func (nodeData *NodeData) GetCanViewerEditInfo() *CanViewerSeeInfo
- func (nodeData *NodeData) GetCanViewerSeeInfo() *CanViewerSeeInfo
- func (obj *NodeData) GetConstantGroups() map[string]*ConstGroupInfo
- func (nodeData *NodeData) GetDestinationEdgeByName(edgeName string) edge.ConnectionEdge
- func (nodeData *NodeData) GetEdgeInfo() *edge.EdgeInfo
- func (nodeData *NodeData) GetExtraCustomQueryInfo() *extraCustomQueryInfo
- func (nodeData *NodeData) GetFieldByName(fieldName string) *field.Field
- func (nodeData *NodeData) GetFieldEdgeByName(edgeName string) *edge.FieldEdge
- func (nodeData *NodeData) GetFieldInfo() *field.FieldInfo
- func (nodeData *NodeData) GetFieldLoaderName(field *field.Field) string
- func (nodeData *NodeData) GetFieldLoaderNoTransformName(field *field.Field) string
- func (nodeData *NodeData) GetFieldQueryName(field *field.Field) (string, error)
- func (nodeData *NodeData) GetForeignKeyEdgeByName(edgeName string) *edge.ForeignKeyEdge
- func (nodeData *NodeData) GetGraphQLTypeName() string
- func (nodeData *NodeData) GetImportPathsForDependencies(s *Schema) []*tsimport.ImportPath
- func (nodeData *NodeData) GetImportsForBaseFile(s *Schema, cfg codegenapi.Config) ([]*tsimport.ImportPath, error)
- func (nodeData *NodeData) GetImportsForQueryBaseFile(s *Schema) ([]*tsimport.ImportPath, error)
- func (nodeData *NodeData) GetLoaderName() string
- func (nodeData *NodeData) GetLoaderNoTransformName() string
- func (nodeData *NodeData) GetMixinInfo(s *Schema, cfg codegenapi.Config) (*mixinInfo, error)
- func (nodeData *NodeData) GetName() string
- func (nodeData *NodeData) GetNodeInstance() string
- func (nodeData *NodeData) GetNodeLoaders() [][]*loader
- func (nodeData *NodeData) GetOnEntLoadPrivacyInfo(cfg codegenapi.Config) *entLoadPrivacyInfo
- func (nodeData *NodeData) GetQuotedTableName() string
- func (nodeData *NodeData) GetRawDBDataName() string
- func (nodeData *NodeData) GetSchemaConst() string
- func (nodeData *NodeData) GetSchemaPath() 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) GetUpsertInfo(actionName string) *UpsertInfo
- func (nodeData *NodeData) HasAssocGroups() bool
- func (nodeData *NodeData) HasAssociationEdges() bool
- func (nodeData *NodeData) HasCanViewerDo() bool
- func (nodeData *NodeData) HasMixins() bool
- func (nodeData *NodeData) HasPrivateField(cfg codegenapi.Config) bool
- func (nodeData *NodeData) IsPattern() bool
- func (nodeData *NodeData) OnEntLoadFieldPrivacy(cfg codegenapi.Config) bool
- func (nodeData *NodeData) OverrideSchemaPath(schemaPath string)
- type NodeDataInfo
- type NodeMapInfo
- type PatternInfo
- func (p *PatternInfo) ForeignImport(imp string) bool
- func (p *PatternInfo) GetActionInfo() *action.ActionInfo
- func (p *PatternInfo) GetBuilderInterfaceName() string
- func (p *PatternInfo) GetBuilderName() string
- func (obj *PatternInfo) GetConstantGroups() map[string]*ConstGroupInfo
- func (p *PatternInfo) GetEdgeInfo() *edge.EdgeInfo
- func (p *PatternInfo) GetFieldInfo() *field.FieldInfo
- func (p *PatternInfo) GetImportPathForMixinBase() string
- func (p *PatternInfo) GetImportsForMixin(s *Schema, cfg codegenapi.Config) []*tsimport.ImportPath
- func (p *PatternInfo) GetImportsForQueryBaseFile(s *Schema) ([]*tsimport.ImportPath, error)
- func (p *PatternInfo) GetMixinBaseFile() string
- func (p *PatternInfo) GetMixinBaseName() string
- func (p *PatternInfo) GetMixinInterfaceBaseName() string
- func (p *PatternInfo) GetMixinInterfaceName() string
- func (p *PatternInfo) GetMixinName() string
- func (p *PatternInfo) GetMixinWithInterfaceName() string
- func (p *PatternInfo) GetName() string
- func (p *PatternInfo) GetNodeInstance() string
- func (p *PatternInfo) GetPatternMethod() string
- func (obj *PatternInfo) GetSortedConstantGroups() []*ConstGroupInfo
- func (p *PatternInfo) GetSortedEdges() []*edge.AssociationEdge
- func (p *PatternInfo) HasBuilder() bool
- func (p *PatternInfo) HasFields() bool
- func (p *PatternInfo) HasMixin() bool
- func (p *PatternInfo) IsPattern() bool
- type Schema
- func (s *Schema) EnumNameExists(enum string) bool
- func (s *Schema) ExtraEdgeFields() []*field.Field
- func (s *Schema) GetActionFromGraphQLName(graphQLName string) action.Action
- func (s *Schema) GetAssocEdgeByName(nodeName, edgeName string) (*edge.AssociationEdge, error)
- func (s *Schema) GetCustomTypeByTSName(name string) field.CustomTypeWithHasConvertFunction
- func (s *Schema) GetEdges() map[string]*ent.AssocEdgeData
- func (s *Schema) GetEdgesToUpdate() []*ent.AssocEdgeData
- func (s *Schema) GetFieldByName(nodeName, fieldName string) (*field.Field, error)
- func (s *Schema) GetGlobalCanViewerDo() map[string]action.Action
- func (s *Schema) GetGlobalConsts() WithConst
- func (s *Schema) GetGlobalEdges() []*edge.AssociationEdge
- func (s *Schema) GetGlobalEnums() map[string]*EnumInfo
- 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) GlobalSchemaTransformsEdges() bool
- func (s *Schema) InitGlobalSchema() bool
- func (s *Schema) IsGlobalEnumWithDisableUnknownType(typ string) bool
- func (s *Schema) NameExists(k string) bool
- func (s *Schema) NodeNameExists(nodeName string) bool
- func (s *Schema) PatternFieldWithMixin(f *field.Field) bool
- type TypeInfo
- type UpsertInfo
- 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 CanViewerSeeInfo ¶ added in v0.1.0
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 ¶
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 PatternsWithMixins []string CustomGraphQLInterfaces []string SupportUpsert bool ShowCanViewerSee bool ShowCanViewerEdit bool TransformsSelect bool TransformsDelete bool TransformsLoaderCodegen *input.TransformsLoaderCodegen HasDefaultActionPrivacy bool // contains filtered or unexported fields }
func (*NodeData) BuilderEdges ¶ added in v0.1.0
func (nodeData *NodeData) BuilderEdges(s *Schema) []*edge.AssociationEdge
edges that are in the builder directly
func (*NodeData) FieldsWithEditFieldPrivacy ¶ added in v0.1.0
func (*NodeData) FieldsWithFieldPrivacy ¶ added in v0.1.0
func (*NodeData) GenerateGetIDInBuilder ¶ added in v0.1.0
func (*NodeData) GetActionByGraphQLName ¶
func (*NodeData) GetActionInfo ¶
func (nodeData *NodeData) GetActionInfo() *action.ActionInfo
func (*NodeData) GetAssociationEdgeByName ¶
func (nodeData *NodeData) GetAssociationEdgeByName(edgeName string) *edge.AssociationEdge
func (*NodeData) GetBuilderMixinInfo ¶ added in v0.1.0
func (*NodeData) GetCanViewerDoInfo ¶ added in v0.1.0
func (*NodeData) GetCanViewerEditInfo ¶ added in v0.1.0
func (nodeData *NodeData) GetCanViewerEditInfo() *CanViewerSeeInfo
func (*NodeData) GetCanViewerSeeInfo ¶ added in v0.1.0
func (nodeData *NodeData) GetCanViewerSeeInfo() *CanViewerSeeInfo
func (*NodeData) GetConstantGroups ¶
func (obj *NodeData) GetConstantGroups() map[string]*ConstGroupInfo
func (*NodeData) GetDestinationEdgeByName ¶
func (nodeData *NodeData) GetDestinationEdgeByName(edgeName string) edge.ConnectionEdge
func (*NodeData) GetEdgeInfo ¶
func (*NodeData) GetExtraCustomQueryInfo ¶ added in v0.1.0
func (nodeData *NodeData) GetExtraCustomQueryInfo() *extraCustomQueryInfo
func (*NodeData) GetFieldByName ¶
func (*NodeData) GetFieldEdgeByName ¶
func (*NodeData) GetFieldInfo ¶
func (*NodeData) GetFieldLoaderName ¶
func (*NodeData) GetFieldLoaderNoTransformName ¶ added in v0.0.39
func (*NodeData) GetFieldQueryName ¶
func (*NodeData) GetForeignKeyEdgeByName ¶
func (nodeData *NodeData) GetForeignKeyEdgeByName(edgeName string) *edge.ForeignKeyEdge
func (*NodeData) GetGraphQLTypeName ¶ added in v0.1.0
func (*NodeData) GetImportPathsForDependencies ¶
func (nodeData *NodeData) GetImportPathsForDependencies(s *Schema) []*tsimport.ImportPath
TODO kill this GetImportPathsForDependencies returns imports needed in dependencies e.g. actions and builders
func (*NodeData) GetImportsForBaseFile ¶
func (nodeData *NodeData) GetImportsForBaseFile(s *Schema, cfg codegenapi.Config) ([]*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) GetLoaderName ¶ added in v0.0.39
func (*NodeData) GetLoaderNoTransformName ¶ added in v0.0.39
func (*NodeData) GetMixinInfo ¶ added in v0.1.0
func (nodeData *NodeData) GetMixinInfo(s *Schema, cfg codegenapi.Config) (*mixinInfo, error)
func (*NodeData) GetNodeInstance ¶
func (*NodeData) GetNodeLoaders ¶
func (nodeData *NodeData) GetNodeLoaders() [][]*loader
GetNodeLoaders returns groups of loaders that can be primed e.g. if there's a transform, loaders which query with transformation can prime the other but those which don't query with transformations can't be
func (*NodeData) GetOnEntLoadPrivacyInfo ¶ added in v0.1.0
func (nodeData *NodeData) GetOnEntLoadPrivacyInfo(cfg codegenapi.Config) *entLoadPrivacyInfo
func (*NodeData) GetQuotedTableName ¶
func (*NodeData) GetRawDBDataName ¶ added in v0.1.0
func (*NodeData) GetSchemaConst ¶ added in v0.1.0
func (*NodeData) GetSchemaPath ¶ added in v0.0.39
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) GetUpsertInfo ¶ added in v0.1.0
func (nodeData *NodeData) GetUpsertInfo(actionName string) *UpsertInfo
func (*NodeData) HasAssocGroups ¶
func (*NodeData) HasAssociationEdges ¶
func (*NodeData) HasCanViewerDo ¶ added in v0.1.0
func (*NodeData) HasPrivateField ¶
func (nodeData *NodeData) HasPrivateField(cfg codegenapi.Config) bool
func (*NodeData) OnEntLoadFieldPrivacy ¶ added in v0.1.0
func (nodeData *NodeData) OnEntLoadFieldPrivacy(cfg codegenapi.Config) bool
func (*NodeData) OverrideSchemaPath ¶ added in v0.1.0
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 FieldInfo *field.FieldInfo EdgeInfo *edge.EdgeInfo AssocEdges map[string]*edge.AssociationEdge DisableMixin bool // contains filtered or unexported fields }
func (*PatternInfo) ForeignImport ¶ added in v0.1.0
func (p *PatternInfo) ForeignImport(imp string) bool
func (*PatternInfo) GetActionInfo ¶
func (p *PatternInfo) GetActionInfo() *action.ActionInfo
func (*PatternInfo) GetBuilderInterfaceName ¶ added in v0.1.0
func (p *PatternInfo) GetBuilderInterfaceName() string
func (*PatternInfo) GetBuilderName ¶ added in v0.1.0
func (p *PatternInfo) GetBuilderName() string
func (*PatternInfo) GetConstantGroups ¶
func (obj *PatternInfo) GetConstantGroups() map[string]*ConstGroupInfo
func (*PatternInfo) GetEdgeInfo ¶
func (p *PatternInfo) GetEdgeInfo() *edge.EdgeInfo
func (*PatternInfo) GetFieldInfo ¶
func (p *PatternInfo) GetFieldInfo() *field.FieldInfo
func (*PatternInfo) GetImportPathForMixinBase ¶
func (p *PatternInfo) GetImportPathForMixinBase() string
func (*PatternInfo) GetImportsForMixin ¶ added in v0.1.0
func (p *PatternInfo) GetImportsForMixin(s *Schema, cfg codegenapi.Config) []*tsimport.ImportPath
func (*PatternInfo) GetImportsForQueryBaseFile ¶
func (p *PatternInfo) GetImportsForQueryBaseFile(s *Schema) ([]*tsimport.ImportPath, error)
borrowed for builder.tmpl
func (*PatternInfo) GetMixinBaseFile ¶
func (p *PatternInfo) GetMixinBaseFile() string
func (*PatternInfo) GetMixinBaseName ¶
func (p *PatternInfo) GetMixinBaseName() string
func (*PatternInfo) GetMixinInterfaceBaseName ¶
func (p *PatternInfo) GetMixinInterfaceBaseName() string
func (*PatternInfo) GetMixinInterfaceName ¶ added in v0.1.0
func (p *PatternInfo) GetMixinInterfaceName() string
func (*PatternInfo) GetMixinName ¶ added in v0.1.0
func (p *PatternInfo) GetMixinName() string
func (*PatternInfo) GetMixinWithInterfaceName ¶ added in v0.1.0
func (p *PatternInfo) GetMixinWithInterfaceName() string
func (*PatternInfo) GetName ¶
func (p *PatternInfo) GetName() string
func (*PatternInfo) GetNodeInstance ¶
func (p *PatternInfo) GetNodeInstance() string
func (*PatternInfo) GetPatternMethod ¶ added in v0.1.0
func (p *PatternInfo) GetPatternMethod() string
func (*PatternInfo) GetSortedConstantGroups ¶
func (obj *PatternInfo) GetSortedConstantGroups() []*ConstGroupInfo
func (*PatternInfo) GetSortedEdges ¶
func (p *PatternInfo) GetSortedEdges() []*edge.AssociationEdge
func (*PatternInfo) HasBuilder ¶ added in v0.1.0
func (p *PatternInfo) HasBuilder() bool
func (*PatternInfo) HasFields ¶ added in v0.1.0
func (p *PatternInfo) HasFields() bool
func (*PatternInfo) HasMixin ¶ added in v0.1.0
func (p *PatternInfo) HasMixin() bool
the main value that currently exists for mixins with no fields seems to be marker interface
func (*PatternInfo) IsPattern ¶
func (p *PatternInfo) IsPattern() bool
type Schema ¶
type Schema struct { Nodes NodeMapInfo Patterns map[string]*PatternInfo Enums map[string]*EnumInfo CustomInterfaces map[string]*customtype.CustomInterface // contains filtered or unexported fields }
Schema is the representation of the parsed schema. Has everything needed to
func ParseFromInputSchema ¶
func ParseFromInputSchema(cfg codegenapi.Config, schema *input.Schema, lang base.Language) (*Schema, error)
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 (*Schema) EnumNameExists ¶
func (*Schema) ExtraEdgeFields ¶ added in v0.1.0
func (*Schema) GetActionFromGraphQLName ¶
func (*Schema) GetAssocEdgeByName ¶
func (s *Schema) GetAssocEdgeByName(nodeName, edgeName string) (*edge.AssociationEdge, error)
below really only exist for tests but yolo
func (*Schema) GetCustomTypeByTSName ¶ added in v0.1.0
func (s *Schema) GetCustomTypeByTSName(name string) field.CustomTypeWithHasConvertFunction
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) GetGlobalCanViewerDo ¶ added in v0.1.0
func (*Schema) GetGlobalConsts ¶ added in v0.1.0
func (*Schema) GetGlobalEdges ¶ added in v0.1.0
func (s *Schema) GetGlobalEdges() []*edge.AssociationEdge
func (*Schema) GetGlobalEnums ¶ added in v0.1.0
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) GlobalSchemaTransformsEdges ¶ added in v0.1.0
func (*Schema) InitGlobalSchema ¶ added in v0.1.0
func (*Schema) IsGlobalEnumWithDisableUnknownType ¶ added in v0.1.5
func (*Schema) NameExists ¶
func (*Schema) NodeNameExists ¶
type TypeInfo ¶ added in v0.1.0
type UpsertInfo ¶ added in v0.1.0
type UpsertInfo struct { Name string HasColumn bool HasConstraint bool // contains filtered or unexported fields }
func (*UpsertInfo) Types ¶ added in v0.1.0
func (ui *UpsertInfo) Types() string
type WithConst ¶
type WithConst interface { GetNodeInstance() string GetConstantGroups() map[string]*ConstGroupInfo // contains filtered or unexported methods }