github.com/rmarku/gomarkdoc@v0.0.0-20230517164305-78688ebe4325/testData/lang/function/README.md (about) 1 <!-- Code generated by gomarkdoc. DO NOT EDIT --> 2 3 # function 4 5 ```go 6 import "github.com/rmarku/gomarkdoc/testData/lang/function" 7 ``` 8 9 ## Index 10 11 - [Constants](#constants) 12 - [Variables](#variables) 13 - [func Standalone(p1 int, p2 string) (int, error)](#Standalone) 14 - [type Generic](#Generic) 15 - [func (r Generic[T]) WithGenericReceiver()](#Generic[T].WithGenericReceiver) 16 - [type Receiver](#Receiver) 17 - [func New() Receiver](#New) 18 - [func (r \*Receiver) WithPtrReceiver()](#Receiver.WithPtrReceiver) 19 - [func (r Receiver) WithReceiver()](#Receiver.WithReceiver) 20 21 ## Constants 22 23 <a name="ConstA"></a>Set of constants for this package. 24 25 ```go 26 const ( 27 ConstA = "string" 28 ConstB = true 29 ) 30 ``` 31 32 ## Variables 33 34 <a name="Variable"></a>Variable is a package\-level variable. 35 36 ```go 37 var Variable = 5 38 ``` 39 40 <a name="Standalone"></a> 41 42 ## func [Standalone](https://github.com/rmarku/gomarkdoc/blob/master/testData/lang/function/func.go#L14) 43 44 ```go 45 func Standalone(p1 int, p2 string) (int, error) 46 ``` 47 48 Standalone provides a function that is not part of a type. 49 50 Additional description can be provided in subsequent paragraphs, including code blocks and headers 51 52 ### Header A 53 54 This section contains a code block. 55 56 ``` 57 Code Block 58 More of Code Block 59 ``` 60 61 <details><summary>Example</summary> 62 <p> 63 64 ```go 65 package main 66 67 import ( 68 "fmt" 69 70 "github.com/rmarku/gomarkdoc/testData/lang/function" 71 ) 72 73 func main() { 74 res, _ := function.Standalone(2, "abc") 75 fmt.Println(res) 76 } 77 ``` 78 79 #### Output 80 81 ``` 82 2 83 ``` 84 85 </p> 86 </details> 87 88 <details><summary>Example (Zero)</summary> 89 <p> 90 91 ```go 92 package main 93 94 import ( 95 "fmt" 96 97 "github.com/rmarku/gomarkdoc/testData/lang/function" 98 ) 99 100 func main() { 101 res, _ := function.Standalone(0, "def") 102 fmt.Println(res) 103 } 104 ``` 105 106 #### Output 107 108 ``` 109 0 110 ``` 111 112 </p> 113 </details> 114 115 <a name="Generic"></a> 116 117 ## type [Generic](https://github.com/rmarku/gomarkdoc/blob/master/testData/lang/function/func.go#L33) 118 119 Generic is a struct with a generic type. 120 121 ```go 122 type Generic[T any] struct{} 123 ``` 124 125 <a name="Generic[T].WithGenericReceiver"></a> 126 127 ### func \(Generic\[T\]\) [WithGenericReceiver](https://github.com/rmarku/gomarkdoc/blob/master/testData/lang/function/func.go#L36) 128 129 ```go 130 func (r Generic[T]) WithGenericReceiver() 131 ``` 132 133 WithGenericReceiver has a receiver with a generic type. 134 135 <details><summary>Example</summary> 136 <p> 137 138 ```go 139 package main 140 141 import ( 142 "github.com/rmarku/gomarkdoc/testData/lang/function" 143 ) 144 145 func main() { 146 r := function.Generic[int]{} 147 r.WithGenericReceiver() 148 } 149 ``` 150 151 </p> 152 </details> 153 154 <a name="Receiver"></a> 155 156 ## type [Receiver](https://github.com/rmarku/gomarkdoc/blob/master/testData/lang/function/func.go#L19) 157 158 Receiver is a type used to demonstrate functions with receivers. 159 160 ```go 161 type Receiver struct{} 162 ``` 163 164 <details><summary>Example</summary> 165 <p> 166 167 ```go 168 package main 169 170 import ( 171 "fmt" 172 173 "github.com/rmarku/gomarkdoc/testData/lang/function" 174 ) 175 176 func main() { 177 r := &function.Receiver{} 178 fmt.Println(r) 179 } 180 ``` 181 182 </p> 183 </details> 184 185 <details><summary>Example (Sub Test)</summary> 186 <p> 187 188 ```go 189 package main 190 191 import ( 192 "github.com/rmarku/gomarkdoc/testData/lang/function" 193 ) 194 195 func main() { 196 var r function.Receiver 197 r.WithReceiver() 198 } 199 ``` 200 201 </p> 202 </details> 203 204 <a name="New"></a> 205 206 ### func [New](https://github.com/rmarku/gomarkdoc/blob/master/testData/lang/function/func.go#L22) 207 208 ```go 209 func New() Receiver 210 ``` 211 212 New is an initializer for Receiver. 213 214 <a name="Receiver.WithPtrReceiver"></a> 215 216 ### func \(\*Receiver\) [WithPtrReceiver](https://github.com/rmarku/gomarkdoc/blob/master/testData/lang/function/func.go#L30) 217 218 ```go 219 func (r *Receiver) WithPtrReceiver() 220 ``` 221 222 WithPtrReceiver has a pointer receiver. 223 224 <a name="Receiver.WithReceiver"></a> 225 226 ### func \(Receiver\) [WithReceiver](https://github.com/rmarku/gomarkdoc/blob/master/testData/lang/function/func.go#L27) 227 228 ```go 229 func (r Receiver) WithReceiver() 230 ``` 231 232 WithReceiver has a receiver. 233 234 Generated by [gomarkdoc](https://github.com/rmarku/gomarkdoc)