utils

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DateInt64

func DateInt64(ti int64, format string) string

Format unix time int64 to string

func DateString

func DateString(ts string, format string) string

Format unix time string to string

func DateTime

func DateTime(t time.Time, format string) string

Format time.Time struct to string MM - month - 01 M - month - 1, single bit DD - day - 02 D - day 2 YYYY - year - 2006 YY - year - 06 HH - 24 hours - 03 H - 24 hours - 3 hh - 12 hours - 03 h - 12 hours - 3 mm - minute - 04 m - minute - 4 ss - second - 05 s - second = 5

func FileSize

func FileSize(size int64) string

func Gravatar

func Gravatar(email string, size string) string

generate gravatar link by email.

func Html2str

func Html2str(html string) string

func IsASCII

func IsASCII(str string) bool

func IsContain

func IsContain(str string, contain string) bool

func IsDir added in v0.1.5

func IsDir(path string) bool

func IsEmail

func IsEmail(str string) bool

func IsEmptyString

func IsEmptyString(str string) bool

func IsEnglish

func IsEnglish(str string) bool

func IsFile added in v0.1.5

func IsFile(path string) bool

func IsLonger

func IsLonger(str string, length int) bool

func IsShorter

func IsShorter(str string, length int) bool

func IsURL

func IsURL(str string) bool

func Markdown2Html added in v0.1.5

func Markdown2Html(text string) string

func Markdown2HtmlTemplate added in v0.1.5

func Markdown2HtmlTemplate(text string) template.HTML

func Now

func Now() int64

Get unix stamp int64 of now

func Sha1

func Sha1(raw string) string

func SortInt added in v0.2.5

func SortInt(s [][2]int)

Sort [][2]int by the second element of [2].

Types

type Pager

type Pager struct {
	Current   int
	Size      int
	Total     int
	Pages     int
	PageSlice []int
	Begin     int
	End       int
	Prev      int
	Next      int
	IsPrev    bool
	IsNext    bool
}

func NewPager

func NewPager(page, size, total int) *Pager

Jump to

Keyboard shortcuts

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