edge

package
v0.1.0-alpha.18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2022 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssocEdgeEqual added in v0.0.38

func AssocEdgeEqual(existingEdge, edge *AssociationEdge) bool

func AssocEdgeGroupEqual added in v0.0.38

func AssocEdgeGroupEqual(g1, g2 *AssociationEdgeGroup) bool

intentionally skips EdgeActions since actions are high level objects of their own which will do their own comparison

func AssocEdgesEqual added in v0.0.38

func AssocEdgesEqual(l1, l2 []*AssociationEdge) bool

func CompareAssocEdgesMap added in v0.0.38

func CompareAssocEdgesMap(m1, m2 map[string]*AssociationEdge) []change.Change

func CompareAssociationEdge added in v0.0.38

func CompareAssociationEdge(existingEdge, edge *AssociationEdge) []change.Change

CompareAssociationEdge compares 2 actions to see what changes intentionally skips EdgeActions since actions are high level objects of their own which will do their own comparison

func CompareEdgeInfo added in v0.0.38

func CompareEdgeInfo(e1, e2 *EdgeInfo) []change.Change

Compares edges, assoc edge groups, field edge, connection edge

func TsEdgeConst

func TsEdgeConst(constName string) (string, error)

Types

type ActionableEdge

type ActionableEdge interface {
	EdgeIdentifier() string
}

ActionableEdge indicates an edge that can be used in an action. This provides the edge identifier that can be used in edge action PS: why am I so bad at names?

type AssociationEdge

type AssociationEdge struct {
	EdgeConst     string
	TsEdgeConst   string
	Symmetric     bool
	Unique        bool
	InverseEdge   *InverseAssocEdge
	IsInverseEdge bool
	TableName     string // TableName will be gotten from the GroupName if part of a group or derived from each edge
	// will eventually be made configurable to the user
	EdgeActions []*EdgeAction

	PatternName string
	// contains filtered or unexported fields
}

func AssocEdgeFromInput

func AssocEdgeFromInput(cfg codegenapi.Config, packageName string, edge *input.AssocEdge) (*AssociationEdge, error)

packageName == "object" for edges from patterns

func (*AssociationEdge) AddInverseEdge

func (e *AssociationEdge) AddInverseEdge(inverseEdgeInfo *EdgeInfo) error

func (*AssociationEdge) AssocEdgeBase

func (e *AssociationEdge) AssocEdgeBase() string

func (*AssociationEdge) CamelCaseEdgeName

func (e *AssociationEdge) CamelCaseEdgeName() string

func (*AssociationEdge) CloneWithCommonInfo

func (e *AssociationEdge) CloneWithCommonInfo(cfg codegenapi.Config, configName string) (*AssociationEdge, error)

func (*AssociationEdge) CreateEdge

func (e *AssociationEdge) CreateEdge() bool

func (*AssociationEdge) EdgeIdentifier

func (e *AssociationEdge) EdgeIdentifier() string

func (*AssociationEdge) EdgeQueryBase

func (e *AssociationEdge) EdgeQueryBase() string

func (*AssociationEdge) GenerateBase

func (e *AssociationEdge) GenerateBase() bool

func (*AssociationEdge) GenerateSourceLoadEntOptions added in v0.0.31

func (e *AssociationEdge) GenerateSourceLoadEntOptions() bool

func (*AssociationEdge) GetCountFactoryName

func (e *AssociationEdge) GetCountFactoryName() string

func (*AssociationEdge) GetDataFactoryName

func (e *AssociationEdge) GetDataFactoryName() string

func (*AssociationEdge) GetEdgeName

func (e *AssociationEdge) GetEdgeName() string

func (*AssociationEdge) GetEntConfig

func (e *AssociationEdge) GetEntConfig() *schemaparser.EntConfigInfo

func (*AssociationEdge) GetGraphQLConnectionName

func (e *AssociationEdge) GetGraphQLConnectionName() string

func (*AssociationEdge) GetGraphQLEdgePrefix

func (e *AssociationEdge) GetGraphQLEdgePrefix() string

func (*AssociationEdge) GetNodeInfo

func (e *AssociationEdge) GetNodeInfo() nodeinfo.NodeInfo

func (*AssociationEdge) GetSourceNodeName

func (e *AssociationEdge) GetSourceNodeName() string

func (*AssociationEdge) GetTSGraphQLTypeImports

func (edge *AssociationEdge) GetTSGraphQLTypeImports() []*tsimport.ImportPath

func (*AssociationEdge) GraphQLEdgeName

func (e *AssociationEdge) GraphQLEdgeName() string

func (*AssociationEdge) HideFromGraphQL

func (e *AssociationEdge) HideFromGraphQL() bool

func (*AssociationEdge) PluralEdge

func (e *AssociationEdge) PluralEdge() bool

func (*AssociationEdge) PolymorphicEdge

func (e *AssociationEdge) PolymorphicEdge() bool

func (*AssociationEdge) Singular

func (e *AssociationEdge) Singular() string

func (*AssociationEdge) TsEdgeQueryEdgeName

func (e *AssociationEdge) TsEdgeQueryEdgeName() string

func (*AssociationEdge) TsEdgeQueryName

func (e *AssociationEdge) TsEdgeQueryName() string

func (*AssociationEdge) UniqueEdge

func (e *AssociationEdge) UniqueEdge() bool

type AssociationEdgeGroup

type AssociationEdgeGroup struct {
	GroupName         string // this is the name of the edge which is different from the name of the status. confusing
	GroupStatusName   string // should be something like RsvpStatus
	TSGroupStatusName string // changes RsvpStatus to rsvpStatus
	DestNodeInfo      nodeinfo.NodeInfo
	ConstType         string                      // and then this becomes EventRsvpStatus
	Edges             map[string]*AssociationEdge // TODO...
	EdgeActions       []*EdgeAction
	StatusEnums       []string
	NullStateFn       string
	NullStates        []string

	NodeInfo nodeinfo.NodeInfo
	// contains filtered or unexported fields
}

func (*AssociationEdgeGroup) AddActionEdges

func (edgeGroup *AssociationEdgeGroup) AddActionEdges(list []string)

func (*AssociationEdgeGroup) DefaultNullState

func (edgeGroup *AssociationEdgeGroup) DefaultNullState() string

func (*AssociationEdgeGroup) EdgeIdentifier

func (edgeGroup *AssociationEdgeGroup) EdgeIdentifier() string

func (*AssociationEdgeGroup) GetAssociationByName

func (edgeGroup *AssociationEdgeGroup) GetAssociationByName(edgeName string) *AssociationEdge

func (*AssociationEdgeGroup) GetConstNameForEdgeName

func (edgeGroup *AssociationEdgeGroup) GetConstNameForEdgeName(edgeName string) string

func (*AssociationEdgeGroup) GetConstNameForUnknown

func (edgeGroup *AssociationEdgeGroup) GetConstNameForUnknown() string

func (*AssociationEdgeGroup) GetEnumValues

func (edgeGroup *AssociationEdgeGroup) GetEnumValues() []string

func (*AssociationEdgeGroup) GetIDArg

func (edgeGroup *AssociationEdgeGroup) GetIDArg() string

func (*AssociationEdgeGroup) GetQuotedConstNameForEdgeName

func (edgeGroup *AssociationEdgeGroup) GetQuotedConstNameForEdgeName(edgeName string) string

func (*AssociationEdgeGroup) GetStatusEdges

func (edgeGroup *AssociationEdgeGroup) GetStatusEdges() []*AssociationEdge

func (*AssociationEdgeGroup) GetStatusFieldName

func (edgeGroup *AssociationEdgeGroup) GetStatusFieldName() string

func (*AssociationEdgeGroup) GetStatusFuncName

func (edgeGroup *AssociationEdgeGroup) GetStatusFuncName() string

func (*AssociationEdgeGroup) GetStatusMap

func (edgeGroup *AssociationEdgeGroup) GetStatusMap() map[string]string

func (*AssociationEdgeGroup) GetStatusMapMethod

func (edgeGroup *AssociationEdgeGroup) GetStatusMapMethod() string

func (*AssociationEdgeGroup) GetStatusMethod

func (edgeGroup *AssociationEdgeGroup) GetStatusMethod() string

func (*AssociationEdgeGroup) GetStatusValues

func (edgeGroup *AssociationEdgeGroup) GetStatusValues() []string

func (*AssociationEdgeGroup) UseEdgeInStatusAction

func (edgeGroup *AssociationEdgeGroup) UseEdgeInStatusAction(edgeName string) bool

type ConnectionEdge

type ConnectionEdge interface {
	// NOTE: update compareConnectionEdge if anything changes here
	Edge
	// For custom edges...
	GetSourceNodeName() string
	GetGraphQLEdgePrefix() string
	GetGraphQLConnectionName() string
	TsEdgeQueryEdgeName() string
	TsEdgeQueryName() string
	UniqueEdge() bool
}

type Edge

type Edge interface {
	// NOTE: update compareEdge if anything changes here
	GetEdgeName() string
	GetNodeInfo() nodeinfo.NodeInfo
	GetEntConfig() *schemaparser.EntConfigInfo
	GraphQLEdgeName() string
	CamelCaseEdgeName() string
	HideFromGraphQL() bool
	PolymorphicEdge() bool
	GetTSGraphQLTypeImports() []*tsimport.ImportPath
}

type EdgeAction

type EdgeAction struct {
	Action            string
	CustomActionName  string
	CustomGraphQLName string
	ExposeToGraphQL   bool
	ActionOnlyFields  []*input.ActionField
}

EdgeAction holds as little data as possible about the edge action and depends on action to take that information, process it and generate the action specific metadata

type EdgeInfo

type EdgeInfo struct {

	// TODO hide FieldEdges etc
	// make them accessors since we want to control mutations
	FieldEdges []*FieldEdge

	// note: look at CompareEdgeInfo in compare_edge.go as this changes
	// indexedEdgeQueriesMap has both foreign key and index edges so only comparing
	// that. not comparing destinationEdgesMap as that only includes foreignKey edges
	// if this changes, logic there should change
	IndexedEdgeQueries []IndexedConnectionEdge

	// DestinationEdges. edges that can be gotten from this node
	// foreign key edges + polymorphic indexed fields...
	// this doesn't include Assoc edges which are also connection edges...
	DestinationEdges []ConnectionEdge

	Associations []*AssociationEdge

	AssocGroups []*AssociationEdgeGroup

	SourcePackageName string
	SourceNodeName    string
	// contains filtered or unexported fields
}

func EdgeInfoFromInput

func EdgeInfoFromInput(cfg codegenapi.Config, packageName string, node *input.Node) (*EdgeInfo, error)

func NewEdgeInfo

func NewEdgeInfo(packageName string) *EdgeInfo

func ParseEdgesFunc

func ParseEdgesFunc(packageName string, fn *ast.FuncDecl) (*EdgeInfo, error)

func (*EdgeInfo) AddDestinationEdgeFromPolymorphicOptions

func (e *EdgeInfo) AddDestinationEdgeFromPolymorphicOptions(cfg codegenapi.Config, tsFieldName, quotedDBColName, nodeName string, polymorphic *base.PolymorphicOptions, foreignNode string) error

func (*EdgeInfo) AddEdgeFromForeignKeyIndex

func (e *EdgeInfo) AddEdgeFromForeignKeyIndex(cfg codegenapi.Config, dbColName, edgeName, nodeName string) error

func (*EdgeInfo) AddEdgeFromInverseFieldEdge added in v0.0.35

func (e *EdgeInfo) AddEdgeFromInverseFieldEdge(cfg codegenapi.Config, sourceSchemaName, destinationPackageName string, edge *input.InverseFieldEdge) (*AssociationEdge, error)

func (*EdgeInfo) AddFieldEdgeFromFieldEdgeInfo

func (e *EdgeInfo) AddFieldEdgeFromFieldEdgeInfo(
	cfg codegenapi.Config,
	fieldName string,
	fieldEdgeInfo *base.FieldEdgeInfo,
	nullable bool,
	fieldType enttype.EntType,
	validSchema func(str string) bool,
) error

func (*EdgeInfo) AddFieldEdgeFromForeignKeyInfo

func (e *EdgeInfo) AddFieldEdgeFromForeignKeyInfo(cfg codegenapi.Config, fieldName, configName string, nullable bool, fieldType enttype.EntType, validSchema func(str string) bool,
) error

func (*EdgeInfo) AddIndexedEdgeFromSource

func (e *EdgeInfo) AddIndexedEdgeFromSource(cfg codegenapi.Config, tsFieldName, quotedDBColName, nodeName string, polymorphic *base.PolymorphicOptions) error

func (*EdgeInfo) CreateEdgeBaseFile

func (e *EdgeInfo) CreateEdgeBaseFile() bool

func (*EdgeInfo) GetAssociationEdgeByName

func (e *EdgeInfo) GetAssociationEdgeByName(edgeName string) *AssociationEdge

func (*EdgeInfo) GetAssociationEdgeGroupByStatusName

func (e *EdgeInfo) GetAssociationEdgeGroupByStatusName(groupStatusName string) *AssociationEdgeGroup

func (*EdgeInfo) GetConnectionEdges

func (e *EdgeInfo) GetConnectionEdges() []ConnectionEdge

func (*EdgeInfo) GetDestinationEdgeByName

func (e *EdgeInfo) GetDestinationEdgeByName(edgeName string) ConnectionEdge

func (*EdgeInfo) GetEdgeQueryIndexedEdgeByName

func (e *EdgeInfo) GetEdgeQueryIndexedEdgeByName(edgeName string) *IndexedEdge

func (*EdgeInfo) GetEdgesForIndexLoader

func (e *EdgeInfo) GetEdgesForIndexLoader() []IndexedConnectionEdge

func (*EdgeInfo) GetFieldEdgeByName

func (e *EdgeInfo) GetFieldEdgeByName(edgeName string) *FieldEdge

func (*EdgeInfo) GetForeignKeyEdgeByName

func (e *EdgeInfo) GetForeignKeyEdgeByName(edgeName string) *ForeignKeyEdge

func (*EdgeInfo) GetIndexedEdgeByName

func (e *EdgeInfo) GetIndexedEdgeByName(edgeName string) *IndexedEdge

func (*EdgeInfo) GetSingularEdges

func (e *EdgeInfo) GetSingularEdges() []Edge

func (*EdgeInfo) HasAssociationEdges

func (e *EdgeInfo) HasAssociationEdges() bool

type FieldEdge

type FieldEdge struct {
	FieldName   string
	TSFieldName string
	//	InverseEdgeName string
	Nullable bool

	InverseEdge *input.InverseFieldEdge
	Polymorphic *base.PolymorphicOptions
	// contains filtered or unexported fields
}

func (*FieldEdge) CamelCaseEdgeName

func (e *FieldEdge) CamelCaseEdgeName() string

func (*FieldEdge) GetEdgeName

func (e *FieldEdge) GetEdgeName() string

func (*FieldEdge) GetEntConfig

func (e *FieldEdge) GetEntConfig() *schemaparser.EntConfigInfo

func (*FieldEdge) GetNodeInfo

func (e *FieldEdge) GetNodeInfo() nodeinfo.NodeInfo

func (*FieldEdge) GetTSGraphQLTypeImports

func (edge *FieldEdge) GetTSGraphQLTypeImports() []*tsimport.ImportPath

func (*FieldEdge) GraphQLEdgeName

func (e *FieldEdge) GraphQLEdgeName() string

func (*FieldEdge) HideFromGraphQL

func (e *FieldEdge) HideFromGraphQL() bool

func (*FieldEdge) IsList added in v0.0.35

func (edge *FieldEdge) IsList() bool

func (*FieldEdge) NonPolymorphicList added in v0.0.35

func (edge *FieldEdge) NonPolymorphicList() bool

func (*FieldEdge) PolymorphicEdge

func (edge *FieldEdge) PolymorphicEdge() bool

type ForeignKeyEdge

type ForeignKeyEdge struct {
	// note that if anything is changed here, need to update foreignKeyEdgeEqual() in compare_edge.go
	SourceNodeName string
	// contains filtered or unexported fields
}

func (ForeignKeyEdge) EdgeIdentifier

func (e ForeignKeyEdge) EdgeIdentifier() string

func (*ForeignKeyEdge) GetCountFactoryName

func (e *ForeignKeyEdge) GetCountFactoryName() string

func (*ForeignKeyEdge) GetDataFactoryName

func (e *ForeignKeyEdge) GetDataFactoryName() string

func (*ForeignKeyEdge) GetGraphQLConnectionName

func (e *ForeignKeyEdge) GetGraphQLConnectionName() string

func (*ForeignKeyEdge) GetGraphQLEdgePrefix

func (e *ForeignKeyEdge) GetGraphQLEdgePrefix() string

func (*ForeignKeyEdge) GetSourceNodeName

func (e *ForeignKeyEdge) GetSourceNodeName() string

func (*ForeignKeyEdge) GetTSGraphQLTypeImports

func (e *ForeignKeyEdge) GetTSGraphQLTypeImports() []*tsimport.ImportPath

func (*ForeignKeyEdge) PluralEdge

func (e *ForeignKeyEdge) PluralEdge() bool

func (*ForeignKeyEdge) PolymorphicEdge

func (e *ForeignKeyEdge) PolymorphicEdge() bool

func (*ForeignKeyEdge) QuotedDBColName

func (e *ForeignKeyEdge) QuotedDBColName() string

func (ForeignKeyEdge) Singular

func (e ForeignKeyEdge) Singular() string

func (*ForeignKeyEdge) SourceIsPolymorphic added in v0.0.31

func (e *ForeignKeyEdge) SourceIsPolymorphic() bool

func (*ForeignKeyEdge) TsEdgeQueryEdgeName

func (e *ForeignKeyEdge) TsEdgeQueryEdgeName() string

func (*ForeignKeyEdge) TsEdgeQueryName

func (e *ForeignKeyEdge) TsEdgeQueryName() string

func (*ForeignKeyEdge) UniqueEdge

func (e *ForeignKeyEdge) UniqueEdge() bool

type IndexedConnectionEdge

type IndexedConnectionEdge interface {
	// NOTE: update compareIndexedConnectionEdge if anything changes here
	ConnectionEdge
	SourceIsPolymorphic() bool
	QuotedDBColName() string
}

type IndexedEdge

type IndexedEdge struct {
	// note that if anything is changed here, need to update indexedEdgeEqual() in compare_edge.go
	SourceNodeName string
	// contains filtered or unexported fields
}

this is like a foreign key edge except different refers to a field that's indexed but doesn't want to reference it as a foreign key currently best use case is as a polymorphic field but nothing stopping this from being non-polymorphic

func (IndexedEdge) EdgeIdentifier

func (e IndexedEdge) EdgeIdentifier() string

func (*IndexedEdge) GetCountFactoryName

func (e *IndexedEdge) GetCountFactoryName() string

func (*IndexedEdge) GetDataFactoryName

func (e *IndexedEdge) GetDataFactoryName() string

func (*IndexedEdge) GetGraphQLConnectionName

func (e *IndexedEdge) GetGraphQLConnectionName() string

func (*IndexedEdge) GetGraphQLEdgePrefix

func (e *IndexedEdge) GetGraphQLEdgePrefix() string

func (*IndexedEdge) GetSourceNodeName

func (e *IndexedEdge) GetSourceNodeName() string

func (*IndexedEdge) GetTSGraphQLTypeImports

func (e *IndexedEdge) GetTSGraphQLTypeImports() []*tsimport.ImportPath

func (*IndexedEdge) PluralEdge

func (e *IndexedEdge) PluralEdge() bool

func (*IndexedEdge) PolymorphicEdge

func (e *IndexedEdge) PolymorphicEdge() bool

func (*IndexedEdge) QuotedDBColName

func (e *IndexedEdge) QuotedDBColName() string

func (IndexedEdge) Singular

func (e IndexedEdge) Singular() string

func (*IndexedEdge) SourceIsPolymorphic added in v0.0.31

func (e *IndexedEdge) SourceIsPolymorphic() bool

func (*IndexedEdge) TsEdgeQueryEdgeName

func (e *IndexedEdge) TsEdgeQueryEdgeName() string

func (*IndexedEdge) TsEdgeQueryName

func (e *IndexedEdge) TsEdgeQueryName() string

func (*IndexedEdge) UniqueEdge

func (e *IndexedEdge) UniqueEdge() bool

type InverseAssocEdge

type InverseAssocEdge struct {
	EdgeConst string
	// contains filtered or unexported fields
}

func (*InverseAssocEdge) CamelCaseEdgeName

func (e *InverseAssocEdge) CamelCaseEdgeName() string

func (*InverseAssocEdge) GetEdgeName

func (e *InverseAssocEdge) GetEdgeName() string

func (*InverseAssocEdge) GetEntConfig

func (e *InverseAssocEdge) GetEntConfig() *schemaparser.EntConfigInfo

func (*InverseAssocEdge) GetNodeInfo

func (e *InverseAssocEdge) GetNodeInfo() nodeinfo.NodeInfo

func (*InverseAssocEdge) GetTSGraphQLTypeImports

func (e *InverseAssocEdge) GetTSGraphQLTypeImports() []*tsimport.ImportPath

func (*InverseAssocEdge) GraphQLEdgeName

func (e *InverseAssocEdge) GraphQLEdgeName() string

func (*InverseAssocEdge) HideFromGraphQL

func (e *InverseAssocEdge) HideFromGraphQL() bool

func (*InverseAssocEdge) PolymorphicEdge

func (e *InverseAssocEdge) PolymorphicEdge() bool

type PluralEdge

type PluralEdge interface {
	Edge
	PluralEdge() bool
	Singular() string
}

marker interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL