Hide boilerplate in snippets.

This commit is contained in:
István Zoltán Szabó
2026-07-21 14:04:28 +02:00
parent 3fecc10c89
commit 4bc89cd833
44 changed files with 46 additions and 64 deletions
@@ -5,7 +5,9 @@ public class Snippet
{
public static async Task Run()
{
// @hide-start
var client = new QdrantClient("localhost", 6334);
// @hide-end
await client.CreateShardKeyAsync(
"{collection_name}",
@@ -2,8 +2,6 @@
using Qdrant.Client;
using Qdrant.Client.Grpc;
var client = new QdrantClient("localhost", 6334);
await client.CreateShardKeyAsync(
"{collection_name}",
new CreateShardKey { ShardKey = new ShardKey { Keyword = "{shard_key}", } }
@@ -5,11 +5,6 @@ import (
"github.com/qdrant/go-client/qdrant"
)
client, err := qdrant.NewClient(&qdrant.Config{
Host: "localhost",
Port: 6334,
})
client.CreateShardKey(context.Background(), "{collection_name}", &qdrant.CreateShardKey{
ShardKey: qdrant.NewShardKey("{shard_key}"),
})
@@ -6,9 +6,6 @@ import io.qdrant.client.QdrantGrpcClient;
import io.qdrant.client.grpc.Collections.CreateShardKey;
import io.qdrant.client.grpc.Collections.CreateShardKeyRequest;
QdrantClient client =
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
client.createShardKeyAsync(CreateShardKeyRequest.newBuilder()
.setCollectionName("{collection_name}")
.setRequest(CreateShardKey.newBuilder()
@@ -1,7 +1,5 @@
```python
from qdrant_client import QdrantClient, models
client = QdrantClient(url="http://localhost:6333")
client.create_shard_key("{collection_name}", "{shard_key}")
```
@@ -4,8 +4,6 @@ use qdrant_client::qdrant::{
};
use qdrant_client::Qdrant;
let client = Qdrant::from_url("http://localhost:6334").build()?;
client
.create_shard_key(
CreateShardKeyRequestBuilder::new("{collection_name}")
@@ -1,8 +1,6 @@
```typescript
import { QdrantClient } from "@qdrant/js-client-rest";
const client = new QdrantClient({ host: "localhost", port: 6333 });
client.createShardKey("{collection_name}", {
shard_key: "{shard_key}"
});
@@ -7,12 +7,14 @@ import (
)
func Main() {
// @hide-start
client, err := qdrant.NewClient(&qdrant.Config{
Host: "localhost",
Port: 6334,
})
if err != nil { panic(err) } // @hide
if err != nil { panic(err) }
// @hide-end
client.CreateShardKey(context.Background(), "{collection_name}", &qdrant.CreateShardKey{
ShardKey: qdrant.NewShardKey("{shard_key}"),
@@ -9,8 +9,10 @@ import io.qdrant.client.grpc.Collections.CreateShardKeyRequest;
public class Snippet {
public static void run() throws Exception {
// @hide-start
QdrantClient client =
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
// @hide-end
client.createShardKeyAsync(CreateShardKeyRequest.newBuilder()
.setCollectionName("{collection_name}")
@@ -1,5 +1,7 @@
from qdrant_client import QdrantClient, models
# @hide-start
client = QdrantClient(url="http://localhost:6333")
# @hide-end
client.create_shard_key("{collection_name}", "{shard_key}")
@@ -4,7 +4,9 @@ use qdrant_client::qdrant::{
use qdrant_client::Qdrant;
pub async fn main() -> anyhow::Result<()> {
// @hide-start
let client = Qdrant::from_url("http://localhost:6334").build()?;
// @hide-end
client
.create_shard_key(
@@ -1,6 +1,8 @@
import { QdrantClient } from "@qdrant/js-client-rest";
// @hide-start
const client = new QdrantClient({ host: "localhost", port: 6333 });
// @hide-end
client.createShardKey("{collection_name}", {
shard_key: "{shard_key}"