All Projects → mennanov → fmutils

mennanov / fmutils

Licence: MIT license
Golang protobuf FieldMask missing utils

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to fmutils

fieldmask-utils
Protobuf Field Mask Go utils
Stars: ✭ 127 (+98.44%)
Mutual labels:  protobuf, fieldmask
apache-flink-jdbc-streaming
Sample project for Apache Flink with Streaming Engine and JDBC Sink
Stars: ✭ 22 (-65.62%)
Mutual labels:  protobuf
go-grpcmw
A Go package and protobuf generator for managing grpc interceptors.
Stars: ✭ 19 (-70.31%)
Mutual labels:  protobuf
tinyrpc
Much fast, lightweight, async, based boost.beast and protobuf.
Stars: ✭ 32 (-50%)
Mutual labels:  protobuf
POGOProtos
A central repository for all proto files of PokémonGO.
Stars: ✭ 136 (+112.5%)
Mutual labels:  protobuf
mongo-db-go-protobuf-tutorial
Source code for "New official MongoDB Go Driver and Google Protobuf - making them work together" article
Stars: ✭ 18 (-71.87%)
Mutual labels:  protobuf
aerospike-scala
Typesafe DSL for work with Aerospike Database
Stars: ✭ 40 (-37.5%)
Mutual labels:  protobuf
J1939-Framework
Framework to work with J1939 Frames used in CAN bus in bus, car and trucks industries
Stars: ✭ 123 (+92.19%)
Mutual labels:  protobuf
mine.js
🌏 A voxel engine built with JS/TS/RS. (formerly mc.js) (maybe mine.ts? or even mine.rs?)
Stars: ✭ 282 (+340.63%)
Mutual labels:  protobuf
rpc-spring-boot-starter
自定义rpc框架,支持Java序列化和protobuf序列化协议,多种负载均衡算法
Stars: ✭ 75 (+17.19%)
Mutual labels:  protobuf
erda-infra
Erda Infra is a lightweight microservices framework implements by golang, which offers many useful modules and tools to help you quickly build a module-driven application
Stars: ✭ 152 (+137.5%)
Mutual labels:  protobuf
faiss-server
faiss serving :)
Stars: ✭ 111 (+73.44%)
Mutual labels:  protobuf
flipper
Search/Recommendation engine and metainformation server for fanfiction net
Stars: ✭ 29 (-54.69%)
Mutual labels:  protobuf
universe-topology
A universal computer knowledge topology for all the programmers worldwide.
Stars: ✭ 47 (-26.56%)
Mutual labels:  protobuf
pronto
Clojure support for protocol buffers
Stars: ✭ 66 (+3.13%)
Mutual labels:  protobuf
edap
No description or website provided.
Stars: ✭ 22 (-65.62%)
Mutual labels:  protobuf
python-riemann-client
A Riemann client and command line tool
Stars: ✭ 38 (-40.62%)
Mutual labels:  protobuf
luban
你的最佳游戏配置解决方案 {excel, csv, xls, xlsx, json, bson, xml, yaml, lua, unity scriptableobject} => {json, bson, xml, lua, yaml, protobuf(pb), msgpack, flatbuffers, erlang, custom template} data + {c++, java, c#, go(golang), lua, javascript(js), typescript(ts), erlang, rust, gdscript, protobuf schema, flatbuffers schema, custom template} code。
Stars: ✭ 1,660 (+2493.75%)
Mutual labels:  protobuf
caffemodel2json
A small tool to dump Caffe's *.caffemodel to JSON for inspection
Stars: ✭ 40 (-37.5%)
Mutual labels:  protobuf
protobuf-decoder
JavaScript-based web UI to decode ad-hoc Protobuf data
Stars: ✭ 107 (+67.19%)
Mutual labels:  protobuf

Golang protobuf FieldMask utils

Build Status Coverage Status PkgGoDev

Filter a protobuf message with a FieldMask applied

// Keeps the fields mentioned in the paths untouched, all the other fields will be cleared.
fmutils.Filter(protoMessage, []string{"a.b.c", "d"})

Prune a protobuf message with a FieldMask applied

// Clears all the fields mentioned in the paths, all the other fields will be left untouched.
fmutils.Prune(protoMessage, []string{"a.b.c", "d"})

Working with Golang protobuf APIv1

This library uses the new Go API for protocol buffers. If your *.pb.go files are generated with the old version APIv1 then you have 2 choices:

  • migrate to the new APIv2 google.golang.org/protobuf
  • upgrade an existing APIv1 version to github.com/golang/[email protected] that implements the new API

In both cases you'll need to regenerate *.pb.go files.

If you decide to stay with APIv1 then you need to use the proto.MessageV2 function like this:

import protov1 "github.com/golang/protobuf/proto"

fmutils.Filter(protov1.MessageV2(protoMessage), []string{"a.b.c", "d"})

Read more about the Go protobuf API versions.

Examples

See the examples_test.go for real life examples.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].