util

package
v0.0.0-...-0248c43 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertMapHas

func AssertMapHas(m map[string]interface{}, key string) string

func BuildFileDir

func BuildFileDir(dir string, name string) string

func CleanupMapValue

func CleanupMapValue(v interface{}) interface{}

func CleanupStringMap

func CleanupStringMap(in map[string]interface{}) map[string]interface{}

func GetMapInt

func GetMapInt(m map[string]interface{}, key string, defaultValue int64) int64

func GetMapString

func GetMapString(m map[string]interface{}, key string, defaultValue string) string

func GetMapStringSlice

func GetMapStringSlice(m map[string]interface{}, key string, defaultValue []string) []string

func MergeMap

func MergeMap(master, follow map[string]interface{}) map[string]interface{}

MergeMap 融合两个map

func MergeNewMap

func MergeNewMap(master, follow map[string]interface{}) map[string]interface{}

MergeNewMap 融合两个map,返回一个新map

func QueryToJSON

func QueryToJSON(query interface{}) ([]byte, error)

QueryToJSON 转化query为json byte[]

func ToBuffer

func ToBuffer(i interface{}) *bytes.Buffer

ToBuffer 转换一个对象为byte[]

Types

type Mail

type Mail struct {
	Host, Port, Username, Password, From, ReplyTo string
}

Mail 邮件实体

func (Mail) Send

func (mail Mail) Send(to []string, subject string, msg []byte) error

Send 发送邮件 # BUG

  • 某些不确定情况下可能导致该函数阻塞,等待不确定的一段时间(可能很长,可能一会儿以后)报EOF错误, 跟断点猜测重要应该时golang源码没有超时机制和相关smtp服务器服务器有些问题(telnet客服端模拟也会出现发送HELO没有回复的情况)

Jump to

Keyboard shortcuts

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