All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.app.cash.zipline.loader.internal.cache.PinsQueries.kt Maven / Gradle / Ivy

There is a newer version: 1.17.5-CUSTOM
Show newest version
package app.cash.zipline.loader.`internal`.cache

import app.cash.sqldelight.Query
import app.cash.sqldelight.TransacterImpl
import app.cash.sqldelight.db.QueryResult
import app.cash.sqldelight.db.SqlCursor
import app.cash.sqldelight.db.SqlDriver
import kotlin.Any
import kotlin.Long
import kotlin.String

public class PinsQueries(
  driver: SqlDriver,
) : TransacterImpl(driver) {
  public fun count(): Query = Query(618_474_414, arrayOf("pins"), driver, "Pins.sq", "count",
      "SELECT COUNT(*) FROM pins") { cursor ->
    cursor.getLong(0)!!
  }

  public fun  get_pin(
    file_id: Long,
    application_name: String,
    mapper: (file_id: Long, application_name: String) -> T,
  ): Query = Get_pinQuery(file_id, application_name) { cursor ->
    mapper(
      cursor.getLong(0)!!,
      cursor.getString(1)!!
    )
  }

  public fun get_pin(file_id: Long, application_name: String): Query = get_pin(file_id,
      application_name) { file_id_, application_name_ ->
    Pins(
      file_id_,
      application_name_
    )
  }

  public fun delete_pin(application_name: String, file_id: Long) {
    driver.execute(-1_830_319_678,
        """DELETE FROM pins WHERE application_name = ? AND file_id = ?""", 2) {
          bindString(0, application_name)
          bindLong(1, file_id)
        }
    notifyQueries(-1_830_319_678) { emit ->
      emit("pins")
    }
  }

  public fun delete_application_pins(application_name: String) {
    driver.execute(-547_381_248, """DELETE FROM pins WHERE application_name = ?""", 1) {
          bindString(0, application_name)
        }
    notifyQueries(-547_381_248) { emit ->
      emit("pins")
    }
  }

  public fun create_pin(file_id: Long, application_name: String) {
    driver.execute(2_069_271_699, """
        |INSERT INTO pins(file_id, application_name)
        |VALUES (?, ?)
        """.trimMargin(), 2) {
          bindLong(0, file_id)
          bindString(1, application_name)
        }
    notifyQueries(2_069_271_699) { emit ->
      emit("pins")
    }
  }

  private inner class Get_pinQuery(
    public val file_id: Long,
    public val application_name: String,
    mapper: (SqlCursor) -> T,
  ) : Query(mapper) {
    override fun addListener(listener: Query.Listener) {
      driver.addListener("pins", listener = listener)
    }

    override fun removeListener(listener: Query.Listener) {
      driver.removeListener("pins", listener = listener)
    }

    override fun  execute(mapper: (SqlCursor) -> QueryResult): QueryResult =
        driver.executeQuery(615_810_059,
        """SELECT pins.file_id, pins.application_name FROM pins WHERE file_id = ? AND application_name = ?""",
        mapper, 2) {
      bindLong(0, file_id)
      bindString(1, application_name)
    }

    override fun toString(): String = "Pins.sq:get_pin"
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy