Documentation ¶
Index ¶
- Constants
- func AvatarLink(email string) string
- func BasicAuthDecode(encoded string) (string, string, error)
- func BasicAuthEncode(username, password string) string
- func CreateTimeLimitCode(data string, minutes int, startInf interface{}) string
- func DetectEncoding(content []byte) (string, error)
- func EllipsisString(str string, length int) string
- func EncodeMD5(str string) string
- func EncodeSha1(str string) string
- func FileSize(s int64) string
- func GetRandomString(n int, alphabets ...byte) string
- func HashEmail(email string) string
- func Int64sToMap(ints []int64) map[int64]bool
- func Int64sToStrings(ints []int64) []string
- func IsImageFile(data []byte) (string, bool)
- func IsLetter(ch rune) bool
- func IsTextFile(data []byte) (string, bool)
- func PBKDF2(password, salt []byte, iter, keyLen int, h func() hash.Hash) []byte
- func RawTimeSince(t time.Time, lang string) string
- func ShortSha(sha1 string) string
- func StringsToInt64s(strs []string) []int64
- func Subtract(left interface{}, right interface{}) interface{}
- func TimeSince(t time.Time, lang string) template.HTML
- func TimeSincePro(then time.Time) string
- func TruncateString(str string, limit int) string
- func VerifyTimeLimitCode(data string, minutes int, code string) bool
- type TplName
Constants ¶
const ( Minute = 60 Hour = 60 * Minute Day = 24 * Hour Week = 7 * Day Month = 30 * Day Year = 12 * Month )
Seconds-based time units
const ( Byte = 1 KByte = Byte * 1024 MByte = KByte * 1024 GByte = MByte * 1024 TByte = GByte * 1024 PByte = TByte * 1024 EByte = PByte * 1024 )
const DOC_URL = "https://github.com/gogits/go-gogs-client/wiki"
const TimeLimitCodeLength = 12 + 6 + 40
Variables ¶
This section is empty.
Functions ¶
func AvatarLink ¶
AvatarLink returns avatar link by given email.
func BasicAuthEncode ¶ added in v0.5.8
func CreateTimeLimitCode ¶
create a time limit code code format: 12 length date time string + 6 minutes string + 40 sha1 encoded string
func DetectEncoding ¶ added in v0.5.9
func EllipsisString ¶ added in v0.8.25
EllipsisString returns a truncated short string, it appends '...' in the end of the length of string is too large.
func EncodeSha1 ¶ added in v0.5.8
Encode string to sha1 hex value.
func GetRandomString ¶
GetRandomString generate random string by specify chars.
func HashEmail ¶ added in v0.8.43
HashEmail hashes email address to MD5 string. https://en.gravatar.com/site/implement/hash/
func Int64sToMap ¶ added in v0.6.5
Int64sToMap converts a slice of int64 to a int64 map.
func Int64sToStrings ¶ added in v0.6.9
Int64sToStrings converts a slice of int64 to a slice of string.
func IsImageFile ¶
func IsLetter ¶ added in v0.8.43
IsLetter reports whether the rune is a letter (category L). https://github.com/golang/go/blob/master/src/go/scanner/scanner.go#L257
func IsTextFile ¶
func PBKDF2 ¶ added in v0.3.0
http://code.google.com/p/go/source/browse/pbkdf2/pbkdf2.go?repo=crypto
func StringsToInt64s ¶ added in v0.6.5
StringsToInt64s converts a slice of string to a slice of int64.
func Subtract ¶
func Subtract(left interface{}, right interface{}) interface{}
Subtract deals with subtraction of all types of number.
func TimeSincePro ¶
TimeSincePro calculates the time interval and generate full user-friendly string.
func TruncateString ¶ added in v0.9.0
TruncateString returns a truncated string with given limit, it returns input string if length is not reached limit.