msgbatch

package module
v0.0.0-...-17b035b Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

README

MsgBatch

Go lang msgpack batch data library for compress efficient processing.

Examples:

Encode:

 batch := msgbatch.Batch{}
 batch.Add(map[string]string{"url":"http://google.com/", "ts":"123"})
 batch.Add(map[string]string{"url":"http://google.com/", "id":"908908"})
 batch.Add(map[string]string{"url":"http://google.com/", "ts":"43556478346", "id": "6546"})
 batch.Add(map[string]string{"url":"http://google.com/"})
 dataBytes, err := batch.Encode()
 log.Printf("data len %d, err %s", len(dataBytes), err) 

Decode:

 batch, err = msgbatch.Decode(dataBytes)
 log.Printf("batch %v", batch.GetValues())

Documentation

Overview

******************************************************************************

  • Copyright 2014 by Artem Andreenko. *
  • Permission is hereby granted, free of charge, to any person obtaining a copy
  • of this software and associated documentation files (the "Software"), to
  • deal in the Software without restriction, including without limitation the
  • rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  • sell copies of the Software, and to permit persons to whom the Software is
  • furnished to do so, subject to the following conditions: *
  • The above copyright notice and this permission notice shall be included in
  • all copies or substantial portions of the Software. *
  • THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  • IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  • FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  • AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  • LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  • FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  • IN THE SOFTWARE. *****************************************************************************

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	Length  int64
	Columns []string
	Values  [][][]interface{}
}

func Decode

func Decode(data []byte) (batch Batch, err error)

func (*Batch) Add

func (batch *Batch) Add(e map[string]interface{})

func (*Batch) Encode

func (batch *Batch) Encode() (data []byte, err error)

func (*Batch) GetValues

func (batch *Batch) GetValues() (values []map[string]interface{})

Jump to

Keyboard shortcuts

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