KdbSharp 0.3.0
dotnet add package KdbSharp --version 0.3.0
NuGet\Install-Package KdbSharp -Version 0.3.0
<PackageReference Include="KdbSharp" Version="0.3.0" />
<PackageVersion Include="KdbSharp" Version="0.3.0" />
<PackageReference Include="KdbSharp" />
paket add KdbSharp --version 0.3.0
#r "nuget: KdbSharp, 0.3.0"
#:package KdbSharp@0.3.0
#addin nuget:?package=KdbSharp&version=0.3.0
#tool nuget:?package=KdbSharp&version=0.3.0
KdbSharp
KdbSharp is a kdb client for .NET, providing a modern and efficient way to interact with kdb+ databases from .NET applications.
Status
This project is a work in progress. The API is subject to change. Production use is not recommended at this time.
Features
- Connect to kdb+ databases
- Serialize and deserialize kdb+ data types
- Execute queries against kdb+ databases
- Support for asynchronous operations
Installation
Install the package via NuGet:
dotnet add package KdbSharp
Usage
Basic Connection
// Connect to a kdb+ server
var connection = new KdbConnection(new KdbConnectionOptions
{
Host = "localhost",
Port = 5000,
Username = "username", // Optional
Password = "password" // Optional
});
// h: hopen `:localhost:5000:username:password
await connection.OpenAsync();
GetAsync - Execute Queries and Get Results
// result: h "2+3"
var result = await connection.GetAsync<long>("2 + 3");
// table: h "([] col1:1 2 3; col2:`a`b`c)"
var table = await connection.GetAsync<KTable>("([] col1:1 2 3; col2:`a`b`c)");
SetAsync - Execute Async Commands
// neg[h] "insert[`trade] (1; `AAPL; 100.5; 1000)"
await connection.SetAsync("insert[`trade] (1; `AAPL; 100.5; 1000)");
// neg[h] ".u.sub[`trade;`]"
await connection.SetAsync(".u.sub[`trade;`]"); // Subscribe to updates
Parameterized Queries with CreateCommand
// h ("{select from trade where sym=x}"; "AAPL")
var result1 = await connection.CreateCommand("{select from trade where sym=x}", "AAPL")
.GetAsync<KTable>();
// h ("select from trade where sym=x and size>y"; "AAPL"; 500)
var result2 = connection.CreateCommand("select from trade where sym=x and size>y", "AAPL", 500L)
.GetAsync<KTable>();
// neg[h] ("insert[`trade] (`MSFT; x)"; 150.75)
var result3 = connection.CreateCommand("insert[`trade] (`MSFT; x)", 150.75)
.SetAsync();
Receiving Async Messages Using Subscribe Extension
// Subscribe to updates
await connection.SetAsync(".u.sub[`trade;`]");
// Use the Subscribe extension method for easier async enumeration
await foreach (var message in connection.Subscribe().WithCancellation(cancellationToken))
{
if (message.Compressed)
{
message.Uncompress();
}
var data = message.Deserialize();
// TODO: Process the data
// Important: Dispose the message when done
message.Dispose();
}
Requirements
- .NET 6.0 or higher
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Acknowledgements
The KMessage.Uncompress
method modifications were made to functions originally found in the following repository:
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.