codecs

package module
v1.0.0-rc8 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

README

mongo-go-driver-protobuf

This is extension for officional MongoDB Go driver adds support for Google protocol buffers types.

Description

It contains set of BSON marshal/unmarshal codecs for Google protocol buffers type wrappers, Timestamp and MongoDB ObjectID:

  • BoolValue
  • BytesValue
  • DoubleValue
  • FloatValue
  • Int32Value
  • Int64Value
  • StringValue
  • Uint32Value
  • Uint64Value
  • Timestamp
  • ObjectID
  • Struct

Requirements

  • Google protocol buffers version proto3
  • Official MongoDB Go Driver RC1 or higher

Installation

Installing using go get:

go get -u github.com/Hunrik/mongo-go-driver-protobuf

or you don't need to do anything manually if you are using Go modules. Go modules installs necessary packages automatically.

Usage example

First install protoc-gen-gotag to make available Go language tags for proto messages

go get -u github.com/Hunrik/protoc-gen-gotag

Next

  1. Create free Altas mini MongoDB instance
  2. Create experiments database
  3. Create proto collection into experiments database
  4. Run this example

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

Register registers Google protocol buffers types codecs

func ToStruct

func ToStruct(v map[string]interface{}) *st.Struct

ToStruct converts a map[string]interface{} to a ptypes.Struct

func ToValue

func ToValue(v interface{}) *st.Value

ToValue converts an interface{} to a ptypes.Value

Types

This section is empty.

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

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