gpa

package module
v0.0.0-...-a3fe9c5 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2022 License: MIT Imports: 13 Imported by: 0

README

GPA

Golang Persistence API.

Go Report Card

install

go install github.com/xuender/gpa@latest

License

© ender, 2022~time.Now

MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB[T Document] struct {
	// contains filtered or unexported fields
}

DB 数据对象.

func NewDB

func NewDB[T Document](config *pb.Config) (*DB[T], error)

NewDB 新建数据对象.

func NewDBByDir

func NewDBByDir[T Document](dir string) (db *DB[T], err error)

func NewMemory

func NewMemory[T Document]() (*DB[T], error)

func (*DB[T]) Close

func (p *DB[T]) Close() error

func (*DB[T]) Load

func (p *DB[T]) Load(docs ...T) (err error)

func (*DB[T]) LoadByID

func (p *DB[T]) LoadByID(ids ...uint64) (docs []T, err error)

func (*DB[T]) Match

func (p *DB[T]) Match(value string) (docs []T, err error)

func (*DB[T]) Query

func (p *DB[T]) Query(values map[string]string) (docs []T, err error)

func (*DB[T]) Save

func (p *DB[T]) Save(docs ...T) (err error)

type Document

type Document interface {
	GetId() uint64
	ProtoReflect() protoreflect.Message
}

type Field

type Field struct {
	Type FieldType
	Name string
}

func NewField

func NewField(fieldType, fieldName string) *Field

func (*Field) Field

func (p *Field) Field(value reflect.Value) bluge.Field

type FieldType

type FieldType int

FieldType TODO.

const (
	Number FieldType = iota
	Time
	Text
)

func ToFieldType

func ToFieldType(str string) FieldType

type IndexService

type IndexService[T Document] struct {
	// contains filtered or unexported fields
}

IndexService 索引服务.

func NewIndexService

func NewIndexService[T Document](dir string) *IndexService[T]

NewIndexService 新建索引服务.

func (*IndexService[T]) Close

func (p *IndexService[T]) Close() error

func (*IndexService[T]) Index

func (p *IndexService[T]) Index(docs []T) (err error)

Index 索引.

func (*IndexService[T]) Match

func (p *IndexService[T]) Match(value string) (ids []uint64, err error)

func (*IndexService[T]) Parse

func (p *IndexService[T]) Parse(doc Document) *bluge.Document

func (*IndexService[T]) Query

func (p *IndexService[T]) Query(values map[string]string) (ids []uint64, err error)

type LevelService

type LevelService[T Document] struct {
	// contains filtered or unexported fields
}

func NewLevelService

func NewLevelService[T Document](dir string) *LevelService[T]

func (*LevelService[T]) Close

func (p *LevelService[T]) Close() error

func (*LevelService[T]) Load

func (p *LevelService[T]) Load(docs []T) (err error)

func (*LevelService[T]) Save

func (p *LevelService[T]) Save(docs []T) (err error)

Directories

Path Synopsis
_example

Jump to

Keyboard shortcuts

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