unified-storage: add BatchGet support to the sqlkv implementation (#115517)
* unified-storage: add `BatchGet` support to the sqlkv implementation * address comments * fix linting
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
SELECT r.{{ .Ident "key_path" }}, r.{{ .Ident "value" }}
|
||||
FROM (
|
||||
{{ range $id, $key_path := .KeyPaths }}
|
||||
{{ if eq $id 0 }}
|
||||
SELECT {{ $.Arg $id }} AS idx, {{ $.Arg $key_path }} AS key_path
|
||||
{{ else }}
|
||||
UNION ALL SELECT {{ $.Arg $id }}, {{ $.Arg $key_path }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
) AS requested_keys
|
||||
INNER JOIN {{ .TableName }} r ON r.{{ .Ident "key_path" }} = requested_keys.{{ .Ident "key_path" }}
|
||||
ORDER BY requested_keys.{{ .Ident "idx" }};
|
||||
Reference in New Issue
Block a user