You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We can setup CQL Options at the PreparedStatement definition as a way to avoid defining them on BoundStatement level, like:
valqueryAll="SELECT * FROM hotels".toCQL.prepareUnit
.withConsistencyLevel(ConsistencyLevel.LOCAL_QUORUM)
.withTimeout(Duration.ofHours(1))
.withPageSize(10)
.withTracing(enabled =true)
.withExecutionProfile(session.executionProfile("default").get)
But the way these options are applied to the actual BoundStatement can be a bit inefficient:
val bs1 = bs.setTracing(tracing).setPageSize(pageSize)
val bs2 = profile.map(bs1.setExecutionProfile).getOrElse(bs1)
val bs3 = routingKeyspace.map(bs2.setRoutingKeyspace).getOrElse(bs2)
val bs4 = routingKey.map(bs3.setRoutingKey).getOrElse(bs3)
val bs5 = timeout.map(bs4.setTimeout).getOrElse(bs4)
val bs6 = pagingState.map(bs5.setPagingState).getOrElse(bs5)
consistencyLevel.map(bs6.setConsistencyLevel).getOrElse(bs6)
We would like this to be simplified with only the desired options.
Solution Description
The current solution may be a bit inefficient but by keeping Options into a case class we can avoid calling the same method twice (e.g. pstmt.withTracing(true).withTracing(false) would only call setTracing once)
The text was updated successfully, but these errors were encountered:
Description
We can setup CQL Options at the
PreparedStatement
definition as a way to avoid defining them onBoundStatement
level, like:But the way these options are applied to the actual
BoundStatement
can be a bit inefficient:We would like this to be simplified with only the desired options.
Solution Description
The current solution may be a bit inefficient but by keeping
Options
into a case class we can avoid calling the same method twice (e.g.pstmt.withTracing(true).withTracing(false)
would only callsetTracing
once)The text was updated successfully, but these errors were encountered: