milvus

package module
v0.0.0-...-02f0996 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 24, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

README

Milvus 向量数据库扩展包

Milvus 向量数据库实现,位于扩展包中,独立管理依赖。

安装

go get github.com/rushteam/reckit/ext/vector/milvus

使用

import (
    "github.com/rushteam/reckit/core"
    milvus "github.com/rushteam/reckit/ext/vector/milvus"
)

// 创建 Milvus 服务
milvusService := milvus.NewMilvusService("localhost:19530")

// 作为 core.VectorService 使用
var vectorService core.VectorService = milvusService

// 作为 core.VectorDatabaseService 使用
var dbService core.VectorDatabaseService = milvusService

依赖

  • github.com/rushteam/reckit - 核心包(仅接口定义)
  • github.com/milvus-io/milvus/client/v2 - Milvus 官方 SDK v2

注意:此扩展包使用 Milvus Go SDK v2 (github.com/milvus-io/milvus/client/v2),这是官方维护的最新 Go SDK。

自行实现

你也可以参考此实现,自行实现 core.VectorServicecore.VectorDatabaseService 接口,满足你的特定需求。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MilvusOption

type MilvusOption func(*MilvusService)

func WithMilvusAuth

func WithMilvusAuth(username, password string) MilvusOption

func WithMilvusDatabase

func WithMilvusDatabase(database string) MilvusOption

func WithMilvusTimeout

func WithMilvusTimeout(timeout int) MilvusOption

type MilvusService

type MilvusService struct {
	Address  string
	Username string
	Password string
	Database string
	Timeout  int
	// contains filtered or unexported fields
}

MilvusService 是 Milvus 向量数据库的 VectorDatabaseService 实现。

注意:此实现位于扩展包中,需要单独引入:

go get github.com/rushteam/reckit/ext/vector/milvus

func NewMilvusService

func NewMilvusService(address string, opts ...MilvusOption) (*MilvusService, error)

NewMilvusService 创建一个新的 Milvus 服务实例。

func (*MilvusService) Close

func (s *MilvusService) Close(ctx context.Context) error

func (*MilvusService) CreateCollection

func (s *MilvusService) CreateCollection(ctx context.Context, req *core.VectorCreateCollectionRequest) error

func (*MilvusService) Delete

func (*MilvusService) DropCollection

func (s *MilvusService) DropCollection(ctx context.Context, collection string) error

func (*MilvusService) HasCollection

func (s *MilvusService) HasCollection(ctx context.Context, collection string) (bool, error)

func (*MilvusService) Insert

func (*MilvusService) Search

Search 实现 core.VectorService 接口

func (*MilvusService) Update

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL