Fetch the repository succeeded.
package builtin
// -----------------------------------------------------------------------------
// Not returns !a
//
func Not(a interface{}) interface{} {
if a1, ok := a.(bool); ok {
return !a1
}
return panicUnsupportedOp1("!", a)
}
// LT returns a < b
//
func LT(a, b interface{}) interface{} {
switch a1 := a.(type) {
case int:
switch b1 := b.(type) {
case int:
return a1 < b1
case float64:
return float64(a1) < b1
}
case float64:
switch b1 := b.(type) {
case int:
return a1 < float64(b1)
case float64:
return a1 < b1
}
case string:
if b1, ok := b.(string); ok {
return a1 < b1
}
}
return panicUnsupportedOp2("<", a, b)
}
// GT returns a > b
//
func GT(a, b interface{}) interface{} {
switch a1 := a.(type) {
case int:
switch b1 := b.(type) {
case int:
return a1 > b1
case float64:
return float64(a1) > b1
}
case float64:
switch b1 := b.(type) {
case int:
return a1 > float64(b1)
case float64:
return a1 > b1
}
case string:
if b1, ok := b.(string); ok {
return a1 > b1
}
}
return panicUnsupportedOp2(">", a, b)
}
// LE returns a <= b
//
func LE(a, b interface{}) interface{} {
switch a1 := a.(type) {
case int:
switch b1 := b.(type) {
case int:
return a1 <= b1
case float64:
return float64(a1) <= b1
}
case float64:
switch b1 := b.(type) {
case int:
return a1 <= float64(b1)
case float64:
return a1 <= b1
}
case string:
if b1, ok := b.(string); ok {
return a1 <= b1
}
}
return panicUnsupportedOp2("<=", a, b)
}
// GE returns a >= b
//
func GE(a, b interface{}) interface{} {
switch a1 := a.(type) {
case int:
switch b1 := b.(type) {
case int:
return a1 >= b1
case float64:
return float64(a1) >= b1
}
case float64:
switch b1 := b.(type) {
case int:
return a1 >= float64(b1)
case float64:
return a1 >= b1
}
case string:
if b1, ok := b.(string); ok {
return a1 >= b1
}
}
return panicUnsupportedOp2(">=", a, b)
}
// EQ returns a == b
//
func EQ(a, b interface{}) interface{} {
return a == b
}
// NE returns a != b
//
func NE(a, b interface{}) interface{} {
return a != b
}
// -----------------------------------------------------------------------------
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。