ldbc.connector.codec.BooleanCodec.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ldbc-connector_sjs1_3 Show documentation
Show all versions of ldbc-connector_sjs1_3 Show documentation
MySQL connector written in pure Scala3
/**
* Copyright (c) 2023-2024 by Takahiko Tominaga
* This software is licensed under the MIT License (MIT).
* For more information see LICENSE or https://opensource.org/licenses/MIT
*/
package ldbc.connector.codec
import ldbc.connector.data.Type
trait BooleanCodec:
val boolean: Codec[Boolean] = Codec.simple(
_.toString,
{
case "true" | "1" => Right(true)
case "false" | "0" => Right(false)
case unknown => Left(s"Invalid boolean value: $unknown")
},
Type.boolean
)
object boolean extends BooleanCodec
© 2015 - 2025 Weber Informatics LLC | Privacy Policy