tags

package
v1.1.23 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package tags 标签记录.

包括 打标,搜索等.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Byte2Ints

func Byte2Ints[T constraints.Integer](n T, b byte) []T

Byte2Ints 字节码转换整数. nolint

func Int2Byte

func Int2Byte[T constraints.Integer](i T) (T, byte)

Int2Byte 整数转换字节码.

Types

type Tags

type Tags[T constraints.Integer] []byte

Tags 标签.

Example
package main

import (
	"fmt"

	"gitee.com/xuender/oils/tags"
)

func main() {
	tag := tags.NewTags(1, 2, 33)

	fmt.Println(tag.Has(1))
	fmt.Println(tag.Has(3))
	fmt.Println(tag.Has(33))
	fmt.Println(tag)

}
Output:

true
false
true
1, 2, 33

func Intersection added in v1.0.27

func Intersection[T constraints.Integer](elems ...Tags[T]) Tags[T]

Intersection 交集. nolint

func NewTags

func NewTags[T constraints.Integer](elems ...T) Tags[T]

NewTags 新建标签.

func (*Tags[T]) Add

func (t *Tags[T]) Add(elems ...T) Tags[T]

Add 增加标签.

func (*Tags[T]) AddTags added in v1.0.9

func (t *Tags[T]) AddTags(elem Tags[T]) Tags[T]

AddTags 增加标签.

func (Tags[T]) All

func (t Tags[T]) All(elems ...T) bool

All 全部包含.

func (Tags[T]) Any

func (t Tags[T]) Any(elems ...T) bool

Any 包含任意.

func (Tags[T]) Bytes added in v1.0.30

func (t Tags[T]) Bytes() []byte

Bytes 字节码.

func (Tags[T]) Count added in v1.0.24

func (t Tags[T]) Count() int

Count 标签数量.

func (Tags[T]) Del

func (t Tags[T]) Del(elems ...T) Tags[T]

Del 删除标签.

func (Tags[T]) DelTags added in v1.0.9

func (t Tags[T]) DelTags(elem Tags[T]) Tags[T]

DelTags 删除标签.

func (Tags[T]) Has

func (t Tags[T]) Has(tag T) bool

Has 包含标签.

func (Tags[T]) Join

func (t Tags[T]) Join(sep string) string

Join 集合连接.

func (*Tags[T]) Load added in v1.0.30

func (t *Tags[T]) Load(bs []byte)

Load 加载.

func (Tags[T]) Slice

func (t Tags[T]) Slice() []T

Slice 转换切片.

func (Tags[T]) String

func (t Tags[T]) String() string

String 字符串.

Jump to

Keyboard shortcuts

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