Documentation
¶
Index ¶
- func CheckCSVPrefix(file string, prefix string) (string, bool)
- func FileExists(path string) bool
- func GetAllCsvFiles(dirPath string) ([]string, error)
- func NewCSVFile(r io.Reader) (*csvFile, error)
- func NewCSVFileFromFile(fileName string) (*csvFile, error)
- func ReadCSV(fileName string) ([][]string, error)
- func ReadCSV2Array(fileName string) ([]map[string]string, error)
- func ReadCSV2MapWithPrimaryKey(fileName string, primaryKeyColumn int) (map[string]map[string]string, error)
- func SelfDir() string
- func SelfPath() string
- func SkipBom(file *os.File) bool
- func StrToBool(str string) bool
- func StrToFloat32(str string) float32
- func StrToFloat64(str string) float64
- func StrToInt32(str string) int32
- func StrToInt32Slice(str, sep string) []int32
- func StrToInt64(str string) int64
- func StrToInt64Slice(str, sep string) []int64
- func StrToUint32(str string) uint32
- func StrToUint32Slice(str, sep string) []uint32
- func StrToUint64(str string) uint64
- func StrToUint64Slice(str, sep string) []uint64
- type CSVFile
- type SkipBomReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckCSVPrefix ¶
CheckCSVPrefix check file whether matched prefix. return false when not matched. return the remaining part(exclude ".csv" suffix) and true when matched.
func GetAllCsvFiles ¶
GetAllCsvFiles get all csv files from current dir not sub dirs
func NewCSVFile ¶
NewCSVFile create a CSVFile from io.Reader
func NewCSVFileFromFile ¶
NewCSVFileFromFile create a CSVFile from a physic file path
func ReadCSV2Array ¶
ReadCSV2Array read a csv file to []map[string]string
func ReadCSV2MapWithPrimaryKey ¶
func ReadCSV2MapWithPrimaryKey(fileName string, primaryKeyColumn int) (map[string]map[string]string, error)
ReadCSV2MapWithPrimaryKey read a csv file to map[string]map[string]string
func SkipBom ¶
SkipBom will remove bom from the file if it has bom
will skip any error occur during the process, and reset to start position return true means bom is skipped , or no bom is skipped
func StrToFloat32 ¶ added in v0.1.7
func StrToFloat64 ¶ added in v0.1.7
func StrToInt32 ¶ added in v0.1.7
func StrToInt32Slice ¶ added in v0.1.7
func StrToInt64 ¶ added in v0.1.7
func StrToInt64Slice ¶ added in v0.1.7
func StrToUint32 ¶ added in v0.1.7
func StrToUint32Slice ¶ added in v0.1.7
func StrToUint64 ¶ added in v0.1.7
func StrToUint64Slice ¶ added in v0.1.7
Types ¶
type SkipBomReader ¶
type SkipBomReader struct {
// contains filtered or unexported fields
}
func NewSkipBomReader ¶
func NewSkipBomReader(r io.Reader) *SkipBomReader
NewSkipBomReader returns a reader which can remove bom from the given io.Reader if it has bom
Click to show internal directories.
Click to hide internal directories.