1
mirror of https://github.com/jlelse/GoBlog synced 2024-07-08 06:12:59 +00:00
GoBlog/pkgs/plugintypes/plugins.go

30 lines
549 B
Go
Raw Normal View History

package plugintypes
import (
2023-01-22 20:26:21 +00:00
"io"
"net/http"
)
2023-01-22 20:26:21 +00:00
// SetApp is used to allow GoBlog set its app instance to be accessible by the plugin.
type SetApp interface {
2023-01-22 20:26:21 +00:00
SetApp(app App)
}
2023-01-22 20:26:21 +00:00
// SetConfig is used in all plugin types to allow GoBlog set the plugin configuration.
type SetConfig interface {
2023-01-22 20:26:21 +00:00
SetConfig(config map[string]any)
}
type Exec interface {
Exec()
}
type Middleware interface {
2023-01-22 20:26:21 +00:00
Handler(next http.Handler) http.Handler
Prio() int
}
type UI interface {
2023-01-22 20:26:21 +00:00
Render(renderContext RenderContext, rendered io.Reader, modified io.Writer)
}