forked from influxdata/influxdb-client-csharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support some linq string functions in where conditions, fixes i…
- Loading branch information
1 parent
44574e0
commit 4c6f9f2
Showing
11 changed files
with
306 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace InfluxDB.Client.Linq.Internal.Expressions.String | ||
{ | ||
internal class Contains : IExpressionPart | ||
{ | ||
private readonly IEnumerable<IExpressionPart> expressionParts; | ||
private readonly IEnumerable<IExpressionPart> expressionParts2; | ||
|
||
internal Contains(IEnumerable<IExpressionPart> expressionParts, IEnumerable<IExpressionPart> expressionParts2) | ||
{ | ||
this.expressionParts = expressionParts; | ||
this.expressionParts2 = expressionParts2; | ||
} | ||
|
||
public void AppendFlux(StringBuilder builder) | ||
{ | ||
builder.Append("strings.containsStr(v: "); | ||
foreach (var expressionPart in expressionParts) expressionPart.AppendFlux(builder); | ||
builder.Append(", substr: "); | ||
foreach (var expressionPart in expressionParts2) expressionPart.AppendFlux(builder); | ||
builder.Append(")"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace InfluxDB.Client.Linq.Internal.Expressions.String | ||
{ | ||
internal class EndsWith : IExpressionPart | ||
{ | ||
private readonly IEnumerable<IExpressionPart> expressionParts; | ||
private readonly IEnumerable<IExpressionPart> expressionParts2; | ||
|
||
internal EndsWith(IEnumerable<IExpressionPart> expressionParts, IEnumerable<IExpressionPart> expressionParts2) | ||
{ | ||
this.expressionParts = expressionParts; | ||
this.expressionParts2 = expressionParts2; | ||
} | ||
|
||
public void AppendFlux(StringBuilder builder) | ||
{ | ||
builder.Append("strings.hasSuffix(v: "); | ||
foreach (var expressionPart in expressionParts) expressionPart.AppendFlux(builder); | ||
builder.Append(", suffix: "); | ||
foreach (var expressionPart in expressionParts2) expressionPart.AppendFlux(builder); | ||
builder.Append(")"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace InfluxDB.Client.Linq.Internal.Expressions.String | ||
{ | ||
internal class Replace : IExpressionPart | ||
{ | ||
private readonly IEnumerable<IExpressionPart> expressionParts; | ||
private readonly IEnumerable<IExpressionPart> expressionParts2; | ||
private readonly IEnumerable<IExpressionPart> expressionParts3; | ||
|
||
internal Replace(IEnumerable<IExpressionPart> expressionParts, IEnumerable<IExpressionPart> expressionParts2, | ||
IEnumerable<IExpressionPart> expressionParts3) | ||
{ | ||
this.expressionParts = expressionParts; | ||
this.expressionParts2 = expressionParts2; | ||
this.expressionParts3 = expressionParts3; | ||
} | ||
|
||
public void AppendFlux(StringBuilder builder) | ||
{ | ||
builder.Append("strings.replaceAll(v: "); | ||
foreach (var expressionPart in expressionParts) expressionPart.AppendFlux(builder); | ||
builder.Append(", t: "); | ||
foreach (var expressionPart in expressionParts2) expressionPart.AppendFlux(builder); | ||
builder.Append(", u: "); | ||
foreach (var expressionPart in expressionParts3) expressionPart.AppendFlux(builder); | ||
builder.Append(")"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace InfluxDB.Client.Linq.Internal.Expressions.String | ||
{ | ||
internal class StartsWith : IExpressionPart | ||
{ | ||
private readonly IEnumerable<IExpressionPart> expressionParts; | ||
private readonly IEnumerable<IExpressionPart> expressionParts2; | ||
|
||
internal StartsWith(IEnumerable<IExpressionPart> expressionParts, IEnumerable<IExpressionPart> expressionParts2) | ||
{ | ||
this.expressionParts = expressionParts; | ||
this.expressionParts2 = expressionParts2; | ||
} | ||
|
||
public void AppendFlux(StringBuilder builder) | ||
{ | ||
builder.Append("strings.hasPrefix(v: "); | ||
foreach (var expressionPart in expressionParts) expressionPart.AppendFlux(builder); | ||
builder.Append(", prefix: "); | ||
foreach (var expressionPart in expressionParts2) expressionPart.AppendFlux(builder); | ||
builder.Append(")"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace InfluxDB.Client.Linq.Internal.Expressions.String | ||
{ | ||
internal class ToLower : IExpressionPart | ||
{ | ||
private readonly IEnumerable<IExpressionPart> expressionParts; | ||
|
||
internal ToLower(IEnumerable<IExpressionPart> expressionParts) | ||
{ | ||
this.expressionParts = expressionParts; | ||
} | ||
|
||
public void AppendFlux(StringBuilder builder) | ||
{ | ||
builder.Append("strings.toLower(v: "); | ||
foreach (var expressionPart in expressionParts) expressionPart.AppendFlux(builder); | ||
builder.Append(")"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace InfluxDB.Client.Linq.Internal.Expressions.String | ||
{ | ||
internal class ToString : IExpressionPart | ||
{ | ||
private readonly IEnumerable<IExpressionPart> expressionParts; | ||
|
||
internal ToString(IEnumerable<IExpressionPart> expressionParts) | ||
{ | ||
this.expressionParts = expressionParts; | ||
} | ||
|
||
public void AppendFlux(StringBuilder builder) | ||
{ | ||
builder.Append("string(v: "); | ||
foreach (var expressionPart in expressionParts) expressionPart.AppendFlux(builder); | ||
builder.Append(")"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace InfluxDB.Client.Linq.Internal.Expressions.String | ||
{ | ||
internal class ToUpper : IExpressionPart | ||
{ | ||
private readonly IEnumerable<IExpressionPart> expressionParts; | ||
|
||
internal ToUpper(IEnumerable<IExpressionPart> expressionParts) | ||
{ | ||
this.expressionParts = expressionParts; | ||
} | ||
|
||
public void AppendFlux(StringBuilder builder) | ||
{ | ||
builder.Append("strings.toUpper(v: "); | ||
foreach (var expressionPart in expressionParts) expressionPart.AppendFlux(builder); | ||
builder.Append(")"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters