Documentation ¶
Index ¶
- func Bytes2String(b []byte) string
- func CamelString(s string) string
- func Display(data ...interface{})
- func FileExists(name string) bool
- func GetDisplayString(data ...interface{}) string
- func GetFuncName(i interface{}) string
- func GrepFile(patten string, filename string) (lines []string, err error)
- func HashString(encode string) uint64
- func InSlice(v string, sl []string) bool
- func InSliceIface(v interface{}, sl []interface{}) bool
- func MakeHash(s string) string
- func MakeMd5(obj interface{}, length ...int) string
- func MakeUnique(obj interface{}) string
- func NewObjectPtr(i interface{}) interface{}
- func ObjectName(i interface{}) string
- func PrintPointerInfo(buf *bytes.Buffer, headlen int, pointers *pointerInfo)
- func RandomCreateBytes(n int, alphabets ...byte) []byte
- func RelPath(targpath string) string
- func SearchFile(filename string, paths ...string) (fullpath string, err error)
- func SelfChdir()
- func SelfDir() string
- func SelfPath() string
- func SliceChunk(slice []interface{}, size int) (chunkslice [][]interface{})
- func SliceDiff(slice1, slice2 []interface{}) (diffslice []interface{})
- func SliceFilter(slice []interface{}, a filtertype) (ftslice []interface{})
- func SliceIntersect(slice1, slice2 []interface{}) (diffslice []interface{})
- func SliceMerge(slice1, slice2 []interface{}) (c []interface{})
- func SlicePad(slice []interface{}, size int, val interface{}) []interface{}
- func SliceRand(a []interface{}) (b interface{})
- func SliceRandList(min, max int) []int
- func SliceRange(start, end, step int64) (intslice []int64)
- func SliceReduce(slice []interface{}, a reducetype) (dslice []interface{})
- func SliceShuffle(slice []interface{}) []interface{}
- func SliceSum(intslice []int64) (sum int64)
- func SliceUnique(slice []interface{}) (uniqueslice []interface{})
- func SnakeString(s string) string
- func Stack(skip int, indent string) []byte
- func String2Bytes(s string) []byte
- func WalkDirs(targpath string, suffixes ...string) (dirlist []string)
- type Attachment
- type BeeMap
- type Email
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bytes2String ¶ added in v0.7.0
Bytes2String直接转换底层指针,两者指向的相同的内存,改一个另外一个也会变。 效率是string([]byte{})的百倍以上,且转换量越大效率优势越明显。
func FileExists ¶
FileExists reports whether the named file or directory exists.
func GetDisplayString ¶
func GetDisplayString(data ...interface{}) string
GetDisplayString return data print string
func GrepFile ¶
GrepFile like command grep -E for example: GrepFile(`^hello`, "hello.txt") \n is striped while read
func HashString ¶
func InSliceIface ¶
func InSliceIface(v interface{}, sl []interface{}) bool
InSliceIface checks given interface in interface slice.
func PrintPointerInfo ¶
PrintPointerInfo dump pointer value
func RandomCreateBytes ¶
RandomCreateBytes generate random []byte by specify chars.
func SearchFile ¶
SearchFile Search a file in paths. this is often used in search config file in /etc ~/
func SliceChunk ¶
func SliceChunk(slice []interface{}, size int) (chunkslice [][]interface{})
SliceChunk separates one slice to some sized slice.
func SliceDiff ¶
func SliceDiff(slice1, slice2 []interface{}) (diffslice []interface{})
SliceDiff returns diff slice of slice1 - slice2.
func SliceFilter ¶
func SliceFilter(slice []interface{}, a filtertype) (ftslice []interface{})
SliceFilter generates a new slice after filter function.
func SliceIntersect ¶
func SliceIntersect(slice1, slice2 []interface{}) (diffslice []interface{})
SliceIntersect returns slice that are present in all the slice1 and slice2.
func SliceMerge ¶
func SliceMerge(slice1, slice2 []interface{}) (c []interface{})
SliceMerge merges interface slices to one slice.
func SlicePad ¶
func SlicePad(slice []interface{}, size int, val interface{}) []interface{}
SlicePad prepends size number of val into slice.
func SliceRand ¶
func SliceRand(a []interface{}) (b interface{})
SliceRand returns random one from slice.
func SliceRandList ¶
SliceRandList generate an int slice from min to max.
func SliceRange ¶
SliceRange generates a new slice from begin to end with step duration of int64 number.
func SliceReduce ¶
func SliceReduce(slice []interface{}, a reducetype) (dslice []interface{})
SliceReduce generates a new slice after parsing every value by reduce function
func SliceShuffle ¶
func SliceShuffle(slice []interface{}) []interface{}
SliceShuffle shuffles a slice.
func SliceUnique ¶
func SliceUnique(slice []interface{}) (uniqueslice []interface{})
SliceUnique cleans repeated values in slice.
func String2Bytes ¶ added in v0.7.0
String2Bytes直接转换底层指针,两者指向的相同的内存,改一个另外一个也会变。 效率是string([]byte{})的百倍以上,且转换量越大效率优势越明显。 转换之后若没做其他操作直接改变里面的字符,则程序会崩溃。 如 b:=String2bytes("xxx"); b[1]='d'; 程序将panic。
Types ¶
type Attachment ¶
type Attachment struct { Filename string Header textproto.MIMEHeader Content []byte }
Attachment is a struct representing an email attachment. Based on the mime/multipart.FileHeader struct, Attachment contains the name, MIMEHeader, and content of the attachment in question
type BeeMap ¶
type BeeMap struct {
// contains filtered or unexported fields
}
BeeMap is a map with lock
func (*BeeMap) Get ¶
func (m *BeeMap) Get(k interface{}) interface{}
Get from maps return the k's value
type Email ¶
type Email struct { Auth smtp.Auth Identity string `json:"identity"` Username string `json:"username"` Password string `json:"password"` Host string `json:"host"` Port int `json:"port"` From string `json:"from"` To []string Bcc []string Cc []string Subject string Text string // Plaintext message (optional) HTML string // Html message (optional) Headers textproto.MIMEHeader Attachments []*Attachment ReadReceipt []string }
Email is the type used for email messages
func NewEMail ¶
NewEMail create new Email struct with config json. config json is followed from Email struct fields.
func (*Email) Attach ¶
Attach is used to attach content from an io.Reader to the email. Parameters include an io.Reader, the desired filename for the attachment, and the Content-Type.
func (*Email) AttachFile ¶
func (e *Email) AttachFile(args ...string) (a *Attachment, err error)
AttachFile Add attach file to the send mail