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

goobjfmt

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2019 License: MIT Imports: 12 Imported by: 59

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

开源讨论群: 527430600

知乎: 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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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