Documentation
¶
Index ¶
- Constants
- func CreateFile(absPath string, payload io.Reader, opts ...FileOptionFunc) error
- func CreateIfNotExist(path string, defaultValue string) error
- func FileExists(fpath string) bool
- func GetFileName(fpath string) string
- func Int32Pointer(i int32) *int32
- func Int64Pointer(i int64) *int64
- func IntPointer(i int) *int
- func IsNil(p any) bool
- func LoadCSV[T any](inputPath string) ([]T, error)
- func NewCSVFilelistCallback(pattern string, rowProcessor sdkcsv.RecordProcessor) error
- func NewFileOpenCallback(fpath string, fn func(f *os.File) error) error
- func NewFilelistCallback(pattern string, f FileCallback) error
- func OpenFile(absPath string, opts ...FileOptionFunc) (*os.File, error)
- func ParseCSVFile(fpath string) (*csv.Reader, *os.File, error)
- func ParseTimeDuration(s string) (time.Duration, error)
- func ResolvePath(path string) (string, error)deprecated
- func SaveFile(absPath string, payload io.Reader) errordeprecated
- func String(length int) string
- func StringPointer(s string) *string
- func StringWithCharset(length int, charset string) string
- func Uint32Pointer(i uint32) *uint32
- func Uint64Pointer(i uint64) *uint64
- func UintPointer(i uint) *uint
- func WriteCSV(absPath string, data any) error
- func WriteFile(absPath string, payload io.Reader, opts ...FileOptionFunc) error
- type FileCallback
- type FileOptionFunc
- type FileOptions
- type SampleInt
- type SampleInt2
Constants ¶
View Source
const ( COUNTER2_A = 1<<iota + 2 COUNTER2_B COUNTER2_C COUNTER2_D )
View Source
const CHARSET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
Variables ¶
This section is empty.
Functions ¶
func CreateFile ¶ added in v1.1.0
func CreateFile(absPath string, payload io.Reader, opts ...FileOptionFunc) error
CreateFile is an alias for WriteFile.
func CreateIfNotExist ¶ added in v1.0.1
CreateIfNotExist checks if a file exists at the given path. If the file does not exist, it creates one with the provided defaultValue. It supports "~" as the home directory.
func FileExists ¶ added in v1.0.1
func GetFileName ¶ added in v1.0.1
func Int32Pointer ¶
func Int64Pointer ¶
func IntPointer ¶
func NewCSVFilelistCallback ¶ added in v1.0.1
func NewCSVFilelistCallback(pattern string, rowProcessor sdkcsv.RecordProcessor) error
func NewFileOpenCallback ¶ added in v1.0.1
func NewFilelistCallback ¶ added in v1.0.1
func NewFilelistCallback(pattern string, f FileCallback) error
func OpenFile ¶ added in v1.1.0
func OpenFile(absPath string, opts ...FileOptionFunc) (*os.File, error)
OpenFile opens or creates a file at absPath according to provided options.
func ParseTimeDuration ¶ added in v1.0.1
ParseHHMMSS converts a string of "HH:MM:SS" format to a time.Duration.
func ResolvePath
deprecated
added in
v1.1.0
func StringPointer ¶
func StringWithCharset ¶
func Uint32Pointer ¶
func Uint64Pointer ¶
func UintPointer ¶
Types ¶
type FileCallback ¶ added in v1.0.1
type FileOptionFunc ¶ added in v1.1.0
type FileOptionFunc func(*FileOptions)
FileOptionFunc defines configuration builder for CreateFile.
func WithBackup ¶ added in v1.1.0
func WithBackup() FileOptionFunc
WithBackup enables recursive backup of existing files.
func WithCreate ¶ added in v1.1.0
func WithCreate() FileOptionFunc
WithCreate enables file creation if it doesn't exist.
func WithReturnWriter ¶ added in v1.1.0
func WithReturnWriter(w *io.Writer) FileOptionFunc
WithWriter allows retrieving the opened writer.
type FileOptions ¶ added in v1.1.0
type FileOptions struct {
// contains filtered or unexported fields
}
type SampleInt2 ¶ added in v1.1.0
type SampleInt2 int
const ( COUNTER1_A SampleInt2 = iota COUNTER1_B COUNTER1_C COUNTER1_D COUNTER1_E COUNTER1_F COUNTER1_G COUNTER1_H COUNTER1_I COUNTER1_J COUNTER1_K COUNTER1_L COUNTER1_M )
Click to show internal directories.
Click to hide internal directories.