Documentation ¶
Index ¶
- Constants
- Variables
- func CheckFatal(t *testing.T, err error)
- func DurationStr(secs int) string
- func DurationStrJira(secs int) string
- func DurationStrLong(secs int) string
- func FormatDuration(secs int) string
- func LeftPad2Len(s string, padStr string, overallLen int) string
- func Map(vs []string, f func(string) string) []string
- func Percent(val, total int) float64
- func RightPad2Len(s string, padStr string, overallLen int) string
- func StringInSlice(list []string, a string) bool
- func UcFirst(str string) string
- type ByInt64
- type CallFrame
- type ContextLogger
- type DateRange
- type FamilyCallStack
- type TestRepo
- func (t TestRepo) AddSubmodule(url, path string)
- func (t TestRepo) Clone() TestRepo
- func (t TestRepo) Commit(treeID *git.Oid) *git.Oid
- func (t TestRepo) Fetch(name string, refs ...string)
- func (t TestRepo) FileExists(filename, subdir string) bool
- func (t TestRepo) Path() string
- func (t TestRepo) Push(name string, refs ...string)
- func (t TestRepo) Remove()
- func (t TestRepo) Repo() *git.Repository
- func (t TestRepo) SaveFile(filename, subdir, content string)
- func (t TestRepo) Seed()
- func (t TestRepo) Stage(files ...string) *git.Oid
- func (t TestRepo) Workdir() string
Constants ¶
const ( SecInMinute = 60 MinInHour = 60 HoursInDay = 8 DaysInWeek = 5 )
Variables ¶
Debug is no-op implementation of the debug logger
var Now = func() time.Time { return time.Now() }
Now is the func used for system time within gtm This allows for manipulating system time during testing
var ( // Profile is a no-op implemention of the profile logger Profile = func(s ...string) func() { return func() { } } )
Functions ¶
func CheckFatal ¶
CheckFatal raises a fatal error if error is not nil
func DurationStr ¶
DurationStr returns seconds as a duration string, i.e. 9h10m30s
func DurationStrJira ¶ added in v1.0.0
DurationStrJira returns seconds as duration string, i.e. 1d 9h 10m
func DurationStrLong ¶
DurationStrLong returns a human readable format for the duration
func FormatDuration ¶
FormatDuration converts seconds into a duration string
func LeftPad2Len ¶
LeftPad2Len https://github.com/DaddyOh/golang-samples/blob/master/pad.go
func RightPad2Len ¶
RightPad2Len https://github.com/DaddyOh/golang-samples/blob/master/pad.go
func StringInSlice ¶
StringInSlice https://github.com/DaddyOh/golang-samples/blob/master/pad.go
Types ¶
type ContextLogger ¶
type ContextLogger struct {
// contains filtered or unexported fields
}
ContextLogger adds child and parent file location to logging
func NewContextLogger ¶
func NewContextLogger(x *log.Logger, skip int) *ContextLogger
NewContextLogger initializes a ContextLogger struct
func (*ContextLogger) Print ¶
func (c *ContextLogger) Print(v ...interface{})
Print prints log message with context
func (*ContextLogger) Printf ¶
func (c *ContextLogger) Printf(format string, v ...interface{})
Printf prints log message with context and format
func (*ContextLogger) Println ¶
func (c *ContextLogger) Println(v ...interface{})
Println prints log message with context
type DateRange ¶
DateRange creates predefined date ranges and validates if dates are within the range
func LastMonthRange ¶
func LastMonthRange() DateRange
LastMonthRange returns a date range for last month
func LastYearRange ¶
func LastYearRange() DateRange
LastYearRange returns a date range for last year
func ThisMonthRange ¶
func ThisMonthRange() DateRange
ThisMonthRange returns a date range for this month
func ThisWeekRange ¶
func ThisWeekRange() DateRange
ThisWeekRange returns a date range for this week
func ThisYearRange ¶
func ThisYearRange() DateRange
ThisYearRange returns a date range for this year
func YesterdayRange ¶
func YesterdayRange() DateRange
YesterdayRange returns a date range for yesterday
type FamilyCallStack ¶
FamilyCallStack contains the child and parent call frames
func NewFamilyCallStack ¶
func NewFamilyCallStack(f *runtime.Frames) FamilyCallStack
NewFamilyCallStack initializes a FamilyCallStack struct
func (FamilyCallStack) String ¶
func (f FamilyCallStack) String() string
String returns a canonical representation of a FamilyCallStack
type TestRepo ¶
type TestRepo struct {
// contains filtered or unexported fields
}
TestRepo represents a test git repo used in testing
func NewTestRepo ¶
NewTestRepo creates a new instance of TestRepo
func (TestRepo) AddSubmodule ¶
AddSubmodule adds a submodule to the test repository
func (TestRepo) Commit ¶
func (t TestRepo) Commit(treeID *git.Oid) *git.Oid
Commit commits staged files
func (TestRepo) FileExists ¶
FileExists Checks if a file exists in the repo folder
func (TestRepo) Remove ¶
func (t TestRepo) Remove()
Remove deletes temp directories, files and git repo
func (TestRepo) Repo ¶
func (t TestRepo) Repo() *git.Repository
Repo return a pointer to the git repository