Skip to content

Commit

Permalink
More styling changes to address codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
KocproZ committed Jan 17, 2022
1 parent e71ccdb commit 2f26e0c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import org.ktorm.schema.ColumnDeclaring
import org.ktorm.schema.DoubleSqlType
import org.ktorm.schema.SqlType

/**
* Enum for 'cube' and 'earthdistance' binary operators.
*/
public enum class CubeExpressionType(private val value: String) {
/**
* Cube overlaps operator, translated to the && operator in PostgreSQL.
Expand Down Expand Up @@ -182,7 +185,7 @@ public fun earthDistance(

/**
* Get distance between 2 points on earth.
**/
*/
public fun earthDistance(
point1: ColumnDeclaring<Earth>,
point2: Earth
Expand All @@ -191,7 +194,7 @@ public fun earthDistance(

/**
* Get distance between 2 points on earth.
**/
*/
public fun earthDistance(
point1: Earth,
point2: ColumnDeclaring<Earth>
Expand All @@ -200,7 +203,7 @@ public fun earthDistance(

/**
* Get distance between 2 points on earth.
**/
*/
public fun earthDistance(
point1: Earth,
point2: Earth
Expand All @@ -224,7 +227,7 @@ public fun earthBox(

/**
* Creates a bounding cube, sized to contain all the points that are not farther than radius meters from a given point.
**/
*/
public fun earthBox(
point: ColumnDeclaring<Earth>,
radius: Double
Expand All @@ -233,7 +236,7 @@ public fun earthBox(

/**
* Creates a bounding cube, sized to contain all the points that are not farther than radius meters from a given point.
**/
*/
public fun earthBox(
point: Earth,
radius: ColumnDeclaring<Double>
Expand All @@ -242,7 +245,7 @@ public fun earthBox(

/**
* Creates a bounding cube, sized to contain all the points that are not farther than radius meters from a given point.
**/
*/
public fun earthBox(
point: Earth,
radius: Double
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ public class PgEnumType<C : Enum<C>>(private val enumClass: Class<C>) : SqlType<
*/
public typealias Earth = Triple<Double, Double, Double>

/**
* Represents a point on Earth's surface
* Part of PostgreSQL's `earthdistance` SQL extension.
*/
public object PGEarthType : SqlType<Earth>(Types.OTHER, "earth") {
override fun doSetParameter(ps: PreparedStatement, index: Int, parameter: Earth) {
ps.setObject(index, parameter, Types.OTHER)
Expand Down Expand Up @@ -153,13 +157,14 @@ public fun BaseTable<*>.earth(name: String): Column<Earth> = registerColumn(name
* Part of PostgreSQL's `cube` SQL extension.
* https://www.postgresql.org/docs/9.5/cube.html
*/
public class Cube(
public data class Cube(
public val first: DoubleArray,
public val second: DoubleArray
) {
init {
if (first.size != second.size)
if (first.size != second.size) {
throw IllegalArgumentException("Cube should be initialized with same size arrays")
}
}

override fun toString(): String {
Expand Down

0 comments on commit 2f26e0c

Please sign in to comment.