Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddPrefixPathFS ¶
type AddPrefixPathFS struct {
// contains filtered or unexported fields
}
AddPrefixPathFS is a helper wrapper that will a prefix to each incoming filename that is to be opened. This is useful for embedFS which will keep their prefix. For example, mounting the embed fs go:embed static will retain the static/* prefix, while the static gin handler will strip it.
func NewAddPrefixPathFS ¶
func NewAddPrefixPathFS(fs fs.FS, prefix string) AddPrefixPathFS
NewAddPrefixPathFS creates a new AddPrefixPathFS that will add the given prefix to each file that is opened..
type EmbedFileSystem ¶
type EmbedFileSystem struct {
// contains filtered or unexported fields
}
EmbedFileSystem is a helper to make an embed FS work as a http.FS, which allows us to serve embed.FS using gin's `Static` middleware.
func NewEmbedFileSystem ¶
func NewEmbedFileSystem(f fs.FS, stripPrefix string) *EmbedFileSystem
NewEmbedFileSystem will create a new EmbedFileSystem that will serve the given embed.FS under the given URL path. stripPrefix will be added to the beginning of all paths when looking up files in the embed.FS.
type StaticPath ¶
StaticPath allows you to serve static files from a http.FileSystem under a given URL path UrlPath.
func NewStaticPath ¶
func NewStaticPath(fs fs.FS, urlPath string) StaticPath
NewStaticPath creates a new StaticPath that will serve files from the given http.FileSystem.