query

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2019 License: MIT Imports: 10 Imported by: 0

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

View Source
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"
)
View Source
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 LogNode

func LogNode(n NodeI, level int)

LogNode is used internally by the framework to debug node issues.

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 NodeDbKey added in v0.3.1

func NodeDbKey(n NodeI) string

func NodeGoName

func NodeGoName(n NodeI) string

NodeGoName is used internally by the framework to return the go name of the item the node refers to.

func NodeIsConditioner

func NodeIsConditioner(n NodeI) bool

NodeIsConditioner is used internally by the framework to determine if the node has a join condition.

func NodeIsExpanded

func NodeIsExpanded(n NodeI) bool

NodeIsExpanded is used internally by the framework to detect if the node is an expanded many-many relationship.

func NodeIsExpander

func NodeIsExpander(n NodeI) bool

NodeIsExpander is used internally by the framework to detect if the node can be an expanded many-many relationship.

func NodeIsPK added in v0.0.7

func NodeIsPK(n NodeI) bool

func NodeIsReferenceI added in v0.0.7

func NodeIsReferenceI(n NodeI) bool

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

func NodeIsTableNodeI(n NodeI) bool

Convenience method to see if a node is a table type of node, or a leaf node

func NodeSetCondition

func NodeSetCondition(n NodeI, condition NodeI)

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

func NodeTableName(n NodeI) string

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

func SetParentNode(child NodeI, parent NodeI)

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

func Alias(goName string) *AliasNode

Alias returns an AliasNode type, which allows you to refer to a prior created named alias operation.

func (*AliasNode) Equals

func (n *AliasNode) Equals(n2 NodeI) bool

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.

func (*AliasNode) GobDecode added in v0.3.0

func (n *AliasNode) GobDecode(data []byte) (err error)

func (*AliasNode) GobEncode added in v0.3.0

func (n *AliasNode) GobEncode() (data []byte, err error)

func (*AliasNode) SetAlias added in v0.0.7

func (n *AliasNode) 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 AliasNodeI

type AliasNodeI interface {
	NodeI
	Aliaser
}

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) Bool

func (a AliasValue) Bool() bool

Bool returns the value as a bool.

func (AliasValue) DateTime

func (a AliasValue) DateTime() datetime.DateTime

DateTime returns the value as a datetime.DateTime value.

func (AliasValue) Float

func (a AliasValue) Float() float64

Float returns the value as a float64

func (AliasValue) Int

func (a AliasValue) Int() int

Int returns the value as an integer.

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 Aliaser added in v0.0.7

type Aliaser interface {
	// SetAlias sets a unique name for the node as used in a database query.
	SetAlias(string)
	// GetAlias returns the alias that was used in a database query.
	GetAlias() 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)

func (*ColumnNode) SetAlias added in v0.0.7

func (n *ColumnNode) 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 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)

func (*ManyManyNode) SetAlias added in v0.0.7

func (n *ManyManyNode) 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 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

func ChildNode(n NodeI) NodeI

ChildNode is used internally by the framework to get the child node of a node

func ContainedNodes

func ContainedNodes(n NodeI) (nodes []NodeI)

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

func NodeCondition(n NodeI) NodeI

NodeCondition is used internally by the framework to get a condition node.

func NodePrimaryKey added in v0.0.7

func NodePrimaryKey(n NodeI) NodeI

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

func ParentNode(n NodeI) NodeI

ParentNode is used internally by the framework to return a node's parent.

func RelatedColumnNode

func RelatedColumnNode(n NodeI) NodeI

RelatedColumnNode is used internally by the framework to create a new node for the other side of the relationship.

func RootNode

func RootNode(n NodeI) NodeI

RootNode is used internally by the framework to get the root node, which is the top parent in the node tree.

func Value

func Value(i interface{}) NodeI

Shortcut for converting a constant value to a node

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

const (
	UnknownNodeType NodeType = iota
	TableNodeType
	ColumnNodeType
	ReferenceNodeType // forward reference from a foreign key
	ManyManyNodeType
	ReverseReferenceNodeType
	ValueNodeType
	OperationNodeType
	AliasNodeType
	SubqueryNodeType
)

func NodeGetType added in v0.0.7

func NodeGetType(n NodeI) NodeType

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)

func (*OperationNode) SetAlias added in v0.0.7

func (n *OperationNode) 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 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.

func (Operator) String

func (o Operator) String() string

String returns a string representation of the Operator type. For convenience, this also corresponds to the SQL representation of an 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)

func (*ReferenceNode) SetAlias added in v0.0.7

func (n *ReferenceNode) 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 ReferenceNodeI added in v0.0.7

type ReferenceNodeI interface {
	NodeI
	Aliaser

	Expander
	// contains filtered or unexported methods
}

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 NewReverseReferenceNode(
	dbKey string,

	dbTable string,

	dbColumn string,

	goName string,

	refTable string,

	refColumn string,
	isArray bool,
) *ReverseReferenceNode

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)

func (*SubqueryNode) SetAlias added in v0.0.7

func (n *SubqueryNode) 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 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

func NewTableNode(dbKey string, dbName string, goName string) *TableNode

NewTableNode creates a table node, which is always the starting node in a node chain

func (*TableNode) Equals

func (n *TableNode) Equals(n2 NodeI) bool

func (*TableNode) Expand added in v0.0.7

func (n *TableNode) Expand()

func (*TableNode) GetAlias added in v0.0.7

func (n *TableNode) GetAlias() string

GetAlias returns the alias name for the node.

func (*TableNode) GobDecode added in v0.3.0

func (n *TableNode) GobDecode(data []byte) (err error)

func (*TableNode) GobEncode added in v0.3.0

func (n *TableNode) GobEncode() (data []byte, err error)

func (*TableNode) SetAlias added in v0.0.7

func (n *TableNode) 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 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.

type ValueNode

type ValueNode struct {
	// contains filtered or unexported fields
}

ValueNode represents a value for a built-in type that is to be used in a query.

func (*ValueNode) Equals

func (n *ValueNode) Equals(n2 NodeI) bool

func (*ValueNode) GobDecode added in v0.3.0

func (n *ValueNode) GobDecode(data []byte) (err error)

func (*ValueNode) GobEncode added in v0.3.0

func (n *ValueNode) GobEncode() (data []byte, err error)

Jump to

Keyboard shortcuts

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