format

package
v2.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorFormat       = fmt.Errorf("format error")
	ErrorNoSerializer = fmt.Errorf("message is not serializable")
)

Functions

func GetFormats

func GetFormats() []string

func RegisterFormatDriver

func RegisterFormatDriver(name string, t FormatDriver)

Types

type DriverFormatError

type DriverFormatError struct {
	Driver string
	Err    error
}

func (*DriverFormatError) Error

func (e *DriverFormatError) Error() string

func (*DriverFormatError) Unwrap

func (e *DriverFormatError) Unwrap() []error

type Format

type Format struct {
	FormatDriver
	// contains filtered or unexported fields
}

func FindFormat

func FindFormat(name string) (*Format, error)

func (*Format) Format

func (t *Format) Format(data interface{}) ([]byte, []byte, error)

type FormatDriver

type FormatDriver interface {
	Prepare() error                                  // Prepare driver (eg: flag registration)
	Init() error                                     // Initialize driver (eg: parse keying)
	Format(data interface{}) ([]byte, []byte, error) // Send a message
}

type FormatInterface

type FormatInterface interface {
	Format(data interface{}) ([]byte, []byte, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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