fn(key$0, then$1) =>
#sql<@definy.service-io>({
statements: [
{
sql: "SELECT content_bytes FROM cas_contents WHERE content_hash = ?",
params: [#text<@definy.sql-value>($0)]
}
],
then: fn(results$2) =>
match @core.list-get(list: @definy.sql-rows-concat(results: $2, index: 0), index: 0) {
#some(row$3) =>
let bytes$4 = @definy.sql-text(row: $3, name: "content_bytes");
#hash_contents<@definy.service-io>({
contents_bytes: [$4],
then: fn(hashes$5) =>
match @core.list-get(list: $5, index: 0) {
#some(hash$6) =>
match $6 {
#some(content_hash$7) =>
$1(content: #some({content_hash: $7, bytes_base64: $4})),
#none(_) =>
$1(content: #none)
},
#none(_) =>
$1(content: #none)
}
}),
#none(_) =>
$1(content: #none)
}
})