Documentation ¶
Index ¶
- type CsvSliceToRecordFunc
- type Meta
- type Record
- type RecordToCsvFunc
- type Table
- func (t *Table) GetRecords(cond ...func(r Record, m Meta) bool) []Record
- func (t *Table) GetRecordsAndMeta(cond ...func(r Record, m Meta) bool) (rs []Record, ms []Meta)
- func (t *Table) Insert(record Record) error
- func (t *Table) Read() error
- func (t *Table) RemoveRecordById(id int) error
- func (t *Table) SetRecordByCond(new Record, cond ...func(r Record, m Meta) bool) error
- func (t *Table) SetRecordById(new Record, id int) error
- func (t *Table) WriteAll() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CsvSliceToRecordFunc ¶
type RecordToCsvFunc ¶
type Table ¶
type Table struct { //文件路径 FileName string //数据开始行,值从0开始 默认1 第一行一般为列名 StartRow int Comma, Comment rune UseCRLF bool // contains filtered or unexported fields }
csv操作封装 为了便于操作 数据采用map存储
func NewTable ¶
func NewTable(filename string, f1 RecordToCsvFunc, f2 CsvSliceToRecordFunc) *Table
func (*Table) GetRecords ¶
按条件查找记录
func (*Table) GetRecordsAndMeta ¶
按条件查找记录
func (*Table) SetRecordByCond ¶
按条件更新记录
Click to show internal directories.
Click to hide internal directories.