Documentation
¶
Index ¶
Constants ¶
View Source
const ( FileModeOnlyRead os.FileMode = 0444 FileModeReadWrite os.FileMode = 0666 )
FileMode
View Source
const (
DefaultReadBufferLength = 1024
)
DefaultReadBufferLength default reader buffer length
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileRepo ¶
type FileRepo interface {
Open(file string) (*FileInfo, error)
OpenFile(file string, flag int, perm os.FileMode) (*FileInfo, error)
// judge if file is opening
FileOpened(string) bool
// get information with file name
FileInfo(name string) (os.FileInfo, error)
// close the file
Close(file string) error
// close all files which were opened
CloseAll() error
// read file
Read(string) (b []byte, n int, err error)
// rewrite file with context
Write(name, context string, opts ...WriteOption) (int, error)
WriteBytes(name string, b []byte, opts ...WriteOption) (int, error)
// append context to the file
WriteAppend(name, context string, opts ...WriteOption) (int, error)
WriteAppendBytes(name string, b []byte, opts ...WriteOption) (int, error)
// rename file
Rename(oldpath, newpath string) error
// set length of buffer to read file, default: 1024
SetReadBufLength(int64) error
}
FileRepo execute file functions
func NewFileRepo ¶ added in v0.21.16
NewFileRepo return an new constraction of FileRepo
type Option ¶ added in v0.21.13
type Option func(*Options)
func ConcurrencyRead ¶ added in v0.21.17
func ConcurrencyRead() Option
func ReadBufferLength ¶
type WriteOption ¶ added in v0.21.13
type WriteOption func(*WriteOptions)
func WriteFlag ¶ added in v0.21.13
func WriteFlag(flag int) WriteOption
type WriteOptions ¶ added in v0.21.13
type WriteOptions struct {
Flag *int
}
Click to show internal directories.
Click to hide internal directories.