README ¶ Storer 配置存储器 storer是用于存储运行配置的存储器,可以提供存、取一串string配置,只能存取一个字符串数据 调用Truncate() (err error)清空数据 调用WriterString(data string) error方法可以写入数据 调用ReadString() (data string, err error)则读出数据 数据的parse与format需要自行处理 fileStorre提供了一个storer的基于文件的实现 需要用MustNewFileStorer方法来初始化 Expand ▾ Collapse ▴ Documentation ¶ Index ¶ type FileStorer func (storer *FileStorer) Read() (data []byte, err error) func (storer *FileStorer) Truncate() (err error) func (storer *FileStorer) Writer(data []byte) error type Storer func MustNewFileStorer(filePath string) Storer Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ This section is empty. Types ¶ type FileStorer ¶ type FileStorer struct { // contains filtered or unexported fields } FileStorer 文件配置存储器 func (*FileStorer) Read ¶ func (storer *FileStorer) Read() (data []byte, err error) Read 读取配置 func (*FileStorer) Truncate ¶ func (storer *FileStorer) Truncate() (err error) Truncate 清空配置 func (*FileStorer) Writer ¶ func (storer *FileStorer) Writer(data []byte) error Writer 刷写配置 type Storer ¶ type Storer interface { // Writer 刷写配置 Writer(data []byte) error // Read 读取配置 Read() (data []byte, err error) // Truncate 清空配置 Truncate() (err error) } Storer 运行时存储器 func MustNewFileStorer ¶ func MustNewFileStorer(filePath string) Storer MustNewFileStorer 创建文件配置存储器 Source Files ¶ View all Source files filestorer.go storer.go Click to show internal directories. Click to hide internal directories.