diff options
author | crupest <crupest@outlook.com> | 2022-12-04 18:11:06 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-12-20 20:32:52 +0800 |
commit | 476a6141b71d3def4a777ce934fec0d0bca8cd28 (patch) | |
tree | 12eda3d48fefb733b11e675724481d75dc65d319 /docker/crupest-api/CrupestApi/CrupestApi.Commons/DatabaseHelper.cs | |
parent | cdfb5781c8028a08051e0dbe6b7a2e39013e0f72 (diff) | |
download | crupest-476a6141b71d3def4a777ce934fec0d0bca8cd28.tar.gz crupest-476a6141b71d3def4a777ce934fec0d0bca8cd28.tar.bz2 crupest-476a6141b71d3def4a777ce934fec0d0bca8cd28.zip |
Develop secret api. v4
Diffstat (limited to 'docker/crupest-api/CrupestApi/CrupestApi.Commons/DatabaseHelper.cs')
-rw-r--r-- | docker/crupest-api/CrupestApi/CrupestApi.Commons/DatabaseHelper.cs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/docker/crupest-api/CrupestApi/CrupestApi.Commons/DatabaseHelper.cs b/docker/crupest-api/CrupestApi/CrupestApi.Commons/DatabaseHelper.cs new file mode 100644 index 0000000..9eb6a08 --- /dev/null +++ b/docker/crupest-api/CrupestApi/CrupestApi.Commons/DatabaseHelper.cs @@ -0,0 +1,13 @@ +namespace CrupestApi.Commons; + + +public static class DatabaseHelper +{ + public static string GenerateUpdateColumnString(this IEnumerable<string> updateColumnList, IEnumerable<KeyValuePair<string, string>>? paramNameMap = null) + { + paramNameMap = paramNameMap ?? Enumerable.Empty<KeyValuePair<string, string>>(); + var paramNameDictionary = new Dictionary<string, string>(paramNameMap); + + return string.Join(", ", updateColumnList.Select(x => $"{x} = @{paramNameDictionary.GetValueOrDefault(x) ?? x}")); + } +}
\ No newline at end of file |