format

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetKind

func GetKind(name string) configV1.Kind

GetKind returns the Kind for the given name.

func GetObjectNames

func GetObjectNames() []string

GetObjectNames returns a sorted list of object names.

func HasSuffix

func HasSuffix(s string, suffix ...string) bool

HasSuffix checks if a string has one of the suffixes given as input

func ListObjectNames

func ListObjectNames() string

ListObjectNames returns a string with a list of object names.

func ResolveWriter

func ResolveWriter(filename string) (io.WriteCloser, error)

ResolveWriter creates a file and returns an io.Writer for the file. If filename is empty, os.StdOut is returned

func Unmarshal

func Unmarshal(ctx context.Context, filename string, result chan<- *config.ConfigObject) error

Unmarshal unmarshals a file into a channel of ConfigObjects

Types

type Formatter

type Formatter interface {
	// WriteRecord writes a record to the formatter.
	// The input record is guaranteed to be a protobuf message
	// or the result of parsing a json formatted string into an interface (see https://pkg.go.dev/encoding/json#Unmarshal).
	WriteRecord(interface{}) error
	Close() error
}

Formatter is the interface for formatters. Formatters should not be instantiated directly, but through the NewFormatter function.

func NewFormatter

func NewFormatter(objectType string, out io.Writer, format string, template string) (formatter Formatter, err error)

NewFormatter creates a new formatter

type MarshalSpec

type MarshalSpec struct {
	ObjectType string
	Format     string
	Template   string
	// contains filtered or unexported fields
}

MarshalSpec is the specification for a formatter

func (*MarshalSpec) Close

func (s *MarshalSpec) Close() error

Close closes the formatter

Jump to

Keyboard shortcuts

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