Skip to content

Commit 6e8e2bd

Browse files
committed
QuestDb BulkCopy增加日期格式化配置
1 parent e7e09f7 commit 6e8e2bd

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Providers/FreeSql.Provider.QuestDb/QuestDbGlobalExtensions.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@ private static List<string> SplitByLine(string text)
154154
/// </summary>
155155
/// <typeparam name="T"></typeparam>
156156
/// <param name="that"></param>
157+
/// <param name="dateFormat">导入时,时间格式 默认:yyyy/M/d H:mm:ss</param>
157158
/// <returns></returns>
158-
public static async Task<int> ExecuteBulkCopyAsync<T>(this IInsert<T> that) where T : class
159+
public static async Task<int> ExecuteBulkCopyAsync<T>(this IInsert<T> that,string dateFormat = "yyyy/M/d H:mm:ss") where T : class
159160
{
160161
//思路:通过提供的RestAPI imp,实现快速复制
161162
if (string.IsNullOrWhiteSpace(RestAPIExtension.BaseUrl))
@@ -180,7 +181,7 @@ public static async Task<int> ExecuteBulkCopyAsync<T>(this IInsert<T> that) wher
180181
{
181182
{ "name", d.Name },
182183
{ "type", d.DbTypeText },
183-
{ "pattern", "yyyy/M/d H:mm:ss" }
184+
{ "pattern", dateFormat}
184185
});
185186
}
186187
else
@@ -249,10 +250,11 @@ public static async Task<int> ExecuteBulkCopyAsync<T>(this IInsert<T> that) wher
249250
/// </summary>
250251
/// <typeparam name="T"></typeparam>
251252
/// <param name="insert"></param>
253+
/// <param name="dateFormat">导入时,时间格式 默认:yyyy/M/d H:mm:ss</param>
252254
/// <returns></returns>
253-
public static int ExecuteBulkCopy<T>(this IInsert<T> insert) where T : class
255+
public static int ExecuteBulkCopy<T>(this IInsert<T> insert,string dateFormat = "yyyy/M/d H:mm:ss") where T : class
254256
{
255-
return ExecuteBulkCopyAsync(insert).ConfigureAwait(false).GetAwaiter().GetResult();
257+
return ExecuteBulkCopyAsync(insert,dateFormat).ConfigureAwait(false).GetAwaiter().GetResult();
256258
}
257259
}
258260

0 commit comments

Comments
 (0)