All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.ferhatwi.supabase.database.request.OrderableQuery.kt Maven / Gradle / Ivy

Go to download

Some experiments on Kotlin client for Supabase Database, currently in development phase.

There is a newer version: 0.4.0
Show newest version
package io.github.ferhatwi.supabase.database.request

import io.github.ferhatwi.supabase.database.Count
import io.github.ferhatwi.supabase.database.Filter
import io.github.ferhatwi.supabase.database.Order
import io.github.ferhatwi.supabase.database.OrderBy

private fun  A.order(column: String, orderBy: OrderBy, nullsFirst: Boolean): A =
    apply { orders.add(Order(column, orderBy, nullsFirst)) }

open class OrderableQueryR internal constructor(
    schema: String,
    function: String,
    selections: List,
    range: Pair?,
    count: Count?,
    filters: MutableList,
    orders: MutableList,
) : LimitableQueryR(schema, function, selections, range, count, filters, orders) {
    fun order(column: String, orderBy: OrderBy = OrderBy.Ascending, nullsFirst: Boolean = false) =
        order(column, orderBy, nullsFirst)
}

open class OrderableQuery internal constructor(
    schema: String,
    table: String,
    selections: List,
    range: Pair?,
    count: Count?,
    filters: MutableList,
    orders: MutableList,
) : LimitableQuery(schema, table, selections, range, count, filters, orders) {
    fun order(column: String, orderBy: OrderBy = OrderBy.Ascending, nullsFirst: Boolean = false) =
        order(column, orderBy, nullsFirst)
}

open class OrderableQueryX internal constructor(
    schema: String,
    table: String,
    selections: List,
    range: Pair?,
    count: Count?,
    orders: MutableList,
) : LimitableQueryX(schema, table, selections, range, count, orders) {
    fun order(column: String, orderBy: OrderBy = OrderBy.Ascending, nullsFirst: Boolean = false) =
        order(column, orderBy, nullsFirst)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy