QuestDb BulkCopy增加日期格式化配置

This commit is contained in:
d4ilys 2023-09-18 09:36:12 +08:00
parent e7e09f7ece
commit 6e8e2bd446

View File

@ -154,8 +154,9 @@ public static partial class QuestDbGlobalExtensions
/// </summary> /// </summary>
/// <typeparam name="T"></typeparam> /// <typeparam name="T"></typeparam>
/// <param name="that"></param> /// <param name="that"></param>
/// <param name="dateFormat">导入时,时间格式 默认:yyyy/M/d H:mm:ss</param>
/// <returns></returns> /// <returns></returns>
public static async Task<int> ExecuteBulkCopyAsync<T>(this IInsert<T> that) where T : class public static async Task<int> ExecuteBulkCopyAsync<T>(this IInsert<T> that,string dateFormat = "yyyy/M/d H:mm:ss") where T : class
{ {
//思路通过提供的RestAPI imp实现快速复制 //思路通过提供的RestAPI imp实现快速复制
if (string.IsNullOrWhiteSpace(RestAPIExtension.BaseUrl)) if (string.IsNullOrWhiteSpace(RestAPIExtension.BaseUrl))
@ -180,7 +181,7 @@ public static partial class QuestDbGlobalExtensions
{ {
{ "name", d.Name }, { "name", d.Name },
{ "type", d.DbTypeText }, { "type", d.DbTypeText },
{ "pattern", "yyyy/M/d H:mm:ss" } { "pattern", dateFormat}
}); });
} }
else else
@ -249,10 +250,11 @@ public static partial class QuestDbGlobalExtensions
/// </summary> /// </summary>
/// <typeparam name="T"></typeparam> /// <typeparam name="T"></typeparam>
/// <param name="insert"></param> /// <param name="insert"></param>
/// <param name="dateFormat">导入时,时间格式 默认:yyyy/M/d H:mm:ss</param>
/// <returns></returns> /// <returns></returns>
public static int ExecuteBulkCopy<T>(this IInsert<T> insert) where T : class public static int ExecuteBulkCopy<T>(this IInsert<T> insert,string dateFormat = "yyyy/M/d H:mm:ss") where T : class
{ {
return ExecuteBulkCopyAsync(insert).ConfigureAwait(false).GetAwaiter().GetResult(); return ExecuteBulkCopyAsync(insert,dateFormat).ConfigureAwait(false).GetAwaiter().GetResult();
} }
} }