Documentation ¶
Index ¶
- func Byte2Ints[T constraints.Integer](n T, b byte) []T
- func DecodeID(id uint64) (uint64, uint64, uint64)
- func ID() uint64
- func Int2Byte[T constraints.Integer](i T) (T, byte)
- func NewID(num uint64) uint64
- func Rand() uint64
- type BitMap
- func (t *BitMap[T]) Add(elems ...T) BitMap[T]
- func (t *BitMap[T]) AddBitMap(elem BitMap[T]) BitMap[T]
- func (t BitMap[T]) All(elems ...T) bool
- func (t BitMap[T]) Any(elems ...T) bool
- func (t BitMap[T]) Bytes() []byte
- func (t BitMap[T]) Count() int
- func (t BitMap[T]) Del(elems ...T) BitMap[T]
- func (t BitMap[T]) DelBitMap(elem BitMap[T]) BitMap[T]
- func (t BitMap[T]) Has(tag T) bool
- func (t BitMap[T]) Join(sep string) string
- func (t *BitMap[T]) Load(bs []byte)
- func (t BitMap[T]) Slice() []T
- func (t BitMap[T]) String() string
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Byte2Ints ¶ added in v0.3.20
func Byte2Ints[T constraints.Integer](n T, b byte) []T
Byte2Ints 字节码转换整数. nolint
func ID ¶
func ID() uint64
ID 获取ID.
Example ¶
package main import ( "fmt" "github.com/xuender/oils/dbs" ) func main() { fmt.Println(dbs.ID()) fmt.Println(dbs.ID()) }
Output:
func Int2Byte ¶ added in v0.3.20
func Int2Byte[T constraints.Integer](i T) (T, byte)
Int2Byte 整数转换字节码.
Types ¶
type BitMap ¶ added in v0.3.20
type BitMap[T constraints.Integer] []byte
BitMap 位图.
Example ¶
package main import ( "fmt" "github.com/xuender/oils/dbs" ) func main() { tag := dbs.NewBitMap(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 v0.3.20
func Intersection[T constraints.Integer](elems ...BitMap[T]) BitMap[T]
Intersection 交集. nolint
func NewBitMap ¶ added in v0.3.20
func NewBitMap[T constraints.Integer](elems ...T) BitMap[T]
NewBitMap 新建位图.
Click to show internal directories.
Click to hide internal directories.