jsonfmt

package
v0.0.0-...-4aef51c Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2018 License: Apache-2.0, Apache-2.0 Imports: 12 Imported by: 0

README

minimal json marshaling lib without full feature compatibility with encoding/json

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigDefault = Config{}.Froze()

Functions

func MarshalToString

func MarshalToString(obj interface{}) string

func WriteBytes

func WriteBytes(space []byte, s []byte) []byte

func WriteFloat32

func WriteFloat32(space []byte, val float32) []byte

WriteFloat32 write float32 to stream

func WriteFloat32Lossy

func WriteFloat32Lossy(space []byte, val float32) []byte

WriteFloat32Lossy write float32 to stream with ONLY 6 digits precision although much much faster

func WriteFloat64

func WriteFloat64(space []byte, val float64) []byte

WriteFloat64 write float64 to stream

func WriteFloat64Lossy

func WriteFloat64Lossy(space []byte, val float64) []byte

WriteFloat64Lossy write float64 to stream with ONLY 6 digits precision although much much faster

func WriteInt16

func WriteInt16(space []byte, nval int16) []byte

func WriteInt32

func WriteInt32(space []byte, nval int32) []byte

func WriteInt64

func WriteInt64(space []byte, nval int64) []byte

func WriteInt8

func WriteInt8(space []byte, nval int8) []byte

func WriteString

func WriteString(space []byte, str string) []byte

func WriteUint16

func WriteUint16(space []byte, val uint16) []byte

func WriteUint32

func WriteUint32(space []byte, val uint32) []byte

func WriteUint64

func WriteUint64(space []byte, val uint64) []byte

func WriteUint8

func WriteUint8(space []byte, val uint8) []byte

Types

type API

type API interface {
	EncoderOf(valType reflect2.Type) Encoder
	EncoderOfObject(obj interface{}) Encoder
}

type Config

type Config struct {
	IncludesUnexported bool
	Extensions         []Extension
}

func (Config) Froze

func (cfg Config) Froze() API

type Encoder

type Encoder interface {
	Encode(ctx context.Context, space []byte, ptr unsafe.Pointer) []byte
}

func EncoderOf

func EncoderOf(valType reflect2.Type) Encoder

func EncoderOfObject

func EncoderOfObject(obj interface{}) Encoder

type Extension

type Extension interface {
	EncoderOf(prefix string, valType reflect.Type) Encoder
}

Jump to

Keyboard shortcuts

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