reference

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrImmutableReference       = fmt.Errorf("cannot set immutable reference")
	ErrRenameImmutableReference = fmt.Errorf("cannot rename immutable reference")
	ErrNotResolvable            = fmt.Errorf("cannot resolve reference")
	ErrUnexpectedType           = fmt.Errorf("unexpected type")
	ErrFieldExists              = fmt.Errorf("field already exists")
)

Functions

This section is empty.

Types

type Reference

type Reference interface {
	// Get returns the value of the reference. The type of the returned value
	// depends on the reference.
	Get() any
	// Set sets the value of the reference. The type of the value depends on the
	// reference. If the value is not of the expected type, an error is returned.
	Set(any) error
	// Delete deletes the value of the reference. If the reference is not
	// deletable, an error is returned.
	Delete() error
	// Rename renames the referenced field, the old field value is moved to the
	// new field. The reference is still pointing to the old field, while the returned
	// reference points to the new field.
	Rename(string) (Reference, error)
	// contains filtered or unexported methods
}

Reference is an interface that represents a reference to a field in a record. It can be used to get and set the value of the field dynamically using input provided by the user.

type Resolver

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

Resolver is a type that knows how to resolve a reference to a field in a record. It is used to specify the target of a processor's output.

func NewResolver

func NewResolver(input string) (Resolver, error)

func (Resolver) Resolve

func (rr Resolver) Resolve(rec *opencdc.Record) (Reference, error)

Resolve resolves the reference to a field in the record. If the reference cannot be resolved an error is returned. If the reference is valid but the field does not exist in the record, the field will be created. The returned reference can be used to set the value of the field.

type UnexpectedTokenError

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

func (UnexpectedTokenError) Error

func (e UnexpectedTokenError) Error() string

Jump to

Keyboard shortcuts

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