conditionKit

package
v3.0.81 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func And

func And[T, U any](a T, b U) bool

And 逻辑且操作,当切仅当a和b都为true时返回true

func Bool

func Bool[T any](value T) bool

Bool 返回传入参数的bool值.

如果出入类型参数含有Bool方法, 会调用该方法并返回
如果传入类型参数有IsZero方法, 返回IsZero方法返回值的取反
slices和map的length大于0时,返回true,否则返回false
其他类型会判断是否是零值

func Nand

func Nand[T, U any](a T, b U) bool

Nand 如果a和b都为真,返回false,否则返回true

func Nor

func Nor[T, U any](a T, b U) bool

Nor 异或的取反操作

func Or

func Or[T, U any](a T, b U) bool

Or 逻辑或操作,当切仅当a和b都为false时返回false

func TernaryOperator

func TernaryOperator[T, U any](isTrue T, ifValue U, elseValue U) U

TernaryOperator 三目运算符(三元运算符)

!!!: 传参 ifValue 和 elseValue,如果涉及复杂运算(调用方法或函数...),还是老老实实使用 if else 吧.

func Xnor

func Xnor[T, U any](a T, b U) bool

Xnor 如果a和b都是真的或a和b均是假的,则返回true

func Xor

func Xor[T, U any](a T, b U) bool

Xor 逻辑异或操作,a和b相同返回false,a和b不相同返回true

Types

This section is empty.

Jump to

Keyboard shortcuts

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