chore: rename some symbols

This commit is contained in:
Noah Hsu
2022-06-15 20:41:17 +08:00
parent 09ef7c7106
commit 69647f73f0
10 changed files with 95 additions and 91 deletions

View File

@ -15,7 +15,7 @@ import (
// List files
// TODO: hide
// TODO: sort
func List(ctx context.Context, path string) ([]model.Object, error) {
func List(ctx context.Context, path string) ([]model.Obj, error) {
account, actualPath, err := operations.GetAccountAndActualPath(path)
virtualFiles := operations.GetAccountVirtualFilesByPath(path)
if err != nil {
@ -40,7 +40,7 @@ func List(ctx context.Context, path string) ([]model.Object, error) {
return files, nil
}
func Get(ctx context.Context, path string) (model.Object, error) {
func Get(ctx context.Context, path string) (model.Obj, error) {
path = utils.StandardizationPath(path)
// maybe a virtual file
if path != "/" {
@ -55,7 +55,7 @@ func Get(ctx context.Context, path string) (model.Object, error) {
if err != nil {
// if there are no account prefix with path, maybe root folder
if path == "/" {
return model.File{
return model.Object{
Name: "root",
Size: 0,
Modified: time.Time{},

View File

@ -12,7 +12,7 @@ import (
"github.com/pkg/errors"
)
func containsByName(files []model.Object, file model.Object) bool {
func containsByName(files []model.Obj, file model.Obj) bool {
for _, f := range files {
if f.GetName() == file.GetName() {
return true
@ -23,7 +23,7 @@ func containsByName(files []model.Object, file model.Object) bool {
var httpClient = &http.Client{}
func getFileStreamFromLink(file model.Object, link *model.Link) (model.FileStreamer, error) {
func getFileStreamFromLink(file model.Obj, link *model.Link) (model.FileStreamer, error) {
var rc io.ReadCloser
mimetype := mime.TypeByExtension(stdpath.Ext(file.GetName()))
if link.Data != nil {
@ -57,7 +57,7 @@ func getFileStreamFromLink(file model.Object, link *model.Link) (model.FileStrea
mimetype = "application/octet-stream"
}
stream := model.FileStream{
Object: file,
Obj: file,
ReadCloser: rc,
Mimetype: mimetype,
}