congqixia ef41f80bd0
enhance: Sync go.mod version & dep to main pkg (#32973)
Related to #31293
See also #32951 #32952 #32953 #32954

---------

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
2024-05-13 10:25:32 +08:00

38 lines
835 B
Go

package main
import (
"context"
"log"
milvusclient "github.com/milvus-io/milvus/client/v2"
)
const (
milvusAddr = `localhost:19530`
nEntities, dim = 3000, 128
collectionName = "hello_milvus"
msgFmt = "==== %s ====\n"
idCol, randomCol, embeddingCol = "ID", "random", "embeddings"
topK = 3
)
func main() {
ctx := context.Background()
log.Printf(msgFmt, "start connecting to Milvus")
c, err := milvusclient.New(ctx, &milvusclient.ClientConfig{
Address: milvusAddr,
})
if err != nil {
log.Fatal("failed to connect to milvus, err: ", err.Error())
}
defer c.Close(ctx)
dbNames, err := c.ListDatabase(ctx, milvusclient.NewListDatabaseOption())
if err != nil {
log.Fatal("failed to list databases", err.Error())
}
log.Println("=== Databases: ", dbNames)
}