utils

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2017 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DATE_FORMAT = "2006-01-02 15:04:05"

Functions

func ComputeMd5

func ComputeMd5(filePath string) (string, error)

ComputeMd5 returns the md5sum of a file http://dev.pawelsz.eu/2014/11/google-golang-compute-md5-of-file.html

func CopyFile

func CopyFile(src, dst string) (err error)

CopyFile copies a file from src to dst. If src and dst files exist, and are the same, then return success. Otherise, attempt to create a hard link between the two files. If that fail, copy the file contents from src to dst.

func CreateBolUser

func CreateBolUser(username string, password string, server string) (string, error)

CreateBolUser creates the specified user on the specified server

func DecryptFromFile

func DecryptFromFile(password string, filename string) ([]byte, error)

func EncryptToFile

func EncryptToFile(toEncrypt []byte, password string, filename string) error

func Exists

func Exists(path string) bool

Exists returns whether the given file or directory exists or not from http://stackoverflow.com/questions/10510691/how-to-check-whether-a-file-or-directory-denoted-by-a-path-exists-in-golang

func FormatDate

func FormatDate(date time.Time) string

func GetCurrentDate

func GetCurrentDate() string

func GetPassword

func GetPassword(passwordType string) string

func GetRandomMD5Hash

func GetRandomMD5Hash() string

GetRandomMD5Hash returns 8 bytes of a random md5 hash

func GetUnixTimestamp

func GetUnixTimestamp() string

func HashAndHex

func HashAndHex(s string) string

func ParseDate

func ParseDate(date string) (time.Time, error)

func RandStringBytesMaskImprSrc

func RandStringBytesMaskImprSrc(n int) string

stole this from stack overflow.

func ReFormatDate

func ReFormatDate(date string) string

func Shred

func Shred(fileName string) error

Shred writes random data to the file before erasing it

func StrExtract

func StrExtract(sExper, sAdelim, sCdelim string, nOccur int) string

StrExtract extracts a string between two other strings from http://stackoverflow.com/questions/21000277/extract-text-content-from-html-in-golang

Types

This section is empty.

Jump to

Keyboard shortcuts

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