codec

package
v1.1.24 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterCodec

func RegisterCodec(ext string)

RegisterCodec register codec

Types

type TomlCodec

type TomlCodec struct{}

TomlCodec is a Codec implementation with toml.

func init() {
    encoding.RegisterCodec(codec.TomlCodec{})
}

func (TomlCodec) Marshal

func (TomlCodec) Marshal(v interface{}) ([]byte, error)

Marshal returns the wire format of v.

func (TomlCodec) Name

func (TomlCodec) Name() string

Name returns the name of the Codec implementation. The returned string will be used as part of content type in transmission. The result must be static; the result cannot change between calls.

func (TomlCodec) Unmarshal

func (TomlCodec) Unmarshal(data []byte, v interface{}) error

Unmarshal parses the wire format into v.

type YamlCodec

type YamlCodec struct{}

YamlCodec is a Codec implementation with yaml.

func init() {
    encoding.RegisterCodec(codec.YamlCodec{})
}

func (YamlCodec) Marshal

func (YamlCodec) Marshal(v interface{}) ([]byte, error)

Marshal returns the wire format of v.

func (YamlCodec) Name

func (YamlCodec) Name() string

Name returns the name of the Codec implementation. The returned string will be used as part of content type in transmission. The result must be static; the result cannot change between calls.

func (YamlCodec) Unmarshal

func (YamlCodec) Unmarshal(data []byte, v interface{}) error

Unmarshal parses the wire format into v.

Jump to

Keyboard shortcuts

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