utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const SpanVarName = "span"
View Source
const (
	T = "T"
)

Variables

This section is empty.

Functions

func AddImports

func AddImports(proj *models.Project, file *jen.File)

func AppendItemsToList

func AppendItemsToList(list jen.Code, items ...jen.Code) jen.Code

func AssertContains

func AssertContains(container, value, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

AssertContains calls assert.NotEmpty

func AssertEmpty

func AssertEmpty(value, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

AssertEmpty calls assert.NotEmpty

func AssertEqual

func AssertEqual(expected, actual, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

AssertEqual calls assert.Equal

func AssertError

func AssertError(value, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

AssertError calls assert.Error

func AssertExpectationsFor

func AssertExpectationsFor(varNames ...string) jen.Code

func AssertFalse

func AssertFalse(value, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

AssertFalse calls assert.False

func AssertLength

func AssertLength(value, length, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

AssertLength calls assert.NotEmpty

func AssertNil

func AssertNil(value, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

AssertNil calls assert.Nil

func AssertNoError

func AssertNoError(value, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

AssertNoError calls assert.NoError

func AssertNotEmpty

func AssertNotEmpty(value, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

AssertNotEmpty calls assert.NotEmpty

func AssertNotEqual

func AssertNotEqual(expected, actual, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

AssertNotEqual calls assert.Equal

func AssertNotNil

func AssertNotNil(value, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

AssertNotNil calls assert.NotNil

func AssertNotZero

func AssertNotZero(value, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

AssertNotZero calls assert.NotEmpty

func AssertTrue

func AssertTrue(value, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

AssertTrue calls assert.True

func AssertZero

func AssertZero(value, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

AssertZero calls assert.NotEmpty

func BuildError

func BuildError(args ...jen.Code) jen.Code

func BuildFakeVar

func BuildFakeVar(proj *models.Project, typName string, args ...jen.Code) jen.Code

func BuildFakeVarName

func BuildFakeVarName(typName string) string

func BuildFakeVarWithCustomName

func BuildFakeVarWithCustomName(proj *models.Project, varName, funcName string, args ...jen.Code) jen.Code

func BuildInterfaceCheck

func BuildInterfaceCheck(interfaceName, implementerType string) jen.Code

func BuildSubTest

func BuildSubTest(name string, testInstructions ...jen.Code) jen.Code

BuildSubTest builds a subtest

func BuildSubTestWithoutContext

func BuildSubTestWithoutContext(name string, testInstructions ...jen.Code) jen.Code

BuildSubTestWithoutContext builds a subtest without context

func BuildTemplatePath

func BuildTemplatePath(pkgRoot, tail string) string

BuildTemplatePath builds a template path

func BuildTestServer

func BuildTestServer(name string, handlerLines ...jen.Code) *jen.Statement

BuildTestServer builds a test server with an example handlerfunc

func CreateDefaultQueryFilter

func CreateDefaultQueryFilter(proj *models.Project) jen.Code

func CreateNilQueryFilter

func CreateNilQueryFilter(proj *models.Project) jen.Code

func DefaultQueryFilter

func DefaultQueryFilter(proj *models.Project) jen.Code

func Error

func Error(str string) jen.Code

func Errorf

func Errorf(str string, args ...interface{}) jen.Code

func ExpectMethod

func ExpectMethod(varName, method string) jen.Code

ExpectMethod creates a test expectation for a gievn method

func FakeBoolFunc

func FakeBoolFunc() jen.Code

func FakeCallForField

func FakeCallForField(pkgRoot string, field models.DataField) jen.Code

func FakeContentTypeFunc

func FakeContentTypeFunc() jen.Code

func FakeError

func FakeError() jen.Code

func FakeFloat32Func

func FakeFloat32Func() jen.Code

func FakeFloat64Func

func FakeFloat64Func() jen.Code

func FakeFloat64WhichIsActuallyAFloat32Func

func FakeFloat64WhichIsActuallyAFloat32Func() jen.Code

func FakeFuncForType

func FakeFuncForType(typ string, isPointer bool) func() jen.Code

func FakeHTTPMethodFunc

func FakeHTTPMethodFunc() jen.Code

func FakeInt16Func

func FakeInt16Func() jen.Code

func FakeInt32Func

func FakeInt32Func() jen.Code

func FakeInt64Func

func FakeInt64Func() jen.Code

func FakeInt64WhichIsReallyAnInt32Func

func FakeInt64WhichIsReallyAnInt32Func() jen.Code

func FakeInt8Func

func FakeInt8Func() jen.Code

func FakeIntFunc

func FakeIntFunc() jen.Code

func FakePasswordFunc

func FakePasswordFunc() jen.Code

func FakeSeedFunc

func FakeSeedFunc() jen.Code

FakeSeedFunc builds a consistent fake library seed init function

func FakeStringFunc

func FakeStringFunc() jen.Code

func FakeURLFunc

func FakeURLFunc() jen.Code

func FakeUUIDFunc

func FakeUUIDFunc() jen.Code

func FakeUint16Func

func FakeUint16Func() jen.Code

func FakeUint32Func

func FakeUint32Func() jen.Code

func FakeUint64Func

func FakeUint64Func() jen.Code

func FakeUint64WhichIsActuallyAUint32Func

func FakeUint64WhichIsActuallyAUint32Func() jen.Code

func FakeUint8Func

func FakeUint8Func() jen.Code

func FakeUintFunc

func FakeUintFunc() jen.Code

func FakeUnixTimeFunc

func FakeUnixTimeFunc() jen.Code

func FakeUsernameFunc

func FakeUsernameFunc() jen.Code

func FindAndFixImportBlock

func FindAndFixImportBlock(pkgRoot, filepath string) error

func FormatString

func FormatString(str string, args ...jen.Code) *jen.Statement

func FormatStringWithArg

func FormatStringWithArg(arg jen.Code, args ...jen.Code) *jen.Statement

func InlineFakeSeedFunc

func InlineFakeSeedFunc() jen.Code

InlineFakeSeedFunc builds a consistent fake library seed init function

func NilQueryFilter

func NilQueryFilter(proj *models.Project) jen.Code

func OuterTestFunc

func OuterTestFunc(subjectName string) *jen.Statement

OuterTestFunc does

func ParallelTest

func ParallelTest(tee *jen.Statement) jen.Code

ParallelTest creates a new t.Parallel call

func QueryFilterParam

func QueryFilterParam(proj *models.Project) jen.Code

QueryFilterParam does

func RenderGoFile

func RenderGoFile(proj *models.Project, path string, file *jen.File) error

RenderGoFile does

func RequireNil

func RequireNil(value, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

RequireNil creates a require call

func RequireNoError

func RequireNoError(value, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

RequireNoError creates a require call

func RequireNotNil

func RequireNotNil(value, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

RequireNotNil creates a require call

func RequireTrue

func RequireTrue(value, message *jen.Statement, formatArgs ...*jen.Statement) jen.Code

RequireTrue creates a require call

func RunGoFormatForFile

func RunGoFormatForFile(filename string) error

RunGoFormatForFile does something

func RunGoimportsForFile

func RunGoimportsForFile(filename string) error

RunGoimportsForFile runs the `goimports` binary for a given filename

func StartSpan

func StartSpan(proj *models.Project, saveCtx bool, spanName string) jen.Code

func StartSpanWithInlineCtx

func StartSpanWithInlineCtx(proj *models.Project, saveCtx bool, spanName jen.Code) jen.Code

func StartSpanWithVar

func StartSpanWithVar(proj *models.Project, saveCtx bool, spanName jen.Code) jen.Code

func ValuePointerWrapper

func ValuePointerWrapper(typ string, c jen.Code) func() jen.Code

func WriteHeader

func WriteHeader(status string) jen.Code

WriteHeader calls res.WriteHeader for a given status

func WriteXHeader

func WriteXHeader(varName, status string) jen.Code

WriteXHeader calls WriteHeader for a given variable name

Types

This section is empty.

Jump to

Keyboard shortcuts

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