Documentation ¶
Overview ¶
参考Python的DictReader
参考Python的DictReader
Index ¶
- func CountLines(r io.Reader) (n int, err error)
- type MapReader
- type MapWriter
- func (w *MapWriter) Flush()
- func (w *MapWriter) Init(params csv.Writer)
- func (w *MapWriter) SetFieldNotSetErr(fieldNotSetErr bool)
- func (w *MapWriter) SetHeader(fieldnames []string)
- func (w *MapWriter) WriteHeader() (err error)
- func (w *MapWriter) WriteRow(row map[string]string) (err error)
- func (w *MapWriter) WriteRows(rows []map[string]string) (err error)
- type Reader
- func (r *Reader) GetFieldnames() (fieldnames []string, err error)
- func (r *Reader) Init(params csv.Reader)
- func (r *Reader) Read() (record []string, err error)
- func (r *Reader) ReadAll() (records [][]string, err error)
- func (r *Reader) SetFieldnames(fieldnames []string)
- func (r *Reader) SetLimit(limit int)
- func (r *Reader) SetSkip(skip int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MapReader ¶
type MapReader struct {
Reader
}
func NewMapReader ¶
type MapWriter ¶
func NewMapWriterSimple ¶
NewMapWriterSimple 简化的writer对象,可以通过SetHeader方法来设置Header
func (*MapWriter) SetFieldNotSetErr ¶
SetFieldNotSetErr 字段未设置时,是否报错 默认为false,即当字段为设置时,会自动使用空字符串补充
func (*MapWriter) WriteHeader ¶
type Reader ¶
func (*Reader) GetFieldnames ¶
GetFieldnames 获取csv文件的header csv文件在处理的时候,可能会最后会出现空字段 Error: Multiple indices with the same name ”
func (*Reader) SetFieldnames ¶
SetFieldnames 指定csv文件的字段名 如果不指定的话,则默认使用csv文件的第一行作为字段名
Click to show internal directories.
Click to hide internal directories.