Documentation ¶
Overview ¶
The query package primarily contains code used internally by the framework to build queries. You will primarily interact with Nodes through the code generated ORM structures. Other than working with Nodes, you will not likely need to use the query package, unless you are creating a database driver.
Index ¶
- Constants
- func ColumnNodeDbName(n *ColumnNode) string
- func ColumnNodeIsPK(n *ColumnNode) bool
- func ExpandNode(n NodeI)
- func LogNode(n NodeI, level int)
- func ManyManyNodeDbColumn(n *ManyManyNode) string
- func ManyManyNodeDbTable(n *ManyManyNode) string
- func ManyManyNodeIsArray(n *ManyManyNode) bool
- func ManyManyNodeIsTypeTable(n *ManyManyNode) bool
- func ManyManyNodeRefColumn(n *ManyManyNode) string
- func ManyManyNodeRefTable(n *ManyManyNode) string
- func NodeDbKey(n NodeI) string
- func NodeGoName(n NodeI) string
- func NodeIsConditioner(n NodeI) bool
- func NodeIsExpanded(n NodeI) bool
- func NodeIsExpander(n NodeI) bool
- func NodeIsPK(n NodeI) bool
- func NodeIsReferenceI(n NodeI) bool
- func NodeIsTableNodeI(n NodeI) bool
- func NodeSetCondition(n NodeI, condition NodeI)
- func NodeSorterSortDesc(n NodeSorter) bool
- func NodeTableName(n NodeI) string
- func OperationNodeDistinct(n *OperationNode) bool
- func OperationNodeFunction(n *OperationNode) string
- func ReferenceNodeDbColumnName(n *ReferenceNode) string
- func ReferenceNodeRefColumn(n *ReferenceNode) string
- func ReferenceNodeRefTable(n *ReferenceNode) string
- func ReverseReferenceNodeDbColumnName(n *ReverseReferenceNode) string
- func ReverseReferenceNodeIsArray(n *ReverseReferenceNode) bool
- func ReverseReferenceNodeRefColumn(n *ReverseReferenceNode) string
- func ReverseReferenceNodeRefTable(n *ReverseReferenceNode) string
- func SetParentNode(child NodeI, parent NodeI)
- func ValueNodeGetValue(n *ValueNode) interface{}
- type AliasNode
- type AliasNodeI
- type AliasValue
- type Aliaser
- type ColumnNode
- func (n *ColumnNode) Ascending() NodeI
- func (n *ColumnNode) Descending() NodeI
- func (n *ColumnNode) Equals(n2 NodeI) bool
- func (n *ColumnNode) GetAlias() string
- func (n *ColumnNode) GobDecode(data []byte) (err error)
- func (n *ColumnNode) GobEncode() (data []byte, err error)
- func (n *ColumnNode) SetAlias(a string)
- type ColumnNodeI
- type Expander
- type GoColumnType
- type ManyManyNode
- type NodeI
- func ChildNode(n NodeI) NodeI
- func ContainedNodes(n NodeI) (nodes []NodeI)
- func NewValueNode(i interface{}) NodeI
- func NodeCondition(n NodeI) NodeI
- func NodePrimaryKey(n NodeI) NodeI
- func OperationNodeOperands(n *OperationNode) []NodeI
- func ParentNode(n NodeI) NodeI
- func RelatedColumnNode(n NodeI) NodeI
- func RootNode(n NodeI) NodeI
- func Value(i interface{}) NodeI
- type NodeSorter
- type NodeType
- type OperationNode
- func (n *OperationNode) Distinct() *OperationNode
- func (n *OperationNode) Equals(n2 NodeI) bool
- func (n *OperationNode) GetAlias() string
- func (n *OperationNode) GobDecode(data []byte) (err error)
- func (n *OperationNode) GobEncode() (data []byte, err error)
- func (n *OperationNode) SetAlias(a string)
- type OperationNodeI
- type Operator
- type QueryBuilderI
- type ReferenceNode
- type ReferenceNodeI
- type ReverseReferenceNode
- func (n *ReverseReferenceNode) Equals(n2 NodeI) bool
- func (n *ReverseReferenceNode) Expand()
- func (n *ReverseReferenceNode) GetAlias() string
- func (n *ReverseReferenceNode) GobDecode(data []byte) (err error)
- func (n *ReverseReferenceNode) GobEncode() (data []byte, err error)
- func (n *ReverseReferenceNode) SetAlias(a string)
- type SubqueryNode
- type TableNode
- type TableNodeI
- type ValueNode
Constants ¶
const ( OpEqual Operator = "=" OpNotEqual Operator = "<>" OpAnd = "AND" OpOr = "OR" OpXor = "XOR" OpGreater = ">" OpGreaterEqual = ">=" OpLess = "<" OpLessEqual = "<=" // Unary logical OpNot = "NOT" OpAll = "1=1" OpNone = "1=0" // Math operators OpAdd = "+" OpSubtract = "-" OpMultiply = "*" OpDivide = "/" OpModulo = "%" // Unary math OpNegate = " -" // Bit operators OpBitAnd = "&" OpBitOr = "|" OpBitXor = "^" OpShiftLeft = "<<" OpShiftRight = ">>" // Unary bit OpBitInvert = "~" // Function operator // The function name is followed by the operators in parenthesis OpFunc = "func" // SQL functions that act like operators in that the operator is put in between the operands OpLike = "LIKE" // This is very SQL specific and may not be supported in NoSql OpIn = "IN" OpNotIn = "NOT IN" // Special NULL tests OpNull = "NULL" OpNotNull = "NOT NULL" // Our own custom operators for universal support OpStartsWith = "StartsWith" OpEndsWith = "EndsWith" OpContains = "Contains" )
const AliasResults = "aliases_"
The special item to use for named aliases in the result set
Variables ¶
This section is empty.
Functions ¶
func ColumnNodeDbName ¶
func ColumnNodeDbName(n *ColumnNode) string
ColumnNodeDbName is used internally by the framework to return the name of the column in the database.
func ColumnNodeIsPK ¶ added in v0.0.7
func ColumnNodeIsPK(n *ColumnNode) bool
func ExpandNode ¶
func ExpandNode(n NodeI)
ExpandNode is used internally by the framework to expand a many-many relationship.
func ManyManyNodeDbColumn ¶
func ManyManyNodeDbColumn(n *ManyManyNode) string
ManyManyNodeDbColumn is used internally by the framework to return the column name in the table the node belongs to
func ManyManyNodeDbTable ¶
func ManyManyNodeDbTable(n *ManyManyNode) string
ManyManyNodeDbTable is used internally by the framework to return the table name of the table the node belongs to
func ManyManyNodeIsArray ¶
func ManyManyNodeIsArray(n *ManyManyNode) bool
ManyManyNodeIsArray is used internally by the framework to return whether the node creates an array, or just a link to a single item.
func ManyManyNodeIsTypeTable ¶
func ManyManyNodeIsTypeTable(n *ManyManyNode) bool
ManyManyNodeIsTypeTable is used internally by the framework to return whether the node points to a type table
func ManyManyNodeRefColumn ¶
func ManyManyNodeRefColumn(n *ManyManyNode) string
ManyManyNodeRefColumn is used internally by the framework to return the column name on the other end of the link
func ManyManyNodeRefTable ¶
func ManyManyNodeRefTable(n *ManyManyNode) string
ManyManyNodeRefTable is used internally by the framework to return the table name on the other end of the link
func NodeGoName ¶
NodeGoName is used internally by the framework to return the go name of the item the node refers to.
func NodeIsConditioner ¶
NodeIsConditioner is used internally by the framework to determine if the node has a join condition.
func NodeIsExpanded ¶
NodeIsExpanded is used internally by the framework to detect if the node is an expanded many-many relationship.
func NodeIsExpander ¶
NodeIsExpander is used internally by the framework to detect if the node can be an expanded many-many relationship.
func NodeIsReferenceI ¶ added in v0.0.7
Convenience method to see if a node is a reference type node. This is essentially table type nodes excluding an actual TableNode, since table nodes always start at the top level.
func NodeIsTableNodeI ¶ added in v0.0.7
Convenience method to see if a node is a table type of node, or a leaf node
func NodeSetCondition ¶
NodeSetCondition is used internally by the framework to set a condition on a node.
func NodeSorterSortDesc ¶
func NodeSorterSortDesc(n NodeSorter) bool
NodeSorterSortDesc is used internally by the framework to determine if the NodeSorter is descending.
func NodeTableName ¶
NodeTableName is used internally by the framework to return the table associated with a node.
func OperationNodeDistinct ¶
func OperationNodeDistinct(n *OperationNode) bool
OperationNodeDistinct is used internally by the framework to get the distinct value.
func OperationNodeFunction ¶
func OperationNodeFunction(n *OperationNode) string
OperationNodeFunction is used internally by the framework to get the function.
func ReferenceNodeDbColumnName ¶
func ReferenceNodeDbColumnName(n *ReferenceNode) string
ReferenceNodeDbColumnName is used internally by the framework to get the column name for this side of the relationship.
func ReferenceNodeRefColumn ¶
func ReferenceNodeRefColumn(n *ReferenceNode) string
ReferenceNodeRefColumn is used internally by the framework to get the column name for the other side of the relationship.
func ReferenceNodeRefTable ¶
func ReferenceNodeRefTable(n *ReferenceNode) string
ReferenceNodeRefTable is used internally by the framework to get the table name for the other side of the relationship.
func ReverseReferenceNodeDbColumnName ¶
func ReverseReferenceNodeDbColumnName(n *ReverseReferenceNode) string
ReverseReferenceNodeDbColumnName is used internally by the framework to get the database column on this side of the relationship, which is most likely the primary key.
func ReverseReferenceNodeIsArray ¶
func ReverseReferenceNodeIsArray(n *ReverseReferenceNode) bool
ReverseReferenceNodeIsArray is used internally by the framework to determine if a node should create an array
func ReverseReferenceNodeRefColumn ¶
func ReverseReferenceNodeRefColumn(n *ReverseReferenceNode) string
ReverseReferenceNodeRefColumn is used internally by the framework to get the referenced column
func ReverseReferenceNodeRefTable ¶
func ReverseReferenceNodeRefTable(n *ReverseReferenceNode) string
ReverseReferenceNodeRefTable is used internally by the framework to get the referenced table
func SetParentNode ¶
SetParentNode is used internally by the framework. It is used by the codegenerator to create linked nodes. It is used by the serializer to restore linked nodes.
func ValueNodeGetValue ¶
func ValueNodeGetValue(n *ValueNode) interface{}
ValueNodeGetValue is used internally by the framework to get the node's internal value.
Types ¶
type AliasNode ¶
type AliasNode struct {
// contains filtered or unexported fields
}
An AliasNode is a reference to a prior aliased operation later in a query. An alias is a name given to a computed value.
func Alias ¶
Alias returns an AliasNode type, which allows you to refer to a prior created named alias operation.
func (*AliasNode) Equals ¶
Equals returns true if the given node points to the same alias value as receiver.
func (*AliasNode) GetAlias ¶ added in v0.0.7
func (n *AliasNode) GetAlias() string
GetAlias returns the alias name for the node.
type AliasNodeI ¶
type AliasValue ¶
type AliasValue struct {
// contains filtered or unexported fields
}
An AliasValue is returned by the GetAlias function that is generated for each type. You then convert the alias to a particular type to use it.
func NewAliasValue ¶
func NewAliasValue(a interface{}) AliasValue
NewAliasValue is used by the ORM to wrap an aliased operation or computed value that was returned by a query. You would not normally call this function.
func (AliasValue) DateTime ¶
func (a AliasValue) DateTime() datetime.DateTime
DateTime returns the value as a datetime.DateTime value.
func (AliasValue) IsNil ¶
func (a AliasValue) IsNil() bool
IsNil returns true if the value returned was a NULL value from the database.
func (AliasValue) IsNull ¶
func (a AliasValue) IsNull() bool
IsNull is the same as IsNil, and returns true if the operation return a NULL value from the database.
func (AliasValue) String ¶
func (a AliasValue) String() string
String returns the value as a string. A NULL value will be an empty string.
type ColumnNode ¶
type ColumnNode struct {
// contains filtered or unexported fields
}
A Column represents a table or field in a database structure, and is the leaf of a node tree or chain.
func NewColumnNode ¶
func NewColumnNode(dbKey string, dbTable string, dbName string, goName string, goType GoColumnType, isPK bool) *ColumnNode
NewColumnNode is used by the code generator to create a new column node.
func (*ColumnNode) Ascending ¶
func (n *ColumnNode) Ascending() NodeI
Ascending is used in an OrderBy query builder function to sort the column in ascending order.
func (*ColumnNode) Descending ¶
func (n *ColumnNode) Descending() NodeI
Descending is used in an OrderBy query builder function to sort the column in descending order.
func (*ColumnNode) Equals ¶
func (n *ColumnNode) Equals(n2 NodeI) bool
Equals is used internally by the framework to determine if two nodes are equal.
func (*ColumnNode) GetAlias ¶ added in v0.0.7
func (n *ColumnNode) GetAlias() string
GetAlias returns the alias name for the node.
func (*ColumnNode) GobDecode ¶ added in v0.3.0
func (n *ColumnNode) GobDecode(data []byte) (err error)
func (*ColumnNode) GobEncode ¶ added in v0.3.0
func (n *ColumnNode) GobEncode() (data []byte, err error)
type ColumnNodeI ¶ added in v0.0.7
type ColumnNodeI interface { NodeI NodeSorter Aliaser // contains filtered or unexported methods }
type Expander ¶
type Expander interface { Expand() // contains filtered or unexported methods }
Expander is the interface a node must satisfy to be able to be expanded upon, making a many-* relationship that creates multiple versions of the original object.
type GoColumnType ¶
type GoColumnType int
GoColumnType represents the GO type that corresponds to a database column
const ( ColTypeUnknown GoColumnType = iota ColTypeBytes ColTypeString ColTypeInteger ColTypeUnsigned ColTypeInteger64 ColTypeUnsigned64 ColTypeDateTime ColTypeFloat ColTypeDouble ColTypeBool )
func ColumnNodeGoType ¶
func ColumnNodeGoType(n *ColumnNode) GoColumnType
GoColumnType is used internally by the framework to return the go type corresponding to the given column.
func (GoColumnType) DefaultValue ¶
func (g GoColumnType) DefaultValue() string
DefaultValue returns a string that represents the GO default value for the corresponding type
func (GoColumnType) GoType ¶ added in v0.0.3
func (g GoColumnType) GoType() string
GoType returns the actual GO type as go code
func (GoColumnType) String ¶
func (g GoColumnType) String() string
String returns the constant type name as a string
type ManyManyNode ¶
type ManyManyNode struct {
// contains filtered or unexported fields
}
A ManyManyNode is an association node that links one table to another table with a many-to-many relationship. Some of the columns have overloaded meanings depending on SQL or NoSQL mode.
func NewManyManyNode ¶
func NewManyManyNode( dbKey string, dbTable string, dbColumn string, goName string, refTableName string, refColumn string, isType bool, ) *ManyManyNode
NewManyManyNode is used internally by the framework to return a new ManyMany node.
func (*ManyManyNode) Equals ¶
func (n *ManyManyNode) Equals(n2 NodeI) bool
Equals is used internally by the framework to test if the node is the same as another node.
func (*ManyManyNode) Expand ¶
func (n *ManyManyNode) Expand()
Expand tells this node to create multiple original objects with a single link for each joined item, rather than to create one original with an array of joined items
func (*ManyManyNode) GetAlias ¶ added in v0.0.7
func (n *ManyManyNode) GetAlias() string
GetAlias returns the alias name for the node.
func (*ManyManyNode) GobDecode ¶ added in v0.3.0
func (n *ManyManyNode) GobDecode(data []byte) (err error)
func (*ManyManyNode) GobEncode ¶ added in v0.3.0
func (n *ManyManyNode) GobEncode() (data []byte, err error)
type NodeI ¶
type NodeI interface { // Equals returns true if the given node is equal to this node. Equals(NodeI) bool // contains filtered or unexported methods }
NodeI is the interface that all nodes must satisfy. A node is a representation of an object or a relationship between objects in a database that we use to create a query. It lets us abstract the structure of a database to be able to query any kind of database. Obviously, this doesn't work for all possible database structures, but it generally works well enough to solve most of the situations that you will come across.
func ChildNode ¶ added in v0.0.7
ChildNode is used internally by the framework to get the child node of a node
func ContainedNodes ¶
ContainedNodes is used internally by the framework to return the contained nodes.
func NewValueNode ¶
func NewValueNode(i interface{}) NodeI
NewValueNode returns a new ValueNode that wraps the given value.
func NodeCondition ¶
NodeCondition is used internally by the framework to get a condition node.
func NodePrimaryKey ¶ added in v0.0.7
Return the primary key of a node, if it has a primary key. Otherwise return nil.
func OperationNodeOperands ¶
func OperationNodeOperands(n *OperationNode) []NodeI
OperationNodeOperands is used internally by the framework to get the operands.
func ParentNode ¶
ParentNode is used internally by the framework to return a node's parent.
func RelatedColumnNode ¶
RelatedColumnNode is used internally by the framework to create a new node for the other side of the relationship.
type NodeSorter ¶
type NodeSorter interface { Ascending() NodeI Descending() NodeI // contains filtered or unexported methods }
NodeSorter is the interface a node must satisfy to be able to be used in an OrderBy statement.
type NodeType ¶
type NodeType int
NodeType indicates the type of node, which saves us from having to use reflection to determine this
func NodeGetType ¶ added in v0.0.7
NodeGetType is an internal function used to get the node type without casting. This is particularly useful when dealing with TableNodeI types, because they are embedded in different concrete types by the code generator, so to get the specific node type involves extracting the embedded type and then doing a type select.
type OperationNode ¶
type OperationNode struct {
// contains filtered or unexported fields
}
An OperationNode is a general purpose structure that specifies an operation on a node or group of nodes. The operation could be arithmetic, boolean, or a function.
func NewCountNode ¶
func NewCountNode(operands ...NodeI) *OperationNode
NewCountNode creates a Count function node. If no operands are given, it will use * as the parameter to the function which means it will count nulls. To NOT count nulls, at least one table name needs to be specified.
func NewFunctionNode ¶
func NewFunctionNode(functionName string, operands ...interface{}) *OperationNode
NewFunctionNode returns an operation node that executes a database function.
func NewOperationNode ¶
func NewOperationNode(op Operator, operands ...interface{}) *OperationNode
NewOperationNode returns a new operation.
func (*OperationNode) Distinct ¶
func (n *OperationNode) Distinct() *OperationNode
Distinct sets the operation to return distinct results
func (*OperationNode) Equals ¶
func (n *OperationNode) Equals(n2 NodeI) bool
Equals is used internally by the framework to tell if two nodes are equal
func (*OperationNode) GetAlias ¶ added in v0.0.7
func (n *OperationNode) GetAlias() string
GetAlias returns the alias name for the node.
func (*OperationNode) GobDecode ¶ added in v0.3.0
func (n *OperationNode) GobDecode(data []byte) (err error)
func (*OperationNode) GobEncode ¶ added in v0.3.0
func (n *OperationNode) GobEncode() (data []byte, err error)
type OperationNodeI ¶ added in v0.0.7
type OperationNodeI interface { Aliaser // contains filtered or unexported methods }
type Operator ¶
type Operator string
Operator is used internally by the framework to specify an operation to be performed by the database. Not all databases can perform all the operations. It will be up to the database driver to sort this out.
func OperationNodeOperator ¶
func OperationNodeOperator(n *OperationNode) Operator
OperationNodeOperator is used internally by the framework to get the operator.
type QueryBuilderI ¶
type QueryBuilderI interface { Join(n NodeI, condition NodeI) QueryBuilderI Expand(n NodeI) QueryBuilderI Condition(c NodeI) QueryBuilderI Having(c NodeI) QueryBuilderI OrderBy(nodes ...NodeI) QueryBuilderI GroupBy(nodes ...NodeI) QueryBuilderI Limit(maxRowCount int, offset int) QueryBuilderI Select(nodes ...NodeI) QueryBuilderI Distinct() QueryBuilderI Alias(name string, n NodeI) QueryBuilderI Load(ctx context.Context) []map[string]interface{} Delete(ctx context.Context) Count(ctx context.Context, distinct bool, nodes ...NodeI) uint Subquery() *SubqueryNode }
The query builder is the primary aid in creating cross-platform, portable queries to the database(s) The code-generated ORM classes call these functions to build a query. The query will eventually get sent to the database for processing, and then unpacked into one of the ORM generated objects. You generally will not call these functions directly, but rather will call the matching functions in each of the codegenerated ORM classes located in your project directory.
If you are creating a database driver, you will implement these functions in the query builder that you provide.
func SubqueryBuilder ¶
func SubqueryBuilder(n *SubqueryNode) QueryBuilderI
SubqueryBuilder is used internally by the framework to return the internal query builder of the subquery
type ReferenceNode ¶
type ReferenceNode struct {
// contains filtered or unexported fields
}
A ReferenceNode is a forward-pointing foreign key relationship, and can define a one-to-one or one-to-many relationship, depending on whether it is unique. If the other side of the relationship is not a type table, then the other table will have a matching ReverseReferenceNode.
func NewReferenceNode ¶
func NewReferenceNode( dbKey string, dbTableName string, dbColumnName string, goColumnName string, goName string, refTableName string, refColumn string, isType bool, ) *ReferenceNode
NewReferenceNode creates a forward reference node.
func (*ReferenceNode) Equals ¶
func (n *ReferenceNode) Equals(n2 NodeI) bool
Equals is used internally by the framework to determine if two nodes are equal.
func (*ReferenceNode) Expand ¶ added in v0.0.7
func (n *ReferenceNode) Expand()
func (*ReferenceNode) GetAlias ¶ added in v0.0.7
func (n *ReferenceNode) GetAlias() string
GetAlias returns the alias name for the node.
func (*ReferenceNode) GobDecode ¶ added in v0.3.0
func (n *ReferenceNode) GobDecode(data []byte) (err error)
func (*ReferenceNode) GobEncode ¶ added in v0.3.0
func (n *ReferenceNode) GobEncode() (data []byte, err error)
type ReferenceNodeI ¶ added in v0.0.7
func CopyNode ¶ added in v0.0.7
func CopyNode(n NodeI) ReferenceNodeI
type ReverseReferenceNode ¶
type ReverseReferenceNode struct {
// contains filtered or unexported fields
}
ReverseReferenceNode creates a reverse reference node representing a one to many relationship or one-to-one relationship, depending on whether the foreign key is unique. The other side of the relationship will have a matching forward ReferenceNode.
For SQL databases, a ReverseReferenceNode will not have anything in its table to indicate the relationship. It is a kind of virtual placeholder to indicate that a foreign key in another table is pointing to this table, and therefore that relationship can be used to build a query.
func NewReverseReferenceNode ¶
func (*ReverseReferenceNode) Equals ¶
func (n *ReverseReferenceNode) Equals(n2 NodeI) bool
Equals is used internally by the framework to determine if two nodes are equal.
func (*ReverseReferenceNode) Expand ¶
func (n *ReverseReferenceNode) Expand()
Expand tells the node to expand its results into multiple records, one for each item found in this relationship, rather than have this relationship create an array of items within an individual record. Unique reverse relationships create one-to-one relationships, and so they are always expanded.
func (*ReverseReferenceNode) GetAlias ¶ added in v0.0.7
func (n *ReverseReferenceNode) GetAlias() string
GetAlias returns the alias name for the node.
func (*ReverseReferenceNode) GobDecode ¶ added in v0.3.0
func (n *ReverseReferenceNode) GobDecode(data []byte) (err error)
func (*ReverseReferenceNode) GobEncode ¶ added in v0.3.0
func (n *ReverseReferenceNode) GobEncode() (data []byte, err error)
func (*ReverseReferenceNode) SetAlias ¶ added in v0.0.7
func (n *ReverseReferenceNode) SetAlias(a string)
SetAlias sets an alias which is an alternate name to use for the node in the result of a query. Aliases will generally be assigned during the query build process. You only need to assign a manual alias if
type SubqueryNode ¶
type SubqueryNode struct {
// contains filtered or unexported fields
}
A SubqueryNode represents a "select" subquery. Subqueries are not always portable to other databases, and are not easily checked for syntax errors, since a subquery can return a scalar, vector, or even an entire table. You generally do not create a subquery node directly, but rather you use the codegenerated models to start a query on a table, and then end the query with "Subquery()" which will turn the query into a usable subquery node that you can embed in other queries.
func NewSubqueryNode ¶
func NewSubqueryNode(b QueryBuilderI) *SubqueryNode
NewSubqueryNode creates a new subquery
func (*SubqueryNode) Equals ¶
func (n *SubqueryNode) Equals(n2 NodeI) bool
Equals is used internally by the framework to determine if two nodes are equal
func (*SubqueryNode) GetAlias ¶ added in v0.0.7
func (n *SubqueryNode) GetAlias() string
GetAlias returns the alias name for the node.
func (*SubqueryNode) GobDecode ¶ added in v0.3.0
func (n *SubqueryNode) GobDecode(data []byte) (err error)
func (*SubqueryNode) GobEncode ¶ added in v0.3.0
func (n *SubqueryNode) GobEncode() (data []byte, err error)
type TableNode ¶
type TableNode struct {
// contains filtered or unexported fields
}
A TableNode is a representation of the top level of a chain of nodes that point to a particular field in a query, even after aliases and joins are taken into account. TableNodes are create by the code generation process, one for each table in the database.
func NewTableNode ¶
NewTableNode creates a table node, which is always the starting node in a node chain
func (*TableNode) GetAlias ¶ added in v0.0.7
func (n *TableNode) GetAlias() string
GetAlias returns the alias name for the node.
type TableNodeI ¶
type TableNodeI interface { ReferenceNodeI SelectNodes_() []*ColumnNode PrimaryKeyNode_() *ColumnNode EmbeddedNode_() NodeI Copy_() NodeI }
TableNodeI is the interface that all table nodes must implement. TableNodes are create by the code generation process, one for each table in the database.