Documentation
¶
Index ¶
- Variables
- func CountFileLines(path string) (int, error)
- func GetFileGroup(file string) (*user.Group, error)
- func GetFileOwner(file string) (*user.User, error)
- func IsDigit(c byte) bool
- func IsDir(path string) bool
- func IsExists(path string) bool
- func IsExistsAndDir(path string) bool
- func IsHexa(c byte) bool
- func IsLineInFile(path, s string) (bool, error)
- func IsLowerLetter(c byte) bool
- func IsUpperLetter(c byte) bool
- func RandomString(chars []byte, l int) string
- func SHA256Str(v string) string
- func Sleep(ctx context.Context, d time.Duration)
Constants ¶
This section is empty.
Variables ¶
var (
ErrAssert = errors.New("syscall.Stat_t assertion failed")
)
Functions ¶
func CountFileLines ¶ added in v1.0.6
CountFileLines returns the number lines in file.
func GetFileGroup ¶ added in v1.0.3
GetFileGroup returns the user.Group struct of file. Returns ErrAssert if syscall assertion failed or UnknownGroupIdError if failed to get owner from the GID.
func GetFileOwner ¶ added in v1.0.3
GetFileOwner returns the owner user.User struct of file. Returns ErrAssert if syscall assertion failed or UnknownUserIdError if failed to get owner from the UID.
func IsDir ¶ added in v1.0.7
IsDir returns whether path is a directory..
It will panic is error is other than fs.ErrNotExist!
func IsExists ¶ added in v1.0.7
IsExists returns whether path is exists.
It will panic is error is other than "no such file or directory"!
func IsExistsAndDir ¶ added in v1.0.7
IsExistsAndDir returns whether path is exists and a directory.
It will panic is error is other than fs.ErrNotExist!
func IsLineInFile ¶ added in v1.0.1
IsLineInFile check whether s is exactly a line in file in path. A line in the file does not contains the newline character ("\n"). This function uses bufio.Scanner to able to handle large files.
func IsLowerLetter ¶ added in v1.0.5
IsLowerLetter returns whether c is a lower case letter (a-z).
func IsUpperLetter ¶ added in v1.0.5
IsUpperLetter returns whether c is an upper case letter (A-Z).
func RandomString ¶ added in v1.0.4
RandomString generates a random string from chars with length l. If chars nil/empty or l < 1, returns an empty string ("").
Types ¶
This section is empty.