I hereby claim:
- I am thinkharderdev on github.
- I am thinkharder (https://keybase.io/thinkharder) on keybase.
- I have a public key whose fingerprint is 575D 2A4A DC1D 72AB 1347 3260 904E 8177 8153 F43D
To claim this, I am signing this object:
| val bytes = Base64.decodeBase64(dataString.getBytes("UTF-8")) | |
| val tempFile = new File(UUID.randomUUID().toString) | |
| FileUtils.copy(new ByteArrayInputStream(bytes),new FileOutputStream(tempFile)) | |
| TemporaryFile(tempFile) |
| sealed trait UserRole | |
| case object BasicUser extends UserRole | |
| case object Admin extends UserRole | |
| // I can very easily define basic data types using case classes | |
| case class User(id: String, name: String, email: String, role: UserRole) | |
| //Defining User as a case class has a couple of implications | |
| // You don't need to use the "new" key word when instantiating an instance | |
| val user = User("id","Dan","[email protected]", Admin) |
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| import java.sql.Types | |
| import io.circe._ | |
| import io.getquill.context.jdbc.JdbcContextBase | |
| import org.postgresql.util.PGobject | |
| import doobie._ | |
| import doobie.implicits._ | |
| import doobie.postgres.implicits._ | |
| sealed trait IdentifierType |
| def encode[A](schema: Schema[A], value: A): Chunk[Byte] = schema match { | |
| case Schema.Sequence(element, _, g) => encodeSequence(element, g(value)) | |
| case Schema.Transform(codec, _, g) => g(value).map(encode(codec, _)).getOrElse(Chunk.empty) | |
| case Schema.Primitive(standardType) => encodePrimitive(standardType, value) | |
| case Schema.Optional(codec) => | |
| value match { | |
| case v: Option[_] => encodeOptional(codec, v) | |
| case _ => Chunk.empty | |
| } | |
| case Schema.Tuple(left, right) => |