Version: v3.7.0+incompatible Latest Latest

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

Go to latest
Published: Sep 3, 2017 License: MIT Imports: 3 Imported by: 0




This section is empty.


This section is empty.


This section is empty.


type AliasContainer

type AliasContainer struct {
	Fast FastAlias

type Block

type Block [32]byte

type Bunny

type Bunny struct {
	Carrots []int             `msg:",omitempty"`
	Sayings map[string]string `msg:",omitempty"`
	BunnyId int               `msg:",omitempty"`

type Custom

type Custom struct {
	Bts   CustomBytes          `msg:"bts"`
	Mp    map[string]*Embedded `msg:"mp"`
	Enums []MyEnum             `msg:"enums"` // test explicit enum shim
	Some  FileHandle           `msg:file_handle`

type CustomBytes

type CustomBytes []byte

type CustomInt

type CustomInt int

type Embedded

type Embedded struct {
	*Embedded   // test embedded field
	Children    []Embedded
	PtrChildren []*Embedded
	Other       string

type FastAlias

type FastAlias TestFast

Test nested aliases

type FileHandle

type FileHandle struct {
	Relevent Files  `msg:"files"`
	Name     string `msg:"name"`

type Files

type Files []*os.File

type Fixed

type Fixed struct {
	A float64
	B bool

test fixed-size struct size compilation

type Insane

type Insane [3]map[string]InsaneInner

anonymous structs can't be serialized with greenpack, because the fieldsempty/everything omitempty by default logic requires named types when we define the helper method fieldsNotEmpty().

type InsaneInner

type InsaneInner struct{ A, B CustomInt }

type IntA

type IntA int

Test dependency resolution

type IntB

type IntB IntA

type IntC

type IntC IntB

type Moose

type Moose struct {
	Trees   []int             `msg:",omitempty"`
	Sayings map[string]string `msg:",omitempty"`
	Id      int

type MyEnum

type MyEnum byte
const (
	A MyEnum = iota

func (MyEnum) String

func (m MyEnum) String() string

type Object

type Object struct {
	ObjectNo string   `msg:"objno"`
	Slice1   []string `msg:"slice1"`
	Slice2   []string `msg:"slice2"`
	MapMap   map[string]map[string]string

type OmitEmptyInside1

type OmitEmptyInside1 struct {
	CountOfMonteCrisco int
	Name               string           `msg:"name,omitempty"`
	Inside2            OmitEmptyInside2 `msg:",omitempty"`

type OmitEmptyInside2

type OmitEmptyInside2 struct {
	NameSuey string `msg:",omitempty"`

type OmitSimple

type OmitSimple struct {
	CountDrocula int
	Inside1      OmitEmptyInside1 `msg:",omitempty"`

type PreviouslyAnon

type PreviouslyAnon struct {
	ValueA string `msg:"value_a"`
	ValueB []byte `msg:"value_b"`

type Rocky

type Rocky struct {
	Bugs  *Bunny `msg:",omitempty"`
	Road  string `msg:",omitempty"`
	Moose *Moose `msg:",omitempty"`

type SimpleTestType

type SimpleTestType struct {
	F   *float64          `msg:"float"`
	Els map[string]string `msg:"elements"`
	Obj *PreviouslyAnon   `msg:"object"`

type SpecialID

type SpecialID string

type T

type T struct {
	T time.Time

type TestBench

type TestBench struct {
	Name     string
	BirthDay time.Time
	Phone    string
	Siblings int
	Spouse   bool
	Money    float64

type TestFast

type TestFast struct {
	Lat, Long, Alt float64 // test inline decl
	Data           []byte

type TestHidden

type TestHidden struct {
	A   string
	B   []float64
	Bad func(string) bool // This results in a warning: field "Bad" unsupported

type TestObj

type TestObj struct{ ID1, ID2 SpecialID }

type TestOmitEmpty

type TestOmitEmpty struct {

	// scalars
	Name     string    `msg:",omitempty"`
	BirthDay time.Time `msg:",omitempty"`
	Phone    string    `msg:",omitempty"`
	Siblings int       `msg:",omitempty"`
	Spouse   bool      `msg:",omitempty"`
	Money    float64   `msg:",omitempty"`

	// slices
	SliceName     []string    `msg:",omitempty"`
	SliceBirthDay []time.Time `msg:",omitempty"`
	SlicePhone    []string    `msg:",omitempty"`
	SliceSiblings []int       `msg:",omitempty"`
	SliceSpouse   []bool      `msg:",omitempty"`
	SliceMoney    []float64   `msg:",omitempty"`

	// arrays
	ArrayName     [3]string    `msg:",omitempty"`
	ArrayBirthDay [3]time.Time `msg:",omitempty"`
	ArrayPhone    [3]string    `msg:",omitempty"`
	ArraySiblings [3]int       `msg:",omitempty"`
	ArraySpouse   [3]bool      `msg:",omitempty"`
	ArrayMoney    [3]float64   `msg:",omitempty"`

	// maps
	MapStringString map[string]string      `msg:",omitempty"`
	MapStringIface  map[string]interface{} `msg:",omitempty"`

	// pointers
	PtrName     *string    `msg:",omitempty"`
	PtrBirthDay *time.Time `msg:",omitempty"`
	PtrPhone    *string    `msg:",omitempty"`
	PtrSiblings *int       `msg:",omitempty"`
	PtrSpouse   *bool      `msg:",omitempty"`
	PtrMoney    *float64   `msg:",omitempty"`

	Inside1    OmitEmptyInside1 `msg:",omitempty"`
	Greetings  string           `msg:",omitempty"`
	Bullwinkle *Rocky           `msg:",omitempty"`

Test omitempty tag

type TestType

type TestType struct {
	F        *float64          `msg:"float"`
	Els      map[string]string `msg:"elements"`
	Obj      PreviouslyAnon    `msg:"object"`
	Child    *TestType         `msg:"child"`
	Time     time.Time         `msg:"time"`
	Any      interface{}       `msg:"any"`
	Appended msgp.Raw          `msg:"appended"`
	Num      msgp.Number       `msg:"num"`
	Slice1   []string
	Slice2   []string
	SlicePtr *[]string

type Things

type Things struct {
	Cmplx complex64 `msg:"complex"` // test slices
	Vals  []int32   `msg:"values"`
	//Arr   [msgp.ExtensionPrefixSize]float64 `msg:"arr"`            // test const array and *ast.SelectorExpr as array size
	Arr  [6]float64         `msg:"arr"`            // test const array and *ast.SelectorExpr as array size
	Arr2 [4]float64         `msg:"arr2"`           // test basic lit array
	Ext  *msgp.RawExtension `msg:"ext,extension"`  // test extension
	Oext msgp.RawExtension  `msg:"oext,extension"` // test extension reference

type TopNester

type TopNester struct {
	TopId      int
	Greetings  string `msg:",omitempty"`
	Bullwinkle *Rocky `msg:",omitempty"`

	MyIntArray  [3]int               `msg:",omitempty"`
	MyByteArray [3]byte              `msg:",omitempty"`
	MyMap       map[string]string    `msg:",omitempty"`
	MyArrayMap  [3]map[string]string `msg:",omitempty"`

	// the time.Time extension
	TopTime time.Time  `msg:",omitempty"`
	PtrTime *time.Time `msg:",omitempty"`

type Tree

type Tree struct {
	Children []Tree
	Element  int
	Parent   *Wrapper

type Wrapper

type Wrapper struct {
	Tree *Tree

type X

type X struct {
	Values    [32]byte    // should compile to 32*msgp.ByteSize; encoded as Bin
	More      Block       // should be identical to the above
	Others    [][32]int32 // should compile to len(x.Others)*32*msgp.Int32Size
	Matrix    [][]int32   // should not optimize
	ManyFixed []Fixed

tests edge-cases with compiling size compilation.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL