base

package
v1.0.50 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: MIT Imports: 0 Imported by: 10

README

base

基础函数。

Result1

返回第1个结果。

fmt.Println(base.Result1(1, 2, 3, 4))

// 1

[play]

Result2

返回第2个结果。

fmt.Println(base.Result2(1, 2, 3, 4))

// 2

[play]

Result3

返回第3个结果。

fmt.Println(base.Result3(1, 2, 3, 4))

// 3

[play]

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

View Source
var None = struct{}{}

nolint: gochecknoglobals

Functions

func Result1 added in v1.0.4

func Result1[R any](r R, _ ...any) R

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

func Result2[R any](_ any, r R, _ ...any) R

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

func Result3[R any](_, _ any, r R, _ ...any) R

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

func Result4[R any](_, _, _ any, r R, _ ...any) R

Result4 返回第4个参数.

Example
package main

import (
	"fmt"

	"github.com/xuender/kit/base"
)

func main() {
	fmt.Println(base.Result4(1, 2, 3, 4))

}
Output:

4

Types

This section is empty.

Jump to

Keyboard shortcuts

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