function

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const (
	ConstA = "string"
	ConstB = true
)

Set of constants for this package.

Variables

View Source
var Variable = 5

Variable is a package-level variable.

Functions

func Standalone

func Standalone(p1 int, p2 string) (int, error)

Standalone provides a function that is not part of a type.

Additional description can be provided in subsequent paragraphs, including code blocks and headers

Header A

This section contains a code block.

Code Block
More of Code Block
Example
package main

import (
	"fmt"

	"github.com/anthonyme00/gomarkdoc/testData/lang/function"
)

func main() {
	// Comment
	res, _ := function.Standalone(2, "abc")
	fmt.Println(res)
}
Output:

2
Example (Zero)
package main

import (
	"fmt"

	"github.com/anthonyme00/gomarkdoc/testData/lang/function"
)

func main() {
	res, _ := function.Standalone(0, "def")
	fmt.Println(res)
}
Output:

0

Types

type Generic

type Generic[T any] struct{}

Generic is a struct with a generic type.

func (Generic[T]) WithGenericReceiver

func (r Generic[T]) WithGenericReceiver()

WithGenericReceiver has a receiver with a generic type.

Example
package main

import (
	"github.com/anthonyme00/gomarkdoc/testData/lang/function"
)

func main() {
	r := function.Generic[int]{}
	r.WithGenericReceiver()
}
Output:

type Receiver

type Receiver struct{}

Receiver is a type used to demonstrate functions with receivers.

Example
package main

import (
	"fmt"

	"github.com/anthonyme00/gomarkdoc/testData/lang/function"
)

func main() {
	// Add some comments
	r := &function.Receiver{}
	// And some more
	fmt.Println(r)
}
Output:

Example (SubTest)
package main

import (
	"github.com/anthonyme00/gomarkdoc/testData/lang/function"
)

func main() {
	var r function.Receiver
	r.WithReceiver()
}
Output:

func New

func New() Receiver

New is an initializer for Receiver.

func (*Receiver) WithPtrReceiver

func (r *Receiver) WithPtrReceiver()

WithPtrReceiver has a pointer receiver.

func (Receiver) WithReceiver

func (r Receiver) WithReceiver()

WithReceiver has a receiver.

Jump to

Keyboard shortcuts

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