Session supports couple of query types that decode the data type automatically, e.g.:
|
public func query<T: Decodable>( |
|
_ query: String, |
|
parameters: [CassandraClient.Statement.Value] = [], |
|
options: CassandraClient.Statement.Options = .init(), |
|
on eventLoop: EventLoop? = .none, |
|
logger: Logger? = .none |
|
) -> EventLoopFuture<[T]> { |
|
self.query(query, parameters: parameters, options: options, on: eventLoop, logger: logger).flatMapThrowing { rows in |
|
try rows.map { row in |
|
try T(from: CassandraClient.RowDecoder(row: row)) |
|
} |
|
} |
|
} |
Separately, Session supports paging queries, for example:
|
public func query( |
|
_ query: String, |
|
parameters: [CassandraClient.Statement.Value] = [], |
|
pageSize: Int32, |
|
options: CassandraClient.Statement.Options = .init(), |
|
on eventLoop: EventLoop? = .none, |
|
logger: Logger? = .none |
|
) -> EventLoopFuture<CassandraClient.PaginatedRows> { |
|
do { |
|
let statement = try CassandraClient.Statement(query: query, parameters: parameters, options: options) |
|
return self.execute(statement: statement, pageSize: pageSize, on: eventLoop, logger: logger) |
|
} catch { |
|
let eventLoop = eventLoop ?? eventLoopGroup.next() |
|
return eventLoop.makeFailedFuture(error) |
|
} |
|
} |
|
} |
What's missing is a query that'd do both paging & decoding.
Sessionsupports couple ofquerytypes that decode the data type automatically, e.g.:swift-cassandra-client/Sources/CassandraClient/Session.swift
Lines 133 to 145 in 4c395e6
Separately,
Sessionsupports paging queries, for example:swift-cassandra-client/Sources/CassandraClient/Session.swift
Lines 173 to 189 in 4c395e6
What's missing is a query that'd do both paging & decoding.