Documentation ¶
Overview ¶
Package tag 标签方法.
Index ¶
- func Add[E constraints.Integer](tag E, elems ...E) E
- func Del[E constraints.Integer](tag E, elems ...E) E
- func Get[E constraints.Integer](tag E) []E
- func Has[E constraints.Integer](tag E, elems ...E) bool
- func Hit[E constraints.Integer](tag E, elems ...E) bool
- func Tag[E constraints.Integer](elems ...E) E
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Add ¶
func Add[E constraints.Integer](tag E, elems ...E) E
Add 增加.
Example ¶
ExampleAdd 增加例子.
package main import ( "fmt" "github.com/xuender/kit/tag" ) func main() { num := tag.Add(0, 3, 4) fmt.Println(num) }
Output: 24
func Del ¶
func Del[E constraints.Integer](tag E, elems ...E) E
Del 删除.
Example ¶
ExampleDel 删除例子.
package main import ( "fmt" "github.com/xuender/kit/tag" ) func main() { num := tag.Del(tag.Tag(3, 4), 3, 5) fmt.Println(num) }
Output: 16
func Get ¶ added in v1.0.40
func Get[E constraints.Integer](tag E) []E
Get 获取标签.
Example ¶
ExampleGet 获取例子.
package main import ( "fmt" "github.com/xuender/kit/tag" ) func main() { num := tag.Tag(1, 2) nums := tag.Get(num) fmt.Println(nums) }
Output: [1 2]
func Has ¶
func Has[E constraints.Integer](tag E, elems ...E) bool
Has 包含任何一个标签.
Example ¶
ExampleHas 包含例子.
package main import ( "fmt" "github.com/xuender/kit/tag" ) func main() { num := tag.Tag(3, 4) fmt.Println(tag.Has(num, 3)) fmt.Println(tag.Has(num, 3, 4)) fmt.Println(tag.Has(num, 2)) fmt.Println(tag.Has(num, 3, 2)) }
Output: true true false true
func Hit ¶
func Hit[E constraints.Integer](tag E, elems ...E) bool
Hit 命中所有标签.
Example ¶
ExampleHit 命中例子.
package main import ( "fmt" "github.com/xuender/kit/tag" ) func main() { num := tag.Tag(3, 4) fmt.Println(tag.Hit(num, 3)) fmt.Println(tag.Hit(num, 3, 4)) fmt.Println(tag.Hit(num, 2)) fmt.Println(tag.Hit(num, 2, 3, 4)) }
Output: true true false false
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.