Skip to content

Commit

Permalink
#2: In squeryl, nullable fields are implemented with Option[]
Browse files Browse the repository at this point in the history
  • Loading branch information
adamw committed Dec 6, 2012
1 parent ad5aa82 commit fa25c39
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ object SquerylQueue {
}

class SquerylMessage(val id: String,
val receipt: String,
val receipt: Option[String],
@Column("queue_name") val queueName: String,
val content: String,
@Column("next_delivery") val nextDelivery: Long,
@Column("created_timestamp") val createdTimestamp: Long) extends KeyedEntity[String] {
def toMessage: MessageData = MessageData(MessageId(id),
if (receipt == null) None else Some(DeliveryReceipt(receipt)),
receipt.map(DeliveryReceipt(_)),
content,
MillisNextDelivery(nextDelivery),
new DateTime(createdTimestamp))
Expand All @@ -73,7 +73,7 @@ class SquerylMessage(val id: String,
object SquerylMessage {
def from(queueName: String, message: MessageData) = {
new SquerylMessage(message.id.id,
message.deliveryReceipt.map(_.receipt).getOrElse(null),
message.deliveryReceipt.map(_.receipt),
queueName,
message.content,
message.nextDelivery.millis,
Expand Down

0 comments on commit fa25c39

Please sign in to comment.