PinnedSiteDao.kt 946 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package mozilla.components.feature.top.sites.db

import androidx.paging.DataSource
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Transaction
Tiger Oakes's avatar
Tiger Oakes committed
13
import kotlinx.coroutines.flow.Flow
14
15

/**
16
 * Internal DAO for accessing [PinnedSiteEntity] instances.
17
18
 */
@Dao
19
internal interface PinnedSiteDao {
20
    @Insert
21
    fun insertPinnedSite(site: PinnedSiteEntity): Long
22
23

    @Delete
24
    fun deletePinnedSite(site: PinnedSiteEntity)
25
26
27

    @Transaction
    @Query("SELECT * FROM top_sites")
28
    fun getPinnedSites(): Flow<List<PinnedSiteEntity>>
29
30
31

    @Transaction
    @Query("SELECT * FROM top_sites")
32
    fun getPinnedSitesPaged(): DataSource.Factory<Int, PinnedSiteEntity>
33
}