Skip to content

Commit

Permalink
Action sbt scalafmtAll
Browse files Browse the repository at this point in the history
  • Loading branch information
takapi327 committed Jan 26, 2025
1 parent 2f0e039 commit d1700da
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

package ldbc.connector

import java.util.{ Locale, StringTokenizer }
import java.nio.charset.Charset
import java.util.{ Locale, StringTokenizer }

import scala.collection.immutable.{ ListMap, SortedMap }

Expand Down Expand Up @@ -81,7 +81,11 @@ private[ldbc] case class DatabaseMetaDataImpl[F[_]: Temporal: Exchange: Tracer](
resultSetRow <- protocol.readUntilEOF[ResultSetRowPacket](
ResultSetRowPacket.decoder(protocol.initialPacket.capabilityFlags, columnDefinitions)
)
yield resultSetRow.headOption.flatMap(_.values.headOption).flatten.map(_.toByteVector.decodeUtf8Lenient).getOrElse("")
yield resultSetRow.headOption
.flatMap(_.values.headOption)
.flatten
.map(_.toByteVector.decodeUtf8Lenient)
.getOrElse("")
}

override def getDatabaseProductVersion(): String = protocol.initialPacket.serverVersion.toString
Expand Down Expand Up @@ -527,7 +531,9 @@ private[ldbc] case class DatabaseMetaDataImpl[F[_]: Temporal: Exchange: Tracer](
override def columnType: ColumnDataType = ColumnDataType.MYSQL_TYPE_VARCHAR
override def flags: Seq[ColumnDefinitionFlags] = Seq.empty
},
dbList.map(name => ResultSetRowPacket(Array(BitVector.encodeString(name)(using Charset.defaultCharset()).toOption))).toVector,
dbList
.map(name => ResultSetRowPacket(Array(BitVector.encodeString(name)(using Charset.defaultCharset()).toOption)))
.toVector,
serverVariables,
protocol.initialPacket.serverVersion
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,16 +398,16 @@ private[ldbc] case class ResultSetImpl(

private def rowDecode[T](index: Int, decode: String => T): Option[T] =
for
row <- currentRow
value <- row.values(index - 1)
decoded <- try { Option(decode(value.toByteVector.decodeUtf8Lenient)) } catch
case _ => None
row <- currentRow
value <- row.values(index - 1)
decoded <- try { Option(decode(value.toByteVector.decodeUtf8Lenient)) }
catch case _ => None
yield decoded

private def rowDecode[T](index: Int)(using codec: Codec[T]): Option[T] =
for
row <- currentRow
value <- row.values(index)
row <- currentRow
value <- row.values(index)
decoded <- codec.decode(value).toOption
yield decoded.value

Expand Down

0 comments on commit d1700da

Please sign in to comment.