Skip to content

Commit 9e73d22

Browse files
feature_605: move QueryFactory extensions to a separate class
1 parent 1d21d89 commit 9e73d22

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

QueryBuilder.Tests/MySqlExecutionTest.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -180,20 +180,5 @@ QueryFactory DB()
180180

181181

182182

183-
}
184-
static class QueryFactoryExtensions
185-
{
186-
public static QueryFactory Create(this QueryFactory db, string table, IEnumerable<string> cols)
187-
{
188-
db.Drop(table);
189-
db.Statement($"CREATE TABLE `{table}`({string.Join(", ", cols)})");
190-
return db;
191-
}
192-
193-
public static QueryFactory Drop(this QueryFactory db, string table)
194-
{
195-
db.Statement($"DROP TABLE IF EXISTS `{table}`");
196-
return db;
197-
}
198183
}
199184
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
using System.Collections.Generic;
3+
using SqlKata.Execution;
4+
5+
static class QueryFactoryExtensions
6+
{
7+
public static QueryFactory Create(this QueryFactory db, string table, IEnumerable<string> cols)
8+
{
9+
db.Drop(table);
10+
db.Statement($"CREATE TABLE `{table}`({string.Join(", ", cols)});");
11+
return db;
12+
}
13+
14+
public static QueryFactory Drop(this QueryFactory db, string table)
15+
{
16+
db.Statement($"DROP TABLE IF EXISTS `{table}`;");
17+
return db;
18+
}
19+
}

0 commit comments

Comments
 (0)