Skip to content

Commit

Permalink
Fix linter
Browse files Browse the repository at this point in the history
  • Loading branch information
markaya committed May 10, 2023
1 parent 8f1c702 commit 939f0a1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 21 deletions.
44 changes: 24 additions & 20 deletions modules/library/src/main/scala/zio/elasticsearch/ElasticQuery.scala
Original file line number Diff line number Diff line change
Expand Up @@ -112,50 +112,53 @@ object ElasticQuery {
* Constructs an instance of [[zio.elasticsearch.query.GeoDistanceQuery]] using the specified parameters.
*
* @param field
* the type-safe field for which query is specified for
* the type-safe field for which query is specified for
* @param longitude
* longitude of desired point
* longitude of desired point
* @param latitude
* latitude of desired point
* latitude of desired point
* @tparam S
* document for which field query is executed
* document for which field query is executed
* @tparam A
* the type of value to be matched. A JSON decoder must be in scope for this type
* @return an instance of [[zio.elasticsearch.query.GeoDistanceQuery]] that represents `geo_distance` query to be performed.
* the type of value to be matched. A JSON decoder must be in scope for this type
* @return
* an instance of [[zio.elasticsearch.query.GeoDistanceQuery]] that represents `geo_distance` query to be performed.
*/
final def geoDistance[S, A: ElasticPrimitive](
field: Field[S, A],
longitude: Double,
latitude: Double
): GeoDistanceQuery[S] =
GeoDistance(field = field.toString, point = Left(longitude, latitude))
GeoDistance(field = field.toString, point = Left((longitude, latitude)))

/**
* Constructs an instance of [[zio.elasticsearch.query.GeoDistanceQuery]] using the specified parameters.
*
* @param field
* the field for which query is specified for
* the field for which query is specified for
* @param longitude
* longitude of desired point
* longitude of desired point
* @param latitude
* latitude of desired point
* @return an instance of [[zio.elasticsearch.query.GeoDistanceQuery]] that represents `geo_distance` query to be performed.
* latitude of desired point
* @return
* an instance of [[zio.elasticsearch.query.GeoDistanceQuery]] that represents `geo_distance` query to be performed.
*/
final def geoDistance(field: String, longitude: Double, latitude: Double): GeoDistanceQuery[Any] =
GeoDistance(field = field, point = Left(longitude, latitude))
GeoDistance(field = field, point = Left((longitude, latitude)))

/**
* Constructs an instance of [[zio.elasticsearch.query.GeoDistanceQuery]] using the specified parameters.
*
* @param field
* the type-safe field for which query is specified for
* the type-safe field for which query is specified for
* @param longitudeAndLatitude
* longitude and latitude of desired point written as string(e.g. "40,31") or geo hash (e.g. "drm3btev3e86")
* longitude and latitude of desired point written as string(e.g. "40,31") or geo hash (e.g. "drm3btev3e86")
* @tparam S
* document for which field query is executed
* document for which field query is executed
* @tparam A
* the type of value to be matched. A JSON decoder must be in scope for this type
* @return an instance of [[zio.elasticsearch.query.GeoDistanceQuery]] that represents `geo_distance` query to be performed.
* the type of value to be matched. A JSON decoder must be in scope for this type
* @return
* an instance of [[zio.elasticsearch.query.GeoDistanceQuery]] that represents `geo_distance` query to be performed.
*/
final def geoDistance[S, A: ElasticPrimitive](field: Field[S, A], longitudeAndLatitude: String): GeoDistanceQuery[S] =
GeoDistance(field = field.toString, point = Right(longitudeAndLatitude))
Expand All @@ -164,10 +167,11 @@ object ElasticQuery {
* Constructs an instance of [[zio.elasticsearch.query.GeoDistanceQuery]] using the specified parameters.
*
* @param field
* the field for which query is specified for
* the field for which query is specified for
* @param longitudeAndLatitude
* longitude and latitude of desired point written as string(e.g. "40,31") or geo hash (e.g. "drm3btev3e86")
* @return an instance of [[zio.elasticsearch.query.GeoDistanceQuery]] that represents `geo_distance` query to be performed.
* longitude and latitude of desired point written as string(e.g. "40,31") or geo hash (e.g. "drm3btev3e86")
* @return
* an instance of [[zio.elasticsearch.query.GeoDistanceQuery]] that represents `geo_distance` query to be performed.
*/
final def geoDistance(field: String, longitudeAndLatitude: String): GeoDistanceQuery[Any] =
GeoDistance(field = field, point = Right(longitudeAndLatitude))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
/*
* Copyright 2022 LambdaWorks
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package zio.elasticsearch.query

final case class Distance(distanceValue: Double, distanceUnit: DistanceUnit) {
override def toString = s"$distanceValue$distanceUnit"
override def toString: String = s"$distanceValue$distanceUnit"
}

sealed trait DistanceUnit {
Expand Down

0 comments on commit 939f0a1

Please sign in to comment.