mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-27 03:20:25 +08:00
refactor: 组件升级、代码优化
This commit is contained in:
@@ -3,7 +3,7 @@ package assert
|
||||
import "fmt"
|
||||
|
||||
// 断言条件为真,不满足的panic
|
||||
func IsTrue(condition bool, panicMsg string, params ...interface{}) {
|
||||
func IsTrue(condition bool, panicMsg string, params ...any) {
|
||||
if !condition {
|
||||
if len(params) != 0 {
|
||||
panic(fmt.Sprintf(panicMsg, params...))
|
||||
@@ -12,10 +12,10 @@ func IsTrue(condition bool, panicMsg string, params ...interface{}) {
|
||||
}
|
||||
}
|
||||
|
||||
func State(condition bool, panicMsg string, params ...interface{}) {
|
||||
func State(condition bool, panicMsg string, params ...any) {
|
||||
IsTrue(condition, panicMsg, params...)
|
||||
}
|
||||
|
||||
func NotEmpty(str string, panicMsg string, params ...interface{}) {
|
||||
func NotEmpty(str string, panicMsg string, params ...any) {
|
||||
IsTrue(str != "", panicMsg, params...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user