Documentation ¶
Index ¶
- Variables
- func DecodeBasicAuthHeader(header string) (string, string, error)
- func Decrypt(payload []byte, secret string) ([]byte, error)
- func EncodePassword(password string, salt string) (string, error)
- func Encrypt(payload []byte, secret string) ([]byte, error)
- func GenerateShortUID() string
- func GetAgeString(t time.Time) string
- func GetBasicAuthHeader(user string, password string) string
- func GetRandomString(n int, alphabets ...byte) (string, error)
- func IsEmail(str string) bool
- func IsValidShortUID(uid string) bool
- func JoinURLFragments(a, b string) string
- func Md5Sum(reader io.Reader) (string, error)
- func Md5SumString(input string) (string, error)
- func MinInt(x, y int) int
- func RandomHex(n int) (string, error)
- func SplitEmails(emails string) []string
- func SplitString(str string) []string
- func StringsFallback2(val1 string, val2 string) string
- func StringsFallback3(val1 string, val2 string, val3 string) string
- func ToCamelCase(str string) string
- func Walk(path string, followSymlinks bool, detectSymlinkInfiniteLoop bool, ...) error
- type DynMap
- type NetworkAddress
- type URLQueryReader
- type WalkFunc
Constants ¶
This section is empty.
Variables ¶
var ErrWalkSkipDir = errors.New("skip this directory")
ErrWalkSkipDir is the Error returned when we want to skip descending into a directory
Functions ¶
func DecodeBasicAuthHeader ¶
DecodeBasicAuthHeader decodes user and password from a basic auth header.
func EncodePassword ¶
EncodePassword encodes a password using PBKDF2.
func GenerateShortUID ¶
func GenerateShortUID() string
GenerateShortUID generates a short unique identifier.
func GetAgeString ¶
GetAgeString returns a string representing certain time from years to minutes.
func GetBasicAuthHeader ¶
GetBasicAuthHeader returns a base64 encoded string from user and password.
func GetRandomString ¶
GetRandomString generate random string by specify chars. source: https://github.com/gogits/gogs/blob/9ee80e3e5426821f03a4e99fad34418f5c736413/modules/base/tool.go#L58
func IsValidShortUID ¶
IsValidShortUID checks if short unique identifier contains valid characters
func JoinURLFragments ¶
JoinURLFragments joins two ApiURL fragments into only one ApiURL string.
func Md5SumString ¶
Md5SumString calculates the md5sum of a string
func SplitEmails ¶
SplitEmails splits addresses with a few different ways
func SplitString ¶
SplitString splits a string by commas or empty spaces.
func StringsFallback2 ¶
StringsFallback2 returns the first of two not empty strings.
func StringsFallback3 ¶
StringsFallback3 returns the first of three not empty strings.
func ToCamelCase ¶
ToCamelCase changes kebab case, snake case or mixed strings to camel case. See unit test for examples.
func Walk ¶
Walk walks a path, optionally following symbolic links, and for each path, it calls the walkFn passed.
It is similar to filepath.Walk, except that it supports symbolic links and can detect infinite loops while following sym links. It solves the issue where your WalkFunc needs a path relative to the symbolic link (resolving links within walkfunc loses the path to the symbolic link for each traversal).
Types ¶
type NetworkAddress ¶
func SplitHostPortDefault ¶
func SplitHostPortDefault(input, defaultHost, defaultPort string) (NetworkAddress, error)
SplitHostPortDefault splits ip address/hostname string by host and port. Defaults used if no match found
type URLQueryReader ¶
type URLQueryReader struct {
// contains filtered or unexported fields
}
URLQueryReader is a ApiURL query type.
func NewURLQueryReader ¶
func NewURLQueryReader(urlInfo *url.URL) (*URLQueryReader, error)
NewURLQueryReader parses a raw query and returns it as a URLQueryReader type.