Documentation ¶
Index ¶
- Constants
- Variables
- func AddingDir(s string, n int) string
- func BsearchInKeyRecord(key uint64, kr *query.KeyRecord) *query.KeyRecord
- func ColumnPath(tdir, col string, isNum bool) string
- func ColumnPathWithStatus(tdir, col string, isNum bool, s, e string, status byte) string
- func DecodeTri(v uint64) (s string)
- func EncodeTri(s string) (result []string)
- func FileExist(filename string) bool
- func FileListPath(tabledir string) string
- func FileListPathWithAdding(tabledir string, s, e uint64, usePid bool) string
- func FileMtime(filename string) time.Time
- func GetInode(info os.FileInfo) uint64
- func InitIdxCaches(i *IdxCaches)
- func IsEqQRecord(src, dst *query.Record) bool
- func JoinExt(s ...string) string
- func LessEqString(s, d string) (isLess bool)
- func Log(l LogLevel, f string, args ...interface{})
- func LogIsDebug() bool
- func MakeKRLessFn(krList *query.KeyRecordList) func(i, j int) bool
- func MakeLessFn(recs *query.RecordList) func(i, j int) bool
- func MakeSearchInxexFn(fileID uint64, offset int64) func(r *query.Record) bool
- func MergeKerRecordList(oKrLists ...*query.KeyRecordList) (dst *query.KeyRecordList, e error)
- func MesureElapsed() func(string) string
- func MesureElapsedToStat() func(string) *SearchFinderStat
- func SafeRename(src, dst string) error
- func SaveCmdConfig(dir string, conf *ConfigFile) error
- func TriKeys(s string) (result []uint64)
- func TrimFilePathSuffix(path string) string
- func Untar(tarName, xpath string) (err error)
- type BufWriterIO
- type ChainProc
- type ColGetter
- type Column
- type CompareStatus
- type CondFn
- type CondOp
- type CondStat
- type CondType
- type ConfigBase
- type ConfigFile
- type ConfigIndex
- type ConfigResultFn
- type CountFn
- type Decoder
- type DistanceOfStringArg
- type File
- type FileList
- type GetColumn
- type GlobCache
- func (g *GlobCache) Add(key, value string)
- func (g *GlobCache) Finish(key string)
- func (g *GlobCache) Get(pat string) *query.PathInfoList
- func (g *GlobCache) GetCh(pat string) <-chan string
- func (g *GlobCache) PrepareRead(pat string) *query.PathInfoList
- func (g GlobCache) Run(key string)
- func (g *GlobCache) Start() error
- type GlobRequest
- type HookRecordList
- type IdxCache
- type IdxCaches
- type IdxInfo
- type IdxPathInfo
- type IdxWriter
- type IndexFile
- func (f IndexFile) Column() *Column
- func (f *IndexFile) CountNearByKeyFn(key uint64, less bool) CountFn
- func (f *IndexFile) FindByKey(key uint64) (result []*IndexFile)
- func (f *IndexFile) FindNearByKey(key uint64, less bool) (results []*IndexFile)
- func (f *IndexFile) First() *IndexFile
- func (f *IndexFile) FirstRecord() *Record
- func (f *IndexFile) IdxInfo() IndexPathInfo
- func (f *IndexFile) Init()
- func (f *IndexFile) IsType(t IndexFileType) bool
- func (f *IndexFile) KeyRecord() *query.InvertedMapNum
- func (f *IndexFile) KeyRecords() *query.KeyRecordList
- func (f *IndexFile) Last() *IndexFile
- func (f *IndexFile) LastRecord() *Record
- func (f *IndexFile) OldKeyRecords() *query.KeyRecordList
- func (f *IndexFile) RecordByKey2(key uint64) RecordFn
- func (f *IndexFile) RecordNearByKeyFn(key uint64, less bool) RecordFn
- func (f *IndexFile) ResetCache()
- func (f *IndexFile) Select(opts ...SelectOption) (err error)
- type IndexFileMerged
- type IndexFileType
- type IndexMergeFileType
- type IndexPathInfo
- type Indexer
- type InfoFn
- type KeyDistance
- type KeySetter
- type LogLevel
- type NearsByQueryType
- type OptMergeIndexFile
- type OptResultFn
- type Option
- type OptionMergeIndexFile
- type Outputer
- type ParentDirs
- type ProgressBar
- type Range
- type RangeCur
- type Record
- func (r *Record) Cache() map[string]interface{}
- func (r *Record) IsExist(c *Column) bool
- func (r *Record) Raw(c *Column) (data []byte)
- func (r *Record) StrValue(c *Column) string
- func (r *Record) ToFbs(inf interface{}) []byte
- func (r *Record) Uint64Value(c *Column) uint64
- func (r *Record) Write(c *Column) error
- type RecordChFn
- type RecordFn
- type RecordInfoArg
- type RecordPos
- type Records
- type ResultFn
- type RowIndex
- type ScoreOfDistance
- type SearchCond
- func (cond *SearchCond) CancelAndWait()
- func (cond *SearchCond) Column() *Column
- func (f *SearchCond) CountOfKey(key uint64, cname string) (cnt int)
- func (cond *SearchCond) EnableStats(t bool)
- func (cond *SearchCond) FindBy(col string, kInf interface{}) (sfinder *SearchFinder)
- func (cond *SearchCond) IndexFile() *IndexFile
- func (f *SearchCond) Match(s string) *SearchFinder
- func (f *SearchCond) Nears(src string, cname string) ([]*Record, []ScoreOfDistance)
- func (f *SearchCond) Query(s string) (r *SearchFinder)
- func (cond *SearchCond) ReloadFileList()
- func (cond *SearchCond) Select(fn func(SearchElem) bool) (sfinder *SearchFinder)
- func (cond *SearchCond) StartMerging()
- func (cond *SearchCond) Stats() []CondStat
- type SearchElem
- type SearchFinder
- func (sf *SearchFinder) All(opts ...SearchFinderOpt) interface{}
- func (sf *SearchFinder) And(i int, key uint64) (result SkipFn)
- func (sf *SearchFinder) AndWithColumn(i int, key uint64, col *Column) (result SkipFn)
- func (sf *SearchFinder) Count() (cnt int)
- func (sf *SearchFinder) First(opts ...SearchFinderOpt) interface{}
- func (sf *SearchFinder) Last(opts ...SearchFinderOpt) interface{}
- func (sf *SearchFinder) Limit(n int) *SearchFinder
- func (sf *SearchFinder) MergeAsAnd(src *SearchFinder)
- func (sf *SearchFinder) Records() (recs []*query.Record)
- func (sf *SearchFinder) Stats() []*SearchFinderStat
- func (sf *SearchFinder) Stop()
- type SearchFinderOpt
- type SearchFinderStat
- type SearchFn
- type SearchMode
- type SelectOpt
- type SelectOptType
- type SelectOption
- type SkipFn
- type SkipType
- type StatusKeyRecord
- type TraverseFn
- type ValueGetter
- type WriterChFn
- type WriterFn
Constants ¶
const ( RECORD_WRITING byte = iota RECORD_WRITTEN RECORD_MERGING RECORD_MERGED )
const ( JsonOutput = iota MapInfOutput )
const ( // OuterKeyRecord ... not found status to search KeyRecord OuterKeyRecord = 1 << iota // FoundSameKeyRecord undocumented FoundSameKeyRecord // InnerKeyRecord undocumented InnerKeyRecord )
const ( KeyStateGot int = 1 // KeyStateRun int = 2 // KeyStateFlase int = 3 KeyStateFinish int = 4 )
const ( MAX_IDX_CACHE = 512 MIN_NEGATIVE_CACHE = 8 )
const (
RECORDS_INIT = 64
)
Variables ¶
var ( ErrInvalidTableName = errors.New("table name is invalid") ErrNotFoundFile = errors.New("file not found") ErrInvalidIdxName = errors.New("idx file name is invalid") ErrNotHasColumn = errors.New("record dosent have this column") ErrNotIndexDir = errors.New("Indexfile must be Index top directory") ErrStopTraverse = errors.New("stop traverse") ErrParameterInvalid = errors.New("parameter invalid") ErrNotSupported = errors.New("not supported") ErrMustCsvHeader = errors.New("not set csv header") )
var CsvHeader string
var DefaultDecoder []Decoder = []Decoder{ Decoder{ FileType: "csv", Encoder: func(v interface{}) ([]byte, error) { return json.Marshal(v) }, Decoder: func(raw []byte, v interface{}) error { return nil }, Tokenizer: func(ctx context.Context, rio io.Reader, f *File) <-chan *Record { ch := make(chan *Record, 5) go func() { buf, err := ioutil.ReadAll(rio) if err != nil { defer close(ch) } s := string(buf) lines := strings.Split(s, "\n") CsvHeader = lines[0] lines = lines[1:] cur := len(CsvHeader) + 1 for _, line := range lines { ch <- &Record{fileID: f.id, offset: int64(cur), size: int64(len(line))} cur += len(line) + 1 } close(ch) }() return ch }, }, Decoder{ FileType: "json", Encoder: func(v interface{}) ([]byte, error) { b, e := json.Marshal(v) if e != nil { return b, e } var out bytes.Buffer json.Indent(&out, b, "", "\t") return out.Bytes(), e }, Decoder: func(raw []byte, v interface{}) error { e := json.Unmarshal(raw, v) if e != nil { return e } if value, ok := v.(*(map[string]interface{})); ok { for key, v := range *value { if f64, ok := v.(float64); ok { (*value)[key] = uint64(f64) } } } return nil }, Tokenizer: func(ctx context.Context, rio io.Reader, f *File) <-chan *Record { ch := make(chan *Record, 100) go func() { dec := json.NewDecoder(rio) var rec *Record nest := int(0) defer close(ch) for { token, err := dec.Token() if err == io.EOF { break } switch token { case json.Delim('{'): nest++ if nest == 1 { rec = &Record{fileID: f.id, offset: dec.InputOffset() - 1} } case json.Delim('}'): nest-- if nest == 0 { rec.size = dec.InputOffset() - rec.offset ch <- rec } } select { case <-ctx.Done(): return default: } } }() return ch }, }, }
var GGlobCache map[string][]string = map[string][]string{}
var LogWriter io.StringWriter = os.Stderr
var Opt optionState = optionState{ // contains filtered or unexported fields }
var StringOp map[string]CondOp = map[string]CondOp{ "==": CondOpEq, "<=": CondOpLe, "<": CondOpLt, ">=": CondOpGe, ">": CondOpGe, }
var ZERO_TIME time.Time = time.Time{}
Functions ¶
func BsearchInKeyRecord ¶ added in v0.2.2
func ColumnPathWithStatus ¶
ColumnPathWithStatus undocumented
func FileListPath ¶
func FileListPathWithAdding ¶
func IsEqQRecord ¶ added in v0.1.7
func LessEqString ¶
LessEqString ... compare strings . if equal or less , return true
func LogIsDebug ¶ added in v0.1.7
func LogIsDebug() bool
func MakeKRLessFn ¶ added in v0.3.1
func MakeKRLessFn(krList *query.KeyRecordList) func(i, j int) bool
func MakeLessFn ¶ added in v0.3.1
func MakeLessFn(recs *query.RecordList) func(i, j int) bool
func MakeSearchInxexFn ¶ added in v0.3.1
func MergeKerRecordList ¶ added in v0.2.5
func MergeKerRecordList(oKrLists ...*query.KeyRecordList) (dst *query.KeyRecordList, e error)
func MesureElapsed ¶ added in v0.1.7
func MesureElapsedToStat ¶ added in v0.2.3
func MesureElapsedToStat() func(string) *SearchFinderStat
func SafeRename ¶
func SaveCmdConfig ¶ added in v0.1.14
func SaveCmdConfig(dir string, conf *ConfigFile) error
SaveCmdConfig undocumented
func TrimFilePathSuffix ¶
Types ¶
type BufWriterIO ¶
func NewBufWriterIO ¶
func NewBufWriterIO(o *os.File, n int) *BufWriterIO
func (*BufWriterIO) Flush ¶
func (b *BufWriterIO) Flush() (e error)
type Column ¶
type Column struct { Table string Name string Dir string Flist *FileList IsNum bool Dirties Records // contains filtered or unexported fields }
Column undocumented
func (*Column) CleanDirTest ¶ added in v0.1.14
CleanDirTest undocumented
func (*Column) RecordEqInt ¶
RecordEqInt undocumented
type CompareStatus ¶ added in v0.2.5
type CompareStatus byte
CompareStatus undocumented
const ( RecordLS CompareStatus = 0 RecordEQ CompareStatus = 1 RecordGT CompareStatus = 2 RecordErr CompareStatus = 3 )
func CompareRecord ¶ added in v0.2.5
func CompareRecord(src, dst *query.Record) (CompareStatus, error)
CompareRecord undocumented
type ConfigBase ¶ added in v0.1.14
ConfigBase undocumented
type ConfigFile ¶ added in v0.1.14
type ConfigFile struct {
Name2Index map[string]*ConfigIndex
}
ConfigFile undocumented
func LoadCmdConfig ¶ added in v0.1.14
func LoadCmdConfig(dir string) (*ConfigFile, error)
LoadCmdConfig undocumented
type ConfigIndex ¶ added in v0.1.14
type ConfigIndex struct { Path string ConfigBase }
ConfigIndex undocumented
type ConfigResultFn ¶ added in v0.2.7
type ConfigResultFn struct {
// contains filtered or unexported fields
}
ConfigResultFn ... configuration for ResultFn
var DefaultCofigResultFn ConfigResultFn = ConfigResultFn{/* contains filtered or unexported fields */}
DefaultCofigResultFn ... default configuration of CofigResultFn
type Decoder ¶
type Decoder struct { FileType string Decoder func([]byte, interface{}) error Encoder func(interface{}) ([]byte, error) Tokenizer func(context.Context, io.Reader, *File) <-chan *Record }
func GetDecoder ¶
GetDecoder ... return format Decoder/Encoder from fname(file name)
type DistanceOfStringArg ¶ added in v0.3.1
type DistanceOfStringArg func(s map[uint64]map[uint64]KeyDistance) map[uint64]map[uint64]KeyDistance
func OptCache ¶ added in v0.3.1
func OptCache(cache map[uint64]map[uint64]KeyDistance) DistanceOfStringArg
type File ¶
type File struct {
// contains filtered or unexported fields
}
func FileFromFbs ¶
type GlobCache ¶
type GlobCache struct { Keys []string ReqCh chan GlobRequest // contains filtered or unexported fields }
func (*GlobCache) PrepareRead ¶
func (g *GlobCache) PrepareRead(pat string) *query.PathInfoList
type GlobRequest ¶
type GlobRequest struct {
// contains filtered or unexported fields
}
type HookRecordList ¶ added in v0.2.5
type HookRecordList struct {
*query.RecordList
}
HookRecordList ... to extend query.RecordList in this package.
func (HookRecordList) InsertWithKeepSort ¶ added in v0.2.5
func (hl HookRecordList) InsertWithKeepSort(rec *query.Record, idx int)
InsertWithKeepSort ... insert query.Record with order of sort.
type IdxCaches ¶
type IdxCaches struct {
// contains filtered or unexported fields
}
IdxCaches undocumented
type IdxInfo ¶
type IdxInfo struct {
// contains filtered or unexported fields
}
IdxInfo undocumented
type IdxPathInfo ¶
type IdxPathInfo string
func (IdxPathInfo) Greater ¶
func (s IdxPathInfo) Greater(d IdxPathInfo) bool
func (IdxPathInfo) Info ¶
func (p IdxPathInfo) Info() (col string, isNum bool, first, last, fileID uint64, offset int64)
func (IdxPathInfo) IsMerged ¶
func (p IdxPathInfo) IsMerged() bool
func (IdxPathInfo) Less ¶
func (s IdxPathInfo) Less(d IdxPathInfo) bool
col, isNum, first, last, fileID , offset
func (IdxPathInfo) TDir ¶
func (p IdxPathInfo) TDir() string
func (IdxPathInfo) Table ¶
func (p IdxPathInfo) Table() string
type IndexFile ¶
type IndexFile struct { Path string Ftype IndexFileType // contains filtered or unexported fields }
IndexFile ... file entity of index file in index table directories
func ListMergedIndex ¶ added in v0.1.2
func ListMergedIndex(c *Column, fn CondFn, opts ...SelectOption) (result []*IndexFile)
ListMergedIndex ... return all merged index
func NewIndexFile ¶
NewIndexFile ... make new IndexFile
func (*IndexFile) CountNearByKeyFn ¶ added in v0.1.18
CountNearByKeyFn ... return function count to matching near
func (*IndexFile) FindNearByKey ¶
func (*IndexFile) IdxInfo ¶
func (f *IndexFile) IdxInfo() IndexPathInfo
func (*IndexFile) IsType ¶
func (f *IndexFile) IsType(t IndexFileType) bool
IsType ... check by IndexFileType
func (*IndexFile) KeyRecord ¶
func (f *IndexFile) KeyRecord() *query.InvertedMapNum
func (*IndexFile) KeyRecords ¶
func (f *IndexFile) KeyRecords() *query.KeyRecordList
KeyRecords ... return KeyRecordList from flatbuffers
func (*IndexFile) OldKeyRecords ¶ added in v0.3.1
func (f *IndexFile) OldKeyRecords() *query.KeyRecordList
func (*IndexFile) RecordByKey2 ¶ added in v0.1.8
RecordByKey2 ... return function getting slice of query.Record Deprecated: RecordByKey
should use recordByKey
func (*IndexFile) RecordNearByKeyFn ¶ added in v0.1.18
RecordNearByKeyFn ... return function near matching of query.Record
func (*IndexFile) ResetCache ¶ added in v0.3.1
func (f *IndexFile) ResetCache()
ResetCache ... reset cache and close io for caching
func (*IndexFile) Select ¶
func (f *IndexFile) Select(opts ...SelectOption) (err error)
Select .. search indexfile by SelectOption
type IndexFileMerged ¶ added in v0.2.5
type IndexFileMerged struct { *IndexFile State IndexMergeFileType // contains filtered or unexported fields }
IndexFileMerged ... accessor for merge type index file
func MakeMergedIndexFile ¶ added in v0.2.5
func MakeMergedIndexFile(opts ...OptMergeIndexFile) *IndexFileMerged
func OpenIndexFileMerged ¶ added in v0.2.5
func OpenIndexFileMerged(table, column, path string, idxer *Indexer) *IndexFileMerged
OpenIndexFileMerged ... return IndexFileMerged
func ToIndexFileMerged ¶ added in v0.2.5
func ToIndexFileMerged(l *IndexFile) *IndexFileMerged
ToIndexFileMerged ... convert to IndexFileMerged
func (*IndexFileMerged) Chain ¶ added in v0.2.5
func (m *IndexFileMerged) Chain(procs ...ChainProc)
func (*IndexFileMerged) Merge ¶ added in v0.2.5
func (m *IndexFileMerged) Merge(srcs ...*IndexFileMerged) (dst *IndexFileMerged, e error)
Merge ... Join multiple index merged file
func (*IndexFileMerged) Split ¶ added in v0.2.5
func (m *IndexFileMerged) Split(cnt int) (dsts []*IndexFileMerged, e error)
Split ... split merged index file.
func (*IndexFileMerged) Write ¶ added in v0.2.5
func (m *IndexFileMerged) Write() (e error)
type IndexFileType ¶
type IndexFileType int
IndexFileType ... type of Index File
const ( // IdxFileTypeNoInit ... default on init IdxFileTypeNoInit IndexFileType = 0 // IdxFileTypeNone ... default on init IdxFileTypeNone IndexFileType = 1 << iota // IdxFileTypeDir ... directory IdxFileTypeDir // IdxFileTypeMerge ... merged(multiple) index file IdxFileTypeMerge // IdxFileTypeWrite ... single index file IdxFileTypeWrite // IdxFileTypeMyColum undocumented IdxFileTypeMyColum // IdxFileTypeNoComplete ... index file is not completed IdxFileTypeNoComplete )
type IndexMergeFileType ¶ added in v0.2.5
type IndexMergeFileType int
IndexMergeFileType .. type of Merge Index File
const ( IdxMergedFileState_None IndexMergeFileType = 0 IdxMergedFileState_Writing IndexMergeFileType = 1 << iota IdxMergedFileState_Writen IdxMergedFileState_Dirty )
type IndexPathInfo ¶
type IndexPathInfo struct {
// contains filtered or unexported fields
}
IndexPathInfo undocumented
func NewIndexInfo ¶
func NewIndexInfo(fileID uint64, offset int64, first uint64, last uint64) IndexPathInfo
NewIndexInfo undocumented
type Indexer ¶
type Indexer struct { Root string Cols map[string]*Column // contains filtered or unexported fields }
type InfoFn ¶ added in v0.1.8
type InfoFn func(RecordInfoArg)
InfoFn ... function to find record infomation
type KeyDistance ¶ added in v0.3.1
type NearsByQueryType ¶ added in v0.3.1
type NearsByQueryType byte
const ( ScoreOnly NearsByQueryType = 1 WithRecord NearsByQueryType = 2 )
type OptMergeIndexFile ¶ added in v0.2.5
type OptMergeIndexFile func(opt *OptionMergeIndexFile)
func OptMergefileRange ¶ added in v0.2.5
func OptMergefileRange(first, last uint64) OptMergeIndexFile
func OptPath ¶ added in v0.2.5
func OptPath(table, column, path string) OptMergeIndexFile
type OptResultFn ¶ added in v0.2.7
type OptResultFn func(*ConfigResultFn)
OptResultFn ... option of ResultFn
func OptFilterWithFile ¶ added in v0.2.7
func OptFilterWithFile(fileID uint64, offset int64) OptResultFn
OptFilterWithFile ... filter by Record infomation of ResultFn
type Option ¶
type Option func(*optionState)
type ReaderOpt map[string]string
func EnableCleanAfterMerge ¶ added in v0.1.12
func MergeDuration ¶
func MergeOnSearch ¶
MergeOnSearch ... enable to merge index on search
func ReaderColumn ¶
ReaderColumn ... config for columname for search/read
func RegitConcurrent ¶
func UseBsearch ¶ added in v0.2.2
type OptionMergeIndexFile ¶ added in v0.2.5
type OptionMergeIndexFile struct {
// contains filtered or unexported fields
}
func OptDefaultMergeIndexFile ¶ added in v0.2.5
func OptDefaultMergeIndexFile() OptionMergeIndexFile
type ParentDirs ¶ added in v0.1.14
type ParentDirs struct {
// contains filtered or unexported fields
}
ParentDirs undocumented
func NewParentDirs ¶ added in v0.1.14
func NewParentDirs(base string, dirs []string) (pdirs ParentDirs)
NewParentDirs undocumented
func (ParentDirs) Has ¶ added in v0.1.14
func (pdir ParentDirs) Has(dir string) bool
Has undocumented
type ProgressBar ¶
type ProgressBar struct {
// contains filtered or unexported fields
}
var Pbar ProgressBar = NewProgressBar()
func NewProgressBar ¶
func NewProgressBar(opts ...mpb.ContainerOption) (bar ProgressBar)
func (*ProgressBar) Add ¶
func (p *ProgressBar) Add(name string, total int) (bar *mpb.Bar)
func (*ProgressBar) Done ¶
func (p *ProgressBar) Done()
type Record ¶
type Record struct {
// contains filtered or unexported fields
}
func RecordFromFbs ¶
func (*Record) Uint64Value ¶
type RecordChFn ¶ added in v0.2.5
RecordChFn ... function to retrun record slices via chan
type RecordInfoArg ¶ added in v0.1.8
type RecordInfoArg struct {
// contains filtered or unexported fields
}
RecordInfoArg ... params for InfoFn
type RecordPos ¶
type RecordPos struct {
// contains filtered or unexported fields
}
RecordPos undocumented
type ResultFn ¶ added in v0.1.8
type ResultFn func(SkipFn, ...OptResultFn)
ResultFn ... function to find record with SkipFn
type RowIndex ¶
type RowIndex struct {
// contains filtered or unexported fields
}
RowIndex undocumented
type ScoreOfDistance ¶ added in v0.3.1
type ScoreOfDistance struct { Distance float64 KeyScores map[uint64]map[uint64]KeyDistance }
ScoreOfDistance ... distance infomation between strings.
type SearchCond ¶
type SearchCond struct { Err error // contains filtered or unexported fields }
SearchCond .. saerch condition object.
func NewSearchCond ¶ added in v0.3.1
func NewSearchCond() *SearchCond
func (*SearchCond) CancelAndWait ¶
func (cond *SearchCond) CancelAndWait()
CancelAndWait ... wait for canceld backgraound routine( mainly merging index)
func (*SearchCond) Column ¶
func (cond *SearchCond) Column() *Column
func (*SearchCond) CountOfKey ¶ added in v0.3.1
func (f *SearchCond) CountOfKey(key uint64, cname string) (cnt int)
func (*SearchCond) EnableStats ¶ added in v0.3.1
func (cond *SearchCond) EnableStats(t bool)
func (*SearchCond) FindBy ¶
func (cond *SearchCond) FindBy(col string, kInf interface{}) (sfinder *SearchFinder)
func (*SearchCond) IndexFile ¶ added in v0.1.12
func (cond *SearchCond) IndexFile() *IndexFile
func (*SearchCond) Match ¶
func (f *SearchCond) Match(s string) *SearchFinder
func (*SearchCond) Nears ¶ added in v0.3.1
func (f *SearchCond) Nears(src string, cname string) ([]*Record, []ScoreOfDistance)
func (*SearchCond) Query ¶
func (f *SearchCond) Query(s string) (r *SearchFinder)
func (*SearchCond) ReloadFileList ¶ added in v0.1.9
func (cond *SearchCond) ReloadFileList()
func (*SearchCond) Select ¶ added in v0.1.8
func (cond *SearchCond) Select(fn func(SearchElem) bool) (sfinder *SearchFinder)
func (*SearchCond) StartMerging ¶
func (cond *SearchCond) StartMerging()
func (*SearchCond) Stats ¶ added in v0.3.1
func (cond *SearchCond) Stats() []CondStat
type SearchElem ¶ added in v0.1.8
type SearchElem struct { Column ColGetter // contains filtered or unexported fields }
func (SearchElem) Op ¶ added in v0.1.8
func (cond SearchElem) Op(col, op string, v interface{}) (result bool)
type SearchFinder ¶
type SearchFinder struct {
// contains filtered or unexported fields
}
SearchFinder ... FInder for query search
func NewSearchFinder ¶ added in v0.1.8
func NewSearchFinder(c *Column) *SearchFinder
func (*SearchFinder) All ¶
func (sf *SearchFinder) All(opts ...SearchFinderOpt) interface{}
func (*SearchFinder) AndWithColumn ¶ added in v0.2.0
func (sf *SearchFinder) AndWithColumn(i int, key uint64, col *Column) (result SkipFn)
func (*SearchFinder) Count ¶ added in v0.1.8
func (sf *SearchFinder) Count() (cnt int)
func (*SearchFinder) First ¶
func (sf *SearchFinder) First(opts ...SearchFinderOpt) interface{}
func (*SearchFinder) Last ¶
func (sf *SearchFinder) Last(opts ...SearchFinderOpt) interface{}
func (*SearchFinder) Limit ¶ added in v0.1.8
func (sf *SearchFinder) Limit(n int) *SearchFinder
func (*SearchFinder) MergeAsAnd ¶ added in v0.1.11
func (sf *SearchFinder) MergeAsAnd(src *SearchFinder)
func (*SearchFinder) Records ¶
func (sf *SearchFinder) Records() (recs []*query.Record)
func (*SearchFinder) Stats ¶ added in v0.2.3
func (sf *SearchFinder) Stats() []*SearchFinderStat
func (*SearchFinder) Stop ¶ added in v0.2.6
func (sf *SearchFinder) Stop()
type SearchFinderOpt ¶ added in v0.2.3
type SearchFinderOpt func(*SearchFinder)
SearchFinderOpt ... Option for SearchFinder
func OptQueryStat ¶ added in v0.2.3
func OptQueryStat(t bool) SearchFinderOpt
OptQueryStat ... enable stats option in SearchFinder
func OptQueryUseChan ¶ added in v0.2.5
func OptQueryUseChan(t bool) SearchFinderOpt
func ResultFnOutput ¶ added in v0.3.1
func ResultFnOutput(w WriterFn, wCh WriterChFn) SearchFinderOpt
ResultFnOutput ... set output function for SearchFinder
func ResultOutput ¶
func ResultOutput(name string) SearchFinderOpt
ResultOutput ... output option for SearchFinder
func ResultStreamt ¶ added in v0.2.5
func ResultStreamt(t bool) SearchFinderOpt
type SearchFinderStat ¶ added in v0.2.3
type SearchFinderStat struct { Name string // contains filtered or unexported fields }
SearchFinderStat ... stats for SearchFinder
type SearchFn ¶ added in v0.1.18
type SearchFn struct { RecFn RecordFn CntFn CountFn RecChFn RecordChFn // contains filtered or unexported fields }
SearchFn ... aggreate RecordFn and CountFn
type SearchMode ¶
type SearchMode byte
SearchMode undocumented
const ( SEARCH_INIT SearchMode = iota SEARCH_START SEARCH_ASC SEARCH_DESC SEARCH_ALL SEARCH_FINISH )
type SelectOpt ¶
type SelectOpt struct {
// contains filtered or unexported fields
}
SelectOpt ... sarch options for select.
func DefaultSelectOpt ¶ added in v0.2.5
func DefaultSelectOpt() SelectOpt
DefaultSelectOpt ... return default of SelectOption
type SelectOptType ¶ added in v0.2.5
type SelectOptType struct {
// contains filtered or unexported fields
}
SelectOptType ... spefify IndexFile type for Select()
type SelectOption ¶
type SelectOption func(*SelectOpt)
SelectOption ... for setting option parameter in Select()
func OptAsc ¶
func OptAsc(isAsc bool) SelectOption
OptAsc ... set option of order to search in Select()
func OptCcondFn ¶
func OptCcondFn(c CondFn) SelectOption
OptCcondFn ... set option of CondFn in Select()
func OptOnly ¶ added in v0.2.5
func OptOnly(t IndexFileType) SelectOption
OptOnly ... set option of index file type of Select()
func OptRange ¶
func OptRange(start, last uint64) SelectOption
OptRange ... set option of range Select()
func OptRecord ¶ added in v0.3.1
func OptRecord(fileID uint64, offset int64) SelectOption
OptRecord ... filter by Record infomation of index file type of Select()
func OptTraverse ¶
func OptTraverse(fn TraverseFn) SelectOption
OptTraverse ... set option of TraverseFnin Select()
type StatusKeyRecord ¶ added in v0.2.5
type StatusKeyRecord uint8
StatusKeyRecord undocumented
func SearchIndexToStatus ¶ added in v0.2.5
func SearchIndexToStatus(krList *query.RecordList, rec *query.Record, idx int) StatusKeyRecord
SearchIndexToStatus ... return status to searchIndex Record
type TraverseFn ¶
TraverseFn ... function to traverse in Select()
type ValueGetter ¶ added in v0.1.8
type ValueGetter func(string, CondOp) *SearchFinder