util

package
v0.0.0-...-e9e0146 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2020 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AvatarResize

func AvatarResize(srcImg image.Image, w, h int, filePath string) error

func CheckImageType

func CheckImageType(buff []byte) string

func CheckTags

func CheckTags(tags string) string

func ContentFmt

func ContentFmt(db *youdb.DB, input string) string

文本格式化

func ContentRich

func ContentRich(db *youdb.DB, input string) string

func FetchAvatar

func FetchAvatar(url, save, ua string) error

func GenerateAvatar

func GenerateAvatar(sex, userName string, w, h int, filePath string) error

func GetImageObj

func GetImageObj(buff *bytes.Buffer) (image.Image, error)

func GetImageObj2

func GetImageObj2(buff *bytes.Buffer) (image.Image, error)

func GetMention

func GetMention(input string, notInclude []string) []string

func HashFileMD5

func HashFileMD5(filePath string) (string, error)

func ImageResize

func ImageResize(srcImg image.Image, w, h int) *image.NRGBA

func IsMail

func IsMail(str string) bool

func IsNickname

func IsNickname(str string) bool

func IsUserName

func IsUserName(str string) bool

func RemoveCharacter

func RemoveCharacter(str string) string

func SliceUniqInt

func SliceUniqInt(s []int) []int

func SliceUniqStr

func SliceUniqStr(s []string) []string

func TimeFmt

func TimeFmt(tp interface{}, sample string, tz int) string

func TimeHuman

func TimeHuman(ts interface{}) string

Types

type Message

type Message struct {
	To      []string
	From    string
	Subject string
	Body    string
	User    string
	Type    string
	Massive bool
	Info    string
}

func NewHTMLMessage

func NewHTMLMessage(To []string, From, Subject, Body string) Message

NewHTMLMessage Create html mail message

func (Message) Content

func (m Message) Content() string

Content create mail content

type SmtpSendMail

type SmtpSendMail struct {
	MailHost     string
	MailAuthUser string
	MailAuthPass string
}

func (*SmtpSendMail) AsyncSendMail

func (s *SmtpSendMail) AsyncSendMail(msg Message)

AsyncSendMail Async Send mail message

func (*SmtpSendMail) SendMail

func (s *SmtpSendMail) SendMail(msg Message) (int, error)

SendMail Direct Send mail message

Jump to

Keyboard shortcuts

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