index

package
v0.0.0-...-dbf49c0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNil 未匹配给定的索引
	ErrNil = errors.New("未匹配")
	// ErrNotInitialized 未初始化
	ErrNotInitialized = errors.New("未初始化")
)

Functions

func ScanLinesEscapeDoubleQuotation

func ScanLinesEscapeDoubleQuotation(data []byte, atEOF bool) (advance int, token []byte, err error)

ScanLinesEscapeDoubleQuotation 按换行符读取内容,但是忽视在双引号中的换行符

Types

type Interface

type Interface interface {
	Match(k string) (*Item, error)
	Like(k string) ([]*Item, error)
}

Interface 词典索引

type Item

type Item struct {
	Key string
	Pos int32
	Len int32
}

Item 单条索引记录

func (Item) String

func (i Item) String() string

type Simple

type Simple []*Item

Simple 简单的已排序数组索引

func BuildSimpleIndex

func BuildSimpleIndex(r io.Reader, ignore ...bool) (Simple, error)

BuildSimpleIndex 根据给定的数据建立索引

func (Simple) Len

func (s Simple) Len() int

func (Simple) Less

func (s Simple) Less(i, j int) bool

func (Simple) Like

func (s Simple) Like(k string) ([]*Item, error)

Like 使用最左匹配的原则匹配有 key 的所有索引

func (Simple) Match

func (s Simple) Match(k string) (*Item, error)

Match 查找指定 key 的索引,必须完全匹配

func (Simple) Swap

func (s Simple) Swap(i, j int)

Jump to

Keyboard shortcuts

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