sink

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: MIT Imports: 1 Imported by: 0

README

README

This document was generated by Gadget by providing a valid Go template. You can generate this document yourself by running the following in the /sink directory:

$ gadget --format template --template README.tpl

Or, without the --template ... flag as it will use README.tpl as the default template:

$ gadget --format template

Enjoy!

Package sink_test

File benchmarks_test.go

Function BenchmarkKitchenSink
  • func BenchmarkKitchenSink(b *testing.B) #
  • benchmarks_test.go:8:12 #
for i := 0; i < b.N; i++ {
	fmt.Println("intentionally not implemented")
}

File examples_test.go

Function ExampleNewNormalStructTest
  • func ExampleNewNormalStructTest() #
  • examples_test.go:9:16 #
s := sink.NewNormalStructTest("Wilhelm", "Murdoch", 40)

fmt.Println(s.First, s.Last)

File sink_test.go

Function TestKitchenSink
  • func TestKitchenSink(t *testing.T) #
  • sink_test.go:9:11 #
assert.True(t, true, true)

Package sink

File sink.go

Function PrintVars
  • func PrintVars() #
  • sink.go:30:34 #

PrintVars prints out a value on each line.

fmt.Println(one)
fmt.Println(two)
fmt.Println(three)

Function AssignCollection
  • func AssignCollection() #
  • sink.go:37:43 #

AssignCollection assigns values to var collection.

collection = make(map[string]map[string]string)

collection["one"] = map[string]string{"foo": "bar"}
collection["two"] = map[string]string{"merp": "flakes"}

Function PrintConst
  • func PrintConst() #
  • sink.go:46:50 #

PrintConst prints out a value on each line.

fmt.Println(ONE)
fmt.Println(TWO)
fmt.Println(THREE)

Function NewNormalStructTest
  • func NewNormalStructTest(first, last string, age int) *NormalStructTest #
  • sink.go:72:79 #

NewNormalStructTest returns a new instance of NormalStructTest.

return &NormalStructTest{
	First:              first,
	Last:               last,
	Age:                age,
	EmbeddedStructTest: &EmbeddedStructTest{"SWE"},
}

Function GetPrivate
  • func (nst *NormalStructTest) GetPrivate() string #
  • sink.go:82:84 #

GetPrivate is an accessor method that returns a dark secret.

return nst.private

Function GetOccupation
  • func (nst *NormalStructTest) GetOccupation() string #
  • sink.go:87:89 #

GetOccupation is an accessor method that returns an occupation.

return nst.Occupation

Function GetFullName
  • func (nst NormalStructTest) GetFullName() string #
  • sink.go:92:94 #

GetFullName is an function that attempts to return a full name.

return fmt.Sprint(nst.First, nst.Last)

Function notExported
  • func (nst NormalStructTest) notExported() string #
  • sink.go:98:100 #

notExported is an example of a function that will not be exported.

return "I should not be exported!"

Function NewGenericStructTest
  • func NewGenericStructTest[T any](first, last string, age int) *GenericStructTest[T] #
  • sink.go:111:113 #

NewGenericStructTest returns a new instance of GenericStructTest.

return &GenericStructTest[T]{first, last, age, "hidden"}

Function GetPrivate
  • func (nst *GenericStructTest[T]) GetPrivate() string #
  • sink.go:116:118 #

GetPrivate is an accessor method that returns a dark secret.

return nst.private

Function GetFullName
  • func (nst GenericStructTest[T]) GetFullName() string #
  • sink.go:121:123 #

GetFullName is an function that attempts to return a full name.

return fmt.Sprint(nst.First, nst.Last)

Function IsBlank
  • func (nst GenericStructTest[T]) IsBlank() { #
  • sink.go:126:126 #

IsBlank is an function that does not have a body.

Documentation

Overview

Package sink covers most, if not all, patterns to adequately-test gadget's capabilities.

Index

Examples

Constants

View Source
const (
	ONE   = 1 // represents the number 1
	TWO   = 2 // represents the number 2
	THREE = 3 // represents the number 3
)

a block comment describing const assignments:

Variables

This section is empty.

Functions

func AssignCollection

func AssignCollection()

AssignCollection assigns values to var collection.

func PrintConst

func PrintConst()

PrintConst prints out a value on each line.

func PrintVars

func PrintVars()

PrintVars prints out a value on each line.

Types

type EmbeddedStructTest

type EmbeddedStructTest struct {
	Occupation string // a standard job title.
}

EmbeddedStructTest represents an example of an embedded struct.

type GenericRandomType

type GenericRandomType[T any] []string

type GenericStructTest

type GenericStructTest[T any] struct {
	First string
	Last  string
	Age   int
	// contains filtered or unexported fields
}

GenericStructTest represents an example of a generic struct.

func NewGenericStructTest

func NewGenericStructTest[T any](first, last string, age int) *GenericStructTest[T]

NewGenericStructTest returns a new instance of GenericStructTest.

func (GenericStructTest[T]) GetFullName

func (nst GenericStructTest[T]) GetFullName() string

GetFullName is an function that attempts to return a full name.

func (*GenericStructTest[T]) GetPrivate

func (nst *GenericStructTest[T]) GetPrivate() string

GetPrivate is an accessor method that returns a dark secret.

func (GenericStructTest[T]) IsBlank

func (nst GenericStructTest[T]) IsBlank()

IsBlank is an function that does not have a body.

type InterfaceTest

type InterfaceTest interface {
	ImplementMe() // this should be added to your data structures to implement this interface.
}

InterfaceTest is an example of an interface definition.

type NormalChannelType

type NormalChannelType chan bool

type NormalFuncType

type NormalFuncType func() bool

type NormalRandomType

type NormalRandomType map[string]int

type NormalStructTest

type NormalStructTest struct {
	First string // first name
	Last  string // last name
	Age   int    // age

	*EmbeddedStructTest // an embedded struct
	// contains filtered or unexported fields
}

NormalStructTest represents an example of a top-level struct.

func NewNormalStructTest

func NewNormalStructTest(first, last string, age int) *NormalStructTest

NewNormalStructTest returns a new instance of NormalStructTest.

Example
package main

import (
	"fmt"

	"github.com/wilhelm-murdoch/go-gadget/sink"
)

func main() {
	s := sink.NewNormalStructTest("Wilhelm", "Murdoch", 40)

	fmt.Println(s.First, s.Last)

}
Output:

Wilhelm Murdoch

func (NormalStructTest) GetFullName

func (nst NormalStructTest) GetFullName() string

GetFullName is an function that attempts to return a full name.

func (*NormalStructTest) GetOccupation

func (nst *NormalStructTest) GetOccupation() string

GetOccupation is an accessor method that returns an occupation.

func (*NormalStructTest) GetPrivate

func (nst *NormalStructTest) GetPrivate() string

GetPrivate is an accessor method that returns a dark secret.

Jump to

Keyboard shortcuts

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