Skip to content

Commit

Permalink
feat(postgrest): set coder in SupabaseClientOptions (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
junjielu authored Dec 11, 2023
1 parent 5124a58 commit 6376107
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Sources/Supabase/SupabaseClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ public final class SupabaseClient: @unchecked Sendable {
url: databaseURL,
schema: options.db.schema,
headers: defaultHeaders,
fetch: fetchWithAuth
fetch: fetchWithAuth,
encoder: options.db.encoder,
decoder: options.db.decoder
)

/// Supabase Storage allows you to manage user-generated content, such as photos or videos.
Expand Down
6 changes: 5 additions & 1 deletion Sources/Supabase/Types.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ public struct SupabaseClientOptions: Sendable {
/// The Postgres schema which your tables belong to. Must be on the list of exposed schemas in
/// Supabase. Defaults to `public`.
public let schema: String
public let encoder: JSONEncoder
public let decoder: JSONDecoder

public init(schema: String = "public") {
public init(schema: String = "public", encoder: JSONEncoder = .postgrest, decoder: JSONDecoder = .postgrest) {
self.schema = schema
self.encoder = encoder
self.decoder = decoder
}
}

Expand Down

0 comments on commit 6376107

Please sign in to comment.