gotool

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: MIT Imports: 10 Imported by: 11

README

GoTool

GoTool 是一套 Golang 工具包,提供了丰富的开发过程中所需的工具包,助力 Golang 高效开发 ~

GoTool 使用手册

https://www.lesscode.work/courses/info/48ea02ffbbb7fd6bbcd137e32e8aa547.html

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Root string
View Source
var SystemSeparator string

Functions

func GetLocalIP

func GetLocalIP() string

func GetNetworkIP

func GetNetworkIP() string

func ReadTCPResponse added in v0.0.2

func ReadTCPResponse(conn net.Conn) ([]byte, error)

读取TCP连接二进制消息

func WriteTCPResponse added in v0.0.2

func WriteTCPResponse(conn net.Conn, msg []byte) error

响应TCP连接二进制消息

Types

type BinaryDataFileIndexStruct

type BinaryDataFileIndexStruct struct {
	Position uint64 // 8字节
	Size     uint64 // 8字节
}

type BinaryFile

type BinaryFile struct {
	DataDir               string
	DataFilePath          string
	DataFile              *os.File
	IndexFilePath         string
	IndexFile             *os.File
	SuperDataNumberFile   *os.File
	CurrentPosition       int64
	SupperSaveIndexNumber int64
	MaxDataNumberPerFile  uint64
	WriteChannel          chan int64
}

func NewBinaryFile

func NewBinaryFile(dataDir string, maxDataNumberPerFile uint64) *BinaryFile

初始化

func (*BinaryFile) Close

func (bf *BinaryFile) Close()

关闭

func (*BinaryFile) InitFiles

func (bf *BinaryFile) InitFiles(startIndex uint64, action string) error

func (*BinaryFile) PrepareForWrite

func (bf *BinaryFile) PrepareForWrite() error

func (*BinaryFile) Read

func (bf *BinaryFile) Read(startIndex uint64, length int) ([][]byte, error)

通过索引读取数据

func (*BinaryFile) Write

func (bf *BinaryFile) Write(data []byte) error

写入内容

Jump to

Keyboard shortcuts

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