Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ThisBuild / organization := "app.softnetwork"

name := "softclient4es"

ThisBuild / version := "0.24.0"
ThisBuild / version := "0.25.0-SNAPSHOT"

ThisBuild / scalaVersion := scala213

Expand Down
36 changes: 21 additions & 15 deletions core/src/main/scala/app/softnetwork/elastic/client/DateRoute.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,27 @@ private[client] object DateRoute {
dates: SetOperationValues.DateReading
): DateRoute =
(sqlType, format) match {
case (SQLTypes.Date | SQLTypes.Timestamp | SQLTypes.Time, Some(spec)) =>
dates.dialect match {
case None =>
AsStored(
s"the date format '$spec' is read as the Elasticsearch version does, " +
dates.elasticVersion.fold("which is not known")(v => s"and core reads dates of no $v")
)
case Some(dialect) =>
MappedDateFormat(spec, dialect, dates.clock).unread.fold[DateRoute](Typed) { why =>
AsStored(
s"core cannot read every value of the date format '$spec' as ${dialect.label} " +
s"does: $why"
)
}
case (SQLTypes.Date | SQLTypes.Timestamp | SQLTypes.Time, Some(spec)) => dates.route(spec)
case _ => Typed
}

/** The route of a date field of mapping format `spec`, from the format alone: decided ONCE per
* statement and format ([[SetOperationValues.DateReading.route]]), over the statement's one
* built format ([[SetOperationValues.DateReading.format]]).
*/
private[client] def ofFormat(spec: String, dates: SetOperationValues.DateReading): DateRoute =
dates.format(spec) match {
case None =>
AsStored(
s"the date format '$spec' is read as the Elasticsearch version does, " +
dates.elasticVersion.fold("which is not known")(v => s"and core reads dates of no $v")
)
case Some(mapped) =>
mapped.unread.fold[DateRoute](Typed) { why =>
AsStored(
s"core cannot read every value of the date format '$spec' as " +
s"${mapped.dialect.label} does: $why"
)
}
case _ => Typed
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,14 @@ trait ElasticClientDelegator extends ElasticClientApi with BulkTypes {
context: ConversionContext
): Source[(ListMap[String, Any], ScrollMetrics), NotUsed] = delegate.scroll(statement, config)

/** SCHEMA-2 (D13) -- the delegate's: its schema cache, its reload memo. */
override private[client] def scrollWithSchema(statement: SearchStatement, config: ScrollConfig)(
implicit
system: ActorSystem,
context: ConversionContext
): (Option[ResultSchema], Source[(ListMap[String, Any], ScrollMetrics), NotUsed]) =
delegate.scrollWithSchema(statement, config)

/** Scroll and convert results into typed entities from an SQL query.
*
* @note
Expand Down Expand Up @@ -2005,6 +2013,13 @@ trait ElasticClientDelegator extends ElasticClientApi with BulkTypes {
): Future[ElasticResult[QueryResult]] =
delegate.run(statement)

/** SCHEMA-2 (D14) -- the delegate's: its extensions, its schema cache, its reload memo. */
override def describe(sql: String): ElasticResult[Option[ResultSchema]] =
delegate.describe(sql)

override def describe(statement: query.Statement): ElasticResult[Option[ResultSchema]] =
delegate.describe(statement)

// ==================== Extensions (delegate) ====================

/** #163 — the delegator inherits ExtensionApi's lazy vals, so `this.extensionRegistry` would be a
Expand Down
Loading
Loading