diff --git a/sysutils.go b/sysutils.go index 8697c14..1927f9d 100644 --- a/sysutils.go +++ b/sysutils.go @@ -1,6 +1,7 @@ package f5 import ( + "q5" "os" "errors" "gorm.io/gorm" @@ -32,6 +33,14 @@ func New[T any](cb func(*T)) *T { return obj } +func ExtractRegisterTimeFromSessionid(sessionId string) int32 { + strList := q5.StrSplit(sessionId, "_") + if len(strList) < 4 { + return 0 + } + return q5.ToInt32(strList[0]) +} + func IsOrmErrRecordNotFound(err error) bool { return errors.Is(err, gorm.ErrRecordNotFound) }