tag

package
v1.0.40 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package tag 标签方法.

Index

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

func Tag added in v1.0.40

func Tag[E constraints.Integer](elems ...E) E

Tag 合并成标签.

Types

This section is empty.

Jump to

Keyboard shortcuts

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