Documentation
¶
Overview ¶
Package csv 主要实现了stream/file的接口
Index ¶
- func NewInStream(filename string) (file.InStream, error)
- func NewOutStream(filename string) (file.OutStream, error)
- func NewRows(f *os.File, c *config.JSON) (file.Rows, error)
- func NewWriter(f *os.File, c *config.JSON) (file.StreamWriter, error)
- type Column
- type Creator
- type InConfig
- type Opener
- type OutConfig
- type Rows
- type Stream
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewInStream ¶
NewInStream 创建一个名为filename的csv输入流
func NewOutStream ¶
NewOutStream 创建一个名为filename的csv输出流
Types ¶
type Column ¶
type Column struct {
Index string `json:"index"` // 索引 从1开始,代表第几列
Type string `json:"type"` // 类型 bool bigInt decimal string time
Format string `json:"format"` // joda时间格式
// contains filtered or unexported fields
}
Column 列信息
type InConfig ¶
type InConfig struct {
Columns []Column `json:"column"` // 列信息
Encoding string `json:"encoding"` // 编码
Delimiter string `json:"delimiter"` // 分割符
NullFormat string `json:"nullFormat"` // null文本
StartRow int `json:"startRow"` // 读取开始行数,从1开始
Comment string `json:"comment"` // 注释
Compress string `json:"compress"` // 压缩
}
InConfig csv配置
type OutConfig ¶
type OutConfig struct {
Columns []Column `json:"column"` // 列信息
Encoding string `json:"encoding"` // 编码
Delimiter string `json:"delimiter"` // 分割符
NullFormat string `json:"nullFormat"` // null文本
HasHeader bool `json:"hasHeader"` // 是否有列头
Header []string `json:"header"` // 列头
Compress string `json:"compress"` // 压缩
}
OutConfig csv配置
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream csv文件流
Click to show internal directories.
Click to hide internal directories.