Skip to content

Instantly share code, notes, and snippets.

{
tokens = [
crlf='regexp:\n'
escaped_crlf='regexp:^\\(\n)'
comment='regexp:[#|!][^\n]*'
nonId='regexp:[:=\s\\]'
sepearator='regexp:\s*(=|:)\s*'
id='regexp:[^#|!:=\s\n\\]([^:=\s\n\\]|(\\\s))*'
]
}
package org.jetbrains.fluid.java;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.commons.AdviceAdapter;
public class ReplaceMonitorWithTryCatchVisitor extends AdviceAdapter implements Opcodes {
private Label endTry;
private Label startCatch;
.yt-agile-table__row__cell {
border-color: #232e34;
border-right: 1px solid #232e34;
border-left: 1px solid #232e34;
}
.yt-agile-table .yt-agile-table__row {
border-bottom: 1px solid #232e34;
}
package models
import java.sql.Timestamp
import javax.inject.{Inject, Singleton}
import play.api.db.slick.{HasDatabaseConfigProvider, DatabaseConfigProvider}
import slick.driver.JdbcProfile
case class Topic(id: Long = 0, groupId: Long, userId: Long, date: Timestamp, text: String) extends AbstractGroupMessage
package models
import javax.inject.{Inject, Singleton}
import play.api.db.slick.{HasDatabaseConfigProvider, DatabaseConfigProvider}
import slick.driver.JdbcProfile
import scala.concurrent.ExecutionContext.Implicits.global
case class Group(id: Long = 0, name: String)
@Singleton()
(dao.topics outerJoin dao.comments on { case (topic, comment) => comment.topicId === topic.id }).list
Results in
play.api.Application$$anon$1: Execution exception[[SlickException: Expected a collection type, found UnassignedType]]
at play.api.Application$class.handleError(Application.scala:296) ~[play_2.11-2.3.7.jar:2.3.7]
at play.api.DefaultApplication.handleError(Application.scala:402) [play_2.11-2.3.7.jar:2.3.7]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:205) [play_2.11-2.3.7.jar:2.3.7]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:202) [play_2.11-2.3.7.jar:2.3.7]
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36) [scala-library-2.11.5.jar:na]
@cheptsov
cheptsov / gist:e99e5fa7343143008b2b
Created July 6, 2014 22:03
Kotlin NoSQL API for MongoDB has been rewritten to use RxJava (see https://github.com/cheptsov/kotlin-nosql for details):
// Get a document
Albums.find { details.artistId.equal(artistId) }.subscribe(onNext = { album ->
}, onError = {
})
// Get selected fields of a document
Albums.find { id.equal(albumId) }.projection { sku + details.title + pricing }.subscribe(onNext = {
val (sku, title, pricing) = it
}, onError = {
})

Kotlin NoSQL Roadmap

v0.1

  • Drop iterate methods without filtering
  • Support for Template1-10
  • Support for Query1-10
  • Support for other operators: gt, lt, ge, le, mb, ne, nm, nn, nl, mt
  • Support for boolean, date, timestamp, double, float, long, short, byte types
  • Support for add, delete, remove, etc operations
@cheptsov
cheptsov / gist:8146503
Created December 27, 2013 12:42
Access Amazon DynamoDB using the type-safe Kotlin DSL for NoSQL databases. For more details: https://github.com/cheptsov/Exposed/tree/NoSQL
import kotlin.nosql.*
import kotlin.nosql.dynamodb.*
object Users : Table() {
val id = string("id", length = 10).id() // PKColumn<String, Users>
val name = string("name", length = 50) // Column<String, Users>
val requiredCityId = integer("required_city_id") // Column<Int, Users>
val optionalCityId = integer("optional_city_id").nullable() // Column<Int?, Users>
val all = id + name + requiredCityId + optionalCityId // Template4<Users, String, Int, Int?>
@cheptsov
cheptsov / gist:8124099
Last active January 1, 2016 09:19
A type-safe DSL for NoSQL using Kotlin language (experiment)
import kotlin.nosql.*
object Cities : Table() {
val id = integer("id").id().generated() // GeneratedPKColumn<Int, Cities>
val name = varchar("name", 50) // Column<String, Cities>
val all = id + name // Template2<Cities, Int, String> Select template
val values = name // Column<String, Cities>
}