Refactor (driver): Optimize lock field type

- Changed the `IsLock` field type from `int` to `bool` for better semantics.
- Updated the check logic to use direct Boolean comparisons to improve code readability and accuracy.
pull/9311/head
okatu-loli 2025-09-05 19:51:30 +08:00
parent d6f002a133
commit ca149ac10f
2 changed files with 2 additions and 2 deletions

View File

@ -55,7 +55,7 @@ func (d *Pan123) Drop(ctx context.Context) error {
}
func (d *Pan123) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error) {
if f, ok := dir.(File); ok && f.IsLock == 1 {
if f, ok := dir.(File); ok && f.IsLock {
if err := d.unlockSafeBox(f.FileId); err != nil {
return nil, err
}

View File

@ -20,7 +20,7 @@ type File struct {
Etag string `json:"Etag"`
S3KeyFlag string `json:"S3KeyFlag"`
DownloadUrl string `json:"DownloadUrl"`
IsLock int `json:"IsLock"`
IsLock bool `json:"IsLock"`
}
func (f File) CreateTime() time.Time {