code
stringlengths 22
3.95M
| docstring
stringlengths 20
17.8k
| func_name
stringlengths 1
472
| language
stringclasses 1
value | repo
stringlengths 6
57
| path
stringlengths 4
226
| url
stringlengths 43
277
| license
stringclasses 7
values |
|---|---|---|---|---|---|---|---|
func Load(path string) (*packages.Package, error) {
cfg := &packages.Config{Mode: packages.NeedName | packages.NeedFiles | packages.NeedCompiledGoFiles | packages.NeedImports | packages.NeedDeps}
pkgs, err := packages.Load(cfg, path)
if err != nil {
return nil, err
}
if len(pkgs) < 1 {
return nil, errPackageNotFound
}
if len(pkgs[0].Errors) > 0 {
return nil, pkgs[0].Errors[0]
}
return pkgs[0], nil
}
|
Load loads package by its import path
|
Load
|
go
|
hexdigest/gowrap
|
pkg/package.go
|
https://github.com/hexdigest/gowrap/blob/master/pkg/package.go
|
MIT
|
func AST(fs *token.FileSet, p *packages.Package) (*Package, error) {
dir := Dir(p)
pkgs, err := parser.ParseDir(fs, dir, nil, parser.DeclarationErrors|parser.ParseComments)
if err != nil {
return nil, err
}
if ap, ok := pkgs[p.Name]; ok {
return &Package{
Name: p.Name,
Files: ap.Files,
}, nil
}
return &Package{Name: p.Name}, nil
}
|
AST returns package's abstract syntax tree
|
AST
|
go
|
hexdigest/gowrap
|
pkg/package.go
|
https://github.com/hexdigest/gowrap/blob/master/pkg/package.go
|
MIT
|
func Dir(p *packages.Package) string {
files := append(p.GoFiles, p.OtherFiles...)
if len(files) < 1 {
return p.PkgPath
}
return filepath.Dir(files[0])
}
|
Dir returns absolute path of the package in a filesystem
|
Dir
|
go
|
hexdigest/gowrap
|
pkg/package.go
|
https://github.com/hexdigest/gowrap/blob/master/pkg/package.go
|
MIT
|
func New(fs *token.FileSet, typeSpecs []*ast.TypeSpec, typesPrefix string) *Printer {
return &Printer{
fs: fs,
types: typeSpecs,
typesPrefix: typesPrefix,
buf: bytes.NewBuffer([]byte{}),
}
}
|
New returns Printer
If srcPackageName is not empty Printer assumes that printed node goes to the package
different from the srcPackageName and all references to the types listed in typeSpecs
should be prepended with the source package name selector
|
New
|
go
|
hexdigest/gowrap
|
printer/printer.go
|
https://github.com/hexdigest/gowrap/blob/master/printer/printer.go
|
MIT
|
func (p *Printer) Print(node ast.Node) (string, error) {
if node == nil {
return "", nil
}
defer p.buf.Reset()
err := printer.Fprint(p.buf, p.fs, node)
return p.buf.String(), err
}
|
Print prints AST node as is
|
Print
|
go
|
hexdigest/gowrap
|
printer/printer.go
|
https://github.com/hexdigest/gowrap/blob/master/printer/printer.go
|
MIT
|
func (p *Printer) PrintType(node ast.Node) (string, error) {
defer p.buf.Reset()
switch t := node.(type) {
case *ast.FuncType:
return p.printFunc(t)
case *ast.StarExpr:
return p.printPointer(t)
case *ast.Ellipsis:
return p.printVariadicParam(t)
case *ast.ChanType:
return p.printChan(t)
case *ast.ArrayType:
return p.printArray(t)
case *ast.MapType:
return p.printMap(t)
case *ast.StructType:
return p.printStruct(t)
case *ast.Ident:
return p.printIdent(t)
case *ast.IndexExpr:
return p.printGeneric(t)
case *ast.IndexListExpr:
return p.printGenericList(t)
}
err := printer.Fprint(p.buf, p.fs, node)
return p.buf.String(), err
}
|
PrintType prints node that represents a type, i.e. type of a function argument or a or struct field
If node references one of the types listed in p.types and srcPackageName is not empty
it adds source package selector to the type identifier
PrintType returns error if the srcPackageName is not empty and the printed type is unexported.
|
PrintType
|
go
|
hexdigest/gowrap
|
printer/printer.go
|
https://github.com/hexdigest/gowrap/blob/master/printer/printer.go
|
MIT
|
func (mmCaptureError *mElasticAPMMockCaptureError) Expect(ctx context.Context, err error) *mElasticAPMMockCaptureError {
if mmCaptureError.mock.funcCaptureError != nil {
mmCaptureError.mock.t.Fatalf("ElasticAPMMock.CaptureError mock is already set by Set")
}
if mmCaptureError.defaultExpectation == nil {
mmCaptureError.defaultExpectation = &ElasticAPMMockCaptureErrorExpectation{}
}
mmCaptureError.defaultExpectation.params = &ElasticAPMMockCaptureErrorParams{ctx, err}
for _, e := range mmCaptureError.expectations {
if minimock.Equal(e.params, mmCaptureError.defaultExpectation.params) {
mmCaptureError.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmCaptureError.defaultExpectation.params)
}
}
return mmCaptureError
}
|
Expect sets up expected params for ElasticAPM.CaptureError
|
Expect
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmCaptureError *mElasticAPMMockCaptureError) Inspect(f func(ctx context.Context, err error)) *mElasticAPMMockCaptureError {
if mmCaptureError.mock.inspectFuncCaptureError != nil {
mmCaptureError.mock.t.Fatalf("Inspect function is already set for ElasticAPMMock.CaptureError")
}
mmCaptureError.mock.inspectFuncCaptureError = f
return mmCaptureError
}
|
Inspect accepts an inspector function that has same arguments as the ElasticAPM.CaptureError
|
Inspect
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmCaptureError *mElasticAPMMockCaptureError) Return() *ElasticAPMMock {
if mmCaptureError.mock.funcCaptureError != nil {
mmCaptureError.mock.t.Fatalf("ElasticAPMMock.CaptureError mock is already set by Set")
}
if mmCaptureError.defaultExpectation == nil {
mmCaptureError.defaultExpectation = &ElasticAPMMockCaptureErrorExpectation{mock: mmCaptureError.mock}
}
return mmCaptureError.mock
}
|
Return sets up results that will be returned by ElasticAPM.CaptureError
|
Return
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmCaptureError *mElasticAPMMockCaptureError) Set(f func(ctx context.Context, err error)) *ElasticAPMMock {
if mmCaptureError.defaultExpectation != nil {
mmCaptureError.mock.t.Fatalf("Default expectation is already set for the ElasticAPM.CaptureError method")
}
if len(mmCaptureError.expectations) > 0 {
mmCaptureError.mock.t.Fatalf("Some expectations are already set for the ElasticAPM.CaptureError method")
}
mmCaptureError.mock.funcCaptureError = f
return mmCaptureError.mock
}
|
Set uses given function f to mock the ElasticAPM.CaptureError method
|
Set
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmCaptureError *ElasticAPMMock) CaptureErrorAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmCaptureError.afterCaptureErrorCounter)
}
|
CaptureErrorAfterCounter returns a count of finished ElasticAPMMock.CaptureError invocations
|
CaptureErrorAfterCounter
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmCaptureError *ElasticAPMMock) CaptureErrorBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmCaptureError.beforeCaptureErrorCounter)
}
|
CaptureErrorBeforeCounter returns a count of ElasticAPMMock.CaptureError invocations
|
CaptureErrorBeforeCounter
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmCaptureError *mElasticAPMMockCaptureError) Calls() []*ElasticAPMMockCaptureErrorParams {
mmCaptureError.mutex.RLock()
argCopy := make([]*ElasticAPMMockCaptureErrorParams, len(mmCaptureError.callArgs))
copy(argCopy, mmCaptureError.callArgs)
mmCaptureError.mutex.RUnlock()
return argCopy
}
|
Calls returns a list of arguments used in each call to ElasticAPMMock.CaptureError.
The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
Calls
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (m *ElasticAPMMock) MinimockCaptureErrorDone() bool {
for _, e := range m.CaptureErrorMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
// if default expectation was set then invocations count should be greater than zero
if m.CaptureErrorMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterCaptureErrorCounter) < 1 {
return false
}
// if func was set then invocations count should be greater than zero
if m.funcCaptureError != nil && mm_atomic.LoadUint64(&m.afterCaptureErrorCounter) < 1 {
return false
}
return true
}
|
MinimockCaptureErrorDone returns true if the count of the CaptureError invocations corresponds
the number of defined expectations
|
MinimockCaptureErrorDone
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmEndSpan *mElasticAPMMockEndSpan) Expect(span *apm.Span) *mElasticAPMMockEndSpan {
if mmEndSpan.mock.funcEndSpan != nil {
mmEndSpan.mock.t.Fatalf("ElasticAPMMock.EndSpan mock is already set by Set")
}
if mmEndSpan.defaultExpectation == nil {
mmEndSpan.defaultExpectation = &ElasticAPMMockEndSpanExpectation{}
}
mmEndSpan.defaultExpectation.params = &ElasticAPMMockEndSpanParams{span}
for _, e := range mmEndSpan.expectations {
if minimock.Equal(e.params, mmEndSpan.defaultExpectation.params) {
mmEndSpan.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmEndSpan.defaultExpectation.params)
}
}
return mmEndSpan
}
|
Expect sets up expected params for ElasticAPM.EndSpan
|
Expect
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmEndSpan *mElasticAPMMockEndSpan) Inspect(f func(span *apm.Span)) *mElasticAPMMockEndSpan {
if mmEndSpan.mock.inspectFuncEndSpan != nil {
mmEndSpan.mock.t.Fatalf("Inspect function is already set for ElasticAPMMock.EndSpan")
}
mmEndSpan.mock.inspectFuncEndSpan = f
return mmEndSpan
}
|
Inspect accepts an inspector function that has same arguments as the ElasticAPM.EndSpan
|
Inspect
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmEndSpan *mElasticAPMMockEndSpan) Return() *ElasticAPMMock {
if mmEndSpan.mock.funcEndSpan != nil {
mmEndSpan.mock.t.Fatalf("ElasticAPMMock.EndSpan mock is already set by Set")
}
if mmEndSpan.defaultExpectation == nil {
mmEndSpan.defaultExpectation = &ElasticAPMMockEndSpanExpectation{mock: mmEndSpan.mock}
}
return mmEndSpan.mock
}
|
Return sets up results that will be returned by ElasticAPM.EndSpan
|
Return
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmEndSpan *mElasticAPMMockEndSpan) Set(f func(span *apm.Span)) *ElasticAPMMock {
if mmEndSpan.defaultExpectation != nil {
mmEndSpan.mock.t.Fatalf("Default expectation is already set for the ElasticAPM.EndSpan method")
}
if len(mmEndSpan.expectations) > 0 {
mmEndSpan.mock.t.Fatalf("Some expectations are already set for the ElasticAPM.EndSpan method")
}
mmEndSpan.mock.funcEndSpan = f
return mmEndSpan.mock
}
|
Set uses given function f to mock the ElasticAPM.EndSpan method
|
Set
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmEndSpan *ElasticAPMMock) EndSpanAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmEndSpan.afterEndSpanCounter)
}
|
EndSpanAfterCounter returns a count of finished ElasticAPMMock.EndSpan invocations
|
EndSpanAfterCounter
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmEndSpan *ElasticAPMMock) EndSpanBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmEndSpan.beforeEndSpanCounter)
}
|
EndSpanBeforeCounter returns a count of ElasticAPMMock.EndSpan invocations
|
EndSpanBeforeCounter
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmEndSpan *mElasticAPMMockEndSpan) Calls() []*ElasticAPMMockEndSpanParams {
mmEndSpan.mutex.RLock()
argCopy := make([]*ElasticAPMMockEndSpanParams, len(mmEndSpan.callArgs))
copy(argCopy, mmEndSpan.callArgs)
mmEndSpan.mutex.RUnlock()
return argCopy
}
|
Calls returns a list of arguments used in each call to ElasticAPMMock.EndSpan.
The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
Calls
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (m *ElasticAPMMock) MinimockEndSpanDone() bool {
for _, e := range m.EndSpanMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
// if default expectation was set then invocations count should be greater than zero
if m.EndSpanMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterEndSpanCounter) < 1 {
return false
}
// if func was set then invocations count should be greater than zero
if m.funcEndSpan != nil && mm_atomic.LoadUint64(&m.afterEndSpanCounter) < 1 {
return false
}
return true
}
|
MinimockEndSpanDone returns true if the count of the EndSpan invocations corresponds
the number of defined expectations
|
MinimockEndSpanDone
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmSetLabel *mElasticAPMMockSetLabel) Expect(span *apm.Span, key string, value interface{}) *mElasticAPMMockSetLabel {
if mmSetLabel.mock.funcSetLabel != nil {
mmSetLabel.mock.t.Fatalf("ElasticAPMMock.SetLabel mock is already set by Set")
}
if mmSetLabel.defaultExpectation == nil {
mmSetLabel.defaultExpectation = &ElasticAPMMockSetLabelExpectation{}
}
mmSetLabel.defaultExpectation.params = &ElasticAPMMockSetLabelParams{span, key, value}
for _, e := range mmSetLabel.expectations {
if minimock.Equal(e.params, mmSetLabel.defaultExpectation.params) {
mmSetLabel.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmSetLabel.defaultExpectation.params)
}
}
return mmSetLabel
}
|
Expect sets up expected params for ElasticAPM.SetLabel
|
Expect
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmSetLabel *mElasticAPMMockSetLabel) Inspect(f func(span *apm.Span, key string, value interface{})) *mElasticAPMMockSetLabel {
if mmSetLabel.mock.inspectFuncSetLabel != nil {
mmSetLabel.mock.t.Fatalf("Inspect function is already set for ElasticAPMMock.SetLabel")
}
mmSetLabel.mock.inspectFuncSetLabel = f
return mmSetLabel
}
|
Inspect accepts an inspector function that has same arguments as the ElasticAPM.SetLabel
|
Inspect
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmSetLabel *mElasticAPMMockSetLabel) Return() *ElasticAPMMock {
if mmSetLabel.mock.funcSetLabel != nil {
mmSetLabel.mock.t.Fatalf("ElasticAPMMock.SetLabel mock is already set by Set")
}
if mmSetLabel.defaultExpectation == nil {
mmSetLabel.defaultExpectation = &ElasticAPMMockSetLabelExpectation{mock: mmSetLabel.mock}
}
return mmSetLabel.mock
}
|
Return sets up results that will be returned by ElasticAPM.SetLabel
|
Return
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmSetLabel *mElasticAPMMockSetLabel) Set(f func(span *apm.Span, key string, value interface{})) *ElasticAPMMock {
if mmSetLabel.defaultExpectation != nil {
mmSetLabel.mock.t.Fatalf("Default expectation is already set for the ElasticAPM.SetLabel method")
}
if len(mmSetLabel.expectations) > 0 {
mmSetLabel.mock.t.Fatalf("Some expectations are already set for the ElasticAPM.SetLabel method")
}
mmSetLabel.mock.funcSetLabel = f
return mmSetLabel.mock
}
|
Set uses given function f to mock the ElasticAPM.SetLabel method
|
Set
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmSetLabel *ElasticAPMMock) SetLabelAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmSetLabel.afterSetLabelCounter)
}
|
SetLabelAfterCounter returns a count of finished ElasticAPMMock.SetLabel invocations
|
SetLabelAfterCounter
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmSetLabel *ElasticAPMMock) SetLabelBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmSetLabel.beforeSetLabelCounter)
}
|
SetLabelBeforeCounter returns a count of ElasticAPMMock.SetLabel invocations
|
SetLabelBeforeCounter
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmSetLabel *mElasticAPMMockSetLabel) Calls() []*ElasticAPMMockSetLabelParams {
mmSetLabel.mutex.RLock()
argCopy := make([]*ElasticAPMMockSetLabelParams, len(mmSetLabel.callArgs))
copy(argCopy, mmSetLabel.callArgs)
mmSetLabel.mutex.RUnlock()
return argCopy
}
|
Calls returns a list of arguments used in each call to ElasticAPMMock.SetLabel.
The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
Calls
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (m *ElasticAPMMock) MinimockSetLabelDone() bool {
for _, e := range m.SetLabelMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
// if default expectation was set then invocations count should be greater than zero
if m.SetLabelMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterSetLabelCounter) < 1 {
return false
}
// if func was set then invocations count should be greater than zero
if m.funcSetLabel != nil && mm_atomic.LoadUint64(&m.afterSetLabelCounter) < 1 {
return false
}
return true
}
|
MinimockSetLabelDone returns true if the count of the SetLabel invocations corresponds
the number of defined expectations
|
MinimockSetLabelDone
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmStartSpan *mElasticAPMMockStartSpan) Expect(ctx context.Context, name string, spanType string) *mElasticAPMMockStartSpan {
if mmStartSpan.mock.funcStartSpan != nil {
mmStartSpan.mock.t.Fatalf("ElasticAPMMock.StartSpan mock is already set by Set")
}
if mmStartSpan.defaultExpectation == nil {
mmStartSpan.defaultExpectation = &ElasticAPMMockStartSpanExpectation{}
}
mmStartSpan.defaultExpectation.params = &ElasticAPMMockStartSpanParams{ctx, name, spanType}
for _, e := range mmStartSpan.expectations {
if minimock.Equal(e.params, mmStartSpan.defaultExpectation.params) {
mmStartSpan.mock.t.Fatalf("Expectation set by When has same params: %#v", *mmStartSpan.defaultExpectation.params)
}
}
return mmStartSpan
}
|
Expect sets up expected params for ElasticAPM.StartSpan
|
Expect
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmStartSpan *mElasticAPMMockStartSpan) Inspect(f func(ctx context.Context, name string, spanType string)) *mElasticAPMMockStartSpan {
if mmStartSpan.mock.inspectFuncStartSpan != nil {
mmStartSpan.mock.t.Fatalf("Inspect function is already set for ElasticAPMMock.StartSpan")
}
mmStartSpan.mock.inspectFuncStartSpan = f
return mmStartSpan
}
|
Inspect accepts an inspector function that has same arguments as the ElasticAPM.StartSpan
|
Inspect
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmStartSpan *mElasticAPMMockStartSpan) Return(sp1 *apm.Span, c2 context.Context) *ElasticAPMMock {
if mmStartSpan.mock.funcStartSpan != nil {
mmStartSpan.mock.t.Fatalf("ElasticAPMMock.StartSpan mock is already set by Set")
}
if mmStartSpan.defaultExpectation == nil {
mmStartSpan.defaultExpectation = &ElasticAPMMockStartSpanExpectation{mock: mmStartSpan.mock}
}
mmStartSpan.defaultExpectation.results = &ElasticAPMMockStartSpanResults{sp1, c2}
return mmStartSpan.mock
}
|
Return sets up results that will be returned by ElasticAPM.StartSpan
|
Return
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmStartSpan *mElasticAPMMockStartSpan) Set(f func(ctx context.Context, name string, spanType string) (sp1 *apm.Span, c2 context.Context)) *ElasticAPMMock {
if mmStartSpan.defaultExpectation != nil {
mmStartSpan.mock.t.Fatalf("Default expectation is already set for the ElasticAPM.StartSpan method")
}
if len(mmStartSpan.expectations) > 0 {
mmStartSpan.mock.t.Fatalf("Some expectations are already set for the ElasticAPM.StartSpan method")
}
mmStartSpan.mock.funcStartSpan = f
return mmStartSpan.mock
}
|
Set uses given function f to mock the ElasticAPM.StartSpan method
|
Set
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmStartSpan *mElasticAPMMockStartSpan) When(ctx context.Context, name string, spanType string) *ElasticAPMMockStartSpanExpectation {
if mmStartSpan.mock.funcStartSpan != nil {
mmStartSpan.mock.t.Fatalf("ElasticAPMMock.StartSpan mock is already set by Set")
}
expectation := &ElasticAPMMockStartSpanExpectation{
mock: mmStartSpan.mock,
params: &ElasticAPMMockStartSpanParams{ctx, name, spanType},
}
mmStartSpan.expectations = append(mmStartSpan.expectations, expectation)
return expectation
}
|
When sets expectation for the ElasticAPM.StartSpan which will trigger the result defined by the following
Then helper
|
When
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (e *ElasticAPMMockStartSpanExpectation) Then(sp1 *apm.Span, c2 context.Context) *ElasticAPMMock {
e.results = &ElasticAPMMockStartSpanResults{sp1, c2}
return e.mock
}
|
Then sets up ElasticAPM.StartSpan return parameters for the expectation previously defined by the When method
|
Then
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmStartSpan *ElasticAPMMock) StartSpanAfterCounter() uint64 {
return mm_atomic.LoadUint64(&mmStartSpan.afterStartSpanCounter)
}
|
StartSpanAfterCounter returns a count of finished ElasticAPMMock.StartSpan invocations
|
StartSpanAfterCounter
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmStartSpan *ElasticAPMMock) StartSpanBeforeCounter() uint64 {
return mm_atomic.LoadUint64(&mmStartSpan.beforeStartSpanCounter)
}
|
StartSpanBeforeCounter returns a count of ElasticAPMMock.StartSpan invocations
|
StartSpanBeforeCounter
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (mmStartSpan *mElasticAPMMockStartSpan) Calls() []*ElasticAPMMockStartSpanParams {
mmStartSpan.mutex.RLock()
argCopy := make([]*ElasticAPMMockStartSpanParams, len(mmStartSpan.callArgs))
copy(argCopy, mmStartSpan.callArgs)
mmStartSpan.mutex.RUnlock()
return argCopy
}
|
Calls returns a list of arguments used in each call to ElasticAPMMock.StartSpan.
The list is in the same order as the calls were made (i.e. recent calls have a higher index)
|
Calls
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (m *ElasticAPMMock) MinimockStartSpanDone() bool {
for _, e := range m.StartSpanMock.expectations {
if mm_atomic.LoadUint64(&e.Counter) < 1 {
return false
}
}
// if default expectation was set then invocations count should be greater than zero
if m.StartSpanMock.defaultExpectation != nil && mm_atomic.LoadUint64(&m.afterStartSpanCounter) < 1 {
return false
}
// if func was set then invocations count should be greater than zero
if m.funcStartSpan != nil && mm_atomic.LoadUint64(&m.afterStartSpanCounter) < 1 {
return false
}
return true
}
|
MinimockStartSpanDone returns true if the count of the StartSpan invocations corresponds
the number of defined expectations
|
MinimockStartSpanDone
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (m *ElasticAPMMock) MinimockFinish() {
if !m.minimockDone() {
m.MinimockCaptureErrorInspect()
m.MinimockEndSpanInspect()
m.MinimockSetLabelInspect()
m.MinimockStartSpanInspect()
m.t.FailNow()
}
}
|
MinimockFinish checks that all mocked methods have been called the expected number of times
|
MinimockFinish
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func (m *ElasticAPMMock) MinimockWait(timeout mm_time.Duration) {
timeoutCh := mm_time.After(timeout)
for {
if m.minimockDone() {
return
}
select {
case <-timeoutCh:
m.MinimockFinish()
return
case <-mm_time.After(10 * mm_time.Millisecond):
}
}
}
|
MinimockWait waits for all mocked methods to be called the expected number of times
|
MinimockWait
|
go
|
hexdigest/gowrap
|
templates_tests/elastic_apm_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/elastic_apm_mock_test.go
|
MIT
|
func NewTestInterfaceWithCircuitBreaker(base TestInterface, consecutiveErrors int, openInterval time.Duration, ignoreErrors ...error) *TestInterfaceWithCircuitBreaker {
return &TestInterfaceWithCircuitBreaker{
TestInterface: base,
_maxConsecutiveErrors: consecutiveErrors,
_openInterval: openInterval,
_ignoreErrors: ignoreErrors,
}
}
|
NewTestInterfaceWithCircuitBreaker breakes a circuit after consecutiveErrors of errors and closes the circuit again after openInterval of time.
If, after openInterval, the first method call results in error we open and close again.
|
NewTestInterfaceWithCircuitBreaker
|
go
|
hexdigest/gowrap
|
templates_tests/interface_with_circuitbreaker.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/interface_with_circuitbreaker.go
|
MIT
|
func NewTestInterfaceAPMTracing(base TestInterface, opts ...TestInterfaceAPMTracingOption) TestInterfaceAPMTracing {
r := TestInterfaceAPMTracing{
base: base,
startSpan: apm.StartSpan,
endSpan: func(span *apm.Span) {
span.End()
},
setLabel: func(span *apm.Span, key string, value interface{}) {
},
captureError: func(ctx context.Context, err error) {
apm.CaptureError(ctx, err).Send()
},
spanType: "testinterface",
}
for _, fn := range opts {
fn(&r)
}
return r
}
|
NewTestInterfaceAPMTracing returns an instance of the TestInterface decorated with go.elastic.co/apm/v2
|
NewTestInterfaceAPMTracing
|
go
|
hexdigest/gowrap
|
templates_tests/interface_with_elasticapm.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/interface_with_elasticapm.go
|
MIT
|
func NewTestInterfaceWithFallback(interval time.Duration, impls ...TestInterface) TestInterfaceWithFallback {
return TestInterfaceWithFallback{implementations: impls, interval: interval}
}
|
NewTestInterfaceWithFallback takes several implementations of the TestInterface and returns an instance of TestInterface
which calls all implementations concurrently with given interval and returns first non-error response.
|
NewTestInterfaceWithFallback
|
go
|
hexdigest/gowrap
|
templates_tests/interface_with_fallback.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/interface_with_fallback.go
|
MIT
|
func NewTestInterfaceWithLogger(base TestInterface, stdout, stderr io.Writer) TestInterfaceWithLogger {
return TestInterfaceWithLogger{
_base: base,
_stdlog: log.New(stdout, "", log.LstdFlags),
_errlog: log.New(stderr, "", log.LstdFlags),
}
}
|
NewTestInterfaceWithLogger instruments an implementation of the TestInterface with simple logging
|
NewTestInterfaceWithLogger
|
go
|
hexdigest/gowrap
|
templates_tests/interface_with_log.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/interface_with_log.go
|
MIT
|
func NewTestInterfaceWithLogrus(base TestInterface, log *logrus.Entry) TestInterfaceWithLogrus {
return TestInterfaceWithLogrus{
_base: base,
_log: log,
}
}
|
NewTestInterfaceWithLogrus instruments an implementation of the TestInterface with simple logging
|
NewTestInterfaceWithLogrus
|
go
|
hexdigest/gowrap
|
templates_tests/interface_with_logrus.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/interface_with_logrus.go
|
MIT
|
func NewTestInterfaceWithPrometheus(base TestInterface, instanceName string) TestInterfaceWithPrometheus {
return TestInterfaceWithPrometheus{
base: base,
instanceName: instanceName,
}
}
|
NewTestInterfaceWithPrometheus returns an instance of the TestInterface decorated with prometheus summary metric
|
NewTestInterfaceWithPrometheus
|
go
|
hexdigest/gowrap
|
templates_tests/interface_with_prometheus.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/interface_with_prometheus.go
|
MIT
|
func NewAnotherTestInterfaceWithPrometheus(base AnotherTestInterface, instanceName string) AnotherTestInterfaceWithPrometheus {
return AnotherTestInterfaceWithPrometheus{
base: base,
instanceName: instanceName,
}
}
|
NewAnotherTestInterfaceWithPrometheus returns an instance of the AnotherTestInterface decorated with prometheus summary metric
|
NewAnotherTestInterfaceWithPrometheus
|
go
|
hexdigest/gowrap
|
templates_tests/interface_with_prometheus_metric_name.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/interface_with_prometheus_metric_name.go
|
MIT
|
func NewTestInterfaceRoundRobinPool(pool ...TestInterface) (*TestInterfaceRoundRobinPool, error) {
if len(pool) == 0 {
return nil, errors.New("empty pool")
}
return &TestInterfaceRoundRobinPool{pool: pool, poolSize: uint32(len(pool))}, nil
}
|
NewTestInterfaceRoundRobinPool takes several implementations of the TestInterface and returns an instance of the TestInterface
that picks one of the given implementations using Round-robin algorithm and delegates method call to it
|
NewTestInterfaceRoundRobinPool
|
go
|
hexdigest/gowrap
|
templates_tests/interface_with_robinpool.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/interface_with_robinpool.go
|
MIT
|
func MustNewTestInterfaceRoundRobinPool(pool ...TestInterface) *TestInterfaceRoundRobinPool {
if len(pool) == 0 {
panic("empty pool")
}
return &TestInterfaceRoundRobinPool{pool: pool, poolSize: uint32(len(pool))}
}
|
MustNewTestInterfaceRoundRobinPool takes several implementations of the TestInterface and returns an instance of the TestInterface
that picks one of the given implementations using Round-robin algorithm and delegates method call to it.
|
MustNewTestInterfaceRoundRobinPool
|
go
|
hexdigest/gowrap
|
templates_tests/interface_with_robinpool.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/interface_with_robinpool.go
|
MIT
|
func NewTestInterfacePool(impls ...TestInterface) TestInterfacePool {
if len(impls) == 0 {
panic("empty pool")
}
pool := make(chan TestInterface, len(impls))
for _, i := range impls {
pool <- i
}
return TestInterfacePool{pool: pool}
}
|
NewTestInterfacePool takes several implementations of the TestInterface and returns an instance of the TestInterface
that uses sync.Pool of given implemetations
|
NewTestInterfacePool
|
go
|
hexdigest/gowrap
|
templates_tests/interface_with_syncpool.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/interface_with_syncpool.go
|
MIT
|
func NewSpanMock(t minimock.Tester) *SpanMock {
m := &SpanMock{t: t}
if controller, ok := t.(minimock.MockController); ok {
controller.RegisterMocker(m)
}
m.BaggageItemMock = mSpanMockBaggageItem{mock: m}
m.ContextMock = mSpanMockContext{mock: m}
m.FinishMock = mSpanMockFinish{mock: m}
m.FinishWithOptionsMock = mSpanMockFinishWithOptions{mock: m}
m.LogMock = mSpanMockLog{mock: m}
m.LogEventMock = mSpanMockLogEvent{mock: m}
m.LogEventWithPayloadMock = mSpanMockLogEventWithPayload{mock: m}
m.LogFieldsMock = mSpanMockLogFields{mock: m}
m.LogKVMock = mSpanMockLogKV{mock: m}
m.SetBaggageItemMock = mSpanMockSetBaggageItem{mock: m}
m.SetOperationNameMock = mSpanMockSetOperationName{mock: m}
m.SetTagMock = mSpanMockSetTag{mock: m}
m.TracerMock = mSpanMockTracer{mock: m}
return m
}
|
NewSpanMock returns a mock for github.com/opentracing/opentracing-go.Span
|
NewSpanMock
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockBaggageItem) Expect(p string) *mSpanMockBaggageItem {
m.mockExpectations = &SpanMockBaggageItemParams{p}
return m
}
|
Expect sets up expected params for the Span.BaggageItem
|
Expect
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockBaggageItem) Return(r string) *SpanMock {
m.mock.BaggageItemFunc = func(p string) string {
return r
}
return m.mock
}
|
Return sets up a mock for Span.BaggageItem to return Return's arguments
|
Return
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockBaggageItem) Set(f func(p string) (r string)) *SpanMock {
m.mock.BaggageItemFunc = f
return m.mock
}
|
Set uses given function f as a mock of Span.BaggageItem method
|
Set
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) BaggageItem(p string) (r string) {
atomic.AddUint64(&m.BaggageItemPreCounter, 1)
defer atomic.AddUint64(&m.BaggageItemCounter, 1)
if m.BaggageItemMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.BaggageItemMock.mockExpectations, SpanMockBaggageItemParams{p},
"Span.BaggageItem got unexpected parameters")
if m.BaggageItemFunc == nil {
m.t.Fatal("No results are set for the SpanMock.BaggageItem")
return
}
}
if m.BaggageItemFunc == nil {
m.t.Fatal("Unexpected call to SpanMock.BaggageItem")
return
}
return m.BaggageItemFunc(p)
}
|
BaggageItem implements github.com/opentracing/opentracing-go.Span interface
|
BaggageItem
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) BaggageItemMinimockCounter() uint64 {
return atomic.LoadUint64(&m.BaggageItemCounter)
}
|
BaggageItemMinimockCounter returns a count of SpanMock.BaggageItemFunc invocations
|
BaggageItemMinimockCounter
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) BaggageItemMinimockPreCounter() uint64 {
return atomic.LoadUint64(&m.BaggageItemPreCounter)
}
|
BaggageItemMinimockPreCounter returns the value of SpanMock.BaggageItem invocations
|
BaggageItemMinimockPreCounter
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockContext) Return(r opentracing.SpanContext) *SpanMock {
m.mock.ContextFunc = func() opentracing.SpanContext {
return r
}
return m.mock
}
|
Return sets up a mock for Span.Context to return Return's arguments
|
Return
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockContext) Set(f func() (r opentracing.SpanContext)) *SpanMock {
m.mock.ContextFunc = f
return m.mock
}
|
Set uses given function f as a mock of Span.Context method
|
Set
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) Context() (r opentracing.SpanContext) {
atomic.AddUint64(&m.ContextPreCounter, 1)
defer atomic.AddUint64(&m.ContextCounter, 1)
if m.ContextFunc == nil {
m.t.Fatal("Unexpected call to SpanMock.Context")
return
}
return m.ContextFunc()
}
|
Context implements github.com/opentracing/opentracing-go.Span interface
|
Context
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) ContextMinimockCounter() uint64 {
return atomic.LoadUint64(&m.ContextCounter)
}
|
ContextMinimockCounter returns a count of SpanMock.ContextFunc invocations
|
ContextMinimockCounter
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) ContextMinimockPreCounter() uint64 {
return atomic.LoadUint64(&m.ContextPreCounter)
}
|
ContextMinimockPreCounter returns the value of SpanMock.Context invocations
|
ContextMinimockPreCounter
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockFinish) Return() *SpanMock {
m.mock.FinishFunc = func() {
return
}
return m.mock
}
|
Return sets up a mock for Span.Finish to return Return's arguments
|
Return
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockFinish) Set(f func()) *SpanMock {
m.mock.FinishFunc = f
return m.mock
}
|
Set uses given function f as a mock of Span.Finish method
|
Set
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) Finish() {
atomic.AddUint64(&m.FinishPreCounter, 1)
defer atomic.AddUint64(&m.FinishCounter, 1)
if m.FinishFunc == nil {
m.t.Fatal("Unexpected call to SpanMock.Finish")
return
}
m.FinishFunc()
}
|
Finish implements github.com/opentracing/opentracing-go.Span interface
|
Finish
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) FinishMinimockCounter() uint64 {
return atomic.LoadUint64(&m.FinishCounter)
}
|
FinishMinimockCounter returns a count of SpanMock.FinishFunc invocations
|
FinishMinimockCounter
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) FinishMinimockPreCounter() uint64 {
return atomic.LoadUint64(&m.FinishPreCounter)
}
|
FinishMinimockPreCounter returns the value of SpanMock.Finish invocations
|
FinishMinimockPreCounter
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockFinishWithOptions) Expect(p opentracing.FinishOptions) *mSpanMockFinishWithOptions {
m.mockExpectations = &SpanMockFinishWithOptionsParams{p}
return m
}
|
Expect sets up expected params for the Span.FinishWithOptions
|
Expect
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockFinishWithOptions) Return() *SpanMock {
m.mock.FinishWithOptionsFunc = func(p opentracing.FinishOptions) {
return
}
return m.mock
}
|
Return sets up a mock for Span.FinishWithOptions to return Return's arguments
|
Return
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockFinishWithOptions) Set(f func(p opentracing.FinishOptions)) *SpanMock {
m.mock.FinishWithOptionsFunc = f
return m.mock
}
|
Set uses given function f as a mock of Span.FinishWithOptions method
|
Set
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) FinishWithOptions(p opentracing.FinishOptions) {
atomic.AddUint64(&m.FinishWithOptionsPreCounter, 1)
defer atomic.AddUint64(&m.FinishWithOptionsCounter, 1)
if m.FinishWithOptionsMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.FinishWithOptionsMock.mockExpectations, SpanMockFinishWithOptionsParams{p},
"Span.FinishWithOptions got unexpected parameters")
if m.FinishWithOptionsFunc == nil {
m.t.Fatal("No results are set for the SpanMock.FinishWithOptions")
return
}
}
if m.FinishWithOptionsFunc == nil {
m.t.Fatal("Unexpected call to SpanMock.FinishWithOptions")
return
}
m.FinishWithOptionsFunc(p)
}
|
FinishWithOptions implements github.com/opentracing/opentracing-go.Span interface
|
FinishWithOptions
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) FinishWithOptionsMinimockCounter() uint64 {
return atomic.LoadUint64(&m.FinishWithOptionsCounter)
}
|
FinishWithOptionsMinimockCounter returns a count of SpanMock.FinishWithOptionsFunc invocations
|
FinishWithOptionsMinimockCounter
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) FinishWithOptionsMinimockPreCounter() uint64 {
return atomic.LoadUint64(&m.FinishWithOptionsPreCounter)
}
|
FinishWithOptionsMinimockPreCounter returns the value of SpanMock.FinishWithOptions invocations
|
FinishWithOptionsMinimockPreCounter
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockLog) Expect(p opentracing.LogData) *mSpanMockLog {
m.mockExpectations = &SpanMockLogParams{p}
return m
}
|
Expect sets up expected params for the Span.Log
|
Expect
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockLog) Return() *SpanMock {
m.mock.LogFunc = func(p opentracing.LogData) {
return
}
return m.mock
}
|
Return sets up a mock for Span.Log to return Return's arguments
|
Return
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockLog) Set(f func(p opentracing.LogData)) *SpanMock {
m.mock.LogFunc = f
return m.mock
}
|
Set uses given function f as a mock of Span.Log method
|
Set
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) Log(p opentracing.LogData) {
atomic.AddUint64(&m.LogPreCounter, 1)
defer atomic.AddUint64(&m.LogCounter, 1)
if m.LogMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.LogMock.mockExpectations, SpanMockLogParams{p},
"Span.Log got unexpected parameters")
if m.LogFunc == nil {
m.t.Fatal("No results are set for the SpanMock.Log")
return
}
}
if m.LogFunc == nil {
m.t.Fatal("Unexpected call to SpanMock.Log")
return
}
m.LogFunc(p)
}
|
Log implements github.com/opentracing/opentracing-go.Span interface
|
Log
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) LogMinimockCounter() uint64 {
return atomic.LoadUint64(&m.LogCounter)
}
|
LogMinimockCounter returns a count of SpanMock.LogFunc invocations
|
LogMinimockCounter
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) LogMinimockPreCounter() uint64 {
return atomic.LoadUint64(&m.LogPreCounter)
}
|
LogMinimockPreCounter returns the value of SpanMock.Log invocations
|
LogMinimockPreCounter
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockLogEvent) Expect(p string) *mSpanMockLogEvent {
m.mockExpectations = &SpanMockLogEventParams{p}
return m
}
|
Expect sets up expected params for the Span.LogEvent
|
Expect
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockLogEvent) Return() *SpanMock {
m.mock.LogEventFunc = func(p string) {
return
}
return m.mock
}
|
Return sets up a mock for Span.LogEvent to return Return's arguments
|
Return
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockLogEvent) Set(f func(p string)) *SpanMock {
m.mock.LogEventFunc = f
return m.mock
}
|
Set uses given function f as a mock of Span.LogEvent method
|
Set
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) LogEvent(p string) {
atomic.AddUint64(&m.LogEventPreCounter, 1)
defer atomic.AddUint64(&m.LogEventCounter, 1)
if m.LogEventMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.LogEventMock.mockExpectations, SpanMockLogEventParams{p},
"Span.LogEvent got unexpected parameters")
if m.LogEventFunc == nil {
m.t.Fatal("No results are set for the SpanMock.LogEvent")
return
}
}
if m.LogEventFunc == nil {
m.t.Fatal("Unexpected call to SpanMock.LogEvent")
return
}
m.LogEventFunc(p)
}
|
LogEvent implements github.com/opentracing/opentracing-go.Span interface
|
LogEvent
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) LogEventMinimockCounter() uint64 {
return atomic.LoadUint64(&m.LogEventCounter)
}
|
LogEventMinimockCounter returns a count of SpanMock.LogEventFunc invocations
|
LogEventMinimockCounter
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) LogEventMinimockPreCounter() uint64 {
return atomic.LoadUint64(&m.LogEventPreCounter)
}
|
LogEventMinimockPreCounter returns the value of SpanMock.LogEvent invocations
|
LogEventMinimockPreCounter
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockLogEventWithPayload) Expect(p string, p1 interface{}) *mSpanMockLogEventWithPayload {
m.mockExpectations = &SpanMockLogEventWithPayloadParams{p, p1}
return m
}
|
Expect sets up expected params for the Span.LogEventWithPayload
|
Expect
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockLogEventWithPayload) Return() *SpanMock {
m.mock.LogEventWithPayloadFunc = func(p string, p1 interface{}) {
return
}
return m.mock
}
|
Return sets up a mock for Span.LogEventWithPayload to return Return's arguments
|
Return
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockLogEventWithPayload) Set(f func(p string, p1 interface{})) *SpanMock {
m.mock.LogEventWithPayloadFunc = f
return m.mock
}
|
Set uses given function f as a mock of Span.LogEventWithPayload method
|
Set
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) LogEventWithPayload(p string, p1 interface{}) {
atomic.AddUint64(&m.LogEventWithPayloadPreCounter, 1)
defer atomic.AddUint64(&m.LogEventWithPayloadCounter, 1)
if m.LogEventWithPayloadMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.LogEventWithPayloadMock.mockExpectations, SpanMockLogEventWithPayloadParams{p, p1},
"Span.LogEventWithPayload got unexpected parameters")
if m.LogEventWithPayloadFunc == nil {
m.t.Fatal("No results are set for the SpanMock.LogEventWithPayload")
return
}
}
if m.LogEventWithPayloadFunc == nil {
m.t.Fatal("Unexpected call to SpanMock.LogEventWithPayload")
return
}
m.LogEventWithPayloadFunc(p, p1)
}
|
LogEventWithPayload implements github.com/opentracing/opentracing-go.Span interface
|
LogEventWithPayload
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) LogEventWithPayloadMinimockCounter() uint64 {
return atomic.LoadUint64(&m.LogEventWithPayloadCounter)
}
|
LogEventWithPayloadMinimockCounter returns a count of SpanMock.LogEventWithPayloadFunc invocations
|
LogEventWithPayloadMinimockCounter
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) LogEventWithPayloadMinimockPreCounter() uint64 {
return atomic.LoadUint64(&m.LogEventWithPayloadPreCounter)
}
|
LogEventWithPayloadMinimockPreCounter returns the value of SpanMock.LogEventWithPayload invocations
|
LogEventWithPayloadMinimockPreCounter
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockLogFields) Expect(p ...log.Field) *mSpanMockLogFields {
m.mockExpectations = &SpanMockLogFieldsParams{p}
return m
}
|
Expect sets up expected params for the Span.LogFields
|
Expect
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockLogFields) Return() *SpanMock {
m.mock.LogFieldsFunc = func(p ...log.Field) {
return
}
return m.mock
}
|
Return sets up a mock for Span.LogFields to return Return's arguments
|
Return
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockLogFields) Set(f func(p ...log.Field)) *SpanMock {
m.mock.LogFieldsFunc = f
return m.mock
}
|
Set uses given function f as a mock of Span.LogFields method
|
Set
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) LogFields(p ...log.Field) {
atomic.AddUint64(&m.LogFieldsPreCounter, 1)
defer atomic.AddUint64(&m.LogFieldsCounter, 1)
if m.LogFieldsMock.mockExpectations != nil {
testify_assert.Equal(m.t, *m.LogFieldsMock.mockExpectations, SpanMockLogFieldsParams{p},
"Span.LogFields got unexpected parameters")
if m.LogFieldsFunc == nil {
m.t.Fatal("No results are set for the SpanMock.LogFields")
return
}
}
if m.LogFieldsFunc == nil {
m.t.Fatal("Unexpected call to SpanMock.LogFields")
return
}
m.LogFieldsFunc(p...)
}
|
LogFields implements github.com/opentracing/opentracing-go.Span interface
|
LogFields
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) LogFieldsMinimockCounter() uint64 {
return atomic.LoadUint64(&m.LogFieldsCounter)
}
|
LogFieldsMinimockCounter returns a count of SpanMock.LogFieldsFunc invocations
|
LogFieldsMinimockCounter
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *SpanMock) LogFieldsMinimockPreCounter() uint64 {
return atomic.LoadUint64(&m.LogFieldsPreCounter)
}
|
LogFieldsMinimockPreCounter returns the value of SpanMock.LogFields invocations
|
LogFieldsMinimockPreCounter
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
func (m *mSpanMockLogKV) Expect(p ...interface{}) *mSpanMockLogKV {
m.mockExpectations = &SpanMockLogKVParams{p}
return m
}
|
Expect sets up expected params for the Span.LogKV
|
Expect
|
go
|
hexdigest/gowrap
|
templates_tests/span_mock_test.go
|
https://github.com/hexdigest/gowrap/blob/master/templates_tests/span_mock_test.go
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.