core

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRandomString

func GenerateRandomString(length uint64) (string, error)

生成指定长度的随机字符串,包含大小写字母和数字

func GetFormatValue

func GetFormatValue(bytes uint64) string

B(字节) KB(千字节,1KB = 1024B) MB(兆字节,1MB = 1024KB) GB(吉字节,1GB = 1024MB) TB(太字节,1TB = 1024GB) PB(拍字节,1PB = 1024TB) EB(艾字节,1EB = 1024PB) ZB(泽字节,1ZB = 1024EB) YB(尧字节,1YB = 1024ZB) 转换字节数为人类可读格式

func GetNanoID

func GetNanoID() uint64

func GetRand

func GetRand(min, max int) int

生成随机数

Types

type CRC16

type CRC16 struct {
	Value uint16
}

func NewCRC16

func NewCRC16() *CRC16

func (*CRC16) Calc

func (c *CRC16) Calc(data []byte)

func (*CRC16) GetValue

func (c *CRC16) GetValue() uint16

type Config

type Config struct {
}

func GetConfig

func GetConfig() *Config

func (*Config) LoadConfig

func (c *Config) LoadConfig() error

func (*Config) SaveConfig

func (c *Config) SaveConfig() error

type List

type List[T any] struct {
	// contains filtered or unexported fields
}

List 基于切片实现的列表结构

func NewList

func NewList[T any]() *List[T]

NewList 创建一个新的列表

func (*List[T]) Append

func (l *List[T]) Append(element T)

Append 在列表末尾添加元素

func (*List[T]) Clear

func (l *List[T]) Clear()

Clear 清空列表

func (*List[T]) Contains

func (l *List[T]) Contains(element T, equals func(a, b T) bool) bool

Contains 检查列表是否包含指定元素(需要提供相等性比较函数)

func (*List[T]) Get

func (l *List[T]) Get(index int) (T, error)

Get 获取指定索引的元素

func (*List[T]) IndexOf

func (l *List[T]) IndexOf(element T, equals func(a, b T) bool) int

IndexOf 查找元素在列表中的索引(需要提供相等性比较函数)

func (*List[T]) Insert

func (l *List[T]) Insert(index int, element T) error

Insert 在指定索引位置插入元素

func (*List[T]) Len

func (l *List[T]) Len() int

Len 返回列表长度

func (*List[T]) Remove

func (l *List[T]) Remove(index int) (T, error)

Remove 删除指定索引的元素

func (*List[T]) ToSlice

func (l *List[T]) ToSlice() []T

ToSlice 将列表转换为切片

Source Files

  • List.go
  • config.go
  • core.go
  • crc.go

Jump to

Keyboard shortcuts

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