S
Supabase2mo ago
oli

Count in Supabase-kt

Hi, I wanted to ask what's up with the .count() function referenced in the supabase docs. (The countOrNull() functions work without any issues)
val enrollmentCount = supabaseClient.from("enrollments")
.select {
count(Count.EXACT)
filter {
eq("user_id", userId)
}
}.count()!! // this prevents it from working
val enrollmentCount = supabaseClient.from("enrollments")
.select {
count(Count.EXACT)
filter {
eq("user_id", userId)
}
}.count()!! // this prevents it from working
None of the following candidates is applicable:
fun <K, V> Map<out K, V>.count(): Int
fun <K, V> Map<out K, V>.count(predicate: (Map.Entry<K, V>) -> Boolean): Int
fun <T> Array<out T>.count(): Int
fun ByteArray.count(): Int
fun ShortArray.count(): Int
fun IntArray.count(): Int
fun LongArray.count(): Int
fun FloatArray.count(): Int
fun DoubleArray.count(): Int
fun BooleanArray.count(): Int
fun CharArray.count(): Int
fun <T> Array<out T>.count(predicate: (T) -> Boolean): Int
fun ByteArray.count(predicate: (Byte) -> Boolean): Int
fun ShortArray.count(predicate: (Short) -> Boolean): Int
fun IntArray.count(predicate: (Int) -> Boolean): Int
fun LongArray.count(predicate: (Long) -> Boolean): Int
fun FloatArray.count(predicate: (Float) -> Boolean): Int
fun DoubleArray.count(predicate: (Double) -> Boolean): Int
fun BooleanArray.count(predicate: (Boolean) -> Boolean): Int
fun CharArray.count(predicate: (Char) -> Boolean): Int
...
None of the following candidates is applicable:
fun <K, V> Map<out K, V>.count(): Int
fun <K, V> Map<out K, V>.count(predicate: (Map.Entry<K, V>) -> Boolean): Int
fun <T> Array<out T>.count(): Int
fun ByteArray.count(): Int
fun ShortArray.count(): Int
fun IntArray.count(): Int
fun LongArray.count(): Int
fun FloatArray.count(): Int
fun DoubleArray.count(): Int
fun BooleanArray.count(): Int
fun CharArray.count(): Int
fun <T> Array<out T>.count(predicate: (T) -> Boolean): Int
fun ByteArray.count(predicate: (Byte) -> Boolean): Int
fun ShortArray.count(predicate: (Short) -> Boolean): Int
fun IntArray.count(predicate: (Int) -> Boolean): Int
fun LongArray.count(predicate: (Long) -> Boolean): Int
fun FloatArray.count(predicate: (Float) -> Boolean): Int
fun DoubleArray.count(predicate: (Double) -> Boolean): Int
fun BooleanArray.count(predicate: (Boolean) -> Boolean): Int
fun CharArray.count(predicate: (Char) -> Boolean): Int
...
No description
3 Replies
ihm40
ihm402mo ago
Are you using the filter correctly here?
supabase.from("cities").select(columns = Columns.list("name", "country_id")) {
filter {
City::name eq "The Shire"
//or
eq("name", "The Shire")
}
}
supabase.from("cities").select(columns = Columns.list("name", "country_id")) {
filter {
City::name eq "The Shire"
//or
eq("name", "The Shire")
}
}
This from the docs suggests that filter should be outside of select
TheRealJan
TheRealJan4w ago
The docs seem to be wrong, there is no count() method. Use countOrNull() Can you create an issue in the supabase-kt repo?
oli
oliOP4w ago
Thanks I'll done

Did you find this page helpful?