common

package
v0.0.0-...-b5cb8fc Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Standard length of uniuri string to achive ~95 bits of entropy.
	StdLen = 16
	// Length of uniurl string to achive ~119 bits of entropy, closest
	// to what can be losslessly converted to UUIDv4 (122 bits).
	UUIDLen = 20
)

Variables

View Source
var StdChars = []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")

Standard characters allowed in uniuri string.

Functions

func DateFormat

func DateFormat(tm int64) string

func GetId

func GetId(id bson.ObjectId) string

获取Id

func GetSlug

func GetSlug(str string, isslug bool) string

自动获取slug

func GetTagSlug

func GetTagSlug(caption string) string

获取Tag列表

func Gravatar

func Gravatar(email string, size int) string

生成Gravatar头像URL

func LoadTimes

func LoadTimes(startTime time.Time) string

获取运行时间

func New

func New() string

New returns a new random string of the standard length, consisting of standard characters.

func NewLen

func NewLen(length int) string

NewLen returns a new random string of the provided length, consisting of standard characters.

func NewLenChars

func NewLenChars(length int, chars []byte) string

NewLenChars returns a new random string of the provided length, consisting of the provided byte slice of allowed characters (maximum 256).

func Preview

func Preview(str string, length int) string

获取预览内容

func ToSize

func ToSize(size uint64) string

转换字节为对应大小

Types

type Image

type Image struct {
	*image.NRGBA
	// contains filtered or unexported fields
}

func NewImage

func NewImage(digits []byte, width, height int) *Image

func (*Image) WriteTo

func (img *Image) WriteTo(w io.Writer) (int64, error)

Jump to

Keyboard shortcuts

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