|
import Foundation
|
|
import PostgresKit
|
|
|
|
struct UserRole: Codable {
|
|
let name: String
|
|
|
|
static func all (connection: any SQLDatabase) async throws -> [UserRole] {
|
|
return try await connection.raw ("""
|
|
SELECT "name"
|
|
FROM "roles"
|
|
ORDER BY "name"
|
|
""")
|
|
.all (decoding: UserRole.self)
|
|
}
|
|
}
|