goobjfmt

package
v0.0.0-...-29ffec6 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2017 License: MIT, MIT Imports: 12 Imported by: 0

README

goobjfmt

Marshal struct input text format( protobuf text )

like key : value

key has no ""

string value should have ""

Example

	input := &MyData{
		Name:   "genji",
		Type:   MyCar_Pig,
		Uint32: math.MaxUint32,
		Int64:  math.MaxInt64,
		Uint64: math.MaxUint64,
	}

	t.Log(MarshalTextString(input))

Feedback

Star me if you like or use, thanks

blog(Chinese): http://www.cppblog.com/sunicdavy

zhihu(Chinese): http://www.zhihu.com/people/sunicdavy

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidType = errors.New("invalid type")
	ErrOutOfData   = errors.New("out of data")
)

Functions

func BinaryRead

func BinaryRead(data []byte, obj interface{}) error

func BinarySize

func BinarySize(obj interface{}) int

func BinaryWrite

func BinaryWrite(obj interface{}) ([]byte, error)

func CompactTextString

func CompactTextString(obj interface{}) string

func MarshalTextString

func MarshalTextString(obj interface{}) string

Types

type TextMarshaler

type TextMarshaler struct {
	Compact        bool // use compact text format (one line).
	IgnoreDefault  bool // Do not output value when value equals its default value
	OriginalString bool // Do not output string as byte
}

TextMarshaler is a configurable text format marshaler.

func (*TextMarshaler) Marshal

func (self *TextMarshaler) Marshal(w io.Writer, obj interface{}) error

func (*TextMarshaler) Text

func (self *TextMarshaler) Text(obj interface{}) string

Jump to

Keyboard shortcuts

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