codec

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() encoding.Codec

New create codec

Types

type Codec

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

Codec serializer

func (*Codec) Marshal

func (c *Codec) Marshal(v any) ([]byte, error)

Marshal serialize data

func (*Codec) Unmarshal

func (c *Codec) Unmarshal(data []byte, v any) error

Unmarshal deserialize data

type DataType

type DataType byte

DataType data type

const (
	// TypeUnknown unknown type
	TypeUnknown DataType = iota
	// TypeRaw raw data
	TypeRaw
	// TypeHTTPRequest http request data
	TypeHTTPRequest
	// TypeHTTPResponse http response data
	TypeHTTPResponse
)

type Variable

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

Variable variable data

func (*Variable) Bytes

func (v *Variable) Bytes() []byte

Bytes get raw bytes

func (*Variable) ToRequest

func (v *Variable) ToRequest() (*http.Request, error)

ToRequest convert to http request

func (*Variable) ToResponse

func (v *Variable) ToResponse() (*http.Response, error)

ToResponse convert to http response

func (*Variable) Type

func (v *Variable) Type() DataType

Type data type

Jump to

Keyboard shortcuts

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