common

package
v0.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const MetaDataID = "meta().id"

Variables

This section is empty.

Functions

func ExtractKeys

func ExtractKeys(expression bson.D) []string

ExtractKeys traverses a MongoDB filter expression and collects unique field names.

func GenerateShortUUIDHex

func GenerateShortUUIDHex() (string, error)

func GetMapKeys

func GetMapKeys(val map[string]interface{}) []string

func IsNilOrZero

func IsNilOrZero(i interface{}) bool

IsNilOrZero checks if the provided interface{} value is nil, a nil pointer, a nil interface, or a zero value of any type.

func NavigatePath(path string, data map[string]interface{}) (string, bool)

NavigatePath initiates the recursive path check.

Types

type Analyzer

type Analyzer[T any] interface {
	Init(index []T, suk IDocumentKey)
	AnalyzeData(data map[string]interface{})
	GetCouchbaseQuery(bucket, scope, collection string) []Index
}

type DocumentKey

type DocumentKey struct {
	Key          string
	NotComposite bool
	UUIDSet      bool
	HasString    bool
}

func NewDocumentKey

func NewDocumentKey() *DocumentKey

func (*DocumentKey) Get

func (d *DocumentKey) Get() string

func (*DocumentKey) Set

func (d *DocumentKey) Set(kind DocumentKind, value string)

type DocumentKind

type DocumentKind string
const (
	DkString DocumentKind = "string"
	DkUuid   DocumentKind = "UUID"
	DkField  DocumentKind = "field"
)

type IDestination

type IDestination interface {
	Init(opts *option.Options) (IDocumentKey, error)
	ProcessData(map[string]interface{}) error
	Complete() error
	CreateIndexes(indexes []Index) error
}

type IDocumentKey

type IDocumentKey interface {
	Set(kind DocumentKind, value string)
	Get() string
}

type ISource

type ISource[Index any, Options any] interface {
	Init(opts *Options) error
	StreamData(context.Context, chan map[string]interface{}) error
	GetIndexes(ctx context.Context) ([]Index, error)
}

type Index

type Index struct {
	Name  string
	Query string
	Error error
}

Jump to

Keyboard shortcuts

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