1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 09:57:01 +00:00

minor: add iris.Singleton as a helper

This commit is contained in:
Gerasimos (Makis) Maropoulos
2023-08-22 15:06:36 +03:00
parent 10fd39fc07
commit 3c79c4ee04

View File

@@ -852,3 +852,10 @@ func (cwp *ContextWriterPatches) Markdown(patchFunc func(ctx Context, v []byte,
func (cwp *ContextWriterPatches) YAML(patchFunc func(ctx Context, v interface{}, indentSpace int) error) {
context.WriteYAML = patchFunc
}
// Singleton is a structure which can be used as an embedded field on
// struct/controllers that should be marked as singletons on `PartyConfigure` or `MVC` Applications.
type Singleton struct{}
// Singleton returns true as this controller is a singleton.
func (c Singleton) Singleton() bool { return true }