Slide 27
Slide 27 text
© 2018 CONFIDENTIAL
-- src/main/sql/com/…/OfflineVideo.sq
CREATE TABLE offlineVideo (
xid TEXT NOT NULL,
title TEXT NOT NULL,
duration REAL,
[..more..]
);
selectAll:
SELECT * FROM offlineVideo;
selectAllMatchingState:
SELECT * FROM offlineVideo WHERE state = ?;
insertVideo:
INSERT OR REPLACE INTO offlineVideo
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);
delete:
DELETE FROM offlineVideo WHERE xid = ?;
-- build/generated/…/OfflineVideo.kt
interface OfflineVideo {
val xid: String
val title: String
val duration: Double?
…
data class Impl(…)
}
-- build/generated/…/OfflineVideoQueries.kt
class OfflineVideoQueries(private val database: Database, private val
driver: SqlDriver) :
Transacter(driver) {
fun selectAll(): Query
fun selectAllMatchingState(state: SyncState?):
Query
fun delete(xid: String)
}