system

package
v0.7.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

Package system 提供了大部分与事个系统相关的功能

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteLinkage

func DeleteLinkage(l *Module, key string) error

DeleteLinkage 删除指定的级联数据

func InstallLinkage

func InstallLinkage[T any](l *Module, key, title string, items []*LinkageItem[T]) error

InstallLinkage 安装一组级联数据

Types

type Backup

type Backup struct {
	// 备份文件的路径
	Dir string `json:"dir" yaml:"dir" xml:"dir"`

	// 备份的文件格式,以 Go 的时间格式作为格式。
	Format string `json:"format" yaml:"format" xml:"format"`

	// 备份任务的执行时间
	Cron string `yaml:"cron" json:"cron" xml:"cron"`
	// contains filtered or unexported fields
}

Backup 备份数据的相关设置项

func (*Backup) SanitizeConfig

func (b *Backup) SanitizeConfig() *web.FieldError

type Config

type Config struct {
	// URLPrefix 该模块下的地址前缀
	URLPrefix string `yaml:"urlPrefix" json:"urlPrefix" xml:"urlPrefix"`

	// Backup 备份数据的选项
	Backup *Backup `yaml:"backup,omitempty" json:"backup,omitempty" xml:"backup,omitempty"`
}

Config 配置项

func (*Config) SanitizeConfig

func (c *Config) SanitizeConfig() *web.FieldError

type Linkage

type Linkage[T any] struct {
	// contains filtered or unexported fields
}

Linkage 级联菜单元素

func LoadLinkage

func LoadLinkage[T any](l *Module, key string) (*Linkage[T], error)

LoadLinkage 加载一组级联数据

func (*Linkage[T]) Add

func (l *Linkage[T]) Add(v T, parent int64) (*LinkageItem[T], error)

Add 将 v 添加至 parent 之下

func (*Linkage[T]) Delete

func (l *Linkage[T]) Delete(id int64) error

func (*Linkage[T]) Get

func (l *Linkage[T]) Get(id int64) *LinkageItem[T]

Get 返回指定 id 的子元素

可以查找非根元素的元素,如果找不到则返回 nil。

func (*Linkage[T]) Items

func (l *Linkage[T]) Items() []*LinkageItem[T]

func (*Linkage[T]) Key

func (l *Linkage[T]) Key() string

func (*Linkage[T]) Set

func (l *Linkage[T]) Set(id int64, v T) error

func (*Linkage[T]) Title

func (l *Linkage[T]) Title() string

type LinkageItem

type LinkageItem[T any] struct {
	ID    int64
	Data  T
	Items []*LinkageItem[T]
}

type Module

type Module struct {
	// contains filtered or unexported fields
}

func Install

func Install(mod *cmfx.Module, conf *Config, adminL *admin.Module) *Module

func Load

func Load(mod *cmfx.Module, conf *Config, adminL *admin.Module) *Module

Load 加载当前模块

conf 当前模块的配置项,需要调用者自先调用 Config.SanitizeConfig 对数据进行校正;

func (*Module) Censor

func (m *Module) Censor(text string) (ok bool)

Censor 审核内容

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL