Documentation
¶
Index ¶
- func Close(log zerolog.Logger, c io.Closer)
- func GenerateRandomBytes(n int) ([]byte, error)
- func GenerateRandomString(bytes int) (string, error)
- func GenerateShortID() string
- type AssertJSON
- func (a *AssertJSON) Equal(path string, expected interface{}, msgAndArgs ...interface{})
- func (a *AssertJSON) False(path string, msgAndArgs ...interface{})
- func (a *AssertJSON) Len(path string, length int, msgAndArgs ...interface{})
- func (a *AssertJSON) Nil(path string, msgAndArgs ...interface{})
- func (a *AssertJSON) Raw(path string, expected interface{}, msgAndArgs ...interface{})
- func (a *AssertJSON) Regexp(path string, rx interface{}, msgAndArgs ...interface{})
- func (a *AssertJSON) TimeBetween(path string, minDur time.Duration, maxDur time.Duration, ...)
- func (a *AssertJSON) True(path string, msgAndArgs ...interface{})
- type Loader
- type TestLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Close ¶
Close is a simple utility used to log error messages riased during a deferred closing function. For example:
defer utils.Close(myLog, f)
func GenerateRandomBytes ¶
GenerateRandomBytes returns securely generated random bytes. It returns an error if the system's secure random number generator fails.
func GenerateRandomString ¶
GenerateRandomString returns a URL-safe, base64 encoded random string.
It returns an error if the system's secure random number generator fails.
func GenerateShortID ¶
func GenerateShortID() string
GenerateShortID returns a base58-encoded UUID which is 22 characters long.
Types ¶
type AssertJSON ¶
func NewAssertJSON ¶
func NewAssertJSON(t *testing.T, body []byte) *AssertJSON
func (*AssertJSON) Equal ¶
func (a *AssertJSON) Equal(path string, expected interface{}, msgAndArgs ...interface{})
func (*AssertJSON) False ¶
func (a *AssertJSON) False(path string, msgAndArgs ...interface{})
func (*AssertJSON) Len ¶
func (a *AssertJSON) Len(path string, length int, msgAndArgs ...interface{})
func (*AssertJSON) Nil ¶
func (a *AssertJSON) Nil(path string, msgAndArgs ...interface{})
func (*AssertJSON) Raw ¶
func (a *AssertJSON) Raw(path string, expected interface{}, msgAndArgs ...interface{})
func (*AssertJSON) Regexp ¶
func (a *AssertJSON) Regexp(path string, rx interface{}, msgAndArgs ...interface{})
func (*AssertJSON) TimeBetween ¶
func (*AssertJSON) True ¶
func (a *AssertJSON) True(path string, msgAndArgs ...interface{})
type Loader ¶
Loader loads layout, partial and template files from a specified directory.
Dealing with partials and layouts in template files is notoriously tricky using the standard Golang template parser. This Loader makes is easier to simply load a template by name and parse one of the blocks within that template file.
func NewTemplateLoader ¶
NewTemplateLoader creates a Loader with the recommended layouts directory "/layouts" and partials directory "/partials". These directories are relative from the specified template directory.
func (*Loader) LoadAllTemplates ¶
LoadAllTemplates creates separate templates for each template in the template directory.
type TestLogger ¶
type TestLogger struct {
// contains filtered or unexported fields
}
func (*TestLogger) LastLine ¶
func (log *TestLogger) LastLine() (result map[string]interface{})
func (*TestLogger) Lines ¶
func (log *TestLogger) Lines() (result []map[string]interface{})
Directories
¶
Path | Synopsis |
---|---|
Package validator implements value validations Copyright 2014 Roberto Teixeira <robteix@robteix.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
Package validator implements value validations Copyright 2014 Roberto Teixeira <robteix@robteix.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. |