Documentation
¶
Overview ¶
Package goshared ...
Index ¶
- func AES256Decrypt(encryptedString string, keyString string) (decryptedString string)
- func AES256Encrypt(stringToEncrypt string, keyString string) (encryptedString string)
- func CheckFileExistence(filepath string) bool
- func FlatPath(path string) []string
- func FunctionName() string
- func GetFirstElementFromSliceByCondition[T any](in []T, condition func(element T) bool) (out T, ok bool)
- func IOMV(sourcePath, destPath string) error
- func InitLogrus(cfg LogrusRawConfig)
- func NewLogrusLogger(cfg LogrusRawConfig) *logrus.Logger
- func NewMysqlClient(rawCfg MysqlRawConfig, ormCfg MysqlORMConfig) (*gorm.DB, error)
- func NewRedisClient(ctx context.Context, cfg RedisRawConfig) (*redis.Client, error)
- func NewSignalCtx() context.Context
- func ParseQuery(str string) (url.Values, error)
- func RepeatedlyDo(op func() error, rt uint) error
- func ShellMV(src, dst string) error
- func SliceContains[T comparable](s []T, e T) bool
- func SliceFilter[T any](in []T, condition func(element T) bool) (out []T)
- func SlicePaginate[T any](in []T, offset *uint64, limit *uint64) (out []T)
- func Ternary[T any](b bool, t, f T) T
- type FrequencyLimiter
- type LimitedOperation
- type LogrusRawConfig
- type MysqlORMConfig
- type MysqlRawConfig
- type RedisRawConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AES256Decrypt ¶
func AES256Encrypt ¶
func CheckFileExistence ¶ added in v1.4.0
CheckFileExistence ...
func FunctionName ¶ added in v1.5.0
func FunctionName() string
func GetFirstElementFromSliceByCondition ¶ added in v1.11.0
func GetFirstElementFromSliceByCondition[T any](in []T, condition func(element T) bool) (out T, ok bool)
GetFirstElementFromSliceByCondition ...
func IOMV ¶
IOMV Solve problem that os.Rename() give error "invalid cross-device link" in Docker container with Volumes(container FS and volume FS are different). Note that you need have permissions on both FS.
func NewLogrusLogger ¶ added in v1.3.2
func NewLogrusLogger(cfg LogrusRawConfig) *logrus.Logger
func NewMysqlClient ¶ added in v1.3.2
func NewMysqlClient(rawCfg MysqlRawConfig, ormCfg MysqlORMConfig) (*gorm.DB, error)
func NewRedisClient ¶ added in v1.3.2
func NewRedisClient(ctx context.Context, cfg RedisRawConfig) (*redis.Client, error)
func NewSignalCtx ¶
NewSignalCtx generate context which work with SIGINT and SIGTERM
func RepeatedlyDo ¶
RepeatedlyDo do some operation at least once @Param op represent operation function which has 'func() error' signature @Param rt represent repeated times
func SliceContains ¶ added in v1.8.0
func SliceContains[T comparable](s []T, e T) bool
SliceContains ...
func SliceFilter ¶ added in v1.10.0
SliceFilter ...
func SlicePaginate ¶ added in v1.10.0
SlicePaginate ...
Types ¶
type FrequencyLimiter ¶ added in v1.9.0
type FrequencyLimiter func(ctx context.Context, op LimitedOperation) (done bool, err error)
func MakeFrequencyLimiter ¶ added in v1.9.0
func MakeFrequencyLimiter(period time.Duration, frequency uint64) FrequencyLimiter
MakeFrequencyLimiter ...
type LimitedOperation ¶ added in v1.9.0
type LogrusRawConfig ¶ added in v1.3.2
type MysqlORMConfig ¶ added in v1.3.2
type MysqlRawConfig ¶ added in v1.3.2
type MysqlRawConfig struct { Host string `envconfig:"MYSQL_HOST,default=127.0.0.1"` Port string `envconfig:"MYSQL_PORT,default=3306"` TLP string `envconfig:"MYSQL_TLP,optional"` User string `envconfig:"MYSQL_USER"` Password string `envconfig:"MYSQL_PASSWORD"` Database string `envconfig:"MYSQL_DATABASE"` ConnMaxLifeMinute int `envconfig:"MYSQL_CONN_MAX_LIFE_MINUTE,default=3"` MaxOpenConns int `envconfig:"MYSQL_MAX_OPEN_CONNS,default=10"` MaxIdleConns int `envconfig:"MYSQL_MAX_IDLE_CONNS,default=10"` }
type RedisRawConfig ¶ added in v1.3.2
Source Files
¶
Click to show internal directories.
Click to hide internal directories.