SQL/Blob: Add support for blob storage to SQL backend (#98192)
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
INSERT INTO {{ .Ident "resource_blob" }}
|
||||
(
|
||||
{{ .Ident "uuid" }},
|
||||
{{ .Ident "created" }},
|
||||
{{ .Ident "group" }},
|
||||
{{ .Ident "resource" }},
|
||||
{{ .Ident "namespace" }},
|
||||
{{ .Ident "name" }},
|
||||
|
||||
{{ .Ident "value" }},
|
||||
{{ .Ident "hash" }},
|
||||
{{ .Ident "content_type" }}
|
||||
)
|
||||
VALUES (
|
||||
{{ .Arg .Info.UID }},
|
||||
{{ .Arg .Now }},
|
||||
{{ .Arg .Key.Group }},
|
||||
{{ .Arg .Key.Resource }},
|
||||
{{ .Arg .Key.Namespace }},
|
||||
{{ .Arg .Key.Name }},
|
||||
|
||||
{{ .Arg .Value }},
|
||||
{{ .Arg .Info.Hash }},
|
||||
{{ .Arg .ContentType }}
|
||||
)
|
||||
;
|
||||
@@ -0,0 +1,17 @@
|
||||
SELECT
|
||||
{{ .Ident "uuid" }},
|
||||
{{ .Ident "value" }},
|
||||
{{ .Ident "content_type" }}
|
||||
FROM {{ .Ident "resource_blob" }}
|
||||
WHERE 1 = 1
|
||||
AND {{ .Ident "namespace" }} = {{ .Arg .Key.Namespace }}
|
||||
AND {{ .Ident "group" }} = {{ .Arg .Key.Group }}
|
||||
AND {{ .Ident "resource" }} = {{ .Arg .Key.Resource }}
|
||||
{{ if .Key.Name }}
|
||||
AND {{ .Ident "name" }} = {{ .Arg .Key.Name }}
|
||||
{{ end }}
|
||||
{{ if .UID }}
|
||||
AND {{ .Ident "uuid" }} = {{ .Arg .UID }}
|
||||
{{ end }}
|
||||
ORDER BY {{ .Ident "created" }} DESC
|
||||
LIMIT 1;
|
||||
Reference in New Issue
Block a user