Coverage Summary for Class: LabelDao_Impl (com.stslex93.notes.core.database.label)

Class Method, % Branch, % Line, % Instruction, %
LabelDao_Impl 11.1% (1/9) 0% (0/4) 10.4% (5/48)
LabelDao_Impl$1 33.3% (1/3) 20% (1/5) 11.1% (2/18)
LabelDao_Impl$Companion 100% (1/1) 100% (1/1) 100% (1/1)
LabelDao_Impl$search$1 0% (0/3) 0% (0/2) 0% (0/20) 0% (0/84)
Total 18.8% (3/16) 0% (0/6) 9.5% (7/74) 2.9% (3/103)


 package com.stslex93.notes.core.database.label
 
 import androidx.paging.PagingSource
 import androidx.room.EntityInsertAdapter
 import androidx.room.RoomDatabase
 import androidx.room.RoomRawQuery
 import androidx.room.paging.LimitOffsetPagingSource
 import androidx.room.util.appendPlaceholders
 import androidx.room.util.getColumnIndexOrThrow
 import androidx.room.util.performBlocking
 import androidx.room.util.performSuspending
 import androidx.sqlite.SQLiteStatement
 import javax.`annotation`.processing.Generated
 import kotlin.Int
 import kotlin.String
 import kotlin.Suppress
 import kotlin.Unit
 import kotlin.collections.List
 import kotlin.collections.MutableList
 import kotlin.collections.Set
 import kotlin.collections.mutableListOf
 import kotlin.reflect.KClass
 import kotlin.text.StringBuilder
 
 @Generated(value = ["androidx.room.RoomProcessor"])
 @Suppress(names = ["UNCHECKED_CAST", "DEPRECATION", "REDUNDANT_PROJECTION", "REMOVAL"])
 public class LabelDao_Impl(
   __db: RoomDatabase,
 ) : LabelDao {
   private val __db: RoomDatabase
 
   private val __insertAdapterOfLabelEntity: EntityInsertAdapter<LabelEntity>
   init {
     this.__db = __db
     this.__insertAdapterOfLabelEntity = object : EntityInsertAdapter<LabelEntity>() {
       protected override fun createQuery(): String =
           "INSERT OR REPLACE INTO `label_table` (`uuid`,`title`,`timestamp`) VALUES (?,?,?)"
 
       protected override fun bind(statement: SQLiteStatement, entity: LabelEntity) {
         statement.bindText(1, entity.uuid)
         statement.bindText(2, entity.title)
         statement.bindText(3, entity.timestamp)
       }
     }
   }
 
   public override suspend fun addLabel(label: LabelEntity): Unit = performSuspending(__db, false,
       true) { _connection ->
     __insertAdapterOfLabelEntity.insert(_connection, label)
   }
 
   public override fun getLabels(uuids: Set<String>): List<LabelEntity> {
     val _stringBuilder: StringBuilder = StringBuilder()
     _stringBuilder.append("SELECT * FROM label_table WHERE uuid in (")
     val _inputSize: Int = uuids.size
     appendPlaceholders(_stringBuilder, _inputSize)
     _stringBuilder.append(")")
     val _sql: String = _stringBuilder.toString()
     return performBlocking(__db, true, false) { _connection ->
       val _stmt: SQLiteStatement = _connection.prepare(_sql)
       try {
         var _argIndex: Int = 1
         for (_item: String in uuids) {
           _stmt.bindText(_argIndex, _item)
           _argIndex++
         }
         val _columnIndexOfUuid: Int = getColumnIndexOrThrow(_stmt, "uuid")
         val _columnIndexOfTitle: Int = getColumnIndexOrThrow(_stmt, "title")
         val _columnIndexOfTimestamp: Int = getColumnIndexOrThrow(_stmt, "timestamp")
         val _result: MutableList<LabelEntity> = mutableListOf()
         while (_stmt.step()) {
           val _item_1: LabelEntity
           val _tmpUuid: String
           _tmpUuid = _stmt.getText(_columnIndexOfUuid)
           val _tmpTitle: String
           _tmpTitle = _stmt.getText(_columnIndexOfTitle)
           val _tmpTimestamp: String
           _tmpTimestamp = _stmt.getText(_columnIndexOfTimestamp)
           _item_1 = LabelEntity(_tmpUuid,_tmpTitle,_tmpTimestamp)
           _result.add(_item_1)
         }
         _result
       } finally {
         _stmt.close()
       }
     }
   }
 
   public override fun search(query: String): PagingSource<Int, LabelEntity> {
     val _sql: String =
         "SELECT * FROM label_table WHERE title LIKE '%' || ? || '%'ORDER BY timestamp DESC"
     val _rawQuery: RoomRawQuery = RoomRawQuery(_sql) { _stmt ->
       var _argIndex: Int = 1
       _stmt.bindText(_argIndex, query)
     }
     return object : LimitOffsetPagingSource<LabelEntity>(_rawQuery, __db, "label_table") {
       protected override suspend fun convertRows(limitOffsetQuery: RoomRawQuery, itemCount: Int):
           List<LabelEntity> = performSuspending(__db, true, false) { _connection ->
         val _stmt: SQLiteStatement = _connection.prepare(limitOffsetQuery.sql)
         limitOffsetQuery.getBindingFunction().invoke(_stmt)
         try {
           val _columnIndexOfUuid: Int = getColumnIndexOrThrow(_stmt, "uuid")
           val _columnIndexOfTitle: Int = getColumnIndexOrThrow(_stmt, "title")
           val _columnIndexOfTimestamp: Int = getColumnIndexOrThrow(_stmt, "timestamp")
           val _result: MutableList<LabelEntity> = mutableListOf()
           while (_stmt.step()) {
             val _item: LabelEntity
             val _tmpUuid: String
             _tmpUuid = _stmt.getText(_columnIndexOfUuid)
             val _tmpTitle: String
             _tmpTitle = _stmt.getText(_columnIndexOfTitle)
             val _tmpTimestamp: String
             _tmpTimestamp = _stmt.getText(_columnIndexOfTimestamp)
             _item = LabelEntity(_tmpUuid,_tmpTitle,_tmpTimestamp)
             _result.add(_item)
           }
           _result
         } finally {
           _stmt.close()
         }
       }
     }
   }
 
   public override suspend fun removeLabel(uuid: String) {
     val _sql: String = "DELETE from label_table WHERE uuid = ?"
     return performSuspending(__db, false, true) { _connection ->
       val _stmt: SQLiteStatement = _connection.prepare(_sql)
       try {
         var _argIndex: Int = 1
         _stmt.bindText(_argIndex, uuid)
         _stmt.step()
       } finally {
         _stmt.close()
       }
     }
   }
 
   public companion object {
     public fun getRequiredConverters(): List<KClass<*>> = emptyList()
   }
 }