abs

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckStr

type CheckStr interface {
	IsEmpty(val string) bool
	IsEmptyPtr(val *string) (string, bool)
}

type Conv added in v1.0.12

type Conv interface {
	AnyToMap(obj interface{}) (map[string]interface{}, error)
}

type ConvProto added in v1.0.7

type ConvProto interface {
	AnyToProtoStruct(sr any) (*structpb.Struct, error)
}

type ConvTime

type ConvTime interface {
	ToStr(tm time.Time, format string) string
	ToStrDate(tm time.Time) string
	ToStrFull(tm time.Time) string
	ToStrMillis(tm time.Time) string
	ToStrMicro(tm time.Time) string

	ToStrRFC3339(tm time.Time) string
	ToStrRFC3339MilliSecond(tm time.Time) string
	ToStrRFC3339MicroSecond(tm time.Time) string

	ToTime(layout string, value string) (tm time.Time, err error)
	ToTimeDate(value string) (time.Time, error)
	ToTimeFull(value string) (time.Time, error)
	ToTimeMillis(value string) (time.Time, error)
	ToTimeMicro(value string) (time.Time, error)

	ToTimeRFC3339(value string) (time.Time, error)
	ToTimeRFC3339MilliSecond(value string) (time.Time, error)
	ToTimeRFC3339MicroSecond(value string) (time.Time, error)

	GetTimeZone(tm time.Time) string
	RemovePart(tm time.Time, part ...string) time.Time
}

type CryptoAES added in v1.0.10

type CryptoAES interface {
	ECBEncrypt(key, value string) (string, error)
	ECBRawEncrypt(key, value string) ([]byte, error)
	ECBDecrypt(key, value string) (string, error)
	ECBRawDecrypt(key string, value []byte) ([]byte, error)
}

https://www.devglan.com/online-tools/aes-encryption-decryption

type CryptoMD5 added in v1.0.3

type CryptoMD5 interface {
	Generate(data string) string
}

type CryptoSHA256 added in v1.0.8

type CryptoSHA256 interface {
	Generate(data string) string
}

type CryptoSHA512 added in v1.1.47

type CryptoSHA512 interface {
	Generate(data string) string
}

type Db

type Db interface {
	NewPostgresInstance(host string, port int, dbName, username, password string, schema *string, config *model.DbConfig, autoRebind, unsafeCompatibility bool, applicationName string, printSql bool, printUnsafeError bool) DbPostgresInstance
	NewReadWritePostgresInstance(read, write DbPostgresInstance) DbPostgresInstance
}

type DbGetUpdateHelper added in v1.1.21

type DbGetUpdateHelper interface {
	Add(kv map[string]interface{}) DbGetUpdateHelper
	AddIfNotNilOrEmpty(kv map[string]interface{}) DbGetUpdateHelper
	Where(condition string, pars ...interface{}) DbGetUpdateHelper
	Get() (condition string, pars []interface{})
}

type DbInstance

type DbInstance interface {
	Ping() error
	Execute(sqlQuery string, sqlPars ...interface{}) (string, error)
	ExecuteRID(sqlQuery string, sqlPars ...interface{}) (*int64, string, error)
	Select(out interface{}, sqlQuery string, sqlPars ...interface{}) error
	DirectSelect(rw_force bool, out interface{}, sqlQuery string, sqlPars ...interface{}) (*model.DbUnsafeSelectError, string, error)
	Get(rw_force bool, out interface{}, sqlQuery string, sqlPars ...interface{}) (string, error)

	NewTransaction() (DbTx, string, error)
	EmptyTransaction() (DbTx, string)
	OnUnsafe(unsafe *model.DbUnsafeSelectError)

	TxExecute(tx DbTx, sqlQuery string, sqlPars ...interface{}) (string, error)
	TxExecuteRID(tx DbTx, sqlQuery string, sqlPars ...interface{}) (*int64, string, error)
	TxSelect(tx DbTx, out interface{}, sqlQuery string, sqlPars ...interface{}) (*model.DbUnsafeSelectError, string, error)
	TxGet(tx DbTx, out interface{}, sqlQuery string, sqlPars ...interface{}) (string, error)
}

type DbPostgresInstance

type DbPostgresInstance interface {
	DbInstance
}

type DbTx added in v1.1.18

type DbTx interface {
	Commit() error
	Rollback() error
	Host() string
}

type DbUpdateHelper added in v1.1.21

type DbUpdateHelper interface {
	SetAdd(condition string, param interface{})
	SetAddIfNoNil(condition string, param interface{})
	SetAddIfNotNilOrEmpty(condition string, param interface{})
	Where(condition string, pars ...interface{})

	MapSetAdd(kv map[string]interface{})
	MapSetAddIfNotNilOrEmpty(kv map[string]interface{})

	Get() (condition string, pars []interface{})
}

type Err added in v1.0.5

type Err interface {
	WithStack(err error, skip ...int) error
}

type Http added in v1.0.4

type Http interface {
	Get(url string, header map[string]interface{}, params map[string]interface{}, skipSecurityChecking bool, timeout *time.Duration) (result []byte, code int, err error)
	Post(url string, header map[string]interface{}, payload map[string]interface{}, skipSecurityChecking bool, timeout *time.Duration) (result []byte, code int, err error)
	PostData(url string, header map[string]interface{}, data []byte, skipSecurityChecking bool, timeout *time.Duration) (result []byte, code int, err error)
	PostFormData(url string, header map[string]string, files map[string]model.FileData, fields map[string]string) (result []byte, code int, err error)
	Delete(url string, header map[string]interface{}, params map[string]interface{}, skipSecurityChecking bool, timeout *time.Duration) (result []byte, code int, err error)
}

type I9GCS added in v1.1.26

type I9GCS interface {
	Write(destination string, data []byte, timeout ...time.Duration) error
	WriteFromFile(destination string, filePath string, autoIncludeExtension bool, timeout ...time.Duration) error
}

type Json

type Json interface {
	Marshal(obj interface{}) ([]byte, error)
	UnMarshal(data []byte, out interface{}) error
	Encode(obj interface{}) (string, error)
	Decode(jsonStr string, out interface{}) error
	MapToJson(maps map[string]interface{}) (string, error)
}

type Log added in v1.0.1

type Log interface {
	GetSourceCall() string
}

type Server added in v1.0.6

type Server interface {
	StartGRPC(port int, autoRecover bool, register func(svc *grpc.Server), stackTraceSkipLevel ...int)
}

type Util

type Util interface {
	GetNanoID(length ...int) string
	GetID25() string
	GetXID25() string
	GetXID30() string
	GetXID40() string
	GetRandom(length int, value string) (string, error)
	GetRandomNumber(min, max int) int
	GetRandomAlphabet(length int) string
	GetRandomAlphabetLower(length int) string
	GetRandomAlphabetUpper(length int) string
	GetRandomAlphabetNumber(length int) string
	GetRandomDuration(min int, max int, base time.Duration) time.Duration
	BuildJwtToken(privateKey []byte, claims jwt.Claims) (string, error)
	BuildJwtTokenWithPassword(privateKey []byte, password string, claims jwt.Claims) (string, error)
	CreateJwtToken(subject, id string, expiresAt, issuedAt, notBefore time.Time, privateKey []byte) (string, error)
	CreateJwtTokenWithPassword(subject, id string, expiresAt, issuedAt, notBefore time.Time, privateKey []byte, password string) (string, error)
	GetJwtClaims(token string, publicKey []byte) (*jwt.RegisteredClaims, bool, error)
	Base64Encode(data []byte) string
	Base64Decode(value string) ([]byte, error)
	GetExecutionInfo(depth int) (execFunc string, execPath string)
	IsNumberOnly(value string, exclude ...string) bool
	ExtractPhoneNumber(phoneNumber *string) (countryId, countryCode, number string)
	IsEmailValid(email string, verifyDomain ...bool) bool

	ImageBase64Decoder(imageBase64 string) (buff bytes.Buffer, config image.Config, format string, err error)

	// ReflectionSet path: core.util.util-reflection-set.go
	ReflectionSet(obj interface{}, bind map[string]interface{}) error
	ReflectionGet(obj interface{}, fieldName string) (interface{}, error)

	ConcurrentProcess(total, max int, fn func(index int))
	UniqueConcurrentProcess(total, max int, key func(index int) *string, fn func(index int))
	NewMutex(name string) UtilMutex
	NewNMutex(max int) UtilNMutex
}

type UtilEnv

type UtilEnv interface {
	GetAppEnv(key string) actenv.AppEnv
	GetStr(key string, defaultValue ...string) string
	GetInt(key string, defaultValue ...int) int
	GetInt32(key string, defaultValue ...int32) int32
	GetInt64(key string, defaultValue ...int64) int64
	GetFloat32(key string, defaultValue ...float32) float32
	GetFloat64(key string, defaultValue ...float64) float64
	GetBool(key string, defaultValue ...bool) bool
	GetBase64(key string) UtilEnvBase64
	GetStrArr(key string, separator string, defaultValue ...[]string) []string
	GetMapStrStr(key string, keyValSeparator string, itemSeparator string, defaultValue ...map[string]string) map[string]string
}

type UtilEnvBase64 added in v1.0.2

type UtilEnvBase64 interface {
	Key() string
	Data() []byte
}

type UtilHashId

type UtilHashId interface {
	Reload()
	Encode(numbers ...int) string
	Decode(hashed string) ([]int, error)
	Encode64(numbers ...int64) string
	DecodeInt64(hashed string) ([]int64, error)
	Add(key, salt string, length int)
	Get(key string) UtilHashId
}

type UtilMutex added in v1.1.41

type UtilMutex interface {
	Sleep(duration ...time.Duration)
	Lock(timeout ...time.Duration) (isTimeout bool)
	Unlock()
	Exec(timeout *time.Duration, fn func()) (executed bool, panicErr error)
	FExec(timeoutLock *time.Duration, timeoutFunc time.Duration, fn func()) (executed bool, isTimeout bool, panicErr error)
	Func(timeout time.Duration, fn func()) (isTimeout bool, panicErr error)
}

type UtilNMutex added in v1.2.1

type UtilNMutex interface {
	Lock(key string, totalTry ...int) (locked bool)
	Unlock(key string)
}

Jump to

Keyboard shortcuts

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