diff --git a/alias.go b/alias.go index 8f156fd..38d7470 100644 --- a/alias.go +++ b/alias.go @@ -27,7 +27,7 @@ func (a *alias) serializeForProjection(statement statementType, out *queryData) return err } - out.writeString("AS ") + out.writeString("AS") out.writeQuotedString(a.alias) return nil diff --git a/cast.go b/cast.go index 146d264..e950403 100644 --- a/cast.go +++ b/cast.go @@ -1,154 +1,131 @@ package jet -type cast struct { +import "fmt" + +type cast interface { + // Cast expression AS bool type + AS_BOOL() BoolExpression + // Cast expression AS smallint type + AS_SMALLINT() IntegerExpression + // Cast expression AS integer type + AS_INTEGER() IntegerExpression + // Cast expression AS bigint type + AS_BIGINT() IntegerExpression + // Cast expression AS numeric type, using precision and optionally scale + AS_NUMERIC(precision int, scale ...int) FloatExpression + // Cast expression AS real type + AS_REAL() FloatExpression + // Cast expression AS double precision type + AS_DOUBLE() FloatExpression + // Cast expression AS text type + AS_TEXT() StringExpression + // Cast expression AS date type + AS_DATE() DateExpression + // Cast expression AS time type + AS_TIME() TimeExpression + // Cast expression AS time with time timezone type + AS_TIMEZ() TimezExpression + // Cast expression AS timestamp type + AS_TIMESTAMP() TimestampExpression + // Cast expression AS timestamp with timezone type + AS_TIMESTAMPZ() TimestampzExpression +} + +type castImpl struct { Expression castType string } -func newCast(expression Expression, castType string) *cast { - return &cast{ +func CAST(expression Expression) cast { + return &castImpl{ Expression: expression, - castType: castType, } } -func (b *cast) serialize(statement statementType, out *queryData, options ...serializeOption) error { +func (b *castImpl) serialize(statement statementType, out *queryData, options ...serializeOption) error { err := b.Expression.serialize(statement, out, options...) out.writeString("::" + b.castType) return err } -type boolCast struct { - expressionInterfaceImpl - boolInterfaceImpl - cast +func (b *castImpl) AS_BOOL() BoolExpression { + b.castType = "boolean" + return BoolExp(b) } -func newBoolCast(expression Expression) BoolExpression { - boolCast := &boolCast{cast: *newCast(expression, "boolean")} - - boolCast.boolInterfaceImpl.parent = boolCast - boolCast.expressionInterfaceImpl.parent = boolCast - - return boolCast +func (b *castImpl) AS_SMALLINT() IntegerExpression { + b.castType = "smallint" + return IntExp(b) } -type integerCast struct { - expressionInterfaceImpl - integerInterfaceImpl - cast +// Cast expression AS integer type +func (b *castImpl) AS_INTEGER() IntegerExpression { + b.castType = "integer" + return IntExp(b) } -func newIntegerCast(expression Expression, intType string) IntegerExpression { - integerCast := &integerCast{cast: *newCast(expression, intType)} - - integerCast.integerInterfaceImpl.parent = integerCast - integerCast.expressionInterfaceImpl.parent = integerCast - - return integerCast +// Cast expression AS bigint type +func (b *castImpl) AS_BIGINT() IntegerExpression { + b.castType = "bigint" + return IntExp(b) } -type floatCast struct { - expressionInterfaceImpl - floatInterfaceImpl - cast +// Cast expression AS numeric type, using precision and optionally scale +func (b *castImpl) AS_NUMERIC(precision int, scale ...int) FloatExpression { + + if len(scale) > 0 { + b.castType = fmt.Sprintf("numeric(%d, %d)", precision, scale[0]) + } else { + b.castType = fmt.Sprintf("numeric(%d)", precision) + } + + return FloatExp(b) } -func newFloatCast(expression Expression, floatType string) FloatExpression { - floatCast := &floatCast{cast: *newCast(expression, floatType)} - - floatCast.floatInterfaceImpl.parent = floatCast - floatCast.expressionInterfaceImpl.parent = floatCast - - return floatCast +// Cast expression AS real type +func (b *castImpl) AS_REAL() FloatExpression { + b.castType = "real" + return FloatExp(b) } -type textCast struct { - expressionInterfaceImpl - stringInterfaceImpl - cast +// Cast expression AS double precision type +func (b *castImpl) AS_DOUBLE() FloatExpression { + b.castType = "double precision" + return FloatExp(b) } -func newTextCast(expression Expression) StringExpression { - textCast := &textCast{cast: *newCast(expression, "text")} - - textCast.stringInterfaceImpl.parent = textCast - textCast.expressionInterfaceImpl.parent = textCast - - return textCast +// Cast expression AS text type +func (b *castImpl) AS_TEXT() StringExpression { + b.castType = "text" + return StringExp(b) } -type dateCast struct { - expressionInterfaceImpl - dateInterfaceImpl - cast +// Cast expression AS date type +func (b *castImpl) AS_DATE() DateExpression { + b.castType = "date" + return DateExp(b) } -func newDateCast(expression Expression) DateExpression { - dateCast := &dateCast{cast: *newCast(expression, "date")} - - dateCast.dateInterfaceImpl.parent = dateCast - dateCast.expressionInterfaceImpl.parent = dateCast - - return dateCast +// Cast expression AS time type +func (b *castImpl) AS_TIME() TimeExpression { + b.castType = "time without time zone" + return TimeExp(b) } -type timeCast struct { - expressionInterfaceImpl - timeInterfaceImpl - cast +// Cast expression AS time with time timezone type +func (b *castImpl) AS_TIMEZ() TimezExpression { + b.castType = "time with time zone" + return TimezExp(b) } -func newTimeCast(expression Expression) TimeExpression { - timeCast := &timeCast{cast: *newCast(expression, "time without time zone")} - - timeCast.timeInterfaceImpl.parent = timeCast - timeCast.expressionInterfaceImpl.parent = timeCast - - return timeCast +// Cast expression AS timestamp type +func (b *castImpl) AS_TIMESTAMP() TimestampExpression { + b.castType = "timestamp without time zone" + return TimestampExp(b) } -type timezCast struct { - expressionInterfaceImpl - timezInterfaceImpl - cast -} - -func newTimezCast(expression Expression) TimezExpression { - timezCast := &timezCast{cast: *newCast(expression, "time with time zone")} - - timezCast.timezInterfaceImpl.parent = timezCast - timezCast.expressionInterfaceImpl.parent = timezCast - - return timezCast -} - -type timestampCast struct { - expressionInterfaceImpl - timestampInterfaceImpl - cast -} - -func newTimestampCast(expression Expression) TimestampExpression { - timestampCast := ×tampCast{cast: *newCast(expression, "timestamp without time zone")} - - timestampCast.timestampInterfaceImpl.parent = timestampCast - timestampCast.expressionInterfaceImpl.parent = timestampCast - - return timestampCast -} - -type timestampzCast struct { - expressionInterfaceImpl - timestampzInterfaceImpl - cast -} - -func newTimestampzCast(expression Expression) TimestampzExpression { - timestampzCast := ×tampzCast{cast: *newCast(expression, "timestamp with time zone")} - - timestampzCast.timestampzInterfaceImpl.parent = timestampzCast - timestampzCast.expressionInterfaceImpl.parent = timestampzCast - - return timestampzCast +// Cast expression AS timestamp with timezone type +func (b *castImpl) AS_TIMESTAMPZ() TimestampzExpression { + b.castType = "timestamp with time zone" + return TimestampzExp(b) } diff --git a/cast_test.go b/cast_test.go new file mode 100644 index 0000000..20f5170 --- /dev/null +++ b/cast_test.go @@ -0,0 +1,58 @@ +package jet + +import "testing" + +func TestExpressionCAST_AS_BOOL(t *testing.T) { + assertClauseSerialize(t, CAST(Int(1)).AS_BOOL(), "$1::boolean", int64(1)) + assertClauseSerialize(t, CAST(table2Col3).AS_BOOL(), "table2.col3::boolean") + assertClauseSerialize(t, CAST(table2Col3.ADD(table2Col3)).AS_BOOL(), "(table2.col3 + table2.col3)::boolean") +} + +func TestExpressionCAST_AS_SMALLINT(t *testing.T) { + assertClauseSerialize(t, CAST(table2Col3).AS_SMALLINT(), "table2.col3::smallint") +} + +func TestExpressionCAST_AS_INTEGER(t *testing.T) { + assertClauseSerialize(t, CAST(table2Col3).AS_INTEGER(), "table2.col3::integer") +} + +func TestExpressionCAST_AS_BIGINT(t *testing.T) { + assertClauseSerialize(t, CAST(table2Col3).AS_BIGINT(), "table2.col3::bigint") +} + +func TestExpressionCAST_AS_NUMERIC(t *testing.T) { + assertClauseSerialize(t, CAST(table2Col3).AS_NUMERIC(11, 11), "table2.col3::numeric(11, 11)") + assertClauseSerialize(t, CAST(table2Col3).AS_NUMERIC(11), "table2.col3::numeric(11)") +} + +func TestExpressionCAST_AS_REAL(t *testing.T) { + assertClauseSerialize(t, CAST(table2Col3).AS_REAL(), "table2.col3::real") +} + +func TestExpressionCAST_AS_DOUBLE(t *testing.T) { + assertClauseSerialize(t, CAST(table2Col3).AS_DOUBLE(), "table2.col3::double precision") +} + +func TestExpressionCAST_AS_TEXT(t *testing.T) { + assertClauseSerialize(t, CAST(table2Col3).AS_TEXT(), "table2.col3::text") +} + +func TestExpressionCAST_AS_DATE(t *testing.T) { + assertClauseSerialize(t, CAST(table2Col3).AS_DATE(), "table2.col3::date") +} + +func TestExpressionCAST_AS_TIME(t *testing.T) { + assertClauseSerialize(t, CAST(table2Col3).AS_TIME(), "table2.col3::time without time zone") +} + +func TestExpressionCAST_AS_TIMEZ(t *testing.T) { + assertClauseSerialize(t, CAST(table2Col3).AS_TIMEZ(), "table2.col3::time with time zone") +} + +func TestExpressionCAST_AS_TIMESTAMP(t *testing.T) { + assertClauseSerialize(t, CAST(table2Col3).AS_TIMESTAMP(), "table2.col3::timestamp without time zone") +} + +func TestExpressionCAST_AS_TIMESTAMPZ(t *testing.T) { + assertClauseSerialize(t, CAST(table2Col3).AS_TIMESTAMPZ(), "table2.col3::timestamp with time zone") +} diff --git a/expression.go b/expression.go index 7cae5c9..7872e02 100644 --- a/expression.go +++ b/expression.go @@ -2,7 +2,6 @@ package jet import ( "errors" - "fmt" ) // Common expression interface @@ -29,35 +28,6 @@ type Expression interface { ASC() OrderByClause // Expression will be used to sort query result in ascending order DESC() OrderByClause - - // Cast expression to dbType - TO(dbType string) Expression - // Cast expression to bool type - TO_BOOL() BoolExpression - // Cast expression to smallint type - TO_SMALLINT() IntegerExpression - // Cast expression to integer type - TO_INTEGER() IntegerExpression - // Cast expression to bigint type - TO_BIGINT() IntegerExpression - // Cast expression to numeric type, using precision and optionally scale - TO_NUMERIC(precision int, scale ...int) FloatExpression - // Cast expression to real type - TO_REAL() FloatExpression - // Cast expression to double precision type - TO_DOUBLE() FloatExpression - // Cast expression to text type - TO_TEXT() StringExpression - // Cast expression to date type - TO_DATE() DateExpression - // Cast expression to time type - TO_TIME() TimeExpression - // Cast expression to time with time timezone type - TO_TIMEZ() TimezExpression - // Cast expression to timestamp type - TO_TIMESTAMP() TimestampExpression - // Cast expression to timestamp with timezone type - TO_TIMESTAMPZ() TimestampzExpression } type expressionInterfaceImpl struct { @@ -96,68 +66,6 @@ func (e *expressionInterfaceImpl) DESC() OrderByClause { return newOrderByClause(e.parent, false) } -func (e *expressionInterfaceImpl) TO(dbType string) Expression { - return newCast(e.parent, dbType) -} - -func (e *expressionInterfaceImpl) TO_BOOL() BoolExpression { - return newBoolCast(e.parent) -} - -func (e *expressionInterfaceImpl) TO_SMALLINT() IntegerExpression { - return newIntegerCast(e.parent, "smallint") -} - -func (e *expressionInterfaceImpl) TO_INTEGER() IntegerExpression { - return newIntegerCast(e.parent, "integer") -} - -func (e *expressionInterfaceImpl) TO_BIGINT() IntegerExpression { - return newIntegerCast(e.parent, "bigint") -} - -func (e *expressionInterfaceImpl) TO_NUMERIC(precision int, scale ...int) FloatExpression { - var castType string - if len(scale) > 0 { - castType = fmt.Sprintf("numeric(%d, %d)", precision, scale[0]) - } else { - castType = fmt.Sprintf("numeric(%d)", precision) - } - return newFloatCast(e.parent, castType) -} - -func (e *expressionInterfaceImpl) TO_REAL() FloatExpression { - return newFloatCast(e.parent, "real") -} - -func (e *expressionInterfaceImpl) TO_DOUBLE() FloatExpression { - return newFloatCast(e.parent, "double precision") -} - -func (e *expressionInterfaceImpl) TO_TEXT() StringExpression { - return newTextCast(e.parent) -} - -func (e *expressionInterfaceImpl) TO_DATE() DateExpression { - return newDateCast(e.parent) -} - -func (e *expressionInterfaceImpl) TO_TIME() TimeExpression { - return newTimeCast(e.parent) -} - -func (e *expressionInterfaceImpl) TO_TIMEZ() TimezExpression { - return newTimezCast(e.parent) -} - -func (e *expressionInterfaceImpl) TO_TIMESTAMP() TimestampExpression { - return newTimestampCast(e.parent) -} - -func (e *expressionInterfaceImpl) TO_TIMESTAMPZ() TimestampzExpression { - return newTimestampzCast(e.parent) -} - func (e *expressionInterfaceImpl) serializeForGroupBy(statement statementType, out *queryData) error { return e.parent.serialize(statement, out, noWrap) } diff --git a/expression_test.go b/expression_test.go index 45e60a7..9e24bf1 100644 --- a/expression_test.go +++ b/expression_test.go @@ -25,60 +25,6 @@ func TestExpressionIS_NOT_DISTINCT_FROM(t *testing.T) { assertClauseSerialize(t, table2Col3.ADD(table2Col3).IS_NOT_DISTINCT_FROM(Int(23)), "((table2.col3 + table2.col3) IS NOT DISTINCT FROM $1)", int64(23)) } -func TestExpressionCAST_TO_BOOL(t *testing.T) { - assertClauseSerialize(t, table2Col3.TO_BOOL(), "table2.col3::boolean") - assertClauseSerialize(t, table2Col3.ADD(table2Col3).TO_BOOL(), "(table2.col3 + table2.col3)::boolean") -} - -func TestExpressionCAST_TO_SMALLINT(t *testing.T) { - assertClauseSerialize(t, table2Col3.TO_SMALLINT(), "table2.col3::smallint") -} - -func TestExpressionCAST_TO_INTEGER(t *testing.T) { - assertClauseSerialize(t, table2Col3.TO_INTEGER(), "table2.col3::integer") -} - -func TestExpressionCAST_TO_BIGINT(t *testing.T) { - assertClauseSerialize(t, table2Col3.TO_BIGINT(), "table2.col3::bigint") -} - -func TestExpressionCAST_TO_NUMERIC(t *testing.T) { - assertClauseSerialize(t, table2Col3.TO_NUMERIC(11, 11), "table2.col3::numeric(11, 11)") - assertClauseSerialize(t, table2Col3.TO_NUMERIC(11), "table2.col3::numeric(11)") -} - -func TestExpressionCAST_TO_REAL(t *testing.T) { - assertClauseSerialize(t, table2Col3.TO_REAL(), "table2.col3::real") -} - -func TestExpressionCAST_TO_DOUBLE(t *testing.T) { - assertClauseSerialize(t, table2Col3.TO_DOUBLE(), "table2.col3::double precision") -} - -func TestExpressionCAST_TO_TEXT(t *testing.T) { - assertClauseSerialize(t, table2Col3.TO_TEXT(), "table2.col3::text") -} - -func TestExpressionCAST_TO_DATE(t *testing.T) { - assertClauseSerialize(t, table2Col3.TO_DATE(), "table2.col3::date") -} - -func TestExpressionCAST_TO_TIME(t *testing.T) { - assertClauseSerialize(t, table2Col3.TO_TIME(), "table2.col3::time without time zone") -} - -func TestExpressionCAST_TO_TIMEZ(t *testing.T) { - assertClauseSerialize(t, table2Col3.TO_TIMEZ(), "table2.col3::time with time zone") -} - -func TestExpressionCAST_TO_TIMESTAMP(t *testing.T) { - assertClauseSerialize(t, table2Col3.TO_TIMESTAMP(), "table2.col3::timestamp without time zone") -} - -func TestExpressionCAST_TO_TIMESTAMPZ(t *testing.T) { - assertClauseSerialize(t, table2Col3.TO_TIMESTAMPZ(), "table2.col3::timestamp with time zone") -} - func TestIN(t *testing.T) { assertClauseSerialize(t, Float(1.11).IN(table1.SELECT(table1Col1)), diff --git a/literal_expression.go b/literal_expression.go index b098d1d..521ce44 100644 --- a/literal_expression.go +++ b/literal_expression.go @@ -101,13 +101,13 @@ type timeLiteral struct { } func Time(hour, minute, second, milliseconds int) TimeExpression { - timeLiteral := timeLiteral{} + timeLiteral := &timeLiteral{} timeStr := fmt.Sprintf("%02d:%02d:%02d.%03d", hour, minute, second, milliseconds) timeLiteral.literalExpression = *literal(timeStr) - timeLiteral.timeInterfaceImpl.parent = &timeLiteral + timeLiteral.timeInterfaceImpl.parent = timeLiteral - return timeLiteral.TO_TIME() + return CAST(timeLiteral).AS_TIME() } //---------------------------------------------------// @@ -117,13 +117,13 @@ type timezLiteral struct { } func Timez(hour, minute, second, milliseconds, timezone int) TimezExpression { - timezLiteral := timezLiteral{} + timezLiteral := &timezLiteral{} timeStr := fmt.Sprintf("%02d:%02d:%02d.%03d %+03d", hour, minute, second, milliseconds, timezone) timezLiteral.literalExpression = *literal(timeStr) - timezLiteral.timezInterfaceImpl.parent = &timezLiteral + timezLiteral.timezInterfaceImpl.parent = timezLiteral - return timezLiteral.TO_TIMEZ() + return CAST(timezLiteral).AS_TIMEZ() } //---------------------------------------------------// @@ -133,13 +133,13 @@ type timestampLiteral struct { } func Timestamp(year, month, day, hour, minute, second, milliseconds int) TimestampExpression { - timestampLiteral := timestampLiteral{} + timestampLiteral := ×tampLiteral{} timeStr := fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d.%03d", year, month, day, hour, minute, second, milliseconds) timestampLiteral.literalExpression = *literal(timeStr) - timestampLiteral.timestampInterfaceImpl.parent = ×tampLiteral + timestampLiteral.timestampInterfaceImpl.parent = timestampLiteral - return timestampLiteral.TO_TIMESTAMP() + return CAST(timestampLiteral).AS_TIMESTAMP() } //---------------------------------------------------// @@ -149,15 +149,15 @@ type timestampzLiteral struct { } func Timestampz(year, month, day, hour, minute, second, milliseconds, timezone int) TimestampzExpression { - timestampzLiteral := timestampzLiteral{} + timestampzLiteral := ×tampzLiteral{} timeStr := fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d.%03d %+04d", year, month, day, hour, minute, second, milliseconds, timezone) timestampzLiteral.literalExpression = *literal(timeStr) - timestampzLiteral.timestampzInterfaceImpl.parent = ×tampzLiteral + timestampzLiteral.timestampzInterfaceImpl.parent = timestampzLiteral - return timestampzLiteral.TO_TIMESTAMPZ() + return CAST(timestampzLiteral).AS_TIMESTAMPZ() } //---------------------------------------------------// @@ -167,13 +167,13 @@ type dateLiteral struct { } func Date(year, month, day int) DateExpression { - dateLiteral := dateLiteral{} + dateLiteral := &dateLiteral{} timeStr := fmt.Sprintf("%04d-%02d-%02d", year, month, day) dateLiteral.literalExpression = *literal(timeStr) - dateLiteral.dateInterfaceImpl.parent = &dateLiteral + dateLiteral.dateInterfaceImpl.parent = dateLiteral - return dateLiteral.TO_DATE() + return CAST(dateLiteral).AS_DATE() } //--------------------------------------------------// diff --git a/tests/all_types_test.go b/tests/all_types_test.go index 42f2141..7a545d3 100644 --- a/tests/all_types_test.go +++ b/tests/all_types_test.go @@ -66,20 +66,20 @@ func TestExpressionOperators(t *testing.T) { AllTypes.SmallintPtr.NOT_IN(Int(11), Int(22), NULL), AllTypes.SmallintPtr.NOT_IN(AllTypes.SELECT(AllTypes.IntegerPtr)), - String("TRUE").TO_BOOL(), - String("111").TO_SMALLINT(), - String("111").TO_INTEGER(), - String("111").TO_BIGINT(), - String("11.23").TO_NUMERIC(30, 10), - String("11.23").TO_NUMERIC(30), - String("11.23").TO_REAL(), - String("11.23").TO_DOUBLE(), - Int(234).TO_TEXT(), - String("1/8/1999").TO_DATE(), - String("04:05:06.789").TO_TIME(), - String("04:05:06 PST").TO_TIMEZ(), - String("1999-01-08 04:05:06").TO_TIMESTAMP(), - String("January 8 04:05:06 1999 PST").TO_TIMESTAMPZ(), + CAST(String("TRUE")).AS_BOOL(), + CAST(String("111")).AS_SMALLINT(), + CAST(String("111")).AS_INTEGER(), + CAST(String("111")).AS_BIGINT(), + CAST(String("11.23")).AS_NUMERIC(30, 10), + CAST(String("11.23")).AS_NUMERIC(30), + CAST(String("11.23")).AS_REAL(), + CAST(String("11.23")).AS_DOUBLE(), + CAST(Int(234)).AS_TEXT(), + CAST(String("1/8/1999")).AS_DATE(), + CAST(String("04:05:06.789")).AS_TIME(), + CAST(String("04:05:06 PST")).AS_TIMEZ(), + CAST(String("1999-01-08 04:05:06")).AS_TIMESTAMP(), + CAST(String("January 8 04:05:06 1999 PST")).AS_TIMESTAMPZ(), TO_CHAR(AllTypes.Timestamp, String("HH12:MI:SS")), TO_CHAR(AllTypes.Integer, String("999")), diff --git a/tests/select_test.go b/tests/select_test.go index ce8a066..5d2148f 100644 --- a/tests/select_test.go +++ b/tests/select_test.go @@ -865,7 +865,10 @@ WHERE film.rental_rate = ( ORDER BY film.film_id ASC; ` - maxFilmRentalRate := Film.SELECT(MAXf(Film.RentalRate)).TO_DOUBLE() + maxFilmRentalRate := CAST( + Film. + SELECT(MAXf(Film.RentalRate)), + ).AS_DOUBLE() query := Film. SELECT(Film.AllColumns). diff --git a/timestampz_expression.go b/timestampz_expression.go index cb5c118..df9457b 100644 --- a/timestampz_expression.go +++ b/timestampz_expression.go @@ -63,6 +63,6 @@ func newTimestampzExpressionWrap(expression Expression) TimestampzExpression { return ×tampzExpressionWrap } -func TimestampzExp(expression Expression) TimestampExpression { - return newTimestampExpressionWrap(expression) +func TimestampzExp(expression Expression) TimestampzExpression { + return newTimestampzExpressionWrap(expression) } diff --git a/timez_expression.go b/timez_expression.go index 91c9927..1ef0eda 100644 --- a/timez_expression.go +++ b/timez_expression.go @@ -81,6 +81,6 @@ func newTimezExpressionWrap(expression Expression) TimezExpression { return &timezExpressionWrap } -func TimezExp(expression Expression) TimeExpression { - return newTimeExpressionWrap(expression) +func TimezExp(expression Expression) TimezExpression { + return newTimezExpressionWrap(expression) } diff --git a/update_statement.go b/update_statement.go index c804901..b93b25b 100644 --- a/update_statement.go +++ b/update_statement.go @@ -122,19 +122,6 @@ func (u *updateStatementImpl) Sql() (sql string, args []interface{}, err error) return } - //if len(u.returning) > 0 { - // out.newLine() - // out.writeString("RETURNING") - // out.increaseIdent() - // out.increaseIdent() - // - // err = serializeProjectionList(update_statement, u.returning, out) - // - // if err != nil { - // return - // } - //} - sql, args = out.finalize() return }