Thomas Potaire
Thomas Potaire

Reputation: 6256

Parser: Compilation error[not found: value get]

When I create a parser for the output of Anorm.SQL I get the following error: Parser: Compilation error[not found: value get]

val parser = {
  get[String]("id") ~
  get[String]("name") map { ... }
}

Likewise the following code returns Parser: Compilation error[not found: value str]

val parser = {
  str("id") ~
  str("name") map { ... }
}

Same for Parser: Compilation error[not found: value int]

Upvotes: 0

Views: 1233

Answers (1)

Thomas Potaire
Thomas Potaire

Reputation: 6256

The issue is likely to be namespace-related. You probably are trying to build a SQL query and already imported anorm._ however get, str, int and more are available under SqlParser namespace.

You can either import the parser SqlParser at the top of your file:

 import anorm.SqlParser._

Or call directly like the following:

 import anorm._     

 // ...

 val parser = {
   SqlParser.get[String]("id") ~
   SqlParser.get[String]("name") map { ... }
 }

 // or

 val parser = {
   SqlParser.str("id") ~
   SqlParser.str("name") map { ... }
 }

Upvotes: 3

Related Questions