enumeraum-mongodb


Лицензия

Лицензия

Категории

Категории

MongoDB Данные Базы данных
Группа

Группа

com.github.alonsodomin
Идентификатор

Идентификатор

enumeraum-mongodb_2.12
Последняя версия

Последняя версия

0.1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

enumeraum-mongodb
enumeraum-mongodb
Ссылка на сайт

Ссылка на сайт

https://github.com/alonsodomin/enumeratum-mongodb
Организация-разработчик

Организация-разработчик

com.github.alonsodomin
Система контроля версий

Система контроля версий

https://github.com/alonsodomin/enumeraum-mongodb

Скачать enumeraum-mongodb_2.12

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.alonsodomin/enumeraum-mongodb_2.12/ -->
<dependency>
    <groupId>com.github.alonsodomin</groupId>
    <artifactId>enumeraum-mongodb_2.12</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.alonsodomin/enumeraum-mongodb_2.12/
implementation 'com.github.alonsodomin:enumeraum-mongodb_2.12:0.1.0'
// https://jarcasting.com/artifacts/com.github.alonsodomin/enumeraum-mongodb_2.12/
implementation ("com.github.alonsodomin:enumeraum-mongodb_2.12:0.1.0")
'com.github.alonsodomin:enumeraum-mongodb_2.12:jar:0.1.0'
<dependency org="com.github.alonsodomin" name="enumeraum-mongodb_2.12" rev="0.1.0">
  <artifact name="enumeraum-mongodb_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.alonsodomin', module='enumeraum-mongodb_2.12', version='0.1.0')
)
libraryDependencies += "com.github.alonsodomin" % "enumeraum-mongodb_2.12" % "0.1.0"
[com.github.alonsodomin/enumeraum-mongodb_2.12 "0.1.0"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
org.scala-lang : scala-library jar 2.12.11
org.mongodb.scala : mongo-scala-driver_2.12 jar 2.9.0
com.beachape : enumeratum_2.12 jar 1.5.15

test (4)

Идентификатор библиотеки Тип Версия
org.slf4j : slf4j-api jar 1.7.30
org.slf4j : slf4j-simple jar 1.7.30
org.scalatest : scalatest_2.12 jar 3.1.1
com.github.simplyscala : scalatest-embedmongo_2.12 jar 0.2.4

Модули Проекта

Данный проект не имеет модулей.

Enumeratum MongoDB

Build Status License Maven Central

Extension for Enumeratum and official MongoDB Scala Driver

Getting started

Add the following to your build.sbt:

libraryDependencies += "com.github.alonsodomin" %% "enumeratum-mongodb" % <version>

Usage

Define an enumerated value following the guidelines stated in the Enumeratum documentation:

import enumeratum._
import enumeratum.mongodb._

sealed trait ShirtSize extends EnumEntry
object ShirtSize extends Enum[ShirtSize] with MongoDBEnum[ShirtSize] {
  case object Small  extends ShirtSize
  case object Medium extends ShirtSize
  case object Large  extends ShirtSize

  val values = findValues
}

To make it compatible with MongoDB Driver, we need to mix-in the MongoDBEnum trait into our enum definition as shown above, that will provide with the MongoDB codec generation code required to be abe to use this enum.

To have the codec available when communicating with MongoDB, we need to define a CodecRegistry as follows:

val enumCodecRegistry = CodecRegistry.fromProviders(ShirtSize.bsonCodecProvider)

Версии библиотеки

Версия
0.1.0