Documentation
¶
Overview ¶
Package dictionary represents storage for keeping an index vocabulary
Index ¶
- Constants
- type Dictionary
- func BuildCDBDictionary(iterator Iterable, destinationPath string) (Dictionary, error)
- func NewCDBDictionary(r io.ReaderAt) (Dictionary, error)
- func NewInMemoryDictionary(words []string) Dictionary
- func OpenCDBDictionary(path string) (Dictionary, error)
- func OpenRAMDictionary(path string) (dict Dictionary, err error)
- type Iterable
- type Iterator
- type Key
- type Value
Constants ¶
View Source
const ( // NilValue is a value, that returns when an entry with the given // key doesn't exist NilValue = "<nil/>" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dictionary ¶
type Dictionary interface {
Iterable
// Get returns value associated with a particular key
Get(key Key) (Value, error)
// Size returns the size of the dictionary
Size() int
}
Dictionary is an abstract data type composed of a collection of (key, value) pairs
func BuildCDBDictionary ¶
func BuildCDBDictionary(iterator Iterable, destinationPath string) (Dictionary, error)
BuildCDBDictionary is a helper for building a CDB dictionary from the sourcePath Saves the dictionary to destinationPath
func NewCDBDictionary ¶
func NewCDBDictionary(r io.ReaderAt) (Dictionary, error)
NewCDBDictionary creates new instance of cdbDictionary
func NewInMemoryDictionary ¶
func NewInMemoryDictionary(words []string) Dictionary
NewInMemoryDictionary creates new instance of inMemoryDictionary
func OpenCDBDictionary ¶
func OpenCDBDictionary(path string) (Dictionary, error)
OpenCDBDictionary opens a dictionary from cdb file
func OpenRAMDictionary ¶
func OpenRAMDictionary(path string) (dict Dictionary, err error)
OpenRAMDictionary opens a dictionary from the given path and stores items in RAM
type Iterable ¶
type Iterable interface {
// Iterate walks through each kv pair and calls iterator on it
Iterate(iterator Iterator) error
}
Iterable tells that an implementation might be an object of for loop
Click to show internal directories.
Click to hide internal directories.