indexers

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	// Struct is the name of the field of the struct
	// being indexed.
	Struct string
	// Sub is the name of the field inside the struct Struct,
	// which is being indexed.
	Sub string
}

Field represents a field that needs to be used for subfield indexing.

type MD5FieldsIndexer

type MD5FieldsIndexer struct {
	// Fields to use for md5sum calculation
	Fields []string
}

MD5FieldsIndexer is used to create an index based on md5sum of string or *string fields.

func (*MD5FieldsIndexer) FromArgs

func (s *MD5FieldsIndexer) FromArgs(args ...interface{}) ([]byte, error)

FromArgs takes in a string and returns its byte form.

func (*MD5FieldsIndexer) FromObject

func (s *MD5FieldsIndexer) FromObject(obj interface{}) (bool, []byte, error)

FromObject take Obj and returns index key formed using the fields.

type MethodIndexer

type MethodIndexer struct {
	// Method name to call to get the string to bulid the index on.
	Method string
}

MethodIndexer is used to create an index based on a string returned as a result of calling a method on the object. It is assumed that the method has no arguments.

func (*MethodIndexer) FromArgs

func (s *MethodIndexer) FromArgs(args ...interface{}) ([]byte, error)

FromArgs takes in a string and returns its byte form.

func (*MethodIndexer) FromObject

func (s *MethodIndexer) FromObject(obj interface{}) (bool, []byte, error)

FromObject take Obj and returns index key formed using the fields.

type SubFieldIndexer

type SubFieldIndexer struct {
	Fields []Field
}

SubFieldIndexer is used to extract a field from an object using reflection and builds an index on that field.

func (*SubFieldIndexer) FromArgs

func (s *SubFieldIndexer) FromArgs(args ...interface{}) ([]byte, error)

FromArgs takes in a string and returns its byte form.

func (*SubFieldIndexer) FromObject

func (s *SubFieldIndexer) FromObject(obj interface{}) (bool, []byte, error)

FromObject take Obj and returns index key formed using the field SubField.

Jump to

Keyboard shortcuts

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