Documentation ¶
Index ¶
- func CheckDirectory(path string) (bool, error)
- func CheckDirectoryIsNull(filePath string) error
- func CheckExists(name string) bool
- func CheckFile(path string) (bool, error)
- func CopyFile(srcPath, targetPath string) error
- func CreateAndOpenFile(filePath string) (*os.File, error)
- func GetBaseDir() string
- func GetCurrentTime(sec int, dateFormat DateFormat) string
- func GetHostname() (string, error)
- func GetHostnameAlias(hostName string) (string, error)
- func GetParentAbsPath(inPath string, parentLevel int) (string, error)
- func GetParentPath(inPath string, parentLevel int) string
- func GetTimeString(dateFormat DateFormat, t time.Time) string
- func HandleError(w io.Writer, inErr error, message string) error
- func HandleErrorWithAlert(w io.Writer, inErr error, message string) error
- func RemoveAndCreateDir(filePath string) error
- func SetLogLevel(level int) error
- func TrimPathSeparator(path string) string
- type DateFormat
- type DiskStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDirectory ¶
CheckDirectory はディレクトリの存在確認をします。
func CheckDirectoryIsNull ¶
CheckDirectoryIsNull は中身が空のディレクトリかチェックします
func CheckExists ¶
func CreateAndOpenFile ¶
CreateAndOpenFile ファイルパスから書き込み用ファイルをオープンします。 ディレクトリが存在しない場合は事前にディレクトリを作成します。
func GetCurrentTime ¶
func GetCurrentTime(sec int, dateFormat DateFormat) string
GetCurrentTime は指定したフォーマット形式で何秒前の現在時刻を取得します。
func GetHostnameAlias ¶
GetHostnameAlias はホスト名の「.」以降の文字列はカットし、大文字は小文字に変換します。
func GetParentAbsPath ¶
GetParentPathAbs は実行パスから上位のディレクトリを絶対パスに変換して返します。
func GetParentPath ¶
GetParentPathAbs は実行パスから上位のディレクトリを絶対パスに変換して返します。
func GetTimeString ¶
func GetTimeString(dateFormat DateFormat, t time.Time) string
gpfDGetTimeString は指定したフォーマット形式で時刻を変換します。
GPF_DATE_FORMAT_DEFAULT 0 GPF_DATE_FORMAT_YYYYMMDD 1 GPF_DATE_FORMAT_HHMISS 2 GPF_DATE_FORMAT_YYYYMMDD_HHMISS 3 GPF_DATE_FORMAT_DIR 4
func HandleError ¶
HandleError はエラーがある場合に、メッセージを付加したエラーをログ出力し、 エラーとして返します
func HandleErrorWithAlert ¶
HandleError はエラーがある場合に、メッセージを付加したエラーをログ出力し、 エラーとして返します
func RemoveAndCreateDir ¶
RemoveAndCreateDir はディレクトリを再作成します。
func SetLogLevel ¶
; Log level. None 0, FATAL 1, CRIT 2, ERR 3, WARN 4, NOTICE 5, INFO 6, DBG 7 LOG_LEVEL = 5
func TrimPathSeparator ¶
TrimPathSeparator はパス名(/tmp/log/data/)から前後のセパレータを 取り除きます(tmp/log/data)
Types ¶
type DateFormat ¶
type DateFormat int
const ( DEFAULT DateFormat = iota YYYYMMDD HHMISS YYYYMMDD_HHMISS DIR )
type DiskStatus ¶
type DiskStatus struct { All uint64 `json:"all"` Used uint64 `json:"used"` Free uint64 `json:"free"` }
func CheckDiskFree ¶
func CheckDiskFree(dir string) (DiskStatus, error)
CheckDiskFree は指定したディレクトリのディスク使用量[%]を取得します。