gocommon

package module
v0.0.0-...-7b23515 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: Apache-2.0 Imports: 12 Imported by: 1

README

go-common

some commonnly used utilities for golang

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckedDeferFunc0

func CheckedDeferFunc0(f func() error)

CheckedDeferFunc0 is useful for report error in deferred function without argument.

func DumpPprofInfo

func DumpPprofInfo()

DumpPprofInfo dumps all predefined profile to stderr.

func GetFileLine

func GetFileLine() (string, int)

GetFileLine is a debug utility that get the file&line of caller.

func GetMySQLConnectionString

func GetMySQLConnectionString(host, port, database, username, password string) string

GetMySQLConnectionString constructs a connection string based on input.

func Init

func Init()

Init function initializes the gocommon package.

func InitializeDatabase

func InitializeDatabase(sqlDriver, connectionString, database, table, sqlCreateTable string) error

InitializeDatabase initials the database, make sure database and table exist.

func MatchPattern

func MatchPattern(str, pattern string) bool

MatchPattern function checks if the str matches specified regular expression pattern.

func RandomString

func RandomString(n int, letters string) string

RandomString returns a random string of n length with letters.

func SetSignalHandler

func SetSignalHandler(sig syscall.Signal, f func(syscall.Signal))

SetSignalHandler setup a handler for spefied signal.

Types

This section is empty.

Jump to

Keyboard shortcuts

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