mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-09 21:08:31 +02:00
This commit both: - Fixes pre-existing mistakes in snippets, aka wrong code samples. - Adds hidden (`@hide`) statements that do not appear in the docs, but satisfy typecheckers.
38 lines
850 B
Go
38 lines
850 B
Go
package snippet
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/qdrant/go-client/qdrant"
|
|
)
|
|
|
|
func Main() {
|
|
client, err := qdrant.NewClient(&qdrant.Config{
|
|
Host: "localhost",
|
|
Port: 6334,
|
|
})
|
|
|
|
if err != nil { panic(err) } // @hide
|
|
|
|
client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
|
CollectionName: "{collection_name}",
|
|
Points: []*qdrant.PointStruct{
|
|
{
|
|
Id: qdrant.NewIDNum(1),
|
|
Vectors: qdrant.NewVectors(0.9, 0.1, 0.1),
|
|
Payload: qdrant.NewValueMap(map[string]any{"group_id": "user_1"}),
|
|
},
|
|
{
|
|
Id: qdrant.NewIDNum(2),
|
|
Vectors: qdrant.NewVectors(0.1, 0.9, 0.1),
|
|
Payload: qdrant.NewValueMap(map[string]any{"group_id": "user_1"}),
|
|
},
|
|
{
|
|
Id: qdrant.NewIDNum(3),
|
|
Vectors: qdrant.NewVectors(0.1, 0.1, 0.9),
|
|
Payload: qdrant.NewValueMap(map[string]any{"group_id": "user_2"}),
|
|
},
|
|
},
|
|
})
|
|
}
|