util

package
v4.6.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2017 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WalkSkipDir = errors.New("skip this directory")

WalkSkipDir is the Error returned when we want to skip descending into a directory

Functions

func DecodeBasicAuthHeader

func DecodeBasicAuthHeader(header string) (string, string, error)

func Decrypt

func Decrypt(payload []byte, secret string) ([]byte, error)

func EncodeMd5

func EncodeMd5(str string) string

Encode string to md5 hex value.

func EncodePassword

func EncodePassword(password string, salt string) string

func Encrypt

func Encrypt(payload []byte, secret string) ([]byte, error)

func GetAgeString

func GetAgeString(t time.Time) string

func GetBasicAuthHeader

func GetBasicAuthHeader(user string, password string) string

func IsEmail

func IsEmail(str string) bool

func JoinUrlFragments

func JoinUrlFragments(a, b string) string

func PBKDF2

func PBKDF2(password, salt []byte, iter, keyLen int, h func() hash.Hash) []byte

http://code.google.com/p/go/source/browse/pbkdf2/pbkdf2.go?repo=crypto

func SplitString

func SplitString(str string) []string

func StringsFallback2

func StringsFallback2(val1 string, val2 string) string

func StringsFallback3

func StringsFallback3(val1 string, val2 string, val3 string) string

func Walk

func Walk(path string, followSymlinks bool, detectSymlinkInfiniteLoop bool, walkFn WalkFunc) error

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 DynMap

type DynMap map[string]interface{}

type UrlQueryReader

type UrlQueryReader struct {
	// contains filtered or unexported fields
}

func NewUrlQueryReader

func NewUrlQueryReader(url *url.URL) *UrlQueryReader

func (*UrlQueryReader) Get

func (r *UrlQueryReader) Get(name string, def string) string

type WalkFunc

type WalkFunc func(resolvedPath string, info os.FileInfo, err error) error

WalkFunc is a callback function called for each path as a directory is walked If resolvedPath != "", then we are following symbolic links.

Jump to

Keyboard shortcuts

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