1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 02:17:05 +00:00

add support for fs.FS, embed.FS (in addition of string and http.FileSystem) for i18n locales and view engine's templates

This commit is contained in:
Gerasimos (Makis) Maropoulos
2022-09-25 20:40:56 +03:00
parent 4cd0621018
commit 512ed6ffc0
29 changed files with 276 additions and 202 deletions

View File

@@ -1,6 +1,7 @@
package iris
import (
"io/fs"
"net/http"
"net/url"
"path"
@@ -805,10 +806,15 @@ func (cp *ContextPatches) SetCookieKVExpiration(patch time.Duration) {
context.SetCookieKVExpiration = patch
}
// ResolveFS modifies the default way to resolve a filesystem by any type of value.
// It affects the view engine filesystem resolver
// and the Application's API Builder's `HandleDir` method.
func (cp *ContextPatches) ResolveFS(patchFunc func(fsOrDir interface{}) http.FileSystem) {
// ResolveHTTPFS modifies the default way to resolve a filesystem by any type of value.
// It affects the Application's API Builder's `HandleDir` method.
func (cp *ContextPatches) ResolveHTTPFS(patchFunc func(fsOrDir interface{}) http.FileSystem) {
context.ResolveHTTPFS = patchFunc
}
// ResolveHTTPFS modifies the default way to resolve a filesystem by any type of value.
// It affects the view engine's filesystem resolver.
func (cp *ContextPatches) ResolveFS(patchFunc func(fsOrDir interface{}) fs.FS) {
context.ResolveFS = patchFunc
}