Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gaplotech/kotlin-protobuf-bson-codec

Open more actions menu

Repository files navigation

Introduction

kotlin-protobuf-bson-codec provide a PBCodecProvider to encode/decode from google protocol buffer & BSON genericly. It is 100% written by Kotlin.

The underlying implementation (PBBsonReader & PBBsonWriter) are mainly inspired by the official google protocol buffer json serialization (JsonFormat.Parser & JsonFormat.Printer).

Compatibility

PBCodecProvider is compatible to all mongodb driver using org.bson.*, for example

Note: Only Proto3 is supported

Gradle

compile 'io.github.gaplotech:kotlin-protobuf-bson-codec:0.3.0'

Maven

<dependency>
  <groupId>io.github.gaplotech</groupId>
  <artifactId>kotlin-protobuf-bson-codec</artifactId>
  <version>0.3.0</version>
</dependency>

Example

// register the codec provider
val registry = CodecRegistries.fromRegistries(
                   CodecRegistries.fromProviders(PBCodecProvider()),
                   MongoClients.getDefaultCodecRegistry()
               )

// use the registry for the database
val collection = createClient()
    .getDatabase(...)
    .withCodecRegistry(registry)

About

Provide a Protobuf BSON Codec for MongoDB, written by Kotlin

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.