Documentation ¶
Index ¶
- func NewAutoincrementIndex(o ...option.Option) index.Index
- func NewNonUniqueIndexWithOptions(o ...option.Option) index.Index
- func NewUniqueIndexWithOptions(o ...option.Option) index.Index
- type Autoincrement
- func (idx *Autoincrement) Add(id, v string) (string, error)
- func (idx *Autoincrement) CaseInsensitive() bool
- func (idx *Autoincrement) Delete() error
- func (idx *Autoincrement) FilesDir() string
- func (idx *Autoincrement) IndexBy() string
- func (idx *Autoincrement) Init() error
- func (idx *Autoincrement) Lookup(v string) ([]string, error)
- func (idx *Autoincrement) Remove(id string, v string) error
- func (idx *Autoincrement) Search(pattern string) ([]string, error)
- func (idx *Autoincrement) TypeName() string
- func (idx *Autoincrement) Update(id, oldV, newV string) error
- type NonUnique
- func (idx *NonUnique) Add(id, v string) (string, error)
- func (idx *NonUnique) CaseInsensitive() bool
- func (idx *NonUnique) Delete() error
- func (idx *NonUnique) FilesDir() string
- func (idx *NonUnique) IndexBy() string
- func (idx *NonUnique) Init() error
- func (idx *NonUnique) Lookup(v string) ([]string, error)
- func (idx *NonUnique) Remove(id string, v string) error
- func (idx *NonUnique) Search(pattern string) ([]string, error)
- func (idx *NonUnique) TypeName() string
- func (idx *NonUnique) Update(id, oldV, newV string) (err error)
- type Unique
- func (idx *Unique) Add(id, v string) (string, error)
- func (idx *Unique) CaseInsensitive() bool
- func (idx *Unique) Delete() error
- func (idx *Unique) FilesDir() string
- func (idx *Unique) IndexBy() string
- func (idx *Unique) Init() error
- func (idx *Unique) Lookup(v string) (resultPath []string, err error)
- func (idx *Unique) Remove(id string, v string) (err error)
- func (idx *Unique) Search(pattern string) ([]string, error)
- func (idx *Unique) TypeName() string
- func (idx *Unique) Update(id, oldV, newV string) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAutoincrementIndex ¶
NewAutoincrementIndex instantiates a new AutoincrementIndex instance. Init() MUST be called upon instantiation.
func NewNonUniqueIndexWithOptions ¶
NewNonUniqueIndexWithOptions instantiates a new UniqueIndex instance. Init() should be called afterward to ensure correct on-disk structure.
Types ¶
type Autoincrement ¶
type Autoincrement struct {
// contains filtered or unexported fields
}
Autoincrement are fields for an index of type autoincrement.
func (*Autoincrement) Add ¶
func (idx *Autoincrement) Add(id, v string) (string, error)
Add a new value to the index.
func (*Autoincrement) CaseInsensitive ¶
func (idx *Autoincrement) CaseInsensitive() bool
CaseInsensitive undocumented.
func (*Autoincrement) Delete ¶
func (idx *Autoincrement) Delete() error
Delete deletes the index root folder from the configured storage.
func (*Autoincrement) Init ¶
func (idx *Autoincrement) Init() error
Init initializes an autoincrement index.
func (*Autoincrement) Lookup ¶
func (idx *Autoincrement) Lookup(v string) ([]string, error)
Lookup exact lookup by value.
func (*Autoincrement) Remove ¶
func (idx *Autoincrement) Remove(id string, v string) error
Remove a value v from an index.
func (*Autoincrement) Search ¶
func (idx *Autoincrement) Search(pattern string) ([]string, error)
Search allows for glob search on the index.
func (*Autoincrement) Update ¶
func (idx *Autoincrement) Update(id, oldV, newV string) error
Update index from <oldV> to <newV>.
type NonUnique ¶
type NonUnique struct {
// contains filtered or unexported fields
}
NonUnique is able to index an document by a key which might contain non-unique values
/var/tmp/testfiles-395764020/index.disk/PetByColor/ ├── Brown │ └── rebef-123 -> /var/tmp/testfiles-395764020/pets/rebef-123 ├── Green │ ├── goefe-789 -> /var/tmp/testfiles-395764020/pets/goefe-789 │ └── xadaf-189 -> /var/tmp/testfiles-395764020/pets/xadaf-189 └── White
└── wefwe-456 -> /var/tmp/testfiles-395764020/pets/wefwe-456
func (*NonUnique) CaseInsensitive ¶
CaseInsensitive undocumented.
type Unique ¶
type Unique struct {
// contains filtered or unexported fields
}
Unique ensures that only one document of the same type and key-value combination can exist in the index.
Modeled by creating a indexer-folder per entity and key with symlinks which point to respective documents which contain the link-filename as value.
Directory Layout
/var/data/index.disk/UniqueUserByEmail/ ├── jacky@example.com -> /var/data/users/ewf4ofk-555 ├── jones@example.com -> /var/data/users/rulan54-777 └── mikey@example.com -> /var/data/users/abcdefg-123
Example user
{ "Id": "ewf4ofk-555", "UserName": "jacky", "Email": "jacky@example.com" }
func (*Unique) CaseInsensitive ¶
CaseInsensitive undocumented.