Documentation
¶
Overview ¶
Package fieldcodec implements the pluggable VALUE codec catalog — the charset, numeric, amount and bitmap encodings that pair orthogonally with a lengthcodec length prefix to describe any ISO-8583 field. Codecs implement the interfaces declared in iso8583 (ARCHITECTURE.md §10 C1) and are populated into a Registry by the explicit DefaultRegistry() builder — no init() side effects.
Every codec honours the canonical value form documented in iso8583/codec_iface.go: text/numeric decode to ASCII bytes, binary to the raw octets (zero copy where possible), amount to an exact Decimal.
Index ¶
- Variables
- type Registry
- func (r *Registry) Lookup(name string) (iso8583.FieldCodec, bool)
- func (r *Registry) LookupBitmap(name string) (iso8583.BitmapCodec, bool)
- func (r *Registry) LookupLength(name string) (iso8583.LengthCodec, bool)
- func (r *Registry) Register(c iso8583.FieldCodec)
- func (r *Registry) RegisterBitmap(b iso8583.BitmapCodec)
- func (r *Registry) RegisterLength(l iso8583.LengthCodec)
Constants ¶
This section is empty.
Variables ¶
var ( AmountASCII iso8583.FieldCodec = amountASCII{} AmountBCD iso8583.FieldCodec = amountBCD{} AmountBinary iso8583.FieldCodec = amountBinary{} )
Catalog singletons.
var ( BitmapBinary iso8583.BitmapCodec = bitmapCodec{/* contains filtered or unexported fields */} BitmapHex iso8583.BitmapCodec = bitmapCodec{/* contains filtered or unexported fields */} BitmapEBCDIC iso8583.BitmapCodec = bitmapCodec{/* contains filtered or unexported fields */} )
Catalog singletons.
var ( ASCII iso8583.FieldCodec = ascii{} EBCDIC037 iso8583.FieldCodec = ebcdicChar{/* contains filtered or unexported fields */} EBCDIC1047 iso8583.FieldCodec = ebcdicChar{/* contains filtered or unexported fields */} UTF8 iso8583.FieldCodec = utf8Char{} BINARY iso8583.FieldCodec = binaryRaw{} )
Catalog singletons.
var ( ErrTooLong = errors.New("fieldcodec: value exceeds fixed field width") ErrNonDigit = errors.New("fieldcodec: non-digit byte in numeric value") ErrNegative = errors.New("fieldcodec: negative value in unsigned field") ErrOddNibble = errors.New("fieldcodec: malformed packed value") ErrBadHex = errors.New("fieldcodec: malformed hex bitmap") ErrShortBitmap = errors.New("fieldcodec: truncated bitmap") )
Errors shared by the value codecs.
var ( NumASCII iso8583.FieldCodec = numASCII{} NumEBCDIC iso8583.FieldCodec = numEBCDIC{} BCD iso8583.FieldCodec = bcdNum{} RBCD iso8583.FieldCodec = rbcdNum{} NumBinary iso8583.FieldCodec = binNum{} )
Catalog singletons.
var HexBINARY iso8583.FieldCodec = hexBinary{}
HexBINARY is the ASCII-hex binary value codec (registry name "b.hex").
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry resolves codecs by name for schema assembly (packager/, generic YAML loader). It is populated explicitly by DefaultRegistry — never by init() side effects — so global state stays visible and import order never matters.
func DefaultRegistry ¶
func DefaultRegistry() *Registry
DefaultRegistry returns a freshly-built registry pre-populated with the full catalog: every value codec, every length codec, and every bitmap codec. Callers may add custom codecs to the returned instance.
func (*Registry) Lookup ¶
func (r *Registry) Lookup(name string) (iso8583.FieldCodec, bool)
Lookup resolves a value codec by name.
func (*Registry) LookupBitmap ¶
func (r *Registry) LookupBitmap(name string) (iso8583.BitmapCodec, bool)
LookupBitmap resolves a bitmap codec by name.
func (*Registry) LookupLength ¶
func (r *Registry) LookupLength(name string) (iso8583.LengthCodec, bool)
LookupLength resolves a length codec by name.
func (*Registry) Register ¶
func (r *Registry) Register(c iso8583.FieldCodec)
Register adds (or replaces) a value codec under its Name().
func (*Registry) RegisterBitmap ¶
func (r *Registry) RegisterBitmap(b iso8583.BitmapCodec)
RegisterBitmap adds (or replaces) a bitmap codec under its Name().
func (*Registry) RegisterLength ¶
func (r *Registry) RegisterLength(l iso8583.LengthCodec)
RegisterLength adds (or replaces) a length codec under its Name().
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package subfield implements the positional subfield-packager composite value codec: a field whose body is itself a bitmap followed by positional subfields, the way ISO-8583 DE 127 (reserved-private use) is commonly carried — a nested mini-message addressed under the uniform path grammar ("127.2", "127.22").
|
Package subfield implements the positional subfield-packager composite value codec: a field whose body is itself a bitmap followed by positional subfields, the way ISO-8583 DE 127 (reserved-private use) is commonly carried — a nested mini-message addressed under the uniform path grammar ("127.2", "127.22"). |
|
Package tlv implements the BER-TLV composite value codec used for EMV data (ISO-8583 DE 55) and other tag-length-value fields.
|
Package tlv implements the BER-TLV composite value codec used for EMV data (ISO-8583 DE 55) and other tag-length-value fields. |