Documentation ¶
Index ¶
- Constants
- Variables
- func AbsoluteURL(purl string) string
- func Base36Decode(v string) uint64
- func Base36Encode(i uint64) string
- func CN2Number(cn string) (uint64, error)
- func CondFindInSet(key string, value interface{}, useFulltextIndex ...bool) db.Compound
- func CopyFormDataBy(ctx echo.Context, formData map[string][]string)
- func Dump(m interface{})
- func FirstLetter(s string) string
- func FixedClippedString(text string) string
- func GenSN(prefixes ...string) (string, error)
- func GetValidated(ctx echo.Context) interface{}
- func HashID() *hashids.HashID
- func HashIDDecode(encoded string) (uint64, error)
- func HashIDEncode(id uint64) (string, error)
- func HashIDOnce() *hashids.HashID
- func HeaderP3P(ctx echo.Context)
- func HideContent(content string, contype string, hide HideDetector, ...) (result string)
- func ImageProxyURL(values ...interface{}) string
- func IsMobile(userAgent string) bool
- func IsSN(v string) bool
- func IsSameDay(last time.Time, nows ...time.Time) bool
- func IsSameMonth(last time.Time, nows ...time.Time) bool
- func IsWechat(userAgent string) bool
- func MakeEncodedURL(urlStr string, expiry int64) (string, error)
- func MakeEncodedURLOrLink(url string, expiry interface{}, linkTitle ...string) interface{}
- func MakeKVCallback(cb func(k interface{}, v interface{}) error, args ...interface{}) (err error)
- func MakeListURL(urlPrefix string, params param.StringMap, filterParamNames []string, ...) string
- func MakeValuesURLPath(args echo.H, sep string, keys ...string) string
- func MonthDay(year int, month int) (days int)
- func MonthDayByTime(t time.Time) int
- func NewHashID(salt string) *hashids.HashID
- func NewSNCodec() *hashids.HashID
- func OutputContent(content string, contypes ...string) interface{}
- func ParseDuration(s string) (time.Duration, error)
- func ParseEncodedURL(encodedURL string) (string, int64, error)
- func ParseURLPathKV(path string) param.StringMap
- func ParseURLPathValues(path string, sep string, keys ...string) param.StringMap
- func PictureHTML(picURL string, widthAndHeights ...string) template.HTML
- func PictureWithDefaultHTML(picURL string, defaultURL string, widthAndHeights ...string) template.HTML
- func Pinyin(s string, seps ...string) string
- func RawSN() (string, error)
- func RecvValidated(ctx echo.Context, recvs ...factory.Model) error
- func ReplacePlaceholder(content string, values map[string]interface{}, startAndEndTag ...string) string
- func ReplacePlaceholderx(t *fasttemplate.Template, values map[string]interface{}, args ...interface{}) string
- func ResizeImageURL(image string, size string, defaults ...string) string
- func Response(ctx echo.Context) error
- func SecretSafeBuilder(ctx echo.Context, secret string) string
- func Slugify(v string) string
- func StrengthenSafeSecret(ctx echo.Context, secret string) string
- func TodayTimestamp() (startTs int64, endTs int64)
- func TokenURL(values ...interface{}) string
- func TrimOverflowText(text string, maxLength int, seperators ...string) string
- func TrimOverflowTextSlice(textSlice []string, maxLength int, seperators ...string) []string
- func Tx(ctx echo.Context) factory.Transactioner
- func URLByName(name string, params ...interface{}) string
- func URLFor(purl string) string
- type AsMap
- type AsPartialMap
- type HideDetector
- type Pagination
- type ResponseData
- type ResponseList
- type Stars
- type VSTAR
Constants ¶
View Source
const PrefixEncoded = `encoded:`
Variables ¶
View Source
var ( DefaultStarIcon = `fa-star-o` StarIcons = map[VSTAR]string{ STAR_EMPTY: `fa-star-o`, STAR_FULL: `fa-star`, STAR_HALF: `fa-star-half-o`, } DefaultStarName = `empty` StarNames = map[VSTAR]string{ STAR_EMPTY: `empty`, STAR_FULL: `full`, STAR_HALF: `half`, } )
View Source
var ( ErrInvalidDuration = errors.New("invalid duration") DurationDay = time.Hour * 24 DurationMonth = DurationDay * 30 DurationWeek = DurationDay * 7 DurationYear = DurationDay * 365 MonthMaxSeconds = 31 * 86400 // 月份中可能的最大秒数 )
View Source
var PinyinDict = pinyin.NewDict()
View Source
var SlugifyMaxWidth = 255
Functions ¶
func AbsoluteURL ¶
func Base36Decode ¶
func Base36Encode ¶
func CondFindInSet ¶
func FirstLetter ¶
func FixedClippedString ¶
FixedClippedString 修正被裁减的字符串避免出现乱码
func GetValidated ¶
func HashIDDecode ¶
func HashIDEncode ¶
func HashIDOnce ¶
func HideContent ¶
func HideContent(content string, contype string, hide HideDetector, funcMap map[string]interface{}) (result string)
func MakeEncodedURLOrLink ¶
func MakeKVCallback ¶
func MakeListURL ¶
func MakeValuesURLPath ¶
MakeValuesURLPath 生成带参数值的网址路径
func NewSNCodec ¶
func OutputContent ¶
func ParseDuration ¶
ParseDuration 解析持续时间(在支持标准库time.ParseDuration的基础上增加了年(y)月(mo)周(w)日(d)的支持)
func ParseURLPathKV ¶
ParseURLPathKV 解析网址路径表示的键值数据 /键1/值1/键2/值2
func ParseURLPathValues ¶
ParseURLPathValues 解析网址路径表示的值数据 /值1_值2 通过传入参数keys来指定各个对应位置的key
func PictureWithDefaultHTML ¶
func ReplacePlaceholder ¶
func ReplacePlaceholderx ¶
func ReplacePlaceholderx(t *fasttemplate.Template, values map[string]interface{}, args ...interface{}) string
func ResizeImageURL ¶
ResizeImageURL ResizeImageURL(imageURL,`1000x1240`,`default.jpg`)
func SecretSafeBuilder ¶
SecretSafeBuilder 密钥强化
func StrengthenSafeSecret ¶
StrengthenSafeSecret 强化的安全密钥(包含网络环境)
func TodayTimestamp ¶
func TrimOverflowText ¶
TrimOverflowText 裁剪溢出长度的文本
func TrimOverflowTextSlice ¶
TrimOverflowTextSlice 裁剪溢出长度的文本(textSlice为待join的字符串切片)
Types ¶
type AsPartialMap ¶
type HideDetector ¶
type Pagination ¶
type ResponseData ¶
type ResponseData struct { Code int `json:"Code"` State string `json:"State"` Info interface{} `json:"Info,omitempty" xml:"Info,omitempty" swaggertype:"string"` Zone interface{} `json:"Zone,omitempty" xml:"Zone,omitempty" swaggertype:"string"` URL string `json:"URL,omitempty" xml:"URL,omitempty"` Data interface{} `json:"Data" swaggertype:"object"` }
type ResponseList ¶
type ResponseList struct { List []interface{} `json:"list"` Pagination Pagination `json:"pagination"` }
type Stars ¶
type Stars []VSTAR
func StarsSlice5 ¶
func StarsSlicex ¶
StarsSlicex 将最大分数按照最大星标数量平分生成星标切片
func StarsSlicex5 ¶
Click to show internal directories.
Click to hide internal directories.