{"modulePath":"github.com/devsisters/gogs","version":"v0.8.25","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package base\n\n## Constants\n\n```go\nconst (\n\tMinute = 60\n\tHour   = 60 * Minute\n\tDay    = 24 * Hour\n\tWeek   = 7 * Day\n\tMonth  = 30 * Day\n\tYear   = 12 * Month\n)\n```\nSeconds-based time units\n\n```go\nconst (\n\tByte  = 1\n\tKByte = Byte * 1024\n\tMByte = KByte * 1024\n\tGByte = MByte * 1024\n\tTByte = GByte * 1024\n\tPByte = TByte * 1024\n\tEByte = PByte * 1024\n)\n```\n\n```go\nconst DOC_URL = \"https://github.com/gogits/go-gogs-client/wiki\"\n```\n\n```go\nconst TimeLimitCodeLength = 12 + 6 + 40\n```\n\n## Variables\n\n```go\nvar GoGetMetas = make(map[string]bool)\n```\n\n```go\nvar (\n\tMentionPattern = regexp.MustCompile(`(\\s|^)@[0-9a-zA-Z_\\.]+`)\n)\n```\n\n```go\nvar Sanitizer = BuildSanitizer()\n```\n\n## Functions\n\n```go\nfunc AvatarLink(email string) string\n```\nAvatarLink returns avatar link by given e-mail.\n\n```go\nfunc BasicAuthDecode(encoded string) (string, string, error)\n```\n\n```go\nfunc BasicAuthEncode(username, password string) string\n```\n\n```go\nfunc BuildSanitizer() (p *bluemonday.Policy)\n```\n\n```go\nfunc CreateTimeLimitCode(data string, minutes int, startInf interface{}) string\n```\ncreate a time limit code code format: 12 length date time string + 6 minutes string + 40 sha1 encoded string\n\n```go\nfunc DetectEncoding(content []byte) (string, error)\n```\n\n```go\nfunc EllipsisString(str string, length int) string\n```\nEllipsisString returns a truncated short string, it appends '...' in the end of the length of string is too large.\n\n```go\nfunc EncodeMD5(str string) string\n```\nEncodeMD5 encodes string to md5 hex value.\n\n```go\nfunc EncodeSha1(str string) string\n```\nEncode string to sha1 hex value.\n\n```go\nfunc ExecPath() (string, error)\n```\nExecPath returns the executable path.\n\n```go\nfunc FileSize(s int64) string\n```\nFileSize calculates the file size and generate user-friendly string.\n\n```go\nfunc GetRandomString(n int, alphabets ...byte) string\n```\nGetRandomString generate random string by specify chars.\n\n```go\nfunc Int64sToMap(ints []int64) map[int64]bool\n```\nInt64sToMap converts a slice of int64 to a int64 map.\n\n```go\nfunc Int64sToStrings(ints []int64) []string\n```\nInt64sToStrings converts a slice of int64 to a slice of string.\n\n```go\nfunc IsImageFile(data []byte) (string, bool)\n```\n\n```go\nfunc IsMarkdownFile(name string) bool\n```\n\n```go\nfunc IsReadmeFile(name string) bool\n```\nIsReadmeFile returns true if given file name suppose to be a README file.\n\n```go\nfunc IsTextFile(data []byte) (string, bool)\n```\n\n```go\nfunc PBKDF2(password, salt []byte, iter, keyLen int, h func() hash.Hash) []byte\n```\n[http://code.google.com/p/go/source/browse/pbkdf2/pbkdf2.go?repo=crypto](http://code.google.com/p/go/source/browse/pbkdf2/pbkdf2.go?repo=crypto)\n\n```go\nfunc PostProcessMarkdown(rawHtml []byte, urlPrefix string, metas map[string]string) []byte\n```\nPostProcessMarkdown treats different types of HTML differently, and only renders special links for plain text blocks.\n\n```go\nfunc RawTimeSince(t time.Time, lang string) string\n```\n\n```go\nfunc RenderIssueIndexPattern(rawBytes []byte, urlPrefix string, metas map[string]string) []byte\n```\n\n```go\nfunc RenderMarkdown(rawBytes []byte, urlPrefix string, metas map[string]string) []byte\n```\n\n```go\nfunc RenderMarkdownString(raw, urlPrefix string, metas map[string]string) string\n```\n\n```go\nfunc RenderRawMarkdown(body []byte, urlPrefix string) []byte\n```\n\n```go\nfunc RenderSha1CurrentPattern(rawBytes []byte, urlPrefix string) []byte\n```\n\n```go\nfunc RenderSpecialLink(rawBytes []byte, urlPrefix string, metas map[string]string) []byte\n```\n\n```go\nfunc ShortSha(sha1 string) string\n```\n\n```go\nfunc StringsToInt64s(strs []string) []int64\n```\nStringsToInt64s converts a slice of string to a slice of int64.\n\n```go\nfunc Subtract(left interface{}, right interface{}) interface{}\n```\nSubtract deals with subtraction of all types of number.\n\n```go\nfunc TimeSince(t time.Time, lang string) template.HTML\n```\nTimeSince calculates the time interval and generate user-friendly string.\n\n```go\nfunc TimeSincePro(then time.Time) string\n```\nTimeSincePro calculates the time interval and generate full user-friendly string.\n\n```go\nfunc VerifyTimeLimitCode(data string, minutes int, code string) bool\n```\nverify time limit code\n\n## Types\n\n```go\ntype CustomRender struct {\n\tblackfriday.Renderer\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (r *CustomRender) AutoLink(out *bytes.Buffer, link []byte, kind int)\n```\n\n```go\nfunc (r *CustomRender) Image(out *bytes.Buffer, link []byte, title []byte, alt []byte)\n```\n\n```go\nfunc (r *CustomRender) Link(out *bytes.Buffer, link []byte, title []byte, content []byte)\n```\n\n```go\nfunc (options *CustomRender) ListItem(out *bytes.Buffer, text []byte, flags int)\n```\n\n```go\ntype TplName string\n```\n\n","path":"github.com/devsisters/gogs/modules/base","name":"base","synopsis":"","isRedistributable":true}
