This commit is contained in:
aozhiwei 2024-05-09 17:49:18 +08:00
parent 77dfc7f2c7
commit d4433dc0ff

View File

@ -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)
}