Documentation
¶
Overview ¶
inspiring from https://www.youtube.com/watch?v=1B71SL6Y0kA
Index ¶
- Constants
- Variables
- func CheckExist(src string) bool
- func CheckImage(src string) error
- func CheckImageExt(fileName string, uploadAllowExt []string) bool
- func CheckImageSize(f multipart.File, uploadMaxSize int) bool
- func CheckNotExist(src string) bool
- func CheckPermission(src string) bool
- func Copy(filepath string, reader io.Reader) error
- func CopyDir(src, dst string) error
- func CopyFile(src, dst string) error
- func Create(filepath string) (*os.File, error)
- func CreateDir(filepath string) error
- func DirClean(dir string) string
- func FileNameClean(filename string) string
- func FileNameEdit(filename string) string
- func FindFile(path string) (string, error)
- func FindFiles(path string, deep int8, num int) ([]string, error)
- func FindFiles2(path string, deep int8, num int) ([]string, error)
- func GetDir(path string) string
- func GetExt(file *multipart.FileHeader) (string, error)
- func GetFileCreateTime(path string) int64
- func GetImageFullPath(uploadPath, runtimeRootPath string) string
- func GetImageFullUrl(uploadPath, name string) string
- func GetImageName(name string) string
- func GetLogFilePath(RuntimeRootPath, LogSavePath string) string
- func GetMP4Duration(filepath string) (lengthOfTime uint32, err error)
- func GetSize(f multipart.File) int
- func IsNotExistMkdir(src string) error
- func LastFile(dir string) (os.FileInfo, map[string]os.FileInfo, error)
- func Md5(path string) (string, error)
- func Mkdir(src string) error
- func MkdirAll(src string) error
- func MustOpen(fileName, filePath string) (*os.File, error)
- func NotExist(filepath string) bool
- func OpenLogFile(fileName, filePath string) (*os.File, error)
- func PathClean(dir string) string
- func RangeDir(dir string, callback func(dir string, entry os.DirEntry) error) error
- func SafeCopyFile(src, dst string) error
- func Split(path string) (dir, file string)
- func Write(buf *bytes.Buffer, filename string) (n int, err error)
- type BoxHeader
- type Dir
- type DirEntities
- type File
- type FileType
- type SafeCopy
Constants ¶
View Source
const PathSeparator = string(os.PathSeparator)
Variables ¶
View Source
var FileTypeMap = map[string]FileType{ ".txt": Txt, ".doc": Doc, }
Functions ¶
func CheckExist ¶
func CheckImage ¶
func CheckImageExt ¶
func CheckNotExist ¶
func CheckPermission ¶
func FileNameClean ¶
func FindFiles2 ¶
path和filepath两个包,filepath文件专用
func GetFileCreateTime ¶
func GetImageFullPath ¶
func GetImageFullUrl ¶
func GetImageName ¶
func GetLogFilePath ¶
func GetMP4Duration ¶
GetMP4Duration 获取视频时长,以秒计
func IsNotExistMkdir ¶
func SafeCopyFile ¶
SafeCopyFile : Error handling by abstraction
Types ¶
type DirEntities ¶
func (DirEntities) Len ¶
func (e DirEntities) Len() int
func (DirEntities) Less ¶
func (e DirEntities) Less(i, j int) bool
func (DirEntities) Swap ¶
func (e DirEntities) Swap(i, j int)
type File ¶
type File struct {
ID uint64 `gorm:"primary_key" json:"id"`
FileName string `gorm:"type:varchar(100);not null" json:"file_name"`
OriginalName string `gorm:"type:varchar(100);not null" json:"original_name"`
URL string `json:"url"`
MD5 string `gorm:"type:varchar(32)" json:"md5"`
Mime string `json:"mime"`
Size uint64 `json:"size"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.