Documentation ¶
Index ¶
- Constants
- func BasicAuthDecode(encoded string) (string, string, error)
- func BasicAuthEncode(username, password string) string
- func CreateTimeLimitCode(data string, minutes int, startInf interface{}) string
- func DetectContentType(data []byte) string
- func EllipsisString(str string, length int) string
- func EncodeMD5(str string) string
- func EncodeSha1(str string) string
- func EncodeSha256(str string) string
- func EntryIcon(entry *git.TreeEntry) string
- func FileSize(s int64) string
- func FormatNumberSI(data interface{}) string
- func Int64sContains(intsSlice []int64, a int64) bool
- func Int64sToMap(ints []int64) map[int64]bool
- func Int64sToStrings(ints []int64) []string
- func IsAudioFile(data []byte) bool
- func IsImageFile(data []byte) bool
- func IsLetter(ch rune) bool
- func IsPDFFile(data []byte) bool
- func IsRepresentableAsText(data []byte) bool
- func IsSVGImageFile(data []byte) bool
- func IsTextFile(data []byte) bool
- func IsVideoFile(data []byte) bool
- func NaturalSortLess(s1, s2 string) bool
- func PrettyNumber(v int64) string
- func SetupGiteaRoot() string
- func ShortSha(sha1 string) string
- func StringsToInt64s(strs []string) ([]int64, error)
- func Subtract(left interface{}, right interface{}) interface{}
- func TruncateString(str string, limit int) string
- func VerifyTimeLimitCode(data string, minutes int, code string) bool
- type TplName
Constants ¶
const SVGMimeType = "image/svg+xml"
SVGMimeType MIME type of SVG images.
const TimeLimitCodeLength = 12 + 6 + 40
TimeLimitCodeLength default value for time limit code
Variables ¶
This section is empty.
Functions ¶
func BasicAuthDecode ¶
BasicAuthDecode decode basic auth string
func BasicAuthEncode ¶
BasicAuthEncode encode basic auth string
func CreateTimeLimitCode ¶
CreateTimeLimitCode create a time limit code code format: 12 length date time string + 6 minutes string + 40 sha1 encoded string
func DetectContentType ¶ added in v1.14.0
DetectContentType extends http.DetectContentType with more content types.
func EllipsisString ¶
EllipsisString returns a truncated short string, it appends '...' in the end of the length of string is too large.
func EncodeSha256 ¶ added in v1.9.0
EncodeSha256 string to sha1 hex value.
func EntryIcon ¶ added in v1.5.0
EntryIcon returns the octicon class for displaying files/directories
func FormatNumberSI ¶ added in v1.13.0
func FormatNumberSI(data interface{}) string
FormatNumberSI format a number
func Int64sContains ¶ added in v1.3.0
Int64sContains returns if a int64 in a slice of int64
func Int64sToMap ¶
Int64sToMap converts a slice of int64 to a int64 map.
func Int64sToStrings ¶
Int64sToStrings converts a slice of int64 to a slice of string.
func IsAudioFile ¶ added in v1.7.0
IsAudioFile detects if data is an video format
func IsImageFile ¶
IsImageFile detects if data is an image format
func IsLetter ¶
IsLetter reports whether the rune is a letter (category L). https://github.com/golang/go/blob/c3b4918/src/go/scanner/scanner.go#L342
func IsRepresentableAsText ¶ added in v1.14.0
IsRepresentableAsText returns true if file content can be represented as plain text or is empty.
func IsSVGImageFile ¶ added in v1.14.0
IsSVGImageFile detects if data is an SVG image format
func IsTextFile ¶
IsTextFile returns true if file content format is plain text or empty.
func IsVideoFile ¶ added in v1.0.0
IsVideoFile detects if data is an video format
func NaturalSortLess ¶ added in v1.3.0
NaturalSortLess compares two strings so that they could be sorted in natural order
func PrettyNumber ¶ added in v1.12.0
PrettyNumber produces a string form of the given number in base 10 with commas after every three orders of magnitud
func SetupGiteaRoot ¶ added in v1.9.0
func SetupGiteaRoot() string
SetupGiteaRoot Sets GITEA_ROOT if it is not already set and returns the value
func ShortSha ¶
ShortSha is basically just truncating. It is DEPRECATED and will be removed in the future.
func StringsToInt64s ¶
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 TruncateString ¶
TruncateString returns a truncated string with given limit, it returns input string if length is not reached limit.