Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ParserNameNumber inner register parser can't override, customized parser can't use prefix "#" ParserNameNumber = "#number" ParserNameCommon = "#common" ParserNameNumRange = "#num_range" ParserNameStrHash = "#str_hash" )
Variables ¶
View Source
var ErrBadRangeValue = fmt.Errorf("NumberRangeParser need:'start:end:step'")
Functions ¶
func ParseIntegerNumber ¶
Types ¶
type CommonParserOpt ¶
type CommonParserOpt struct {
// contains filtered or unexported fields
}
type CommonStrParser ¶
type CommonStrParser struct {
// contains filtered or unexported fields
}
func NewCommonParserWithAllocator ¶
func NewCommonParserWithAllocator(alloc IDAllocator) *CommonStrParser
func NewCommonParserWithOption ¶
func NewCommonParserWithOption(opt CommonParserOpt) *CommonStrParser
func NewCommonStrParser ¶
func NewCommonStrParser() *CommonStrParser
func (*CommonStrParser) IDGen ¶
func (p *CommonStrParser) IDGen() IDAllocator
func (*CommonStrParser) ParseAssign ¶
func (p *CommonStrParser) ParseAssign(v interface{}) (values []uint64, e error)
func (*CommonStrParser) ParseValue ¶
func (p *CommonStrParser) ParseValue(v interface{}) ([]uint64, error)
type FieldValueParser ¶
type FieldValueParser interface {
// ParseAssign parse query assign value into id-encoded ids
ParseAssign(v interface{}) ([]uint64, error)
// ParseValue parse bool expression value into id-encoded ids
ParseValue(v interface{}) ([]uint64, error)
}
FieldValueParser turn value into a unique id
func NewNumRangeParser ¶
func NewNumRangeParser() FieldValueParser
func NewStrHashParser ¶
func NewStrHashParser() FieldValueParser
type IDAllocator ¶
type IDAllocator interface {
AllocStringID(v string) uint64
FindStringID(v *string) (value uint64, found bool)
}
func NewIDAllocatorImpl ¶
func NewIDAllocatorImpl() IDAllocator
type IDAllocatorImpl ¶
type IDAllocatorImpl struct {
// contains filtered or unexported fields
}
IDAllocatorImpl 用于将不同类型的值ID化,用于构造Index的PostingList,减少重复值
func (*IDAllocatorImpl) AllocStringID ¶
func (alloc *IDAllocatorImpl) AllocStringID(v string) uint64
func (*IDAllocatorImpl) FindStringID ¶
func (alloc *IDAllocatorImpl) FindStringID(v *string) (value uint64, found bool)
func (*IDAllocatorImpl) TotalIDCount ¶
func (alloc *IDAllocatorImpl) TotalIDCount() uint64
type NumberParser ¶
type NumberParser struct {
// contains filtered or unexported fields
}
func NewNumberParser ¶
func NewNumberParser() *NumberParser
func NewNumberParser2 ¶
func NewNumberParser2(f2i bool) *NumberParser
func (*NumberParser) ParseAssign ¶
func (p *NumberParser) ParseAssign(v interface{}) (values []uint64, e error)
func (*NumberParser) ParseValue ¶
func (p *NumberParser) ParseValue(v interface{}) ([]uint64, error)
type NumberRangeParser ¶
type NumberRangeParser struct {
}
NumberRangeParser format: start:end:step; the `step` is optional
func (*NumberRangeParser) ParseAssign ¶
func (p *NumberRangeParser) ParseAssign(v interface{}) (res []uint64, err error)
ParseAssign only single number supported, float will round into integer
func (*NumberRangeParser) ParseValue ¶
func (p *NumberRangeParser) ParseValue(v interface{}) (res []uint64, err error)
type RangeDesc ¶
type RangeDesc struct {
// contains filtered or unexported fields
}
NumberRangeParser parse syntax like format: start:end:step step ist optional, it will generate start, start+step, start+2*stem ....
func NewRangeDesc ¶
type StrHashParser ¶
type StrHashParser struct{}
func (*StrHashParser) ParseAssign ¶
func (p *StrHashParser) ParseAssign(v interface{}) ([]uint64, error)
func (*StrHashParser) ParseValue ¶
func (p *StrHashParser) ParseValue(v interface{}) ([]uint64, error)
ParseValue parse bool expression value into id-encoded ids
Click to show internal directories.
Click to hide internal directories.