Documentation ¶
Index ¶
- Constants
- Variables
- func GetCondType(name string) (int, error)
- func WithCgoLimit(cgoLimit int) interface{}
- func WithConnPoolSize(connPoolSize int) interface{}
- func WithRetryAttempts(read int, write int) interface{}
- func WithServerConfig(startupTimeout time.Duration, serverConfig *config.ServerConfig) interface{}
- type AggregationResult
- type DBConfigItem
- type DBLogQueriesConfig
- type DBProfilingConfig
- type DeepCopy
- type ExplainResults
- type FtFastConfig
- type FtFuzzyConfig
- type IndexDef
- type IndexDescription
- type Iterator
- func (it *Iterator) AggResults() (v []AggregationResult)
- func (it *Iterator) AllowUnsafe(allow bool) *Iterator
- func (it *Iterator) Close()
- func (it *Iterator) Count() int
- func (it *Iterator) Error() error
- func (it *Iterator) FetchAll() (items []interface{}, err error)
- func (it *Iterator) FetchAllWithRank() (items []interface{}, ranks []int, err error)
- func (it *Iterator) FetchOne() (item interface{}, err error)
- func (it *Iterator) GetAggreatedValue(idx int) float64
- func (it *Iterator) GetExplainResults() (*ExplainResults, error)
- func (it *Iterator) HasRank() bool
- func (it *Iterator) JoinedObjects(field string) (objects []interface{}, err error)
- func (it *Iterator) Next() (hasNext bool)
- func (it *Iterator) Object() interface{}
- func (it *Iterator) Rank() int
- func (it *Iterator) TotalCount() int
- type JSONIterator
- func (it *JSONIterator) Close()
- func (it *JSONIterator) Count() int
- func (it *JSONIterator) Error() error
- func (it *JSONIterator) FetchAll() (json []byte, err error)
- func (it *JSONIterator) GetExplainResults() (*ExplainResults, error)
- func (it *JSONIterator) JSON() (json []byte)
- func (it *JSONIterator) Next() bool
- type JoinHandler
- type Joinable
- type Logger
- type NamespaceDescription
- type NamespaceMemStat
- type NamespaceOptions
- func (opts *NamespaceOptions) CacheAggressive() *NamespaceOptions
- func (opts *NamespaceOptions) CacheOff() *NamespaceOptions
- func (opts *NamespaceOptions) CacheOn() *NamespaceOptions
- func (opts *NamespaceOptions) DropOnFileFormatError() *NamespaceOptions
- func (opts *NamespaceOptions) DropOnIndexesConflict() *NamespaceOptions
- func (opts *NamespaceOptions) NoStorage() *NamespaceOptions
- type NamespacePerfStat
- type PerfStat
- type Query
- func (q *Query) Aggregate(index string, aggType int) *Query
- func (q *Query) CachedTotal(totalNames ...string) *Query
- func (q *Query) Debug(level int) *Query
- func (q *Query) Delete() (int, error)
- func (q *Query) Distinct(distinctIndex string) *Query
- func (q *Query) EqualPosition(fields ...string) *Query
- func (q *Query) Exec() *Iterator
- func (q *Query) ExecToJson(jsonRoots ...string) *JSONIterator
- func (q *Query) Explain() *Query
- func (q *Query) FetchCount(n int) *Query
- func (q *Query) Functions(fields ...string) *Query
- func (q *Query) Get() (item interface{}, found bool)
- func (q *Query) GetJson() (json []byte, found bool)
- func (q *Query) InnerJoin(q2 *Query, field string) *Query
- func (q *Query) Join(q2 *Query, field string) *Query
- func (q *Query) JoinHandler(field string, handler JoinHandler) *Query
- func (q *Query) LeftJoin(q2 *Query, field string) *Query
- func (q *Query) Limit(limitItems int) *Query
- func (q *Query) Match(index string, keys ...string) *Query
- func (q *Query) Merge(q2 *Query) *Query
- func (q *Query) MustExec() *Iterator
- func (q *Query) Not() *Query
- func (q *Query) Offset(startOffset int) *Query
- func (q *Query) On(index string, condition int, joinIndex string) *Query
- func (q *Query) Or() *Query
- func (q *Query) ReqTotal(totalNames ...string) *Query
- func (q *Query) Select(fields ...string) *Query
- func (q *Query) SetContext(ctx interface{}) *Query
- func (q *Query) Sort(sortIndex string, desc bool, values ...interface{}) *Query
- func (q *Query) Where(index string, condition int, keys interface{}) *Query
- func (q *Query) WhereBool(index string, condition int, keys ...bool) *Query
- func (q *Query) WhereComposite(index string, condition int, keys ...interface{}) *Query
- func (q *Query) WhereDouble(index string, condition int, keys ...float64) *Query
- func (q *Query) WhereInt(index string, condition int, keys ...int) *Query
- func (q *Query) WhereInt32(index string, condition int, keys ...int32) *Query
- func (q *Query) WhereInt64(index string, condition int, keys ...int64) *Query
- func (q *Query) WhereString(index string, condition int, keys ...string) *Query
- type QueryPerfStat
- type Reindexer
- func (db *Reindexer) AddIndex(namespace string, indexDef ...IndexDef) error
- func (db *Reindexer) BeginTx(namespace string) (*Tx, error)
- func (db *Reindexer) Close()
- func (db *Reindexer) CloseNamespace(namespace string) error
- func (db *Reindexer) ConfigureIndex(namespace, index string, config interface{}) error
- func (db *Reindexer) Delete(namespace string, item interface{}, precepts ...string) error
- func (db *Reindexer) DescribeNamespace(namespace string) (*NamespaceDescription, error)
- func (db *Reindexer) DescribeNamespaces() ([]*NamespaceDescription, error)
- func (db *Reindexer) DropIndex(namespace, index string) error
- func (db *Reindexer) DropNamespace(namespace string) error
- func (db *Reindexer) EnableStorage(storagePath string) error
- func (db *Reindexer) ExecSQL(query string) *Iterator
- func (db *Reindexer) ExecSQLToJSON(query string) *JSONIterator
- func (db *Reindexer) GetMeta(namespace, key string) ([]byte, error)
- func (db *Reindexer) GetNamespaceMemStat(namespace string) (*NamespaceMemStat, error)
- func (db *Reindexer) GetNamespacesMemStat() ([]*NamespaceMemStat, error)
- func (db *Reindexer) GetStats() bindings.Stats
- func (db *Reindexer) GetUpdatedAt(namespace string) (*time.Time, error)
- func (db *Reindexer) Insert(namespace string, item interface{}, precepts ...string) (int, error)
- func (db *Reindexer) MustBeginTx(namespace string) *Tx
- func (db *Reindexer) OpenNamespace(namespace string, opts *NamespaceOptions, s interface{}) (err error)
- func (db *Reindexer) Ping() error
- func (db *Reindexer) PutMeta(namespace, key string, data []byte) error
- func (db *Reindexer) Query(namespace string) *Query
- func (db *Reindexer) QueryFrom(d dsl.DSL) (*Query, error)
- func (db *Reindexer) ResetStats()
- func (db *Reindexer) SetDefaultQueryDebug(namespace string, level int)
- func (db *Reindexer) SetLogger(log Logger)
- func (db *Reindexer) Status() error
- func (db *Reindexer) Update(namespace string, item interface{}, precepts ...string) (int, error)
- func (db *Reindexer) UpdateIndex(namespace string, indexDef IndexDef) error
- func (db *Reindexer) Upsert(namespace string, item interface{}, precepts ...string) error
- type Tx
- func (tx *Tx) Commit(updatedAt *time.Time) error
- func (tx *Tx) Delete(s interface{}) error
- func (tx *Tx) DeleteJSON(json []byte) error
- func (tx *Tx) Insert(s interface{}) (int, error)
- func (tx *Tx) MustCommit(updatedAt *time.Time)
- func (tx *Tx) Rollback() error
- func (tx *Tx) Update(s interface{}) (int, error)
- func (tx *Tx) Upsert(s interface{}) error
- func (tx *Tx) UpsertJSON(json []byte) error
Constants ¶
const ( ConfigNamespaceName = "#config" MemstatsNamespaceName = "#memstats" NamespacesNamespaceName = "#namespaces" PerfstatsNamespaceName = "#perfstats" QueriesperfstatsNamespaceName = "#queriesperfstats" )
const ( QuerySelectFunction = bindings.QuerySelectFunction QueryEqualPosition = bindings.QueryEqualPosition )
Constants for query serialization
const ( CollateNone = bindings.CollateNone CollateASCII = bindings.CollateASCII CollateUTF8 = bindings.CollateUTF8 CollateNumeric = bindings.CollateNumeric CollateCustom = bindings.CollateCustom )
const ( // Equal '=' EQ = bindings.EQ // Greater '>' GT = bindings.GT // Lower '<' LT = bindings.LT // Greater or equal '>=' (GT|EQ) GE = bindings.GE // Lower or equal '<' LE = bindings.LE // One of set 'IN []' SET = bindings.SET // All of set ALLSET = bindings.ALLSET // In range RANGE = bindings.RANGE // Any value ANY = bindings.ANY // Empty value (usualy zero len array) EMPTY = bindings.EMPTY )
Condition types
Variables ¶
var ( ErrEmptyNamespace = errors.New("rq: empty namespace name") ErrEmptyFieldName = errors.New("rq: empty field name in filter") ErrCondType = errors.New("rq: cond type not found") ErrOpInvalid = errors.New("rq: op is invalid") ErrNoPK = errors.New("rq: No pk field in struct") ErrWrongType = errors.New("rq: Wrong type of item") ErrMustBePointer = errors.New("rq: Argument must be a pointer to element, not element") ErrNotFound = errors.New("rq: Not found") ErrDeepCopyType = errors.New("rq: DeepCopy() returns wrong type") )
Functions ¶
func GetCondType ¶
func WithCgoLimit ¶ added in v1.9.3
func WithCgoLimit(cgoLimit int) interface{}
func WithConnPoolSize ¶ added in v1.9.3
func WithConnPoolSize(connPoolSize int) interface{}
func WithRetryAttempts ¶ added in v1.9.5
func WithServerConfig ¶ added in v1.9.6
func WithServerConfig(startupTimeout time.Duration, serverConfig *config.ServerConfig) interface{}
Types ¶
type AggregationResult ¶ added in v1.10.0
type DBConfigItem ¶ added in v1.9.3
type DBConfigItem struct { Type string `json:"type"` Profiling *DBProfilingConfig `json:"profiling,omitempty"` LogQueries *[]DBLogQueriesConfig `json:"log_queries,omitempty"` }
type DBLogQueriesConfig ¶ added in v1.9.3
type DBProfilingConfig ¶ added in v1.9.3
type ExplainResults ¶ added in v1.10.0
type ExplainResults struct { TotalUs int `json:"total_us"` PrepareUs int `json:"prepare_us"` IndexesUs int `json:"indexes_us"` PostprocessUS int `json:"postprocess_us"` LoopUs int `json:"loop_us"` SortIndex string `json:"sort_index"` Selectors []struct { Field string `json:"field"` Method string `json:"method"` Keys int `json:"keys"` Comparators int `json:"comparators"` Cost float32 `json:"cost"` Matched int `json:"matched"` } `json:"selectors"` }
ExplainResults presents query plan
type FtFastConfig ¶
type FtFastConfig struct { // boost of bm25 ranking. default value 1. Bm25Boost float64 `json:"bm25_boost"` // weight of bm25 rank in final rank. // 0: bm25 will not change final rank. // 1: bm25 will affect to final rank in 0 - 100% range Bm25Weight float64 `json:"bm25_weight"` // boost of search query term distance in found document. default vaule 1 DistanceBoost float64 `json:"distance_boost"` // weight of search query terms distance in found document in final rank. // 0: distance will not change final rank. // 1: distance will affect to final rank in 0 - 100% range DistanceWeight float64 `json:"distance_weight"` // boost of search query term length. default value 1 TermLenBoost float64 `json:"term_len_boost"` // weight of search query term length in final rank. // 0: term length will not change final rank. // 1: term length will affect to final rank in 0 - 100% range TermLenWeight float64 `json:"term_len_weight"` // Minimum rank of found documents MinRelevancy float64 `json:"min_relevancy"` // Maximum possible typos in word. // 0: typos is disabled, words with typos will not match // N: words with N possible typos will match // It is not recommended to set more than 1 possible typo: It will serously increase RAM usage, and decrease search speed MaxTyposInWord int `json:"max_typos_in_word"` // Maximum word length for building and matching variants with typos. Default value is 15 MaxTypoLen int `json:"max_typo_len"` // Maximum documents which will be processed in merge query results // Default value is 20000. Increasing this value may refine ranking // of queries with high frequency words MergeLimit int `json:"merge_limit"` // List of used stemmers Stemmers []string `json:"stemmers"` // Enable translit variants processing EnableTranslit bool `json:"enable_translit"` // Enable wrong keyboard layout variants processing EnableKbLayout bool `json:"enable_kb_layout"` // List of stop words. Words from this list will be ignored in documents and queries StopWords []string `json:"stop_words"` // Log level of full text search engine LogLevel int `json:"log_level"` // Enable search by numbers as words and backwards EnableNumbersSearch bool `json:"enable_numbers_search"` // Extra symbols, which will be threated as parts of word to addition to letters and digits ExtraWordSymbols string `json:"extra_word_symbols"` }
FtFastConfig configurarion of FullText search index
func DefaultFtFastConfig ¶
func DefaultFtFastConfig() FtFastConfig
type FtFuzzyConfig ¶
type FtFuzzyConfig struct { // max proc geting from src reqest MaxSrcProc float64 `json:"max_src_proc"` // max proc geting from dst reqest //usualy maxDstProc = 100 -MaxSrcProc but it's not nessary MaxDstProc float64 `json:"max_dst_proc"` // increse proc when found pos that are near between source and dst string (0.0001-2) PosSourceBoost float64 `json:"pos_source_boost"` // Minim coof for pos that are neaer in src and dst (0.0001-2) PosSourceDistMin float64 `json:"pos_source_dist_min"` // increse proc when found pos that are near in source string (0.0001-2) PosSourceDistBoost float64 `json:"pos_source_dist_boost"` // increse proc when found pos that are near in dst string (0.0001-2) PosDstBoost float64 `json:"pos_dst_boost"` // decrese proc when found not full thregramm - only start and end (0.0001-2) StartDecreeseBoost float64 `json:"start_decreese_boost"` // base decrese proc when found not full thregramm - only start and end (0.0001-2) StartDefaultDecreese float64 `json:"start_default_decreese"` // Min relevance to show reqest MinOkProc float64 `json:"min_ok_proc"` // size of gramm (1-10)- for example //terminator BufferSize=3 __t _te ter erm rmi ... //terminator BufferSize=4 __te _ter term ermi rmin BufferSize int `json:"buffer_size"` // size of space in start and end of gramm (0-9) - for example //terminator SpaceSize=2 __t _te ter ... tor or_ r__ //terminator SpaceSize=1 _te ter ... tor or_ SpaceSize int `json:"space_size"` // Maximum documents which will be processed in merge query results // Default value is 20000. Increasing this value may refine ranking // of queries with high frequency words MergeLimit int `json:"merge_limit"` // List of used stemmers Stemmers []string `json:"stemmers"` // Enable translit variants processing EnableTranslit bool `json:"enable_translit"` // Enable wrong keyboard layout variants processing EnableKbLayout bool `json:"enable_kb_layout"` // List of stop words. Words from this list will be ignored in documents and queries StopWords []string `json:"stop_words"` // Log level of full text search engine LogLevel int `json:"log_level"` // Extra symbols, which will be threated as parts of word to addition to letters and digits ExtraWordSymbols string `json:"extra_word_symbols"` }
FtFuzzyConfig configurarion of FuzzyFullText search index
func DefaultFtFuzzyConfig ¶
func DefaultFtFuzzyConfig() FtFuzzyConfig
type IndexDescription ¶
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator presents query results
func (*Iterator) AggResults ¶
func (it *Iterator) AggResults() (v []AggregationResult)
AggResults returns aggregation results (if present)
func (*Iterator) AllowUnsafe ¶
AllowUnsafe takes bool, that enable or disable unsafe behavior.
When AllowUnsafe is true and object cache is enabled resulting objects will not be copied for each query. That means possible race conditions. But it's good speedup, without overhead for copying.
By default reindexer guarantees that every object its safe to use in multithread.
func (*Iterator) Close ¶
func (it *Iterator) Close()
Close closes the iterator and freed CGO resources
func (*Iterator) FetchAll ¶
FetchAll returns all query results as slice []interface{} and closes the iterator.
func (*Iterator) FetchAllWithRank ¶
FetchAllWithRank returns resulting slice of objects and slice of objects ranks. Closes iterator after use.
func (*Iterator) FetchOne ¶
FetchOne returns first element and closes the iterator. When it's impossible (count is 0) err will be ErrNotFound.
func (*Iterator) GetAggreatedValue ¶
GetAggreatedValue - Return aggregation sum of field
func (*Iterator) GetExplainResults ¶ added in v1.10.0
func (it *Iterator) GetExplainResults() (*ExplainResults, error)
GetExplainResults returns JSON bytes with explain results
func (*Iterator) JoinedObjects ¶
JoinedObjects returns objects slice, that result of join for the given field
func (*Iterator) Next ¶
Next moves iterator pointer to the next element. Returns bool, that indicates the availability of the next elements.
func (*Iterator) Object ¶
func (it *Iterator) Object() interface{}
Object returns current object. Will panic when pointer was not moved, Next() must be called before.
func (*Iterator) Rank ¶
Rank returns current object search rank. Will panic when pointer was not moved, Next() must be called before.
func (*Iterator) TotalCount ¶
TotalCount returns total count of objects (ignoring conditions of limit and offset)
type JSONIterator ¶
type JSONIterator struct {
// contains filtered or unexported fields
}
JSONIterator its iterator, but results presents as json documents
func (*JSONIterator) Count ¶
func (it *JSONIterator) Count() int
Count returns count if query results
func (*JSONIterator) Error ¶
func (it *JSONIterator) Error() error
Error returns query error if it's present.
func (*JSONIterator) FetchAll ¶
func (it *JSONIterator) FetchAll() (json []byte, err error)
FetchAll returns bytes slice it's JSON array with results
func (*JSONIterator) GetExplainResults ¶ added in v1.10.0
func (it *JSONIterator) GetExplainResults() (*ExplainResults, error)
GetExplainResults returns JSON bytes with explain results
func (*JSONIterator) JSON ¶
func (it *JSONIterator) JSON() (json []byte)
JSON returns JSON bytes with current document
func (*JSONIterator) Next ¶
func (it *JSONIterator) Next() bool
Next moves iterator pointer to the next element. Returns bool, that indicates the availability of the next elements.
type JoinHandler ¶
JoinHandler it's function for handle join results. Returns bool, that indicates is values will be applied to structs.
type Joinable ¶
type Joinable interface {
Join(field string, subitems []interface{}, context interface{})
}
Interface for append joined items
type NamespaceDescription ¶
type NamespaceDescription struct { Name string `json:"name"` Indexes []IndexDescription `json:"indexes"` StorageEnabled bool `json:"storage_enabled"` }
type NamespaceMemStat ¶ added in v1.9.3
type NamespaceMemStat struct { Name string `json:"name"` StorageError string `json:"storage_error"` StoragePath string `json:"storage_path"` StorageOK bool `json:"storage_ok"` UpdatedUnixNano int64 `json:"updated_unix_nano"` ItemsCount int64 `json:"items_count,omitempty"` EmptyItemsCount int64 `json:"empty_items_count"` DataSize int64 `json:"data_size"` Total struct { DataSize int `json:"data_size"` IndexesSize int `json:"indexes_size"` CacheSize int `json:"cache_size"` } }
type NamespaceOptions ¶
type NamespaceOptions struct {
// contains filtered or unexported fields
}
NamespaceOptions is options for namespace
func DefaultNamespaceOptions ¶
func DefaultNamespaceOptions() *NamespaceOptions
DefaultNamespaceOptions return defailt namespace options
func (*NamespaceOptions) CacheAggressive ¶ added in v1.9.2
func (opts *NamespaceOptions) CacheAggressive() *NamespaceOptions
func (*NamespaceOptions) CacheOff ¶ added in v1.9.2
func (opts *NamespaceOptions) CacheOff() *NamespaceOptions
func (*NamespaceOptions) CacheOn ¶ added in v1.9.2
func (opts *NamespaceOptions) CacheOn() *NamespaceOptions
func (*NamespaceOptions) DropOnFileFormatError ¶
func (opts *NamespaceOptions) DropOnFileFormatError() *NamespaceOptions
func (*NamespaceOptions) DropOnIndexesConflict ¶
func (opts *NamespaceOptions) DropOnIndexesConflict() *NamespaceOptions
func (*NamespaceOptions) NoStorage ¶
func (opts *NamespaceOptions) NoStorage() *NamespaceOptions
type NamespacePerfStat ¶ added in v1.9.3
type PerfStat ¶ added in v1.9.3
type PerfStat struct { TotalQueriesCount int64 `json:"total_queries_count"` TotalAvgLatencyUs int64 `json:"total_avg_latency_us"` TotalAvgLockTimeUs int64 `json:"total_avg_lock_time_us"` LastSecQPS int64 `json:"last_sec_qps"` LastSecAvgLatencyUs int64 `json:"last_sec_avg_latency_us"` LastSecAvgLockTimeUs int64 `json:"last_sec_avg_lock_time_us"` }
type Query ¶
type Query struct { Namespace string // contains filtered or unexported fields }
Query to DB object
func (*Query) CachedTotal ¶
CachedTotal Request cached total items calculation
func (*Query) Delete ¶
Delete will execute query, and delete items, matches query On sucess return number of deleted elements
func (*Query) EqualPosition ¶ added in v1.10.0
Adds equal position fields to arrays
func (*Query) ExecToJson ¶
func (q *Query) ExecToJson(jsonRoots ...string) *JSONIterator
ExecAsJson will execute query, and return iterator
func (*Query) FetchCount ¶ added in v1.5.0
FetchCount sets the number of items that will be fetched by one operation When n <= 0 query will fetch all results in one operation
func (*Query) InnerJoin ¶
InnerJoin joins 2 queries - items from 1-st query are expanded with data from joined query
func (*Query) JoinHandler ¶
func (q *Query) JoinHandler(field string, handler JoinHandler) *Query
JoinHandler sets handler for join results
func (*Query) LeftJoin ¶
LeftJoin joins 2 queries = - items from 1-st query are filtered and expanded with data from 2-nd query
func (*Query) SetContext ¶
SetContext set interface, which will be passed to Joined interface
func (*Query) Sort ¶
Sort - Apply sort order to returned from query items If values argument specified, then items equal to values, if found will be placed in the top positions For composite indexes values must be []interface{}, with value of each subindex
func (*Query) Where ¶
Where - Add where condition to DB query For composite indexes keys must be []interface{}, with value of each subindex
func (*Query) WhereComposite ¶ added in v1.9.2
WhereComposite - Add where condition to DB query with interface args for composite indexes
func (*Query) WhereDouble ¶
WhereDouble - Add where condition to DB query with float args
func (*Query) WhereInt32 ¶ added in v1.10.0
WhereInt - Add where condition to DB query with int args
func (*Query) WhereInt64 ¶
WhereInt64 - Add where condition to DB query with int64 args
type QueryPerfStat ¶ added in v1.9.3
type Reindexer ¶
type Reindexer struct {
// contains filtered or unexported fields
}
Reindexer The reindxer state struct
func NewReindex ¶
NewReindex Create new instanse of Reindexer DB Returns pointer to created instance
func (*Reindexer) CloseNamespace ¶
CloseNamespace - close namespace, but keep storage
func (*Reindexer) ConfigureIndex ¶
ConfigureIndex - congigure index. [[deprecated]]. Use UpdateIndex insted config argument must be struct with index configuration
func (*Reindexer) Delete ¶
Delete - remove item from namespace Item must be the same type as item passed to OpenNamespace, or []byte with json data
func (*Reindexer) DescribeNamespace ¶
func (db *Reindexer) DescribeNamespace(namespace string) (*NamespaceDescription, error)
DescribeNamespace makes a 'SELECT * FROM #namespaces' query to database. Return NamespaceDescription results, error
func (*Reindexer) DescribeNamespaces ¶
func (db *Reindexer) DescribeNamespaces() ([]*NamespaceDescription, error)
DescribeNamespaces makes a 'SELECT * FROM #namespaces' query to database. Return NamespaceDescription results, error
func (*Reindexer) DropNamespace ¶
DropNamespace - drop whole namespace from DB
func (*Reindexer) EnableStorage ¶
EnableStorage enables persistent storage of data [[deprecated]] storage path should be passed as DSN part to reindexer.NewReindex (""), e.g. reindexer.NewReindexer ("builtin:///tmp/reindex")
func (*Reindexer) ExecSQLToJSON ¶
func (db *Reindexer) ExecSQLToJSON(query string) *JSONIterator
func (*Reindexer) GetNamespaceMemStat ¶ added in v1.9.3
func (db *Reindexer) GetNamespaceMemStat(namespace string) (*NamespaceMemStat, error)
GetNamespaceMemStat makes a 'SELECT * FROM #memstat' query to database. Return NamespaceMemStat results, error
func (*Reindexer) GetNamespacesMemStat ¶ added in v1.9.3
func (db *Reindexer) GetNamespacesMemStat() ([]*NamespaceMemStat, error)
GetNamespacesMemStat makes a 'SELECT * FROM #memstats' query to database. Return NamespaceMemStat results, error
func (*Reindexer) GetUpdatedAt ¶
GetUpdatedAt - get updated at time of namespace
func (*Reindexer) Insert ¶
Insert item to namespace. Item must be the same type as item passed to OpenNamespace, or []byte with json data Return 0, if no item was inserted, 1 if item was inserted
func (*Reindexer) MustBeginTx ¶
MustBeginTx - start update transaction, panic on error
func (*Reindexer) OpenNamespace ¶
func (db *Reindexer) OpenNamespace(namespace string, opts *NamespaceOptions, s interface{}) (err error)
OpenNamespace Open or create new namespace and indexes based on passed struct. IndexDef fields of struct are marked by `reindex:` tag
func (*Reindexer) ResetStats ¶
func (db *Reindexer) ResetStats()
ResetStats Reset local thread reindexer usage stats [[deprecated]]
func (*Reindexer) SetDefaultQueryDebug ¶
SetDefaultQueryDebug sets default debug level for queries to namespaces
func (*Reindexer) Update ¶
Update item to namespace. Item must be the same type as item passed to OpenNamespace, or []byte with json data Return 0, if no item was updated, 1 if item was updated
func (*Reindexer) UpdateIndex ¶ added in v1.9.7
UpdateIndex - update index.
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx Is pseudo transaction object. Rollback is not implemented yet, and data will always updated
func (*Tx) DeleteJSON ¶
DeleteJSON - remove item by id from namespace
func (*Tx) MustCommit ¶
func (*Tx) UpsertJSON ¶
UpsertJSON (Insert or Update) item to index