Help us shape the future of Go! Take the 2026 Go Developer Survey

gopymarshal

package module
v0.0.0-...-cd92f94 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: MIT Imports: 4 Imported by: 0

README

go-pymarshal

Marshal and unmarshall data between golang and python

Versions

0.1

  • unmarshal python marshaled data
  • marshal golang data as python marshaled data

Notes

  • for unmarshal, supported types are listed below:
    • None
    • int
    • string
    • unicode
    • float
    • list
    • dict
  • for marshal, supported types are listed below:
    • nil
    • int32
    • float
    • string
    • slice (with the types above)
    • map (with the types above)

Documentation

Index

Constants

View Source
const (
	CODE_NONE      = 'N' //None
	CODE_INT       = 'i' //integer
	CODE_INT2      = 'c' //integer2
	CODE_FLOAT     = 'g' //float
	CODE_STRING    = 's' //string
	CODE_UNICODE   = 'u' //unicode string
	CODE_TSTRING   = 't' //tstring?
	CODE_TUPLE     = '(' //tuple
	CODE_LIST      = '[' //list
	CODE_DICT      = '{' //dict
	CODE_STOP      = '0'
	DICT_INIT_SIZE = 64
)

Variables

View Source
var (
	ERR_PARSE        = errors.New("invalid data")
	ERR_UNKNOWN_CODE = errors.New("unknown code")
)
View Source
var (
	ErrType = errors.New("unsupport type")
)

Functions

func EmptyMap

func EmptyMap() (ret []byte)

func Marshal

func Marshal(data interface{}) (ret []byte, retErr error)

func Unmarshal

func Unmarshal(buffer *bytes.Buffer) (ret interface{}, retErr error)

Unmarshal data serialized by python

func Unmarshal2

func Unmarshal2(buffer *bytes.Buffer) (ret interface{}, remainder []byte, retErr error)

Unmarshal data serialized by python, returning the unused portion.

Types

This section is empty.

Jump to

Keyboard shortcuts

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