pool

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package pool provides an example usage of unmarshalling JSON into a struct using sync.Pool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pools

type Pools struct {
	Objects  *sync.Pool
	Contents *sync.Pool
	Buffers  *sync.Pool
}

Pools is a collection of *sync.Pool objects.

func NewPools

func NewPools() *Pools

NewPools returns a new *Pools with the *sync.Pool objects initialized.

func (*Pools) UnmarshalObject

func (pools *Pools) UnmarshalObject(jsonString string) (base.Object, error)

UnmarshalObject writes jsonString into a *bytes.Buffer using sync.Pool and unmarshals the buffer into a *base.Object. It then returns the dereferenced base.Object. The *base.Object is also obtained using sync.Pool.

Jump to

Keyboard shortcuts

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