internal

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

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) ([]*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(pair *ObjectPair) *ObjectDiff

type ObjectDiffer

type ObjectDiffer interface {
	ObjectDiff(pair *ObjectPair) *ObjectDiff
}

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 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) *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