merged from gramsrv upstream
This commit is contained in:
parent
79c64ee916
commit
21a0856587
651 changed files with 54774 additions and 4590 deletions
25
internal/store/postgres/blob_test_helpers_test.go
Normal file
25
internal/store/postgres/blob_test_helpers_test.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package postgres
|
||||
|
||||
import (
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
|
||||
"telesrv/internal/domain"
|
||||
)
|
||||
|
||||
func postgresTestBlob(locationKey, label string, size int64, mimeType string) domain.FileBlob {
|
||||
data := make([]byte, size)
|
||||
seed := sha256.Sum256([]byte(label))
|
||||
for i := range data {
|
||||
data[i] = seed[i%len(seed)]
|
||||
}
|
||||
digest := sha256.Sum256(data)
|
||||
return domain.FileBlob{
|
||||
LocationKey: locationKey,
|
||||
Backend: domain.MediaBackendLocalFS,
|
||||
ObjectKey: hex.EncodeToString(digest[:]),
|
||||
Size: size,
|
||||
SHA256: append([]byte(nil), digest[:]...),
|
||||
MimeType: mimeType,
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue