helper

package
v0.0.0-...-a9e9222 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Wrapper for the Gravatar API.

See: http://en.gravatar.com/site/implement/

Index

Constants

View Source
const (
	HTTP404    = "404"       // do not load any image if none is associated with the email hash, instead return an HTTP 404 (File Not Found) response
	MysteryMan = "mm"        // (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)
	IdentIcon  = "identicon" // a geometric pattern based on an email hash
	MonsterID  = "monsterid" // a generated 'monster' with different colors, faces, etc
	Wavatar    = "wavatar"   // generated faces with differing features and backgrounds
	Retro      = "retro"     // awesome generated, 8-bit arcade-style pixelated faces
)

Default images (used as defaultURL)

View Source
const (
	JKFormatString = "2006-01-02-15:04:05"

	JKFormatNormalNoSec = "2006-01-02 15:04"
)

Variables

View Source
var Month = map[string]string{
	"Jan": "01",
	"Feb": "02",
	"Mar": "03",
	"Apr": "04",
	"May": "05",
	"Jun": "06",
	"Jul": "07",
	"Aug": "08",
	"Sep": "09",
	"Oct": "10",
	"Nov": "11",
	"Dec": "12",
}

Functions

func Available

func Available(email string) (ok bool, err error)

func ConvertStringToUnixTime

func ConvertStringToUnixTime(tm string) (int64, error)

func ConvertStringToUnixTimeFormat1

func ConvertStringToUnixTimeFormat1(tm string) (int64, error)

func FilterHtmlTag

func FilterHtmlTag(filter_tag, html string) string

func FormUnixTimeToString

func FormUnixTimeToString(t int64) string

func FormUnixTimeToStringDate

func FormUnixTimeToStringDate(t int64) string

func FormatStringToUnix

func FormatStringToUnix(tm, format string) (int64, error)

func FormatStringToUnixLogDevice

func FormatStringToUnixLogDevice(tm string) (int64, error)

func Hash

func Hash(email string) string

func IsDirExists

func IsDirExists(path string) bool

func LogDeviceFormatStringToUnixMS

func LogDeviceFormatStringToUnixMS(tm string) (int64, error)

xxxx.ms

func LogDeviceTimeConv

func LogDeviceTimeConv(origin string) (after string)

func LogDeviceUnixTimeToString

func LogDeviceUnixTimeToString(t int64) string

t contains ms (3 numbers)

func LogDeviceUnixTimeToStringNormal

func LogDeviceUnixTimeToStringNormal(t int64) string

func MkdirNotExist

func MkdirNotExist(path string) error

func SecureUrl

func SecureUrl(email string) string

func SecureUrlDefault

func SecureUrlDefault(email, defaultURL string) string

func SecureUrlSize

func SecureUrlSize(email string, size int) string

func SecureUrlSizeDefault

func SecureUrlSizeDefault(email string, size int, defaultURL string) string

func Time1972TimeStamp

func Time1972TimeStamp() int64

func TimeConv

func TimeConv(origin string) (after string)

convert from "Fri Aug 10 09:40:40 +0800 2012" to "2012.8.10 09:40"

func TimeConvertBenewServer

func TimeConvertBenewServer(origin string) (after string, ms int)

2019-09-11T20:06:07.717Z

func UnxiToFormatString

func UnxiToFormatString(t int64, format string) string

func Url

func Url(email string) string

func UrlDefault

func UrlDefault(email, defaultURL string) string

func UrlSize

func UrlSize(email string, size int) string

You may request images anywhere from 1px up to 512px

func UrlSizeDefault

func UrlSizeDefault(email string, size int, defaultURL string) string

Types

type Mongo

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

func NewMongo

func NewMongo(mgoDns string) *Mongo

func (*Mongo) C

func (m *Mongo) C(col TM) *mgo.Collection

func (*Mongo) Close

func (m *Mongo) Close()

func (*Mongo) Cnew

func (m *Mongo) Cnew(dbname string, cname string) *mgo.Collection

get collections

func (*Mongo) DB

func (m *Mongo) DB(dbname string) *mgo.Database

get databse

func (*Mongo) DBSession

func (m *Mongo) DBSession() *mgo.Session

func (*Mongo) DbName

func (m *Mongo) DbName() string

get database name

type TM

type TM map[string]interface{}

Jump to

Keyboard shortcuts

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