Kotlin Protobuf BSON Codec

Provide a Protobuf BSON Codec Provider for MongoDB, written by Kotlin

License

License

Categories

Categories

Kotlin Languages Protobuf Data Data Structures
GroupId

GroupId

io.github.gaplotech
ArtifactId

ArtifactId

kotlin-protobuf-bson-codec
Last Version

Last Version

0.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

Kotlin Protobuf BSON Codec
Provide a Protobuf BSON Codec Provider for MongoDB, written by Kotlin
Project URL

Project URL

https://github.com/gaplotech/kotlin-protobuf-bson-codec
Source Code Management

Source Code Management

https://github.com/gaplotech/kotlin-protobuf-bson-codec

Download kotlin-protobuf-bson-codec

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.gaplotech/kotlin-protobuf-bson-codec/ -->
<dependency>
    <groupId>io.github.gaplotech</groupId>
    <artifactId>kotlin-protobuf-bson-codec</artifactId>
    <version>0.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.gaplotech/kotlin-protobuf-bson-codec/
implementation 'io.github.gaplotech:kotlin-protobuf-bson-codec:0.3.0'
// https://jarcasting.com/artifacts/io.github.gaplotech/kotlin-protobuf-bson-codec/
implementation ("io.github.gaplotech:kotlin-protobuf-bson-codec:0.3.0")
'io.github.gaplotech:kotlin-protobuf-bson-codec:jar:0.3.0'
<dependency org="io.github.gaplotech" name="kotlin-protobuf-bson-codec" rev="0.3.0">
  <artifact name="kotlin-protobuf-bson-codec" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.gaplotech', module='kotlin-protobuf-bson-codec', version='0.3.0')
)
libraryDependencies += "io.github.gaplotech" % "kotlin-protobuf-bson-codec" % "0.3.0"
[io.github.gaplotech/kotlin-protobuf-bson-codec "0.3.0"]

Dependencies

compile (4)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.2.41
com.google.protobuf : protobuf-java jar 3.5.1
com.google.protobuf : protobuf-java-util jar 3.5.1
org.mongodb : bson jar 3.6.3

test (3)

Group / Artifact Type Version
org.litote.kmongo : kmongo-coroutine jar 3.6.2
io.kotlintest : kotlintest-runner-junit5 jar 3.0.4
org.jetbrains.kotlinx : kotlinx-coroutines-core jar 0.22.3

Project Modules

There are no modules declared in this project.

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)
io.github.gaplotech

GapLoTech

Versions

Version
0.3.0
0.2.0
0.1.2
0.1.1
0.1