doc

package
Version: v0.0.0-...-9649366 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package doc is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var IDReservedFieldName = []byte("_m3ninx_id")

IDReservedFieldName is the field name reserved for IDs.

Functions

This section is empty.

Types

type Document

type Document struct {
	ID     []byte
	Fields []Field
}

Document represents a document to be indexed.

func (Document) Compare

func (d Document) Compare(other Document) int

Compare returns an integer comparing two documents. The result will be 0 if the documents are equal, -1 if d is ordered before other, and 1 if d is ordered aftered other.

func (Document) Equal

func (d Document) Equal(other Document) bool

Equal returns a bool indicating whether d is equal to other.

func (Document) Get

func (d Document) Get(fieldName []byte) ([]byte, bool)

Get returns the value of the specified field name in the document if it exists.

func (Document) HasID

func (d Document) HasID() bool

HasID returns a bool indicating whether the document has an ID or not.

func (Document) String

func (d Document) String() string

func (Document) Validate

func (d Document) Validate() error

Validate returns a bool indicating whether the document is valid.

type DocumentArr

type DocumentArr []Document

type DocumentArrPool

type DocumentArrPool struct {
	// contains filtered or unexported fields
}

func (*DocumentArrPool) Get

func (p *DocumentArrPool) Get() []Document

func (*DocumentArrPool) Init

func (p *DocumentArrPool) Init()

func (*DocumentArrPool) Put

func (p *DocumentArrPool) Put(arr []Document)

type DocumentArrayPool

type DocumentArrayPool interface {
	// Init initializes the array pool, it needs to be called
	// before Get/Put use.
	Init()

	// Get returns the a slice from the pool.
	Get() []Document

	// Put returns the provided slice to the pool.
	Put(elems []Document)
}

DocumentArrayPool provides a pool for document slices.

func NewDocumentArrayPool

func NewDocumentArrayPool(opts DocumentArrayPoolOpts) DocumentArrayPool

type DocumentArrayPoolOpts

type DocumentArrayPoolOpts struct {
	Options     pool.ObjectPoolOptions
	Capacity    int
	MaxCapacity int
	FinalizeFn  DocumentFinalizeFn
}

type DocumentFinalizeFn

type DocumentFinalizeFn func([]Document) []Document

type DocumentMatcher

type DocumentMatcher interface {
	gomock.Matcher
}

DocumentMatcher matches a given document.

func NewDocumentMatcher

func NewDocumentMatcher(d Document) DocumentMatcher

NewDocumentMatcher returns a new DocumentMatcher.

type Documents

type Documents []Document

Documents is a list of documents.

func (Documents) Len

func (ds Documents) Len() int

func (Documents) Less

func (ds Documents) Less(i, j int) bool

func (Documents) Swap

func (ds Documents) Swap(i, j int)

type Field

type Field struct {
	Name  []byte
	Value []byte
}

Field represents a field in a document. It is composed of a name and a value.

type Fields

type Fields []Field

Fields is a list of fields.

func (Fields) Len

func (f Fields) Len() int

func (Fields) Less

func (f Fields) Less(i, j int) bool

func (Fields) Swap

func (f Fields) Swap(i, j int)

type Iterator

type Iterator interface {
	// Next returns a bool indicating if the iterator has any more documents
	// to return.
	Next() bool

	// Current returns the current document. It is only safe to call Current immediately
	// after a call to Next confirms there are more elements remaining. The Document
	// returned from Current is only valid until the following call to Next(). Callers
	// should copy the Document if they need it live longer.
	Current() Document

	// Err returns any errors encountered during iteration.
	Err() error

	// Close releases any internal resources used by the iterator.
	Close() error
}

Iterator provides an iterator over a collection of documents. It is NOT safe for multiple goroutines to invoke methods on an Iterator simultaneously.

type MockIterator

type MockIterator struct {
	// contains filtered or unexported fields
}

MockIterator is a mock of Iterator interface

func NewMockIterator

func NewMockIterator(ctrl *gomock.Controller) *MockIterator

NewMockIterator creates a new mock instance

func (*MockIterator) Close

func (m *MockIterator) Close() error

Close mocks base method

func (*MockIterator) Current

func (m *MockIterator) Current() Document

Current mocks base method

func (*MockIterator) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockIterator) Err

func (m *MockIterator) Err() error

Err mocks base method

func (*MockIterator) Next

func (m *MockIterator) Next() bool

Next mocks base method

type MockIteratorMockRecorder

type MockIteratorMockRecorder struct {
	// contains filtered or unexported fields
}

MockIteratorMockRecorder is the mock recorder for MockIterator

func (*MockIteratorMockRecorder) Close

func (mr *MockIteratorMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close

func (*MockIteratorMockRecorder) Current

func (mr *MockIteratorMockRecorder) Current() *gomock.Call

Current indicates an expected call of Current

func (*MockIteratorMockRecorder) Err

Err indicates an expected call of Err

func (*MockIteratorMockRecorder) Next

func (mr *MockIteratorMockRecorder) Next() *gomock.Call

Next indicates an expected call of Next

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL