Skip to content

Commit feb7e70

Browse files
author
vektra-bot
committed
Deployed bd61701 to v3.0 with MkDocs 1.6.1 and mike 2.2.0.dev0
1 parent 2a2cf3c commit feb7e70

File tree

2 files changed

+147
-115
lines changed

2 files changed

+147
-115
lines changed

v3.0/search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

v3.0/templates/index.html

Lines changed: 146 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,33 @@
623623
<nav class="md-nav" aria-label="Data Provided To Templates">
624624
<ul class="md-nav__list">
625625

626+
<li class="md-nav__item">
627+
<a href="#mockeryyml" class="md-nav__link">
628+
<span class="md-ellipsis">
629+
630+
<span class="md-typeset">
631+
<code>.mockery.yml</code>
632+
</span>
633+
634+
</span>
635+
</a>
636+
637+
<nav class="md-nav" aria-label=".mockery.yml">
638+
<ul class="md-nav__list">
639+
640+
<li class="md-nav__item">
641+
<a href="#functions" class="md-nav__link">
642+
<span class="md-ellipsis">
643+
644+
<span class="md-typeset">
645+
Functions
646+
</span>
647+
648+
</span>
649+
</a>
650+
651+
</li>
652+
626653
<li class="md-nav__item">
627654
<a href="#variables" class="md-nav__link">
628655
<span class="md-ellipsis">
@@ -634,10 +661,29 @@
634661
</span>
635662
</a>
636663

664+
</li>
665+
666+
</ul>
667+
</nav>
668+
637669
</li>
638670

639671
<li class="md-nav__item">
640-
<a href="#functions" class="md-nav__link">
672+
<a href="#template-files" class="md-nav__link">
673+
<span class="md-ellipsis">
674+
675+
<span class="md-typeset">
676+
Template Files
677+
</span>
678+
679+
</span>
680+
</a>
681+
682+
<nav class="md-nav" aria-label="Template Files">
683+
<ul class="md-nav__list">
684+
685+
<li class="md-nav__item">
686+
<a href="#functions_1" class="md-nav__link">
641687
<span class="md-ellipsis">
642688

643689
<span class="md-typeset">
@@ -647,6 +693,24 @@
647693
</span>
648694
</a>
649695

696+
</li>
697+
698+
<li class="md-nav__item">
699+
<a href="#variables_1" class="md-nav__link">
700+
<span class="md-ellipsis">
701+
702+
<span class="md-typeset">
703+
Variables
704+
</span>
705+
706+
</span>
707+
</a>
708+
709+
</li>
710+
711+
</ul>
712+
</nav>
713+
650714
</li>
651715

652716
</ul>
@@ -974,6 +1038,33 @@
9741038
<nav class="md-nav" aria-label="Data Provided To Templates">
9751039
<ul class="md-nav__list">
9761040

1041+
<li class="md-nav__item">
1042+
<a href="#mockeryyml" class="md-nav__link">
1043+
<span class="md-ellipsis">
1044+
1045+
<span class="md-typeset">
1046+
<code>.mockery.yml</code>
1047+
</span>
1048+
1049+
</span>
1050+
</a>
1051+
1052+
<nav class="md-nav" aria-label=".mockery.yml">
1053+
<ul class="md-nav__list">
1054+
1055+
<li class="md-nav__item">
1056+
<a href="#functions" class="md-nav__link">
1057+
<span class="md-ellipsis">
1058+
1059+
<span class="md-typeset">
1060+
Functions
1061+
</span>
1062+
1063+
</span>
1064+
</a>
1065+
1066+
</li>
1067+
9771068
<li class="md-nav__item">
9781069
<a href="#variables" class="md-nav__link">
9791070
<span class="md-ellipsis">
@@ -985,10 +1076,29 @@
9851076
</span>
9861077
</a>
9871078

1079+
</li>
1080+
1081+
</ul>
1082+
</nav>
1083+
9881084
</li>
9891085

9901086
<li class="md-nav__item">
991-
<a href="#functions" class="md-nav__link">
1087+
<a href="#template-files" class="md-nav__link">
1088+
<span class="md-ellipsis">
1089+
1090+
<span class="md-typeset">
1091+
Template Files
1092+
</span>
1093+
1094+
</span>
1095+
</a>
1096+
1097+
<nav class="md-nav" aria-label="Template Files">
1098+
<ul class="md-nav__list">
1099+
1100+
<li class="md-nav__item">
1101+
<a href="#functions_1" class="md-nav__link">
9921102
<span class="md-ellipsis">
9931103

9941104
<span class="md-typeset">
@@ -998,6 +1108,24 @@
9981108
</span>
9991109
</a>
10001110

1111+
</li>
1112+
1113+
<li class="md-nav__item">
1114+
<a href="#variables_1" class="md-nav__link">
1115+
<span class="md-ellipsis">
1116+
1117+
<span class="md-typeset">
1118+
Variables
1119+
</span>
1120+
1121+
</span>
1122+
</a>
1123+
1124+
</li>
1125+
1126+
</ul>
1127+
</nav>
1128+
10011129
</li>
10021130

10031131
</ul>
@@ -1341,123 +1469,27 @@ <h4 id="template-data_1"><code>template-data</code><a class="headerlink" href="#
13411469
<td><code class="highlight"><span class="l l-Scalar l-Scalar-Plain">bool</span></code></td>
13421470
<td>Return zero values when no mock implementation is provided, do not panic.</td>
13431471
</tr>
1472+
<tr>
1473+
<td><code>with-resets</code></td>
1474+
<td><code class="highlight"><span class="l l-Scalar l-Scalar-Plain">bool</span></code></td>
1475+
<td>Generates methods that allow resetting calls made to the mocks.</td>
1476+
</tr>
13441477
</tbody>
13451478
</table>
13461479
<h3 id="template-file"><code class="highlight"><span class="nt">template</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;file://</span></code><a class="headerlink" href="#template-file" title="Permanent link">&para;</a></h3>
13471480
<p>You may also provide mockery a path to your own file using the <code>file://</code> protocol specifier. The string after <code>file://</code> will be the relative or absolute path of your template.</p>
13481481
<h2 id="data-provided-to-templates">Data Provided To Templates<a class="headerlink" href="#data-provided-to-templates" title="Permanent link">&para;</a></h2>
1349-
<div class="admonition warning">
1350-
<p class="admonition-title">Construction</p>
1351-
<p>This section is under construction.</p>
1352-
</div>
1353-
<p>mockery configuration makes use of the Go templating system.</p>
1354-
<h3 id="variables">Variables<a class="headerlink" href="#variables" title="Permanent link">&para;</a></h3>
1355-
<div class="admonition note">
1356-
<p class="admonition-title">Note</p>
1357-
<p>Templated variables are only available when using the <code>packages</code> config feature.</p>
1358-
</div>
1359-
<p>Variables that are marked as being templated are capable of using mockery-provided template parameters.</p>
1360-
<table>
1361-
<thead>
1362-
<tr>
1363-
<th>name</th>
1364-
<th>description</th>
1365-
</tr>
1366-
</thead>
1367-
<tbody>
1368-
<tr>
1369-
<td>ConfigDir</td>
1370-
<td>The directory path of the config file used. This is used to allow generation of mocks in a directory relative to the <code>.mockery.yaml</code> file, e.g. external interfaces.</td>
1371-
</tr>
1372-
<tr>
1373-
<td>InterfaceDir</td>
1374-
<td>The directory path of the original interface being mocked. This can be used as <br><code class="highlight"><span class="nt">dir</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;{{.InterfaceDir}}&quot;</span></code> to place your mocks adjacent to the original interface. This should not be used for external interfaces.</td>
1375-
</tr>
1376-
<tr>
1377-
<td>InterfaceDirRelative</td>
1378-
<td>The directory path of the original interface being mocked, relative to the current working directory. If the path cannot be made relative to the current working directory, this variable will be set equal to <code>PackagePath</code></td>
1379-
</tr>
1380-
<tr>
1381-
<td>InterfaceFile</td>
1382-
<td>The file path of the original interface being mocked. <strong>NOTE:</strong> This option will only write one mock implementation to the output file. If multiple mocks are defined in your original file, only one mock will be written to the output.</td>
1383-
</tr>
1384-
<tr>
1385-
<td>InterfaceName</td>
1386-
<td>The name of the original interface being mocked</td>
1387-
</tr>
1388-
<tr>
1389-
<td>InterfaceNameCamel</td>
1390-
<td>Converts a string <code>interface_name</code> to <code>InterfaceName</code>. <br /><b style="color:var(--md-code-hl-number-color);">DEPRECATED</b>: use <code>{{ .InterfaceName | camelcase }}</code> instead</td>
1391-
</tr>
1392-
<tr>
1393-
<td>InterfaceNameLowerCamel</td>
1394-
<td>Converts <code>InterfaceName</code> to <code>interfaceName</code> . <br /><b style="color:var(--md-code-hl-number-color);">DEPRECATED</b>: use <code>{{ .InterfaceName | camelcase | firstLower }}</code> instead</td>
1395-
</tr>
1396-
<tr>
1397-
<td>InterfaceNameSnake</td>
1398-
<td>Converts <code>InterfaceName</code> to <code>interface_name</code> . <br /><b style="color:var(--md-code-hl-number-color);">DEPRECATED</b>: use <code>{{ .InterfaceName | snakecase }}</code> instead</td>
1399-
</tr>
1400-
<tr>
1401-
<td>InterfaceNameLower</td>
1402-
<td>Converts <code>InterfaceName</code> to <code>interfacename</code> . <br /><b style="color:var(--md-code-hl-number-color);">DEPRECATED</b>: use <code>{{ .InterfaceName | lower }}</code> instead</td>
1403-
</tr>
1404-
<tr>
1405-
<td>Mock</td>
1406-
<td>A string that is <code>Mock</code> if the interface is exported, or <code>mock</code> if it is not exported. Useful when setting the name of your mock to something like: <br><code class="highlight"><span class="nt">mockname</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;{{.Mock}}{{.InterfaceName}}&quot;</span></code><br> This way, the mock name will retain the exported-ness of the original interface.</td>
1407-
</tr>
1408-
<tr>
1409-
<td>MockName</td>
1410-
<td>The name of the mock that will be generated. Note that this is simply the <code>mockname</code> configuration variable</td>
1411-
</tr>
1412-
<tr>
1413-
<td>PackageName</td>
1414-
<td>The name of the package from the original interface</td>
1415-
</tr>
1416-
<tr>
1417-
<td>PackagePath</td>
1418-
<td>The fully qualified package path of the original interface</td>
1419-
</tr>
1420-
</tbody>
1421-
</table>
1422-
<h3 id="functions">Functions<a class="headerlink" href="#functions" title="Permanent link">&para;</a></h3>
1423-
<div class="admonition note">
1424-
<p class="admonition-title">Note</p>
1425-
<p>Templated functions are only available when using the <code>packages</code> config feature.</p>
1426-
</div>
1427-
<p>Template functions allow you to inspect and manipulate template variables.</p>
1428-
<p>All template functions are calling native Go functions under the hood, so signatures and return values matches the Go functions you are probably already familiar with.</p>
1429-
<p>To learn more about the templating syntax, please <a href="https://pkg.go.dev/text/template">see the Go <code>text/template</code> documentation</a></p>
1430-
<ul>
1431-
<li><a href="https://pkg.go.dev/strings#Contains"><code>contains</code> string substr</a></li>
1432-
<li><a href="https://pkg.go.dev/strings#HasPrefix"><code>hasPrefix</code> string prefix</a></li>
1433-
<li><a href="https://pkg.go.dev/strings#HasSuffix"><code>hasSuffix</code> string suffix</a></li>
1434-
<li><a href="https://pkg.go.dev/strings#Join"><code>join</code> elems sep</a></li>
1435-
<li><a href="https://pkg.go.dev/strings#Replace"><code>replace</code> string old new n</a></li>
1436-
<li><a href="https://pkg.go.dev/strings#ReplaceAll"><code>replaceAll</code> string old new</a></li>
1437-
<li><a href="https://pkg.go.dev/strings#Split"><code>split</code> string sep</a></li>
1438-
<li><a href="https://pkg.go.dev/strings#SplitAfter"><code>splitAfter</code> string sep</a></li>
1439-
<li><a href="https://pkg.go.dev/strings#SplitAfterN"><code>splitAfterN</code> string sep n</a></li>
1440-
<li><a href="https://pkg.go.dev/strings#Trim"><code>trim</code> string cutset</a></li>
1441-
<li><a href="https://pkg.go.dev/strings#TrimLeft"><code>trimLeft</code> string cutset</a></li>
1442-
<li><a href="https://pkg.go.dev/strings#TrimPrefix"><code>trimPrefix</code> string prefix</a></li>
1443-
<li><a href="https://pkg.go.dev/strings#TrimRight"><code>trimRight</code> string cutset</a></li>
1444-
<li><a href="https://pkg.go.dev/strings#TrimSpace"><code>trimSpace</code> string</a></li>
1445-
<li><a href="https://pkg.go.dev/strings#TrimSuffix"><code>trimSuffix</code> string suffix</a></li>
1446-
<li><a href="https://pkg.go.dev/strings#ToLower"><code>lower</code> string</a></li>
1447-
<li><a href="https://pkg.go.dev/strings#ToUpper"><code>upper</code> string</a></li>
1448-
<li><a href="https://pkg.go.dev/github.com/huandu/xstrings#ToCamelCase"><code>camelcase</code> string</a></li>
1449-
<li><a href="https://pkg.go.dev/github.com/huandu/xstrings#ToSnakeCase"><code>snakecase</code> string</a></li>
1450-
<li><a href="https://pkg.go.dev/github.com/huandu/xstrings#ToKebabCase"><code>kebabcase</code> string</a></li>
1451-
<li><a href="https://pkg.go.dev/github.com/huandu/xstrings#FirstRuneToLower"><code>firstLower</code> string</a></li>
1452-
<li><a href="https://pkg.go.dev/github.com/huandu/xstrings#FirstRuneToUpper"><code>firstUpper</code> string</a></li>
1453-
<li><a href="https://pkg.go.dev/regexp#MatchString"><code>matchString</code> pattern</a></li>
1454-
<li><a href="https://pkg.go.dev/regexp#QuoteMeta"><code>quoteMeta</code> string</a></li>
1455-
<li><a href="https://pkg.go.dev/path/filepath#Base"><code>base</code> string</a></li>
1456-
<li><a href="https://pkg.go.dev/path/filepath#Clean"><code>clean</code> string</a></li>
1457-
<li><a href="https://pkg.go.dev/path/filepath#Dir"><code>dir</code> string</a></li>
1458-
<li><a href="https://pkg.go.dev/os#ExpandEnv"><code>expandEnv</code> string</a></li>
1459-
<li><a href="https://pkg.go.dev/os#Getenv"><code>getenv</code> string</a></li>
1460-
</ul>
1482+
<p>Mockery has two separate template instances: one for the <code>.mockery.yml</code> file, and one for the mock templates. Each instance has a different set of variables and functions available to it. All functions are <a href="https://pkg.go.dev/text/template#hdr-Pipelines">pipeline-compatible</a>.</p>
1483+
<h3 id="mockeryyml"><code>.mockery.yml</code><a class="headerlink" href="#mockeryyml" title="Permanent link">&para;</a></h3>
1484+
<h4 id="functions">Functions<a class="headerlink" href="#functions" title="Permanent link">&para;</a></h4>
1485+
<p>As seen in the <a href="../configuration/">configuration</a> section, mockery configuration has template variables and methods available to it. The functions available for use are defined in the <a href="https://pkg.go.dev/github.com/vektra/mockery/v3/template#pkg-variables"><code>StringManipulationFuncs</code></a>.</p>
1486+
<h4 id="variables">Variables<a class="headerlink" href="#variables" title="Permanent link">&para;</a></h4>
1487+
<p>The variables available are defined in the <a href="https://pkg.go.dev/github.com/vektra/mockery/v3/template#ConfigData"><code>template.ConfigData</code></a> struct.</p>
1488+
<h3 id="template-files">Template Files<a class="headerlink" href="#template-files" title="Permanent link">&para;</a></h3>
1489+
<h4 id="functions_1">Functions<a class="headerlink" href="#functions_1" title="Permanent link">&para;</a></h4>
1490+
<p>Template files have both <a href="https://pkg.go.dev/github.com/vektra/mockery/v3/template#pkg-variables"><code>StringManipulationFuncs</code></a> and <a href="https://pkg.go.dev/github.com/vektra/mockery/[email protected]/template#pkg-variables"><code>TemplateMockFuncs</code></a> available as functions.</p>
1491+
<h4 id="variables_1">Variables<a class="headerlink" href="#variables_1" title="Permanent link">&para;</a></h4>
1492+
<p>The template is supplied with the <a href="https://pkg.go.dev/github.com/vektra/mockery/v3/template#Data"><code>template.Data</code></a> struct. Some attributes return types such as <a href="https://pkg.go.dev/github.com/vektra/mockery/[email protected]/template#MockData"><code>template.MockData</code></a> and <a href="https://pkg.go.dev/github.com/vektra/mockery/v3/registry#Package"><code>registry.Package</code></a> which themselves contain methods that may also be called.</p>
14611493

14621494

14631495

0 commit comments

Comments
 (0)