Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Spec ¶
type Spec struct {
// A sequence of Token structs that indicates the new row layout.
Tokens []Token `json:"tokens"`
// CSV separator character.
Comma string `json:"comma"`
// Decimal separator for currency.
CurrSep string `json:"curr_sep"`
}
Spec is derived from a user-provided string pattern. It contains information about the structure of the output CSV file.
func ParsePattern ¶
ParsePattern converts user input into a Specification struct.
type Token ¶
type Token struct {
// Indicates the value type stored in a Token struct.
Type TokenType `json:"type"`
// Column number. Content of the indicated column will be substituted
// in place of this token during compilation process.
Column int `json:"column"`
// Arbitrary text that will be inserted as is during compilation process.
Text string `json:"text"`
}
Token is an union-like type. It stores either CSV column number or an arbitrary text to be inserted.
func NewColumnToken ¶
Creates a new Token containing specified column number.
func NewNoModToken ¶ added in v0.6.0
func NewNoModToken() Token
Creates a new special Token that prevents any column modifications.
func NewTextToken ¶
Creates a new Token containing specified text.
type TokenType ¶
type TokenType byte
Indicates a type of value stored in a Token struct.
const ( // Indicates that Token stores Column. TT_COLUMN TokenType = 'd' // Indicates that Token stores Column with currency that requires // formatting. Unlike the regular TT_COLUMN type, currency Column will be // converted into a specified currency format. TT_CURRENCY_COLUMN TokenType = 'c' // Indicates that no column modifications should be performed. TT_NO_MOD TokenType = '*' // Indicates that Token stores Text. TT_TEXT TokenType = 's' )
Click to show internal directories.
Click to hide internal directories.