infrastructure

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2017 License: MIT Imports: 19 Imported by: 15

Documentation

Index

Constants

View Source
const (
	Minute = 60
	Hour   = 60 * Minute
	Day    = 24 * Hour
	Week   = 7 * Day
	Month  = 30 * Day
	Year   = 12 * Month
)
View Source
const (
	Byte  = 1
	KByte = Byte * 1024
	MByte = KByte * 1024
	GByte = MByte * 1024
	TByte = GByte * 1024
	PByte = TByte * 1024
	EByte = PByte * 1024
)
View Source
const TimeLimitCodeLength = 12 + 6 + 40

Variables

This section is empty.

Functions

func BasicAuthDecode

func BasicAuthDecode(encoded string) (string, string, error)

func BasicAuthEncode

func BasicAuthEncode(username, password string) string

func Compress

func Compress(infolder string, files []string, dest string) error

func CopyDirFiles

func CopyDirFiles(src, dest string) error

func CreateTimeLimitCode

func CreateTimeLimitCode(data string, minutes int, startInf interface{}) string

func DateFormat

func DateFormat(t time.Time, format string) string

Date takes a PHP like date func to Go's time format.

func DateParse

func DateParse(dateString, format string) (time.Time, error)

Parse Date use PHP time format.

func DeCompress

func DeCompress(zipFile, dest string) error

func EncodeMd5

func EncodeMd5(str string) string

func EncodeSHA256

func EncodeSHA256(str string) string

func FileExist

func FileExist(filename string) bool

func FileMd5

func FileMd5(path string) (string, error)

func FileSHA256

func FileSHA256(path string) (string, error)

func FileSize

func FileSize(s int64) string

func GetRandomString

func GetRandomString(n int, alphabets ...byte) string

func InitInfrastructure

func InitInfrastructure(tempPrefix, encodeSecKey, timeFormat string)

func SaveFileToTemp

func SaveFileToTemp(fileName string, packageFile io.Reader) (string, error)

func Subtract

func Subtract(left interface{}, right interface{}) interface{}

func TimeSince

func TimeSince(t time.Time) template.HTML

func TimeSincePro

func TimeSincePro(then time.Time) string

func VerifyEmail

func VerifyEmail(email string) bool

func VerifyTimeLimitCode

func VerifyTimeLimitCode(data string, minutes int, code string) bool

Types

type ApiJsonError

type ApiJsonError struct {
	Message string `json:"message"`
	Status  int    `json:"status"`
}

type IntentError

type IntentError struct {
	Status int
	Code   int
	// contains filtered or unexported fields
}

func MakeIntentError

func MakeIntentError(err interface{}, code ...int) *IntentError

func (*IntentError) Error

func (self *IntentError) Error() string

type TplName

type TplName string

Jump to

Keyboard shortcuts

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