lib_gc_idx

package
v0.0.0-...-e28984d Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IDX_ORDER_ASC = iota
	IDX_ORDER_DESC
)

Variables

View Source
var DOIndexFactory *doIndexFactory

Index factory

View Source
var DOIndexesManager doIndexesManager

Indexes manager

Functions

func HGetDOIndexesManager

func HGetDOIndexesManager() doIndexesManager

Retrieves the DOIndexesManager

func HGetMapValueAsSlice

func HGetMapValueAsSlice(_map *map[string]*IDX_VALUE.DOIndexValue, keyValues *[]interface{}) (*IDX_VALUE.DOIndexValue, bool)

Given a map of values, linked to an index key, this method retrieves its slice of values. Remember that a value is a slice. For exemple, this methos can be called after calling the HGetMapOfValuesForAnIndexKey.

func HGetValueAsSlice

func HGetValueAsSlice(indexer DOIndexer, index_key *[]string, valueKey ...interface{}) (*[]IDX_VALUE.DOIndexValueItem, bool, error)

Given an index, this method checks for an specific value as a part of the slice of values of a given index key. If the index key does not exist into index, the method return an error. If the index key does exist into index, but the specific value does not exist, the method returns false. Remember that a value is a slice

func HGetValueAsSliceFromDo

func HGetValueAsSliceFromDo(indexer DOIndexer, do MakeIndexable, valueKey ...interface{}) (*[]IDX_VALUE.DOIndexValueItem, bool, error)

Given an index, a domain object with the index key files filled, and a specific value, this method checks if into the index exist an entry with the given index key. If it exist, then the method checks if between its map of values it is the given value.

If the index key does not exist into the index, the method returns an error. If the index exist, but the value is not between their values, it returns false

Types

type DOIndexEntryMaker

type DOIndexEntryMaker interface {
	GetKeyFromDo(indexHeaderName string, key *[]string, do MakeIndexable) (string, error)
	GetKey(indexHeaderName string, key *[]string) (string, error)
	GetValueFromDo(value *[]string, do MakeIndexable) (*[]interface{}, error)
}
var DefaultEntryMaker DOIndexEntryMaker

Default index entries maker

type DOIndexHeader

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

func (*DOIndexHeader) AddEntry

func (doIdxHeader *DOIndexHeader) AddEntry(do MakeIndexable) error

func (*DOIndexHeader) GetAsMap

func (doIdxHeader *DOIndexHeader) GetAsMap(key *[]string) (*map[string]*IDX_VALUE.DOIndexValue, error)

Takes the index entry for the "key" parameter, as a map.

func (*DOIndexHeader) GetAsMapFromDo

func (doIdxHeader *DOIndexHeader) GetAsMapFromDo(do MakeIndexable) (*map[string]*IDX_VALUE.DOIndexValue, error)

Takes the index entry for the DO's "key" parameter, as a map.

func (*DOIndexHeader) GetAsSlice

func (doIdxHeader *DOIndexHeader) GetAsSlice(key *[]string) (*[]IDX_VALUE.DOIndexValue, error)

Takes a slice entry indexed by the "key" parameter.

func (*DOIndexHeader) GetAsSliceFromDo

func (doIdxHeader *DOIndexHeader) GetAsSliceFromDo(do MakeIndexable) (*[]IDX_VALUE.DOIndexValue, error)

Takes the index entry for the DO's "key" parameter, as a slice.

func (*DOIndexHeader) GetEntryMaker

func (doIdxHeader *DOIndexHeader) GetEntryMaker() DOIndexEntryMaker

func (*DOIndexHeader) GetKeyField

func (doIdxHeader *DOIndexHeader) GetKeyField() *[]string

func (*DOIndexHeader) GetName

func (doIdxHeader *DOIndexHeader) GetName() string

---- DOIndexHeader MakeCacheable implementation-------

func (*DOIndexHeader) GetOrdered

func (doIdxHeader *DOIndexHeader) GetOrdered() IdxOrder

func (*DOIndexHeader) GetPK

func (doIdxHeader *DOIndexHeader) GetPK() string

func (*DOIndexHeader) GetUnique

func (doIdxHeader *DOIndexHeader) GetUnique() bool

func (*DOIndexHeader) GetValueField

func (doIdxHeader *DOIndexHeader) GetValueField() *[]string

func (*DOIndexHeader) RemoveIndexKey

func (doIdxHeader *DOIndexHeader) RemoveIndexKey(key *[]string) error

Remove an index header key

func (*DOIndexHeader) RemoveIndexKeyEntry

func (doIdxHeader *DOIndexHeader) RemoveIndexKeyEntry(key *[]string, entryValue ...interface{}) error

Removes an index entry

func (*DOIndexHeader) RemoveIndexKeyEntryFromDo

func (doIdxHeader *DOIndexHeader) RemoveIndexKeyEntryFromDo(do MakeIndexable) error

Remove the index entry filled into the "do" parameter.

type DOIndexMaker

type DOIndexMaker interface {
	CreateDOIndexer(name string, keyField []string, valueField []string, unique bool, order IdxOrder) (DOIndexer, error)
}

type DOIndexer

type DOIndexer interface {

	// Make it cacheable
	GetName() string
	GetPK() string

	// Attribute Getters
	GetOrdered() IdxOrder
	GetUnique() bool
	GetKeyField() *[]string
	GetValueField() *[]string

	// Entry maker getter
	GetEntryMaker() DOIndexEntryMaker

	// Entry A/D operations
	AddEntry(do MakeIndexable) error
	RemoveIndexKeyEntryFromDo(do MakeIndexable) error
	RemoveIndexKeyEntry(key *[]string, entryValue ...interface{}) error
	RemoveIndexKey(key *[]string) error

	// Read operations
	GetAsSlice(key *[]string) (*[]IDX_VALUE.DOIndexValue, error)
	GetAsSliceFromDo(do MakeIndexable) (*[]IDX_VALUE.DOIndexValue, error)
	GetAsMap(key *[]string) (*map[string]*IDX_VALUE.DOIndexValue, error)
	GetAsMapFromDo(do MakeIndexable) (*map[string]*IDX_VALUE.DOIndexValue, error)
}

-------. INDEX HEADER -------------------------------------------------------

A DOIndexHeader instance performs a specific index.

Each key of this index, will be an DOIndexKey instance

type IdxOrder

type IdxOrder int8

----------- INDEX DEFINITION -----------------------------------------------

type MakeIndexable

type MakeIndexable interface {
	GetAsMap() (*map[string]interface{}, error)
}

-------. INDEXABLE INTERFACE -----------------------------------------------

Directories

Path Synopsis
lib_gc_idx_value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL