Skip to content

Commit

Permalink
Merge branch 'main' into feature/cli
Browse files Browse the repository at this point in the history
  • Loading branch information
RohitM-IN committed Mar 5, 2024
2 parents ccc76eb + a39a957 commit ca20eb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/DbSyncKit.PostgreSQL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<AssemblyVersion>1.2.0.0</AssemblyVersion>
<FileVersion>1.2.0.0</FileVersion>
<Version>1.2.0.0</Version>
<AssemblyVersion>1.4.0.0</AssemblyVersion>
<FileVersion>1.4.0.0</FileVersion>
<Version>1.4.0.0</Version>
<PackageProjectUrl>https://dbsynckit.rohit-mahajan.in/t</PackageProjectUrl>
<RepositoryUrl>https://github.com/RohitM-IN/DbSyncKit</RepositoryUrl>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
Expand Down
13 changes: 6 additions & 7 deletions src/QueryGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using DbSyncKit.DB.Helper;
using DbSyncKit.DB.Interface;
using DbSyncKit.Templates.Interface;
using DbSyncKit.Templates.PostgreSQL;
using Fluid;
using System.Reflection;
Expand Down Expand Up @@ -44,7 +44,7 @@ public QueryGenerator()
/// <param name="schemaName">Optional schema name, default is 'public'.</param>
/// <returns>Select Query in string.</returns>
/// <exception cref="ArgumentException">Thrown when table name or columns are null or empty.</exception>
public string GenerateSelectQuery<T>(string tableName, List<string> listOfColumns, string schemaName) where T : IDataContract
public string GenerateSelectQuery<T>(string tableName, List<string> listOfColumns, string schemaName)
{
if (string.IsNullOrEmpty(tableName) || listOfColumns == null || listOfColumns.Count == 0)
{
Expand Down Expand Up @@ -78,7 +78,7 @@ public string GenerateSelectQuery<T>(string tableName, List<string> listOfColumn
/// <param name="excludedColumns">List of excluded columns.</param>
/// <param name="editedProperties">Dictionary of edited properties.</param>
/// <returns>Update Query in string.</returns>
public string GenerateUpdateQuery<T>(T DataContract, List<string> keyColumns, List<string> excludedColumns, (string propName, object propValue)[] editedProperties) where T : IDataContract
public string GenerateUpdateQuery<T>(T DataContract, List<string> keyColumns, List<string> excludedColumns, (string propName, object propValue)[] editedProperties)
{
string tableName = GetTableName<T>();
string schemaName = GetTableSchema<T>() ?? DEFAULT_SCHEMA_NAME;
Expand All @@ -101,7 +101,7 @@ public string GenerateUpdateQuery<T>(T DataContract, List<string> keyColumns, Li
/// <param name="entity">The entity to be deleted.</param>
/// <param name="keyColumns">List of key columns.</param>
/// <returns>Delete Query in string.</returns>
public string GenerateDeleteQuery<T>(T entity, List<string> keyColumns) where T : IDataContract
public string GenerateDeleteQuery<T>(T entity, List<string> keyColumns)
{
string tableName = GetTableName<T>();
string schemaName = GetTableSchema<T>() ?? DEFAULT_SCHEMA_NAME;
Expand All @@ -123,7 +123,7 @@ public string GenerateDeleteQuery<T>(T entity, List<string> keyColumns) where T
/// <param name="keyColumns">List of key columns.</param>
/// <param name="excludedColumns">List of excluded columns.</param>
/// <returns>Insert Query in string.</returns>
public string GenerateInsertQuery<T>(T entity, List<string> keyColumns, List<string> excludedColumns) where T : IDataContract
public string GenerateInsertQuery<T>(T entity, List<string> keyColumns, List<string> excludedColumns)
{
string tableName = GetTableName<T>();
string schemaName = GetTableSchema<T>() ?? DEFAULT_SCHEMA_NAME;
Expand Down Expand Up @@ -183,11 +183,10 @@ public void Dispose()
/// <summary>
/// Generates a SQL WHERE clause based on the specified entity and key columns.
/// </summary>
/// <typeparam name="T">The type of the entity that implements IDataContract.</typeparam>
/// <param name="entity">The entity for which the condition is generated.</param>
/// <param name="keyColumns">The list of key columns used to create the condition.</param>
/// <returns>A string representing the SQL WHERE clause based on the key columns of the entity.</returns>
public List<string> GetCondition<T>(T entity, List<string> keyColumns) where T : IDataContract
public List<string> GetCondition<T>(T entity, List<string> keyColumns)
{
Type entityType = typeof(T);
PropertyInfo[] keyProperties = GetKeyProperties<T>();
Expand Down

0 comments on commit ca20eb3

Please sign in to comment.