Documentation ¶
Index ¶
- Constants
- Variables
- func Address(r io.Reader, w io.Writer, o AddressOption) error
- func Append(r io.Reader, w io.Writer, o AppendOption) error
- func Blank(r io.Reader, w io.Writer, o BlankOption) error
- func Building(r io.Reader, w io.Writer, o BuildingOption) error
- func Collect(r io.Reader, w io.Writer, o CollectOption) error
- func Combine(r io.Reader, w io.Writer, o CombineOption) error
- func Convert(r io.Reader, w io.Writer, o ConvertOption) error
- func Count(r io.Reader, o CountOption) (int, error)
- func Email(r io.Reader, w io.Writer, o EmailOption) error
- func Extract(r io.Reader, w io.Writer, o ExtractOption) error
- func Filter(r io.Reader, w io.Writer, o FilterOption) error
- func Generate(w io.Writer, o GenerateOption) error
- func Header(r io.Reader, w io.Writer, o HeaderOption) error
- func Insert(r io.Reader, w io.Writer, o InsertOption) error
- func Name(r io.Reader, w io.Writer, o NameOption) error
- func NewReader(r io.Reader) (*csv.Reader, bool)
- func NewReaderWithEnc(r io.Reader, e encoding.Encoding) *csv.Reader
- func NewWriter(w io.Writer, bom bool) *csv.Writer
- func NewWriterWithEnc(w io.Writer, e encoding.Encoding) *csv.Writer
- func Numeric(r io.Reader, w io.Writer, o NumericOption) error
- func Password(r io.Reader, w io.Writer, o PasswordOption) error
- func Remove(r io.Reader, w io.Writer, o RemoveOption) error
- func Size(r io.Reader, o SizeOption) (int, error)
- func Sort(r io.Reader, w io.Writer, o SortOption) error
- func Substitute(r io.Reader, w io.Writer, o SubstituteOption) error
- func Tail(r io.Reader, w io.Writer, o TailOption) error
- func Tel(r io.Reader, w io.Writer, o TelOption) error
- func Top(r io.Reader, w io.Writer, o TopOption) error
- func UTF8BOM() []byte
- type AddressOption
- type AppendOption
- type BlankOption
- type BuildingOption
- type CSVProcessor
- type CollectOption
- type CombineOption
- type ConvertOption
- type CountOption
- type EmailOption
- type ExtractOption
- type FilterOption
- type GenerateOption
- type HeaderOption
- type InsertOption
- type NameOption
- type NumericOption
- type PasswordOption
- type RemoveOption
- type SizeOption
- type SortOption
- type SubstituteOption
- type TailOption
- type TelOption
- type TopOption
Constants ¶
const ( // SortDataTypeText is used when want use value as text. SortDataTypeText = "text" // SortDataTypeNumber is used when want use value as number. SortDataTypeNumber = "number" // EmptyNatural is used when empty string is ordered in natural. EmptyNatural = "natural" // EmptyFirst is used when empty string is ordered in first. EmptyFirst = "first" // EmptyLast is used when empty string is ordered in last. EmptyLast = "last" )
Variables ¶
var Version = semver.Version{
Major: 0,
Minor: 24,
Patch: 0,
}
Version of csvutil.
Functions ¶
func NewReader ¶
NewReader returns *csv.Reader for UTF8. If source has BOM, returns true as second return value.
func NewReaderWithEnc ¶
NewReaderWithEnc returns *csv.Reader for given encoding.
func NewWriter ¶
NewWriter returns *csv.Writer for UTF8. If true is given as bom, Writer writes BOM at the top.
func NewWriterWithEnc ¶
NewWriterWithEnc returns *csv.Writer for given encoding.
func Password ¶ added in v0.20.0
Password overwrite value of given column by dummy password address.
func Substitute ¶ added in v0.16.0
Substitute value of given column.
Types ¶
type AddressOption ¶
type AddressOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output. OutputEncoding string // ZipCode column symbol. ZipCode string // Prefecture column symbol. Prefecture string // Output prefecture code. PrefectureCode bool // City column symbol. City string // Town column symbol. Town string // BlockNumber output flag. BlockNumber bool // BlockNumber width(1 or 2) NumberWidth int }
AddressOption is option holder for Address.
type AppendOption ¶
type AppendOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output. OutputEncoding string // Headers is appending header list. Headers []string // Size is appending column size. Size int }
AppendOption is option holder for Append.
type BlankOption ¶
type BlankOption struct { // Source file does not have hdr line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output. OutputEncoding string // ColumnSyms hdr or column index list. ColumnSyms []string // Rate of fill Rate int // Space character width. // 0: no space(empaty) // 1: half space // 2: full width space SpaceWidth int // Space character count. SpaceSize int }
BlankOption is option holder for Blank.
type BuildingOption ¶
type BuildingOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output OutputEncoding string // Target column symbol Column string // Rate of office output OfficeRate int // BlockNumber width(1 or 2) NumberWidth int // Append to source value Append bool }
BuildingOption is option holder for Building.
type CSVProcessor ¶ added in v0.15.1
type CSVProcessor struct {
// contains filtered or unexported fields
}
CSVProcessor process CSV read from csv.Reader, and write to csv.Writer.
func NewCSVProcessor ¶ added in v0.15.1
func NewCSVProcessor(r *csv.Reader, w *csv.Writer) *CSVProcessor
NewCSVProcessor returns new processor from reader and writer.
func NewReadOnlyCSVProcessor ¶ added in v0.19.0
func NewReadOnlyCSVProcessor(r *csv.Reader) *CSVProcessor
NewReadOnlyCSVProcessor returns new processor from reader. Processor does not write to CSV.
func (*CSVProcessor) Process ¶ added in v0.15.1
func (csvp *CSVProcessor) Process() error
Process CSV. Read each line and apply each functions and write line.
func (*CSVProcessor) SetHeaderHanlder ¶ added in v0.15.1
func (csvp *CSVProcessor) SetHeaderHanlder(f func([]string) ([]string, error))
SetHeaderHanlder set function for calling on header line read.
func (*CSVProcessor) SetPreBodyRead ¶ added in v0.15.1
func (csvp *CSVProcessor) SetPreBodyRead(f func() error)
SetPreBodyRead set function for calling before first body line read.
func (*CSVProcessor) SetRecordHandler ¶ added in v0.15.1
func (csvp *CSVProcessor) SetRecordHandler(f func([]string) ([]string, error))
SetRecordHandler set function for calling on each body line read.
type CollectOption ¶ added in v0.19.0
type CollectOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output. OutputEncoding string // Column symbol of target column Column string // AllowEmpty as value AllowEmpty bool // Print count PrintCount bool // Sort flag Sort bool // Sort key (value or count) SortKey string // Sort in descending order Descending bool }
CollectOption is option holder for Collect.
type CombineOption ¶ added in v0.15.1
type CombineOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output. OutputEncoding string // SourceSyms header or column index list SourceSyms []string // Destination column symbol Destination string // Delimiter Delimiter string }
CombineOption is option holder for Combine.
type ConvertOption ¶ added in v0.21.0
type ConvertOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Format of converter Format string // Template for convert Template string // HTML custom template is given HTML bool }
ConvertOption is option holder for Convert.
type CountOption ¶
type CountOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string }
CountOption is option holder for Count.
type EmailOption ¶
type EmailOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output. OutputEncoding string // Target column symbol. Column string // Rate of output mobile email address. MobileRate int }
EmailOption is option holder for Email.
type ExtractOption ¶
type ExtractOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output. OutputEncoding string // ColumnSyms header or column index list. ColumnSyms []string }
ExtractOption is option holder for Extract.
type FilterOption ¶ added in v0.22.0
type FilterOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output OutputEncoding string // ColumnSyms header or column index list. ColumnSyms []string // Target pattern Pattern string // Use regexp Regexp bool // contains filtered or unexported fields }
FilterOption is option holder for Filter.
type GenerateOption ¶
type GenerateOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding for output. OutputEncoding string // Headers is appending header list. Headers []string // Size is generating column size. Size int // Count is generating line count. Count int }
GenerateOption is option holder for Generate.
type HeaderOption ¶
type HeaderOption struct { // Encoding of source file. (default utf8) Encoding string // Encoding for output. OutputEncoding string // Print index Index bool // Index origin number IndexOrigin int }
HeaderOption is option holder for Header.
type InsertOption ¶
type InsertOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output. OutputEncoding string // Headers is header list for insert. Headers []string // Size is appending column size. Size int // Before is insert start column symbol. Before string }
InsertOption is option holder for Insert.
type NameOption ¶
type NameOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output OutputEncoding string // ZipCode column symbol ZipCode string // Full name column symbol Name string // First name column symbol FirstName string // Last name column symbol LastName string // Kana of full name column symbol Kana string // Kana of first name column symbol FirstKana string // Kana of last name column symbol LastKana string // Output hiragana as kana Hiragana bool // Gender column symbol Gender string // Gender format GenderFormat string // Rate of male output MaleRate int // Reference column symbol Reference string // Ignore reference error RistrictReference bool // Delimiter space width SpaceWidth int }
NameOption is option holder for Name.
type NumericOption ¶ added in v0.24.0
type NumericOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output. OutputEncoding string // Target column symbol. Column string // Max value Max int // Min value Min int // Output decimal instead of integer Decimal bool // Digit of decimal DecimalDigit int }
NumericOption is option holder for Numeric.
type PasswordOption ¶ added in v0.20.0
type PasswordOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output. OutputEncoding string // Target column symbol. Column string // MinLength of password MinLength int // MaxLength of password MaxLength int // NoNumeric not using number flag NoNumeric bool // NoUpeer not using upper alphabets flag NoUpper bool // NoSpecial not using marks flag NoSpecial bool }
PasswordOption is option holder for Password.
type RemoveOption ¶
type RemoveOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output. OutputEncoding string // ColumnSyms header or column index list. ColumnSyms []string }
RemoveOption is option holder for Remove.
type SizeOption ¶
type SizeOption struct { // Encoding of source file. (default utf8) Encoding string }
SizeOption is option holder for Size.
type SortOption ¶ added in v0.24.0
type SortOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output. OutputEncoding string // Column symbol of target column Column string // DataType is sort key's data type DataType string // Sort in descending order Descending bool // Handling method of empty string EmptyHandling string }
SortOption is option holder for Sort.
type SubstituteOption ¶ added in v0.16.0
type SubstituteOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output OutputEncoding string // Target column symbol Column string // Target pattern Pattern string // Replacement value Replacement string // Use regexp Regexp bool // contains filtered or unexported fields }
SubstituteOption is option holder for Substitute.
type TailOption ¶ added in v0.18.0
type TailOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output. OutputEncoding string // Count is reading line count. Count int }
TailOption is option holder for Tail.
type TelOption ¶
type TelOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output. OutputEncoding string // Target column symbol. Column string // Rate of output mobile tel number. MobileRate int }
TelOption is option holder for Tel.
type TopOption ¶ added in v0.18.0
type TopOption struct { // Source file does not have header line. (default false) NoHeader bool // Encoding of source file. (default utf8) Encoding string // Encoding for output. OutputEncoding string // Headers is appending header list. Headers []string // Count is reading line count. Count int }
TopOption is option holder for Top.
Source Files ¶
- address.go
- append.go
- blank.go
- building.go
- collect.go
- column.go
- combine.go
- convert.go
- count.go
- csv_processor.go
- csvutil.go
- email.go
- extract.go
- fake_building.go
- filter.go
- generate.go
- header.go
- insert.go
- name.go
- numeric.go
- password.go
- remove.go
- size.go
- sort.go
- substitute.go
- tail.go
- tel.go
- top.go
- utility.go
- version.go