function

package
v0.0.0-...-db64682 Latest Latest
Warning

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

Go to latest
Published: May 20, 2023 License: MIT Imports: 0 Imported by: 0

README

function

import "github.com/chengyumeng/gomarkdoc/testData/lang/function"

Index

Constants

Set of constants for this package.

const (
    ConstA = "string"
    ConstB = true
)

Variables

Variable is a package-level variable.

var Variable = 5

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/chengyumeng/gomarkdoc/testData/lang/function"
)

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

Example (Zero)

package main

import (
	"fmt"

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

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

type Generic

Generic is a struct with a generic type.

type Generic[T any] struct{}

func (Generic[T]) WithGenericReceiver
func (r Generic[T]) WithGenericReceiver()

WithGenericReceiver has a receiver with a generic type.

Example

package main

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

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

type Receiver

Receiver is a type used to demonstrate functions with receivers.

type Receiver struct{}
Example

package main

import (
	"fmt"

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

func main() {
	r := &function.Receiver{}
	fmt.Println(r)
}

Example (Sub Test)

package main

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

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

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.

Generated by gomarkdoc

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/chengyumeng/gomarkdoc/testData/lang/function"
)

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

2
Example (Zero)
package main

import (
	"fmt"

	"github.com/chengyumeng/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/chengyumeng/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/chengyumeng/gomarkdoc/testData/lang/function"
)

func main() {
	r := &function.Receiver{}
	fmt.Println(r)
}
Output:

Example (SubTest)
package main

import (
	"github.com/chengyumeng/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