common

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func GenerateShortUUIDHex

func GenerateShortUUIDHex() (string, error)

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.

Types

type CBDocumentKey

type CBDocumentKey struct {
	Parts []DocumentKeyPart
	// contains filtered or unexported fields
}

CBDocumentKey can be generated with string and field or a composite filed or uuid using generator syntex

func (*CBDocumentKey) GetKey

func (k *CBDocumentKey) GetKey() []DocumentKeyPart

func (*CBDocumentKey) GetNonCompoundPrimaryKeyOnly

func (k *CBDocumentKey) GetNonCompoundPrimaryKeyOnly() string

GetNonCompoundPrimaryKeyOnly value only when the DocumentKeyParts length is 1 and it is a string

func (*CBDocumentKey) IsSet

func (k *CBDocumentKey) IsSet() bool

func (*CBDocumentKey) Set

func (k *CBDocumentKey) Set(key []DocumentKeyPart)

func (*CBDocumentKey) SetKeyHashed

func (k *CBDocumentKey) SetKeyHashed()

type DocumentKeyPart

type DocumentKeyPart struct {
	Value string
	Kind  DocumentKind // string | field | UUID
}

type DocumentKind

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

type ICBDocumentKey

type ICBDocumentKey interface {
	SetKeyHashed()
	Set(key []DocumentKeyPart)
	IsSet() bool
	GetKey() []DocumentKeyPart
	GetNonCompoundPrimaryKeyOnly() string
}

func NewCBDocumentKey

func NewCBDocumentKey() ICBDocumentKey

NewCBDocumentKey returns Singleton DocumentKey as it is used by source (for generating the doc key) and destination (for analyzing the index)

type IDestination

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

type ISource

type ISource[Options any] interface {
	Init(opts *Options, documentKey ICBDocumentKey) error
	StreamData(context.Context, chan map[string]interface{}) error
	GetCouchbaseIndexesQuery(bucket string, scope string, collection string) ([]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