Skip to content

Commit

Permalink
Merge pull request #254 from njqdev/master
Browse files Browse the repository at this point in the history
Add Query.GetComment()
  • Loading branch information
ahmad-moussawi authored May 31, 2021
2 parents 96e54f3 + 5d9354b commit 5a0ce95
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions QueryBuilder/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ namespace SqlKata
{
public partial class Query : BaseQuery<Query>
{
private string comment;

public bool IsDistinct { get; set; } = false;
public string QueryAlias { get; set; }
public string Method { get; set; } = "select";
public string QueryComment { get; set; }
public List<Include> Includes = new List<Include>();
public Dictionary<string, object> Variables = new Dictionary<string, object>();

Expand All @@ -25,6 +26,8 @@ public Query(string table, string comment = null) : base()
Comment(comment);
}

public string GetComment() => comment ?? "";

public bool HasOffset(string engineCode = null) => GetOffset(engineCode) > 0;

public bool HasLimit(string engineCode = null) => GetLimit(engineCode) > 0;
Expand Down Expand Up @@ -63,9 +66,14 @@ public Query As(string alias)
return this;
}

/// <summary>
/// Sets a comment for the query.
/// </summary>
/// <param name="comment">The comment.</param>
/// <returns></returns>
public Query Comment(string comment)
{
QueryComment = comment;
this.comment = comment;
return this;
}

Expand Down

0 comments on commit 5a0ce95

Please sign in to comment.