I hereby claim:
- I am dshva on github.
- I am thinkharder (https://keybase.io/thinkharder) on keybase.
- I have a public key ASCcEX2YnRsUb_swODeGs_DPR4gH3gVjJw7Xl_bACt_VXgo
To claim this, I am signing this object:
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) => |
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 |
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
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) |
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) |