Documentation ¶
Index ¶
- func ChunkJoinStrings(params []string, maxlength int, sep string) []string
- type BufferPool
- type ConcurrentMapString
- func (m *ConcurrentMapString) Add(key string, value string) error
- func (m *ConcurrentMapString) Del(key string) error
- func (m *ConcurrentMapString) Exists(key string) bool
- func (m *ConcurrentMapString) ForEach(do func(string, string))
- func (m *ConcurrentMapString) Get(key string) (string, error)
- func (m *ConcurrentMapString) Length() int
- func (m *ConcurrentMapString) Set(key string, value string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChunkJoinStrings ¶
ChunkJoinStrings takes a list of individual parameters and joins them to strings separated by sep, limited by the maxlength. For each item, if appending the item would breach the maxlength, it instead starts to build a new string. Once all of the strings are built, it returns the list of strings.
Types ¶
type BufferPool ¶
BufferPool holds the Buffers in a Channel as a queue.
func NewBufferPool ¶
func NewBufferPool(max int) *BufferPool
NewBufferPool creates a new object pool of bytes.Buffer.
func (*BufferPool) New ¶
func (pool *BufferPool) New() (buf *bytes.Buffer)
New takes a Buffer from the pool.
func (*BufferPool) Recycle ¶
func (pool *BufferPool) Recycle(buf *bytes.Buffer)
Recycle returns a BUffer to the pool.
func (*BufferPool) Warmup ¶
func (pool *BufferPool) Warmup(num, length int)
Warmup fills the BufferPool with the specified number of objects up to one below the maximum capacity of the internal channel
type ConcurrentMapString ¶
ConcurrentMapString is a simple map[string]string wrapped with a concurrent-safe API
func NewConcurrentMapString ¶
func NewConcurrentMapString() *ConcurrentMapString
NewConcurrentMapString initializes and returns a pointer to a new ConcurrentMapString instance.
func (*ConcurrentMapString) Add ¶
func (m *ConcurrentMapString) Add(key string, value string) error
Add is used to add a key/value to the map. Returns an error if the key already exists.
func (*ConcurrentMapString) Del ¶
func (m *ConcurrentMapString) Del(key string) error
Del is used to remove a key/value from the map. Returns an error if the key does not exist.
func (*ConcurrentMapString) Exists ¶
func (m *ConcurrentMapString) Exists(key string) bool
Exists is used by external callers to check if a value exists in the map and returns a boolean with the result.
func (*ConcurrentMapString) ForEach ¶
func (m *ConcurrentMapString) ForEach(do func(string, string))
ForEach will call the provided function for each entry in the ConcurrentMapString
func (*ConcurrentMapString) Get ¶
func (m *ConcurrentMapString) Get(key string) (string, error)
Get is used to get a key/value from the map. Returns an error if the key does not exist.
func (*ConcurrentMapString) Length ¶
func (m *ConcurrentMapString) Length() int
Length returns the length of the underlying map.