feat (generate-file): not tested yet

This commit is contained in:
dpurbosakti
2025-11-17 17:18:22 +07:00
parent 8073236d06
commit 69a13dd37d
9 changed files with 340 additions and 16 deletions

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
package filehelper
import (
"fmt"
"os"
"path/filepath"
)
// const DEFAULT_EXPIRY_FILES = time.Hour * 24 * 7
func PathAgreement(medicalNumber string) (string, error) {
outputPath := fmt.Sprintf("./public/patient/%s", medicalNumber)
err := os.MkdirAll(outputPath, os.ModePerm)
return outputPath, err
}
func PathToSaveFile(outputPath string) (string, error) {
err := os.MkdirAll(outputPath, os.ModePerm)
return outputPath, err
}
func RenameFile(srcPath, dstPath string) error {
return os.Rename(srcPath, dstPath)
}
func DeleteFolder(path string) error {
return os.RemoveAll(path)
}
func PathToUrl(fileName string) *string {
fileUrl := filepath.ToSlash(fmt.Sprintf("%c%s", os.PathSeparator, fileName))
return &fileUrl
}