Skip to content

Instantly share code, notes, and snippets.

package scala.slick.benchmark
import java.util.concurrent.atomic.AtomicLong
object MemBarrierBench extends App {
trait Subscr[T] {
def onNext(v: T): Unit
}
val setup = seq(
(suppliersStd.schema ++ coffeesStd.schema).create,
suppliersStd += (101, "Acme, Inc.", "99 Market Street", "Groundsville", "CA", "95199"),
suppliersStd += ( 49, "Superior Coffee", "1 Party Place", "Mendocino", "CA", "95460"),
suppliersStd += (150, "The High Ground", "100 Coffee Lane", "Meadows", "CA", "93966"),
coffeesStd ++= Seq(
("Colombian", 101, 799, 1, 0),
("French_Roast", 49, 799, 2, 0),
("Espresso", 150, 999, 3, 0),
("Colombian_Decaf", 101, 849, 4, 0),
for {
_ <- actions(
(suppliersStd.schema ++ coffeesStd.schema).create,
suppliersStd += (101, "Acme, Inc.", "99 Market Street", "Groundsville", "CA", "95199"),
suppliersStd += ( 49, "Superior Coffee", "1 Party Place", "Mendocino", "CA", "95460"),
suppliersStd += (150, "The High Ground", "100 Coffee Lane", "Meadows", "CA", "93966"),
coffeesStd ++= Seq(
("Colombian", 101, 799, 1, 0),
("French_Roast", 49, 799, 2, 0),
("Espresso", 150, 999, 3, 0),
def testSimpleActionAsAction = {
class T(tag: Tag) extends Table[Int](tag, u"t") {
def a = column[Int]("a")
def * = a
}
val ts = TableQuery[T]
for {
_ <- ts.schema.create
_ <- ts ++= Seq(2, 3, 1, 5, 4)
trait Foo[X]
object Foo extends EImplicits
trait Bar[X]
object Bar extends EImplicits
trait E[X]
trait EImplicits extends EImplicitsLowPrio {
implicit final def fooEvidence[T : E]: E[Foo[T]] = null
def testIssue146 {
case class Record(id: Int, text: String, categoryId: Int)
case class Category(id: Int, name: String, toolId: Int)
case class Tool(id: Int, name: String)
class RecordTable(tag: Tag) extends Table[Record](tag, "RECORDS") {
def id = column[Int]("id", O.PrimaryKey)
def text = column[String]("text")
def categoryId = column[Int]("category_id")
package foo.bar.baz
class DivergenceTest {
trait ColumnBase[T]
trait ShapeLevel
trait Flat extends ShapeLevel
class Shape2[Level <: ShapeLevel, -M, U]
#!/bin/bash
function isIdeaProject() {
dirn=`dirname "$1"`
if [ "$dirn" = "/" ]; then
false
elif [ -d "$dirn/.idea" ]; then
true
else
isIdeaProject "$dirn"
@szeiger
szeiger / NegativeCompilationTests.scala
Created March 25, 2013 17:41
Compile-time unit tests that check for type-checking failures
package scala.slick.test.lifted
import com.typesafe.slick.testkit.util.ShouldNotTypecheck
class NegativeCompilationTests {
def noColumnBaseToOptionConversion = ShouldNotTypecheck("""
class FooBarBlub extends String
""", "illegal inheritance from final class String")
}
trait Rep {
type Base
}
class Query[E] extends Rep { self =>
type C[_] <: Iterable[_]
type Base = C[E]
def map[F](f: E => F): Query[F] { type C[X] = self.C[X] } = ???
def to[D[_] <: Iterable[_]]: Query[E] { type C[X] = D[X] } = ???
}