badger

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BadgerStorage

type BadgerStorage struct {
	// contains filtered or unexported fields
}

BadgerStorage BadgerDB存储引擎

func NewBadgerStorage

func NewBadgerStorage(path string) (*BadgerStorage, error)

NewBadgerStorage 创建Badger存储(默认配置)

func NewBadgerStorageWithOptions

func NewBadgerStorageWithOptions(opts BadgerStorageOptions) (*BadgerStorage, error)

NewBadgerStorageWithOptions 使用自定义选项创建Badger存储

func (*BadgerStorage) Backup

func (s *BadgerStorage) Backup(path string) error

Backup 备份数据库

func (*BadgerStorage) BatchDelete

func (s *BadgerStorage) BatchDelete(ids []string) error

批量删除

func (*BadgerStorage) BatchGet

func (s *BadgerStorage) BatchGet(ids []string) ([]*Vector, error)

批量获取

func (*BadgerStorage) BatchPut

func (s *BadgerStorage) BatchPut(vectors []*Vector) error

批量插入

func (*BadgerStorage) Checkpoint

func (s *BadgerStorage) Checkpoint() error

Checkpoint 创建检查点并清空WAL

func (*BadgerStorage) Close

func (s *BadgerStorage) Close() error

关闭存储

func (*BadgerStorage) Count

func (s *BadgerStorage) Count() (int, error)

获取数量

func (*BadgerStorage) CreateBackup

func (s *BadgerStorage) CreateBackup(description string) error

CreateBackup 创建备份

func (*BadgerStorage) Delete

func (s *BadgerStorage) Delete(id string) error

删除向量

func (*BadgerStorage) DeleteBackup

func (s *BadgerStorage) DeleteBackup(backupName string) error

DeleteBackup 删除备份

func (*BadgerStorage) DisableAutoBackup

func (s *BadgerStorage) DisableAutoBackup() error

DisableAutoBackup 禁用自动备份

func (*BadgerStorage) EnableAutoBackup

func (s *BadgerStorage) EnableAutoBackup(interval string) error

EnableAutoBackup 启用自动备份

func (*BadgerStorage) Get

func (s *BadgerStorage) Get(id string) (*Vector, error)

获取向量

func (*BadgerStorage) Iterate

func (s *BadgerStorage) Iterate(fn func(*Vector) bool) error

迭代所有向量

func (*BadgerStorage) ListBackups

func (s *BadgerStorage) ListBackups() ([]*backup.BackupMetadata, error)

ListBackups 列出所有备份

func (*BadgerStorage) Load

func (s *BadgerStorage) Load(path string) error

从文件加载

func (*BadgerStorage) Put

func (s *BadgerStorage) Put(vec *Vector) error

插入向量

func (*BadgerStorage) RestoreBackup

func (s *BadgerStorage) RestoreBackup(backupName string) error

RestoreBackup 从备份恢复

func (*BadgerStorage) Save

func (s *BadgerStorage) Save(path string) error

Save 保存到文件

type BadgerStorageOptions

type BadgerStorageOptions struct {
	Path         string
	SyncWrites   bool
	EnableWAL    bool
	EnableBackup bool
	BackupDir    string
}

BadgerStorageOptions Badger存储配置选项

type Vector

type Vector = types.Vector

Vector 向量数据结构(别名)

Jump to

Keyboard shortcuts

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