Skip to content

Exception during macro expansion: StackOverflowError #140

Open
@bennythomps

Description

Making some basic calls, I'm getting exceptions when I compile:

[error] ApiKey.scala:19: exception during macro expansion: java.lang.StackOverflowError
[error]   def create: (ApiKey) => Future[ApiKey] = withSchema {
[error]                                                       ^
{
  import _root_.troy.driver.InternalDsl._;
  import _root_.troy.driver.codecs.PrimitivesCodecs._;
  val prepared = implicitly[com.datastax.driver.core.Session].prepare("\n            SELECT api_key, name, active\n            FROM api.api_keys\n            WHERE api_key = ?\n        ");
  ((apiKey: java.util.UUID) => {
    def parser(row: _root_.com.datastax.driver.core.Row) = ApiKey(column[java.util.UUID](0)(row).as[CDT.Uuid], column[String](1)(row).as[CDT.Text], column[Boolean](2)(row).as[CDT.Boolean]);
    bind(prepared, param(apiKey).as[CDT.Uuid]).executeAsync(ApiKeyRecord.this.session, scala.concurrent.ExecutionContext.Implicits.global).oneOption(scala.concurrent.ExecutionContext.Implicits.global).parseAs(parser)
  })
}

Here's my schema:

CREATE KEYSPACE api WITH replication = {'class': 'SimpleStrategy' , 'replication_factor': '1'};

CREATE TABLE api.api_keys (
  api_key uuid,
  name text,
  active boolean,
  PRIMARY KEY (api_key)
);

Here's my calling code that's "breaking"

class ApiTokenRecord(implicit session: Session) {

  def create = withSchema { (token: UUID, apiKey: UUID, email: String, expiration: DateTime) =>
    cql"""
      INSERT INTO kiko.api_tokens (api_token, api_key, email, expiration_time)
      VALUES ($token, $apiKey, $email, $expiration)
      """.prepared.executeAsync.map(_ => true)
  }
}

Am I doing something wrong?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions