encoding

package
v0.2.0-beta Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2023 License: MIT Imports: 1 Imported by: 0

README

Swap out the json implementation by overwriting the types and variables.

Here the standard json implementation is swapped out with jsoniter:

package main

import (
    "github.com/discordpkg/gateway/encoding"
    jsoniter "github.com/json-iterator/go"
)

var j = jsoniter.ConfigCompatibleWithStandardLibrary

func init() {
    encoding.Marshal = j.Marshal
    encoding.Unmarshal = j.Unmarshal
}

The idea here is that you may also switch to a different format such as ETF:

package main

import (
    "github.com/JakeMakesStuff/go-erlpack"
    "github.com/discordpkg/gateway/encoding"
)

func init() {
    encoding.Marshal = erlpack.Pack
    encoding.Unmarshal = erlpack.Unpack
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Marshal   = json.Marshal
	Unmarshal = json.Unmarshal
)

Functions

This section is empty.

Types

type RawMessage

type RawMessage = json.RawMessage

Jump to

Keyboard shortcuts

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