Documentation ¶
Index ¶
- Constants
- Variables
- func AddLinks(ctx echo.Context, title string, url string, icon string, color ...string) *echo.KVList
- func BackendURL(ctx echo.Context) string
- func BatchAdd(ctx echo.Context, field string, adder Adder, before func(*string) error, ...) (added []string, err error)
- func BoolToFlag(v bool) string
- func ClearHTML(title string) string
- func ContentEncode(content string, contypes ...string) string
- func CookieConfig() scookie.Config
- func CopyFormDataFrom(ctx echo.Context, formData map[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 EncErrMsg(msg string) string
- func EncOkMsg(msg string) string
- func Encrypt(secret string, datas ...*string)
- func Err(ctx echo.Context, err error) (ret interface{})
- func ExtendConfig() echo.H
- func FlagToBool(v string) bool
- func Float32Sum(numbers ...float32) float32
- func Float64Sum(numbers ...float64) float64
- func FloorNumber(page int, pageSize int, index int) int
- func GenPassword() (string, error)
- func GenSecret(sizes ...uint) string
- func GetBoolFlag(value string, defaults ...string) string
- func GetContype(value string, defaults ...string) string
- func GetEditableJSFormData(ctx echo.Context, checkers ...map[string]func(*string) bool) (pk string, field string, value string, err error)
- func GetEncMsg(ctx echo.Context) (ret interface{})
- func GetEnumValue(enums []string, value string, defaults string) string
- func GetLocalIP(ver ...int) (string, error)
- func GetLocalIPs() (ipv4 []string, ipv6 []string, err error)
- func GetLocalIPv4() (ipv4 string, err error)
- func GetLocalIPv6() (ipv6 string, err error)
- func GetNowTime(ctx echo.Context) time.Time
- func GetSavedNextURL(ctx echo.Context, defaultURL string) string
- func HPoolGet() echo.H
- func HPoolRelease(m echo.H)
- func HTMLFilter() *bluemonday.Policy
- func IDSharding(id uint64, shardingNum float64) uint64
- func IPv4ToMachineID(ipv4 string) (uint16, error)
- func If[T any](condition bool, yesValue T, noValue T) T
- func IsAnonymousMode(ownerType string) bool
- func IsBoolFlag(value string) bool
- func IsContype(value string) bool
- func IsIPv4(host string) bool
- func IsIPv6(host string) bool
- func LookPath(bin string, otherPaths ...string) (string, error)
- func MD5Sharding(str interface{}, length ...int) string
- func MarkdownPickoutCodeblock(content string) (repl []string, newContent string)
- func MarkdownRestorePickout(repl []string, content string) string
- func MonthSharding(ctx echo.Context) string
- 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 NewStrictPolicy() *bluemonday.Policy
- func NewUGCPolicy() *bluemonday.Policy
- func NextID(machineIDs ...uint16) (uint64, error)
- func NoLink() *bluemonday.Policy
- func OSAbsPath(ppath string) string
- func Ok(v string) nerrors.Successor
- func ParseMachineIDFromEnvVar() (uint16, error)
- func RemoveBytesXSS(content []byte, noLinks ...bool) []byte
- func RemoveReaderXSS(reader io.Reader, noLinks ...bool) *bytes.Buffer
- func RemoveXSS(content string, noLinks ...bool) string
- func SeekLinesWithoutComments(r io.Reader) (string, error)
- func SendErr(ctx echo.Context, err error)
- func SendFail(ctx echo.Context, msg string, storeInCookie ...bool)
- func SendOk(ctx echo.Context, msg string, storeInCookie ...bool)
- func SetProcessError(f func(ctx echo.Context, err error) error)
- func SetRandomSecret(ctx echo.Context, sessionKey string, storeKey ...string)
- func SetSonyflake(startDate string, machineIDs ...uint16) (sonyFlake *sonyflake.Sonyflake, err error)
- func Setting(group ...string) echo.H
- func SonyflakeInit(machineIDs ...uint16) *sonyflake.Sonyflake
- func SplitSingleMutibytes(content string) string
- func SplitSingleMutibytesBytes(content []byte) []byte
- func StringMapPoolGet() param.StringMap
- func StringMapPoolRelease(m param.StringMap)
- func SystemAPIKey() string
- func TemplateTags(keys ...string) echo.H
- func Tx(ctx echo.Context) factory.Transactioner
- func URLValuesPoolGet() url.Values
- func URLValuesPoolRelease(m url.Values)
- func UniqueID(machineIDs ...uint16) (string, error)
- func WithEncErrMsg(msg string) string
- func WithEncOkMsg(msg string) string
- func WithoutCommentsLineParser(exec func(string) error) func(string) error
- func YearSharding(ctx echo.Context) string
- type APIKeyGetter
- type Adder
- type ConfigFromDB
- type CookieConfigGetter
- type Cryptor
- type ExtendConfigGetter
- type List
- type Lister
- type OffsetListFunc
- type OffsetLister
- type PageListFunc
- type SortedURLValues
- func (s *SortedURLValues) Add(key, value string)
- func (s SortedURLValues) ApplyCond(cond *db.Compounds)
- func (s *SortedURLValues) Del(key string)
- func (s SortedURLValues) Get(key string) string
- func (s SortedURLValues) Has(key string) bool
- func (s *SortedURLValues) ParseQuery(query string) (err error)
- func (s *SortedURLValues) Set(key, value string)
- type StatusColor
- type URLValues
Constants ¶
View Source
const ( ConfigName = `ConfigFromFile` SettingName = `ConfigFromDB` )
View Source
const ( BoolY = `Y` BoolN = `N` )
View Source
const ( ContentTypeHTML = `html` ContentTypeMarkdown = `markdown` ContentTypeText = `text` )
View Source
const DirShardingNum = float64(50000)
DirShardingNum 文件夹分组基数
Variables ¶
View Source
var ( MustGetMyContext = defaults.MustGetContext MustGetContext = defaults.MustGetContext NewMockContext = defaults.NewMockContext )
View Source
var ( // Sorts 获取数据查询时的排序方式 Sorts = clientPagination.Sorts Paging = dbPagination.Paging PagingWithPagination = dbPagination.PagingWithPagination PagingWithPosition = dbPagination.PagingWithPosition PagingWithLister = dbPagination.PagingWithLister PagingWithOffsetLister = dbPagination.PagingWithOffsetLister PagingWithListerCond = dbPagination.PagingWithListerCond PagingWithSelectList = dbPagination.PagingWithSelectList PagingWithList = dbPagination.PagingWithList PagingWithOffsetSelectList = dbPagination.PagingWithOffsetSelectList PagingWithOffsetList = dbPagination.PagingWithOffsetList NewLister = dbPagination.NewLister NewListParam = dbPagination.NewListParam NewOffsetLister = dbPagination.NewOffsetLister )
View Source
var ( ErrInvalidIPAddress = errors.New("Invalid IP address") ErrNotSet = errors.New("Not set") )
View Source
var (
SonyflakeStartDate = `2018-09-01 08:08:08`
)
Functions ¶
func BackendURL ¶
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 BoolToFlag ¶
func ContentEncode ¶
func CookieConfig ¶
func DecryptedByRandomSecret ¶
DecryptedByRandomSecret 用上次设置的随机密码解密
func DeleteRandomSecret ¶
DeleteRandomSecret 删除随机密码
func ExtendConfig ¶
func FlagToBool ¶
func Float32Sum ¶
func Float64Sum ¶
func GenPassword ¶
func GetBoolFlag ¶
func GetContype ¶
func GetEditableJSFormData ¶
func GetLocalIPs ¶
GetLocalIPs 获取本机网卡IP
func GetSavedNextURL ¶ added in v0.3.25
func HPoolRelease ¶
func IPv4ToMachineID ¶
func IsAnonymousMode ¶
func IsBoolFlag ¶
func MarkdownRestorePickout ¶
func MyCleanTags ¶
func MyCleanText ¶
func MyRemoveXSS ¶
func NewSonyflake ¶
NewSonyflake 19位
func NewStrictPolicy ¶
func NewStrictPolicy() *bluemonday.Policy
func NewUGCPolicy ¶
func NewUGCPolicy() *bluemonday.Policy
func NoLink ¶
func NoLink() *bluemonday.Policy
func RemoveBytesXSS ¶
func SetProcessError ¶ added in v0.3.0
func SetRandomSecret ¶
SetRandomSecret 设置随机密码
func SetSonyflake ¶
func SonyflakeInit ¶
func SplitSingleMutibytes ¶
func StringMapPoolGet ¶
func StringMapPoolRelease ¶
func SystemAPIKey ¶
func SystemAPIKey() string
func TemplateTags ¶
func URLValuesPoolGet ¶
func URLValuesPoolRelease ¶
func WithEncErrMsg ¶ added in v0.2.0
func WithEncOkMsg ¶ added in v0.2.0
Types ¶
type Adder ¶
type Adder interface { Set(interface{}, ...interface{}) Add() (interface{}, error) }
Adder interface
type ConfigFromDB ¶
type CookieConfigGetter ¶
type Cryptor ¶ added in v0.2.0
type Cryptor interface { Encode(raw string, keys ...string) string Decode(encrypted string, keys ...string) string Encode256(raw string, keys ...string) string Decode256(encrypted string, keys ...string) string }
func CryptorConfig ¶ added in v0.2.0
func CryptorConfig() Cryptor
type ExtendConfigGetter ¶
type List ¶
type List = dbPagination.List
type Lister ¶
type Lister = dbPagination.Lister
type OffsetListFunc ¶
type OffsetListFunc = dbPagination.OffsetListFunc
type OffsetLister ¶
type OffsetLister = dbPagination.OffsetLister
type PageListFunc ¶
type PageListFunc = dbPagination.PageListFunc
type SortedURLValues ¶
type SortedURLValues []*URLValues
func NewSortedURLValues ¶
func NewSortedURLValues(query string) SortedURLValues
func (*SortedURLValues) Add ¶
func (s *SortedURLValues) Add(key, value string)
func (SortedURLValues) ApplyCond ¶
func (s SortedURLValues) ApplyCond(cond *db.Compounds)
func (*SortedURLValues) Del ¶
func (s *SortedURLValues) Del(key string)
func (SortedURLValues) Get ¶
func (s SortedURLValues) Get(key string) string
func (SortedURLValues) Has ¶
func (s SortedURLValues) Has(key string) bool
func (*SortedURLValues) ParseQuery ¶
func (s *SortedURLValues) ParseQuery(query string) (err error)
ParseQuery 解析 URL Query copy from standard library src/net/url/url.go: func parseQuery(m Values, query string) (err error)
func (*SortedURLValues) Set ¶
func (s *SortedURLValues) Set(key, value string)
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 控制台样式
Click to show internal directories.
Click to hide internal directories.