Skip to content

Commit

Permalink
Merge branch 'main' into feature/elastic-client
Browse files Browse the repository at this point in the history
  • Loading branch information
niemyjski committed Oct 28, 2024
2 parents 4b78492 + 19f2b43 commit 2e1bed2
Show file tree
Hide file tree
Showing 15 changed files with 479 additions and 133 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:

- package-ecosystem: nuget
directory: "/"
schedule:
interval: weekly
2 changes: 1 addition & 1 deletion build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
<PackageReference Include="AsyncFixer" Version="1.6.0" PrivateAssets="All" />
<PackageReference Include="MinVer" Version="5.0.0" PrivateAssets="All" />
<PackageReference Include="MinVer" Version="6.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
Expand Down
19 changes: 16 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,36 @@ services:
- 9300:9300
networks:
- foundatio
healthcheck:
interval: 2s
retries: 10
test: curl -s http://localhost:9200/_cluster/health | grep -vq '"status":"red"'

kibana:
depends_on:
- elasticsearch
elasticsearch:
condition: service_healthy
image: docker.elastic.co/kibana/kibana:8.15.1
ports:
- 5601:5601
networks:
- foundatio
healthcheck:
interval: 2s
retries: 20
test: curl --write-out 'HTTP %{http_code}' --fail --silent --output /dev/null http://localhost:5601/api/status

sqlserver:
image: mcr.microsoft.com/azure-sql-edge:1.0.7
image: mcr.microsoft.com/mssql/server:2022-latest
ports:
- "1433:1433" # login with sa:P@ssword1
environment:
- "ACCEPT_EULA=Y"
- "SA_PASSWORD=P@ssword1"
- "MSSQL_SA_PASSWORD=P@ssword1"
- "MSSQL_PID=Developer"
user: root
networks:
- foundatio
healthcheck:
test:
[
Expand All @@ -46,6 +58,7 @@ services:
command: elasticsearch:9200
depends_on:
- elasticsearch
- sqlserver
networks:
- foundatio

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\build\common.props" />
<ItemGroup>
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.15.6" />
<PackageReference Include="Exceptionless.DateTimeExtensions" Version="3.4.3" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System.Collections.Generic;

namespace Foundatio.Parsers.SqlQueries.Extensions;

internal static class EnumerableExtensions {
public delegate void ElementAction<in T>(T element, ElementInfo info);

public static void ForEach<T>(this IEnumerable<T> elements, ElementAction<T> action)
{
using IEnumerator<T> enumerator = elements.GetEnumerator();
bool isFirst = true;
bool hasNext = enumerator.MoveNext();
int index = 0;

while (hasNext)
{
T current = enumerator.Current;
hasNext = enumerator.MoveNext();
action(current, new ElementInfo(index, isFirst, !hasNext));
isFirst = false;
index++;
}
}

public struct ElementInfo {
public ElementInfo(int index, bool isFirst, bool isLast)
: this() {
Index = index;
IsFirst = isFirst;
IsLast = isLast;
}

public int Index { get; private set; }
public bool IsFirst { get; private set; }
public bool IsLast { get; private set; }
}
}

Loading

0 comments on commit 2e1bed2

Please sign in to comment.