Documentation ¶
Index ¶
- Constants
- Variables
- func AdditionScript(h *Handle)
- func BuildHandler(pipeScene string, keyFn func(*Handle, string) string, ...) func(*Handle) []HandleCall
- func BuildHandlers(pipeScene string, keyFn func(*Handle, string) string, ...) func(HandleFn[*Handle], *Handle)
- func BuildPipe(scene string) func(*Handle)
- func CalComponent(h *Handle) func(string) string
- func CalCustomCss(h *Handle) (r string)
- func CalCustomLogo(h *Handle) (r string)
- func CalSiteIcon(h *Handle) (r string)
- func CustomVideo(h *Handle, scene ...string) (ok bool)
- func Detail(h *Handle)
- func DetailRender(h *Handle)
- func Digest(next PostsPlugin, h *Handle, post *models.Posts)
- func GetComponentsArgs[T any](k string, defaults T) T
- func GetFn[T any](fnType string, name string) []T
- func GetFnHook[T any](fnType string, name string) []T
- func GetListPostPlugins(name []string, m map[string]func(PostsPlugin, *Handle, *models.Posts)) []func(PostsPlugin, *Handle, *models.Posts)
- func GetMimeType(file string) string
- func GetVideoSetting(h *Handle, u string) (string, error)
- func Index(h *Handle)
- func IndexRender(h *Handle)
- func InitHandle(configFn func(*Handle), h *Handle)
- func InitPipe(h *Handle)
- func ListPostPlugins() map[string]func(PostsPlugin, *Handle, *models.Posts)
- func MergeComponentsArgsForMap[K comparable, V any](name string, m map[K]V)
- func MiddlewareKey(h *Handle, pipScene string) string
- func NothingToDo(h *Handle)
- func ParseStickPosts(h *Handle) (r []models.Posts, ok bool)
- func PasswordProject(next PostsPlugin, h *Handle, post *models.Posts)
- func PipeKey(h *Handle, pipScene string) string
- func PreCodeAndStats(h *Handle)
- func PreRenderTemplate(h *Handle)
- func PreTemplate(h *Handle)
- func ProjectTitle(t models.Posts) models.Posts
- func PushComponentsArgsForSlice[T any](name string, v ...T)
- func PushFn[T any](fnType string, name string, fns ...T) error
- func PushFnHook[T any](fnType string, name string, fns ...T) error
- func PushIndexHandler(pipeScene string, h *Handle, call HandleCall)
- func RenderComment(ctx context.Context, page int, render plugins.CommentHtml, ids []uint64, ...) (string, error)
- func ReplyCommentJs(h *Handle)
- func Run(h *Handle, conf func(*Handle))
- func SetComponentsArgs(key string, value any)
- func SetComponentsArgsForMap[K comparable, V any](name string, key K, v V)
- func StickMapPosts(h *Handle) map[uint64]models.Posts
- func TermClass(term models.TermsMy) string
- type CommentHandle
- type Components
- type DetailHandle
- type Handle
- func (h *Handle) Abort()
- func (h *Handle) AddActionFilter(name string, fns ...func(*Handle, string, ...any) string)
- func (h *Handle) AddCacheComponent(scene, componentType, name string, order float64, fn func(*Handle) string)
- func (h *Handle) BodyClass() string
- func (h *Handle) CommonComponents()
- func (h *Handle) CommonThemeMods() wpconfig.ThemeMods
- func (h *Handle) ComponentHook() ...
- func (h *Handle) Components() *safety.Map[string, map[string][]Components[string]]
- func (h *Handle) DeleteComponents(scene, componentKey, componentName string)
- func (h *Handle) DeleteHandle(pipeScene, scene, name string)
- func (h *Handle) DeletePipe(scene, pipeName string) error
- func (h *Handle) DisplayHeaderText() bool
- func (h *Handle) DoActionFilter(name, s string, args ...any) string
- func (h *Handle) Err() error
- func (h *Handle) ErrLevel() int8
- func (h *Handle) GetComponentFilterFn(name string) ([]func(*Handle, string, ...any) string, bool)
- func (h *Handle) GetCustomHeaderImg() (r models.PostThumbnail, isRand bool)
- func (h *Handle) GetDetailHandle() *DetailHandle
- func (h *Handle) GetHeaderImages(theme string) (r []models.PostThumbnail, err error)
- func (h *Handle) GetIndexHandle() *IndexHandle
- func (h *Handle) GetPassword() string
- func (h *Handle) GetTempl() string
- func (h *Handle) GinH() gin.H
- func (h *Handle) HandleHook() *safety.Map[string, map[string][]func(HandleCall) (HandleCall, bool)]
- func (h *Handle) Handlers() *safety.Map[string, map[string][]HandleCall]
- func (h *Handle) HookHandle(pipeScene, scene string, hook func(HandleCall) (HandleCall, bool))
- func (h *Handle) IsHttps() bool
- func (h *Handle) IsStick(id uint64) bool
- func (h *Handle) PipeHandleHook(name string, calls []HandleCall, m map[string][]HandleCall, key string) []HandleCall
- func (h *Handle) PostClass(posts models.Posts) string
- func (h *Handle) PushCacheGroupFooterScript(scene, name string, order float64, fns ...func(*Handle) string)
- func (h *Handle) PushCacheGroupHeadScript(scene, name string, order float64, fns ...func(*Handle) string)
- func (h *Handle) PushComponentHooks(scene, componentKey string, ...)
- func (h *Handle) PushComponents(scene, componentType string, components ...Components[string])
- func (h *Handle) PushDataHandler(scene string, fns ...HandleCall)
- func (h *Handle) PushFooterScript(scene string, components ...Components[string])
- func (h *Handle) PushGroupCacheComponentFn(scene, componentType, name string, order float64, fns ...func(*Handle) string)
- func (h *Handle) PushGroupComponentStr(scene, componentType, name string, order float64, strs ...string)
- func (h *Handle) PushGroupFooterScript(scene, name string, order float64, strs ...string)
- func (h *Handle) PushGroupHeadScript(scene, name string, order float64, str ...string)
- func (h *Handle) PushHandler(pipScene string, scene string, fns ...HandleCall)
- func (h *Handle) PushHandlers(pipeScene string, call HandleCall, statsOrScene ...string)
- func (h *Handle) PushHeadScript(scene string, components ...Components[string])
- func (h *Handle) PushPipe(scene string, pipes ...Pipe) error
- func (h *Handle) PushPipeHandleHook(name string, fn ...func([]HandleCall) []HandleCall) error
- func (h *Handle) PushPipeHook(scene string, pipes ...func(Pipe) (Pipe, bool)) error
- func (h *Handle) PushPostPlugin(plugin ...PostsPlugin)
- func (h *Handle) PushPostsPlugin(name string, fn func(PostsPlugin, *Handle, *models.Posts))
- func (h *Handle) PushRender(statsOrScene string, fns ...HandleCall)
- func (h *Handle) RenderHtml(t *template.Template, statsCode int, name string)
- func (h *Handle) ReplaceComponents(scene, componentKey, componentName string, components Components[string])
- func (h *Handle) ReplaceHandle(pipeScene, scene, name string, fn HandleFn[*Handle])
- func (h *Handle) ReplacePipe(scene, pipeName string, pipe Pipe) error
- func (h *Handle) Scene() string
- func (h *Handle) SetData(k string, v any)
- func (h *Handle) SetDatas(GinH gin.H)
- func (h *Handle) SetErr(err error, level int8)
- func (h *Handle) SetErrLevel(errLevel int8)
- func (h *Handle) SetScene(scene string)
- func (h *Handle) SetTempl(templ string)
- func (h *Handle) StopHandle()
- func (h *Handle) StopPipe()
- func (h *Handle) Theme() string
- type HandleCall
- func HookHandles(hooks map[string][]func(HandleCall) (HandleCall, bool), ...) []HandleCall
- func NewHandleFn(fn HandleFn[*Handle], order float64, name string) HandleCall
- func PipeDataHandle(h *Handle, key string, hooks map[string][]func(HandleCall) (HandleCall, bool), ...) []HandleCall
- func PipeMiddlewareHandle(h *Handle, key string, hooks map[string][]func(HandleCall) (HandleCall, bool), ...) []HandleCall
- func PipeRender(h *Handle, key string, hooks map[string][]func(HandleCall) (HandleCall, bool), ...) []HandleCall
- type HandleFn
- type HandlePipeFn
- type HandlePlugins
- type IndexHandle
- func (i *IndexHandle) BuildIndexData() (err error)
- func (i *IndexHandle) ExecPostsPlugin()
- func (i *IndexHandle) GetIndexData() (posts []models.Posts, totalRaw int, err error)
- func (i *IndexHandle) ListPlugin() func(*Handle, *models.Posts)
- func (i *IndexHandle) MarkSticky(posts *[]models.Posts)
- func (i *IndexHandle) PageEle() pagination.Render
- func (i *IndexHandle) Pagination()
- func (i *IndexHandle) ParseIndex(parm *IndexParams) (err error)
- func (i *IndexHandle) SetListPlugin(listPlugin func(*Handle, *models.Posts))
- func (i *IndexHandle) SetPageEle(pageEle pagination.Render)
- type IndexParams
- type Pipe
- type PostsPlugin
- type VideoPlay
- type VideoSetting
Constants ¶
View Source
const ( None = iota Low High Fatal )
Variables ¶
View Source
var CacheComponent = reload.BuildMapFnWithAnyParams[string]("cacheComponents", cacheComponentFn)
View Source
var GetAndHookComponents = reload.BuildMapFnWithAnyParams[string]("calComponents", HookComponent)
View Source
var GetCustomHeaderImgFn = reload.BuildValFnWithConfirm("headerImages", customHeadImag, 5)
View Source
var GetCustomLog = reload.BuildValFn("customLogo", CalCustomLogo)
View Source
var GetInitHandleFn = reload.BuildValFnWithAnyParams("themeArgAndConfig", SetConfigHandle, false)
View Source
var GetPostsPlugin = reload.BuildValFnWithAnyParams("postPlugins", UsePostsPlugins)
View Source
var GetStickMapPosts = reload.BuildValFn("stickPostsMap", StickMapPosts)
View Source
var GetStickPosts = reload.BuildValFnWithConfirm("stickPostsSlice", ParseStickPosts)
Functions ¶
func AdditionScript ¶
func AdditionScript(h *Handle)
func BuildHandler ¶
func BuildHandler(pipeScene string, keyFn func(*Handle, string) string, handleHook func(*Handle, string, map[string][]func(HandleCall) (HandleCall, bool), map[string][]HandleCall) []HandleCall) func(*Handle) []HandleCall
func BuildHandlers ¶
func BuildHandlers(pipeScene string, keyFn func(*Handle, string) string, handleHookFn func(*Handle, string, map[string][]func(HandleCall) (HandleCall, bool), map[string][]HandleCall) []HandleCall) func(HandleFn[*Handle], *Handle)
func CalComponent ¶
func CalCustomCss ¶
func CalCustomLogo ¶
func CalSiteIcon ¶
func CustomVideo ¶
func DetailRender ¶
func DetailRender(h *Handle)
func GetComponentsArgs ¶
func GetListPostPlugins ¶
func GetListPostPlugins(name []string, m map[string]func(PostsPlugin, *Handle, *models.Posts)) []func(PostsPlugin, *Handle, *models.Posts)
func GetMimeType ¶
func IndexRender ¶
func IndexRender(h *Handle)
func InitHandle ¶
func ListPostPlugins ¶
func ListPostPlugins() map[string]func(PostsPlugin, *Handle, *models.Posts)
func MergeComponentsArgsForMap ¶
func MergeComponentsArgsForMap[K comparable, V any](name string, m map[K]V)
func MiddlewareKey ¶
func NothingToDo ¶
func NothingToDo(h *Handle)
func PasswordProject ¶
func PasswordProject(next PostsPlugin, h *Handle, post *models.Posts)
PasswordProject 标题和内容密码保护
func PreCodeAndStats ¶
func PreCodeAndStats(h *Handle)
func PreRenderTemplate ¶
func PreRenderTemplate(h *Handle)
func PreTemplate ¶
func PreTemplate(h *Handle)
func PushIndexHandler ¶
func PushIndexHandler(pipeScene string, h *Handle, call HandleCall)
func RenderComment ¶
func ReplyCommentJs ¶
func ReplyCommentJs(h *Handle)
func SetComponentsArgs ¶
func SetComponentsArgsForMap ¶
func SetComponentsArgsForMap[K comparable, V any](name string, key K, v V)
Types ¶
type CommentHandle ¶
type CommentHandle struct {
// contains filtered or unexported fields
}
type Components ¶
Components Order 为执行顺序,降序执行
func GetComponents ¶
func GetComponents(scene, key string) (r []Components[string])
func HookComponent ¶
func HookComponent(a ...any) []Components[string]
func NewComponent ¶
type DetailHandle ¶
type DetailHandle struct { *Handle CommentRender plugins.CommentHtml Comments []uint64 Page int Limit int Post models.Posts CommentPageEle pagination.Render TotalRaw int TotalPage int CommentStep int }
func NewDetailHandle ¶
func NewDetailHandle(handle *Handle) *DetailHandle
func (*DetailHandle) BuildDetailData ¶
func (d *DetailHandle) BuildDetailData() (err error)
func (*DetailHandle) CheckAndGetPost ¶
func (d *DetailHandle) CheckAndGetPost() (err error)
func (*DetailHandle) CommentData ¶
func (d *DetailHandle) CommentData()
func (*DetailHandle) ContextPost ¶
func (d *DetailHandle) ContextPost()
func (*DetailHandle) PasswordProject ¶
func (d *DetailHandle) PasswordProject()
func (*DetailHandle) RenderComment ¶
func (d *DetailHandle) RenderComment()
type Handle ¶
type Handle struct { C *gin.Context Session sessions.Session Code int Stats string // contains filtered or unexported fields }
func SetConfigHandle ¶
func (*Handle) AddActionFilter ¶
func (*Handle) AddCacheComponent ¶
func (*Handle) CommonComponents ¶
func (h *Handle) CommonComponents()
func (*Handle) CommonThemeMods ¶
func (*Handle) ComponentHook ¶
func (h *Handle) ComponentHook() *safety.Map[string, map[string][]func(Components[string]) (Components[string], bool)]
func (*Handle) Components ¶
func (*Handle) DeleteComponents ¶
func (*Handle) DeleteHandle ¶
DeleteHandle 写插件的时候用
func (*Handle) DeletePipe ¶
func (*Handle) DisplayHeaderText ¶
func (*Handle) GetComponentFilterFn ¶
func (*Handle) GetCustomHeaderImg ¶
func (h *Handle) GetCustomHeaderImg() (r models.PostThumbnail, isRand bool)
func (*Handle) GetDetailHandle ¶
func (h *Handle) GetDetailHandle() *DetailHandle
func (*Handle) GetHeaderImages ¶
func (h *Handle) GetHeaderImages(theme string) (r []models.PostThumbnail, err error)
func (*Handle) GetIndexHandle ¶
func (h *Handle) GetIndexHandle() *IndexHandle
func (*Handle) GetPassword ¶
func (*Handle) HandleHook ¶
func (h *Handle) HandleHook() *safety.Map[string, map[string][]func(HandleCall) (HandleCall, bool)]
func (*Handle) HookHandle ¶
func (h *Handle) HookHandle(pipeScene, scene string, hook func(HandleCall) (HandleCall, bool))
HookHandle 写插件的时候用
func (*Handle) PipeHandleHook ¶
func (h *Handle) PipeHandleHook(name string, calls []HandleCall, m map[string][]HandleCall, key string) []HandleCall
func (*Handle) PushCacheGroupFooterScript ¶
func (*Handle) PushCacheGroupHeadScript ¶
func (*Handle) PushComponentHooks ¶
func (h *Handle) PushComponentHooks(scene, componentKey string, fn func(Components[string]) (Components[string], bool))
func (*Handle) PushComponents ¶
func (h *Handle) PushComponents(scene, componentType string, components ...Components[string])
func (*Handle) PushDataHandler ¶
func (h *Handle) PushDataHandler(scene string, fns ...HandleCall)
func (*Handle) PushFooterScript ¶
func (h *Handle) PushFooterScript(scene string, components ...Components[string])
func (*Handle) PushGroupCacheComponentFn ¶
func (*Handle) PushGroupComponentStr ¶
func (*Handle) PushGroupFooterScript ¶
func (*Handle) PushGroupHeadScript ¶
func (*Handle) PushHandler ¶
func (h *Handle) PushHandler(pipScene string, scene string, fns ...HandleCall)
func (*Handle) PushHandlers ¶
func (h *Handle) PushHandlers(pipeScene string, call HandleCall, statsOrScene ...string)
func (*Handle) PushHeadScript ¶
func (h *Handle) PushHeadScript(scene string, components ...Components[string])
func (*Handle) PushPipeHandleHook ¶
func (h *Handle) PushPipeHandleHook(name string, fn ...func([]HandleCall) []HandleCall) error
func (*Handle) PushPipeHook ¶
func (*Handle) PushPostPlugin ¶
func (h *Handle) PushPostPlugin(plugin ...PostsPlugin)
func (*Handle) PushPostsPlugin ¶
func (*Handle) PushRender ¶
func (h *Handle) PushRender(statsOrScene string, fns ...HandleCall)
func (*Handle) RenderHtml ¶
func (*Handle) ReplaceComponents ¶
func (h *Handle) ReplaceComponents(scene, componentKey, componentName string, components Components[string])
func (*Handle) ReplaceHandle ¶
ReplaceHandle 写插件的时候用
func (*Handle) SetErrLevel ¶
func (*Handle) StopHandle ¶
func (h *Handle) StopHandle()
type HandleCall ¶
func HookHandles ¶
func HookHandles(hooks map[string][]func(HandleCall) (HandleCall, bool), handlers map[string][]HandleCall, sceneOrStats ...string) []HandleCall
func NewHandleFn ¶
func NewHandleFn(fn HandleFn[*Handle], order float64, name string) HandleCall
func PipeDataHandle ¶
func PipeDataHandle(h *Handle, key string, hooks map[string][]func(HandleCall) (HandleCall, bool), handlers map[string][]HandleCall) []HandleCall
func PipeMiddlewareHandle ¶
func PipeMiddlewareHandle(h *Handle, key string, hooks map[string][]func(HandleCall) (HandleCall, bool), handlers map[string][]HandleCall) []HandleCall
func PipeRender ¶
func PipeRender(h *Handle, key string, hooks map[string][]func(HandleCall) (HandleCall, bool), handlers map[string][]HandleCall) []HandleCall
type HandleFn ¶
type HandleFn[T any] func(T)
func HandlePipe ¶
func HandlePipe[T any](initial func(T), fns ...HandlePipeFn[T]) HandleFn[T]
HandlePipe 方便把功能写在其它包里
type HandlePipeFn ¶
type HandlePlugins ¶
type IndexHandle ¶
type IndexHandle struct { *Handle Param *IndexParams Posts []models.Posts TotalRows int // contains filtered or unexported fields }
func NewIndexHandle ¶
func NewIndexHandle(handle *Handle) *IndexHandle
func (*IndexHandle) BuildIndexData ¶
func (i *IndexHandle) BuildIndexData() (err error)
func (*IndexHandle) ExecPostsPlugin ¶
func (i *IndexHandle) ExecPostsPlugin()
func (*IndexHandle) GetIndexData ¶
func (i *IndexHandle) GetIndexData() (posts []models.Posts, totalRaw int, err error)
func (*IndexHandle) ListPlugin ¶
func (i *IndexHandle) ListPlugin() func(*Handle, *models.Posts)
func (*IndexHandle) MarkSticky ¶
func (i *IndexHandle) MarkSticky(posts *[]models.Posts)
func (*IndexHandle) PageEle ¶
func (i *IndexHandle) PageEle() pagination.Render
func (*IndexHandle) Pagination ¶
func (i *IndexHandle) Pagination()
func (*IndexHandle) ParseIndex ¶
func (i *IndexHandle) ParseIndex(parm *IndexParams) (err error)
func (*IndexHandle) SetListPlugin ¶
func (i *IndexHandle) SetListPlugin(listPlugin func(*Handle, *models.Posts))
func (*IndexHandle) SetPageEle ¶
func (i *IndexHandle) SetPageEle(pageEle pagination.Render)
type IndexParams ¶
type IndexParams struct { ParseSearch func() ParseArchive func() error ParseCategory func() error ParseTag func() error ParseAuthor func() error CategoryCondition func() ParseParams func() Ctx *gin.Context Page int PageSize int Title string TitleL string TitleR string Search string Author string TotalPage int Category string CategoryType string Where model.SqlBuilder OrderBy string Order string Month string Year string Join model.SqlBuilder PostType []any PostStatus []any Header string PaginationStep int CacheKey string BlogName string }
func NewIndexParams ¶
func NewIndexParams(ctx *gin.Context) *IndexParams
func (*IndexParams) CategoryConditions ¶
func (i *IndexParams) CategoryConditions()
func (*IndexParams) ParseArchives ¶
func (i *IndexParams) ParseArchives() error
func (*IndexParams) ParseAuthors ¶
func (i *IndexParams) ParseAuthors() (err error)
func (*IndexParams) ParseCategorys ¶
func (i *IndexParams) ParseCategorys() error
func (*IndexParams) ParseParamss ¶
func (i *IndexParams) ParseParamss()
func (*IndexParams) ParseSearchs ¶
func (i *IndexParams) ParseSearchs()
func (*IndexParams) ParseTags ¶
func (i *IndexParams) ParseTags() error
type PostsPlugin ¶
func PostPlugin ¶
func PostPlugin(calls ...PostsPlugin) PostsPlugin
func PostsPlugins ¶
func PostsPlugins(initial PostsPlugin, calls ...func(PostsPlugin, *Handle, *models.Posts)) PostsPlugin
func UsePostsPlugins ¶
func UsePostsPlugins(_ ...any) PostsPlugin
type VideoSetting ¶
type VideoSetting struct { MimeType string `json:"mimeType,omitempty"` PosterUrl string `json:"posterUrl,omitempty"` VideoUrl string `json:"videoUrl,omitempty"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` MinWidth int `json:"minWidth,omitempty"` MinHeight int `json:"minHeight,omitempty"` L10n VideoPlay `json:"l10n"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.