This repository has been archived by the owner on Oct 14, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement Seek, Read and ReadAt
- Loading branch information
Norman Meier
committed
Sep 27, 2021
1 parent
7a9cef4
commit f00f8fd
Showing
4 changed files
with
49 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ type File struct { | |
IsDir bool | ||
User int | ||
Group int | ||
Data []byte | ||
} | ||
|
||
var allModels = []interface{}{&File{}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package gormfs | ||
|
||
import "gorm.io/gorm" | ||
|
||
func getFile(db *gorm.DB, name string) (*File, error) { | ||
var f File | ||
if err := db.Where("name = ?", name).Limit(1).Find(&f).Error; err != nil { | ||
return nil, err | ||
} | ||
return &f, nil | ||
} |