Additional MySQL WITH statement tests.
This commit is contained in:
parent
e54e8fcabf
commit
d19fdea86d
5 changed files with 103 additions and 8 deletions
|
|
@ -1,7 +1,7 @@
|
|||
package jet
|
||||
|
||||
// WITH function creates new with statement from list of common table expressions for specified dialect
|
||||
func WITH(dialect Dialect, cte ...CommonTableExpressionDefinition) func(statement SerializerStatement) Statement {
|
||||
func WITH(dialect Dialect, cte ...CommonTableExpressionDefinition) func(statement Statement) Statement {
|
||||
newWithImpl := &withImpl{
|
||||
ctes: cte,
|
||||
serializerStatementInterfaceImpl: serializerStatementInterfaceImpl{
|
||||
|
|
@ -11,8 +11,12 @@ func WITH(dialect Dialect, cte ...CommonTableExpressionDefinition) func(statemen
|
|||
}
|
||||
newWithImpl.parent = newWithImpl
|
||||
|
||||
return func(primaryStatement SerializerStatement) Statement {
|
||||
newWithImpl.primaryStatement = primaryStatement
|
||||
return func(primaryStatement Statement) Statement {
|
||||
serializerStatement, ok := primaryStatement.(SerializerStatement)
|
||||
if !ok {
|
||||
panic("jet: unsupported main WITH statement.")
|
||||
}
|
||||
newWithImpl.primaryStatement = serializerStatement
|
||||
return newWithImpl
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ func AssertExec(t *testing.T, stmt jet.Statement, db qrm.DB, rowsAffected ...int
|
|||
require.NoError(t, err)
|
||||
|
||||
if len(rowsAffected) > 0 {
|
||||
require.Equal(t, rows, rowsAffected[0])
|
||||
require.Equal(t, rowsAffected[0], rows)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue