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
No known key found for this signature in database
GPG Key ID: B9839E9CD30B7B6B

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 }