コード例 #1
0
func TestColumn(t *testing.T) {
	column := nodes.Column("column")
	expected := `"column"`
	if got, _ := sql.Accept(column); expected != got {
		t.Errorf("TestColumn was expected to return %s, got %s", expected, got)
	}
}
コード例 #2
0
ファイル: insert_manager.go プロジェクト: smillaedler/codex
// Return sets the InsertStatementNodes Return to the `column` paramenter
// after ensureing it is a ColumnNode.
func (self *InsertManager) Returning(column interface{}) *InsertManager {
	if _, ok := column.(*nodes.ColumnNode); !ok {
		column = nodes.Column(column)
	}
	self.Tree.Returning = column
	return self
}
コード例 #3
0
func TestUnaliasedAttribute(t *testing.T) {
	relation := nodes.Relation("table")
	column := nodes.Column("column")
	attribute := nodes.Attribute(column, relation)
	expected := `"table"."column"`
	if got, _ := sql.Accept(attribute); expected != got {
		t.Errorf("TestUnaliasedAttribute was expected to return %s, got %s", expected, got)
	}
}
コード例 #4
0
ファイル: table.go プロジェクト: smillaedler/codex
// Table returns an Accessor
func Table(name string) managers.Accessor {
	relation := nodes.Relation(name)
	return func(name interface{}) *nodes.AttributeNode {
		if _, ok := name.(string); ok {
			return nodes.Attribute(nodes.Column(name), relation)
		}

		return nodes.Attribute(name, relation)
	}
}