formatters

package
v0.0.0-...-ebc7474 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

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

func NewFormatter

func NewFormatter(name string, setters ...FormatterOption) Formatter

func (*Formatter) Format

func (f *Formatter) Format(ctx context.Context, record shared.Record) (bool, error)

func (*Formatter) Name

func (f *Formatter) Name() string

func (*Formatter) String

func (f *Formatter) String() string

type FormatterConstructor

type FormatterConstructor func(config map[string]string) (IFormatter, error)

type FormatterError

type FormatterError struct {
	Message string
}

FormatterError custom error for Formatter

func (*FormatterError) Error

func (e *FormatterError) Error() string

type FormatterOption

type FormatterOption func(*Formatter)

func Description

func Description(description string) FormatterOption

func Disabled

func Disabled(disabled bool) FormatterOption

func ID

func ID(id string) FormatterOption

func Name

func Name(name string) FormatterOption

type FormatterRepository

type FormatterRepository struct {
	Formatters map[string]IFormatter
	// contains filtered or unexported fields
}

func GetFormatterRepository

func GetFormatterRepository() *FormatterRepository

func NewFormatterRepository

func NewFormatterRepository() FormatterRepository

func (*FormatterRepository) GetFormatter

func (apr *FormatterRepository) GetFormatter(name string) (IFormatter, error)

func (*FormatterRepository) HasFormatter

func (apr *FormatterRepository) HasFormatter(name string) bool

func (*FormatterRepository) LoadFormatters

func (apr *FormatterRepository) LoadFormatters(path string) error

func (*FormatterRepository) RegisterFormatter

func (apr *FormatterRepository) RegisterFormatter(formatter IFormatter) error

type IFormatter

type IFormatter interface {
	Format(ctx context.Context, record shared.Record) (bool, error)
	Name() string
	String() string
}

Jump to

Keyboard shortcuts

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