utils

package module
v0.0.0-...-601d287 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2023 License: MIT Imports: 16 Imported by: 3

README

ECM utilities

This directory contains common set of utility functions used across ECM codebase.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Backup

func Backup(vdir string, verbose int) error

Backup backups vault directory

func BackupFile

func BackupFile(vdir, fid, bdir string) error

BackupFile perform backup copy of given file in vault dir

func BackupTDir

func BackupTDir(bdir string) (string, error)

helper function to create timestamp subdir in backdur

func Copy

func Copy(src, dst string) (int64, error)

Copy performs backup copy of source to destination based on https://github.com/mactsouk/opensource.com/blob/master/cp1.go

func EcmHome

func EcmHome() string

EcmHome returns home area for ECM

func FileExist

func FileExist(path string) bool

FileExist checks if file exists

func Files

func Files(vdir string) ([]string, error)

Files return list of vault files

func GetPasswordHash

func GetPasswordHash(password string) (string, error)

GetPasswordHash generates password hash

func InList

func InList(a string, list []string) bool

InList checks item in a list

func MacAddress

func MacAddress() uint64

MacAddress returns mac address of the host https://gist.github.com/tsilvers/085c5f39430ced605d970094edf167ba

func RandomString

func RandomString(strSize int, randType string) string

RandomString generates random string

func ReadInput

func ReadInput(msg string) (string, error)

ReadInput read user input from stdout https://gosamples.dev/read-user-input/

func ReadPassword

func ReadPassword() (string, error)

ReadPassword reads input password from stdout

func SizeFormat

func SizeFormat(val interface{}) string

SizeFormat helper function to convert size into human readable form

Types

type StringList

type StringList []string

StringList implement sort for []string type

func (StringList) Len

func (s StringList) Len() int

Len provides length of the []int type

func (StringList) Less

func (s StringList) Less(i, j int) bool

Less implements less function for []int type

func (StringList) Swap

func (s StringList) Swap(i, j int)

Swap implements swap function for []int type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL