Library to integrate github.com/google/uuid with gopkg.in/vmihailenco/msgpack

UUID msgpack

Lint Tests codecov Go Report Card License GoDoc Release

Library to integrate github.com/google/uuid with gopkg.in/vmihailenco/msgpack

Installation

go get github.com/citilinkru/uuid-msgpack

Example

package main

import (
	_ "github.com/citilinkru/uuid-msgpack" // This blank import is required to register encoder/decoder!
	"github.com/google/uuid"
	"log"
	"bytes"
	"gopkg.in/vmihailenco/msgpack.v2" 
)

func main() {
	id := uuid.New()
	buf := bytes.NewBuffer(nil)
	encoder := msgpack.NewEncoder(buf)
	err := encoder.Encode(id)
	if err != nil {
		log.Fatalf("can't encode uuid: %s", err)
	}
	reader := bytes.NewReader(buf.Bytes())
	decoder := msgpack.NewDecoder(reader)
	var decodedId uuid.UUID
	err = decoder.Decode(&decodedId)
	if err != nil {
		log.Fatalf("can't decode uuid: %s", err)
	}

	if id.String() == decodedId.String() {
		log.Printf("original id is equal to decoded '%s'\n", id)
	} else {
		log.Printf("decoded id '%s' is not equal to origin '%s'\n", id, decodedId)
	}
	
	log.Println("done")
}

Testing

Unit-tests:

go test -v -race ./...

Run linter:

go mod vendor \
  && docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint:v1.40 golangci-lint run -v \
  && rm -R vendor

CONTRIBUTE

  • write code
  • run go fmt ./...
  • run all linters and tests (see above)
  • create a PR describing the changes

LICENSE

MIT

AUTHOR

Nikita Sapogov [email protected]

Similar Resources

A UUID package originally forked from github.com/satori/go.uuid

UUID Package uuid provides a pure Go implementation of Universally Unique Identifiers (UUID) variant as defined in RFC-4122. This package supports bot

Dec 30, 2022

*DEPRECATED* Please use https://gopkg.in/redsync.v1 (https://github.com/go-redsync/redsync)

Redsync.go This package is being replaced with https://gopkg.in/redsync.v1. I will continue to maintain this package for a while so that its users do

Nov 20, 2022

msgpack.org[Go] MessagePack encoding for Golang

MessagePack encoding for Golang ❤️ Uptrace.dev - distributed traces, logs, and errors in one place Join Discord to ask questions. Documentation Refere

Dec 28, 2022

msgpack.org[Go] MessagePack encoding for Golang

MessagePack encoding for Golang ❤️ Uptrace.dev - All-in-one tool to optimize performance and monitor errors & logs Join Discord to ask questions. Docu

Dec 28, 2022

gopkg is a universal utility collection for Go, it complements offerings such as Boost, Better std, Cloud tools.

gopkg is a universal utility collection for Go, it complements offerings such as Boost, Better std, Cloud tools. Table of Contents Introduction

Jan 5, 2023

Gopkg - Search go.dev packages by keyword

gopkg Search go.dev packages by keyword Usage Install go install github.com/luck

Apr 6, 2022

Simple command line tool helper to integrate with hashicorp vault & github api

Overview CI/CD Toolkit is small command line tool helper to integrate with vault secret kv management & github api We can use simple command to genera

Apr 2, 2022

A simple uuid library based on RFC 4122

UUID generator A simple library that generates uuids. Supported versions: version 1 version 3 version 4 version 5 Supported variants: DCE Microsoft Th

Oct 20, 2021

Yubigo is a Yubikey client API library that provides an easy way to integrate the Yubico Yubikey into your existing Go-based user authentication infrastructure.

yubigo Yubigo is a Yubikey client API library that provides an easy way to integrate the Yubikey into any Go application. Installation Installation is

Oct 27, 2022

An extremely fast UUID alternative written in golang

Overview WUID is a globally unique number generator, while it is NOT a UUID implementation. WUID is 10-135 times faster than UUID and 4600 times faste

Dec 9, 2022

An extremely fast UUID alternative written in golang

Overview WUID is a globally unique number generator, while it is NOT a UUID implementation. WUID is 10-135 times faster than UUID and 4600 times faste

May 10, 2021

UUID package for Go

UUID package for Go language This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing

Jan 2, 2023

A lightweight UUID implementation

uuid uuid is a lightweight implementation for Univerally unique identifier. Usage var id UUID = uuid.Rand() fmt.Println(id.Hex()) fmt.Println(id.Raw()

Feb 25, 2020

golang uuid-shellcode加载器,分离执行,可直接把shellcode写入程序。

golang uuid-shellcode加载器,分离执行,可直接把shellcode写入程序。

Jan 7, 2023

Postgres uuid[] field for gorm.io - Golang

Postgres uuid[] field for gorm.io - Golang

Jan 17, 2022

Generate UUID for script's sql

Generate UUID for script's sql Instale o go em sua maquina https://golang.org/doc/install Baixe as seguintes dependecias go get github.com/satori/go.u

Oct 26, 2021

generate random data like name, email, uuid, address, images and etc.

gg-rand generate random data like name, email, uuid, address, images and etc. build and install: make run: gg-rand $ gg-rand SillyName : Knavesa

Nov 16, 2022

Alternative random id generation to uuid

randid import "go.withmatt.com/randid" id := randid.New().String() randid's goals are simple: a smaller, more compact, faster version of uuid4. I don

Nov 16, 2022

UUID package for Golang

UUID package for Go language This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing

Dec 9, 2021
A simple uuid library based on RFC 4122

UUID generator A simple library that generates uuids. Supported versions: version 1 version 3 version 4 version 5 Supported variants: DCE Microsoft Th

Oct 20, 2021
An extremely fast UUID alternative written in golang

Overview WUID is a globally unique number generator, while it is NOT a UUID implementation. WUID is 10-135 times faster than UUID and 4600 times faste

Dec 9, 2022
An extremely fast UUID alternative written in golang

Overview WUID is a globally unique number generator, while it is NOT a UUID implementation. WUID is 10-135 times faster than UUID and 4600 times faste

May 10, 2021
UUID package for Go

UUID package for Go language This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing

Jan 2, 2023
A lightweight UUID implementation

uuid uuid is a lightweight implementation for Univerally unique identifier. Usage var id UUID = uuid.Rand() fmt.Println(id.Hex()) fmt.Println(id.Raw()

Feb 25, 2020
Generate UUID for script's sql

Generate UUID for script's sql Instale o go em sua maquina https://golang.org/doc/install Baixe as seguintes dependecias go get github.com/satori/go.u

Oct 26, 2021
Alternative random id generation to uuid

randid import "go.withmatt.com/randid" id := randid.New().String() randid's goals are simple: a smaller, more compact, faster version of uuid4. I don

Nov 16, 2022
UUID package for Golang

UUID package for Go language This package provides pure Go implementation of Universally Unique Identifier (UUID). Supported both creation and parsing

Dec 9, 2021
A generator library for concise, unambiguous and URL-safe UUIDs

shortuuid A Go library that generates concise, unambiguous, URL-safe UUIDs. Based on and compatible with the Python library shortuuid. Often, one need

Jan 4, 2023
idiomatic codec and rpc lib for msgpack, cbor, json, etc. msgpack.org[Go]

go-codec This repository contains the go-codec library, the codecgen tool and benchmarks for comparing against other libraries. This is a High Perform

Dec 19, 2022