2019-03-02 12:34:08 +01:00
|
|
|
package sqlbuilder
|
|
|
|
|
|
2019-06-08 16:34:15 +02:00
|
|
|
import "testing"
|
2019-03-02 12:34:08 +01:00
|
|
|
|
2019-06-08 16:34:15 +02:00
|
|
|
func TestColumn(t *testing.T) {
|
|
|
|
|
column := newColumn("col", "", nil)
|
|
|
|
|
column.expressionInterfaceImpl.parent = &column
|
2019-03-02 12:34:08 +01:00
|
|
|
|
2019-06-08 16:34:15 +02:00
|
|
|
assertClauseSerialize(t, column, "col")
|
|
|
|
|
column.setTableName("table1")
|
|
|
|
|
assertClauseSerialize(t, column, "table1.col")
|
|
|
|
|
assertProjectionSerialize(t, column.defaultAliasProjection(), `table1.col AS "table1.col"`)
|
|
|
|
|
assertProjectionSerialize(t, column.AS("alias1"), `table1.col AS "alias1"`)
|
2019-03-02 12:34:08 +01:00
|
|
|
}
|