Documentation ¶
Overview ¶
Package base 基础函数.
Index ¶
Examples ¶
Constants ¶
View Source
const ( Three = 3 Five = 5 Six = 6 Seven = 7 Nine = 9 Ten = 10 Fifteen = 15 TwentyFour = 24 Thirty = 30 Sixty = 60 Hundred = 100 Million = 1e6 HundredMillion = 1e8 Billion = 1e9 )
View Source
const ( One = 1 << iota Two Four Eight Sixteen ThirtyTwo SixtyFour OneHundredTwentyEight TwoHundredFiftySix FiveHundredTwelve Kilo )
Variables ¶
This section is empty.
Functions ¶
func EveryNil ¶ added in v1.0.4
EveryNil 检查所有元素是否都为 nil.
Example ¶
package main import ( "fmt" "github.com/xuender/kit/base" ) func main() { fmt.Println(base.EveryNil()) fmt.Println(base.EveryNil(nil)) fmt.Println(base.EveryNil(nil, nil)) fmt.Println(base.EveryNil(1)) fmt.Println(base.EveryNil(1, nil)) }
Output: true true true false false
func Result1 ¶ added in v1.0.4
Result1 返回第1个参数.
Example ¶
package main import ( "fmt" "strconv" "github.com/xuender/kit/base" ) func main() { fmt.Println(base.Result1(1, 2, 3, 4)) fmt.Println(base.Result1(strconv.ParseInt("2", 10, 64))) }
Output: 1 2
func Result2 ¶ added in v1.0.4
Result2 返回第2个参数.
Example ¶
package main import ( "fmt" "os" "github.com/xuender/kit/base" ) func main() { fmt.Println(base.Result2(1, 2, 3, 4)) fmt.Println(os.IsNotExist(base.Result2(os.Stat("not exist")))) }
Output: 2 true
func Result3 ¶ added in v1.0.4
Result3 返回第3个参数.
Example ¶
package main import ( "fmt" "github.com/xuender/kit/base" ) func main() { fmt.Println(base.Result3(1, 2, 3, 4)) }
Output: 3
func Result4 ¶ added in v1.0.5
Result4 返回第4个参数.
Example ¶
package main import ( "fmt" "github.com/xuender/kit/base" ) func main() { fmt.Println(base.Result4(1, 2, 3, 4)) }
Output: 4
func SomeNil ¶ added in v1.0.4
SomeNil 检查是否有元素为 nil.
Example ¶
package main import ( "fmt" "github.com/xuender/kit/base" ) func main() { fmt.Println(base.SomeNil()) fmt.Println(base.SomeNil(nil)) fmt.Println(base.SomeNil(nil, nil)) fmt.Println(base.SomeNil(1)) fmt.Println(base.SomeNil(1, nil)) }
Output: true true true false true
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.