mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 04:31:36 +08:00
Unified/Blob: Allow direct access to UIDs (#101339)
This commit is contained in:
@ -6,6 +6,7 @@ import (
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
||||
@ -57,6 +58,7 @@ func (b *backend) PutResourceBlob(ctx context.Context, req *resource.PutBlobRequ
|
||||
err = b.db.WithTx(ctx, ReadCommitted, func(ctx context.Context, tx db.Tx) error {
|
||||
_, err := dbutil.Exec(ctx, tx, sqlResourceBlobInsert, sqlResourceBlobInsertRequest{
|
||||
SQLTemplate: sqltemplate.New(b.dialect),
|
||||
Now: time.Now(),
|
||||
Info: info,
|
||||
Key: req.Resource,
|
||||
ContentType: req.ContentType,
|
||||
@ -83,6 +85,12 @@ func (b *backend) GetResourceBlob(ctx context.Context, key *resource.ResourceKey
|
||||
ctx, span := b.tracer.Start(ctx, tracePrefix+"GetResourceBlob")
|
||||
defer span.End()
|
||||
|
||||
if info == nil {
|
||||
return &resource.GetBlobResponse{
|
||||
Error: resource.NewBadRequestError("missing blob info"),
|
||||
}, nil
|
||||
}
|
||||
|
||||
rsp := &resource.GetBlobResponse{}
|
||||
err := b.db.WithTx(ctx, ReadCommitted, func(ctx context.Context, tx db.Tx) error {
|
||||
rows, err := dbutil.QueryRows(ctx, tx, sqlResourceBlobQuery, sqlResourceBlobQueryRequest{
|
||||
|
Reference in New Issue
Block a user