serializer

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 0 Imported by: 0

README

Serializer

Usage

package serializer_test

import (
	"log"

	"github.com/go-packagist/go-kratos-components/serializer/json"
)

var j = json.Serializer

func ExampleJSON() {
	bytes, err := j.Serialize(map[string]string{
		"key": "value",
	})
	if err != nil {
		log.Fatal(err)
	}

	var dest map[string]string
	err = j.Unserialize(bytes, &dest)
	if err != nil {
		log.Fatal(err)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Serializable added in v1.2.0

type Serializable interface {
	// Serialize the given data into bytes.
	Serialize(data interface{}) ([]byte, error)

	// Unserialize the given bytes into the given data.
	Unserialize(src []byte, dest interface{}) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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