Skip to content

Commit

Permalink
Fix Columns#type function
Browse files Browse the repository at this point in the history
Signed-off-by: TheRealJan <jan.m.tennert@gmail.com>
  • Loading branch information
jan-tennert committed Jul 13, 2023
1 parent da461c4 commit ab36940
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 497 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ object Phone : DefaultAuthProvider<Phone.Config, Phone.Result> {
override val descriptor = PrimitiveSerialDescriptor("Channel", PrimitiveKind.STRING)

override fun deserialize(decoder: Decoder): Channel {
return Channel.values().first { it.value == decoder.decodeString() }
return entries.first { it.value == decoder.decodeString() }
}

override fun serialize(encoder: Encoder, value: Channel) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SSO<Config: SSO.Config> private constructor(val config: Config): AuthProvi
}

/**
* The result of a SSO login
* The result of an SSO login
* @param url The url to redirect to
*/
@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fun interface PropertyConversionMethod {
*/
val SERIAL_NAME = PropertyConversionMethod { getSerialName(it) }
get() {
if(CurrentPlatformTarget !in listOf(PlatformTarget.JVM, PlatformTarget.ANDROID)) error("SerialName PropertyConversionMethod is only available on the JVM and Desktop. Use CAMEL_CASE_TO_SNAKE_CASE instead.")
if(CurrentPlatformTarget !in listOf(PlatformTarget.JVM, PlatformTarget.ANDROID)) error("SerialName PropertyConversionMethod is only available on the JVM and ANDROID due to limited reflection on other targets. Use CAMEL_CASE_TO_SNAKE_CASE instead.")
return field
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.jan.supabase.postgrest.query

import io.github.jan.supabase.postgrest.classPropertyNames
import kotlin.jvm.JvmInline

/**
Expand All @@ -11,6 +12,10 @@ value class Columns @PublishedApi internal constructor(val value: String) {

companion object {

init {
println("hello")
}

/**
* Select all columns
*/
Expand Down Expand Up @@ -38,7 +43,7 @@ value class Columns @PublishedApi internal constructor(val value: String) {
* Select all columns of type [T]'s class properties. Example: If you specify a class 'User' with the fields 'id' and 'name', this will select 'id,name'
* @param T The type of the columns to select
*/
inline fun <reified T> type() = Columns(T::class.simpleName!!)
inline fun <reified T> type() = list(classPropertyNames<T>())

}

Expand Down
Loading

0 comments on commit ab36940

Please sign in to comment.