Strictly type Integer and Real expressions.

This commit is contained in:
zer0sub 2019-05-31 12:59:57 +02:00
parent 7f5ba98819
commit 2b6288d317
32 changed files with 640 additions and 547 deletions

View file

@ -11,8 +11,8 @@ import (
//
func TestUpdate(t *testing.T) {
stmt := table1.UPDATE(table1Col1, table1Col2).
SET(table1.SELECT(table1Col2, table2Col3)).
stmt := table1.UPDATE(table1Col1, table1ColFloat).
SET(table1.SELECT(table1ColFloat, table2Col3)).
WHERE(table1Col1.EQ(Int(2))).
RETURNING(table1Col1)
@ -23,8 +23,8 @@ func TestUpdate(t *testing.T) {
fmt.Println(stmtStr)
assert.Equal(t, stmtStr, `
UPDATE db.table1 SET (col1,col2) = (
SELECT table1.col2 AS "table1.col2",
UPDATE db.table1 SET (col1,colFloat) = (
SELECT table1.colFloat AS "table1.colFloat",
table2.col3 AS "table2.col3"
FROM db.table1
)
@ -53,7 +53,7 @@ RETURNING table1.col1 AS "table1.col1";
//
//func (s *StmtSuite) TestUpdateSingleValue(c *gc.C) {
// stmt := table1.UPDATE().SET(table1Col1, Literal(1))
// stmt.WHERE(EqString(table1Col2, 2))
// stmt.WHERE(EqString(table1ColFloat, 2))
// sql, err := stmt.String()
// c.Assert(err, gc.IsNil)
//
@ -65,7 +65,7 @@ RETURNING table1.col1 AS "table1.col1";
//
//func (s *StmtSuite) TestUpdateUsingDeferredLookupColumns(c *gc.C) {
// stmt := table1.UPDATE().SET(table1.C("col1"), Literal(1))
// stmt.WHERE(EqString(table1Col2, 2))
// stmt.WHERE(EqString(table1ColFloat, 2))
// sql, err := stmt.String()
// c.Assert(err, gc.IsNil)
//
@ -78,8 +78,8 @@ RETURNING table1.col1 AS "table1.col1";
//func (s *StmtSuite) TestUpdateMultiValues(c *gc.C) {
// stmt := table1.UPDATE()
// stmt.SET(table1Col1, Literal(1))
// stmt.SET(table1Col2, Literal(2))
// stmt.WHERE(EqString(table1Col2, 3))
// stmt.SET(table1ColFloat, Literal(2))
// stmt.WHERE(EqString(table1ColFloat, 3))
// sql, err := stmt.String()
// c.Assert(err, gc.IsNil)
//
@ -93,8 +93,8 @@ RETURNING table1.col1 AS "table1.col1";
//
//func (s *StmtSuite) TestUpdateWithOrderBy(c *gc.C) {
// stmt := table1.UPDATE().SET(table1Col1, Literal(1))
// stmt.WHERE(EqString(table1Col2, 2))
// stmt.ORDER_BY(table1Col2)
// stmt.WHERE(EqString(table1ColFloat, 2))
// stmt.ORDER_BY(table1ColFloat)
// sql, err := stmt.String()
// c.Assert(err, gc.IsNil)
//
@ -109,7 +109,7 @@ RETURNING table1.col1 AS "table1.col1";
//
//func (s *StmtSuite) TestUpdateWithLimit(c *gc.C) {
// stmt := table1.UPDATE().SET(table1Col1, Literal(1))
// stmt.WHERE(EqString(table1Col2, 2))
// stmt.WHERE(EqString(table1ColFloat, 2))
// stmt.LIMIT(5)
// sql, err := stmt.String()
// c.Assert(err, gc.IsNil)