Documentation ¶
Index ¶
- Variables
- func CheckConnect(host string, port string) bool
- func CheckDbErr(err error, db *sql.DB, msg ...interface{}) (isErr bool)
- func CheckErr(err error) (isErr bool)
- func Crit(msg ...interface{})
- func Debug(msg ...interface{})
- func DeferClose(c io.Closer)
- func Error(msg ...interface{})
- func Exists(filePath string) (exists bool)
- func GetImagePath(html string) string
- func IfThenElse(condition bool, a interface{}, b interface{}) interface{}
- func Info(msg ...interface{})
- func LogInit(level string, name string)
- func NextHeartBeat(heartBeat int) (nextHeartBeat int)
- func NilString(s string) string
- func RandomRange(min int, max int) (randomRange int)
- func SendMail(mail Mail)
- func StayAlive(fn func())
- func ThrottleAllow(ip string, timeout int) (retVal bool)
- func TrimLen(str string, size int) (splited string)
- func Warn(msg ...interface{})
- func WatchFileAndRun(filePath string, fn func())
- type Mail
- type Services
Constants ¶
This section is empty.
Variables ¶
var Alive bool
*******_____*_***********************_*_**********************************
- / ____| | /\ | (_)
- | (___ | |_ __ _ _ _ / \ | |___ _____
- \___ \| __/ _` | | | | / /\ \ | | \ \ / / _ \
- ____) | || (_| | |_| |/ ____ \| | |\ V / __/
- |_____/ \__\__,_|\__, /_/ \_\_|_| \_/ \___|
- __/ |
- |___/
- Call this routine to stay alive, but check for break condition to exit.
- Paramter is a clean up function to call.
var (
DebugLevel string
)
Functions ¶
func CheckConnect ¶
---------------------------------------------------------------------------------
_____ _ _ _____ _ _ / ____| | | | / ____| | | (_)
| | | |__ ___ ___| | _| | ___ _ __ _ __ ___ ___| |_ _ ___ _ __ | | | '_ \ / _ \/ __| |/ / | / _ \| '_ \| '_ \ / _ \/ __| __| |/ _ \| '_ \ | |____| | | | __/ (__| <| |___| (_) | | | | | | | __/ (__| |_| | (_) | | | | \_____|_| |_|\___|\___|_|\_\\_____\___/|_| |_|_| |_|\___|\___|\__|_|\___/|_| |_|
func CheckDbErr ¶
-------------------------------------------------
___ _ _ DB ___ / __| |_ ___ __| |__ | __|_ _ _ _ ___ _ _ | (__| ' \/ -_) _| / / | _|| '_| '_/ _ \ '_| \___|_||_\___\__|_\_\ |___|_| |_| \___/_|
func CheckErr ¶
-------------------------------------------------
___ _ _ ___ / __| |_ ___ __| |__ | __|_ _ _ _ ___ _ _ | (__| ' \/ -_) _| / / | _|| '_| '_/ _ \ '_| \___|_||_\___\__|_\_\ |___|_| |_| \___/_|
func Debug ¶
func Debug(msg ...interface{})
*** _ _ _ _
- | | | | | | | |
- | | ___ __ _| |__| | ___| |_ __ ___ _ __ ___
- | |/ _ \ / _` | __ |/ _ \ | '_ \ / _ \ '__/ __|
- | | (_) | (_| | | | | __/ | |_) | __/ | \__ \
- |_|\___/ \__, |_| |_|\___|_| .__/ \___|_| |___/
- __/ | | |
- |___/ |_|
func DeferClose ¶
_ | | ___| | ___ ___ ___ / __| |/ _ \/ __|/ _ \ | (__| | (_) \__ \ __/ \___|_|\___/|___/\___|
Safe close routine
func Exists ¶
---___--_--_------------___-------_------_-----------
| __|(_)| | ___ ___ | __|__ __(_) ___| |_ ___ | _| | || |/ -_)|___|| _| \ \ /| |(_-<| _|(_-< |_| |_||_|\___| |___|/_\_\|_|/__/ \__|/__/
func GetImagePath ¶
func IfThenElse ¶
func IfThenElse(condition bool, a interface{}, b interface{}) interface{}
****************************************************************
- _ __ _______ _ ______ _
- (_)/ _|__ __| | | ____| |
- _| |_ | | | |__ ___ _ __ | |__ | |___ ___
- | | _| | | | '_ \ / _ \ '_ \| __| | / __|/ _ \
- | | | | | | | | | __/ | | | |____| \__ \ __/
- |_|_| |_| |_| |_|\___|_| |_|______|_|___/\___|
- --------------------------------------------------------------
- IfThenElse evaluates a condition, if true returns the first
- parameter otherwise the second
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
func NextHeartBeat ¶
------------_---_---_-----------------_---_----------------_----------
| | | | | | | | | | | | __ _ ___| |_| |_| | ___ __ _ _ __| |_| |__ ___ __ _| |_ / _` |/ _ \ __| _ |/ _ \/ _` | '__| __| '_ \ / _ \/ _` | __|
| (_| | __/ |_| | | | __/ (_| | | | |_| |_) | __/ (_| | |_
\__, |\___|\__\_| |_/\___|\__,_|_| \__|_.__/ \___|\__,_|\__| __/ | |___/
func NilString ¶
************************************************
- _ _ _____ _ _
- (_) |/ ____| | (_)
- _ __ _| | (___ | |_ _ __ _ _ __ __ _
- | '_ \| | |\___ \| __| '__| | '_ \ / _` |
- | | | | | |____) | |_| | | | | | | (_| |
- |_| |_|_|_|_____/ \__|_| |_|_| |_|\__, |
- __/ |
- |___/
- * * * * * * * * * * * * * * * * * * * * * * * *
- prevents a nil string from infecting data
- ---------------------------------------------
func RandomRange ¶
----------------------------------------------------------------------------
____ __ ____ / __ \____ _____ ____/ /___ ____ ___ / __ \____ _____ ____ ____ / /_/ / __ `/ __ \/ __ / __ \/ __ `__ \ / /_/ / __ `/ __ \/ __ `/ _ \ / _, _/ /_/ / / / / /_/ / /_/ / / / / / / / _, _/ /_/ / / / / /_/ / __/ /_/ |_|\__,_/_/ /_/\__,_/\____/_/ /_/ /_/ /_/ |_|\__,_/_/ /_/\__, /\___/ /____/
func ThrottleAllow ¶
func TrimLen ¶
****************************************************
- _ _ _
- | | (_) | |
- | |_ _ __ _ _ __ ___ | | ___ _ __
- | __| '__| | '_ ` _ \| | / _ \ '_ \
- | |_| | | | | | | | | |___| __/ | | |
- \__|_| |_|_| |_| |_|______\___|_| |_|
- * * * * * * * * * * * * * * * * * * * * * * * * * *
- Trim the length of a string based on the max length
- --------------------------------------------------
func WatchFileAndRun ¶
func WatchFileAndRun(filePath string, fn func())
*******************************************************************************************
- _ _ ______ _ _ _ _____
- | | | | | ____(_) | /\ | | __ \
- __ ____ _| |_ ___| |__ | |__ _| | ___ / \ _ __ __| | |__) | _ _ __
- \ \ /\ / / _` | __/ __| '_ \| __| | | |/ _ \ / /\ \ | '_ \ / _` | _ / | | | '_ \
- \ V V / (_| | || (__| | | | | | | | __// ____ \| | | | (_| | | \ \ |_| | | | |
- \_/\_/ \__,_|\__\___|_| |_|_| |_|_|\___/_/ \_\_| |_|\__,_|_| \_\__,_|_| |_|
- ------------------------------------------------------------------------------------------
- Watches for a file change and if it change returns nil
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Types ¶
type Mail ¶
type Mail struct { HOST string PORT int FROM string PASS string TO string SUBJECT string BODY string FILES []string }
************************************************
- _ __ __ _ _
- | | \/ | (_) |
- ___ ___ _ __ __| | \ / | __ _ _| |
- / __|/ _ \ '_ \ / _` | |\/| |/ _` | | |
- \__ \ __/ | | | (_| | | | | (_| | | |
- |___/\___|_| |_|\__,_|_| |_|\__,_|_|_|
- -----------------------------------------------
- Sends an email based on config values
- * * * * * * * * * * * * * * * * * * * * * * *
type Services ¶
type Services struct { Service string `json:"service"` Dns string `json:"dns"` Ip string `json:"ip"` Port string `json:"port"` Cb string `json:"callback"` Expected string `json:"expected"` Deps string `json:"deps"` Meta string `json:"meta"` }
***************************************************************************************
- _ _______ _____ _
- | |__ __| | __ \ (_)
- _ __ ___ _ __ ___ _ __| |_ | | ___ | | | | ___ _ __ ___ __ _ _ _ __
- | '__/ _ \ '_ \ / _ \| '__| __|| |/ _ \| | | |/ _ \| '_ ` _ \ / _` | | '_ \
- | | | __/ |_) | (_) | | | |_ | | (_) | |__| | (_) | | | | | | (_| | | | | |
- |_| \___| .__/ \___/|_| \__||_|\___/|_____/ \___/|_| |_| |_|\__,_|_|_| |_|
- | |
- |_|
- --------------------------------------------------------------------------------------
- Function to report to domains, this will require paramters, since we can not predict
- how each application is managing its configuration control.
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *