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 fb8aeff
Showing
11 changed files
with
305 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 ContainsStr : IExpressionPart | ||
{ | ||
private readonly IEnumerable<IExpressionPart> _value; | ||
private readonly IEnumerable<IExpressionPart> _substr; | ||
|
||
internal ContainsStr(IEnumerable<IExpressionPart> value, IEnumerable<IExpressionPart> substr) | ||
{ | ||
this._value = value; | ||
this._substr = substr; | ||
} | ||
|
||
public void AppendFlux(StringBuilder builder) | ||
{ | ||
builder.Append("strings.containsStr(v: "); | ||
foreach (var expressionPart in _value) expressionPart.AppendFlux(builder); | ||
builder.Append(", substr: "); | ||
foreach (var expressionPart in _substr) 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 HasPrefix : IExpressionPart | ||
{ | ||
private readonly IEnumerable<IExpressionPart> _value; | ||
private readonly IEnumerable<IExpressionPart> _prefix; | ||
|
||
internal HasPrefix(IEnumerable<IExpressionPart> value, IEnumerable<IExpressionPart> prefix) | ||
{ | ||
this._value = value; | ||
this._prefix = prefix; | ||
} | ||
|
||
public void AppendFlux(StringBuilder builder) | ||
{ | ||
builder.Append("strings.hasPrefix(v: "); | ||
foreach (var expressionPart in _value) expressionPart.AppendFlux(builder); | ||
builder.Append(", prefix: "); | ||
foreach (var expressionPart in _prefix) 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 HasSuffix : IExpressionPart | ||
{ | ||
private readonly IEnumerable<IExpressionPart> _value; | ||
private readonly IEnumerable<IExpressionPart> _suffix; | ||
|
||
internal HasSuffix(IEnumerable<IExpressionPart> value, IEnumerable<IExpressionPart> suffix) | ||
{ | ||
this._value = value; | ||
this._suffix = suffix; | ||
} | ||
|
||
public void AppendFlux(StringBuilder builder) | ||
{ | ||
builder.Append("strings.hasSuffix(v: "); | ||
foreach (var expressionPart in _value) expressionPart.AppendFlux(builder); | ||
builder.Append(", suffix: "); | ||
foreach (var expressionPart in _suffix) 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 ReplaceAll : IExpressionPart | ||
{ | ||
private readonly IEnumerable<IExpressionPart> _value; | ||
private readonly IEnumerable<IExpressionPart> _substring; | ||
private readonly IEnumerable<IExpressionPart> _replacement; | ||
|
||
internal ReplaceAll(IEnumerable<IExpressionPart> value, IEnumerable<IExpressionPart> substring, | ||
IEnumerable<IExpressionPart> replacement) | ||
{ | ||
this._value = value; | ||
this._substring = substring; | ||
this._replacement = replacement; | ||
} | ||
|
||
public void AppendFlux(StringBuilder builder) | ||
{ | ||
builder.Append("strings.replaceAll(v: "); | ||
foreach (var expressionPart in _value) expressionPart.AppendFlux(builder); | ||
builder.Append(", t: "); | ||
foreach (var expressionPart in _substring) expressionPart.AppendFlux(builder); | ||
builder.Append(", u: "); | ||
foreach (var expressionPart in _replacement) 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> _value; | ||
|
||
internal ToLower(IEnumerable<IExpressionPart> value) | ||
{ | ||
this._value = value; | ||
} | ||
|
||
public void AppendFlux(StringBuilder builder) | ||
{ | ||
builder.Append("strings.toLower(v: "); | ||
foreach (var expressionPart in _value) 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> _value; | ||
|
||
internal ToString(IEnumerable<IExpressionPart> value) | ||
{ | ||
this._value = value; | ||
} | ||
|
||
public void AppendFlux(StringBuilder builder) | ||
{ | ||
builder.Append("string(v: "); | ||
foreach (var expressionPart in _value) 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> _value; | ||
|
||
internal ToUpper(IEnumerable<IExpressionPart> value) | ||
{ | ||
this._value = value; | ||
} | ||
|
||
public void AppendFlux(StringBuilder builder) | ||
{ | ||
builder.Append("strings.toUpper(v: "); | ||
foreach (var expressionPart in _value) 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