Skip to content

Commit 0248490

Browse files
authored
Merge pull request #51 Query service
2 parents ae6e18f + 46ef8e8 commit 0248490

38 files changed

+2772
-564
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
jobs:
1010
autoformatter:
1111
strategy:
12+
fail-fast: false
1213
matrix:
1314
source-dir: ["./src/", "./examples/src/", "./slo/src/"]
1415
include:
@@ -38,6 +39,7 @@ jobs:
3839

3940
inspection:
4041
strategy:
42+
fail-fast: false
4143
matrix:
4244
solutionPath: ["./src/YdbSdk.sln", "./examples/src/YdbExamples.sln", "./slo/src/src.sln"]
4345
runs-on: ubuntu-latest

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
jobs:
99
unit-tests:
1010
strategy:
11+
fail-fast: false
1112
matrix:
1213
os: [ubuntu-22.04, windows-2022, macos-12]
1314
dotnet-version: [6.0.x, 7.0.x]

examples/src/BasicExample/BasicExample.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using System;
21
using System.Security.Cryptography.X509Certificates;
3-
using System.Threading.Tasks;
42
using Microsoft.Extensions.Logging;
53
using Ydb.Sdk.Auth;
64
using Ydb.Sdk.Services.Table;

examples/src/BasicExample/BasicExample.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@
44
<PropertyGroup>
55
<OutputType>Exe</OutputType>
66
<TargetFramework>net6.0</TargetFramework>
7+
<ImplicitUsings>enable</ImplicitUsings>
78
<Nullable>enable</Nullable>
89
<AssemblyName>Ydb.Sdk.Examples.BasicExample</AssemblyName>
910
<RootNamespace>Ydb.Sdk.Examples</RootNamespace>
1011
</PropertyGroup>
1112

1213
<PropertyGroup>
1314
<RepositoryType>git</RepositoryType>
14-
<RepositoryUrl>https://github.com/ydb-platform/ydb-dotnet-examples</RepositoryUrl>
15-
<PackageProjectUrl>https://github.com/ydb-platform/ydb-dotnet-examples</PackageProjectUrl>
15+
<RepositoryUrl>https://github.com/ydb-platform/ydb-dotnet-sdk</RepositoryUrl>
16+
<PackageProjectUrl>https://github.com/ydb-platform/ydb-dotnet-sdk</PackageProjectUrl>
1617
<Company>YANDEX LLC</Company>
1718
</PropertyGroup>
1819

examples/src/BasicExample/DataQuery.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Threading.Tasks;
41
using Ydb.Sdk.Services.Table;
52
using Ydb.Sdk.Value;
63

Lines changed: 1 addition & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
51
using Ydb.Sdk.Services.Table;
6-
using Ydb.Sdk.Value;
72

83
namespace Ydb.Sdk.Examples;
94

@@ -50,152 +45,11 @@ REPLACE INTO episodes
5045
return await session.ExecuteDataQuery(
5146
query: query,
5247
txControl: TxControl.BeginSerializableRW().Commit(),
53-
parameters: GetDataParams(),
48+
parameters: DataUtils.GetDataParams(),
5449
settings: DefaultDataQuerySettings
5550
);
5651
});
5752

5853
response.Status.EnsureSuccess();
5954
}
60-
61-
internal record Series(int SeriesId, string Title, DateTime ReleaseDate, string Info);
62-
63-
internal record Season(int SeriesId, int SeasonId, string Title, DateTime FirstAired, DateTime LastAired);
64-
65-
internal record Episode(int SeriesId, int SeasonId, int EpisodeId, string Title, DateTime AirDate);
66-
67-
private static Dictionary<string, YdbValue> GetDataParams()
68-
{
69-
var series = new Series[]
70-
{
71-
new(SeriesId: 1, Title: "IT Crowd", ReleaseDate: DateTime.Parse("2006-02-03"),
72-
Info: "The IT Crowd is a British sitcom produced by Channel 4, written by Graham Linehan, " +
73-
"produced by Ash Atalla and starring Chris O'Dowd, Richard Ayoade, Katherine Parkinson, " +
74-
"and Matt Berry."),
75-
new(SeriesId: 2, Title: "Silicon Valley", ReleaseDate: DateTime.Parse("2014-04-06"),
76-
Info: "Silicon Valley is an American comedy television series created by Mike Judge, " +
77-
"John Altschuler and Dave Krinsky. The series focuses on five young men who founded " +
78-
"a startup company in Silicon Valley.")
79-
};
80-
81-
var seasons = new Season[]
82-
{
83-
new(1, 1, "Season 1", DateTime.Parse("2006-02-03"), DateTime.Parse("2006-03-03")),
84-
new(1, 2, "Season 2", DateTime.Parse("2007-08-24"), DateTime.Parse("2007-09-28")),
85-
new(1, 3, "Season 3", DateTime.Parse("2008-11-21"), DateTime.Parse("2008-12-26")),
86-
new(1, 4, "Season 4", DateTime.Parse("2010-06-25"), DateTime.Parse("2010-07-30")),
87-
new(2, 1, "Season 1", DateTime.Parse("2014-04-06"), DateTime.Parse("2014-06-01")),
88-
new(2, 2, "Season 2", DateTime.Parse("2015-04-12"), DateTime.Parse("2015-06-14")),
89-
new(2, 3, "Season 3", DateTime.Parse("2016-04-24"), DateTime.Parse("2016-06-26")),
90-
new(2, 4, "Season 4", DateTime.Parse("2017-04-23"), DateTime.Parse("2017-06-25")),
91-
new(2, 5, "Season 5", DateTime.Parse("2018-03-25"), DateTime.Parse("2018-05-13"))
92-
};
93-
94-
var episodes = new Episode[]
95-
{
96-
new(1, 1, 1, "Yesterday's Jam", DateTime.Parse("2006-02-03")),
97-
new(1, 1, 2, "Calamity Jen", DateTime.Parse("2006-02-03")),
98-
new(1, 1, 3, "Fifty-Fifty", DateTime.Parse("2006-02-10")),
99-
new(1, 1, 4, "The Red Door", DateTime.Parse("2006-02-17")),
100-
new(1, 1, 5, "The Haunting of Bill Crouse", DateTime.Parse("2006-02-24")),
101-
new(1, 1, 6, "Aunt Irma Visits", DateTime.Parse("2006-03-03")),
102-
new(1, 2, 1, "The Work Outing", DateTime.Parse("2006-08-24")),
103-
new(1, 2, 2, "Return of the Golden Child", DateTime.Parse("2007-08-31")),
104-
new(1, 2, 3, "Moss and the German", DateTime.Parse("2007-09-07")),
105-
new(1, 2, 4, "The Dinner Party", DateTime.Parse("2007-09-14")),
106-
new(1, 2, 5, "Smoke and Mirrors", DateTime.Parse("2007-09-21")),
107-
new(1, 2, 6, "Men Without Women", DateTime.Parse("2007-09-28")),
108-
new(1, 3, 1, "From Hell", DateTime.Parse("2008-11-21")),
109-
new(1, 3, 2, "Are We Not Men?", DateTime.Parse("2008-11-28")),
110-
new(1, 3, 3, "Tramps Like Us", DateTime.Parse("2008-12-05")),
111-
new(1, 3, 4, "The Speech", DateTime.Parse("2008-12-12")),
112-
new(1, 3, 5, "Friendface", DateTime.Parse("2008-12-19")),
113-
new(1, 3, 6, "Calendar Geeks", DateTime.Parse("2008-12-26")),
114-
new(1, 4, 1, "Jen The Fredo", DateTime.Parse("2010-06-25")),
115-
new(1, 4, 2, "The Final Countdown", DateTime.Parse("2010-07-02")),
116-
new(1, 4, 3, "Something Happened", DateTime.Parse("2010-07-09")),
117-
new(1, 4, 4, "Italian For Beginners", DateTime.Parse("2010-07-16")),
118-
new(1, 4, 5, "Bad Boys", DateTime.Parse("2010-07-23")),
119-
new(1, 4, 6, "Reynholm vs Reynholm", DateTime.Parse("2010-07-30")),
120-
new(2, 1, 1, "Minimum Viable Product", DateTime.Parse("2014-04-06")),
121-
new(2, 1, 2, "The Cap Table", DateTime.Parse("2014-04-13")),
122-
new(2, 1, 3, "Articles of Incorporation", DateTime.Parse("2014-04-20")),
123-
new(2, 1, 4, "Fiduciary Duties", DateTime.Parse("2014-04-27")),
124-
new(2, 1, 5, "Signaling Risk", DateTime.Parse("2014-05-04")),
125-
new(2, 1, 6, "Third Party Insourcing", DateTime.Parse("2014-05-11")),
126-
new(2, 1, 7, "Proof of Concept", DateTime.Parse("2014-05-18")),
127-
new(2, 1, 8, "Optimal Tip-to-Tip Efficiency", DateTime.Parse("2014-06-01")),
128-
new(2, 2, 1, "Sand Hill Shuffle", DateTime.Parse("2015-04-12")),
129-
new(2, 2, 2, "Runaway Devaluation", DateTime.Parse("2015-04-19")),
130-
new(2, 2, 3, "Bad Money", DateTime.Parse("2015-04-26")),
131-
new(2, 2, 4, "The Lady", DateTime.Parse("2015-05-03")),
132-
new(2, 2, 5, "Server Space", DateTime.Parse("2015-05-10")),
133-
new(2, 2, 6, "Homicide", DateTime.Parse("2015-05-17")),
134-
new(2, 2, 7, "Adult Content", DateTime.Parse("2015-05-24")),
135-
new(2, 2, 8, "White Hat/Black Hat", DateTime.Parse("2015-05-31")),
136-
new(2, 2, 9, "Binding Arbitration", DateTime.Parse("2015-06-07")),
137-
new(2, 2, 10, "Two Days of the Condor", DateTime.Parse("2015-06-14")),
138-
new(2, 3, 1, "Founder Friendly", DateTime.Parse("2016-04-24")),
139-
new(2, 3, 2, "Two in the Box", DateTime.Parse("2016-05-01")),
140-
new(2, 3, 3, "Meinertzhagen's Haversack", DateTime.Parse("2016-05-08")),
141-
new(2, 3, 4, "Maleant Data Systems Solutions", DateTime.Parse("2016-05-15")),
142-
new(2, 3, 5, "The Empty Chair", DateTime.Parse("2016-05-22")),
143-
new(2, 3, 6, "Bachmanity Insanity", DateTime.Parse("2016-05-29")),
144-
new(2, 3, 7, "To Build a Better Beta", DateTime.Parse("2016-06-05")),
145-
new(2, 3, 8, "Bachman's Earnings Over-Ride", DateTime.Parse("2016-06-12")),
146-
new(2, 3, 9, "Daily Active Users", DateTime.Parse("2016-06-19")),
147-
new(2, 3, 10, "The Uptick", DateTime.Parse("2016-06-26")),
148-
new(2, 4, 1, "Success Failure", DateTime.Parse("2017-04-23")),
149-
new(2, 4, 2, "Terms of Service", DateTime.Parse("2017-04-30")),
150-
new(2, 4, 3, "Intellectual Property", DateTime.Parse("2017-05-07")),
151-
new(2, 4, 4, "Teambuilding Exercise", DateTime.Parse("2017-05-14")),
152-
new(2, 4, 5, "The Blood Boy", DateTime.Parse("2017-05-21")),
153-
new(2, 4, 6, "Customer Service", DateTime.Parse("2017-05-28")),
154-
new(2, 4, 7, "The Patent Troll", DateTime.Parse("2017-06-04")),
155-
new(2, 4, 8, "The Keenan Vortex", DateTime.Parse("2017-06-11")),
156-
new(2, 4, 9, "Hooli-Con", DateTime.Parse("2017-06-18")),
157-
new(2, 4, 10, "Server Error", DateTime.Parse("2017-06-25")),
158-
new(2, 5, 1, "Grow Fast or Die Slow", DateTime.Parse("2018-03-25")),
159-
new(2, 5, 2, "Reorientation", DateTime.Parse("2018-04-01")),
160-
new(2, 5, 3, "Chief Operating Officer", DateTime.Parse("2018-04-08")),
161-
new(2, 5, 4, "Tech Evangelist", DateTime.Parse("2018-04-15")),
162-
new(2, 5, 5, "Facial Recognition", DateTime.Parse("2018-04-22")),
163-
new(2, 5, 6, "Artificial Emotional Intelligence", DateTime.Parse("2018-04-29")),
164-
new(2, 5, 7, "Initial Coin Offering", DateTime.Parse("2018-05-06")),
165-
new(2, 5, 8, "Fifty-One Percent", DateTime.Parse("2018-05-13"))
166-
};
167-
168-
var seriesData = series.Select(s => YdbValue.MakeStruct(new Dictionary<string, YdbValue>
169-
{
170-
{ "series_id", YdbValue.MakeUint64((ulong)s.SeriesId) },
171-
{ "title", YdbValue.MakeUtf8(s.Title) },
172-
{ "series_info", YdbValue.MakeUtf8(s.Info) },
173-
{ "release_date", YdbValue.MakeDate(s.ReleaseDate) }
174-
})).ToList();
175-
176-
var seasonsData = seasons.Select(s => YdbValue.MakeStruct(new Dictionary<string, YdbValue>
177-
{
178-
{ "series_id", YdbValue.MakeUint64((ulong)s.SeriesId) },
179-
{ "season_id", YdbValue.MakeUint64((ulong)s.SeasonId) },
180-
{ "title", YdbValue.MakeUtf8(s.Title) },
181-
{ "first_aired", YdbValue.MakeDate(s.FirstAired) },
182-
{ "last_aired", YdbValue.MakeDate(s.LastAired) }
183-
})).ToList();
184-
185-
var episodesData = episodes.Select(e => YdbValue.MakeStruct(new Dictionary<string, YdbValue>
186-
{
187-
{ "series_id", YdbValue.MakeUint64((ulong)e.SeriesId) },
188-
{ "season_id", YdbValue.MakeUint64((ulong)e.SeasonId) },
189-
{ "episode_id", YdbValue.MakeUint64((ulong)e.EpisodeId) },
190-
{ "title", YdbValue.MakeUtf8(e.Title) },
191-
{ "air_date", YdbValue.MakeDate(e.AirDate) }
192-
})).ToList();
193-
194-
return new Dictionary<string, YdbValue>
195-
{
196-
{ "$seriesData", YdbValue.MakeList(seriesData) },
197-
{ "$seasonsData", YdbValue.MakeList(seasonsData) },
198-
{ "$episodesData", YdbValue.MakeList(episodesData) }
199-
};
200-
}
20155
}

examples/src/BasicExample/InteractiveTx.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Threading.Tasks;
41
using Ydb.Sdk.Services.Table;
52
using Ydb.Sdk.Value;
63

examples/src/BasicExample/Program.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using System;
2-
using System.Threading.Tasks;
31
using CommandLine;
42
using Microsoft.Extensions.DependencyInjection;
53
using Microsoft.Extensions.Logging;

examples/src/BasicExample/ReadTable.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Threading.Tasks;
41
using Ydb.Sdk.Services.Table;
52

63
namespace Ydb.Sdk.Examples;

examples/src/BasicExample/ScanQuery.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Threading.Tasks;
41
using Ydb.Sdk.Value;
52

63
namespace Ydb.Sdk.Examples;

0 commit comments

Comments
 (0)