Documentation ¶
Index ¶
- type CsvCache
- type FileSystemStringDB
- func (db *FileSystemStringDB) Add(key, str string) error
- func (db *FileSystemStringDB) Close(delete bool) error
- func (db *FileSystemStringDB) ContainsKey(key string) (bool, error)
- func (db *FileSystemStringDB) Get(key string) (string, error)
- func (db *FileSystemStringDB) GetCount() int
- func (db *FileSystemStringDB) GetDir() string
- type MemoryStringDB
- type StringDB
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CsvCache ¶
type CsvCache struct {
// contains filtered or unexported fields
}
CsvCache stores csv lines of equal length in an arbitrary StringDB implementation.
func NewCsvCache ¶
NewCsvCache returns a CsvCache for the given headers using a memory or file-system mapped StringDB implementation.
func NewFileSystemCsvCache ¶
NewFileSystemCsvCache returns a CsvCache for the given headers using a file-system mapped StringDB implementation.
func NewMemoryCsvCache ¶
NewMemoryCsvCache returns a CsvCache for the given headers using a memory mapped StringDB implementation.
func (*CsvCache) Add ¶
Add adds an entry to the cache using the first array element as key. Returns an error if the key is already stored.
func (*CsvCache) ContainsKey ¶
ContainsKey returns true when the given key is stored in the cache, otherwise false.
type FileSystemStringDB ¶
type FileSystemStringDB struct {
// contains filtered or unexported fields
}
FileSystemStringDB is a StringDB implementation which stores the data on the local file system.
func (*FileSystemStringDB) Add ¶
func (db *FileSystemStringDB) Add(key, str string) error
Add stores a value with the given key in the database. Returns an error if the key is already stored.
func (*FileSystemStringDB) Close ¶
func (db *FileSystemStringDB) Close(delete bool) error
Close deletes all storage files from the local file-system.
func (*FileSystemStringDB) ContainsKey ¶
func (db *FileSystemStringDB) ContainsKey(key string) (bool, error)
ContainsKey returns true if the given key is stored in the database, otherwise false.
func (*FileSystemStringDB) Get ¶
func (db *FileSystemStringDB) Get(key string) (string, error)
Get returns the string stored in the database for the given key. Returns an error if the key is not stored in the database.
func (*FileSystemStringDB) GetCount ¶
func (db *FileSystemStringDB) GetCount() int
GetCount returns the total number of entries in the database.
func (*FileSystemStringDB) GetDir ¶
func (db *FileSystemStringDB) GetDir() string
GetDir returns the base directory of the file-system database.
type MemoryStringDB ¶
type MemoryStringDB struct {
// contains filtered or unexported fields
}
MemoryStringDB is a StringDB implementation which stores all data in the memory.
func (*MemoryStringDB) Add ¶
func (db *MemoryStringDB) Add(key, str string) error
Add stores a value with the given key in the database. Returns an error if the key is already stored.
func (*MemoryStringDB) Close ¶
func (db *MemoryStringDB) Close(delete bool) error
Close disposes all storage resources of this database.
func (*MemoryStringDB) ContainsKey ¶
func (db *MemoryStringDB) ContainsKey(key string) (bool, error)
ContainsKey returns true if the given key is stored in the database, otherwise false.
func (*MemoryStringDB) Get ¶
func (db *MemoryStringDB) Get(key string) (string, error)
Get returns the string stored in the database for the given key. Returns an error if the key is not stored in the database.
func (*MemoryStringDB) GetCount ¶
func (db *MemoryStringDB) GetCount() int
GetCount returns the total number of entries in the database.
type StringDB ¶
type StringDB interface { GetCount() int Add(key, str string) error ContainsKey(key string) (bool, error) Get(key string) (string, error) Close(delete bool) error }
StringDB is the abstract interface for storing keyed strings in a database.
func NewFileSystemStringDB ¶
NewFileSystemStringDB returns a file-system mapped string database in the given directory.
func NewMemoryStringDB ¶
NewMemoryStringDB returns a memory mapped string database in the given directory.