예제 #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
// 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)
	}
}