manageable-users/Sources/ManageableUsers/Models/UserRole.swift

16 lines
361 B
Swift

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)
}
}