feat: add command to move blob from local to db (#2026)

* Add `mvrss` command to move blob from local to db

* Add comment for mvrss command
This commit is contained in:
Athurg Gooth
2023-08-03 19:08:39 +08:00
committed by GitHub
parent b5a6f1f997
commit 11abc45440
2 changed files with 89 additions and 3 deletions

View File

@@ -36,9 +36,11 @@ type FindResource struct {
}
type UpdateResource struct {
ID int
UpdatedTs *int64
Filename *string
ID int
UpdatedTs *int64
Filename *string
InternalPath *string
Blob []byte
}
type DeleteResource struct {
@@ -174,6 +176,12 @@ func (s *Store) UpdateResource(ctx context.Context, update *UpdateResource) (*Re
if v := update.Filename; v != nil {
set, args = append(set, "filename = ?"), append(args, *v)
}
if v := update.InternalPath; v != nil {
set, args = append(set, "internal_path = ?"), append(args, *v)
}
if v := update.Blob; v != nil {
set, args = append(set, "blob = ?"), append(args, v)
}
args = append(args, update.ID)
fields := []string{"id", "filename", "external_link", "type", "size", "creator_id", "created_ts", "updated_ts", "internal_path"}