Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiskStaticDriver ¶
type DiskStaticDriver struct {
// contains filtered or unexported fields
}
DiskStaticDriver 磁盘文件系统驱动实现
func NewDiskStaticDriver ¶
func NewDiskStaticDriver(baseDir string) *DiskStaticDriver
NewDiskStaticDriver 创建磁盘驱动实例
func (*DiskStaticDriver) FileExists ¶
func (d *DiskStaticDriver) FileExists(path string) bool
FileExists 检查文件是否存在于磁盘中
func (*DiskStaticDriver) GetDriverName ¶
func (d *DiskStaticDriver) GetDriverName() string
GetDriverName 获取驱动名称
func (*DiskStaticDriver) GetFS ¶
func (d *DiskStaticDriver) GetFS(dir string) (http.FileSystem, error)
GetFS 获取指定目录的文件系统
type EmbedStaticDriver ¶
type EmbedStaticDriver struct {
// contains filtered or unexported fields
}
EmbedStaticDriver embed.FS 驱动实现
func NewEmbedStaticDriver ¶
func NewEmbedStaticDriver(embedFS embed.FS) *EmbedStaticDriver
NewEmbedStaticDriver 创建 embed 驱动实例
func (*EmbedStaticDriver) FileExists ¶
func (d *EmbedStaticDriver) FileExists(path string) bool
FileExists 检查文件是否存在于 embed.FS 中
func (*EmbedStaticDriver) GetDriverName ¶
func (d *EmbedStaticDriver) GetDriverName() string
GetDriverName 获取驱动名称
func (*EmbedStaticDriver) GetFS ¶
func (d *EmbedStaticDriver) GetFS(dir string) (http.FileSystem, error)
GetFS 获取指定目录的文件系统
type StaticFileDriver ¶
type StaticFileDriver interface {
// FileExists 检查文件是否存在
FileExists(path string) bool
// GetFS 获取文件系统(用于 gin.StaticFS)
GetFS(dir string) (http.FileSystem, error)
// ServeFile 直接提供文件到 gin.Context
ServeFile(c *gin.Context, dir string, relativePath string) error
// GetDriverName 获取驱动名称(用于日志)
GetDriverName() string
}
StaticFileDriver 静态文件驱动接口
Source Files
¶
- disk_static_driver.go
- embed_static_driver.go
- static_file_driver.go
Click to show internal directories.
Click to hide internal directories.