common

package
v0.0.0-...-4e715fa Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const OSPathSeparator = string(os.PathSeparator)

OSPathSeparator versi string dari os.PathSeparator

Variables

This section is empty.

Functions

func AppendFilePath

func AppendFilePath(basePath string, fileOrFolder string) string

AppendFilePath add file/ folder ke path. esensi nya base path bisa di akhiri dengan path separator. fungsi ini memastikan kalau misal not end with path separator, akan di tambahkan path separator. kalau sudah, tinggal gabung string saja <strong>basePath: <strong> folder awal untuk di tambahkan file atau folder

func AppendFilePaths

func AppendFilePaths(basePath string, fileOrFolders ...string) string

AppendFilePaths versi ini dengan path berupa array. misal nested folder

func ForceDeleteFolder

func ForceDeleteFolder(foldername string, loggerEntry *logrus.Entry) (err error)

ForceDeleteFolder delete folder yang tidak kosong. paksa

func GetReflectTypeOfStructObject

func GetReflectTypeOfStructObject(sampleModel interface{}) reflect.Type

GetReflectTypeOfStructObject read actual object type. this function will scan for actual object type when wrapped as interface{}. actual object type could be determined

func MakeDirectoryHelper

func MakeDirectoryHelper(destinationFolder string, loggerEntry *logrus.Entry) (err error)

MakeDirectoryHelper helper membuat directory. kalau directory tidak ada. ini tidak menyertakan pembuatan kalau directory nested

Types

type ErrorWithCodeData

type ErrorWithCodeData interface {
	error
	//GetErrorCode read error code
	GetErrorCode() string
	//GetRawError rawerror data
	GetRawError() error
}

ErrorWithCodeData error with code

func ErrorWithCode

func ErrorWithCode(errorMessage string, errorCode string) ErrorWithCodeData

ErrorWithCode generate error with code

func ErrorWithCodeAndRawError

func ErrorWithCodeAndRawError(errorMessage string, errorCode string, err error) ErrorWithCodeData

ErrorWithCodeAndRawError generate error with raw error

type LogCapturer

type LogCapturer interface {
	Release()
}

LogCapturer reroutes testing.T log output

func CaptureLog

func CaptureLog(t *testing.T) LogCapturer

CaptureLog redirects logrus output to testing.Log

Jump to

Keyboard shortcuts

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