Documentation ¶
Overview ¶
Package project defines global project helpers.
Index ¶
- Constants
- func RandomBase64String(len int) (string, error)
- func RandomBytes(length int) ([]byte, error)
- func RandomHexString(len int) (string, error)
- func Root() string
- func TestContext(tb testing.TB) context.Context
- func TestLogger(tb testing.TB) *zap.SugaredLogger
- func TrimSpace(s string) string
- func TrimSpaceAndNonPrintable(s string) string
Constants ¶
View Source
const ( // RFC3339Date formats time as RFC3339 but without a time component (e.g. // 2020-11-24 for November 24, 20202). RFC3339Date = "2006-01-02" // RFC3339Squish is the RFC3339 datetime but all dashes and timezone // indicators are removed. This is useful for filenames. RFC3339Squish = "20060102150405" )
View Source
const (
// PasswordSentinel is the password string inserted into forms.
PasswordSentinel = "very-nice-try-maybe-next-time"
)
Variables ¶
This section is empty.
Functions ¶
func RandomBase64String ¶ added in v0.18.0
RandomBase64String encodes a random base64 string of a given length.
func RandomBytes ¶ added in v0.19.0
RandomBytes returns a byte slice of random values of the given length.
func RandomHexString ¶ added in v0.19.0
RandomHexString generates a random string of the provided length.
func TestContext ¶ added in v0.19.0
TestContext returns a context with test values pre-populated.
func TestLogger ¶ added in v0.19.0
func TestLogger(tb testing.TB) *zap.SugaredLogger
TestLogger returns a logger configured for test. See the following link for more information:
https://pkg.go.dev/go.uber.org/zap/zaptest
func TrimSpaceAndNonPrintable ¶ added in v0.16.0
TrimSpaceAndNonPrintable trims spaces and non-printable chars from the beginning and end of a string.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.