Documentation ¶
Index ¶
- Constants
- Variables
- func AppendStrIfNotExist(list []string, elem string) []string
- func EnclosedEnvironmentVariableSymbol(s string) string
- func EnvironmentVariableSymbol(s string) string
- func EscapeIdentifier(s string) string
- func EscapeString(s string) string
- func FlagSymbol(s string) string
- func FormatInt(i int, thousandsSeparator string) string
- func FormatNumber(f float64, precision int, decimalPoint string, thousandsSeparator string, ...) string
- func GetCSVQConfigDirFilePath(filename string) string
- func GetConfigDirFilePath(filename string) string
- func GetCurrentDirFilePath(filename string) string
- func GetDefaultNumberOfCPU() int
- func GetHomeDirFilePath(filename string) string
- func GetLocation(timezone string) (*time.Location, error)
- func GetRand() *rand.Rand
- func GetSpecialFilePath(filename string) []string
- func JsonEscapeTypeToString(escapeType txjson.EscapeType) string
- func MustBeEnclosed(s string) bool
- func NewPalette(env *Environment) (*color.Palette, error)
- func Now(location *time.Location) time.Time
- func ParseDelimiter(s string) (rune, error)
- func ParseDelimiterPositions(s string) ([]int, bool, error)
- func ParseEncoding(s string) (text.Encoding, error)
- func ParseJsonEscapeType(s string) (txjson.EscapeType, error)
- func ParseLineBreak(s string) (text.LineBreak, error)
- func QuoteIdentifier(s string) string
- func QuoteString(s string) string
- func RuneWidth(r rune, flags *Flags) int
- func RuntimeInformationSymbol(s string) string
- func TextWidth(s string, flags *Flags) int
- func TrimSpace(s string) string
- func UnescapeIdentifier(s string, quote rune) string
- func UnescapeString(s string, quote rune) string
- func VariableSymbol(s string) string
- type Environment
- type ExportOptions
- type Flags
- func (f *Flags) GetTimeLocation() *time.Location
- func (f *Flags) SetAllowUnevenFields(b bool)
- func (f *Flags) SetAnsiQuotes(b bool)
- func (f *Flags) SetCPU(i int)
- func (f *Flags) SetColor(b bool)
- func (f *Flags) SetCountDiacriticalSign(b bool)
- func (f *Flags) SetCountFormatCode(b bool)
- func (f *Flags) SetDatetimeFormat(s string)
- func (f *Flags) SetDelimiter(s string) error
- func (f *Flags) SetDelimiterPositions(s string) error
- func (f *Flags) SetEastAsianEncoding(b bool)
- func (f *Flags) SetEncloseAll(b bool)
- func (f *Flags) SetEncoding(s string) error
- func (f *Flags) SetFormat(s string, outfile string, canOutputToPipe bool) error
- func (f *Flags) SetImportFormat(s string) error
- func (f *Flags) SetJsonEscape(s string) error
- func (f *Flags) SetJsonQuery(s string)
- func (f *Flags) SetLimitRecursion(i int64)
- func (f *Flags) SetLineBreak(s string) error
- func (f *Flags) SetLocation(s string) error
- func (f *Flags) SetNoHeader(b bool)
- func (f *Flags) SetPrettyPrint(b bool)
- func (f *Flags) SetQuiet(b bool)
- func (f *Flags) SetRepository(s string) error
- func (f *Flags) SetScientificNotation(b bool)
- func (f *Flags) SetStats(b bool)
- func (f *Flags) SetStrictEqual(b bool)
- func (f *Flags) SetStripEndingLineBreak(b bool)
- func (f *Flags) SetWaitTimeout(t float64)
- func (f *Flags) SetWithoutHeader(b bool)
- func (f *Flags) SetWithoutNull(b bool)
- func (f *Flags) SetWriteDelimiter(s string) error
- func (f *Flags) SetWriteDelimiterPositions(s string) error
- func (f *Flags) SetWriteEncoding(s string) error
- type Format
- type ImportOptions
- type InteractiveShell
- type TimezoneMap
Constants ¶
View Source
const ( XDGConfigHomeEnvName = "XDG_CONFIG_HOME" DefaultXDGConfigDir = ".config" CSVQConfigDir = "csvq" EnvFileName = "csvq_env.json" PreloadCommandFileName = "csvqrc" HiddenPrefix = '.' )
View Source
const ( VariableSign = "@" FlagSign = "@@" EnvironmentVariableSign = "@%" RuntimeInformationSign = "@#" )
View Source
const ( RepositoryFlag = "REPOSITORY" TimezoneFlag = "TIMEZONE" DatetimeFormatFlag = "DATETIME_FORMAT" AnsiQuotesFlag = "ANSI_QUOTES" StrictEqualFlag = "STRICT_EQUAL" WaitTimeoutFlag = "WAIT_TIMEOUT" ImportFormatFlag = "IMPORT_FORMAT" DelimiterFlag = "DELIMITER" AllowUnevenFieldsFlag = "ALLOW_UNEVEN_FIELDS" DelimiterPositionsFlag = "DELIMITER_POSITIONS" JsonQueryFlag = "JSON_QUERY" EncodingFlag = "ENCODING" NoHeaderFlag = "NO_HEADER" WithoutNullFlag = "WITHOUT_NULL" StripEndingLineBreakFlag = "STRIP_ENDING_LINE_BREAK" FormatFlag = "FORMAT" ExportEncodingFlag = "WRITE_ENCODING" ExportDelimiterFlag = "WRITE_DELIMITER" ExportDelimiterPositionsFlag = "WRITE_DELIMITER_POSITIONS" WithoutHeaderFlag = "WITHOUT_HEADER" LineBreakFlag = "LINE_BREAK" EncloseAllFlag = "ENCLOSE_ALL" JsonEscapeFlag = "JSON_ESCAPE" PrettyPrintFlag = "PRETTY_PRINT" ScientificNotationFlag = "SCIENTIFIC_NOTATION" EastAsianEncodingFlag = "EAST_ASIAN_ENCODING" CountDiacriticalSignFlag = "COUNT_DIACRITICAL_SIGN" CountFormatCodeFlag = "COUNT_FORMAT_CODE" ColorFlag = "COLOR" QuietFlag = "QUIET" LimitRecursion = "LIMIT_RECURSION" CPUFlag = "CPU" StatsFlag = "STATS" )
View Source
const ( CsvExt = ".csv" TsvExt = ".tsv" JsonExt = ".json" JsonlExt = ".jsonl" LtsvExt = ".ltsv" GfmExt = ".md" OrgExt = ".org" SqlExt = ".sql" CsvqProcExt = ".cql" TextExt = ".txt" )
View Source
const ( NoEffect = "" LableEffect = "label" NumberEffect = "number" StringEffect = "string" BooleanEffect = "boolean" TernaryEffect = "ternary" DatetimeEffect = "datetime" NullEffect = "null" ObjectEffect = "object" AttributeEffect = "attribute" IdentifierEffect = "identifier" ValueEffect = "value" EmphasisEffect = "emphasis" PromptEffect = "prompt" ErrorEffect = "error" WarnEffect = "warn" NoticeEffect = "notice" )
View Source
const DefaultEnvJson = `` /* 4108-byte string literal not displayed */
View Source
const DelimitAutomatically = "SPACES"
Variables ¶
View Source
var ( TestTime time.Time // For Tests Timezones = NewTimezoneMap() )
View Source
var FlagList = []string{ RepositoryFlag, TimezoneFlag, DatetimeFormatFlag, AnsiQuotesFlag, StrictEqualFlag, WaitTimeoutFlag, ImportFormatFlag, DelimiterFlag, AllowUnevenFieldsFlag, DelimiterPositionsFlag, JsonQueryFlag, EncodingFlag, NoHeaderFlag, WithoutNullFlag, StripEndingLineBreakFlag, FormatFlag, ExportEncodingFlag, ExportDelimiterFlag, ExportDelimiterPositionsFlag, WithoutHeaderFlag, LineBreakFlag, EncloseAllFlag, JsonEscapeFlag, PrettyPrintFlag, ScientificNotationFlag, EastAsianEncodingFlag, CountDiacriticalSignFlag, CountFormatCodeFlag, ColorFlag, QuietFlag, LimitRecursion, CPUFlag, StatsFlag, }
View Source
var FormatLiteral = map[Format]string{ CSV: "CSV", TSV: "TSV", FIXED: "FIXED", JSON: "JSON", JSONL: "JSONL", LTSV: "LTSV", GFM: "GFM", ORG: "ORG", BOX: "BOX", TEXT: "TEXT", }
View Source
var JsonEscapeTypeLiteral = map[txjson.EscapeType]string{ txjson.Backslash: "BACKSLASH", txjson.HexDigits: "HEX", txjson.AllWithHexDigits: "HEXALL", }
Functions ¶
func AppendStrIfNotExist ¶
func EscapeIdentifier ¶
func EscapeString ¶
func FlagSymbol ¶
func FormatNumber ¶
func GetConfigDirFilePath ¶
func GetCurrentDirFilePath ¶
func GetDefaultNumberOfCPU ¶
func GetDefaultNumberOfCPU() int
func GetHomeDirFilePath ¶
func GetSpecialFilePath ¶
func JsonEscapeTypeToString ¶
func JsonEscapeTypeToString(escapeType txjson.EscapeType) string
func MustBeEnclosed ¶
func NewPalette ¶
func NewPalette(env *Environment) (*color.Palette, error)
func ParseDelimiter ¶
func ParseEncoding ¶
func ParseJsonEscapeType ¶
func ParseJsonEscapeType(s string) (txjson.EscapeType, error)
func ParseLineBreak ¶
func QuoteIdentifier ¶
func QuoteString ¶
func UnescapeIdentifier ¶
func UnescapeString ¶
func VariableSymbol ¶
Types ¶
type Environment ¶
type Environment struct { DatetimeFormat []string `json:"datetime_format"` Timezone *string `json:"timezone"` AnsiQuotes *bool `json:"ansi_quotes"` InteractiveShell InteractiveShell `json:"interactive_shell"` EnvironmentVariables map[string]string `json:"environment_variables"` Palette color.PaletteConfig `json:"palette"` }
func NewEnvironment ¶
func (*Environment) Merge ¶
func (e *Environment) Merge(e2 *Environment)
type ExportOptions ¶
type ExportOptions struct { StripEndingLineBreak bool Format Format Encoding text.Encoding Delimiter rune DelimiterPositions []int SingleLine bool WithoutHeader bool LineBreak text.LineBreak EncloseAll bool JsonEscape txjson.EscapeType PrettyPrint bool ScientificNotation bool // For Calculation of String Width EastAsianEncoding bool CountDiacriticalSign bool CountFormatCode bool Color bool }
func NewExportOptions ¶
func NewExportOptions() ExportOptions
func (ExportOptions) Copy ¶
func (ops ExportOptions) Copy() ExportOptions
type Flags ¶
type Flags struct { // Common Settings Repository string Location string DatetimeFormat []string AnsiQuotes bool StrictEqual bool WaitTimeout float64 // For Import ImportOptions ImportOptions // For Export ExportOptions ExportOptions // System Use Quiet bool LimitRecursion int64 CPU int Stats bool // contains filtered or unexported fields }
func NewFlags ¶
func NewFlags(env *Environment) (*Flags, error)
func (*Flags) GetTimeLocation ¶
func (*Flags) SetAllowUnevenFields ¶
func (*Flags) SetAnsiQuotes ¶
func (*Flags) SetCountDiacriticalSign ¶
func (*Flags) SetCountFormatCode ¶
func (*Flags) SetDatetimeFormat ¶
func (*Flags) SetDelimiter ¶
func (*Flags) SetDelimiterPositions ¶
func (*Flags) SetEastAsianEncoding ¶
func (*Flags) SetEncloseAll ¶
func (*Flags) SetEncoding ¶
func (*Flags) SetImportFormat ¶
func (*Flags) SetJsonEscape ¶
func (*Flags) SetJsonQuery ¶
func (*Flags) SetLimitRecursion ¶
func (*Flags) SetLineBreak ¶
func (*Flags) SetLocation ¶
func (*Flags) SetNoHeader ¶
func (*Flags) SetPrettyPrint ¶
func (*Flags) SetRepository ¶
func (*Flags) SetScientificNotation ¶
func (*Flags) SetStrictEqual ¶
func (*Flags) SetStripEndingLineBreak ¶
func (*Flags) SetWaitTimeout ¶
func (*Flags) SetWithoutHeader ¶
func (*Flags) SetWithoutNull ¶
func (*Flags) SetWriteDelimiter ¶
func (*Flags) SetWriteDelimiterPositions ¶
func (*Flags) SetWriteEncoding ¶
type Format ¶
type Format int
func ParseFormat ¶
func ParseFormat(s string, et txjson.EscapeType) (Format, txjson.EscapeType, error)
type ImportOptions ¶
type ImportOptions struct { Format Format Delimiter rune AllowUnevenFields bool DelimiterPositions []int SingleLine bool JsonQuery string Encoding text.Encoding NoHeader bool WithoutNull bool }
func NewImportOptions ¶
func NewImportOptions() ImportOptions
func (ImportOptions) Copy ¶
func (ops ImportOptions) Copy() ImportOptions
type InteractiveShell ¶
type InteractiveShell struct { HistoryFile string `json:"history_file"` HistoryLimit *int `json:"history_limit"` Prompt string `json:"prompt"` ContinuousPrompt string `json:"continuous_prompt"` Completion *bool `json:"completion"` KillWholeLine *bool `json:"kill_whole_line"` ViMode *bool `json:"vi_mode"` }
type TimezoneMap ¶
type TimezoneMap struct {
// contains filtered or unexported fields
}
func NewTimezoneMap ¶
func NewTimezoneMap() TimezoneMap
Click to show internal directories.
Click to hide internal directories.