utils

package
v0.0.4-beta.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 20 Imported by: 31

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecryptText

func AesDecryptText(fieldID int64, realEncryptKey []byte, encryptedText string) (originText string, err error)

func BoolPtr

func BoolPtr(val bool) *bool

func BoolValueOfPtr

func BoolValueOfPtr(val *bool) bool

func Decode

func Decode(input interface{}, output interface{}) error

func GetAGWDomain

func GetAGWDomain(ctx context.Context) string

func GetAGWDomainByConf

func GetAGWDomainByConf(ctx context.Context) string

func GetAPaaSPersistFaaSMapFromCtx added in v0.0.4

func GetAPaaSPersistFaaSMapFromCtx(ctx context.Context) (res map[string]string)

func GetAPaaSPersistFaaSMapStr added in v0.0.4

func GetAPaaSPersistFaaSMapStr(ctx context.Context) string

func GetAPaaSPersistFaaSValueFromCtx added in v0.0.4

func GetAPaaSPersistFaaSValueFromCtx(ctx context.Context, key string) string

func GetApiTimeoutFromCtx

func GetApiTimeoutFromCtx(ctx context.Context) map[string]int64

func GetAppIDAndSecret

func GetAppIDAndSecret() (string, string, error)

func GetBoe

func GetBoe(ctx context.Context) string

func GetDebugTypeFromCtx

func GetDebugTypeFromCtx(ctx context.Context) int

func GetDistributedMaskFromCtx

func GetDistributedMaskFromCtx(ctx context.Context) string

func GetEnv

func GetEnv() string

func GetEnvBoeFromCtx

func GetEnvBoeFromCtx(ctx context.Context) string

func GetEnvOrgID

func GetEnvOrgID() string

func GetFaaSInfraDomain

func GetFaaSInfraDomain(ctx context.Context) string

func GetFaaSType added in v0.0.4

func GetFaaSType(ctx context.Context) string

func GetFunctionNameFromCtx

func GetFunctionNameFromCtx(ctx context.Context) string

func GetInnerAPIPSM

func GetInnerAPIPSM(ctx context.Context) string

GetInnerAPIPSM open-sdk: from ctx faaS-sdk: from const by env

func GetInnerAPIPSMFromCtx

func GetInnerAPIPSMFromCtx(ctx context.Context) string

func GetLogIDFromCtx

func GetLogIDFromCtx(ctx context.Context) string

func GetLogIDFromExtra

func GetLogIDFromExtra(extra map[string]interface{}) string

func GetLoopMaskFromCtx

func GetLoopMaskFromCtx(ctx context.Context) []string

func GetNamespace

func GetNamespace() string

func GetNamespaceFromCtx

func GetNamespaceFromCtx(ctx context.Context) string

func GetOpenAPIDomain

func GetOpenAPIDomain(ctx context.Context) string

func GetServiceID

func GetServiceID() string

func GetSourceTypeFromCtx

func GetSourceTypeFromCtx(ctx context.Context) int

func GetTTEnvFromCtx

func GetTTEnvFromCtx(ctx context.Context) string

func GetTenantFromCtx

func GetTenantFromCtx(ctx context.Context) (*structs.Tenant, error)

func GetTenantIDFromCtx

func GetTenantIDFromCtx(ctx context.Context) int64

func GetTenantName

func GetTenantName() string

func GetTriggerTaskIDFromCtx

func GetTriggerTaskIDFromCtx(ctx context.Context) int64

func GetTriggerTypeFromCtx

func GetTriggerTypeFromCtx(ctx context.Context) string

func GetUserContext

func GetUserContext(ctx context.Context) (res structs.UserContext)

func GetUserContextMap added in v0.0.2

func GetUserContextMap(ctx context.Context) (res map[string]interface{})

func GetUserIDFromCtx

func GetUserIDFromCtx(ctx context.Context) int64

func Int64InInt64s

func Int64InInt64s(ns []int, n int) bool

func Int64Ptr

func Int64Ptr(val int64) *int64

func Int64ValueOfPtr

func Int64ValueOfPtr(p *int64, defaultVal int64) int64

func IntInInts

func IntInInts(ns []int, n int) bool

func IntPtr

func IntPtr(val int) *int

func IntValueOfPtr

func IntValueOfPtr(p *int, defaultVal int) int

func InvokeFuncWithRetry

func InvokeFuncWithRetry(retryCount int, retryInterval time.Duration, f func() error) error

func IsDebug

func IsDebug(ctx context.Context) bool

IsDebug 是否调试

func IsLocalDebug

func IsLocalDebug(ctx context.Context) bool

func IsMicroservice added in v0.0.4

func IsMicroservice(ctx context.Context) bool

func JsonMarshalBytes

func JsonMarshalBytes(val interface{}) ([]byte, error)

func JsonUnmarshalBytes

func JsonUnmarshalBytes(val []byte, addr interface{}) error

func LevelInfo

func LevelInfo(level logrus.Level) (string, int)

func NowMils

func NowMils() int64

func PrintLog

func PrintLog(contents ...interface{})

PrintLog unittest to use

func PtrToInt

func PtrToInt(p *int, defaultVal int) int

func SetAPaaSPersistFaaSMapToCtx added in v0.0.4

func SetAPaaSPersistFaaSMapToCtx(ctx context.Context, aPaaSPersistFaaSMap map[string]string) context.Context

func SetApiTimeoutMethodToCtx

func SetApiTimeoutMethodToCtx(ctx context.Context, method string) context.Context

func SetApiTimeoutToCtx

func SetApiTimeoutToCtx(ctx context.Context, timeout map[string]int64) context.Context

func SetDebugTypeToCtx

func SetDebugTypeToCtx(ctx context.Context, debugType int) context.Context

func SetDistributedMaskToCtx

func SetDistributedMaskToCtx(ctx context.Context, mask string) context.Context

func SetEnvBoeToCtx

func SetEnvBoeToCtx(ctx context.Context, boe string) context.Context

func SetFunctionNameToCtx

func SetFunctionNameToCtx(ctx context.Context, functionName string) context.Context

func SetInnerAPIPSMToCtx

func SetInnerAPIPSMToCtx(ctx context.Context, psm string) context.Context

func SetKEnvToCtx

func SetKEnvToCtx(ctx context.Context, kEnv string) context.Context

func SetKEnvToCtxForRPC

func SetKEnvToCtxForRPC(ctx context.Context) context.Context

func SetLogIDToCtx

func SetLogIDToCtx(ctx context.Context, logID string) context.Context

func SetLoopMaskToCtx

func SetLoopMaskToCtx(ctx context.Context, mask []string) context.Context

func SetSourceTypeToCtx

func SetSourceTypeToCtx(ctx context.Context, sourceType int) context.Context

func SetTTEnvToCtx

func SetTTEnvToCtx(ctx context.Context, ttEnv string) context.Context

func SetTenantToCtx

func SetTenantToCtx(ctx context.Context, tenant *structs.Tenant) context.Context

func SetTriggerTaskIDToCtx

func SetTriggerTaskIDToCtx(ctx context.Context, taskID int64) context.Context

func SetTriggerTypeToCtx

func SetTriggerTypeToCtx(ctx context.Context, triggerType string) context.Context

func SetUserContext

func SetUserContext(ctx context.Context, userCtx structs.UserContext) context.Context

func SetUserContextMap added in v0.0.2

func SetUserContextMap(ctx context.Context, userCtxMap map[string]interface{}) context.Context

func SetUserIDToCtx

func SetUserIDToCtx(ctx context.Context, userID int64) context.Context

func StrInStrs

func StrInStrs(strs []string, str string) bool

func StringPtr

func StringPtr(val string) *string

func StringValueOfPtr

func StringValueOfPtr(p *string, defaultVal string) string

func TimeMils

func TimeMils(t time.Time) int64

func WithAPaaSPersistFaaSValue added in v0.0.4

func WithAPaaSPersistFaaSValue(ctx context.Context, key, value string) context.Context

Types

type ConsoleLogger

type ConsoleLogger struct {
	// contains filtered or unexported fields
}

func GetConsoleLogger

func GetConsoleLogger(logIDs ...string) *ConsoleLogger

func (*ConsoleLogger) Errorf

func (c *ConsoleLogger) Errorf(format string, args ...interface{})

func (*ConsoleLogger) Infof

func (c *ConsoleLogger) Infof(format string, args ...interface{})

func (*ConsoleLogger) Result

func (c *ConsoleLogger) Result(format string, args ...interface{})

func (*ConsoleLogger) Warnf

func (c *ConsoleLogger) Warnf(format string, args ...interface{})

type LogFormatter

type LogFormatter struct {
}

func (*LogFormatter) Format

func (m *LogFormatter) Format(entry *logrus.Entry) ([]byte, error)

type PathReplace

type PathReplace struct {
	// contains filtered or unexported fields
}

PathReplace 路径替换工具

func NewPathReplace

func NewPathReplace(path string) *PathReplace

func (*PathReplace) APIName

func (p *PathReplace) APIName(APIName string) *PathReplace

func (*PathReplace) ExecutionID

func (p *PathReplace) ExecutionID(instanceID int64) *PathReplace

func (*PathReplace) FieldAPIName

func (p *PathReplace) FieldAPIName(fieldAPIName string) *PathReplace

func (*PathReplace) FileID

func (p *PathReplace) FileID(fileID string) *PathReplace

func (*PathReplace) FunctionAPIName

func (p *PathReplace) FunctionAPIName(functionAPIName string) *PathReplace

func (*PathReplace) Namespace

func (p *PathReplace) Namespace(namespace string) *PathReplace

func (*PathReplace) ObjectAPIName

func (p *PathReplace) ObjectAPIName(objectAPIName string) *PathReplace

func (*PathReplace) Path

func (p *PathReplace) Path() string

func (*PathReplace) RecordID

func (p *PathReplace) RecordID(recordID int64) *PathReplace

Jump to

Keyboard shortcuts

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