Skip to content

Commit 77afe9a

Browse files
committed
[ksqlDB.RestApi.Client] - samples group join - query syntax
1 parent e8cc6fd commit 77afe9a

File tree

2 files changed

+46
-2
lines changed

2 files changed

+46
-2
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using ksqlDB.RestApi.Client.KSql.Linq;
2+
using ksqlDB.RestApi.Client.KSql.Query.Context;
3+
4+
namespace ksqlDB.Api.Client.Samples.Joins
5+
{
6+
public class Joins
7+
{
8+
public Joins()
9+
{
10+
var ksqlDbUrl = @"http:\\localhost:8088";
11+
12+
var context = new KSqlDBContext(ksqlDbUrl);
13+
14+
var query = (from o in context.CreateQueryStream<Order>()
15+
join p1 in Source.Of<Payment>() on o.PaymentId equals p1.Id
16+
join s1 in Source.Of<Shipment>() on o.ShipmentId equals s1.Id into gj
17+
from sa in gj.DefaultIfEmpty()
18+
select new
19+
{
20+
orderId = o.OrderId,
21+
shipmentId = sa.Id,
22+
paymentId = p1.Id,
23+
})
24+
.Take(5);
25+
}
26+
}
27+
28+
class Order
29+
{
30+
public int OrderId { get; set; }
31+
public int PaymentId { get; set; }
32+
public int ShipmentId { get; set; }
33+
}
34+
35+
class Payment
36+
{
37+
public int Id { get; set; }
38+
}
39+
40+
record Shipment
41+
{
42+
public int Id { get; set; }
43+
}
44+
}

Samples/ksqlDB.RestApi.Client.Sample/ksqlDB.Api.Client.Samples.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="ksqlDB.RestApi.Client" Version="1.0.0-rc.1" />
11+
<PackageReference Include="ksqlDB.RestApi.Client" Version="1.1.0-rc.1" />
12+
<!-- <ProjectReference Include="..\..\ksqlDb.RestApi.Client\ksqlDb.RestApi.Client.csproj" /> -->
1213
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.1" />
13-
<!--<ProjectReference Include="..\..\ksqlDb.RestApi.Client\ksqlDb.RestApi.Client.csproj" />-->
1414
</ItemGroup>
1515
</Project>

0 commit comments

Comments
 (0)