jet/timestampz_expression_test.go

55 lines
3.2 KiB
Go
Raw Normal View History

2019-07-31 18:43:54 +02:00
// +build todo
2019-07-19 17:19:58 +02:00
package jet
import "testing"
var timestampz = Timestampz(2000, 1, 31, 10, 20, 0, 0, 2)
func TestTimestampzExpressionEQ(t *testing.T) {
2019-07-31 18:43:54 +02:00
AssertPostgreClauseSerialize(t, table1ColTimestampz.EQ(table2ColTimestampz), "(table1.col_timestampz = table2.col_timestampz)")
AssertPostgreClauseSerialize(t, table1ColTimestampz.EQ(timestampz),
2019-07-19 17:19:58 +02:00
"(table1.col_timestampz = $1::timestamp with time zone)", "2000-01-31 10:20:00.000 +002")
}
func TestTimestampzExpressionNOT_EQ(t *testing.T) {
2019-07-31 18:43:54 +02:00
AssertPostgreClauseSerialize(t, table1ColTimestampz.NOT_EQ(table2ColTimestampz), "(table1.col_timestampz != table2.col_timestampz)")
AssertPostgreClauseSerialize(t, table1ColTimestampz.NOT_EQ(timestampz), "(table1.col_timestampz != $1::timestamp with time zone)", "2000-01-31 10:20:00.000 +002")
2019-07-19 17:19:58 +02:00
}
func TestTimestampzExpressionIS_DISTINCT_FROM(t *testing.T) {
2019-07-31 18:43:54 +02:00
AssertPostgreClauseSerialize(t, table1ColTimestampz.IS_DISTINCT_FROM(table2ColTimestampz), "(table1.col_timestampz IS DISTINCT FROM table2.col_timestampz)")
AssertPostgreClauseSerialize(t, table1ColTimestampz.IS_DISTINCT_FROM(timestampz), "(table1.col_timestampz IS DISTINCT FROM $1::timestamp with time zone)", "2000-01-31 10:20:00.000 +002")
2019-07-19 17:19:58 +02:00
}
func TestTimestampzExpressionIS_NOT_DISTINCT_FROM(t *testing.T) {
2019-07-31 18:43:54 +02:00
AssertPostgreClauseSerialize(t, table1ColTimestampz.IS_NOT_DISTINCT_FROM(table2ColTimestampz), "(table1.col_timestampz IS NOT DISTINCT FROM table2.col_timestampz)")
AssertPostgreClauseSerialize(t, table1ColTimestampz.IS_NOT_DISTINCT_FROM(timestampz), "(table1.col_timestampz IS NOT DISTINCT FROM $1::timestamp with time zone)", "2000-01-31 10:20:00.000 +002")
2019-07-19 17:19:58 +02:00
}
func TestTimestampzExpressionLT(t *testing.T) {
2019-07-31 18:43:54 +02:00
AssertPostgreClauseSerialize(t, table1ColTimestampz.LT(table2ColTimestampz), "(table1.col_timestampz < table2.col_timestampz)")
AssertPostgreClauseSerialize(t, table1ColTimestampz.LT(timestampz), "(table1.col_timestampz < $1::timestamp with time zone)", "2000-01-31 10:20:00.000 +002")
2019-07-19 17:19:58 +02:00
}
func TestTimestampzExpressionLT_EQ(t *testing.T) {
2019-07-31 18:43:54 +02:00
AssertPostgreClauseSerialize(t, table1ColTimestampz.LT_EQ(table2ColTimestampz), "(table1.col_timestampz <= table2.col_timestampz)")
AssertPostgreClauseSerialize(t, table1ColTimestampz.LT_EQ(timestampz), "(table1.col_timestampz <= $1::timestamp with time zone)", "2000-01-31 10:20:00.000 +002")
2019-07-19 17:19:58 +02:00
}
func TestTimestampzExpressionGT(t *testing.T) {
2019-07-31 18:43:54 +02:00
AssertPostgreClauseSerialize(t, table1ColTimestampz.GT(table2ColTimestampz), "(table1.col_timestampz > table2.col_timestampz)")
AssertPostgreClauseSerialize(t, table1ColTimestampz.GT(timestampz), "(table1.col_timestampz > $1::timestamp with time zone)", "2000-01-31 10:20:00.000 +002")
2019-07-19 17:19:58 +02:00
}
func TestTimestampzExpressionGT_EQ(t *testing.T) {
2019-07-31 18:43:54 +02:00
AssertPostgreClauseSerialize(t, table1ColTimestampz.GT_EQ(table2ColTimestampz), "(table1.col_timestampz >= table2.col_timestampz)")
AssertPostgreClauseSerialize(t, table1ColTimestampz.GT_EQ(timestampz), "(table1.col_timestampz >= $1::timestamp with time zone)", "2000-01-31 10:20:00.000 +002")
2019-07-19 17:19:58 +02:00
}
func TestTimestampzExp(t *testing.T) {
2019-07-31 18:43:54 +02:00
AssertPostgreClauseSerialize(t, TimestampzExp(table1ColFloat), "table1.col_float")
AssertPostgreClauseSerialize(t, TimestampzExp(table1ColFloat).LT(timestampz),
2019-07-19 17:19:58 +02:00
"(table1.col_float < $1::timestamp with time zone)", "2000-01-31 10:20:00.000 +002")
}