Explorer

definy.store-read-contents

description
The contents of the CAS with the hashes (in the same order. none if not stored) (SQL)
type
Fn(
  content_hashes: List<String>,
  then: Fn(items: List<Union{#none, #some(@definy.content-item)}>) -> @definy.service-io
) -> @definy.service-io
expression
fn(content_hashes$0, then$1) =>
  #sql<@definy.service-io>({
    statements: @definy.sql-in-statements(prefix: "SELECT content_hash, content_bytes FROM cas_contents WHERE content_hash IN ", items: $0),
    then: fn(results$2) =>
      let rows$3 = @definy.sql-rows-concat(results: $2, index: 0);
      let row_index$9500 = @definy.sql-row-index(rows: $3, name: "content_hash");
      $1(
        items: @core.list-map(
          T: String,
          U: Union{#none, #some(@definy.content-item)},
          f: fn(item$4) =>
            match @definy.sql-row-find(index: $9500, value: $4) {
              #some(row$5) =>
                #some({content_hash: $4, content_bytes: @definy.sql-text(row: $5, name: "content_bytes")}),
              #none(_) =>
                #none
            },
          xs: $0
        )
      )
  })
visibility
public
definy.store-read-contents (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: IgTBIbzYhPrGLVYoV3hpyvMKGhpuMK7osSTSmU3XwJE
content hash: 3zqPXcR6TPwEuFv_dGN_D9vQGq_r9kIWzOBNP5WnGEE