guid2english

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package guid2english provides a transform.Transformer which replaces all GUIDs in the input with their known English representation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mapper

type Mapper interface {
	Map(guid.GUID) []byte
}

Mapper converts a GUID to a string.

type TemplateMapper

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

TemplateMapper implements mapper using Go's text/template package. The template can refer to the following variables:

  • {{.Guid}}: The GUID being mapped
  • {{.Name}}: The English name of the GUID or "UNKNOWN"
  • {{.IsKnown}}: Set to true when the English name is not known

func NewTemplateMapper

func NewTemplateMapper(tmpl *template.Template) *TemplateMapper

NewTemplateMapper creates a new TemplateMapper given a Template.

func (*TemplateMapper) Map

func (f *TemplateMapper) Map(g guid.GUID) []byte

Map implements the Mapper.Map() function.

type Transformer

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

Transformer replaces all the GUIDs using the Mapper interface. For example, this can replace all the GUIDs with their's English representation.

func New

func New(m Mapper) *Transformer

New creates a new Transformer with the given Mapper.

func (*Transformer) Reset

func (t *Transformer) Reset()

Reset implements transform.Transformer.Reset().

func (*Transformer) Transform

func (t *Transformer) Transform(dst, src []byte, atEOF bool) (nDst, nSrc int, err error)

Transform implements transform.Transformer.Transform().

Jump to

Keyboard shortcuts

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