Documentation ¶
Index ¶
- Constants
- Variables
- func BatchAdd(ctx echo.Context, field string, adder Adder, before func(string) error, ...) (added []string, err error)
- func CaptchaInfo(hostAlias string, captchaName string, args ...string) echo.H
- func ClearHTML(title string) string
- func Crypto() codec.Codec
- func Decrypt(secret string, datas ...*string)
- func DecryptedByRandomSecret(ctx echo.Context, sessionKey string, datas ...*string)
- func DeleteRandomSecret(ctx echo.Context, sessionKey string)
- func DirSharding(id uint64) uint64
- func Encrypt(secret string, datas ...*string)
- func Err(ctx echo.Context, err error) (ret interface{})
- func GenSecret(sizes ...int) string
- func HTMLFilter() *bluemonday.Policy
- func Init()
- func IsError(err interface{}) bool
- func IsMessage(err interface{}) bool
- func IsOk(err interface{}) bool
- func IsRightUploadFile(ctx echo.Context, src string) error
- func IsUserDisabled(err error) bool
- func IsUserNoPerm(err error) bool
- func IsUserNotFound(err error) bool
- func IsUserNotLoggedIn(err error) bool
- func LogShow(ctx echo.Context, logFile string, extensions ...echo.H) error
- func ModifyAsThumbnailName(originName, thumbnailName string) string
- func MoveAvatarToUserDir(ctx echo.Context, src string, typ string, id uint64) (string, error)
- func MoveEmbedTemporaryFiles(ctx echo.Context, content string, typ string, id interface{}) (int, string, error)
- func MoveUploadedFileToOwnerDir(ctx echo.Context, src string, typ string, id interface{}) (string, error)
- func MoveUploadedFileToOwnerDirCommon(ctx echo.Context, src string, typ string, id interface{}, isAvatar bool) (string, error)
- func MyCleanTags(value string) string
- func MyCleanText(value string) string
- func MyRemoveXSS(content string) string
- func NewSonyflake(startDate string, machineIDs ...uint16) (*sonyflake.Sonyflake, error)
- func NextID() (uint64, error)
- func OkString(err interface{}) string
- func ReadCache(dir string, name string) (content []byte, err error)
- func RemoveAvatar(ctx echo.Context, typ string, id uint64) error
- func RemoveBytesXSS(content []byte) []byte
- func RemoveCache(dir string, names ...string) (err error)
- func RemoveReaderXSS(reader io.Reader) *bytes.Buffer
- func RemoveUploadedFile(ctx echo.Context, typ string, id interface{}) error
- func RemoveXSS(content string) string
- func Replacex(s string, oldAndNew map[string]string) string
- func SendErr(ctx echo.Context, err error)
- func SendFail(ctx echo.Context, msg string)
- func SendOk(ctx echo.Context, msg string)
- func SetRandomSecret(ctx echo.Context, sessionKey string, storeKey ...string)
- func SetSonyflake(startDate string, machineID ...uint16) (err error)
- func UniqueID() (string, error)
- func ValidFileOwnerID(id string) error
- func VerifyAndSetCaptcha(ctx echo.Context, hostAlias string, captchaName string, args ...string) echo.Data
- func VerifyCaptcha(ctx echo.Context, hostAlias string, captchaName string, args ...string) echo.Data
- func WriteCache(dir string, name string, content []byte) (err error)
- type Adder
- type ConfigFromDB
- type Errors
- type List
- type Lister
- type Messager
- type NopMessage
- type OffsetListFunc
- type OffsetLister
- type PageListFunc
- type StatusColor
- type Success
- type Successor
Constants ¶
const ( // StatusCaptchaError 验证码错误 StatusCaptchaError = -9 // StatusNonPrivileged 无权限 StatusNonPrivileged = -2 // StatusNotLoggedIn 未登录 StatusNotLoggedIn = -1 // StatusFailure 操作失败 StatusFailure = 0 // StatusSuccess 操作成功 StatusSuccess = 1 )
const DirShardingNum = float64(50000)
DirShardingNum 文件夹分组基数
Variables ¶
var ( //ErrUserNotLoggedIn 用户未登录 ErrUserNotLoggedIn = errors.New(`User not logged in`) //ErrUserNotFound 用户不存在 ErrUserNotFound = errors.New(`User does not exist`) //ErrUserNoPerm 用户无权限 ErrUserNoPerm = errors.New(`User has no permission`) //ErrUserDisabled 用户已被禁用 ErrUserDisabled = errors.New(`User has been disabled`) // ErrIgnoreConfigChange 忽略配置文件更改 ErrIgnoreConfigChange = errors.New(`Ingore file`) // ErrNext 需要继续向下检查 ErrNext = errors.New("Next") )
var ( // Sorts 获取数据查询时的排序方式 Sorts = clientPagination.Sorts Paging = dbPagination.Paging PagingWithPagination = dbPagination.PagingWithPagination PagingWithLister = dbPagination.PagingWithLister PagingWithListerCond = dbPagination.PagingWithListerCond PagingWithSelectList = dbPagination.PagingWithSelectList NewLister = dbPagination.NewLister NewListParam = dbPagination.NewListParam NewOffsetLister = dbPagination.NewOffsetLister )
var ( // ErrIncorrectFileOwnerID . ErrIncorrectFileOwnerID = errors.New("Incorrect File Owner ID") )
var LogParsers = map[string]func(line *tail.Line) (interface{}, error){}
LogParsers 日志格式解析器
var OnRemoveOwnerFile = func(ctx echo.Context, typ string, id interface{}, ownerDir string) error { return nil }
OnRemoveOwnerFile 当删除文件时的通用操作
var OnUpdateOwnerFilePath = func(ctx echo.Context, src string, typ string, id interface{}, newSavePath string, newViewURL string) error { return nil }
OnUpdateOwnerFilePath 当更新文件路径时的通用操作
Functions ¶
func BatchAdd ¶
func BatchAdd(ctx echo.Context, field string, adder Adder, before func(string) error, seperators ...string) (added []string, err error)
BatchAdd 批量添加(常用于批量添加分类) BatchAdd(ctx, `ident,>name`, adder, before, `=`) 可以通过在字段名称前面添加“>”前缀来指定表单字段名称,如果不指定则默认使用第一个作为表单字段名
func CaptchaInfo ¶
CaptchaInfo 新验证码信息
func DecryptedByRandomSecret ¶
DecryptedByRandomSecret 用上次设置的随机密码解密
func DeleteRandomSecret ¶
DeleteRandomSecret 删除随机密码
func IsRightUploadFile ¶
IsRightUploadFile 是否是正确的上传文件
func ModifyAsThumbnailName ¶
ModifyAsThumbnailName 将指向临时文件夹的缩略图路径改为新位置上的缩略图路径 originName 为新位置上的原始图路径 thumbnailName 为临时位置上的缩略图路径
func MoveAvatarToUserDir ¶
MoveAvatarToUserDir 移动临时文件夹中的头像到用户目录
func MoveEmbedTemporaryFiles ¶
func MoveEmbedTemporaryFiles(ctx echo.Context, content string, typ string, id interface{}) (int, string, error)
MoveEmbedTemporaryFiles 转移被嵌入到文本内容中临时文件
func MoveUploadedFileToOwnerDir ¶
func MoveUploadedFileToOwnerDir(ctx echo.Context, src string, typ string, id interface{}) (string, error)
MoveUploadedFileToOwnerDir 移动上传的文件到所有者目录
func MoveUploadedFileToOwnerDirCommon ¶
func MoveUploadedFileToOwnerDirCommon(ctx echo.Context, src string, typ string, id interface{}, isAvatar bool) (string, error)
MoveUploadedFileToOwnerDirCommon 移动上传的文件到所有者目录
func MyCleanTags ¶
func MyCleanText ¶
func MyRemoveXSS ¶
func NewSonyflake ¶
func RemoveAvatar ¶
RemoveAvatar 删除头像
func RemoveBytesXSS ¶
func RemoveUploadedFile ¶
RemoveUploadedFile 删除被上传的文件
func SetRandomSecret ¶
SetRandomSecret 设置随机密码
func SetSonyflake ¶
func VerifyAndSetCaptcha ¶
func VerifyAndSetCaptcha(ctx echo.Context, hostAlias string, captchaName string, args ...string) echo.Data
VerifyAndSetCaptcha 验证码验证并设置新验证码信息
Types ¶
type Adder ¶
type Adder interface { Set(interface{}, ...interface{}) Add() (interface{}, error) }
Adder interface
type ConfigFromDB ¶
type List ¶
type List = dbPagination.List
type Lister ¶
type Lister = dbPagination.Lister
type Messager ¶
Messager 信息接口
var DefaultNopMessage Messager = &NopMessage{}
DefaultNopMessage 默认空消息
type OffsetListFunc ¶
type OffsetListFunc = dbPagination.OffsetListFunc
type OffsetLister ¶
type OffsetLister = dbPagination.OffsetLister
type PageListFunc ¶
type PageListFunc = dbPagination.PageListFunc
type StatusColor ¶
type StatusColor string
StatusColor 状态色
func (StatusColor) Bootstrap ¶
func (s StatusColor) Bootstrap() string
Bootstrap 前端框架 bootstrap css 状态样式
func (StatusColor) String ¶
func (s StatusColor) String() string
func (StatusColor) Terminal ¶
func (s StatusColor) Terminal() func(string, ...interface{})
Terminal 控制台样式