Skip to content

Commit e907147

Browse files
committed
code formatting
1 parent b7cc7ea commit e907147

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+11369
-11364
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ language: scala
44
services: mongodb
55

66
scala:
7-
- 2.12.10
7+
- 2.12.11
88
- 2.13.1
99

1010
branches:

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ name := "simple-mongo"
44

55
organization := "com.sfxcode.nosql"
66

7-
crossScalaVersions := Seq("2.13.1", "2.12.10")
7+
crossScalaVersions := Seq("2.13.1", "2.12.11")
88

99
scalaVersion := crossScalaVersions.value.head
1010

src/main/scala/com/sfxcode/nosql/mongo/Aggregate.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ package com.sfxcode.nosql.mongo
22

33
object Aggregate extends Aggregate
44

5-
trait Aggregate extends Field with Filter with Sort
5+
trait Aggregate extends Field with Filter with Sort

src/main/scala/com/sfxcode/nosql/mongo/Converter.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@ package com.sfxcode.nosql.mongo
33
import com.sfxcode.nosql.mongo.bson.BsonConverter
44
import org.mongodb.scala.Document
55

6-
/**
7-
* Created by tom on 20.01.17.
8-
*/
96
object Converter {
107

118
def toDocument(value: Any): Document =

src/main/scala/com/sfxcode/nosql/mongo/GridFSDAO.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ import com.sfxcode.nosql.mongo.database.DatabaseProvider
44
import com.sfxcode.nosql.mongo.gridfs.Metadata
55
import org.bson.types.ObjectId
66
import org.mongodb.scala.bson.conversions.Bson
7-
import org.mongodb.scala.gridfs.{GridFSBucket, GridFSFile}
7+
import org.mongodb.scala.gridfs.{ GridFSBucket, GridFSFile }
88
import org.mongodb.scala.model.CountOptions
9-
import org.mongodb.scala.{Document, Observable, ReadConcern, ReadPreference, SingleObservable, WriteConcern}
9+
import org.mongodb.scala.{ Document, Observable, ReadConcern, ReadPreference, SingleObservable, WriteConcern }
1010

1111
abstract class GridFSDAO(provider: DatabaseProvider, bucketName: String) extends Metadata(provider, bucketName) {
1212

1313
var bucket: GridFSBucket = {
1414
if (bucketName.contains(DatabaseProvider.CollectionSeparator)) {
1515
val newDatabaseName = bucketName.substring(0, bucketName.indexOf(DatabaseProvider.CollectionSeparator))
16-
val newBucketName = bucketName.substring(bucketName.indexOf(DatabaseProvider.CollectionSeparator) + 1)
16+
val newBucketName = bucketName.substring(bucketName.indexOf(DatabaseProvider.CollectionSeparator) + 1)
1717
GridFSBucket(provider.database(newDatabaseName), newBucketName)
1818
} else {
1919
GridFSBucket(provider.database(), bucketName)

src/main/scala/com/sfxcode/nosql/mongo/MongoDAO.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@ package com.sfxcode.nosql.mongo
22

33
import com.sfxcode.nosql.mongo.database.DatabaseProvider
44
import com.sfxcode.nosql.mongo.operation.Crud
5-
import org.mongodb.scala.{ Document, MongoCollection, MongoDatabase }
5+
import org.mongodb.scala.{ Document, MongoCollection }
66

77
import scala.reflect.ClassTag
88

99
/**
10-
* Created by tom on 20.01.17.
11-
*/
10+
* Created by tom on 20.01.17.
11+
*/
1212
abstract class MongoDAO[A](provider: DatabaseProvider, collectionName: String)(implicit ct: ClassTag[A])
13-
extends Crud[A] {
13+
extends Crud[A] {
1414

1515
val collection: MongoCollection[A] = {
1616
if (collectionName.contains(DatabaseProvider.CollectionSeparator)) {
17-
val newDatabaseName = collectionName.substring(0, collectionName.indexOf(DatabaseProvider.CollectionSeparator))
17+
val newDatabaseName = collectionName.substring(0, collectionName.indexOf(DatabaseProvider.CollectionSeparator))
1818
val newCollectionName = collectionName.substring(collectionName.indexOf(DatabaseProvider.CollectionSeparator) + 1)
1919
provider.database(newDatabaseName).getCollection[A](newCollectionName)
2020
} else {

src/main/scala/com/sfxcode/nosql/mongo/bson/BsonConverter.scala

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,26 @@ object BsonConverter {
2727
}
2828
case v: Any if converterPlugin.hasCustomClass(v) =>
2929
converterPlugin.toBson(v)
30-
case b: Boolean => BsonBoolean(b)
31-
case s: String => BsonString(s)
32-
case c: Char => BsonString(c.toString)
30+
case b: Boolean => BsonBoolean(b)
31+
case s: String => BsonString(s)
32+
case c: Char => BsonString(c.toString)
3333
case bytes: Array[Byte] => BsonBinary(bytes)
34-
case r: Regex => BsonRegularExpression(r)
35-
case d: Date => BsonDateTime(d)
34+
case r: Regex => BsonRegularExpression(r)
35+
case d: Date => BsonDateTime(d)
3636
case ld: LocalDate =>
3737
BsonDateTime(Date.from(ld.atStartOfDay(ZoneId.systemDefault()).toInstant))
3838
case ldt: LocalDateTime =>
3939
BsonDateTime(Date.from(ldt.atZone(ZoneId.systemDefault()).toInstant))
40-
case oid: ObjectId => BsonObjectId(oid)
41-
case i: Int => BsonInt32(i)
42-
case l: Long => BsonInt64(l)
43-
case bi: BigInt => BsonInt64(bi.toLong)
44-
case bi: BigInteger => BsonInt64(bi.longValue())
45-
case d: Double => BsonDouble(d)
46-
case f: Float => BsonDouble(f)
47-
case bd: BigDecimal => BsonDecimal128.apply(bd)
40+
case oid: ObjectId => BsonObjectId(oid)
41+
case i: Int => BsonInt32(i)
42+
case l: Long => BsonInt64(l)
43+
case bi: BigInt => BsonInt64(bi.toLong)
44+
case bi: BigInteger => BsonInt64(bi.longValue())
45+
case d: Double => BsonDouble(d)
46+
case f: Float => BsonDouble(f)
47+
case bd: BigDecimal => BsonDecimal128.apply(bd)
4848
case bd: java.math.BigDecimal => BsonDecimal128.apply(bd)
49-
case doc: Document => BsonDocument(doc)
49+
case doc: Document => BsonDocument(doc)
5050
case map: Map[_, _] =>
5151
var doc = Document()
5252
map.keys.foreach(key => {
@@ -76,22 +76,22 @@ object BsonConverter {
7676
def fromBson(value: BsonValue): Any =
7777
value match {
7878

79-
case b: BsonBoolean => b.getValue
80-
case s: BsonString => s.getValue
81-
case bytes: BsonBinary => bytes.getData
79+
case b: BsonBoolean => b.getValue
80+
case s: BsonString => s.getValue
81+
case bytes: BsonBinary => bytes.getData
8282
case r: BsonRegularExpression => r.getPattern
83-
case d: BsonDateTime => new Date(d.getValue)
84-
case d: BsonTimestamp => new Date(d.getTime)
85-
case oid: BsonObjectId => oid.getValue
86-
case i: BsonInt32 => i.getValue
87-
case l: BsonInt64 => l.getValue
88-
case d: BsonDouble => d.doubleValue()
89-
case d: BsonDecimal128 => d.getValue.bigDecimalValue()
90-
case doc: BsonDocument => Document(doc)
83+
case d: BsonDateTime => new Date(d.getValue)
84+
case d: BsonTimestamp => new Date(d.getTime)
85+
case oid: BsonObjectId => oid.getValue
86+
case i: BsonInt32 => i.getValue
87+
case l: BsonInt64 => l.getValue
88+
case d: BsonDouble => d.doubleValue()
89+
case d: BsonDecimal128 => d.getValue.bigDecimalValue()
90+
case doc: BsonDocument => Document(doc)
9191
case array: BsonArray =>
9292
array.getValues.asScala.toList.map(v => fromBson(v))
9393
case n: BsonNull => null
94-
case _ => value
94+
case _ => value
9595
}
9696

9797
def asMap(document: Document): Map[String, Any] = {

src/main/scala/com/sfxcode/nosql/mongo/bson/codecs/BigDecimalCodec.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import org.bson.codecs.{ Codec, DecoderContext, EncoderContext }
44
import org.bson.{ BsonReader, BsonWriter }
55

66
/**
7-
* A Codec for BigDecimal instances.
8-
*
9-
*/
7+
* A Codec for BigDecimal instances.
8+
*
9+
*/
1010
class BigDecimalCodec extends Codec[BigDecimal] {
1111

1212
override def decode(reader: BsonReader, decoderContext: DecoderContext): BigDecimal =

src/main/scala/com/sfxcode/nosql/mongo/bson/codecs/BigIntCodec.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import org.bson.codecs.{ Codec, DecoderContext, EncoderContext }
44
import org.bson.{ BsonReader, BsonWriter }
55

66
/**
7-
* A Codec for BigInt instances.
8-
*
9-
* @since 3.0
10-
*/
7+
* A Codec for BigInt instances.
8+
*
9+
* @since 3.0
10+
*/
1111
class BigIntCodec extends Codec[BigInt] {
1212

1313
override def decode(reader: BsonReader, decoderContext: DecoderContext): BigInt =

src/main/scala/com/sfxcode/nosql/mongo/bson/codecs/CustomCodecProvider.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ import org.bson.codecs.configuration.{ CodecProvider, CodecRegistry }
55

66
case class CustomCodecProvider() extends CodecProvider {
77

8-
val BigIntClass: Class[BigInt] = classOf[BigInt]
8+
val BigIntClass: Class[BigInt] = classOf[BigInt]
99
val BigDecimalClass: Class[BigDecimal] = classOf[BigDecimal]
1010

1111
// scalastyle:off null
1212
@SuppressWarnings(Array("unchecked"))
1313
def get[T](clazz: Class[T], registry: CodecRegistry): Codec[T] =
1414
clazz match {
15-
case BigIntClass => new BigIntCodec().asInstanceOf[Codec[T]]
15+
case BigIntClass => new BigIntCodec().asInstanceOf[Codec[T]]
1616
case BigDecimalClass => new BigDecimalCodec().asInstanceOf[Codec[T]]
17-
case _ => null
17+
case _ => null
1818
}
1919
// scalastyle:on null
2020
}

0 commit comments

Comments
 (0)