part

package
v0.10.9 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: MIT Imports: 8 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFilePathTooLong  = errors.New("ErrFilePathTooLong")
	ErrNewFileCantSeed  = errors.New("ErrNewFileCantSeed")
	ErrFailToLock       = errors.New("ErrFailToLock")
	ErrMaxReadSizeReach = errors.New("ErrMaxReadSizeReach")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	FilePath  string //文件路径
	CurIndex  int64  //初始化光标位置
	AutoClose bool   //自动关闭句柄

	// wrap with encoder
	//https://pkg.go.dev/golang.org/x/text/encoding#section-directories
	Coder encoder.Encoding
}

type File

type File struct {
	Config Config

	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New(filePath string, curIndex int64, autoClose bool) *File

func (*File) Close

func (t *File) Close() error

func (*File) CopyTo

func (t *File) CopyTo(to *File, byteInSec int64, tryLock bool) error

func (*File) Delete

func (t *File) Delete() error

func (*File) IsExist added in v0.10.2

func (t *File) IsExist() bool

func (*File) Read

func (t *File) Read(data []byte) (int, error)

func (*File) ReadUntil

func (t *File) ReadUntil(separation byte, perReadSize int, maxReadSize int) (data []byte, e error)

func (*File) Seed

func (t *File) Seed(index int64) (e error)

func (*File) Sync added in v0.10.4

func (t *File) Sync() (e error)

func (*File) Write

func (t *File) Write(data []byte, tryLock bool) (int, error)

Jump to

Keyboard shortcuts

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