Documentation ¶
Index ¶
- Constants
- func BackupRotation(options Options)
- func ByteToMapArray(data [][]byte) []map[string]interface{}
- func ChangeJson(data *[]byte, key string, value interface{}) error
- func Compress(tw *tar.Writer, path string) error
- func Copy(dst, src string) error
- func CopyDir(src string, dst string) (err error)
- func CopyFile(src, dst string) (err error)
- func Dial(addr string) (*smtp.Client, error)
- func Exist(filename string) bool
- func FloatToString(f float64) string
- func GbkToUtf8(s []byte) ([]byte, error)
- func GetDatabaseList(hostname string, bind string, username string, password string, verbosity int) []string
- func GetEncryptPhone(phone interface{}) string
- func GetLocalIP() string
- func GetStructName(myvar interface{}) string
- func GetTimeStamp() string
- func GetWeekFirstDay() string
- func ImageToBase64(img image.Image) (string, error)
- func IsNumeric(val interface{}) bool
- func ListDirs(rootpath string) []string
- func MD5(text string) string
- func MysqlBackup(username, password, databases, mysqldumppath string)
- func RandString(n int) string
- func SendMail(user, password, host, to, subject, body, mailtype string) error
- func SendMailUsingTLS(addr string, auth smtp.Auth, from string, to []string, msg []byte) (err error)
- func SendQQMail(email, password, host string, port int, from, toEmail, subject, body string) error
- func Sort(list []orm.Params, key string) []orm.Params
- func SubString(str string, begin, length int) (substr string)
- func ToBool(i int) bool
- func ToFloat(str interface{}) float64
- func ToInt(val interface{}) int
- func ToJson(datas interface{}) string
- func ToString(str interface{}) string
- func TrimPrefix(s, suffix string) string
- func TrimSuffix(s, suffix string) string
- func Utf8ToGBK(text string) string
- func Utf8ToGbk(s []byte) ([]byte, error)
- func WriteToFile(filePath string, msg string)
- func ZeroBefore(i int) string
- type ByKey
- type Options
- type Table
Constants ¶
const ( // Info messages Info = 1 << iota // a == 1 (iota has been reset) // Warning Messages Warning = 1 << iota // b == 2 // Error Messages Error = 1 << iota // c == 4 )
Variables ¶
This section is empty.
Functions ¶
func BackupRotation ¶
func BackupRotation(options Options)
BackupRotation execute a rotation of file, daily,weekly and monthly
func ByteToMapArray ¶
func ChangeJson ¶
func CopyDir ¶
CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped.
func CopyFile ¶
CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.
func FloatToString ¶
func GetDatabaseList ¶
func GetDatabaseList(hostname string, bind string, username string, password string, verbosity int) []string
GetDatabaseList retrives list of databases on mysql
func GetEncryptPhone ¶
func GetEncryptPhone(phone interface{}) string
func GetStructName ¶
func GetStructName(myvar interface{}) string
func GetTimeStamp ¶
func GetTimeStamp() string
func GetWeekFirstDay ¶
func GetWeekFirstDay() string
func MysqlBackup ¶
func MysqlBackup(username, password, databases, mysqldumppath string)
func RandString ¶
func SendMailUsingTLS ¶
func SendMailUsingTLS(addr string, auth smtp.Auth, from string, to []string, msg []byte) (err error)
参考net/smtp的func SendMail() 使用net.Dial连接tls(ssl)端口时,smtp.NewClient()会卡住且不提示err len(to)>1时,to[1]开始提示是密送
func SendQQMail ¶
func TrimPrefix ¶
func TrimSuffix ¶
func WriteToFile ¶
WriteToFile create a file and writes a specified msg to it
func ZeroBefore ¶
Types ¶
type Options ¶
type Options struct { HostName string Bind string UserName string Password string Databases []string ExcludedDatabases []string DatabaseRowCountTreshold int TableRowCountTreshold int BatchSize int ForceSplit bool AdditionalMySQLDumpArgs string Verbosity int MySQLDumpPath string OutputDirectory string DefaultsProvidedByUser bool ExecutionStartDate time.Time DailyRotation int WeeklyRotation int MonthlyRotation int }
Options model for commandline arguments
func GetOptions ¶
func GetOptions(default_username, default_password, default_databases, default_mysqldumppath string) *Options
GetOptions creates Options type from Commandline arguments
func NewOptions ¶
func NewOptions(hostname string, bind string, username string, password string, databases string, excludeddatabases string, databasetreshold int, tablethreshold int, batchsize int, forcesplit bool, additionals string, verbosity int, mysqldumppath string, outputDirectory string, defaultsProvidedByUser bool, dailyrotation int, weeklyrotation int, monthlyrotation int) *Options
NewOptions returns a new Options instance.