internal

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLoadObject = errors.New("LoadObject")

Functions

func EscapeCommand added in v0.3.0

func EscapeCommand(command string) string

func NewDeleteString

func NewDeleteString(s string) string

func NewDiffHeader

func NewDiffHeader(s string) string

func NewInsertString

func NewInsertString(s string) string

Types

type Marshaler

type Marshaler interface {
	Marshal(ctx context.Context, v any) ([]byte, error)
}

type Object

type Object struct {
	Header ObjectHeader
	Body   string
}

func LoadObjectFromMap

func LoadObjectFromMap(ctx context.Context, marshaler Marshaler, obj map[string]any) (*Object, error)

func LoadObjects

func LoadObjects(ctx context.Context, r io.Reader, marshaler Marshaler, allowDuplicteMapKey bool) ([]*Object, error)

type ObjectDiff

type ObjectDiff struct {
	Pair *ObjectPair
	Diff string
}

type ObjectDiffBuilder

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

func NewObjectDiffBuilder

func NewObjectDiffBuilder(left, right string, diffContext int, color bool) *ObjectDiffBuilder

func (*ObjectDiffBuilder) ObjectDiff

func (d *ObjectDiffBuilder) ObjectDiff(_ context.Context, pair *ObjectPair) (*ObjectDiff, error)

type ObjectDiffer

type ObjectDiffer interface {
	ObjectDiff(ctx context.Context, pair *ObjectPair) (*ObjectDiff, error)
}

type ObjectHeader

type ObjectHeader struct {
	APIVersion string     `yaml:"apiVersion"`
	Kind       string     `yaml:"kind"`
	Metadata   ObjectMeta `yaml:"metadata"`
}

ObjectHeader is a seed of the Object ID.

func (ObjectHeader) IntoID

func (s ObjectHeader) IntoID(sep string) string

type ObjectMap

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

func NewObjectMap

func NewObjectMap(sep string) *ObjectMap

func (*ObjectMap) Add

func (m *ObjectMap) Add(obj *Object) bool

func (*ObjectMap) Get

func (m *ObjectMap) Get(id string) (*Object, bool)

func (*ObjectMap) Keys

func (m *ObjectMap) Keys() []string

type ObjectMeta

type ObjectMeta struct {
	Namespace string `yaml:"namespace"`
	Name      string `yaml:"name"`
}

type ObjectPair

type ObjectPair struct {
	ID    string
	Left  *Object
	Right *Object
}

ObjectPair is a pair of [Objects] that share the same ID.

func (*ObjectPair) IsMissing

func (p *ObjectPair) IsMissing() bool

type ObjectPairMap

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

func NewObjectPairMap

func NewObjectPairMap(left, right *ObjectMap) *ObjectPairMap

func (*ObjectPairMap) ObjectPairs

func (m *ObjectPairMap) ObjectPairs() []*ObjectPair

type ObjectPairer

type ObjectPairer interface {
	ObjectPairs() []*ObjectPair
}

type ProcessObjectDiffBuilder added in v0.3.0

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

func NewProcessObjectDiffBuilder added in v0.3.0

func NewProcessObjectDiffBuilder(
	command string,
	args []string,
	left, right string,
	diffContext int,
	color bool,
) *ProcessObjectDiffBuilder

func (*ProcessObjectDiffBuilder) ObjectDiff added in v0.3.0

func (d *ProcessObjectDiffBuilder) ObjectDiff(ctx context.Context, pair *ObjectPair) (*ObjectDiff, error)

type Unmarshaler

type Unmarshaler[T any] interface {
	// Unmarshal reads all documents and unmarshal them as a list of T.
	Unmarshal(ctx context.Context) ([]T, error)
}

type YamlMarshaler

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

func NewYamlMarshaler

func NewYamlMarshaler(indent int, literalStyleIfMultiline bool) *YamlMarshaler

func (*YamlMarshaler) Marshal

func (y *YamlMarshaler) Marshal(ctx context.Context, v any) ([]byte, error)

type YamlUnmarshaler

type YamlUnmarshaler[T any] struct {
	// contains filtered or unexported fields
}

func NewYamlUnmarshaler

func NewYamlUnmarshaler[T any](r io.Reader, t T, allowDuplicateMapKey bool) *YamlUnmarshaler[T]

func (*YamlUnmarshaler[T]) Unmarshal

func (y *YamlUnmarshaler[T]) Unmarshal(ctx context.Context) ([]T, error)

Jump to

Keyboard shortcuts

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