github.com/wfusion/gofusion@v1.1.14/assets/unittest/coverage.html (about) 1 <title>Coverage Report</title> 2 <meta charset=utf-8><style>body{background-color:#fff;font-family:helvetica neue,Helvetica,Arial,sans-serif}table{margin-left:10px;border-collapse:collapse}td{background-color:#fff;padding:2px}table.overview td{padding-right:20px}td.percent,td.linecount{text-align:right}div.package,#totalcov{color:#fff;background-color:#375eab;font-size:16px;font-weight:700;padding:10px;border-radius:5px 5px 5px 5px}div.package,#totalcov{float:right;right:10px}#totalcov{top:10px;position:relative;background-color:#fff;color:#000;border:1px solid #375eab;clear:both}#summaryWrapper{position:fixed;top:10px;float:right;right:10px}span.packageTotal{float:right;color:#000}#doctitle{background-color:#fff;font-size:24px;margin-top:20px;margin-left:10px;color:#375eab;font-weight:700}#about{margin-left:18px;font-size:10px}.functitle,.funcname{text-align:center;font-size:20px;font-weight:700;color:#375eab}.funcname{text-align:left;margin-top:20px;margin-left:10px;margin-bottom:20px;padding:2px 5px 5px;background-color:#e0ebf5}table.listing{margin-left:10px}table.listing td{padding:0;font-size:12px;background-color:#eee;vertical-align:top;padding-left:10px;border-bottom:1px solid #fff}table.listing td:first-child{text-align:right;font-weight:700;vertical-align:center}table.listing tr.miss td{background-color:#ffbbb8}table.listing tr:last-child td{font-weight:400;color:#000}table.listing tr:last-child td:first-child{font-weight:700}.info{margin-left:10px}.info code{}pre{margin:1px}pre.cmd{background-color:#e9e9e9;border-radius:5px 5px 5px 5px;padding:10px;margin:20px;line-height:18px;font-size:14px}a{text-decoration:none;color:#375eab}a:hover{text-decoration:underline}p{margin-left:10px}</style><div id=doctitle>Coverage Report</div><div id=about>Generated on Tue, 02 Apr 2024 16:14:19 CST with <a href=https://github.com/matm/gocov-html>gocov-html</a></div><div class=funcname>Report Overview</div><table class=overview><tr id=s_pkg_github.com/wfusion/gofusion/async><td><code><a href=#pkg_github.com/wfusion/gofusion/async>github.com/wfusion/gofusion/async</a></code><td class=percent><code>68.9%</code><td class=linecount><code>233/338</code><tr id=s_pkg_github.com/wfusion/gofusion/cache><td><code><a href=#pkg_github.com/wfusion/gofusion/cache>github.com/wfusion/gofusion/cache</a></code><td class=percent><code>77.0%</code><td class=linecount><code>224/291</code><tr id=s_pkg_github.com/wfusion/gofusion/common/constant><td><code><a href=#pkg_github.com/wfusion/gofusion/common/constant>github.com/wfusion/gofusion/common/constant</a></code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_pkg_github.com/wfusion/gofusion/common/di><td><code><a href=#pkg_github.com/wfusion/gofusion/common/di>github.com/wfusion/gofusion/common/di</a></code><td class=percent><code>69.0%</code><td class=linecount><code>40/58</code><tr id=s_pkg_github.com/wfusion/gofusion/common/env><td><code><a href=#pkg_github.com/wfusion/gofusion/common/env>github.com/wfusion/gofusion/common/env</a></code><td class=percent><code>61.9%</code><td class=linecount><code>13/21</code><tr id=s_pkg_github.com/wfusion/gofusion/common/infra/drivers/mongo><td><code><a href=#pkg_github.com/wfusion/gofusion/common/infra/drivers/mongo>github.com/wfusion/gofusion/common/infra/drivers/mongo</a></code><td class=percent><code>89.1%</code><td class=linecount><code>41/46</code><tr id=s_pkg_github.com/wfusion/gofusion/common/infra/drivers/orm><td><code><a href=#pkg_github.com/wfusion/gofusion/common/infra/drivers/orm>github.com/wfusion/gofusion/common/infra/drivers/orm</a></code><td class=percent><code>75.0%</code><td class=linecount><code>54/72</code><tr id=s_pkg_github.com/wfusion/gofusion/common/infra/drivers/orm/idgen><td><code><a href=#pkg_github.com/wfusion/gofusion/common/infra/drivers/orm/idgen>github.com/wfusion/gofusion/common/infra/drivers/orm/idgen</a></code><td class=percent><code>87.5%</code><td class=linecount><code>21/24</code><tr id=s_pkg_github.com/wfusion/gofusion/common/infra/drivers/redis><td><code><a href=#pkg_github.com/wfusion/gofusion/common/infra/drivers/redis>github.com/wfusion/gofusion/common/infra/drivers/redis</a></code><td class=percent><code>47.1%</code><td class=linecount><code>32/68</code><tr id=s_pkg_github.com/wfusion/gofusion/common/utils><td><code><a href=#pkg_github.com/wfusion/gofusion/common/utils>github.com/wfusion/gofusion/common/utils</a></code><td class=percent><code>54.7%</code><td class=linecount><code>519/948</code><tr id=s_pkg_github.com/wfusion/gofusion/common/utils/cipher><td><code><a href=#pkg_github.com/wfusion/gofusion/common/utils/cipher>github.com/wfusion/gofusion/common/utils/cipher</a></code><td class=percent><code>85.6%</code><td class=linecount><code>357/417</code><tr id=s_pkg_github.com/wfusion/gofusion/common/utils/clone><td><code><a href=#pkg_github.com/wfusion/gofusion/common/utils/clone>github.com/wfusion/gofusion/common/utils/clone</a></code><td class=percent><code>37.5%</code><td class=linecount><code>285/759</code><tr id=s_pkg_github.com/wfusion/gofusion/common/utils/cmp><td><code><a href=#pkg_github.com/wfusion/gofusion/common/utils/cmp>github.com/wfusion/gofusion/common/utils/cmp</a></code><td class=percent><code>23.1%</code><td class=linecount><code>33/143</code><tr id=s_pkg_github.com/wfusion/gofusion/common/utils/compress><td><code><a href=#pkg_github.com/wfusion/gofusion/common/utils/compress>github.com/wfusion/gofusion/common/utils/compress</a></code><td class=percent><code>73.7%</code><td class=linecount><code>101/137</code><tr id=s_pkg_github.com/wfusion/gofusion/common/utils/encode><td><code><a href=#pkg_github.com/wfusion/gofusion/common/utils/encode>github.com/wfusion/gofusion/common/utils/encode</a></code><td class=percent><code>84.3%</code><td class=linecount><code>167/198</code><tr id=s_pkg_github.com/wfusion/gofusion/common/utils/inspect><td><code><a href=#pkg_github.com/wfusion/gofusion/common/utils/inspect>github.com/wfusion/gofusion/common/utils/inspect</a></code><td class=percent><code>67.7%</code><td class=linecount><code>67/99</code><tr id=s_pkg_github.com/wfusion/gofusion/common/utils/serialize><td><code><a href=#pkg_github.com/wfusion/gofusion/common/utils/serialize>github.com/wfusion/gofusion/common/utils/serialize</a></code><td class=percent><code>66.7%</code><td class=linecount><code>70/105</code><tr id=s_pkg_github.com/wfusion/gofusion/config><td><code><a href=#pkg_github.com/wfusion/gofusion/config>github.com/wfusion/gofusion/config</a></code><td class=percent><code>79.1%</code><td class=linecount><code>360/455</code><tr id=s_pkg_github.com/wfusion/gofusion/context><td><code><a href=#pkg_github.com/wfusion/gofusion/context>github.com/wfusion/gofusion/context</a></code><td class=percent><code>75.0%</code><td class=linecount><code>87/116</code><tr id=s_pkg_github.com/wfusion/gofusion/cron><td><code><a href=#pkg_github.com/wfusion/gofusion/cron>github.com/wfusion/gofusion/cron</a></code><td class=percent><code>74.1%</code><td class=linecount><code>243/328</code><tr id=s_pkg_github.com/wfusion/gofusion/db><td><code><a href=#pkg_github.com/wfusion/gofusion/db>github.com/wfusion/gofusion/db</a></code><td class=percent><code>51.3%</code><td class=linecount><code>307/599</code><tr id=s_pkg_github.com/wfusion/gofusion/db/callbacks><td><code><a href=#pkg_github.com/wfusion/gofusion/db/callbacks>github.com/wfusion/gofusion/db/callbacks</a></code><td class=percent><code>43.0%</code><td class=linecount><code>65/151</code><tr id=s_pkg_github.com/wfusion/gofusion/db/plugins><td><code><a href=#pkg_github.com/wfusion/gofusion/db/plugins>github.com/wfusion/gofusion/db/plugins</a></code><td class=percent><code>61.0%</code><td class=linecount><code>407/667</code><tr id=s_pkg_github.com/wfusion/gofusion/db/softdelete><td><code><a href=#pkg_github.com/wfusion/gofusion/db/softdelete>github.com/wfusion/gofusion/db/softdelete</a></code><td class=percent><code>59.0%</code><td class=linecount><code>72/122</code><tr id=s_pkg_github.com/wfusion/gofusion/http><td><code><a href=#pkg_github.com/wfusion/gofusion/http>github.com/wfusion/gofusion/http</a></code><td class=percent><code>70.0%</code><td class=linecount><code>468/669</code><tr id=s_pkg_github.com/wfusion/gofusion/http/consts><td><code><a href=#pkg_github.com/wfusion/gofusion/http/consts>github.com/wfusion/gofusion/http/consts</a></code><td class=percent><code>88.9%</code><td class=linecount><code>8/9</code><tr id=s_pkg_github.com/wfusion/gofusion/http/gracefully><td><code><a href=#pkg_github.com/wfusion/gofusion/http/gracefully>github.com/wfusion/gofusion/http/gracefully</a></code><td class=percent><code>38.9%</code><td class=linecount><code>93/239</code><tr id=s_pkg_github.com/wfusion/gofusion/http/middleware><td><code><a href=#pkg_github.com/wfusion/gofusion/http/middleware>github.com/wfusion/gofusion/http/middleware</a></code><td class=percent><code>52.9%</code><td class=linecount><code>99/187</code><tr id=s_pkg_github.com/wfusion/gofusion/http/parser><td><code><a href=#pkg_github.com/wfusion/gofusion/http/parser>github.com/wfusion/gofusion/http/parser</a></code><td class=percent><code>47.4%</code><td class=linecount><code>144/304</code><tr id=s_pkg_github.com/wfusion/gofusion/i18n><td><code><a href=#pkg_github.com/wfusion/gofusion/i18n>github.com/wfusion/gofusion/i18n</a></code><td class=percent><code>74.7%</code><td class=linecount><code>65/87</code><tr id=s_pkg_github.com/wfusion/gofusion/internal/configor><td><code><a href=#pkg_github.com/wfusion/gofusion/internal/configor>github.com/wfusion/gofusion/internal/configor</a></code><td class=percent><code>59.3%</code><td class=linecount><code>150/253</code><tr id=s_pkg_github.com/wfusion/gofusion/internal/util/payload><td><code><a href=#pkg_github.com/wfusion/gofusion/internal/util/payload>github.com/wfusion/gofusion/internal/util/payload</a></code><td class=percent><code>60.2%</code><td class=linecount><code>127/211</code><tr id=s_pkg_github.com/wfusion/gofusion/lock><td><code><a href=#pkg_github.com/wfusion/gofusion/lock>github.com/wfusion/gofusion/lock</a></code><td class=percent><code>80.9%</code><td class=linecount><code>191/236</code><tr id=s_pkg_github.com/wfusion/gofusion/log><td><code><a href=#pkg_github.com/wfusion/gofusion/log>github.com/wfusion/gofusion/log</a></code><td class=percent><code>68.3%</code><td class=linecount><code>168/246</code><tr id=s_pkg_github.com/wfusion/gofusion/log/customlogger><td><code><a href=#pkg_github.com/wfusion/gofusion/log/customlogger>github.com/wfusion/gofusion/log/customlogger</a></code><td class=percent><code>59.2%</code><td class=linecount><code>287/485</code><tr id=s_pkg_github.com/wfusion/gofusion/log/encoder><td><code><a href=#pkg_github.com/wfusion/gofusion/log/encoder>github.com/wfusion/gofusion/log/encoder</a></code><td class=percent><code>100.0%</code><td class=linecount><code>12/12</code><tr id=s_pkg_github.com/wfusion/gofusion/metrics><td><code><a href=#pkg_github.com/wfusion/gofusion/metrics>github.com/wfusion/gofusion/metrics</a></code><td class=percent><code>72.6%</code><td class=linecount><code>191/263</code><tr id=s_pkg_github.com/wfusion/gofusion/mongo><td><code><a href=#pkg_github.com/wfusion/gofusion/mongo>github.com/wfusion/gofusion/mongo</a></code><td class=percent><code>76.4%</code><td class=linecount><code>110/144</code><tr id=s_pkg_github.com/wfusion/gofusion/mq><td><code><a href=#pkg_github.com/wfusion/gofusion/mq>github.com/wfusion/gofusion/mq</a></code><td class=percent><code>62.2%</code><td class=linecount><code>487/783</code><tr id=s_pkg_github.com/wfusion/gofusion/redis><td><code><a href=#pkg_github.com/wfusion/gofusion/redis>github.com/wfusion/gofusion/redis</a></code><td class=percent><code>23.6%</code><td class=linecount><code>108/458</code><tr id=s_pkg_github.com/wfusion/gofusion/routine><td><code><a href=#pkg_github.com/wfusion/gofusion/routine>github.com/wfusion/gofusion/routine</a></code><td class=percent><code>54.1%</code><td class=linecount><code>440/814</code></table><p>This coverage report has been generated with the following command:<pre class=cmd>gocov test github.com/wfusion/gofusion/async github.com/wfusion/gofusion/cache github.com/wfusion/gofusion/common/constant github.com/wfusion/gofusion/common/di github.com/wfusion/gofusion/common/env github.com/wfusion/gofusion/common/infra/drivers/mongo github.com/wfusion/gofusion/common/infra/drivers/orm github.com/wfusion/gofusion/common/infra/drivers/orm/idgen github.com/wfusion/gofusion/common/infra/drivers/redis github.com/wfusion/gofusion/common/utils github.com/wfusion/gofusion/common/utils/cipher github.com/wfusion/gofusion/common/utils/clone github.com/wfusion/gofusion/common/utils/cmp github.com/wfusion/gofusion/common/utils/compress github.com/wfusion/gofusion/common/utils/encode github.com/wfusion/gofusion/common/utils/inspect github.com/wfusion/gofusion/common/utils/serialize github.com/wfusion/gofusion/config github.com/wfusion/gofusion/context github.com/wfusion/gofusion/cron github.com/wfusion/gofusion/db github.com/wfusion/gofusion/db/callbacks github.com/wfusion/gofusion/db/plugins github.com/wfusion/gofusion/db/softdelete github.com/wfusion/gofusion/http github.com/wfusion/gofusion/http/consts github.com/wfusion/gofusion/http/gracefully github.com/wfusion/gofusion/http/middleware github.com/wfusion/gofusion/http/parser github.com/wfusion/gofusion/i18n github.com/wfusion/gofusion/internal/configor github.com/wfusion/gofusion/internal/util/payload github.com/wfusion/gofusion/lock github.com/wfusion/gofusion/log github.com/wfusion/gofusion/log/customlogger github.com/wfusion/gofusion/log/encoder github.com/wfusion/gofusion/metrics github.com/wfusion/gofusion/mongo github.com/wfusion/gofusion/mq github.com/wfusion/gofusion/redis github.com/wfusion/gofusion/routine | gocov-html </pre></div><div id=pkg_github.com/wfusion/gofusion/async class=funcname>Package Overview: github.com/wfusion/gofusion/async 3 <span class=packageTotal>68.9%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_Construct><td><code><a href=#fn_Construct>Construct(...)</a></code><td><code>github.com/wfusion/gofusion/async/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_asynqConsumer.shutdown><td><code><a href=#fn_asynqConsumer.shutdown>asynqConsumer.shutdown(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_@212:27><td><code><a href=#fn_@212:27>@212:27(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_asynqConsumer.adaptAsynqHandlerFunc><td><code><a href=#fn_asynqConsumer.adaptAsynqHandlerFunc>asynqConsumer.adaptAsynqHandlerFunc(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_asynqRedisConnOpt.MakeRedisClient><td><code><a href=#fn_asynqRedisConnOpt.MakeRedisClient>asynqRedisConnOpt.MakeRedisClient(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@122:9><td><code><a href=#fn_@122:9>@122:9(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Args><td><code><a href=#fn_Args>Args(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_asynqConsumer.format><td><code><a href=#fn_asynqConsumer.format>asynqConsumer.format(...)</a></code><td><code>github.com/wfusion/gofusion/async/log.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@125:9><td><code><a href=#fn_@125:9>@125:9(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_asynqConsumer.gatewayMiddleware><td><code><a href=#fn_asynqConsumer.gatewayMiddleware>asynqConsumer.gatewayMiddleware(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Queue><td><code><a href=#fn_Queue>Queue(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/async/flag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/async/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@127:9><td><code><a href=#fn_@127:9>@127:9(...)</a></code><td><code>github.com/wfusion/gofusion/async/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_asynqConsumer.unformatTaskName><td><code><a href=#fn_asynqConsumer.unformatTaskName>asynqConsumer.unformatTaskName(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_AppName><td><code><a href=#fn_AppName>AppName(...)</a></code><td><code>github.com/wfusion/gofusion/async/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_defaultQueue><td><code><a href=#fn_defaultQueue>defaultQueue(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_formatTaskName><td><code><a href=#fn_formatTaskName>formatTaskName(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@34:9><td><code><a href=#fn_@34:9>@34:9(...)</a></code><td><code>github.com/wfusion/gofusion/async/construct.go</code><td class=percent><code>92.3%</code><td class=linecount><code>12/13</code><tr id=s_fn_wrapParams><td><code><a href=#fn_wrapParams>wrapParams(...)</a></code><td><code>github.com/wfusion/gofusion/async/utils.go</code><td class=percent><code>90.0%</code><td class=linecount><code>9/10</code><tr id=s_fn_unwrapParams><td><code><a href=#fn_unwrapParams>unwrapParams(...)</a></code><td><code>github.com/wfusion/gofusion/async/utils.go</code><td class=percent><code>90.0%</code><td class=linecount><code>9/10</code><tr id=s_fn_newAsynqConsumer><td><code><a href=#fn_newAsynqConsumer>newAsynqConsumer(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>89.3%</code><td class=linecount><code>25/28</code><tr id=s_fn_asynqProducer.Go><td><code><a href=#fn_asynqProducer.Go>asynqProducer.Go(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>88.9%</code><td class=linecount><code>16/18</code><tr id=s_fn_asynqConsumer.info><td><code><a href=#fn_asynqConsumer.info>asynqConsumer.info(...)</a></code><td><code>github.com/wfusion/gofusion/async/log.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_asynqConsumer.Handle><td><code><a href=#fn_asynqConsumer.Handle>asynqConsumer.Handle(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>85.0%</code><td class=linecount><code>17/20</code><tr id=s_fn_asynqConsumer.Start><td><code><a href=#fn_asynqConsumer.Start>asynqConsumer.Start(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_asynqProducer.Goc><td><code><a href=#fn_asynqProducer.Goc>asynqProducer.Goc(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>82.4%</code><td class=linecount><code>14/17</code><tr id=s_fn_addInstance><td><code><a href=#fn_addInstance>addInstance(...)</a></code><td><code>github.com/wfusion/gofusion/async/construct.go</code><td class=percent><code>80.0%</code><td class=linecount><code>24/30</code><tr id=s_fn_P><td><code><a href=#fn_P>P(...)</a></code><td><code>github.com/wfusion/gofusion/async/construct.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_C><td><code><a href=#fn_C>C(...)</a></code><td><code>github.com/wfusion/gofusion/async/construct.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_@230:9><td><code><a href=#fn_@230:9>@230:9(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_asynqProducer.newTask><td><code><a href=#fn_asynqProducer.newTask>asynqProducer.newTask(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_asynqProducer.Send><td><code><a href=#fn_asynqProducer.Send>asynqProducer.Send(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>75.0%</code><td class=linecount><code>6/8</code><tr id=s_fn_asynqConsumer.HandleFunc><td><code><a href=#fn_asynqConsumer.HandleFunc>asynqConsumer.HandleFunc(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>66.7%</code><td class=linecount><code>10/15</code><tr id=s_fn_setParams><td><code><a href=#fn_setParams>setParams(...)</a></code><td><code>github.com/wfusion/gofusion/async/utils.go</code><td class=percent><code>66.7%</code><td class=linecount><code>8/12</code><tr id=s_fn_newAsynqProducer><td><code><a href=#fn_newAsynqProducer>newAsynqProducer(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>66.7%</code><td class=linecount><code>6/9</code><tr id=s_fn_asynqProducer.parseOption><td><code><a href=#fn_asynqProducer.parseOption>asynqProducer.parseOption(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>60.0%</code><td class=linecount><code>12/20</code><tr id=s_fn_asynqConsumer.warn><td><code><a href=#fn_asynqConsumer.warn>asynqConsumer.warn(...)</a></code><td><code>github.com/wfusion/gofusion/async/log.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_asynqConsumer.debug><td><code><a href=#fn_asynqConsumer.debug>asynqConsumer.debug(...)</a></code><td><code>github.com/wfusion/gofusion/async/log.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_asynqConsumer.Serve><td><code><a href=#fn_asynqConsumer.Serve>asynqConsumer.Serve(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_@81:40><td><code><a href=#fn_@81:40>@81:40(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_asynqConsumer.Use><td><code><a href=#fn_asynqConsumer.Use>asynqConsumer.Use(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@220:9><td><code><a href=#fn_@220:9>@220:9(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_asynqConsumer.newAsynqTask><td><code><a href=#fn_asynqConsumer.newAsynqTask>asynqConsumer.newAsynqTask(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@222:28><td><code><a href=#fn_@222:28>@222:28(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_task.ID><td><code><a href=#fn_task.ID>task.ID(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_asynqConsumer.adaptMiddleware><td><code><a href=#fn_asynqConsumer.adaptMiddleware>asynqConsumer.adaptMiddleware(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_task.Payload><td><code><a href=#fn_task.Payload>task.Payload(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_task.RawMessage><td><code><a href=#fn_task.RawMessage>task.RawMessage(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_TaskID><td><code><a href=#fn_TaskID>TaskID(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@119:9><td><code><a href=#fn_@119:9>@119:9(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@115:5><td><code><a href=#fn_@115:5>@115:5(...)</a></code><td><code>github.com/wfusion/gofusion/async/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_task.Name><td><code><a href=#fn_task.Name>task.Name(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Delay><td><code><a href=#fn_Delay>Delay(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@94:5><td><code><a href=#fn_@94:5>@94:5(...)</a></code><td><code>github.com/wfusion/gofusion/async/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_MaxRetry><td><code><a href=#fn_MaxRetry>MaxRetry(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@128:9><td><code><a href=#fn_@128:9>@128:9(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Deadline><td><code><a href=#fn_Deadline>Deadline(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@131:9><td><code><a href=#fn_@131:9>@131:9(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Timeout><td><code><a href=#fn_Timeout>Timeout(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@134:9><td><code><a href=#fn_@134:9>@134:9(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_asynqConsumer.adaptRouterHandlerFunc><td><code><a href=#fn_asynqConsumer.adaptRouterHandlerFunc>asynqConsumer.adaptRouterHandlerFunc(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@137:9><td><code><a href=#fn_@137:9>@137:9(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@241:9><td><code><a href=#fn_@241:9>@241:9(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@140:9><td><code><a href=#fn_@140:9>@140:9(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Retention><td><code><a href=#fn_Retention>Retention(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@143:9><td><code><a href=#fn_@143:9>@143:9(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@91:29><td><code><a href=#fn_@91:29>@91:29(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_asynqConsumer.newTask><td><code><a href=#fn_asynqConsumer.newTask>asynqConsumer.newTask(...)</a></code><td><code>github.com/wfusion/gofusion/async/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_DelayAt><td><code><a href=#fn_DelayAt>DelayAt(...)</a></code><td><code>github.com/wfusion/gofusion/async/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_Construct>func Construct</div><div class=info><a href=#s_fn_Construct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/construct.go</code>:</div><table class=listing><tr><td>24<td><code><pre>func Construct(ctx context.Context, confs map[string]*Conf, opts ...utils.OptionExtender) func() {</pre></code><tr><td>25<td><code><pre> opt := utils.ApplyOptions[config.InitOption](opts...)</pre></code><tr><td>26<td><code><pre> optU := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>27<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>28<td><code><pre> opt.AppName = optU.appName</pre></code><tr><td>29<td><code><pre> }</pre></code><tr><td>30<td><code><pre></pre></code><tr><td>31<td><code><pre> for name, conf := range confs {</pre></code><tr><td>32<td><code><pre> addInstance(ctx, name, conf, opt)</pre></code><tr><td>33<td><code><pre> }</pre></code><tr><td>34<td><code><pre> return func() {</pre></code><tr><td>35<td><code><pre> locker.Lock()</pre></code><tr><td>36<td><code><pre> defer locker.Unlock()</pre></code><tr><td>37<td><code><pre></pre></code><tr><td>38<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>39<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>40<td><code><pre> if consumers != nil {</pre></code><tr><td>41<td><code><pre> for name, router := range consumers[opt.AppName] {</pre></code><tr><td>42<td><code><pre> log.Printf("%v [Gofusion] %s %s %s exiting...", pid, app, config.ComponentAsync, name)</pre></code><tr><td>43<td><code><pre> if err := router.shutdown(); err == nil {</pre></code><tr><td>44<td><code><pre> log.Printf("%v [Gofusion] %s %s %s exited", pid, app, config.ComponentAsync, name)</pre></code><tr><td>45<td><code><pre> } else {</pre></code><tr><td>46<td><code><pre> log.Printf("%v [Gofusion] %s %s %s exit failed: %s", pid, app, config.ComponentAsync, name, err)</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre> delete(consumers, opt.AppName)</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre></pre></code><tr><td>52<td><code><pre> if producers != nil {</pre></code><tr><td>53<td><code><pre> producers[opt.AppName] = make(map[string]Producable, len(producers))</pre></code><tr><td>54<td><code><pre> }</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqConsumer.shutdown>func asynqConsumer.shutdown</div><div class=info><a href=#s_fn_asynqConsumer.shutdown>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>203<td><code><pre>func (a *asynqConsumer) shutdown() (err error) {</pre></code><tr><td>204<td><code><pre> if a.consumer != nil {</pre></code><tr><td>205<td><code><pre> _, catchErr := utils.Catch(a.consumer.Shutdown)</pre></code><tr><td>206<td><code><pre> err = multierr.Append(err, errors.Cause(catchErr))</pre></code><tr><td>207<td><code><pre> }</pre></code><tr><td>208<td><code><pre> return</pre></code><tr><td>209<td><code><pre>}</pre></code></table><div class=funcname id=fn_@212:27>func @212:27</div><div class=info><a href=#s_fn_@212:27>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>212<td><code><pre>func(ctx context.Context, raw *asynq.Task) (err error) {</pre></code><tr><td>213<td><code><pre> taskName := a.unformatTaskName(raw.Type())</pre></code><tr><td>214<td><code><pre> inspect.SetField(raw, asyncqTaskTypenameField, taskName)</pre></code><tr><td>215<td><code><pre> return next.ProcessTask(ctx, raw)</pre></code><tr><td>216<td><code><pre> }</pre></code></table><div class=funcname id=fn_asynqConsumer.adaptAsynqHandlerFunc>func asynqConsumer.adaptAsynqHandlerFunc</div><div class=info><a href=#s_fn_asynqConsumer.adaptAsynqHandlerFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>228<td><code><pre>func (a *asynqConsumer) adaptAsynqHandlerFunc(h any, typ reflect.Type, embed bool) asynq.HandlerFunc {</pre></code><tr><td>229<td><code><pre> fn := utils.WrapFunc1[error](h)</pre></code><tr><td>230<td><code><pre> return func(ctx context.Context, task *asynq.Task) (err error) {</pre></code><tr><td>231<td><code><pre> ctx, data, _, err := pd.Unseal(task.Payload(), pd.Type(typ))</pre></code><tr><td>232<td><code><pre> if err != nil {</pre></code><tr><td>233<td><code><pre> return</pre></code><tr><td>234<td><code><pre> }</pre></code><tr><td>235<td><code><pre> params := unwrapParams(typ, embed, data)</pre></code><tr><td>236<td><code><pre> return fn(append([]any{ctx}, params...)...)</pre></code><tr><td>237<td><code><pre> }</pre></code><tr><td>238<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRedisConnOpt.MakeRedisClient>func asynqRedisConnOpt.MakeRedisClient</div><div class=info><a href=#s_fn_asynqRedisConnOpt.MakeRedisClient>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>416<td><code><pre>func (a *asynqRedisConnOpt) MakeRedisClient() any { return a.UniversalClient }</pre></code></table><div class=funcname id=fn_@122:9>func @122:9</div><div class=info><a href=#s_fn_@122:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr><td>122<td><code><pre>func(o *produceOption) { o.args = append(o.args, args...) }</pre></code></table><div class=funcname id=fn_Args>func Args</div><div class=info><a href=#s_fn_Args>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr><td>121<td><code><pre>func Args(args ...any) utils.OptionFunc[produceOption] {</pre></code><tr><td>122<td><code><pre> return func(o *produceOption) { o.args = append(o.args, args...) }</pre></code><tr><td>123<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqConsumer.format>func asynqConsumer.format</div><div class=info><a href=#s_fn_asynqConsumer.format>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/log.go</code>:</div><table class=listing><tr><td>48<td><code><pre>func (a *asynqConsumer) format(src string) (dst string) {</pre></code><tr><td>49<td><code><pre> return fmt.Sprintf("%v [Gofusion] %s %s asynq %s",</pre></code><tr><td>50<td><code><pre> syscall.Getpid(), config.ComponentAsync, a.n, src)</pre></code><tr><td>51<td><code><pre>}</pre></code></table><div class=funcname id=fn_@125:9>func @125:9</div><div class=info><a href=#s_fn_@125:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr><td>125<td><code><pre>func(o *produceOption) { o.queue = queue }</pre></code></table><div class=funcname id=fn_asynqConsumer.gatewayMiddleware>func asynqConsumer.gatewayMiddleware</div><div class=info><a href=#s_fn_asynqConsumer.gatewayMiddleware>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>211<td><code><pre>func (a *asynqConsumer) gatewayMiddleware(next asynq.Handler) asynq.Handler {</pre></code><tr><td>212<td><code><pre> return asynq.HandlerFunc(func(ctx context.Context, raw *asynq.Task) (err error) {</pre></code><tr><td>213<td><code><pre> taskName := a.unformatTaskName(raw.Type())</pre></code><tr><td>214<td><code><pre> inspect.SetField(raw, asyncqTaskTypenameField, taskName)</pre></code><tr><td>215<td><code><pre> return next.ProcessTask(ctx, raw)</pre></code><tr><td>216<td><code><pre> })</pre></code><tr><td>217<td><code><pre>}</pre></code></table><div class=funcname id=fn_Queue>func Queue</div><div class=info><a href=#s_fn_Queue>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr><td>124<td><code><pre>func Queue(queue string) utils.OptionFunc[produceOption] {</pre></code><tr><td>125<td><code><pre> return func(o *produceOption) { o.queue = queue }</pre></code><tr><td>126<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/flag.go</code>:</div><table class=listing><tr><td>7<td><code><pre>func init() {</pre></code><tr><td>8<td><code><pre> pflag.StringVarP(&flagString, "async-config", "", "", "json string for async config")</pre></code><tr><td>9<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/construct.go</code>:</div><table class=listing><tr><td>164<td><code><pre>func init() {</pre></code><tr><td>165<td><code><pre> config.AddComponent(config.ComponentAsync, Construct, config.WithFlag(&flagString))</pre></code><tr><td>166<td><code><pre>}</pre></code></table><div class=funcname id=fn_@127:9>func @127:9</div><div class=info><a href=#s_fn_@127:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/construct.go</code>:</div><table class=listing><tr><td>127<td><code><pre>func(o *useOption) {</pre></code><tr><td>128<td><code><pre> o.appName = name</pre></code><tr><td>129<td><code><pre> }</pre></code></table><div class=funcname id=fn_asynqConsumer.unformatTaskName>func asynqConsumer.unformatTaskName</div><div class=info><a href=#s_fn_asynqConsumer.unformatTaskName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>246<td><code><pre>func (a *asynqConsumer) unformatTaskName(taskName string) (result string) {</pre></code><tr><td>247<td><code><pre> return strings.TrimPrefix(taskName, fmt.Sprintf("%s:async:", config.Use(a.appName).AppName()))</pre></code><tr><td>248<td><code><pre>}</pre></code></table><div class=funcname id=fn_AppName>func AppName</div><div class=info><a href=#s_fn_AppName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/construct.go</code>:</div><table class=listing><tr><td>126<td><code><pre>func AppName(name string) utils.OptionFunc[useOption] {</pre></code><tr><td>127<td><code><pre> return func(o *useOption) {</pre></code><tr><td>128<td><code><pre> o.appName = name</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre>}</pre></code></table><div class=funcname id=fn_defaultQueue>func defaultQueue</div><div class=info><a href=#s_fn_defaultQueue>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>422<td><code><pre>func defaultQueue(appName string) (result string) {</pre></code><tr><td>423<td><code><pre> return fmt.Sprintf("%s:async", config.Use(appName).AppName())</pre></code><tr><td>424<td><code><pre>}</pre></code></table><div class=funcname id=fn_formatTaskName>func formatTaskName</div><div class=info><a href=#s_fn_formatTaskName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>418<td><code><pre>func formatTaskName(appName, taskName string) (result string) {</pre></code><tr><td>419<td><code><pre> return fmt.Sprintf("%s:async:%s", config.Use(appName).AppName(), taskName)</pre></code><tr><td>420<td><code><pre>}</pre></code></table><div class=funcname id=fn_@34:9>func @34:9</div><div class=info><a href=#s_fn_@34:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/construct.go</code>:</div><table class=listing><tr><td>34<td><code><pre>func() {</pre></code><tr><td>35<td><code><pre> locker.Lock()</pre></code><tr><td>36<td><code><pre> defer locker.Unlock()</pre></code><tr><td>37<td><code><pre></pre></code><tr><td>38<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>39<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>40<td><code><pre> if consumers != nil {</pre></code><tr><td>41<td><code><pre> for name, router := range consumers[opt.AppName] {</pre></code><tr><td>42<td><code><pre> log.Printf("%v [Gofusion] %s %s %s exiting...", pid, app, config.ComponentAsync, name)</pre></code><tr><td>43<td><code><pre> if err := router.shutdown(); err == nil {</pre></code><tr><td>44<td><code><pre> log.Printf("%v [Gofusion] %s %s %s exited", pid, app, config.ComponentAsync, name)</pre></code><tr><td>45<td><code><pre> } else {</pre></code><tr class=miss><td>46<td><code><pre> log.Printf("%v [Gofusion] %s %s %s exit failed: %s", pid, app, config.ComponentAsync, name, err)</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre> delete(consumers, opt.AppName)</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre></pre></code><tr><td>52<td><code><pre> if producers != nil {</pre></code><tr><td>53<td><code><pre> producers[opt.AppName] = make(map[string]Producable, len(producers))</pre></code><tr><td>54<td><code><pre> }</pre></code><tr><td>55<td><code><pre> }</pre></code></table><div class=funcname id=fn_wrapParams>func wrapParams</div><div class=info><a href=#s_fn_wrapParams>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/utils.go</code>:</div><table class=listing><tr><td>8<td><code><pre>func wrapParams(fn any) (argType reflect.Type, embed bool) {</pre></code><tr><td>9<td><code><pre> typ := reflect.TypeOf(fn)</pre></code><tr><td>10<td><code><pre></pre></code><tr><td>11<td><code><pre> inLength := typ.NumIn()</pre></code><tr><td>12<td><code><pre> if inLength == 1 {</pre></code><tr class=miss><td>13<td><code><pre> return</pre></code><tr><td>14<td><code><pre> }</pre></code><tr><td>15<td><code><pre> if inLength == 2 {</pre></code><tr><td>16<td><code><pre> return typ.In(1), false</pre></code><tr><td>17<td><code><pre> }</pre></code><tr><td>18<td><code><pre></pre></code><tr><td>19<td><code><pre> fields := make([]reflect.StructField, 0, inLength)</pre></code><tr><td>20<td><code><pre> for i := 1; i < inLength; i++ {</pre></code><tr><td>21<td><code><pre> fields = append(fields, reflect.StructField{</pre></code><tr><td>22<td><code><pre> Name: fmt.Sprintf("Arg%X", i+1),</pre></code><tr><td>23<td><code><pre> PkgPath: "",</pre></code><tr><td>24<td><code><pre> Type: typ.In(i),</pre></code><tr><td>25<td><code><pre> Tag: "",</pre></code><tr><td>26<td><code><pre> Offset: 0,</pre></code><tr><td>27<td><code><pre> Index: nil,</pre></code><tr><td>28<td><code><pre> Anonymous: false,</pre></code><tr><td>29<td><code><pre> })</pre></code><tr><td>30<td><code><pre> }</pre></code><tr><td>31<td><code><pre></pre></code><tr><td>32<td><code><pre> return reflect.StructOf(fields), true</pre></code><tr><td>33<td><code><pre>}</pre></code></table><div class=funcname id=fn_unwrapParams>func unwrapParams</div><div class=info><a href=#s_fn_unwrapParams>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/utils.go</code>:</div><table class=listing><tr><td>35<td><code><pre>func unwrapParams(typ reflect.Type, embed bool, arg any) (params []any) {</pre></code><tr><td>36<td><code><pre> if typ == nil {</pre></code><tr class=miss><td>37<td><code><pre> return</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre></pre></code><tr><td>40<td><code><pre> if !embed {</pre></code><tr><td>41<td><code><pre> return []any{arg}</pre></code><tr><td>42<td><code><pre> }</pre></code><tr><td>43<td><code><pre></pre></code><tr><td>44<td><code><pre> argVal := reflect.Indirect(reflect.ValueOf(arg))</pre></code><tr><td>45<td><code><pre> num := argVal.Type().NumField()</pre></code><tr><td>46<td><code><pre> params = make([]any, 0, num)</pre></code><tr><td>47<td><code><pre> for i := 0; i < num; i++ {</pre></code><tr><td>48<td><code><pre> params = append(params, argVal.Field(i).Interface())</pre></code><tr><td>49<td><code><pre> }</pre></code><tr><td>50<td><code><pre></pre></code><tr><td>51<td><code><pre> return</pre></code><tr><td>52<td><code><pre>}</pre></code></table><div class=funcname id=fn_newAsynqConsumer>func newAsynqConsumer</div><div class=info><a href=#s_fn_newAsynqConsumer>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>47<td><code><pre>func newAsynqConsumer(ctx context.Context, appName, name string, conf *Conf) Consumable {</pre></code><tr><td>48<td><code><pre> consumer := &asynqConsumer{appName: appName, n: name, c: conf}</pre></code><tr><td>49<td><code><pre></pre></code><tr><td>50<td><code><pre> var rdsCli rdsDrv.UniversalClient</pre></code><tr><td>51<td><code><pre> switch conf.InstanceType {</pre></code><tr><td>52<td><code><pre> case instanceTypeRedis:</pre></code><tr><td>53<td><code><pre> rdsCli = redis.Use(ctx, conf.Instance, redis.AppName(appName))</pre></code><tr><td>54<td><code><pre> case instanceTypeDB:</pre></code><tr class=miss><td>55<td><code><pre> fallthrough</pre></code><tr><td>56<td><code><pre> default:</pre></code><tr class=miss><td>57<td><code><pre> panic(errors.Errorf("unknown instance type: %s", conf.InstanceType))</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre></pre></code><tr><td>60<td><code><pre> if consumer.logger == nil && utils.IsStrNotBlank(conf.Logger) {</pre></code><tr><td>61<td><code><pre> loggerType := inspect.TypeOf(conf.Logger)</pre></code><tr><td>62<td><code><pre> loggerValue := reflect.New(loggerType)</pre></code><tr><td>63<td><code><pre> if loggerValue.Type().Implements(customLoggerType) {</pre></code><tr><td>64<td><code><pre> logger := log.Use(conf.LogInstance, log.AppName(appName))</pre></code><tr><td>65<td><code><pre> loggerValue.Interface().(customLogger).Init(logger, appName, name)</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre> consumer.logger = loggerValue.Convert(asynqLoggerType).Interface().(asynq.Logger)</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre></pre></code><tr><td>70<td><code><pre> logLevel := asynq.LogLevel(0)</pre></code><tr><td>71<td><code><pre> utils.MustSuccess(logLevel.Set(conf.LogLevel))</pre></code><tr><td>72<td><code><pre></pre></code><tr><td>73<td><code><pre> consumer.ServeMux = asynq.NewServeMux()</pre></code><tr><td>74<td><code><pre> asynqCfg := asynq.Config{</pre></code><tr><td>75<td><code><pre> Concurrency: conf.ConsumerConcurrency,</pre></code><tr><td>76<td><code><pre> BaseContext: context.Background,</pre></code><tr><td>77<td><code><pre> RetryDelayFunc: asynq.DefaultRetryDelayFunc,</pre></code><tr><td>78<td><code><pre> IsFailure: nil,</pre></code><tr><td>79<td><code><pre> Queues: nil,</pre></code><tr><td>80<td><code><pre> StrictPriority: conf.StrictPriority,</pre></code><tr><td>81<td><code><pre> ErrorHandler: asynq.ErrorHandlerFunc(func(ctx context.Context, task *asynq.Task, err error) {</pre></code><tr><td>82<td><code><pre> taskName := "unknown"</pre></code><tr><td>83<td><code><pre> if task != nil {</pre></code><tr><td>84<td><code><pre> taskName = consumer.unformatTaskName(task.Type())</pre></code><tr><td>85<td><code><pre> }</pre></code><tr><td>86<td><code><pre> consumer.info(ctx, "handle task %s message error %s", taskName, err)</pre></code><tr><td>87<td><code><pre> }),</pre></code><tr><td>88<td><code><pre> Logger: consumer.logger,</pre></code><tr><td>89<td><code><pre> LogLevel: logLevel,</pre></code><tr><td>90<td><code><pre> ShutdownTimeout: 8 * time.Second,</pre></code><tr><td>91<td><code><pre> HealthCheckFunc: func(err error) { consumer.warn(ctx, "health check check failed: %s", err) },</pre></code><tr><td>92<td><code><pre> HealthCheckInterval: 15 * time.Second,</pre></code><tr><td>93<td><code><pre> DelayedTaskCheckInterval: 5 * time.Second,</pre></code><tr><td>94<td><code><pre> GroupGracePeriod: 1 * time.Minute,</pre></code><tr><td>95<td><code><pre> GroupMaxDelay: 0,</pre></code><tr><td>96<td><code><pre> GroupMaxSize: 0,</pre></code><tr><td>97<td><code><pre> GroupAggregator: nil,</pre></code><tr><td>98<td><code><pre> DisableRedisConnClose: true,</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre> if len(conf.Queues) > 0 {</pre></code><tr><td>101<td><code><pre> asynqCfg.Queues = make(map[string]int, len(conf.Queues))</pre></code><tr><td>102<td><code><pre> for _, queue := range conf.Queues {</pre></code><tr><td>103<td><code><pre> if _, ok := asynqCfg.Queues[queue.Name]; ok {</pre></code><tr class=miss><td>104<td><code><pre> panic(ErrDuplicatedQueueName)</pre></code><tr><td>105<td><code><pre> }</pre></code><tr><td>106<td><code><pre> if utils.IsStrBlank(queue.Name) {</pre></code><tr><td>107<td><code><pre> queue.Name = defaultQueue(appName)</pre></code><tr><td>108<td><code><pre> }</pre></code><tr><td>109<td><code><pre> asynqCfg.Queues[queue.Name] = queue.Level</pre></code><tr><td>110<td><code><pre> }</pre></code><tr><td>111<td><code><pre> } else {</pre></code><tr><td>112<td><code><pre> asynqCfg.Queues = map[string]int{defaultQueue(appName): 3}</pre></code><tr><td>113<td><code><pre> }</pre></code><tr><td>114<td><code><pre></pre></code><tr><td>115<td><code><pre> consumer.consumer = asynq.NewServer(&asynqRedisConnOpt{UniversalClient: rdsCli}, asynqCfg)</pre></code><tr><td>116<td><code><pre> return consumer</pre></code><tr><td>117<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqProducer.Go>func asynqProducer.Go</div><div class=info><a href=#s_fn_asynqProducer.Go>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>300<td><code><pre>func (a *asynqProducer) Go(fn any, opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>301<td><code><pre> var data any</pre></code><tr><td>302<td><code><pre> opt := utils.ApplyOptions[produceOption](opts...)</pre></code><tr><td>303<td><code><pre> if len(opt.args) > 0 {</pre></code><tr><td>304<td><code><pre> argType, embed := wrapParams(fn)</pre></code><tr><td>305<td><code><pre> data = setParams(argType, embed, opt.args...)</pre></code><tr><td>306<td><code><pre> }</pre></code><tr><td>307<td><code><pre></pre></code><tr><td>308<td><code><pre> // get task name by func name</pre></code><tr><td>309<td><code><pre> funcName := formatTaskName(a.appName, utils.GetFuncName(fn))</pre></code><tr><td>310<td><code><pre> callbackMapLock.RLock()</pre></code><tr><td>311<td><code><pre> if mappingName, ok := funcNameToTaskName[a.appName][funcName]; ok {</pre></code><tr><td>312<td><code><pre> funcName = mappingName</pre></code><tr><td>313<td><code><pre> }</pre></code><tr><td>314<td><code><pre> callbackMapLock.RUnlock()</pre></code><tr><td>315<td><code><pre></pre></code><tr><td>316<td><code><pre> ctx := context.Background()</pre></code><tr><td>317<td><code><pre> task, err := a.newTask(ctx, funcName, data)</pre></code><tr><td>318<td><code><pre> if err != nil {</pre></code><tr class=miss><td>319<td><code><pre> return</pre></code><tr><td>320<td><code><pre> }</pre></code><tr><td>321<td><code><pre></pre></code><tr><td>322<td><code><pre> _, err = a.Client.EnqueueContext(ctx, task, a.parseOption(opt)...)</pre></code><tr><td>323<td><code><pre> if err != nil {</pre></code><tr class=miss><td>324<td><code><pre> return</pre></code><tr><td>325<td><code><pre> }</pre></code><tr><td>326<td><code><pre> return</pre></code><tr><td>327<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqConsumer.info>func asynqConsumer.info</div><div class=info><a href=#s_fn_asynqConsumer.info>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/log.go</code>:</div><table class=listing><tr><td>24<td><code><pre>func (a *asynqConsumer) info(ctx context.Context, msg string, args ...any) {</pre></code><tr><td>25<td><code><pre> msg = a.format(msg)</pre></code><tr><td>26<td><code><pre> if a.logger == nil {</pre></code><tr class=miss><td>27<td><code><pre> log.Printf(msg, args...)</pre></code><tr><td>28<td><code><pre> } else {</pre></code><tr><td>29<td><code><pre> logArgs := make([]any, 0, len(args)+2)</pre></code><tr><td>30<td><code><pre> logArgs = append(logArgs, ctx, msg)</pre></code><tr><td>31<td><code><pre> logArgs = append(logArgs, args...)</pre></code><tr><td>32<td><code><pre> a.logger.Info(logArgs...)</pre></code><tr><td>33<td><code><pre> }</pre></code><tr><td>34<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqConsumer.Handle>func asynqConsumer.Handle</div><div class=info><a href=#s_fn_asynqConsumer.Handle>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>125<td><code><pre>func (a *asynqConsumer) Handle(pattern string, fn any, _ ...utils.OptionExtender) {</pre></code><tr><td>126<td><code><pre> if !a.c.Consumer {</pre></code><tr class=miss><td>127<td><code><pre> a.debug(context.Background(), "cannot handle task: consumer is not enabled")</pre></code><tr class=miss><td>128<td><code><pre> return</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre> name := formatTaskName(a.appName, pattern)</pre></code><tr><td>131<td><code><pre> funcName := formatTaskName(a.appName, utils.GetFuncName(fn))</pre></code><tr><td>132<td><code><pre></pre></code><tr><td>133<td><code><pre> callbackMapLock.Lock()</pre></code><tr><td>134<td><code><pre> defer callbackMapLock.Unlock()</pre></code><tr><td>135<td><code><pre> if callbackMap[a.appName] == nil {</pre></code><tr><td>136<td><code><pre> callbackMap[a.appName] = make(map[string]any)</pre></code><tr><td>137<td><code><pre> }</pre></code><tr><td>138<td><code><pre> if funcNameToTaskName[a.appName] == nil {</pre></code><tr><td>139<td><code><pre> funcNameToTaskName[a.appName] = make(map[string]string)</pre></code><tr><td>140<td><code><pre> }</pre></code><tr><td>141<td><code><pre> if _, ok := callbackMap[a.appName][name]; ok {</pre></code><tr class=miss><td>142<td><code><pre> panic(ErrDuplicatedHandlerName)</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre> callbackMap[a.appName][name] = fn</pre></code><tr><td>145<td><code><pre> callbackMap[a.appName][funcName] = fn</pre></code><tr><td>146<td><code><pre> funcNameToTaskName[a.appName][funcName] = name</pre></code><tr><td>147<td><code><pre></pre></code><tr><td>148<td><code><pre> typ, embed := wrapParams(fn)</pre></code><tr><td>149<td><code><pre> a.ServeMux.Handle(name, a.adaptAsynqHandlerFunc(fn, typ, embed))</pre></code><tr><td>150<td><code><pre> if name != funcName {</pre></code><tr><td>151<td><code><pre> a.ServeMux.Handle(funcName, a.adaptAsynqHandlerFunc(fn, typ, embed))</pre></code><tr><td>152<td><code><pre> }</pre></code><tr><td>153<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqConsumer.Start>func asynqConsumer.Start</div><div class=info><a href=#s_fn_asynqConsumer.Start>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>190<td><code><pre>func (a *asynqConsumer) Start() (err error) {</pre></code><tr><td>191<td><code><pre> if !a.c.Consumer {</pre></code><tr class=miss><td>192<td><code><pre> return ErrConsumerDisabled</pre></code><tr><td>193<td><code><pre> }</pre></code><tr><td>194<td><code><pre></pre></code><tr><td>195<td><code><pre> defer a.info(context.Background(), "consumer started")</pre></code><tr><td>196<td><code><pre></pre></code><tr><td>197<td><code><pre> a.ServeMux.Use(a.gatewayMiddleware)</pre></code><tr><td>198<td><code><pre> a.ServeMux.Use(a.mws...)</pre></code><tr><td>199<td><code><pre></pre></code><tr><td>200<td><code><pre> return a.consumer.Start(a.ServeMux)</pre></code><tr><td>201<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqProducer.Goc>func asynqProducer.Goc</div><div class=info><a href=#s_fn_asynqProducer.Goc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>329<td><code><pre>func (a *asynqProducer) Goc(ctx context.Context, fn any, opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>330<td><code><pre> var data any</pre></code><tr><td>331<td><code><pre> opt := utils.ApplyOptions[produceOption](opts...)</pre></code><tr><td>332<td><code><pre> if len(opt.args) > 0 {</pre></code><tr><td>333<td><code><pre> argType, embed := wrapParams(fn)</pre></code><tr><td>334<td><code><pre> data = setParams(argType, embed, opt.args...)</pre></code><tr><td>335<td><code><pre> }</pre></code><tr><td>336<td><code><pre></pre></code><tr><td>337<td><code><pre> // get task name by func name</pre></code><tr><td>338<td><code><pre> funcName := formatTaskName(a.appName, utils.GetFuncName(fn))</pre></code><tr><td>339<td><code><pre> callbackMapLock.RLock()</pre></code><tr><td>340<td><code><pre> if mappingName, ok := funcNameToTaskName[a.appName][funcName]; ok {</pre></code><tr class=miss><td>341<td><code><pre> funcName = mappingName</pre></code><tr><td>342<td><code><pre> }</pre></code><tr><td>343<td><code><pre> callbackMapLock.RUnlock()</pre></code><tr><td>344<td><code><pre></pre></code><tr><td>345<td><code><pre> task, err := a.newTask(ctx, funcName, data)</pre></code><tr><td>346<td><code><pre> if err != nil {</pre></code><tr class=miss><td>347<td><code><pre> return</pre></code><tr><td>348<td><code><pre> }</pre></code><tr><td>349<td><code><pre></pre></code><tr><td>350<td><code><pre> _, err = a.Client.EnqueueContext(ctx, task, a.parseOption(opt)...)</pre></code><tr><td>351<td><code><pre> if err != nil {</pre></code><tr class=miss><td>352<td><code><pre> return</pre></code><tr><td>353<td><code><pre> }</pre></code><tr><td>354<td><code><pre> return</pre></code><tr><td>355<td><code><pre>}</pre></code></table><div class=funcname id=fn_addInstance>func addInstance</div><div class=info><a href=#s_fn_addInstance>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/construct.go</code>:</div><table class=listing><tr><td>58<td><code><pre>func addInstance(ctx context.Context, name string, conf *Conf, opt *config.InitOption) {</pre></code><tr><td>59<td><code><pre> var (</pre></code><tr><td>60<td><code><pre> producer Producable</pre></code><tr><td>61<td><code><pre> consumer Consumable</pre></code><tr><td>62<td><code><pre> )</pre></code><tr><td>63<td><code><pre> switch conf.Type {</pre></code><tr><td>64<td><code><pre> case asyncTypeAsynq:</pre></code><tr><td>65<td><code><pre> if conf.Producer {</pre></code><tr><td>66<td><code><pre> producer = newAsynqProducer(ctx, opt.AppName, name, conf)</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre> if conf.Consumer {</pre></code><tr><td>69<td><code><pre> consumer = newAsynqConsumer(ctx, opt.AppName, name, conf)</pre></code><tr><td>70<td><code><pre> }</pre></code><tr><td>71<td><code><pre> case asyncTypeMysql:</pre></code><tr class=miss><td>72<td><code><pre> fallthrough</pre></code><tr><td>73<td><code><pre> default:</pre></code><tr class=miss><td>74<td><code><pre> panic(ErrUnsupportedSchedulerType)</pre></code><tr><td>75<td><code><pre> }</pre></code><tr><td>76<td><code><pre></pre></code><tr><td>77<td><code><pre> locker.Lock()</pre></code><tr><td>78<td><code><pre> defer locker.Unlock()</pre></code><tr><td>79<td><code><pre> if consumer != nil {</pre></code><tr><td>80<td><code><pre> if consumers == nil {</pre></code><tr class=miss><td>81<td><code><pre> consumers = make(map[string]map[string]Consumable)</pre></code><tr><td>82<td><code><pre> }</pre></code><tr><td>83<td><code><pre> if consumers[opt.AppName] == nil {</pre></code><tr><td>84<td><code><pre> consumers[opt.AppName] = make(map[string]Consumable)</pre></code><tr><td>85<td><code><pre> }</pre></code><tr><td>86<td><code><pre> if _, ok := consumers[name]; ok {</pre></code><tr class=miss><td>87<td><code><pre> panic(ErrDuplicatedInstanceName)</pre></code><tr><td>88<td><code><pre> }</pre></code><tr><td>89<td><code><pre> consumers[opt.AppName][name] = consumer</pre></code><tr><td>90<td><code><pre></pre></code><tr><td>91<td><code><pre> // ioc</pre></code><tr><td>92<td><code><pre> if opt.DI != nil {</pre></code><tr><td>93<td><code><pre> opt.DI.MustProvide(</pre></code><tr><td>94<td><code><pre> func() Consumable { return C(name, AppName(opt.AppName)) },</pre></code><tr><td>95<td><code><pre> di.Name(name),</pre></code><tr><td>96<td><code><pre> )</pre></code><tr><td>97<td><code><pre> }</pre></code><tr><td>98<td><code><pre> }</pre></code><tr><td>99<td><code><pre></pre></code><tr><td>100<td><code><pre> if producer != nil {</pre></code><tr><td>101<td><code><pre> if producers == nil {</pre></code><tr class=miss><td>102<td><code><pre> producers = make(map[string]map[string]Producable)</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre> if producers[opt.AppName] == nil {</pre></code><tr><td>105<td><code><pre> producers[opt.AppName] = make(map[string]Producable)</pre></code><tr><td>106<td><code><pre> }</pre></code><tr><td>107<td><code><pre> if _, ok := producers[name]; ok {</pre></code><tr class=miss><td>108<td><code><pre> panic(ErrDuplicatedInstanceName)</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre> producers[opt.AppName][name] = producer</pre></code><tr><td>111<td><code><pre></pre></code><tr><td>112<td><code><pre> // ioc</pre></code><tr><td>113<td><code><pre> if opt.DI != nil {</pre></code><tr><td>114<td><code><pre> opt.DI.MustProvide(</pre></code><tr><td>115<td><code><pre> func() Producable { return P(name) },</pre></code><tr><td>116<td><code><pre> di.Name(name),</pre></code><tr><td>117<td><code><pre> )</pre></code><tr><td>118<td><code><pre> }</pre></code><tr><td>119<td><code><pre> }</pre></code><tr><td>120<td><code><pre>}</pre></code></table><div class=funcname id=fn_P>func P</div><div class=info><a href=#s_fn_P>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/construct.go</code>:</div><table class=listing><tr><td>148<td><code><pre>func P(name string, opts ...utils.OptionExtender) Producable {</pre></code><tr><td>149<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>150<td><code><pre></pre></code><tr><td>151<td><code><pre> locker.RLock()</pre></code><tr><td>152<td><code><pre> defer locker.RUnlock()</pre></code><tr><td>153<td><code><pre> producers, ok := producers[opt.appName]</pre></code><tr><td>154<td><code><pre> if !ok {</pre></code><tr class=miss><td>155<td><code><pre> panic(errors.Errorf("async producer instance not found for app: %s", opt.appName))</pre></code><tr><td>156<td><code><pre> }</pre></code><tr><td>157<td><code><pre> producer, ok := producers[name]</pre></code><tr><td>158<td><code><pre> if !ok {</pre></code><tr class=miss><td>159<td><code><pre> panic(errors.Errorf("async producer instance not found for name: %s", name))</pre></code><tr><td>160<td><code><pre> }</pre></code><tr><td>161<td><code><pre> return producer</pre></code><tr><td>162<td><code><pre>}</pre></code></table><div class=funcname id=fn_C>func C</div><div class=info><a href=#s_fn_C>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/construct.go</code>:</div><table class=listing><tr><td>132<td><code><pre>func C(name string, opts ...utils.OptionExtender) Consumable {</pre></code><tr><td>133<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>134<td><code><pre></pre></code><tr><td>135<td><code><pre> locker.RLock()</pre></code><tr><td>136<td><code><pre> defer locker.RUnlock()</pre></code><tr><td>137<td><code><pre> consumers, ok := consumers[opt.appName]</pre></code><tr><td>138<td><code><pre> if !ok {</pre></code><tr class=miss><td>139<td><code><pre> panic(errors.Errorf("async consumer instance not found for app: %s", opt.appName))</pre></code><tr><td>140<td><code><pre> }</pre></code><tr><td>141<td><code><pre> consumer, ok := consumers[name]</pre></code><tr><td>142<td><code><pre> if !ok {</pre></code><tr class=miss><td>143<td><code><pre> panic(errors.Errorf("async consumer instance not found for name: %s", name))</pre></code><tr><td>144<td><code><pre> }</pre></code><tr><td>145<td><code><pre> return consumer</pre></code><tr><td>146<td><code><pre>}</pre></code></table><div class=funcname id=fn_@230:9>func @230:9</div><div class=info><a href=#s_fn_@230:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>230<td><code><pre>func(ctx context.Context, task *asynq.Task) (err error) {</pre></code><tr><td>231<td><code><pre> ctx, data, _, err := pd.Unseal(task.Payload(), pd.Type(typ))</pre></code><tr><td>232<td><code><pre> if err != nil {</pre></code><tr class=miss><td>233<td><code><pre> return</pre></code><tr><td>234<td><code><pre> }</pre></code><tr><td>235<td><code><pre> params := unwrapParams(typ, embed, data)</pre></code><tr><td>236<td><code><pre> return fn(append([]any{ctx}, params...)...)</pre></code><tr><td>237<td><code><pre> }</pre></code></table><div class=funcname id=fn_asynqProducer.newTask>func asynqProducer.newTask</div><div class=info><a href=#s_fn_asynqProducer.newTask>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>404<td><code><pre>func (a *asynqProducer) newTask(ctx context.Context, taskName string, data any) (task *asynq.Task, err error) {</pre></code><tr><td>405<td><code><pre> payload, err := pd.Seal(data, pd.Context(ctx), pd.Serialize(a.serializeType), pd.Compress(a.compressType))</pre></code><tr><td>406<td><code><pre> if err != nil {</pre></code><tr class=miss><td>407<td><code><pre> return</pre></code><tr><td>408<td><code><pre> }</pre></code><tr><td>409<td><code><pre></pre></code><tr><td>410<td><code><pre> task = asynq.NewTask(taskName, payload)</pre></code><tr><td>411<td><code><pre> return</pre></code><tr><td>412<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqProducer.Send>func asynqProducer.Send</div><div class=info><a href=#s_fn_asynqProducer.Send>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>357<td><code><pre>func (a *asynqProducer) Send(ctx context.Context, taskName string, data any, opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>358<td><code><pre> opt := utils.ApplyOptions[produceOption](opts...)</pre></code><tr><td>359<td><code><pre> task, err := a.newTask(ctx, formatTaskName(a.appName, taskName), data)</pre></code><tr><td>360<td><code><pre> if err != nil {</pre></code><tr class=miss><td>361<td><code><pre> return</pre></code><tr><td>362<td><code><pre> }</pre></code><tr><td>363<td><code><pre></pre></code><tr><td>364<td><code><pre> _, err = a.Client.EnqueueContext(ctx, task, a.parseOption(opt)...)</pre></code><tr><td>365<td><code><pre> if err != nil {</pre></code><tr class=miss><td>366<td><code><pre> return</pre></code><tr><td>367<td><code><pre> }</pre></code><tr><td>368<td><code><pre> return</pre></code><tr><td>369<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqConsumer.HandleFunc>func asynqConsumer.HandleFunc</div><div class=info><a href=#s_fn_asynqConsumer.HandleFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>155<td><code><pre>func (a *asynqConsumer) HandleFunc(fn any, _ ...utils.OptionExtender) {</pre></code><tr><td>156<td><code><pre> if !a.c.Consumer {</pre></code><tr class=miss><td>157<td><code><pre> a.debug(context.Background(), "cannot handle task: consumer is not enabled")</pre></code><tr class=miss><td>158<td><code><pre> return</pre></code><tr><td>159<td><code><pre> }</pre></code><tr><td>160<td><code><pre> funcName := formatTaskName(a.appName, utils.GetFuncName(fn))</pre></code><tr><td>161<td><code><pre></pre></code><tr><td>162<td><code><pre> callbackMapLock.Lock()</pre></code><tr><td>163<td><code><pre> defer callbackMapLock.Unlock()</pre></code><tr><td>164<td><code><pre> if callbackMap[a.appName] == nil {</pre></code><tr class=miss><td>165<td><code><pre> callbackMap[a.appName] = make(map[string]any)</pre></code><tr><td>166<td><code><pre> }</pre></code><tr><td>167<td><code><pre> if funcNameToTaskName[a.appName] == nil {</pre></code><tr class=miss><td>168<td><code><pre> funcNameToTaskName[a.appName] = make(map[string]string)</pre></code><tr><td>169<td><code><pre> }</pre></code><tr><td>170<td><code><pre> if _, ok := callbackMap[funcName]; ok {</pre></code><tr class=miss><td>171<td><code><pre> panic(ErrDuplicatedHandlerName)</pre></code><tr><td>172<td><code><pre> }</pre></code><tr><td>173<td><code><pre> callbackMap[a.appName][funcName] = fn</pre></code><tr><td>174<td><code><pre></pre></code><tr><td>175<td><code><pre> typ, embed := wrapParams(fn)</pre></code><tr><td>176<td><code><pre> a.ServeMux.Handle(funcName, a.adaptAsynqHandlerFunc(fn, typ, embed))</pre></code><tr><td>177<td><code><pre>}</pre></code></table><div class=funcname id=fn_setParams>func setParams</div><div class=info><a href=#s_fn_setParams>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/utils.go</code>:</div><table class=listing><tr><td>54<td><code><pre>func setParams(typ reflect.Type, embed bool, params ...any) (arg any) {</pre></code><tr><td>55<td><code><pre> if typ == nil {</pre></code><tr class=miss><td>56<td><code><pre> return</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre></pre></code><tr><td>59<td><code><pre> argValPtr := reflect.New(typ)</pre></code><tr><td>60<td><code><pre> argVal := argValPtr.Elem()</pre></code><tr><td>61<td><code><pre> if !embed {</pre></code><tr class=miss><td>62<td><code><pre> if len(params) > 0 {</pre></code><tr class=miss><td>63<td><code><pre> argVal.Set(reflect.ValueOf(params[0]))</pre></code><tr><td>64<td><code><pre> }</pre></code><tr class=miss><td>65<td><code><pre> return argValPtr.Interface()</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre></pre></code><tr><td>68<td><code><pre> for i := 0; i < len(params); i++ {</pre></code><tr><td>69<td><code><pre> ft := argVal.Field(i)</pre></code><tr><td>70<td><code><pre> ft.Set(reflect.ValueOf(params[i]).Convert(ft.Type()))</pre></code><tr><td>71<td><code><pre> }</pre></code><tr><td>72<td><code><pre> return argValPtr.Interface()</pre></code><tr><td>73<td><code><pre>}</pre></code></table><div class=funcname id=fn_newAsynqProducer>func newAsynqProducer</div><div class=info><a href=#s_fn_newAsynqProducer>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>274<td><code><pre>func newAsynqProducer(ctx context.Context, appName, name string, conf *Conf) Producable {</pre></code><tr><td>275<td><code><pre> var rdsCli rdsDrv.UniversalClient</pre></code><tr><td>276<td><code><pre> switch conf.InstanceType {</pre></code><tr><td>277<td><code><pre> case instanceTypeRedis:</pre></code><tr><td>278<td><code><pre> rdsCli = redis.Use(ctx, conf.Instance, redis.AppName(appName))</pre></code><tr><td>279<td><code><pre> case instanceTypeDB:</pre></code><tr class=miss><td>280<td><code><pre> fallthrough</pre></code><tr><td>281<td><code><pre> default:</pre></code><tr class=miss><td>282<td><code><pre> panic(errors.Errorf("unknown instance type: %s", conf.InstanceType))</pre></code><tr><td>283<td><code><pre> }</pre></code><tr><td>284<td><code><pre></pre></code><tr><td>285<td><code><pre> producer := &asynqProducer{</pre></code><tr><td>286<td><code><pre> appName: appName,</pre></code><tr><td>287<td><code><pre> n: name,</pre></code><tr><td>288<td><code><pre> c: conf,</pre></code><tr><td>289<td><code><pre> Client: asynq.NewClient(&asynqRedisConnOpt{UniversalClient: rdsCli}),</pre></code><tr><td>290<td><code><pre> compressType: compress.ParseAlgorithm(conf.MessageCompressType),</pre></code><tr><td>291<td><code><pre> serializeType: serialize.ParseAlgorithm(conf.MessageSerializeType),</pre></code><tr><td>292<td><code><pre> }</pre></code><tr><td>293<td><code><pre> // default serialize type</pre></code><tr><td>294<td><code><pre> if !producer.serializeType.IsValid() {</pre></code><tr class=miss><td>295<td><code><pre> producer.serializeType = serialize.AlgorithmGob</pre></code><tr><td>296<td><code><pre> }</pre></code><tr><td>297<td><code><pre> return producer</pre></code><tr><td>298<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqProducer.parseOption>func asynqProducer.parseOption</div><div class=info><a href=#s_fn_asynqProducer.parseOption>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>371<td><code><pre>func (a *asynqProducer) parseOption(src *produceOption) (dst []asynq.Option) {</pre></code><tr><td>372<td><code><pre> if utils.IsStrNotBlank(src.id) {</pre></code><tr class=miss><td>373<td><code><pre> dst = append(dst, asynq.TaskID(src.id))</pre></code><tr><td>374<td><code><pre> }</pre></code><tr><td>375<td><code><pre> if utils.IsStrNotBlank(src.queue) {</pre></code><tr><td>376<td><code><pre> dst = append(dst, asynq.Queue(src.queue))</pre></code><tr><td>377<td><code><pre> } else if len(a.c.Queues) == 1 {</pre></code><tr class=miss><td>378<td><code><pre> dst = append(dst, asynq.Queue(a.c.Queues[0].Name))</pre></code><tr><td>379<td><code><pre> } else {</pre></code><tr><td>380<td><code><pre> dst = append(dst, asynq.Queue(defaultQueue(a.appName)))</pre></code><tr><td>381<td><code><pre> }</pre></code><tr><td>382<td><code><pre> if src.maxRetry > 0 {</pre></code><tr class=miss><td>383<td><code><pre> dst = append(dst, asynq.MaxRetry(src.maxRetry))</pre></code><tr><td>384<td><code><pre> }</pre></code><tr><td>385<td><code><pre> if !src.deadline.IsZero() {</pre></code><tr class=miss><td>386<td><code><pre> dst = append(dst, asynq.Deadline(src.deadline))</pre></code><tr><td>387<td><code><pre> }</pre></code><tr><td>388<td><code><pre> if src.timeout > 0 {</pre></code><tr class=miss><td>389<td><code><pre> dst = append(dst, asynq.Timeout(src.timeout))</pre></code><tr><td>390<td><code><pre> }</pre></code><tr><td>391<td><code><pre> if src.delayDuration > 0 {</pre></code><tr class=miss><td>392<td><code><pre> dst = append(dst, asynq.ProcessIn(src.timeout))</pre></code><tr><td>393<td><code><pre> }</pre></code><tr><td>394<td><code><pre> if !src.delayTime.IsZero() {</pre></code><tr class=miss><td>395<td><code><pre> dst = append(dst, asynq.ProcessAt(src.delayTime))</pre></code><tr><td>396<td><code><pre> }</pre></code><tr><td>397<td><code><pre> if src.retentionDuration > 0 {</pre></code><tr class=miss><td>398<td><code><pre> dst = append(dst, asynq.Retention(src.retentionDuration))</pre></code><tr><td>399<td><code><pre> }</pre></code><tr><td>400<td><code><pre></pre></code><tr><td>401<td><code><pre> return</pre></code><tr><td>402<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqConsumer.warn>func asynqConsumer.warn</div><div class=info><a href=#s_fn_asynqConsumer.warn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/log.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func (a *asynqConsumer) warn(ctx context.Context, msg string, args ...any) {</pre></code><tr class=miss><td>37<td><code><pre> msg = a.format(msg)</pre></code><tr class=miss><td>38<td><code><pre> if a.logger == nil {</pre></code><tr class=miss><td>39<td><code><pre> log.Printf(msg, args...)</pre></code><tr><td>40<td><code><pre> } else {</pre></code><tr class=miss><td>41<td><code><pre> logArgs := make([]any, 0, len(args)+2)</pre></code><tr class=miss><td>42<td><code><pre> logArgs = append(logArgs, ctx, msg)</pre></code><tr class=miss><td>43<td><code><pre> logArgs = append(logArgs, args...)</pre></code><tr class=miss><td>44<td><code><pre> a.logger.Warn(logArgs...)</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqConsumer.debug>func asynqConsumer.debug</div><div class=info><a href=#s_fn_asynqConsumer.debug>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/log.go</code>:</div><table class=listing><tr><td>12<td><code><pre>func (a *asynqConsumer) debug(ctx context.Context, msg string, args ...any) {</pre></code><tr class=miss><td>13<td><code><pre> msg = a.format(msg)</pre></code><tr class=miss><td>14<td><code><pre> if a.logger == nil {</pre></code><tr class=miss><td>15<td><code><pre> log.Printf(msg, args...)</pre></code><tr><td>16<td><code><pre> } else {</pre></code><tr class=miss><td>17<td><code><pre> logArgs := make([]any, 0, len(args)+2)</pre></code><tr class=miss><td>18<td><code><pre> logArgs = append(logArgs, ctx, msg)</pre></code><tr class=miss><td>19<td><code><pre> logArgs = append(logArgs, args...)</pre></code><tr class=miss><td>20<td><code><pre> a.logger.Debug(logArgs...)</pre></code><tr><td>21<td><code><pre> }</pre></code><tr><td>22<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqConsumer.Serve>func asynqConsumer.Serve</div><div class=info><a href=#s_fn_asynqConsumer.Serve>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>179<td><code><pre>func (a *asynqConsumer) Serve() (err error) {</pre></code><tr class=miss><td>180<td><code><pre> if !a.c.Consumer {</pre></code><tr class=miss><td>181<td><code><pre> return ErrConsumerDisabled</pre></code><tr><td>182<td><code><pre> }</pre></code><tr class=miss><td>183<td><code><pre> defer a.info(context.Background(), "consumer started")</pre></code><tr><td>184<td><code><pre></pre></code><tr class=miss><td>185<td><code><pre> a.ServeMux.Use(a.gatewayMiddleware)</pre></code><tr class=miss><td>186<td><code><pre> a.ServeMux.Use(a.mws...)</pre></code><tr class=miss><td>187<td><code><pre> return a.consumer.Run(a.ServeMux)</pre></code><tr><td>188<td><code><pre>}</pre></code></table><div class=funcname id=fn_@81:40>func @81:40</div><div class=info><a href=#s_fn_@81:40>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>81<td><code><pre>func(ctx context.Context, task *asynq.Task, err error) {</pre></code><tr class=miss><td>82<td><code><pre> taskName := "unknown"</pre></code><tr class=miss><td>83<td><code><pre> if task != nil {</pre></code><tr class=miss><td>84<td><code><pre> taskName = consumer.unformatTaskName(task.Type())</pre></code><tr><td>85<td><code><pre> }</pre></code><tr class=miss><td>86<td><code><pre> consumer.info(ctx, "handle task %s message error %s", taskName, err)</pre></code><tr><td>87<td><code><pre> }</pre></code></table><div class=funcname id=fn_asynqConsumer.Use>func asynqConsumer.Use</div><div class=info><a href=#s_fn_asynqConsumer.Use>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>119<td><code><pre>func (a *asynqConsumer) Use(mws ...routerMiddleware) {</pre></code><tr class=miss><td>120<td><code><pre> for _, mw := range mws {</pre></code><tr class=miss><td>121<td><code><pre> a.mws = append(a.mws, a.adaptMiddleware(mw))</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre>}</pre></code></table><div class=funcname id=fn_@220:9>func @220:9</div><div class=info><a href=#s_fn_@220:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>220<td><code><pre>func(asynqNext asynq.Handler) asynq.Handler {</pre></code><tr class=miss><td>221<td><code><pre> next := mw(a.adaptRouterHandlerFunc(asynqNext))</pre></code><tr class=miss><td>222<td><code><pre> return asynq.HandlerFunc(func(ctx context.Context, t *asynq.Task) error {</pre></code><tr><td>223<td><code><pre> return next(ctx, a.newTask(t))</pre></code><tr><td>224<td><code><pre> })</pre></code><tr><td>225<td><code><pre> }</pre></code></table><div class=funcname id=fn_asynqConsumer.newAsynqTask>func asynqConsumer.newAsynqTask</div><div class=info><a href=#s_fn_asynqConsumer.newAsynqTask>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>259<td><code><pre>func (a *asynqConsumer) newAsynqTask(raw Task) (t *asynq.Task) {</pre></code><tr class=miss><td>260<td><code><pre> return raw.RawMessage().(*asynq.Task)</pre></code><tr><td>261<td><code><pre>}</pre></code></table><div class=funcname id=fn_@222:28>func @222:28</div><div class=info><a href=#s_fn_@222:28>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>222<td><code><pre>func(ctx context.Context, t *asynq.Task) error {</pre></code><tr class=miss><td>223<td><code><pre> return next(ctx, a.newTask(t))</pre></code><tr><td>224<td><code><pre> }</pre></code></table><div class=funcname id=fn_task.ID>func task.ID</div><div class=info><a href=#s_fn_task.ID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr><td>90<td><code><pre>func (t *task) ID() string {</pre></code><tr class=miss><td>91<td><code><pre> return t.id</pre></code><tr><td>92<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqConsumer.adaptMiddleware>func asynqConsumer.adaptMiddleware</div><div class=info><a href=#s_fn_asynqConsumer.adaptMiddleware>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>219<td><code><pre>func (a *asynqConsumer) adaptMiddleware(mw routerMiddleware) asynq.MiddlewareFunc {</pre></code><tr class=miss><td>220<td><code><pre> return func(asynqNext asynq.Handler) asynq.Handler {</pre></code><tr><td>221<td><code><pre> next := mw(a.adaptRouterHandlerFunc(asynqNext))</pre></code><tr><td>222<td><code><pre> return asynq.HandlerFunc(func(ctx context.Context, t *asynq.Task) error {</pre></code><tr><td>223<td><code><pre> return next(ctx, a.newTask(t))</pre></code><tr><td>224<td><code><pre> })</pre></code><tr><td>225<td><code><pre> }</pre></code><tr><td>226<td><code><pre>}</pre></code></table><div class=funcname id=fn_task.Payload>func task.Payload</div><div class=info><a href=#s_fn_task.Payload>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr><td>98<td><code><pre>func (t *task) Payload() []byte {</pre></code><tr class=miss><td>99<td><code><pre> return t.payload</pre></code><tr><td>100<td><code><pre>}</pre></code></table><div class=funcname id=fn_task.RawMessage>func task.RawMessage</div><div class=info><a href=#s_fn_task.RawMessage>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr><td>102<td><code><pre>func (t *task) RawMessage() any {</pre></code><tr class=miss><td>103<td><code><pre> return t.rawMessage</pre></code><tr><td>104<td><code><pre>}</pre></code></table><div class=funcname id=fn_TaskID>func TaskID</div><div class=info><a href=#s_fn_TaskID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr><td>118<td><code><pre>func TaskID(id string) utils.OptionFunc[produceOption] {</pre></code><tr class=miss><td>119<td><code><pre> return func(o *produceOption) { o.id = id }</pre></code><tr><td>120<td><code><pre>}</pre></code></table><div class=funcname id=fn_@119:9>func @119:9</div><div class=info><a href=#s_fn_@119:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr class=miss><td>119<td><code><pre>func(o *produceOption) { o.id = id }</pre></code></table><div class=funcname id=fn_@115:5>func @115:5</div><div class=info><a href=#s_fn_@115:5>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/construct.go</code>:</div><table class=listing><tr class=miss><td>115<td><code><pre>func() Producable { return P(name) }</pre></code></table><div class=funcname id=fn_task.Name>func task.Name</div><div class=info><a href=#s_fn_task.Name>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr><td>94<td><code><pre>func (t *task) Name() string {</pre></code><tr class=miss><td>95<td><code><pre> return t.name</pre></code><tr><td>96<td><code><pre>}</pre></code></table><div class=funcname id=fn_Delay>func Delay</div><div class=info><a href=#s_fn_Delay>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr><td>136<td><code><pre>func Delay(d time.Duration) utils.OptionFunc[produceOption] {</pre></code><tr class=miss><td>137<td><code><pre> return func(o *produceOption) { o.delayDuration = d }</pre></code><tr><td>138<td><code><pre>}</pre></code></table><div class=funcname id=fn_@94:5>func @94:5</div><div class=info><a href=#s_fn_@94:5>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/construct.go</code>:</div><table class=listing><tr class=miss><td>94<td><code><pre>func() Consumable { return C(name, AppName(opt.AppName)) }</pre></code></table><div class=funcname id=fn_MaxRetry>func MaxRetry</div><div class=info><a href=#s_fn_MaxRetry>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr><td>127<td><code><pre>func MaxRetry(n int) utils.OptionFunc[produceOption] {</pre></code><tr class=miss><td>128<td><code><pre> return func(o *produceOption) { o.maxRetry = n }</pre></code><tr><td>129<td><code><pre>}</pre></code></table><div class=funcname id=fn_@128:9>func @128:9</div><div class=info><a href=#s_fn_@128:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr class=miss><td>128<td><code><pre>func(o *produceOption) { o.maxRetry = n }</pre></code></table><div class=funcname id=fn_Deadline>func Deadline</div><div class=info><a href=#s_fn_Deadline>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr><td>130<td><code><pre>func Deadline(t time.Time) utils.OptionFunc[produceOption] {</pre></code><tr class=miss><td>131<td><code><pre> return func(o *produceOption) { o.deadline = t }</pre></code><tr><td>132<td><code><pre>}</pre></code></table><div class=funcname id=fn_@131:9>func @131:9</div><div class=info><a href=#s_fn_@131:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr class=miss><td>131<td><code><pre>func(o *produceOption) { o.deadline = t }</pre></code></table><div class=funcname id=fn_Timeout>func Timeout</div><div class=info><a href=#s_fn_Timeout>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr><td>133<td><code><pre>func Timeout(d time.Duration) utils.OptionFunc[produceOption] {</pre></code><tr class=miss><td>134<td><code><pre> return func(o *produceOption) { o.timeout = d }</pre></code><tr><td>135<td><code><pre>}</pre></code></table><div class=funcname id=fn_@134:9>func @134:9</div><div class=info><a href=#s_fn_@134:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr class=miss><td>134<td><code><pre>func(o *produceOption) { o.timeout = d }</pre></code></table><div class=funcname id=fn_asynqConsumer.adaptRouterHandlerFunc>func asynqConsumer.adaptRouterHandlerFunc</div><div class=info><a href=#s_fn_asynqConsumer.adaptRouterHandlerFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>240<td><code><pre>func (a *asynqConsumer) adaptRouterHandlerFunc(h asynq.Handler) routerMiddlewareFunc {</pre></code><tr class=miss><td>241<td><code><pre> return func(ctx context.Context, raw Task) (err error) {</pre></code><tr><td>242<td><code><pre> return h.ProcessTask(ctx, a.newAsynqTask(raw))</pre></code><tr><td>243<td><code><pre> }</pre></code><tr><td>244<td><code><pre>}</pre></code></table><div class=funcname id=fn_@137:9>func @137:9</div><div class=info><a href=#s_fn_@137:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr class=miss><td>137<td><code><pre>func(o *produceOption) { o.delayDuration = d }</pre></code></table><div class=funcname id=fn_@241:9>func @241:9</div><div class=info><a href=#s_fn_@241:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>241<td><code><pre>func(ctx context.Context, raw Task) (err error) {</pre></code><tr class=miss><td>242<td><code><pre> return h.ProcessTask(ctx, a.newAsynqTask(raw))</pre></code><tr><td>243<td><code><pre> }</pre></code></table><div class=funcname id=fn_@140:9>func @140:9</div><div class=info><a href=#s_fn_@140:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr class=miss><td>140<td><code><pre>func(o *produceOption) { o.delayTime = t }</pre></code></table><div class=funcname id=fn_Retention>func Retention</div><div class=info><a href=#s_fn_Retention>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr><td>142<td><code><pre>func Retention(d time.Duration) utils.OptionFunc[produceOption] {</pre></code><tr class=miss><td>143<td><code><pre> return func(o *produceOption) { o.retentionDuration = d }</pre></code><tr><td>144<td><code><pre>}</pre></code></table><div class=funcname id=fn_@143:9>func @143:9</div><div class=info><a href=#s_fn_@143:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr class=miss><td>143<td><code><pre>func(o *produceOption) { o.retentionDuration = d }</pre></code></table><div class=funcname id=fn_@91:29>func @91:29</div><div class=info><a href=#s_fn_@91:29>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr class=miss><td>91<td><code><pre>func(err error) { consumer.warn(ctx, "health check check failed: %s", err) }</pre></code></table><div class=funcname id=fn_asynqConsumer.newTask>func asynqConsumer.newTask</div><div class=info><a href=#s_fn_asynqConsumer.newTask>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/asynq.go</code>:</div><table class=listing><tr><td>250<td><code><pre>func (a *asynqConsumer) newTask(raw *asynq.Task) (t Task) {</pre></code><tr class=miss><td>251<td><code><pre> return &task{</pre></code><tr><td>252<td><code><pre> id: raw.Type(),</pre></code><tr><td>253<td><code><pre> name: raw.Type(),</pre></code><tr><td>254<td><code><pre> payload: raw.Payload(),</pre></code><tr><td>255<td><code><pre> rawMessage: raw,</pre></code><tr><td>256<td><code><pre> }</pre></code><tr><td>257<td><code><pre>}</pre></code></table><div class=funcname id=fn_DelayAt>func DelayAt</div><div class=info><a href=#s_fn_DelayAt>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/async/types.go</code>:</div><table class=listing><tr><td>139<td><code><pre>func DelayAt(t time.Time) utils.OptionFunc[produceOption] {</pre></code><tr class=miss><td>140<td><code><pre> return func(o *produceOption) { o.delayTime = t }</pre></code><tr><td>141<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/cache class=funcname>Package Overview: github.com/wfusion/gofusion/cache 4 <span class=packageTotal>77.0%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_.parseCallbackOption><td><code><a href=#fn_.parseCallbackOption>.parseCallbackOption(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>100.0%</code><td class=linecount><code>13/13</code><tr id=s_fn_Construct><td><code><a href=#fn_Construct>Construct(...)</a></code><td><code>github.com/wfusion/gofusion/cache/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_.convValToInner><td><code><a href=#fn_.convValToInner>.convValToInner(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@192:8><td><code><a href=#fn_@192:8>@192:8(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_.convInnerToKey><td><code><a href=#fn_.convInnerToKey>.convInnerToKey(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_.unseal><td><code><a href=#fn_.unseal>.unseal(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/cache/flag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@45:9><td><code><a href=#fn_@45:9>@45:9(...)</a></code><td><code>github.com/wfusion/gofusion/cache/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_newRedis><td><code><a href=#fn_newRedis>newRedis(...)</a></code><td><code>github.com/wfusion/gofusion/cache/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_.convKeysToInner><td><code><a href=#fn_.convKeysToInner>.convKeysToInner(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_AppName><td><code><a href=#fn_AppName>AppName(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_.convKeyToInner><td><code><a href=#fn_.convKeyToInner>.convKeyToInner(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_.convInnerToKeys><td><code><a href=#fn_.convInnerToKeys>.convInnerToKeys(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@247:39><td><code><a href=#fn_@247:39>@247:39(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Expired><td><code><a href=#fn_Expired>Expired(...)</a></code><td><code>github.com/wfusion/gofusion/cache/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_.seal><td><code><a href=#fn_.seal>.seal(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@39:9><td><code><a href=#fn_@39:9>@39:9(...)</a></code><td><code>github.com/wfusion/gofusion/cache/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/cache/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_KeyExpired><td><code><a href=#fn_KeyExpired>KeyExpired(...)</a></code><td><code>github.com/wfusion/gofusion/cache/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@52:9><td><code><a href=#fn_@52:9>@52:9(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@237:34><td><code><a href=#fn_@237:34>@237:34(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_gCache.get><td><code><a href=#fn_gCache.get>gCache.get(...)</a></code><td><code>github.com/wfusion/gofusion/cache/local.go</code><td class=percent><code>90.9%</code><td class=linecount><code>10/11</code><tr id=s_fn_.Get><td><code><a href=#fn_.Get>.Get(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>88.5%</code><td class=linecount><code>23/26</code><tr id=s_fn_.convInnerToVal><td><code><a href=#fn_.convInnerToVal>.convInnerToVal(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>86.7%</code><td class=linecount><code>13/15</code><tr id=s_fn_.Clear><td><code><a href=#fn_.Clear>.Clear(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_.Set><td><code><a href=#fn_.Set>.Set(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_.Del><td><code><a href=#fn_.Del>.Del(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_.getConfig><td><code><a href=#fn_.getConfig>.getConfig(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>84.6%</code><td class=linecount><code>22/26</code><tr id=s_fn_rds.set><td><code><a href=#fn_rds.set>rds.set(...)</a></code><td><code>github.com/wfusion/gofusion/cache/redis.go</code><td class=percent><code>76.9%</code><td class=linecount><code>10/13</code><tr id=s_fn_New><td><code><a href=#fn_New>New(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>69.2%</code><td class=linecount><code>9/13</code><tr id=s_fn_rds.get><td><code><a href=#fn_rds.get>rds.get(...)</a></code><td><code>github.com/wfusion/gofusion/cache/redis.go</code><td class=percent><code>69.2%</code><td class=linecount><code>9/13</code><tr id=s_fn_rds.del><td><code><a href=#fn_rds.del>rds.del(...)</a></code><td><code>github.com/wfusion/gofusion/cache/redis.go</code><td class=percent><code>66.7%</code><td class=linecount><code>14/21</code><tr id=s_fn_gCache.del><td><code><a href=#fn_gCache.del>gCache.del(...)</a></code><td><code>github.com/wfusion/gofusion/cache/local.go</code><td class=percent><code>66.7%</code><td class=linecount><code>6/9</code><tr id=s_fn_gCache.set><td><code><a href=#fn_gCache.set>gCache.set(...)</a></code><td><code>github.com/wfusion/gofusion/cache/local.go</code><td class=percent><code>63.6%</code><td class=linecount><code>7/11</code><tr id=s_fn_.convInnerToMap><td><code><a href=#fn_.convInnerToMap>.convInnerToMap(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>63.6%</code><td class=linecount><code>7/11</code><tr id=s_fn_.convMapToInner><td><code><a href=#fn_.convMapToInner>.convMapToInner(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>63.6%</code><td class=linecount><code>7/11</code><tr id=s_fn_.GetAll><td><code><a href=#fn_.GetAll>.GetAll(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>63.0%</code><td class=linecount><code>17/27</code><tr id=s_fn_addInstance><td><code><a href=#fn_addInstance>addInstance(...)</a></code><td><code>github.com/wfusion/gofusion/cache/construct.go</code><td class=percent><code>54.5%</code><td class=linecount><code>6/11</code><tr id=s_fn_newGCache><td><code><a href=#fn_newGCache>newGCache(...)</a></code><td><code>github.com/wfusion/gofusion/cache/local.go</code><td class=percent><code>50.0%</code><td class=linecount><code>4/8</code><tr id=s_fn_.cloneVal><td><code><a href=#fn_.cloneVal>.cloneVal(...)</a></code><td><code>github.com/wfusion/gofusion/cache/cache.go</code><td class=percent><code>50.0%</code><td class=linecount><code>2/4</code><tr id=s_fn_@21:9><td><code><a href=#fn_@21:9>@21:9(...)</a></code><td><code>github.com/wfusion/gofusion/cache/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>0/0</code></table><div class=funcname id=fn_.parseCallbackOption>func .parseCallbackOption</div><div class=info><a href=#s_fn_.parseCallbackOption>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>325<td><code><pre>func (c *cache[K, T, TS]) parseCallbackOption(kvs map[K]T, conf *parsedConf[K, T], opts ...utils.OptionExtender) (</pre></code><tr><td>326<td><code><pre> exp map[string]time.Duration) {</pre></code><tr><td>327<td><code><pre> opt := utils.ApplyOptions[option[K]](opts...)</pre></code><tr><td>328<td><code><pre> exp = make(map[string]time.Duration, len(kvs))</pre></code><tr><td>329<td><code><pre></pre></code><tr><td>330<td><code><pre> // opt.keyExpired > opt.expired > conf.expired</pre></code><tr><td>331<td><code><pre> if conf.expired > 0 {</pre></code><tr><td>332<td><code><pre> for k := range kvs {</pre></code><tr><td>333<td><code><pre> innerKey := c.convKeyToInner(k, conf.version)</pre></code><tr><td>334<td><code><pre> exp[innerKey] = conf.expired</pre></code><tr><td>335<td><code><pre> }</pre></code><tr><td>336<td><code><pre> }</pre></code><tr><td>337<td><code><pre></pre></code><tr><td>338<td><code><pre> if opt.expired > 0 {</pre></code><tr><td>339<td><code><pre> for k := range kvs {</pre></code><tr><td>340<td><code><pre> innerKey := c.convKeyToInner(k, conf.version)</pre></code><tr><td>341<td><code><pre> exp[innerKey] = conf.expired</pre></code><tr><td>342<td><code><pre> }</pre></code><tr><td>343<td><code><pre> }</pre></code><tr><td>344<td><code><pre></pre></code><tr><td>345<td><code><pre> for k, e := range opt.keyExpired {</pre></code><tr><td>346<td><code><pre> exp[c.convKeyToInner(k, conf.version)] = e</pre></code><tr><td>347<td><code><pre> }</pre></code><tr><td>348<td><code><pre></pre></code><tr><td>349<td><code><pre> return</pre></code><tr><td>350<td><code><pre>}</pre></code></table><div class=funcname id=fn_Construct>func Construct</div><div class=info><a href=#s_fn_Construct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/construct.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func Construct(ctx context.Context, confs map[string]*Conf, _ ...utils.OptionExtender) func() {</pre></code><tr><td>17<td><code><pre> for _, conf := range confs {</pre></code><tr><td>18<td><code><pre> addInstance(ctx, conf)</pre></code><tr><td>19<td><code><pre> }</pre></code><tr><td>20<td><code><pre></pre></code><tr><td>21<td><code><pre> return func() {</pre></code><tr><td>22<td><code><pre></pre></code><tr><td>23<td><code><pre> }</pre></code><tr><td>24<td><code><pre>}</pre></code></table><div class=funcname id=fn_.convValToInner>func .convValToInner</div><div class=info><a href=#s_fn_.convValToInner>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>276<td><code><pre>func (c *cache[K, T, TS]) convValToInner(src T, conf *parsedConf[K, T]) (dst any, err error) {</pre></code><tr><td>277<td><code><pre> if !conf.serializeType.IsValid() && !conf.compressType.IsValid() {</pre></code><tr><td>278<td><code><pre> return c.cloneVal(src), nil</pre></code><tr><td>279<td><code><pre> }</pre></code><tr><td>280<td><code><pre></pre></code><tr><td>281<td><code><pre> return c.seal(src, conf)</pre></code><tr><td>282<td><code><pre>}</pre></code></table><div class=funcname id=fn_@192:8>func @192:8</div><div class=info><a href=#s_fn_@192:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>192<td><code><pre>func() {</pre></code><tr><td>193<td><code><pre> innerKeys := utils.MapKeys(innerVals)</pre></code><tr><td>194<td><code><pre> c.visited.Insert(innerKeys...)</pre></code><tr><td>195<td><code><pre> }</pre></code></table><div class=funcname id=fn_.convInnerToKey>func .convInnerToKey</div><div class=info><a href=#s_fn_.convInnerToKey>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>252<td><code><pre>func (c *cache[K, T, TS]) convInnerToKey(inner string, ver int) (k K) {</pre></code><tr><td>253<td><code><pre> key := strings.TrimPrefix(inner, fmt.Sprintf("%s:%v:", c.prefix, ver))</pre></code><tr><td>254<td><code><pre> return utils.SortableToGeneric[string, K](key)</pre></code><tr><td>255<td><code><pre>}</pre></code></table><div class=funcname id=fn_.unseal>func .unseal</div><div class=info><a href=#s_fn_.unseal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>356<td><code><pre>func (c *cache[K, T, TS]) unseal(src []byte) (dst T, ok bool, err error) {</pre></code><tr><td>357<td><code><pre> _, dst, ok, err = pd.UnsealT[T](src)</pre></code><tr><td>358<td><code><pre> return</pre></code><tr><td>359<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/flag.go</code>:</div><table class=listing><tr><td>7<td><code><pre>func init() {</pre></code><tr><td>8<td><code><pre> pflag.StringVarP(&flagString, "cache-config", "", "", "json string for cache config")</pre></code><tr><td>9<td><code><pre>}</pre></code></table><div class=funcname id=fn_@45:9>func @45:9</div><div class=info><a href=#s_fn_@45:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/types.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func(o *option[K]) {</pre></code><tr><td>46<td><code><pre> o.keyExpired = keyExpired</pre></code><tr><td>47<td><code><pre> }</pre></code></table><div class=funcname id=fn_newRedis>func newRedis</div><div class=info><a href=#s_fn_newRedis>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/redis.go</code>:</div><table class=listing><tr><td>23<td><code><pre>func newRedis(appName, name string, log log.Loggable) provider {</pre></code><tr><td>24<td><code><pre> return &rds{</pre></code><tr><td>25<td><code><pre> appName: appName,</pre></code><tr><td>26<td><code><pre> name: name,</pre></code><tr><td>27<td><code><pre> log: log,</pre></code><tr><td>28<td><code><pre> instance: redis.Use(context.Background(), name, redis.AppName(appName)),</pre></code><tr><td>29<td><code><pre> }</pre></code><tr><td>30<td><code><pre>}</pre></code></table><div class=funcname id=fn_.convKeysToInner>func .convKeysToInner</div><div class=info><a href=#s_fn_.convKeysToInner>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>236<td><code><pre>func (c *cache[K, T, TS]) convKeysToInner(keys []K, version int) (inner []string) {</pre></code><tr><td>237<td><code><pre> return utils.SliceMapping(keys, func(k K) string {</pre></code><tr><td>238<td><code><pre> return c.convKeyToInner(k, version)</pre></code><tr><td>239<td><code><pre> })</pre></code><tr><td>240<td><code><pre>}</pre></code></table><div class=funcname id=fn_AppName>func AppName</div><div class=info><a href=#s_fn_AppName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>51<td><code><pre>func AppName(name string) utils.OptionFunc[initOption] {</pre></code><tr><td>52<td><code><pre> return func(o *initOption) {</pre></code><tr><td>53<td><code><pre> o.appName = name</pre></code><tr><td>54<td><code><pre> }</pre></code><tr><td>55<td><code><pre>}</pre></code></table><div class=funcname id=fn_.convKeyToInner>func .convKeyToInner</div><div class=info><a href=#s_fn_.convKeyToInner>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>242<td><code><pre>func (c *cache[K, T, TS]) convKeyToInner(k K, ver int) (inner string) {</pre></code><tr><td>243<td><code><pre> return fmt.Sprintf("%s:%v:%s", c.prefix, ver, cast.ToString(k))</pre></code><tr><td>244<td><code><pre>}</pre></code></table><div class=funcname id=fn_.convInnerToKeys>func .convInnerToKeys</div><div class=info><a href=#s_fn_.convInnerToKeys>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>246<td><code><pre>func (c *cache[K, T, TS]) convInnerToKeys(innerKeys []string, ver int) (keys []K) {</pre></code><tr><td>247<td><code><pre> return utils.SliceMapping(innerKeys, func(inner string) K {</pre></code><tr><td>248<td><code><pre> return c.convInnerToKey(inner, ver)</pre></code><tr><td>249<td><code><pre> })</pre></code><tr><td>250<td><code><pre>}</pre></code></table><div class=funcname id=fn_@247:39>func @247:39</div><div class=info><a href=#s_fn_@247:39>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>247<td><code><pre>func(inner string) K {</pre></code><tr><td>248<td><code><pre> return c.convInnerToKey(inner, ver)</pre></code><tr><td>249<td><code><pre> }</pre></code></table><div class=funcname id=fn_Expired>func Expired</div><div class=info><a href=#s_fn_Expired>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/types.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func Expired[K constraint.Sortable](expired time.Duration) utils.OptionFunc[option[K]] {</pre></code><tr><td>39<td><code><pre> return func(o *option[K]) {</pre></code><tr><td>40<td><code><pre> o.expired = expired</pre></code><tr><td>41<td><code><pre> }</pre></code><tr><td>42<td><code><pre>}</pre></code></table><div class=funcname id=fn_.seal>func .seal</div><div class=info><a href=#s_fn_.seal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>352<td><code><pre>func (c *cache[K, T, TS]) seal(src T, conf *parsedConf[K, T]) (dst []byte, err error) {</pre></code><tr><td>353<td><code><pre> return pd.Seal(src, pd.Serialize(conf.serializeType), pd.Compress(conf.compressType))</pre></code><tr><td>354<td><code><pre>}</pre></code></table><div class=funcname id=fn_@39:9>func @39:9</div><div class=info><a href=#s_fn_@39:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/types.go</code>:</div><table class=listing><tr><td>39<td><code><pre>func(o *option[K]) {</pre></code><tr><td>40<td><code><pre> o.expired = expired</pre></code><tr><td>41<td><code><pre> }</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/construct.go</code>:</div><table class=listing><tr><td>51<td><code><pre>func init() {</pre></code><tr><td>52<td><code><pre> config.AddComponent(config.ComponentCache, Construct, config.WithFlag(&flagString))</pre></code><tr><td>53<td><code><pre>}</pre></code></table><div class=funcname id=fn_KeyExpired>func KeyExpired</div><div class=info><a href=#s_fn_KeyExpired>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/types.go</code>:</div><table class=listing><tr><td>44<td><code><pre>func KeyExpired[K constraint.Sortable](keyExpired map[K]time.Duration) utils.OptionFunc[option[K]] {</pre></code><tr><td>45<td><code><pre> return func(o *option[K]) {</pre></code><tr><td>46<td><code><pre> o.keyExpired = keyExpired</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre>}</pre></code></table><div class=funcname id=fn_@52:9>func @52:9</div><div class=info><a href=#s_fn_@52:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func(o *initOption) {</pre></code><tr><td>53<td><code><pre> o.appName = name</pre></code><tr><td>54<td><code><pre> }</pre></code></table><div class=funcname id=fn_@237:34>func @237:34</div><div class=info><a href=#s_fn_@237:34>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>237<td><code><pre>func(k K) string {</pre></code><tr><td>238<td><code><pre> return c.convKeyToInner(k, version)</pre></code><tr><td>239<td><code><pre> }</pre></code></table><div class=funcname id=fn_gCache.get>func gCache.get</div><div class=info><a href=#s_fn_gCache.get>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/local.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func (g *gCache) get(ctx context.Context, keys ...string) (cached map[string]any, missed []string) {</pre></code><tr><td>42<td><code><pre> cached = make(map[string]any, len(keys))</pre></code><tr><td>43<td><code><pre> missed = make([]string, 0, len(keys))</pre></code><tr><td>44<td><code><pre> for _, k := range keys {</pre></code><tr><td>45<td><code><pre> v, err := g.instance.Get(k)</pre></code><tr><td>46<td><code><pre> if err != nil {</pre></code><tr><td>47<td><code><pre> missed = append(missed, k)</pre></code><tr><td>48<td><code><pre> if !errors.Is(err, gcache.KeyNotFoundError) && g.log != nil {</pre></code><tr class=miss><td>49<td><code><pre> g.log.Info(ctx, "%v [Gofusion] %s call gcache get failed "+</pre></code><tr><td>50<td><code><pre> "when get cache from gcache [err[%s] key[%s]]", syscall.Getpid(), config.ComponentCache, err, k)</pre></code><tr><td>51<td><code><pre> }</pre></code><tr><td>52<td><code><pre> continue</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre> cached[k] = v</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre> return</pre></code><tr><td>57<td><code><pre>}</pre></code></table><div class=funcname id=fn_.Get>func .Get</div><div class=info><a href=#s_fn_.Get>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>96<td><code><pre>func (c *cache[K, T, TS]) Get(ctx context.Context, keys []K, cb callback[K, T]) (ts TS) {</pre></code><tr><td>97<td><code><pre> conf := c.getConfig()</pre></code><tr><td>98<td><code><pre> innerKeys := c.convKeysToInner(keys, conf.version)</pre></code><tr><td>99<td><code><pre> cached, missed := c.provider.get(ctx, innerKeys...)</pre></code><tr><td>100<td><code><pre> kvs, _ := c.convInnerToMap(ctx, cached, conf)</pre></code><tr><td>101<td><code><pre> defer c.visited.Insert(innerKeys...)</pre></code><tr><td>102<td><code><pre></pre></code><tr><td>103<td><code><pre> if cb == nil {</pre></code><tr><td>104<td><code><pre> cb = conf.callback</pre></code><tr><td>105<td><code><pre> }</pre></code><tr><td>106<td><code><pre> if len(missed) > 0 && cb != nil {</pre></code><tr><td>107<td><code><pre> keys := c.convInnerToKeys(missed, conf.version)</pre></code><tr><td>108<td><code><pre> if conf.log != nil {</pre></code><tr><td>109<td><code><pre> conf.log.Debug(ctx, "%v [Gofusion] %s call callback function because we do not hit the cache "+</pre></code><tr><td>110<td><code><pre> "when get [keys%+v]", syscall.Getpid(), config.ComponentCache, keys)</pre></code><tr><td>111<td><code><pre> }</pre></code><tr><td>112<td><code><pre></pre></code><tr><td>113<td><code><pre> callbackKVs, opts := cb(ctx, keys)</pre></code><tr><td>114<td><code><pre> kvs = utils.MapMerge(kvs, callbackKVs)</pre></code><tr><td>115<td><code><pre> innerVals, _ := c.convMapToInner(ctx, callbackKVs, conf)</pre></code><tr><td>116<td><code><pre> _ = c.provider.set(ctx, innerVals, c.parseCallbackOption(kvs, conf, opts...))</pre></code><tr><td>117<td><code><pre> // innerFailureKeys = append(innerFailureKeys, convInnerFailureKeys...)</pre></code><tr><td>118<td><code><pre> }</pre></code><tr><td>119<td><code><pre></pre></code><tr><td>120<td><code><pre> // order by param -> keys</pre></code><tr><td>121<td><code><pre> ts = make(TS, 0, len(kvs))</pre></code><tr><td>122<td><code><pre> missedKeys := make([]K, 0, len(keys))</pre></code><tr><td>123<td><code><pre> for _, k := range keys {</pre></code><tr><td>124<td><code><pre> v, ok := kvs[k]</pre></code><tr><td>125<td><code><pre> if !ok {</pre></code><tr class=miss><td>126<td><code><pre> missedKeys = append(missedKeys, k)</pre></code><tr class=miss><td>127<td><code><pre> continue</pre></code><tr><td>128<td><code><pre> }</pre></code><tr><td>129<td><code><pre></pre></code><tr><td>130<td><code><pre> ts = append(ts, v)</pre></code><tr><td>131<td><code><pre> }</pre></code><tr><td>132<td><code><pre> if len(missedKeys) > 0 && conf.log != nil {</pre></code><tr class=miss><td>133<td><code><pre> conf.log.Info(ctx, "%v [Gofusion] %s we still get missing keys after callback when cache get [keys%v]",</pre></code><tr><td>134<td><code><pre> syscall.Getpid(), config.ComponentCache, missedKeys)</pre></code><tr><td>135<td><code><pre> }</pre></code><tr><td>136<td><code><pre></pre></code><tr><td>137<td><code><pre> return</pre></code><tr><td>138<td><code><pre>}</pre></code></table><div class=funcname id=fn_.convInnerToVal>func .convInnerToVal</div><div class=info><a href=#s_fn_.convInnerToVal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>303<td><code><pre>func (c *cache[K, T, TS]) convInnerToVal(src any) (dst T, err error) {</pre></code><tr><td>304<td><code><pre> srcBytes, ok1 := src.([]byte)</pre></code><tr><td>305<td><code><pre> srcString, ok2 := src.(string)</pre></code><tr><td>306<td><code><pre> if !ok1 && !ok2 {</pre></code><tr><td>307<td><code><pre> return c.cloneVal(src.(T)), nil</pre></code><tr><td>308<td><code><pre> }</pre></code><tr><td>309<td><code><pre> if ok2 {</pre></code><tr><td>310<td><code><pre> buffer, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>311<td><code><pre> defer cb()</pre></code><tr><td>312<td><code><pre> buffer.WriteString(srcString)</pre></code><tr><td>313<td><code><pre> srcBytes = buffer.Bytes()</pre></code><tr><td>314<td><code><pre> }</pre></code><tr><td>315<td><code><pre> dst, ok, err := c.unseal(srcBytes)</pre></code><tr><td>316<td><code><pre> if err != nil {</pre></code><tr class=miss><td>317<td><code><pre> return</pre></code><tr><td>318<td><code><pre> }</pre></code><tr><td>319<td><code><pre> if !ok {</pre></code><tr class=miss><td>320<td><code><pre> return c.cloneVal(src.(T)), nil</pre></code><tr><td>321<td><code><pre> }</pre></code><tr><td>322<td><code><pre> return</pre></code><tr><td>323<td><code><pre>}</pre></code></table><div class=funcname id=fn_.Clear>func .Clear</div><div class=info><a href=#s_fn_.Clear>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>223<td><code><pre>func (c *cache[K, T, TS]) Clear(ctx context.Context) (failureKeys []K) {</pre></code><tr><td>224<td><code><pre> conf := c.getConfig()</pre></code><tr><td>225<td><code><pre> innerKeys := c.visited.Items()</pre></code><tr><td>226<td><code><pre> innerFailureKeys := c.provider.del(ctx, innerKeys...)</pre></code><tr><td>227<td><code><pre> defer c.visited.Remove(innerKeys...)</pre></code><tr><td>228<td><code><pre></pre></code><tr><td>229<td><code><pre> if failureKeys = c.convInnerToKeys(innerFailureKeys, conf.version); len(failureKeys) > 0 && conf.log != nil {</pre></code><tr class=miss><td>230<td><code><pre> conf.log.Info(ctx, "%v [Gofusion] %s del some kvs failed when clear [keys%+v]",</pre></code><tr><td>231<td><code><pre> syscall.Getpid(), config.ComponentCache, failureKeys)</pre></code><tr><td>232<td><code><pre> }</pre></code><tr><td>233<td><code><pre> return</pre></code><tr><td>234<td><code><pre>}</pre></code></table><div class=funcname id=fn_.Set>func .Set</div><div class=info><a href=#s_fn_.Set>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>189<td><code><pre>func (c *cache[K, T, TS]) Set(ctx context.Context, kvs map[K]T, opts ...utils.OptionExtender) (failure []K) {</pre></code><tr><td>190<td><code><pre> conf := c.getConfig()</pre></code><tr><td>191<td><code><pre> innerVals, innerFailureKeys := c.convMapToInner(ctx, kvs, conf)</pre></code><tr><td>192<td><code><pre> defer func() {</pre></code><tr><td>193<td><code><pre> innerKeys := utils.MapKeys(innerVals)</pre></code><tr><td>194<td><code><pre> c.visited.Insert(innerKeys...)</pre></code><tr><td>195<td><code><pre> }()</pre></code><tr><td>196<td><code><pre></pre></code><tr><td>197<td><code><pre> innerFailureKeys = append(</pre></code><tr><td>198<td><code><pre> innerFailureKeys,</pre></code><tr><td>199<td><code><pre> c.provider.set(ctx, innerVals, c.parseCallbackOption(kvs, conf, opts...))...,</pre></code><tr><td>200<td><code><pre> )</pre></code><tr><td>201<td><code><pre></pre></code><tr><td>202<td><code><pre> if failure = c.convInnerToKeys(innerFailureKeys, conf.version); len(failure) > 0 && conf.log != nil {</pre></code><tr class=miss><td>203<td><code><pre> conf.log.Info(ctx, "%v [Gofusion] %s set some kvs failed when set [keys%+v vals%+v]",</pre></code><tr><td>204<td><code><pre> syscall.Getpid(), config.ComponentCache, failure, utils.MapValuesByKeys(kvs, failure))</pre></code><tr><td>205<td><code><pre> }</pre></code><tr><td>206<td><code><pre></pre></code><tr><td>207<td><code><pre> return</pre></code><tr><td>208<td><code><pre>}</pre></code></table><div class=funcname id=fn_.Del>func .Del</div><div class=info><a href=#s_fn_.Del>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>210<td><code><pre>func (c *cache[K, T, TS]) Del(ctx context.Context, keys ...K) (failure []K) {</pre></code><tr><td>211<td><code><pre> conf := c.getConfig()</pre></code><tr><td>212<td><code><pre> innerKeys := c.convKeysToInner(keys, conf.version)</pre></code><tr><td>213<td><code><pre> innerFailureKeys := c.provider.del(ctx, innerKeys...)</pre></code><tr><td>214<td><code><pre> defer c.visited.Remove(innerKeys...)</pre></code><tr><td>215<td><code><pre></pre></code><tr><td>216<td><code><pre> if failure = c.convInnerToKeys(innerFailureKeys, conf.version); len(failure) > 0 && conf.log != nil {</pre></code><tr class=miss><td>217<td><code><pre> conf.log.Info(ctx, "%v [Gofusion] %s del some kvs failed when del [keys%+v]",</pre></code><tr><td>218<td><code><pre> syscall.Getpid(), config.ComponentCache, failure)</pre></code><tr><td>219<td><code><pre> }</pre></code><tr><td>220<td><code><pre> return</pre></code><tr><td>221<td><code><pre>}</pre></code></table><div class=funcname id=fn_.getConfig>func .getConfig</div><div class=info><a href=#s_fn_.getConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>369<td><code><pre>func (c *cache[K, T, TS]) getConfig() (conf *parsedConf[K, T]) {</pre></code><tr><td>370<td><code><pre> var cfgs map[string]*Conf</pre></code><tr><td>371<td><code><pre> _ = config.Use(c.appName).LoadComponentConfig(config.ComponentCache, &cfgs)</pre></code><tr><td>372<td><code><pre> if len(cfgs) == 0 {</pre></code><tr class=miss><td>373<td><code><pre> panic(ErrCacheNotFound)</pre></code><tr><td>374<td><code><pre> }</pre></code><tr><td>375<td><code><pre></pre></code><tr><td>376<td><code><pre> cfg, ok := cfgs[c.name]</pre></code><tr><td>377<td><code><pre> if !ok {</pre></code><tr class=miss><td>378<td><code><pre> panic(ErrCacheNotFound)</pre></code><tr><td>379<td><code><pre> }</pre></code><tr><td>380<td><code><pre></pre></code><tr><td>381<td><code><pre> conf = &parsedConf[K, T]{</pre></code><tr><td>382<td><code><pre> size: cfg.Size,</pre></code><tr><td>383<td><code><pre> localEvictType: cfg.LocalEvictType,</pre></code><tr><td>384<td><code><pre> cacheType: cfg.CacheType,</pre></code><tr><td>385<td><code><pre> remoteType: cfg.RemoteType,</pre></code><tr><td>386<td><code><pre> remoteInstance: cfg.RemoteInstance,</pre></code><tr><td>387<td><code><pre> version: cfg.Version,</pre></code><tr><td>388<td><code><pre> }</pre></code><tr><td>389<td><code><pre> if utils.IsStrNotBlank(cfg.Expired) {</pre></code><tr><td>390<td><code><pre> conf.expired = utils.Must(time.ParseDuration(cfg.Expired))</pre></code><tr><td>391<td><code><pre> }</pre></code><tr><td>392<td><code><pre> if utils.IsStrNotBlank(cfg.LogInstance) {</pre></code><tr><td>393<td><code><pre> conf.log = log.Use(cfg.LogInstance, log.AppName(c.appName))</pre></code><tr><td>394<td><code><pre> }</pre></code><tr><td>395<td><code><pre></pre></code><tr><td>396<td><code><pre> if utils.IsStrNotBlank(cfg.SerializeType) {</pre></code><tr><td>397<td><code><pre> conf.serializeType = serialize.ParseAlgorithm(cfg.SerializeType)</pre></code><tr><td>398<td><code><pre> }</pre></code><tr><td>399<td><code><pre></pre></code><tr><td>400<td><code><pre> if utils.IsStrNotBlank(cfg.Compress) {</pre></code><tr><td>401<td><code><pre> conf.compressType = compress.ParseAlgorithm(cfg.Compress)</pre></code><tr><td>402<td><code><pre> if !conf.compressType.IsValid() {</pre></code><tr class=miss><td>403<td><code><pre> panic(UnknownCompress)</pre></code><tr><td>404<td><code><pre> }</pre></code><tr><td>405<td><code><pre> }</pre></code><tr><td>406<td><code><pre> // default serialize type when need compress</pre></code><tr><td>407<td><code><pre> if conf.compressType.IsValid() && !conf.serializeType.IsValid() {</pre></code><tr><td>408<td><code><pre> conf.serializeType = serialize.AlgorithmGob</pre></code><tr><td>409<td><code><pre> }</pre></code><tr><td>410<td><code><pre></pre></code><tr><td>411<td><code><pre> if utils.IsStrNotBlank(cfg.Callback) {</pre></code><tr><td>412<td><code><pre> callbackFn := inspect.FuncOf(cfg.Callback)</pre></code><tr><td>413<td><code><pre> if callbackFn == nil {</pre></code><tr class=miss><td>414<td><code><pre> panic(errors.Errorf("not found callback function: %s", cfg.Callback))</pre></code><tr><td>415<td><code><pre> }</pre></code><tr><td>416<td><code><pre> conf.callback = *(*func(ctx context.Context, missed []K) (rs map[K]T, opts []utils.OptionExtender))(callbackFn)</pre></code><tr><td>417<td><code><pre> }</pre></code><tr><td>418<td><code><pre></pre></code><tr><td>419<td><code><pre> return</pre></code><tr><td>420<td><code><pre>}</pre></code></table><div class=funcname id=fn_rds.set>func rds.set</div><div class=info><a href=#s_fn_rds.set>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/redis.go</code>:</div><table class=listing><tr><td>56<td><code><pre>func (r *rds) set(ctx context.Context, kvs map[string]any, expired map[string]time.Duration) (failure []string) {</pre></code><tr><td>57<td><code><pre> failure = make([]string, 0, len(kvs))</pre></code><tr><td>58<td><code><pre> pipe := r.instance.Pipeline()</pre></code><tr><td>59<td><code><pre> keys := make([]string, 0, len(kvs))</pre></code><tr><td>60<td><code><pre> for k, v := range kvs {</pre></code><tr><td>61<td><code><pre> keys = append(keys, k)</pre></code><tr><td>62<td><code><pre> pipe.Set(ctx, k, v, expired[k])</pre></code><tr><td>63<td><code><pre> }</pre></code><tr><td>64<td><code><pre></pre></code><tr><td>65<td><code><pre> cmds := utils.Must(pipe.Exec(ctx))</pre></code><tr><td>66<td><code><pre> for i := 0; i < len(keys); i++ {</pre></code><tr><td>67<td><code><pre> if err := cmds[i].Err(); err != nil {</pre></code><tr class=miss><td>68<td><code><pre> failure = append(failure, keys[i])</pre></code><tr class=miss><td>69<td><code><pre> if r.log != nil {</pre></code><tr class=miss><td>70<td><code><pre> r.log.Info(ctx, "%v [Gofusion] %s call redis set failed when set cache into redis "+</pre></code><tr><td>71<td><code><pre> "[err[%s] redis[%s] key[%s]]", syscall.Getpid(), config.ComponentCache, err, r.name, keys[i])</pre></code><tr><td>72<td><code><pre> }</pre></code><tr><td>73<td><code><pre> }</pre></code><tr><td>74<td><code><pre> }</pre></code><tr><td>75<td><code><pre> return</pre></code><tr><td>76<td><code><pre>}</pre></code></table><div class=funcname id=fn_New>func New</div><div class=info><a href=#s_fn_New>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>57<td><code><pre>func New[K constraint.Sortable, T any, TS ~[]T](name string, opts ...utils.OptionExtender) Cachable[K, T, TS] {</pre></code><tr><td>58<td><code><pre> opt := utils.ApplyOptions[initOption](opts...)</pre></code><tr><td>59<td><code><pre></pre></code><tr><td>60<td><code><pre> instance := &cache[K, T, TS]{</pre></code><tr><td>61<td><code><pre> name: name,</pre></code><tr><td>62<td><code><pre> appName: opt.appName,</pre></code><tr><td>63<td><code><pre> prefix: fmt.Sprintf("%s:%s", config.Use(opt.appName).AppName(), name),</pre></code><tr><td>64<td><code><pre> visited: utils.NewSet[string](),</pre></code><tr><td>65<td><code><pre> }</pre></code><tr><td>66<td><code><pre></pre></code><tr><td>67<td><code><pre> conf := instance.getConfig()</pre></code><tr><td>68<td><code><pre> switch conf.cacheType {</pre></code><tr><td>69<td><code><pre> case cacheTypeLocal:</pre></code><tr><td>70<td><code><pre> instance.provider = newGCache(conf.size, conf.localEvictType, conf.log)</pre></code><tr><td>71<td><code><pre> case cacheTypeRemote:</pre></code><tr><td>72<td><code><pre> if conf.remoteType != remoteTypeRedis {</pre></code><tr class=miss><td>73<td><code><pre> panic(UnknownRemoteType)</pre></code><tr><td>74<td><code><pre> }</pre></code><tr><td>75<td><code><pre> if !conf.serializeType.IsValid() && !conf.compressType.IsValid() {</pre></code><tr class=miss><td>76<td><code><pre> panic(UnknownSerializeType)</pre></code><tr><td>77<td><code><pre> }</pre></code><tr><td>78<td><code><pre> instance.provider = newRedis(opt.appName, conf.remoteInstance, conf.log)</pre></code><tr><td>79<td><code><pre> case cacheTypeRemoteLocal:</pre></code><tr class=miss><td>80<td><code><pre> panic(ErrNotImplement)</pre></code><tr><td>81<td><code><pre> default:</pre></code><tr class=miss><td>82<td><code><pre> panic(UnknownCacheType)</pre></code><tr><td>83<td><code><pre> }</pre></code><tr><td>84<td><code><pre></pre></code><tr><td>85<td><code><pre> return instance</pre></code><tr><td>86<td><code><pre>}</pre></code></table><div class=funcname id=fn_rds.get>func rds.get</div><div class=info><a href=#s_fn_rds.get>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/redis.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func (r *rds) get(ctx context.Context, keys ...string) (cached map[string]any, missed []string) {</pre></code><tr><td>33<td><code><pre> cached = make(map[string]any, len(keys))</pre></code><tr><td>34<td><code><pre> missed = make([]string, 0, len(keys))</pre></code><tr><td>35<td><code><pre></pre></code><tr><td>36<td><code><pre> rs, err := r.instance.MGet(ctx, keys...).Result()</pre></code><tr><td>37<td><code><pre> if err != nil {</pre></code><tr class=miss><td>38<td><code><pre> missed = keys</pre></code><tr class=miss><td>39<td><code><pre> if r.log != nil {</pre></code><tr class=miss><td>40<td><code><pre> r.log.Info(ctx, "%v [Gofusion] %s call redis mget failed when get cache from redis "+</pre></code><tr><td>41<td><code><pre> "[err[%s] redis[%s]]", syscall.Getpid(), config.ComponentCache, err, r.name)</pre></code><tr><td>42<td><code><pre> }</pre></code><tr class=miss><td>43<td><code><pre> return</pre></code><tr><td>44<td><code><pre> }</pre></code><tr><td>45<td><code><pre> for i := 0; i < len(keys); i++ {</pre></code><tr><td>46<td><code><pre> if rs[i] != nil {</pre></code><tr><td>47<td><code><pre> cached[keys[i]] = rs[i]</pre></code><tr><td>48<td><code><pre> } else {</pre></code><tr><td>49<td><code><pre> missed = append(missed, keys[i])</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre> }</pre></code><tr><td>52<td><code><pre></pre></code><tr><td>53<td><code><pre> return</pre></code><tr><td>54<td><code><pre>}</pre></code></table><div class=funcname id=fn_rds.del>func rds.del</div><div class=info><a href=#s_fn_rds.del>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/redis.go</code>:</div><table class=listing><tr><td>78<td><code><pre>func (r *rds) del(ctx context.Context, keys ...string) (failure []string) {</pre></code><tr><td>79<td><code><pre> affected, err := r.instance.Del(ctx, keys...).Result()</pre></code><tr><td>80<td><code><pre> if err != nil && r.log != nil {</pre></code><tr class=miss><td>81<td><code><pre> r.log.Info(ctx, "%v [Gofusion] %s call redis del failed when delete from cache "+</pre></code><tr><td>82<td><code><pre> "[err[%s] redis[%s] keys%v]", syscall.Getpid(), config.ComponentCache, err, r.name, keys)</pre></code><tr><td>83<td><code><pre> }</pre></code><tr><td>84<td><code><pre></pre></code><tr><td>85<td><code><pre> if affected == int64(len(keys)) {</pre></code><tr><td>86<td><code><pre> return</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre></pre></code><tr><td>89<td><code><pre> failure = make([]string, 0, len(keys))</pre></code><tr><td>90<td><code><pre> pipe := r.instance.Pipeline()</pre></code><tr><td>91<td><code><pre> for i := 0; i < len(keys); i++ {</pre></code><tr><td>92<td><code><pre> pipe.Exists(ctx, keys[i])</pre></code><tr><td>93<td><code><pre> }</pre></code><tr><td>94<td><code><pre> cmds, err := pipe.Exec(ctx)</pre></code><tr><td>95<td><code><pre> if err != nil && r.log != nil {</pre></code><tr class=miss><td>96<td><code><pre> r.log.Info(ctx, "%v [Gofusion] %s call redis exists failed when delete from cache "+</pre></code><tr><td>97<td><code><pre> "[err[%s] redis[%s] keys%v]", syscall.Getpid(), config.ComponentCache, err, r.name, keys)</pre></code><tr class=miss><td>98<td><code><pre> return keys // we cannot know whether ths keys are deleted</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre></pre></code><tr><td>101<td><code><pre> for i := 0; i < len(keys); i++ {</pre></code><tr><td>102<td><code><pre> if err := cmds[i].Err(); err != nil {</pre></code><tr class=miss><td>103<td><code><pre> failure = append(failure, keys[i]) // we cannot know whether ths key is deleted</pre></code><tr class=miss><td>104<td><code><pre> r.log.Info(ctx, "%v [Gofusion] %s call redis exists failed when delete from cache "+</pre></code><tr><td>105<td><code><pre> "[err[%s] redis[%s] key[%s]]", syscall.Getpid(), config.ComponentCache, err, r.name, keys[i])</pre></code><tr class=miss><td>106<td><code><pre> continue</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre></pre></code><tr><td>109<td><code><pre> if cmds[i].String() == "1" {</pre></code><tr class=miss><td>110<td><code><pre> failure = append(failure, keys[i])</pre></code><tr><td>111<td><code><pre> }</pre></code><tr><td>112<td><code><pre> }</pre></code><tr><td>113<td><code><pre></pre></code><tr><td>114<td><code><pre> return</pre></code><tr><td>115<td><code><pre>}</pre></code></table><div class=funcname id=fn_gCache.del>func gCache.del</div><div class=info><a href=#s_fn_gCache.del>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/local.go</code>:</div><table class=listing><tr><td>80<td><code><pre>func (g *gCache) del(ctx context.Context, keys ...string) (failure []string) {</pre></code><tr><td>81<td><code><pre> failure = make([]string, 0, len(keys))</pre></code><tr><td>82<td><code><pre> for _, k := range keys {</pre></code><tr><td>83<td><code><pre> if g.instance.Remove(k) {</pre></code><tr><td>84<td><code><pre> continue</pre></code><tr><td>85<td><code><pre> }</pre></code><tr><td>86<td><code><pre></pre></code><tr><td>87<td><code><pre> if _, err := g.instance.Get(k); !errors.Is(err, gcache.KeyNotFoundError) {</pre></code><tr class=miss><td>88<td><code><pre> failure = append(failure, k)</pre></code><tr class=miss><td>89<td><code><pre> if g.log != nil {</pre></code><tr class=miss><td>90<td><code><pre> g.log.Info(ctx, "%v [Gofusion] %s call gcache remove failed "+</pre></code><tr><td>91<td><code><pre> "when delete cache from gcache [err[%s] key[%s]]", syscall.Getpid(), config.ComponentCache, err, k)</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre> }</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre> return</pre></code><tr><td>96<td><code><pre>}</pre></code></table><div class=funcname id=fn_gCache.set>func gCache.set</div><div class=info><a href=#s_fn_gCache.set>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/local.go</code>:</div><table class=listing><tr><td>59<td><code><pre>func (g *gCache) set(ctx context.Context, kvs map[string]any, expired map[string]time.Duration) (failure []string) {</pre></code><tr><td>60<td><code><pre> failure = make([]string, 0, len(kvs))</pre></code><tr><td>61<td><code><pre> for k, v := range kvs {</pre></code><tr><td>62<td><code><pre> var err error</pre></code><tr><td>63<td><code><pre> if exp, ok := expired[k]; ok {</pre></code><tr><td>64<td><code><pre> err = g.instance.SetWithExpire(k, v, exp)</pre></code><tr><td>65<td><code><pre> } else {</pre></code><tr class=miss><td>66<td><code><pre> err = g.instance.Set(k, v)</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre></pre></code><tr><td>69<td><code><pre> if err != nil {</pre></code><tr class=miss><td>70<td><code><pre> failure = append(failure, k)</pre></code><tr class=miss><td>71<td><code><pre> if g.log != nil {</pre></code><tr class=miss><td>72<td><code><pre> g.log.Info(ctx, "%v [Gofusion] %s call gcache set/set_with_expire failed "+</pre></code><tr><td>73<td><code><pre> "when set cache into gcache [err[%s] key[%s]]", syscall.Getpid(), config.ComponentCache, err, k)</pre></code><tr><td>74<td><code><pre> }</pre></code><tr><td>75<td><code><pre> }</pre></code><tr><td>76<td><code><pre> }</pre></code><tr><td>77<td><code><pre> return</pre></code><tr><td>78<td><code><pre>}</pre></code></table><div class=funcname id=fn_.convInnerToMap>func .convInnerToMap</div><div class=info><a href=#s_fn_.convInnerToMap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>284<td><code><pre>func (c *cache[K, T, TS]) convInnerToMap(ctx context.Context, inner map[string]any, conf *parsedConf[K, T]) (</pre></code><tr><td>285<td><code><pre> kvs map[K]T, innerFailureKeys []string) {</pre></code><tr><td>286<td><code><pre> kvs = make(map[K]T, len(inner))</pre></code><tr><td>287<td><code><pre> for k, v := range inner {</pre></code><tr><td>288<td><code><pre> innerKey := c.convInnerToKey(k, conf.version)</pre></code><tr><td>289<td><code><pre> innerVal, err := c.convInnerToVal(v)</pre></code><tr><td>290<td><code><pre> if err != nil {</pre></code><tr class=miss><td>291<td><code><pre> if conf.log != nil {</pre></code><tr class=miss><td>292<td><code><pre> conf.log.Info(ctx, "%v [Gofusion] %s convert inner to value failed [err[%s] key[%+v] val[%+v]]",</pre></code><tr><td>293<td><code><pre> syscall.Getpid(), config.ComponentCache, err, innerKey, v)</pre></code><tr><td>294<td><code><pre> }</pre></code><tr class=miss><td>295<td><code><pre> innerFailureKeys = append(innerFailureKeys, k)</pre></code><tr class=miss><td>296<td><code><pre> continue</pre></code><tr><td>297<td><code><pre> }</pre></code><tr><td>298<td><code><pre> kvs[innerKey] = innerVal</pre></code><tr><td>299<td><code><pre> }</pre></code><tr><td>300<td><code><pre> return</pre></code><tr><td>301<td><code><pre>}</pre></code></table><div class=funcname id=fn_.convMapToInner>func .convMapToInner</div><div class=info><a href=#s_fn_.convMapToInner>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>257<td><code><pre>func (c *cache[K, T, TS]) convMapToInner(ctx context.Context, kvs map[K]T, conf *parsedConf[K, T]) (</pre></code><tr><td>258<td><code><pre> inner map[string]any, innerFailureKeys []string) {</pre></code><tr><td>259<td><code><pre> inner = make(map[string]any, len(kvs))</pre></code><tr><td>260<td><code><pre> for k, v := range kvs {</pre></code><tr><td>261<td><code><pre> innerKey := c.convKeyToInner(k, conf.version)</pre></code><tr><td>262<td><code><pre> innerVal, err := c.convValToInner(v, conf)</pre></code><tr><td>263<td><code><pre> if err != nil {</pre></code><tr class=miss><td>264<td><code><pre> if conf.log != nil {</pre></code><tr class=miss><td>265<td><code><pre> conf.log.Info(ctx, "%v [Gofusion] %s convert value to inner failed [err[%s] key[%+v] val[%+v]]",</pre></code><tr><td>266<td><code><pre> syscall.Getpid(), config.ComponentCache, err, k, v)</pre></code><tr><td>267<td><code><pre> }</pre></code><tr class=miss><td>268<td><code><pre> innerFailureKeys = append(innerFailureKeys, innerKey)</pre></code><tr class=miss><td>269<td><code><pre> continue</pre></code><tr><td>270<td><code><pre> }</pre></code><tr><td>271<td><code><pre> inner[innerKey] = innerVal</pre></code><tr><td>272<td><code><pre> }</pre></code><tr><td>273<td><code><pre> return</pre></code><tr><td>274<td><code><pre>}</pre></code></table><div class=funcname id=fn_.GetAll>func .GetAll</div><div class=info><a href=#s_fn_.GetAll>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>140<td><code><pre>func (c *cache[K, T, TS]) GetAll(ctx context.Context, cb callback[K, T]) (ts TS) {</pre></code><tr><td>141<td><code><pre> conf := c.getConfig()</pre></code><tr><td>142<td><code><pre> allInnerKeys := c.visited.Items()</pre></code><tr><td>143<td><code><pre> cached, missed := c.provider.get(ctx, allInnerKeys...)</pre></code><tr><td>144<td><code><pre> kvs, _ := c.convInnerToMap(ctx, cached, conf)</pre></code><tr><td>145<td><code><pre> if len(missed) > 0 && (cb != nil || conf.callback != nil) {</pre></code><tr class=miss><td>146<td><code><pre> keys := c.convInnerToKeys(missed, conf.version)</pre></code><tr class=miss><td>147<td><code><pre> if conf.log != nil {</pre></code><tr class=miss><td>148<td><code><pre> conf.log.Info(ctx, "%v [Gofusion] %s call callback function because we do not hit the cache "+</pre></code><tr><td>149<td><code><pre> "when get all [keys%+v]", syscall.Getpid(), config.ComponentCache, keys)</pre></code><tr><td>150<td><code><pre> }</pre></code><tr><td>151<td><code><pre></pre></code><tr class=miss><td>152<td><code><pre> var (</pre></code><tr><td>153<td><code><pre> callbackKVs map[K]T</pre></code><tr><td>154<td><code><pre> opts []utils.OptionExtender</pre></code><tr><td>155<td><code><pre> )</pre></code><tr class=miss><td>156<td><code><pre> if cb != nil {</pre></code><tr class=miss><td>157<td><code><pre> callbackKVs, opts = cb(ctx, keys)</pre></code><tr><td>158<td><code><pre> } else {</pre></code><tr class=miss><td>159<td><code><pre> callbackKVs, opts = conf.callback(ctx, keys)</pre></code><tr><td>160<td><code><pre> }</pre></code><tr><td>161<td><code><pre></pre></code><tr class=miss><td>162<td><code><pre> kvs = utils.MapMerge(kvs, callbackKVs)</pre></code><tr><td>163<td><code><pre></pre></code><tr class=miss><td>164<td><code><pre> innerVals, _ := c.convMapToInner(ctx, callbackKVs, conf)</pre></code><tr class=miss><td>165<td><code><pre> c.provider.set(ctx, innerVals, c.parseCallbackOption(kvs, conf, opts...))</pre></code><tr><td>166<td><code><pre> }</pre></code><tr><td>167<td><code><pre></pre></code><tr><td>168<td><code><pre> // order by param -> keys</pre></code><tr><td>169<td><code><pre> ts = make(TS, 0, len(kvs))</pre></code><tr><td>170<td><code><pre> missedKeys := make([]K, 0, len(allInnerKeys))</pre></code><tr><td>171<td><code><pre> for _, k := range c.convInnerToKeys(allInnerKeys, conf.version) {</pre></code><tr><td>172<td><code><pre> v, ok := kvs[k]</pre></code><tr><td>173<td><code><pre> if !ok {</pre></code><tr><td>174<td><code><pre> missedKeys = append(missedKeys, k)</pre></code><tr><td>175<td><code><pre> continue</pre></code><tr><td>176<td><code><pre> }</pre></code><tr><td>177<td><code><pre></pre></code><tr><td>178<td><code><pre> ts = append(ts, v)</pre></code><tr><td>179<td><code><pre> }</pre></code><tr><td>180<td><code><pre> c.visited.Remove(c.convKeysToInner(missedKeys, conf.version)...)</pre></code><tr><td>181<td><code><pre> if len(missedKeys) > 0 && conf.log != nil {</pre></code><tr><td>182<td><code><pre> conf.log.Warn(ctx, "%v [Gofusion] %s index key value failed when cache get all [keys%v]",</pre></code><tr><td>183<td><code><pre> syscall.Getpid(), config.ComponentCache, missedKeys)</pre></code><tr><td>184<td><code><pre> }</pre></code><tr><td>185<td><code><pre></pre></code><tr><td>186<td><code><pre> return</pre></code><tr><td>187<td><code><pre>}</pre></code></table><div class=funcname id=fn_addInstance>func addInstance</div><div class=info><a href=#s_fn_addInstance>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/construct.go</code>:</div><table class=listing><tr><td>26<td><code><pre>func addInstance(ctx context.Context, conf *Conf) {</pre></code><tr><td>27<td><code><pre> switch conf.CacheType {</pre></code><tr><td>28<td><code><pre> case cacheTypeLocal:</pre></code><tr><td>29<td><code><pre> case cacheTypeRemote:</pre></code><tr><td>30<td><code><pre> if conf.RemoteType != remoteTypeRedis {</pre></code><tr class=miss><td>31<td><code><pre> panic(UnknownRemoteType)</pre></code><tr><td>32<td><code><pre> }</pre></code><tr><td>33<td><code><pre></pre></code><tr><td>34<td><code><pre> parsedSerializeType := serialize.ParseAlgorithm(conf.SerializeType)</pre></code><tr><td>35<td><code><pre> parsedCompressType := compress.ParseAlgorithm(conf.Compress)</pre></code><tr><td>36<td><code><pre> if !parsedSerializeType.IsValid() && !parsedCompressType.IsValid() {</pre></code><tr class=miss><td>37<td><code><pre> panic(UnknownSerializeType)</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre> case cacheTypeRemoteLocal:</pre></code><tr class=miss><td>40<td><code><pre> panic(ErrNotImplement)</pre></code><tr><td>41<td><code><pre></pre></code><tr><td>42<td><code><pre> default:</pre></code><tr class=miss><td>43<td><code><pre> panic(UnknownCacheType)</pre></code><tr><td>44<td><code><pre> }</pre></code><tr><td>45<td><code><pre></pre></code><tr><td>46<td><code><pre> if utils.IsStrNotBlank(conf.Callback) && inspect.FuncOf(conf.Callback) == nil {</pre></code><tr class=miss><td>47<td><code><pre> panic(errors.Errorf("not found callback function: %s", conf.Callback))</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre>}</pre></code></table><div class=funcname id=fn_newGCache>func newGCache</div><div class=info><a href=#s_fn_newGCache>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/local.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func newGCache(size int, strategy string, log log.Loggable) *gCache {</pre></code><tr><td>16<td><code><pre> cacheBuilder := gcache.New(size)</pre></code><tr><td>17<td><code><pre> switch strategy {</pre></code><tr><td>18<td><code><pre> case gcache.TYPE_ARC:</pre></code><tr><td>19<td><code><pre> cacheBuilder = cacheBuilder.ARC()</pre></code><tr><td>20<td><code><pre> case gcache.TYPE_LFU:</pre></code><tr class=miss><td>21<td><code><pre> cacheBuilder = cacheBuilder.LFU()</pre></code><tr><td>22<td><code><pre> case gcache.TYPE_LRU:</pre></code><tr class=miss><td>23<td><code><pre> cacheBuilder = cacheBuilder.LRU()</pre></code><tr><td>24<td><code><pre> case gcache.TYPE_SIMPLE:</pre></code><tr class=miss><td>25<td><code><pre> cacheBuilder = cacheBuilder.Simple()</pre></code><tr><td>26<td><code><pre> default:</pre></code><tr class=miss><td>27<td><code><pre> cacheBuilder = cacheBuilder.ARC()</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre></pre></code><tr><td>30<td><code><pre> return &gCache{</pre></code><tr><td>31<td><code><pre> log: log,</pre></code><tr><td>32<td><code><pre> instance: cacheBuilder.Build(),</pre></code><tr><td>33<td><code><pre> }</pre></code><tr><td>34<td><code><pre>}</pre></code></table><div class=funcname id=fn_.cloneVal>func .cloneVal</div><div class=info><a href=#s_fn_.cloneVal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/cache.go</code>:</div><table class=listing><tr><td>361<td><code><pre>func (c *cache[K, T, TS]) cloneVal(src T) (dst T) {</pre></code><tr><td>362<td><code><pre> if cl, ok := any(src).(clone.Clonable[T]); ok {</pre></code><tr class=miss><td>363<td><code><pre> dst = cl.Clone()</pre></code><tr class=miss><td>364<td><code><pre> return</pre></code><tr><td>365<td><code><pre> }</pre></code><tr><td>366<td><code><pre> return clone.Slowly(src)</pre></code><tr><td>367<td><code><pre>}</pre></code></table><div class=funcname id=fn_@21:9>func @21:9</div><div class=info><a href=#s_fn_@21:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cache/construct.go</code>:</div><table class=listing><tr><td>21<td><code><pre>func() {</pre></code><tr><td>22<td><code><pre></pre></code><tr><td>23<td><code><pre> }</pre></code></table><div id=pkg_github.com/wfusion/gofusion/common/constant class=funcname>Package Overview: github.com/wfusion/gofusion/common/constant 5 <span class=packageTotal>75.0%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_DefaultLocation><td><code><a href=#fn_DefaultLocation>DefaultLocation(...)</a></code><td><code>github.com/wfusion/gofusion/common/constant/time_format.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code></table><div class=funcname id=fn_DefaultLocation>func DefaultLocation</div><div class=info><a href=#s_fn_DefaultLocation>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/constant/time_format.go</code>:</div><table class=listing><tr><td>18<td><code><pre>func DefaultLocation() *time.Location {</pre></code><tr><td>19<td><code><pre> loc, err := time.LoadLocation(DefaultTimezone)</pre></code><tr><td>20<td><code><pre> if err != nil {</pre></code><tr class=miss><td>21<td><code><pre> panic(err)</pre></code><tr><td>22<td><code><pre> }</pre></code><tr><td>23<td><code><pre> return loc</pre></code><tr><td>24<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/common/di class=funcname>Package Overview: github.com/wfusion/gofusion/common/di 6 <span class=packageTotal>69.0%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn__dig.MustProvide><td><code><a href=#fn__dig.MustProvide>_dig.MustProvide(...)</a></code><td><code>github.com/wfusion/gofusion/common/di/dig.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_Name><td><code><a href=#fn_Name>Name(...)</a></code><td><code>github.com/wfusion/gofusion/common/di/dig.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@40:9><td><code><a href=#fn_@40:9>@40:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/di/dig.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn__dig.Clear><td><code><a href=#fn__dig.Clear>_dig.Clear(...)</a></code><td><code>github.com/wfusion/gofusion/common/di/dig.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn__dig.Invoke><td><code><a href=#fn__dig.Invoke>_dig.Invoke(...)</a></code><td><code>github.com/wfusion/gofusion/common/di/dig.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn__dig.MustInvoke><td><code><a href=#fn__dig.MustInvoke>_dig.MustInvoke(...)</a></code><td><code>github.com/wfusion/gofusion/common/di/dig.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_NewDI><td><code><a href=#fn_NewDI>NewDI(...)</a></code><td><code>github.com/wfusion/gofusion/common/di/dig.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn__dig.Preload><td><code><a href=#fn__dig.Preload>_dig.Preload(...)</a></code><td><code>github.com/wfusion/gofusion/common/di/dig.go</code><td class=percent><code>87.5%</code><td class=linecount><code>14/16</code><tr id=s_fn__dig.Provide><td><code><a href=#fn__dig.Provide>_dig.Provide(...)</a></code><td><code>github.com/wfusion/gofusion/common/di/dig.go</code><td class=percent><code>87.5%</code><td class=linecount><code>7/8</code><tr id=s_fn__dig.addFields><td><code><a href=#fn__dig.addFields>_dig.addFields(...)</a></code><td><code>github.com/wfusion/gofusion/common/di/dig.go</code><td class=percent><code>55.0%</code><td class=linecount><code>11/20</code><tr id=s_fn__dig.MustDecorate><td><code><a href=#fn__dig.MustDecorate>_dig.MustDecorate(...)</a></code><td><code>github.com/wfusion/gofusion/common/di/dig.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn__dig.Decorate><td><code><a href=#fn__dig.Decorate>_dig.Decorate(...)</a></code><td><code>github.com/wfusion/gofusion/common/di/dig.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn__dig.String><td><code><a href=#fn__dig.String>_dig.String(...)</a></code><td><code>github.com/wfusion/gofusion/common/di/dig.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@46:9><td><code><a href=#fn_@46:9>@46:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/di/dig.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Group><td><code><a href=#fn_Group>Group(...)</a></code><td><code>github.com/wfusion/gofusion/common/di/dig.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn__dig.MustProvide>func _dig.MustProvide</div><div class=info><a href=#s_fn__dig.MustProvide>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/di/dig.go</code>:</div><table class=listing><tr><td>66<td><code><pre>func (d *_dig) MustProvide(ctor any, opts ...utils.OptionExtender) DI {</pre></code><tr><td>67<td><code><pre> utils.MustSuccess(d.Provide(ctor, opts...))</pre></code><tr><td>68<td><code><pre> return d</pre></code><tr><td>69<td><code><pre>}</pre></code></table><div class=funcname id=fn_Name>func Name</div><div class=info><a href=#s_fn_Name>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/di/dig.go</code>:</div><table class=listing><tr><td>39<td><code><pre>func Name(name string) utils.OptionFunc[provideOption] {</pre></code><tr><td>40<td><code><pre> return func(p *provideOption) {</pre></code><tr><td>41<td><code><pre> p.name = name</pre></code><tr><td>42<td><code><pre> }</pre></code><tr><td>43<td><code><pre>}</pre></code></table><div class=funcname id=fn_@40:9>func @40:9</div><div class=info><a href=#s_fn_@40:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/di/dig.go</code>:</div><table class=listing><tr><td>40<td><code><pre>func(p *provideOption) {</pre></code><tr><td>41<td><code><pre> p.name = name</pre></code><tr><td>42<td><code><pre> }</pre></code></table><div class=funcname id=fn__dig.Clear>func _dig.Clear</div><div class=info><a href=#s_fn__dig.Clear>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/di/dig.go</code>:</div><table class=listing><tr><td>80<td><code><pre>func (d *_dig) Clear() {</pre></code><tr><td>81<td><code><pre> d.Container = dig.New()</pre></code><tr><td>82<td><code><pre>}</pre></code></table><div class=funcname id=fn__dig.Invoke>func _dig.Invoke</div><div class=info><a href=#s_fn__dig.Invoke>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/di/dig.go</code>:</div><table class=listing><tr><td>51<td><code><pre>func (d *_dig) Invoke(fn any) error { return d.Container.Invoke(fn) }</pre></code></table><div class=funcname id=fn__dig.MustInvoke>func _dig.MustInvoke</div><div class=info><a href=#s_fn__dig.MustInvoke>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/di/dig.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func (d *_dig) MustInvoke(fn any) { utils.MustSuccess(d.Container.Invoke(fn)) }</pre></code></table><div class=funcname id=fn_NewDI>func NewDI</div><div class=info><a href=#s_fn_NewDI>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/di/dig.go</code>:</div><table class=listing><tr><td>30<td><code><pre>func NewDI() DI {</pre></code><tr><td>31<td><code><pre> return &_dig{Container: dig.New()}</pre></code><tr><td>32<td><code><pre>}</pre></code></table><div class=funcname id=fn__dig.Preload>func _dig.Preload</div><div class=info><a href=#s_fn__dig.Preload>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/di/dig.go</code>:</div><table class=listing><tr><td>86<td><code><pre>func (d *_dig) Preload() {</pre></code><tr><td>87<td><code><pre> fields := make([]reflect.StructField, 0, 1+len(d.fields))</pre></code><tr><td>88<td><code><pre> fields = append(fields, reflect.StructField{</pre></code><tr><td>89<td><code><pre> Name: "In",</pre></code><tr><td>90<td><code><pre> PkgPath: "",</pre></code><tr><td>91<td><code><pre> Type: digInType,</pre></code><tr><td>92<td><code><pre> Tag: "",</pre></code><tr><td>93<td><code><pre> Offset: 0,</pre></code><tr><td>94<td><code><pre> Index: nil,</pre></code><tr><td>95<td><code><pre> Anonymous: true,</pre></code><tr><td>96<td><code><pre> })</pre></code><tr><td>97<td><code><pre> for i := 0; i < len(d.fields); i++ {</pre></code><tr><td>98<td><code><pre> fields = append(fields, reflect.StructField{</pre></code><tr><td>99<td><code><pre> Name: fmt.Sprintf("Arg%X", i+1),</pre></code><tr><td>100<td><code><pre> PkgPath: "",</pre></code><tr><td>101<td><code><pre> Type: d.fields[i].Type,</pre></code><tr><td>102<td><code><pre> Tag: d.fields[i].Tag,</pre></code><tr><td>103<td><code><pre> Offset: 0,</pre></code><tr><td>104<td><code><pre> Index: nil,</pre></code><tr><td>105<td><code><pre> Anonymous: false,</pre></code><tr><td>106<td><code><pre> })</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre> structType := reflect.StructOf(fields)</pre></code><tr><td>109<td><code><pre></pre></code><tr><td>110<td><code><pre> // FIXME: we cannot declare function param type dynamic now</pre></code><tr><td>111<td><code><pre> scope := inspect.GetField[*dig.Scope](d.Container, "scope")</pre></code><tr><td>112<td><code><pre> containerStoreType := inspect.TypeOf("go.uber.org/dig.containerStore")</pre></code><tr><td>113<td><code><pre> containerStoreVal := reflect.ValueOf(scope).Convert(containerStoreType)</pre></code><tr><td>114<td><code><pre></pre></code><tr><td>115<td><code><pre> fakeParam := utils.Must(newParam(structType, scope))</pre></code><tr><td>116<td><code><pre> paramType := inspect.TypeOf("go.uber.org/dig.param")</pre></code><tr><td>117<td><code><pre> paramVal := reflect.ValueOf(fakeParam).Convert(paramType)</pre></code><tr><td>118<td><code><pre> buildFn := paramVal.MethodByName("Build")</pre></code><tr><td>119<td><code><pre> returnValList := buildFn.Call([]reflect.Value{containerStoreVal})</pre></code><tr><td>120<td><code><pre> if errVal := returnValList[len(returnValList)-1].Interface(); errVal != nil {</pre></code><tr class=miss><td>121<td><code><pre> if err, ok := errVal.(error); ok && err != nil {</pre></code><tr class=miss><td>122<td><code><pre> panic(err)</pre></code><tr><td>123<td><code><pre> }</pre></code><tr><td>124<td><code><pre> }</pre></code><tr><td>125<td><code><pre>}</pre></code></table><div class=funcname id=fn__dig.Provide>func _dig.Provide</div><div class=info><a href=#s_fn__dig.Provide>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/di/dig.go</code>:</div><table class=listing><tr><td>53<td><code><pre>func (d *_dig) Provide(ctor any, opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>54<td><code><pre> opt := utils.ApplyOptions[provideOption](opts...)</pre></code><tr><td>55<td><code><pre> digOpts := make([]dig.ProvideOption, 0, 2)</pre></code><tr><td>56<td><code><pre> if opt.name != "" {</pre></code><tr><td>57<td><code><pre> digOpts = append(digOpts, dig.Name(opt.name))</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre> if opt.group != "" {</pre></code><tr class=miss><td>60<td><code><pre> digOpts = append(digOpts, dig.Group(opt.group))</pre></code><tr><td>61<td><code><pre> }</pre></code><tr><td>62<td><code><pre></pre></code><tr><td>63<td><code><pre> defer d.addFields(ctor, opt)</pre></code><tr><td>64<td><code><pre> return d.Container.Provide(ctor, digOpts...)</pre></code><tr><td>65<td><code><pre>}</pre></code></table><div class=funcname id=fn__dig.addFields>func _dig.addFields</div><div class=info><a href=#s_fn__dig.addFields>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/di/dig.go</code>:</div><table class=listing><tr><td>127<td><code><pre>func (d *_dig) addFields(ctor any, opt *provideOption) {</pre></code><tr><td>128<td><code><pre> typ := reflect.TypeOf(ctor)</pre></code><tr><td>129<td><code><pre> numOfOut := typ.NumOut()</pre></code><tr><td>130<td><code><pre> for i := 0; i < numOfOut; i++ {</pre></code><tr><td>131<td><code><pre> out := typ.Out(i)</pre></code><tr><td>132<td><code><pre> // ignore error and non-interface nor non-struct out param</pre></code><tr><td>133<td><code><pre> if out == constant.ErrorType ||</pre></code><tr><td>134<td><code><pre> (out.Kind() != reflect.Interface &&</pre></code><tr><td>135<td><code><pre> (out.Kind() != reflect.Struct && !(out.Kind() == reflect.Ptr && out.Elem().Kind() == reflect.Struct))) {</pre></code><tr class=miss><td>136<td><code><pre> continue</pre></code><tr><td>137<td><code><pre> }</pre></code><tr><td>138<td><code><pre> if !utils.EmbedsType(out, digOutType) {</pre></code><tr><td>139<td><code><pre> var tag reflect.StructTag</pre></code><tr><td>140<td><code><pre> switch {</pre></code><tr><td>141<td><code><pre> case opt.name != "":</pre></code><tr><td>142<td><code><pre> tag = reflect.StructTag(fmt.Sprintf(`name:"%s"`, opt.name))</pre></code><tr><td>143<td><code><pre> case opt.group != "":</pre></code><tr class=miss><td>144<td><code><pre> tag = reflect.StructTag(fmt.Sprintf(`group:"%s"`, opt.group))</pre></code><tr class=miss><td>145<td><code><pre> out = reflect.SliceOf(out)</pre></code><tr><td>146<td><code><pre> }</pre></code><tr><td>147<td><code><pre></pre></code><tr><td>148<td><code><pre> d.fields = append(d.fields, reflect.StructField{Type: out, Tag: tag})</pre></code><tr><td>149<td><code><pre> continue</pre></code><tr><td>150<td><code><pre> }</pre></code><tr><td>151<td><code><pre></pre></code><tr><td>152<td><code><pre> // traverse all field</pre></code><tr class=miss><td>153<td><code><pre> numOfFields := out.NumField()</pre></code><tr class=miss><td>154<td><code><pre> for j := 0; j < numOfFields; j++ {</pre></code><tr class=miss><td>155<td><code><pre> f := out.Field(j)</pre></code><tr><td>156<td><code><pre></pre></code><tr><td>157<td><code><pre> // ignore dig out</pre></code><tr class=miss><td>158<td><code><pre> if f.Type == digOutType || f.Type == outType {</pre></code><tr class=miss><td>159<td><code><pre> continue</pre></code><tr><td>160<td><code><pre> }</pre></code><tr><td>161<td><code><pre></pre></code><tr class=miss><td>162<td><code><pre> d.fields = append(d.fields, f)</pre></code><tr><td>163<td><code><pre> }</pre></code><tr><td>164<td><code><pre> }</pre></code><tr><td>165<td><code><pre>}</pre></code></table><div class=funcname id=fn__dig.MustDecorate>func _dig.MustDecorate</div><div class=info><a href=#s_fn__dig.MustDecorate>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/di/dig.go</code>:</div><table class=listing><tr><td>71<td><code><pre>func (d *_dig) MustDecorate(decorator any) DI {</pre></code><tr class=miss><td>72<td><code><pre> utils.MustSuccess(d.Container.Decorate(decorator))</pre></code><tr class=miss><td>73<td><code><pre> return d</pre></code><tr><td>74<td><code><pre>}</pre></code></table><div class=funcname id=fn__dig.Decorate>func _dig.Decorate</div><div class=info><a href=#s_fn__dig.Decorate>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/di/dig.go</code>:</div><table class=listing><tr class=miss><td>70<td><code><pre>func (d *_dig) Decorate(decorator any) error { return d.Container.Decorate(decorator) }</pre></code></table><div class=funcname id=fn__dig.String>func _dig.String</div><div class=info><a href=#s_fn__dig.String>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/di/dig.go</code>:</div><table class=listing><tr><td>76<td><code><pre>func (d *_dig) String() string {</pre></code><tr class=miss><td>77<td><code><pre> return d.Container.String()</pre></code><tr><td>78<td><code><pre>}</pre></code></table><div class=funcname id=fn_@46:9>func @46:9</div><div class=info><a href=#s_fn_@46:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/di/dig.go</code>:</div><table class=listing><tr><td>46<td><code><pre>func(p *provideOption) {</pre></code><tr class=miss><td>47<td><code><pre> p.group = group</pre></code><tr><td>48<td><code><pre> }</pre></code></table><div class=funcname id=fn_Group>func Group</div><div class=info><a href=#s_fn_Group>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/di/dig.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func Group(group string) utils.OptionFunc[provideOption] {</pre></code><tr class=miss><td>46<td><code><pre> return func(p *provideOption) {</pre></code><tr><td>47<td><code><pre> p.group = group</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/common/env class=funcname>Package Overview: github.com/wfusion/gofusion/common/env 7 <span class=packageTotal>61.9%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_GetEnv><td><code><a href=#fn_GetEnv>GetEnv(...)</a></code><td><code>github.com/wfusion/gofusion/common/env/env.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/common/env/env.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_SvcName><td><code><a href=#fn_SvcName>SvcName(...)</a></code><td><code>github.com/wfusion/gofusion/common/env/env.go</code><td class=percent><code>57.1%</code><td class=linecount><code>4/7</code><tr id=s_fn_IsOnline><td><code><a href=#fn_IsOnline>IsOnline(...)</a></code><td><code>github.com/wfusion/gofusion/common/env/env.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_IsStaging><td><code><a href=#fn_IsStaging>IsStaging(...)</a></code><td><code>github.com/wfusion/gofusion/common/env/env.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_IsCI><td><code><a href=#fn_IsCI>IsCI(...)</a></code><td><code>github.com/wfusion/gofusion/common/env/env.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_SetSvcName><td><code><a href=#fn_SetSvcName>SetSvcName(...)</a></code><td><code>github.com/wfusion/gofusion/common/env/env.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_IsDEV><td><code><a href=#fn_IsDEV>IsDEV(...)</a></code><td><code>github.com/wfusion/gofusion/common/env/env.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_GetEnv>func GetEnv</div><div class=info><a href=#s_fn_GetEnv>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/env/env.go</code>:</div><table class=listing><tr><td>22<td><code><pre>func GetEnv() string {</pre></code><tr><td>23<td><code><pre> if env != "" {</pre></code><tr><td>24<td><code><pre> return env</pre></code><tr><td>25<td><code><pre> }</pre></code><tr><td>26<td><code><pre> if env = os.Getenv("ENV"); env == "" {</pre></code><tr><td>27<td><code><pre> env = Dev</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre> return env</pre></code><tr><td>30<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/env/env.go</code>:</div><table class=listing><tr><td>69<td><code><pre>func init() {</pre></code><tr><td>70<td><code><pre> GetEnv()</pre></code><tr><td>71<td><code><pre> SvcName()</pre></code><tr><td>72<td><code><pre></pre></code><tr><td>73<td><code><pre> dir, _ := filepath.Abs(filepath.Dir(os.Args[0]))</pre></code><tr><td>74<td><code><pre> WorkDir = dir</pre></code><tr><td>75<td><code><pre>}</pre></code></table><div class=funcname id=fn_SvcName>func SvcName</div><div class=info><a href=#s_fn_SvcName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/env/env.go</code>:</div><table class=listing><tr><td>56<td><code><pre>func SvcName() string {</pre></code><tr><td>57<td><code><pre> if svcName != "" {</pre></code><tr class=miss><td>58<td><code><pre> return svcName</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre> if svcName = os.Getenv("SVC_NAME"); svcName != "" {</pre></code><tr class=miss><td>61<td><code><pre> return svcName</pre></code><tr><td>62<td><code><pre> }</pre></code><tr><td>63<td><code><pre> if svcName = os.Getenv("SERVICE_NAME"); svcName != "" {</pre></code><tr class=miss><td>64<td><code><pre> return svcName</pre></code><tr><td>65<td><code><pre> }</pre></code><tr><td>66<td><code><pre> return ""</pre></code><tr><td>67<td><code><pre>}</pre></code></table><div class=funcname id=fn_IsOnline>func IsOnline</div><div class=info><a href=#s_fn_IsOnline>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/env/env.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func IsOnline() bool {</pre></code><tr class=miss><td>39<td><code><pre> return GetEnv() == Online</pre></code><tr><td>40<td><code><pre>}</pre></code></table><div class=funcname id=fn_IsStaging>func IsStaging</div><div class=info><a href=#s_fn_IsStaging>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/env/env.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func IsStaging() bool {</pre></code><tr class=miss><td>44<td><code><pre> return GetEnv() == Staging</pre></code><tr><td>45<td><code><pre>}</pre></code></table><div class=funcname id=fn_IsCI>func IsCI</div><div class=info><a href=#s_fn_IsCI>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/env/env.go</code>:</div><table class=listing><tr><td>48<td><code><pre>func IsCI() bool {</pre></code><tr class=miss><td>49<td><code><pre> return GetEnv() == CI</pre></code><tr><td>50<td><code><pre>}</pre></code></table><div class=funcname id=fn_SetSvcName>func SetSvcName</div><div class=info><a href=#s_fn_SetSvcName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/env/env.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func SetSvcName(name string) {</pre></code><tr class=miss><td>53<td><code><pre> svcName = name</pre></code><tr><td>54<td><code><pre>}</pre></code></table><div class=funcname id=fn_IsDEV>func IsDEV</div><div class=info><a href=#s_fn_IsDEV>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/env/env.go</code>:</div><table class=listing><tr><td>33<td><code><pre>func IsDEV() bool {</pre></code><tr class=miss><td>34<td><code><pre> return GetEnv() == Dev</pre></code><tr><td>35<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/common/infra/drivers/mongo class=funcname>Package Overview: github.com/wfusion/gofusion/common/infra/drivers/mongo 8 <span class=packageTotal>89.1%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_defaultDialect.wrapNumberSetter><td><code><a href=#fn_defaultDialect.wrapNumberSetter>defaultDialect.wrapNumberSetter(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_Mongo.GetProxy><td><code><a href=#fn_Mongo.GetProxy>Mongo.GetProxy(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/interface.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_WithMonitor><td><code><a href=#fn_WithMonitor>WithMonitor(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/logger.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@10:9><td><code><a href=#fn_@10:9>@10:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/logger.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_WithPoolMonitor><td><code><a href=#fn_WithPoolMonitor>WithPoolMonitor(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/logger.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@16:9><td><code><a href=#fn_@16:9>@16:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/logger.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Mongo.Database><td><code><a href=#fn_Mongo.Database>Mongo.Database(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/interface.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@101:39><td><code><a href=#fn_@101:39>@101:39(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@102:43><td><code><a href=#fn_@102:43>@102:43(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@103:45><td><code><a href=#fn_@103:45>@103:45(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@104:47><td><code><a href=#fn_@104:47>@104:47(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@105:49><td><code><a href=#fn_@105:49>@105:49(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@106:43><td><code><a href=#fn_@106:43>@106:43(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@108:41><td><code><a href=#fn_@108:41>@108:41(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_defaultDialect.parseOption><td><code><a href=#fn_defaultDialect.parseOption>defaultDialect.parseOption(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_defaultDialect.New><td><code><a href=#fn_defaultDialect.New>defaultDialect.New(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code><td class=percent><code>91.3%</code><td class=linecount><code>21/23</code><tr id=s_fn_defaultDialect.wrapDurationSetter><td><code><a href=#fn_defaultDialect.wrapDurationSetter>defaultDialect.wrapDurationSetter(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code><td class=percent><code>66.7%</code><td class=linecount><code>4/6</code><tr id=s_fn_@107:41><td><code><a href=#fn_@107:41>@107:41(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_defaultDialect.wrapNumberSetter>func defaultDialect.wrapNumberSetter</div><div class=info><a href=#s_fn_defaultDialect.wrapNumberSetter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code>:</div><table class=listing><tr><td>143<td><code><pre>func (d *defaultDialect) wrapNumberSetter(n uint64, setter func(nu uint64)) {</pre></code><tr><td>144<td><code><pre> if n > 0 {</pre></code><tr><td>145<td><code><pre> setter(n)</pre></code><tr><td>146<td><code><pre> }</pre></code><tr><td>147<td><code><pre>}</pre></code></table><div class=funcname id=fn_Mongo.GetProxy>func Mongo.GetProxy</div><div class=info><a href=#s_fn_Mongo.GetProxy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/interface.go</code>:</div><table class=listing><tr><td>26<td><code><pre>func (m *Mongo) GetProxy() *mongo.Client {</pre></code><tr><td>27<td><code><pre> return m.Client</pre></code><tr><td>28<td><code><pre>}</pre></code></table><div class=funcname id=fn_WithMonitor>func WithMonitor</div><div class=info><a href=#s_fn_WithMonitor>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/logger.go</code>:</div><table class=listing><tr><td>9<td><code><pre>func WithMonitor(monitor *event.CommandMonitor) utils.OptionFunc[newOption] {</pre></code><tr><td>10<td><code><pre> return func(o *newOption) {</pre></code><tr><td>11<td><code><pre> o.monitor = monitor</pre></code><tr><td>12<td><code><pre> }</pre></code><tr><td>13<td><code><pre>}</pre></code></table><div class=funcname id=fn_@10:9>func @10:9</div><div class=info><a href=#s_fn_@10:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/logger.go</code>:</div><table class=listing><tr><td>10<td><code><pre>func(o *newOption) {</pre></code><tr><td>11<td><code><pre> o.monitor = monitor</pre></code><tr><td>12<td><code><pre> }</pre></code></table><div class=funcname id=fn_WithPoolMonitor>func WithPoolMonitor</div><div class=info><a href=#s_fn_WithPoolMonitor>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/logger.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func WithPoolMonitor(monitor *event.PoolMonitor) utils.OptionFunc[newOption] {</pre></code><tr><td>16<td><code><pre> return func(o *newOption) {</pre></code><tr><td>17<td><code><pre> o.poolMonitor = monitor</pre></code><tr><td>18<td><code><pre> }</pre></code><tr><td>19<td><code><pre>}</pre></code></table><div class=funcname id=fn_@16:9>func @16:9</div><div class=info><a href=#s_fn_@16:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/logger.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func(o *newOption) {</pre></code><tr><td>17<td><code><pre> o.poolMonitor = monitor</pre></code><tr><td>18<td><code><pre> }</pre></code></table><div class=funcname id=fn_Mongo.Database>func Mongo.Database</div><div class=info><a href=#s_fn_Mongo.Database>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/interface.go</code>:</div><table class=listing><tr><td>30<td><code><pre>func (m *Mongo) Database(name string, opts ...*options.DatabaseOptions) *mongo.Database {</pre></code><tr><td>31<td><code><pre> return m.Client.Database(name, opts...)</pre></code><tr><td>32<td><code><pre>}</pre></code></table><div class=funcname id=fn_@101:39>func @101:39</div><div class=info><a href=#s_fn_@101:39>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code>:</div><table class=listing><tr><td>101<td><code><pre>func(du time.Duration) { opt.SetTimeout(du) }</pre></code></table><div class=funcname id=fn_@102:43>func @102:43</div><div class=info><a href=#s_fn_@102:43>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code>:</div><table class=listing><tr><td>102<td><code><pre>func(du time.Duration) { opt.SetConnectTimeout(du) }</pre></code></table><div class=funcname id=fn_@103:45>func @103:45</div><div class=info><a href=#s_fn_@103:45>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code>:</div><table class=listing><tr><td>103<td><code><pre>func(du time.Duration) { opt.SetSocketTimeout(du) }</pre></code></table><div class=funcname id=fn_@104:47>func @104:47</div><div class=info><a href=#s_fn_@104:47>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code>:</div><table class=listing><tr><td>104<td><code><pre>func(du time.Duration) { opt.SetMaxConnIdleTime(du) }</pre></code></table><div class=funcname id=fn_@105:49>func @105:49</div><div class=info><a href=#s_fn_@105:49>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code>:</div><table class=listing><tr><td>105<td><code><pre>func(du time.Duration) { opt.SetHeartbeatInterval(du) }</pre></code></table><div class=funcname id=fn_@106:43>func @106:43</div><div class=info><a href=#s_fn_@106:43>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code>:</div><table class=listing><tr><td>106<td><code><pre>func(nu uint64) { opt.SetMaxConnecting(option.MaxConnecting) }</pre></code></table><div class=funcname id=fn_@108:41>func @108:41</div><div class=info><a href=#s_fn_@108:41>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code>:</div><table class=listing><tr><td>108<td><code><pre>func(nu uint64) { opt.SetMaxPoolSize(option.MaxPoolSize) }</pre></code></table><div class=funcname id=fn_defaultDialect.parseOption>func defaultDialect.parseOption</div><div class=info><a href=#s_fn_defaultDialect.parseOption>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code>:</div><table class=listing><tr><td>149<td><code><pre>func (d *defaultDialect) parseOption(option Option) (dsn string) {</pre></code><tr><td>150<td><code><pre> return fmt.Sprintf("mongodb://%s:%s@%s/%s?authSource=%s",</pre></code><tr><td>151<td><code><pre> option.User, option.Password, strings.Join(option.Endpoints, constant.Comma), option.DB, option.AuthDB)</pre></code><tr><td>152<td><code><pre>}</pre></code></table><div class=funcname id=fn_defaultDialect.New>func defaultDialect.New</div><div class=info><a href=#s_fn_defaultDialect.New>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code>:</div><table class=listing><tr><td>97<td><code><pre>func (d *defaultDialect) New(ctx context.Context, option Option, opts ...utils.OptionExtender) (cli *Mongo, err error) {</pre></code><tr><td>98<td><code><pre> opt := options.Client().ApplyURI(d.parseOption(option))</pre></code><tr><td>99<td><code><pre> opt.SetRetryReads(option.RetryReads)</pre></code><tr><td>100<td><code><pre> opt.SetRetryWrites(option.RetryWrites)</pre></code><tr><td>101<td><code><pre> d.wrapDurationSetter(option.Timeout, func(du time.Duration) { opt.SetTimeout(du) })</pre></code><tr><td>102<td><code><pre> d.wrapDurationSetter(option.ConnTimeout, func(du time.Duration) { opt.SetConnectTimeout(du) })</pre></code><tr><td>103<td><code><pre> d.wrapDurationSetter(option.SocketTimeout, func(du time.Duration) { opt.SetSocketTimeout(du) })</pre></code><tr><td>104<td><code><pre> d.wrapDurationSetter(option.MaxConnIdleTime, func(du time.Duration) { opt.SetMaxConnIdleTime(du) })</pre></code><tr><td>105<td><code><pre> d.wrapDurationSetter(option.HeartbeatInterval, func(du time.Duration) { opt.SetHeartbeatInterval(du) })</pre></code><tr><td>106<td><code><pre> d.wrapNumberSetter(option.MaxConnecting, func(nu uint64) { opt.SetMaxConnecting(option.MaxConnecting) })</pre></code><tr><td>107<td><code><pre> d.wrapNumberSetter(option.MinPoolSize, func(nu uint64) { opt.SetMinPoolSize(option.MinPoolSize) })</pre></code><tr><td>108<td><code><pre> d.wrapNumberSetter(option.MaxPoolSize, func(nu uint64) { opt.SetMaxPoolSize(option.MaxPoolSize) })</pre></code><tr><td>109<td><code><pre></pre></code><tr><td>110<td><code><pre> newOpt := utils.ApplyOptions[newOption](opts...)</pre></code><tr><td>111<td><code><pre> if newOpt.monitor != nil {</pre></code><tr><td>112<td><code><pre> opt = opt.SetMonitor(newOpt.monitor)</pre></code><tr><td>113<td><code><pre> }</pre></code><tr><td>114<td><code><pre> if newOpt.poolMonitor != nil {</pre></code><tr><td>115<td><code><pre> opt = opt.SetPoolMonitor(newOpt.poolMonitor)</pre></code><tr><td>116<td><code><pre> }</pre></code><tr><td>117<td><code><pre></pre></code><tr><td>118<td><code><pre> mgoCli, err := mongo.Connect(ctx, opt)</pre></code><tr><td>119<td><code><pre> if err != nil {</pre></code><tr class=miss><td>120<td><code><pre> return</pre></code><tr><td>121<td><code><pre> }</pre></code><tr><td>122<td><code><pre></pre></code><tr><td>123<td><code><pre> // authentication check</pre></code><tr><td>124<td><code><pre> if err = mgoCli.Ping(ctx, nil); err != nil {</pre></code><tr class=miss><td>125<td><code><pre> return</pre></code><tr><td>126<td><code><pre> }</pre></code><tr><td>127<td><code><pre></pre></code><tr><td>128<td><code><pre> cli = &Mongo{Client: mgoCli}</pre></code><tr><td>129<td><code><pre> return</pre></code><tr><td>130<td><code><pre>}</pre></code></table><div class=funcname id=fn_defaultDialect.wrapDurationSetter>func defaultDialect.wrapDurationSetter</div><div class=info><a href=#s_fn_defaultDialect.wrapDurationSetter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code>:</div><table class=listing><tr><td>132<td><code><pre>func (d *defaultDialect) wrapDurationSetter(s string, setter func(du time.Duration)) {</pre></code><tr><td>133<td><code><pre> if utils.IsStrBlank(s) {</pre></code><tr class=miss><td>134<td><code><pre> return</pre></code><tr><td>135<td><code><pre> }</pre></code><tr><td>136<td><code><pre> duration, err := time.ParseDuration(s)</pre></code><tr><td>137<td><code><pre> if err != nil {</pre></code><tr class=miss><td>138<td><code><pre> panic(err)</pre></code><tr><td>139<td><code><pre> }</pre></code><tr><td>140<td><code><pre> setter(duration)</pre></code><tr><td>141<td><code><pre>}</pre></code></table><div class=funcname id=fn_@107:41>func @107:41</div><div class=info><a href=#s_fn_@107:41>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/mongo/mongo.go</code>:</div><table class=listing><tr class=miss><td>107<td><code><pre>func(nu uint64) { opt.SetMinPoolSize(option.MinPoolSize) }</pre></code></table><div id=pkg_github.com/wfusion/gofusion/common/infra/drivers/orm class=funcname>Package Overview: github.com/wfusion/gofusion/common/infra/drivers/orm 9 <span class=packageTotal>75.0%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_gormDriver.parseDBOption><td><code><a href=#fn_gormDriver.parseDBOption>gormDriver.parseDBOption(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/gorm.go</code><td class=percent><code>100.0%</code><td class=linecount><code>10/10</code><tr id=s_fn_gormDriver.genSqlServerDsn><td><code><a href=#fn_gormDriver.genSqlServerDsn>gormDriver.genSqlServerDsn(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/gorm.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_gormDriver.genPostgresDsn><td><code><a href=#fn_gormDriver.genPostgresDsn>gormDriver.genPostgresDsn(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/gorm.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_DB.GetProxy><td><code><a href=#fn_DB.GetProxy>DB.GetProxy(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/interface.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_DB.WithContext><td><code><a href=#fn_DB.WithContext>DB.WithContext(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/interface.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_WithLogger><td><code><a href=#fn_WithLogger>WithLogger(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/logger.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@10:9><td><code><a href=#fn_@10:9>@10:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/logger.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_gormDriver.New><td><code><a href=#fn_gormDriver.New>gormDriver.New(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/gorm.go</code><td class=percent><code>90.5%</code><td class=linecount><code>19/21</code><tr id=s_fn_gormDriver.open><td><code><a href=#fn_gormDriver.open>gormDriver.open(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/gorm.go</code><td class=percent><code>75.0%</code><td class=linecount><code>9/12</code><tr id=s_fn_gormDriver.genMySqlDsn><td><code><a href=#fn_gormDriver.genMySqlDsn>gormDriver.genMySqlDsn(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/gorm.go</code><td class=percent><code>66.7%</code><td class=linecount><code>4/6</code><tr id=s_fn_gormDriver.genClickhouseDsn><td><code><a href=#fn_gormDriver.genClickhouseDsn>gormDriver.genClickhouseDsn(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/gorm.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/10</code><tr id=s_fn_DB.GetDialector><td><code><a href=#fn_DB.GetDialector>DB.GetDialector(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/interface.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_gormDriver.parseDBOption>func gormDriver.parseDBOption</div><div class=info><a href=#s_fn_gormDriver.parseDBOption>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/gorm.go</code>:</div><table class=listing><tr><td>138<td><code><pre>func (g *gormDriver) parseDBOption(option Option) (parsed *gormDriverOption) {</pre></code><tr><td>139<td><code><pre> parsed = &gormDriverOption{</pre></code><tr><td>140<td><code><pre> Driver: option.Driver,</pre></code><tr><td>141<td><code><pre> Dialect: option.Dialect,</pre></code><tr><td>142<td><code><pre> Timeout: option.Timeout,</pre></code><tr><td>143<td><code><pre> ReadTimeout: option.ReadTimeout,</pre></code><tr><td>144<td><code><pre> WriteTimeout: option.WriteTimeout,</pre></code><tr><td>145<td><code><pre> User: option.User,</pre></code><tr><td>146<td><code><pre> Password: option.Password,</pre></code><tr><td>147<td><code><pre> DBName: option.DB,</pre></code><tr><td>148<td><code><pre> DBCharset: "utf8mb4,utf8",</pre></code><tr><td>149<td><code><pre> DBHostname: option.Host,</pre></code><tr><td>150<td><code><pre> DBPort: fmt.Sprintf("%v", option.Port),</pre></code><tr><td>151<td><code><pre> Scheme: "tcp",</pre></code><tr><td>152<td><code><pre> }</pre></code><tr><td>153<td><code><pre></pre></code><tr><td>154<td><code><pre> if option.Driver != "" {</pre></code><tr><td>155<td><code><pre> parsed.Driver = option.Driver</pre></code><tr><td>156<td><code><pre> }</pre></code><tr><td>157<td><code><pre> if option.MaxIdleConns > 0 {</pre></code><tr><td>158<td><code><pre> parsed.MaxIdleConns = option.MaxIdleConns</pre></code><tr><td>159<td><code><pre> }</pre></code><tr><td>160<td><code><pre> if option.MaxOpenConns > 0 {</pre></code><tr><td>161<td><code><pre> parsed.MaxOpenConns = option.MaxOpenConns</pre></code><tr><td>162<td><code><pre> }</pre></code><tr><td>163<td><code><pre></pre></code><tr><td>164<td><code><pre> if utils.IsStrBlank(string(parsed.Dialect)) {</pre></code><tr><td>165<td><code><pre> parsed.Dialect = defaultDriverDialectMapping[parsed.Driver]</pre></code><tr><td>166<td><code><pre> }</pre></code><tr><td>167<td><code><pre></pre></code><tr><td>168<td><code><pre> return</pre></code><tr><td>169<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormDriver.genSqlServerDsn>func gormDriver.genSqlServerDsn</div><div class=info><a href=#s_fn_gormDriver.genSqlServerDsn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/gorm.go</code>:</div><table class=listing><tr><td>195<td><code><pre>func (g *gormDriver) genSqlServerDsn(opt *gormDriverOption) (dsn string) {</pre></code><tr><td>196<td><code><pre> const (</pre></code><tr><td>197<td><code><pre> dsnFormat = "sqlserver://%s:%s@%s:%s?database=%s&connection+timeout=%s"</pre></code><tr><td>198<td><code><pre> )</pre></code><tr><td>199<td><code><pre></pre></code><tr><td>200<td><code><pre> timeout := "5" // seconds</pre></code><tr><td>201<td><code><pre> if utils.IsStrNotBlank(opt.Timeout) {</pre></code><tr><td>202<td><code><pre> if duration, err := time.ParseDuration(opt.Timeout); err == nil {</pre></code><tr><td>203<td><code><pre> timeout = fmt.Sprintf("%v", int(duration/time.Second))</pre></code><tr><td>204<td><code><pre> }</pre></code><tr><td>205<td><code><pre> }</pre></code><tr><td>206<td><code><pre></pre></code><tr><td>207<td><code><pre> return fmt.Sprintf(dsnFormat, opt.User, opt.Password, opt.DBHostname, opt.DBPort, opt.DBName, timeout)</pre></code><tr><td>208<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormDriver.genPostgresDsn>func gormDriver.genPostgresDsn</div><div class=info><a href=#s_fn_gormDriver.genPostgresDsn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/gorm.go</code>:</div><table class=listing><tr><td>187<td><code><pre>func (g *gormDriver) genPostgresDsn(opt *gormDriverOption) (dsn string) {</pre></code><tr><td>188<td><code><pre> const (</pre></code><tr><td>189<td><code><pre> dsnFormat = "host=%s user=%s password=%s dbname=%s port=%s sslmode=disable TimeZone=Asia/Shanghai"</pre></code><tr><td>190<td><code><pre> )</pre></code><tr><td>191<td><code><pre></pre></code><tr><td>192<td><code><pre> return fmt.Sprintf(dsnFormat, opt.DBHostname, opt.User, opt.Password, opt.DBName, opt.DBPort)</pre></code><tr><td>193<td><code><pre>}</pre></code></table><div class=funcname id=fn_DB.GetProxy>func DB.GetProxy</div><div class=info><a href=#s_fn_DB.GetProxy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/interface.go</code>:</div><table class=listing><tr><td>44<td><code><pre>func (d *DB) GetProxy() *gorm.DB {</pre></code><tr><td>45<td><code><pre> return d.DB</pre></code><tr><td>46<td><code><pre>}</pre></code></table><div class=funcname id=fn_DB.WithContext>func DB.WithContext</div><div class=info><a href=#s_fn_DB.WithContext>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/interface.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func (d *DB) WithContext(ctx context.Context) *DB {</pre></code><tr><td>53<td><code><pre> return &DB{</pre></code><tr><td>54<td><code><pre> DB: d.DB.WithContext(ctx),</pre></code><tr><td>55<td><code><pre> dialector: d.dialector,</pre></code><tr><td>56<td><code><pre> }</pre></code><tr><td>57<td><code><pre>}</pre></code></table><div class=funcname id=fn_WithLogger>func WithLogger</div><div class=info><a href=#s_fn_WithLogger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/logger.go</code>:</div><table class=listing><tr><td>9<td><code><pre>func WithLogger(l logger.Interface) utils.OptionFunc[newOption] {</pre></code><tr><td>10<td><code><pre> return func(o *newOption) {</pre></code><tr><td>11<td><code><pre> o.logger = l</pre></code><tr><td>12<td><code><pre> }</pre></code><tr><td>13<td><code><pre>}</pre></code></table><div class=funcname id=fn_@10:9>func @10:9</div><div class=info><a href=#s_fn_@10:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/logger.go</code>:</div><table class=listing><tr><td>10<td><code><pre>func(o *newOption) {</pre></code><tr><td>11<td><code><pre> o.logger = l</pre></code><tr><td>12<td><code><pre> }</pre></code></table><div class=funcname id=fn_gormDriver.New>func gormDriver.New</div><div class=info><a href=#s_fn_gormDriver.New>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/gorm.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func (g *gormDriver) New(ctx context.Context, option Option, opts ...utils.OptionExtender) (db *DB, err error) {</pre></code><tr><td>44<td><code><pre> opt := g.parseDBOption(option)</pre></code><tr><td>45<td><code><pre> gormDB, dialector, err := g.open(opt.Driver, string(opt.Dialect), opt)</pre></code><tr><td>46<td><code><pre> if err != nil {</pre></code><tr class=miss><td>47<td><code><pre> return</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre></pre></code><tr><td>50<td><code><pre> sqlDB, err := gormDB.DB()</pre></code><tr><td>51<td><code><pre> if err != nil {</pre></code><tr class=miss><td>52<td><code><pre> return</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre></pre></code><tr><td>55<td><code><pre> // optional</pre></code><tr><td>56<td><code><pre> if opt.MaxOpenConns > 0 {</pre></code><tr><td>57<td><code><pre> sqlDB.SetMaxOpenConns(opt.MaxOpenConns)</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre> if opt.MaxIdleConns > 0 {</pre></code><tr><td>60<td><code><pre> sqlDB.SetMaxIdleConns(opt.MaxIdleConns)</pre></code><tr><td>61<td><code><pre> }</pre></code><tr><td>62<td><code><pre> if utils.IsStrNotBlank(option.ConnMaxLifeTime) {</pre></code><tr><td>63<td><code><pre> if liftTime, err := time.ParseDuration(option.ConnMaxLifeTime); err == nil {</pre></code><tr><td>64<td><code><pre> sqlDB.SetConnMaxLifetime(liftTime)</pre></code><tr><td>65<td><code><pre> }</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre> if utils.IsStrNotBlank(option.ConnMaxLifeTime) {</pre></code><tr><td>68<td><code><pre> if idleTime, err := time.ParseDuration(option.ConnMaxIdleTime); err == nil {</pre></code><tr><td>69<td><code><pre> sqlDB.SetConnMaxIdleTime(idleTime)</pre></code><tr><td>70<td><code><pre> }</pre></code><tr><td>71<td><code><pre> }</pre></code><tr><td>72<td><code><pre></pre></code><tr><td>73<td><code><pre> newOpt := utils.ApplyOptions[newOption](opts...)</pre></code><tr><td>74<td><code><pre> if newOpt.logger != nil {</pre></code><tr><td>75<td><code><pre> gormDB.Logger = newOpt.logger</pre></code><tr><td>76<td><code><pre> }</pre></code><tr><td>77<td><code><pre></pre></code><tr><td>78<td><code><pre> return &DB{DB: gormDB.WithContext(ctx), dialector: dialector}, nil</pre></code><tr><td>79<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormDriver.open>func gormDriver.open</div><div class=info><a href=#s_fn_gormDriver.open>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/gorm.go</code>:</div><table class=listing><tr><td>81<td><code><pre>func (g *gormDriver) open(driver driver, dialect string, opt *gormDriverOption) (</pre></code><tr><td>82<td><code><pre> db *gorm.DB, dialector gorm.Dialector, err error) {</pre></code><tr><td>83<td><code><pre> // alternative driver</pre></code><tr><td>84<td><code><pre> switch driver {</pre></code><tr><td>85<td><code><pre> case DriverMysql:</pre></code><tr><td>86<td><code><pre> dialector = mysql.New(mysql.Config{</pre></code><tr><td>87<td><code><pre> DriverName: dialect,</pre></code><tr><td>88<td><code><pre> DSN: g.genMySqlDsn(opt),</pre></code><tr><td>89<td><code><pre> })</pre></code><tr><td>90<td><code><pre></pre></code><tr><td>91<td><code><pre> case DriverPostgres:</pre></code><tr><td>92<td><code><pre> if dialect == string(DialectOpenGauss) {</pre></code><tr><td>93<td><code><pre> dialector = opengauss.New(opengauss.Config{</pre></code><tr><td>94<td><code><pre> DriverName: dialect,</pre></code><tr><td>95<td><code><pre> DSN: g.genPostgresDsn(opt),</pre></code><tr><td>96<td><code><pre> })</pre></code><tr><td>97<td><code><pre> } else {</pre></code><tr><td>98<td><code><pre> dialector = postgres.New(postgres.Config{</pre></code><tr><td>99<td><code><pre> DriverName: dialect,</pre></code><tr><td>100<td><code><pre> DSN: g.genPostgresDsn(opt),</pre></code><tr><td>101<td><code><pre> })</pre></code><tr><td>102<td><code><pre> }</pre></code><tr><td>103<td><code><pre></pre></code><tr><td>104<td><code><pre> // sqlite dsn is filepath</pre></code><tr><td>105<td><code><pre> // or file::memory:?cache=shared is also available, see also https://www.sqlite.org/inmemorydb.html</pre></code><tr><td>106<td><code><pre> case DriverSqlite:</pre></code><tr><td>107<td><code><pre> dialector = sqlite.Open(path.Join(env.WorkDir, path.Clean(opt.DBName)))</pre></code><tr><td>108<td><code><pre></pre></code><tr><td>109<td><code><pre> case DriverSqlserver:</pre></code><tr><td>110<td><code><pre> dialector = sqlserver.New(sqlserver.Config{</pre></code><tr><td>111<td><code><pre> DriverName: dialect,</pre></code><tr><td>112<td><code><pre> DSN: g.genSqlServerDsn(opt),</pre></code><tr><td>113<td><code><pre> })</pre></code><tr><td>114<td><code><pre></pre></code><tr><td>115<td><code><pre> // tidb is compatible with mysql protocol</pre></code><tr><td>116<td><code><pre> case DriverTiDB:</pre></code><tr class=miss><td>117<td><code><pre> dialector = mysql.New(mysql.Config{</pre></code><tr><td>118<td><code><pre> DriverName: dialect,</pre></code><tr><td>119<td><code><pre> DSN: g.genMySqlDsn(opt),</pre></code><tr><td>120<td><code><pre> })</pre></code><tr><td>121<td><code><pre></pre></code><tr><td>122<td><code><pre> case DriverClickhouse:</pre></code><tr class=miss><td>123<td><code><pre> dialector = clickhouse.New(clickhouse.Config{</pre></code><tr><td>124<td><code><pre> DriverName: dialect,</pre></code><tr><td>125<td><code><pre> DSN: g.genClickhouseDsn(opt),</pre></code><tr><td>126<td><code><pre> })</pre></code><tr><td>127<td><code><pre></pre></code><tr><td>128<td><code><pre> default:</pre></code><tr class=miss><td>129<td><code><pre> panic(errors.Errorf("unknown db driver or dialect: %s %s", driver, dialect))</pre></code><tr><td>130<td><code><pre> }</pre></code><tr><td>131<td><code><pre></pre></code><tr><td>132<td><code><pre> db, err = gorm.Open(dialector, &gorm.Config{</pre></code><tr><td>133<td><code><pre> DisableForeignKeyConstraintWhenMigrating: true,</pre></code><tr><td>134<td><code><pre> })</pre></code><tr><td>135<td><code><pre> return</pre></code><tr><td>136<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormDriver.genMySqlDsn>func gormDriver.genMySqlDsn</div><div class=info><a href=#s_fn_gormDriver.genMySqlDsn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/gorm.go</code>:</div><table class=listing><tr><td>171<td><code><pre>func (g *gormDriver) genMySqlDsn(opt *gormDriverOption) (dsn string) {</pre></code><tr><td>172<td><code><pre> if opt.DBCharset == "" {</pre></code><tr class=miss><td>173<td><code><pre> opt.DBCharset = "utf8"</pre></code><tr><td>174<td><code><pre> }</pre></code><tr><td>175<td><code><pre> if opt.Scheme == "" {</pre></code><tr class=miss><td>176<td><code><pre> opt.Scheme = "tcp"</pre></code><tr><td>177<td><code><pre> }</pre></code><tr><td>178<td><code><pre></pre></code><tr><td>179<td><code><pre> const (</pre></code><tr><td>180<td><code><pre> dsnFormat = "%s:%s@%s(%s:%s)/%s?charset=%s&parseTime=True&loc=Local&timeout=%s&readTimeout=%s&writeTimeout=%s"</pre></code><tr><td>181<td><code><pre> )</pre></code><tr><td>182<td><code><pre></pre></code><tr><td>183<td><code><pre> return fmt.Sprintf(dsnFormat, opt.User, opt.Password, opt.Scheme, opt.DBHostname, opt.DBPort, opt.DBName,</pre></code><tr><td>184<td><code><pre> opt.DBCharset, opt.Timeout, opt.ReadTimeout, opt.WriteTimeout)</pre></code><tr><td>185<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormDriver.genClickhouseDsn>func gormDriver.genClickhouseDsn</div><div class=info><a href=#s_fn_gormDriver.genClickhouseDsn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/gorm.go</code>:</div><table class=listing><tr><td>210<td><code><pre>func (g *gormDriver) genClickhouseDsn(opt *gormDriverOption) (dsn string) {</pre></code><tr class=miss><td>211<td><code><pre> const (</pre></code><tr><td>212<td><code><pre> dsnFormat = "tcp://%s:%s?database=%s&username=%s&password=%s&read_timeout=%s&write_timeout=%s"</pre></code><tr><td>213<td><code><pre> )</pre></code><tr><td>214<td><code><pre></pre></code><tr class=miss><td>215<td><code><pre> readTimeout := "2" // seconds</pre></code><tr class=miss><td>216<td><code><pre> if utils.IsStrNotBlank(opt.ReadTimeout) {</pre></code><tr class=miss><td>217<td><code><pre> if duration, err := time.ParseDuration(opt.ReadTimeout); err == nil {</pre></code><tr class=miss><td>218<td><code><pre> readTimeout = fmt.Sprintf("%v", int(duration/time.Second))</pre></code><tr><td>219<td><code><pre> }</pre></code><tr><td>220<td><code><pre> }</pre></code><tr class=miss><td>221<td><code><pre> writeTimeout := "2" // seconds</pre></code><tr class=miss><td>222<td><code><pre> if utils.IsStrNotBlank(opt.ReadTimeout) {</pre></code><tr class=miss><td>223<td><code><pre> if duration, err := time.ParseDuration(opt.WriteTimeout); err == nil {</pre></code><tr class=miss><td>224<td><code><pre> writeTimeout = fmt.Sprintf("%v", int(duration/time.Second))</pre></code><tr><td>225<td><code><pre> }</pre></code><tr><td>226<td><code><pre> }</pre></code><tr><td>227<td><code><pre></pre></code><tr class=miss><td>228<td><code><pre> return fmt.Sprintf(dsnFormat, opt.DBHostname, opt.DBPort, opt.DBName, opt.User, opt.Password,</pre></code><tr><td>229<td><code><pre> readTimeout, writeTimeout)</pre></code><tr><td>230<td><code><pre>}</pre></code></table><div class=funcname id=fn_DB.GetDialector>func DB.GetDialector</div><div class=info><a href=#s_fn_DB.GetDialector>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/interface.go</code>:</div><table class=listing><tr><td>48<td><code><pre>func (d *DB) GetDialector() gorm.Dialector {</pre></code><tr class=miss><td>49<td><code><pre> return d.dialector</pre></code><tr><td>50<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/common/infra/drivers/orm/idgen class=funcname>Package Overview: github.com/wfusion/gofusion/common/infra/drivers/orm/idgen 10 <span class=packageTotal>87.5%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_NewSnowflake><td><code><a href=#fn_NewSnowflake>NewSnowflake(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/idgen/snowflake.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_GormTx><td><code><a href=#fn_GormTx>GormTx(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/idgen/interface.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_snowflake.Next><td><code><a href=#fn_snowflake.Next>snowflake.Next(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/idgen/snowflake.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@36:15><td><code><a href=#fn_@36:15>@36:15(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/idgen/snowflake.go</code><td class=percent><code>93.3%</code><td class=linecount><code>14/15</code><tr id=s_fn_@32:19><td><code><a href=#fn_@32:19>@32:19(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/idgen/snowflake.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_@26:9><td><code><a href=#fn_@26:9>@26:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/orm/idgen/interface.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_NewSnowflake>func NewSnowflake</div><div class=info><a href=#s_fn_NewSnowflake>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/idgen/snowflake.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func NewSnowflake() Generator {</pre></code><tr><td>32<td><code><pre> snowflakeOnce.Do(func() {</pre></code><tr><td>33<td><code><pre> flake := sonyflake.NewSonyflake(sonyflake.Settings{</pre></code><tr><td>34<td><code><pre> StartTime: time.Time{},</pre></code><tr><td>35<td><code><pre> // machine id: hash(host ip + local ip + pid)(8 bit) - local ip(8 bit)</pre></code><tr><td>36<td><code><pre> MachineID: func() (id uint16, err error) {</pre></code><tr><td>37<td><code><pre> pid := os.Getpid()</pre></code><tr><td>38<td><code><pre> hostIP := utils.HostIPInDocker()</pre></code><tr><td>39<td><code><pre> localIP := utils.ClientIP()</pre></code><tr><td>40<td><code><pre> log.Printf("[Common] snowflake get machine id base [host[%s] local[%s] pid[%v]]", hostIP, localIP, pid)</pre></code><tr><td>41<td><code><pre> if hostIP == "" {</pre></code><tr><td>42<td><code><pre> hostIP = utils.ClientIP()</pre></code><tr><td>43<td><code><pre> }</pre></code><tr><td>44<td><code><pre> hash := fnv.New32a()</pre></code><tr><td>45<td><code><pre> _, err = hash.Write([]byte(fmt.Sprintf("%s%s%v", hostIP, localIP, pid)))</pre></code><tr><td>46<td><code><pre> if err != nil {</pre></code><tr><td>47<td><code><pre> return</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre></pre></code><tr><td>50<td><code><pre> high := byte(hash.Sum32() % 255)</pre></code><tr><td>51<td><code><pre> low := net.ParseIP(localIP).To4()[3]</pre></code><tr><td>52<td><code><pre> id = uint16(high)<<8 | uint16(low)</pre></code><tr><td>53<td><code><pre> log.Printf("[Common] snowflake get machine id [%X]", id)</pre></code><tr><td>54<td><code><pre> return</pre></code><tr><td>55<td><code><pre> },</pre></code><tr><td>56<td><code><pre> CheckMachineID: nil,</pre></code><tr><td>57<td><code><pre> })</pre></code><tr><td>58<td><code><pre> if flake == nil {</pre></code><tr><td>59<td><code><pre> panic(ErrNewGenerator)</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre> snowflakeInstance = &snowflake{instance: flake}</pre></code><tr><td>62<td><code><pre> })</pre></code><tr><td>63<td><code><pre></pre></code><tr><td>64<td><code><pre> return snowflakeInstance</pre></code><tr><td>65<td><code><pre>}</pre></code></table><div class=funcname id=fn_GormTx>func GormTx</div><div class=info><a href=#s_fn_GormTx>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/idgen/interface.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func GormTx(tx *gorm.DB) utils.OptionFunc[option] {</pre></code><tr><td>26<td><code><pre> return func(o *option) {</pre></code><tr><td>27<td><code><pre> o.tx = tx</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre>}</pre></code></table><div class=funcname id=fn_snowflake.Next>func snowflake.Next</div><div class=info><a href=#s_fn_snowflake.Next>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/idgen/snowflake.go</code>:</div><table class=listing><tr><td>67<td><code><pre>func (s *snowflake) Next(opts ...utils.OptionExtender) (id uint64, err error) {</pre></code><tr><td>68<td><code><pre> return s.instance.NextID()</pre></code><tr><td>69<td><code><pre>}</pre></code></table><div class=funcname id=fn_@36:15>func @36:15</div><div class=info><a href=#s_fn_@36:15>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/idgen/snowflake.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func() (id uint16, err error) {</pre></code><tr><td>37<td><code><pre> pid := os.Getpid()</pre></code><tr><td>38<td><code><pre> hostIP := utils.HostIPInDocker()</pre></code><tr><td>39<td><code><pre> localIP := utils.ClientIP()</pre></code><tr><td>40<td><code><pre> log.Printf("[Common] snowflake get machine id base [host[%s] local[%s] pid[%v]]", hostIP, localIP, pid)</pre></code><tr><td>41<td><code><pre> if hostIP == "" {</pre></code><tr><td>42<td><code><pre> hostIP = utils.ClientIP()</pre></code><tr><td>43<td><code><pre> }</pre></code><tr><td>44<td><code><pre> hash := fnv.New32a()</pre></code><tr><td>45<td><code><pre> _, err = hash.Write([]byte(fmt.Sprintf("%s%s%v", hostIP, localIP, pid)))</pre></code><tr><td>46<td><code><pre> if err != nil {</pre></code><tr class=miss><td>47<td><code><pre> return</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre></pre></code><tr><td>50<td><code><pre> high := byte(hash.Sum32() % 255)</pre></code><tr><td>51<td><code><pre> low := net.ParseIP(localIP).To4()[3]</pre></code><tr><td>52<td><code><pre> id = uint16(high)<<8 | uint16(low)</pre></code><tr><td>53<td><code><pre> log.Printf("[Common] snowflake get machine id [%X]", id)</pre></code><tr><td>54<td><code><pre> return</pre></code><tr><td>55<td><code><pre> }</pre></code></table><div class=funcname id=fn_@32:19>func @32:19</div><div class=info><a href=#s_fn_@32:19>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/idgen/snowflake.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func() {</pre></code><tr><td>33<td><code><pre> flake := sonyflake.NewSonyflake(sonyflake.Settings{</pre></code><tr><td>34<td><code><pre> StartTime: time.Time{},</pre></code><tr><td>35<td><code><pre> // machine id: hash(host ip + local ip + pid)(8 bit) - local ip(8 bit)</pre></code><tr><td>36<td><code><pre> MachineID: func() (id uint16, err error) {</pre></code><tr><td>37<td><code><pre> pid := os.Getpid()</pre></code><tr><td>38<td><code><pre> hostIP := utils.HostIPInDocker()</pre></code><tr><td>39<td><code><pre> localIP := utils.ClientIP()</pre></code><tr><td>40<td><code><pre> log.Printf("[Common] snowflake get machine id base [host[%s] local[%s] pid[%v]]", hostIP, localIP, pid)</pre></code><tr><td>41<td><code><pre> if hostIP == "" {</pre></code><tr><td>42<td><code><pre> hostIP = utils.ClientIP()</pre></code><tr><td>43<td><code><pre> }</pre></code><tr><td>44<td><code><pre> hash := fnv.New32a()</pre></code><tr><td>45<td><code><pre> _, err = hash.Write([]byte(fmt.Sprintf("%s%s%v", hostIP, localIP, pid)))</pre></code><tr><td>46<td><code><pre> if err != nil {</pre></code><tr><td>47<td><code><pre> return</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre></pre></code><tr><td>50<td><code><pre> high := byte(hash.Sum32() % 255)</pre></code><tr><td>51<td><code><pre> low := net.ParseIP(localIP).To4()[3]</pre></code><tr><td>52<td><code><pre> id = uint16(high)<<8 | uint16(low)</pre></code><tr><td>53<td><code><pre> log.Printf("[Common] snowflake get machine id [%X]", id)</pre></code><tr><td>54<td><code><pre> return</pre></code><tr><td>55<td><code><pre> },</pre></code><tr><td>56<td><code><pre> CheckMachineID: nil,</pre></code><tr><td>57<td><code><pre> })</pre></code><tr><td>58<td><code><pre> if flake == nil {</pre></code><tr class=miss><td>59<td><code><pre> panic(ErrNewGenerator)</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre> snowflakeInstance = &snowflake{instance: flake}</pre></code><tr><td>62<td><code><pre> }</pre></code></table><div class=funcname id=fn_@26:9>func @26:9</div><div class=info><a href=#s_fn_@26:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/orm/idgen/interface.go</code>:</div><table class=listing><tr><td>26<td><code><pre>func(o *option) {</pre></code><tr class=miss><td>27<td><code><pre> o.tx = tx</pre></code><tr><td>28<td><code><pre> }</pre></code></table><div id=pkg_github.com/wfusion/gofusion/common/infra/drivers/redis class=funcname>Package Overview: github.com/wfusion/gofusion/common/infra/drivers/redis 11 <span class=packageTotal>47.1%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_@47:44><td><code><a href=#fn_@47:44>@47:44(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@10:9><td><code><a href=#fn_@10:9>@10:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/hook.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Redis.GetProxy><td><code><a href=#fn_Redis.GetProxy>Redis.GetProxy(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/interface.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@48:45><td><code><a href=#fn_@48:45>@48:45(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_WithHook><td><code><a href=#fn_WithHook>WithHook(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/hook.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@49:48><td><code><a href=#fn_@49:48>@49:48(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_defaultDialect.parseOption><td><code><a href=#fn_defaultDialect.parseOption>defaultDialect.parseOption(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@46:44><td><code><a href=#fn_@46:44>@46:44(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@52:48><td><code><a href=#fn_@52:48>@52:48(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@51:48><td><code><a href=#fn_@51:48>@51:48(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@50:48><td><code><a href=#fn_@50:48>@50:48(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_defaultDialect.wrapDurationSetter><td><code><a href=#fn_defaultDialect.wrapDurationSetter>defaultDialect.wrapDurationSetter(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_defaultDialect.New><td><code><a href=#fn_defaultDialect.New>defaultDialect.New(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>48.5%</code><td class=linecount><code>16/33</code><tr id=s_fn_Redis.PoolStatus><td><code><a href=#fn_Redis.PoolStatus>Redis.PoolStatus(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/interface.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_Redis.Close><td><code><a href=#fn_Redis.Close>Redis.Close(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/interface.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_@26:48><td><code><a href=#fn_@26:48>@26:48(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@45:44><td><code><a href=#fn_@45:44>@45:44(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@27:48><td><code><a href=#fn_@27:48>@27:48(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@25:48><td><code><a href=#fn_@25:48>@25:48(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@24:48><td><code><a href=#fn_@24:48>@24:48(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@23:45><td><code><a href=#fn_@23:45>@23:45(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@22:44><td><code><a href=#fn_@22:44>@22:44(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@21:44><td><code><a href=#fn_@21:44>@21:44(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@20:44><td><code><a href=#fn_@20:44>@20:44(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_defaultDialect.parseClusterOption><td><code><a href=#fn_defaultDialect.parseClusterOption>defaultDialect.parseClusterOption(...)</a></code><td><code>github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_@47:44>func @47:44</div><div class=info><a href=#s_fn_@47:44>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr><td>47<td><code><pre>func(du time.Duration) { opt.ReadTimeout = du }</pre></code></table><div class=funcname id=fn_@10:9>func @10:9</div><div class=info><a href=#s_fn_@10:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/hook.go</code>:</div><table class=listing><tr><td>10<td><code><pre>func(o *newOption) {</pre></code><tr><td>11<td><code><pre> o.hooks = append(o.hooks, hooks...)</pre></code><tr><td>12<td><code><pre> }</pre></code></table><div class=funcname id=fn_Redis.GetProxy>func Redis.GetProxy</div><div class=info><a href=#s_fn_Redis.GetProxy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/interface.go</code>:</div><table class=listing><tr><td>86<td><code><pre>func (r *Redis) GetProxy() redis.UniversalClient {</pre></code><tr><td>87<td><code><pre> return r.redis</pre></code><tr><td>88<td><code><pre>}</pre></code></table><div class=funcname id=fn_@48:45>func @48:45</div><div class=info><a href=#s_fn_@48:45>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr><td>48<td><code><pre>func(du time.Duration) { opt.WriteTimeout = du }</pre></code></table><div class=funcname id=fn_WithHook>func WithHook</div><div class=info><a href=#s_fn_WithHook>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/hook.go</code>:</div><table class=listing><tr><td>9<td><code><pre>func WithHook(hooks []redis.Hook) utils.OptionFunc[newOption] {</pre></code><tr><td>10<td><code><pre> return func(o *newOption) {</pre></code><tr><td>11<td><code><pre> o.hooks = append(o.hooks, hooks...)</pre></code><tr><td>12<td><code><pre> }</pre></code><tr><td>13<td><code><pre>}</pre></code></table><div class=funcname id=fn_@49:48>func @49:48</div><div class=info><a href=#s_fn_@49:48>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func(du time.Duration) { opt.ConnMaxIdleTime = du }</pre></code></table><div class=funcname id=fn_defaultDialect.parseOption>func defaultDialect.parseOption</div><div class=info><a href=#s_fn_defaultDialect.parseOption>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr><td>81<td><code><pre>func (d *defaultDialect) parseOption(option Option) (cfg *redis.Options) {</pre></code><tr><td>82<td><code><pre> return &redis.Options{</pre></code><tr><td>83<td><code><pre> Addr: option.Endpoints[0],</pre></code><tr><td>84<td><code><pre> Username: option.User,</pre></code><tr><td>85<td><code><pre> Password: option.Password,</pre></code><tr><td>86<td><code><pre> MaxRetries: option.MaxRetries,</pre></code><tr><td>87<td><code><pre> MinIdleConns: option.MinIdleConns,</pre></code><tr><td>88<td><code><pre> MaxIdleConns: option.MaxIdleConns,</pre></code><tr><td>89<td><code><pre> PoolSize: option.PoolSize,</pre></code><tr><td>90<td><code><pre> }</pre></code><tr><td>91<td><code><pre>}</pre></code></table><div class=funcname id=fn_@46:44>func @46:44</div><div class=info><a href=#s_fn_@46:44>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr><td>46<td><code><pre>func(du time.Duration) { opt.DialTimeout = du }</pre></code></table><div class=funcname id=fn_@52:48>func @52:48</div><div class=info><a href=#s_fn_@52:48>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func(du time.Duration) { opt.MaxRetryBackoff = du }</pre></code></table><div class=funcname id=fn_@51:48>func @51:48</div><div class=info><a href=#s_fn_@51:48>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr><td>51<td><code><pre>func(du time.Duration) { opt.MinRetryBackoff = du }</pre></code></table><div class=funcname id=fn_@50:48>func @50:48</div><div class=info><a href=#s_fn_@50:48>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr><td>50<td><code><pre>func(du time.Duration) { opt.ConnMaxLifetime = du }</pre></code></table><div class=funcname id=fn_defaultDialect.wrapDurationSetter>func defaultDialect.wrapDurationSetter</div><div class=info><a href=#s_fn_defaultDialect.wrapDurationSetter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr><td>70<td><code><pre>func (d *defaultDialect) wrapDurationSetter(s string, setter func(du time.Duration)) {</pre></code><tr><td>71<td><code><pre> if utils.IsStrBlank(s) {</pre></code><tr><td>72<td><code><pre> return</pre></code><tr><td>73<td><code><pre> }</pre></code><tr><td>74<td><code><pre> duration, err := time.ParseDuration(s)</pre></code><tr><td>75<td><code><pre> if err != nil {</pre></code><tr class=miss><td>76<td><code><pre> panic(err)</pre></code><tr><td>77<td><code><pre> }</pre></code><tr><td>78<td><code><pre> setter(duration)</pre></code><tr><td>79<td><code><pre>}</pre></code></table><div class=funcname id=fn_defaultDialect.New>func defaultDialect.New</div><div class=info><a href=#s_fn_defaultDialect.New>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func (d *defaultDialect) New(ctx context.Context, option Option, opts ...utils.OptionExtender) (</pre></code><tr><td>17<td><code><pre> r *Redis, err error) {</pre></code><tr><td>18<td><code><pre> if option.Cluster {</pre></code><tr class=miss><td>19<td><code><pre> opt := d.parseClusterOption(option)</pre></code><tr class=miss><td>20<td><code><pre> d.wrapDurationSetter(option.PoolTimeout, func(du time.Duration) { opt.PoolTimeout = du })</pre></code><tr class=miss><td>21<td><code><pre> d.wrapDurationSetter(option.DialTimeout, func(du time.Duration) { opt.DialTimeout = du })</pre></code><tr class=miss><td>22<td><code><pre> d.wrapDurationSetter(option.ReadTimeout, func(du time.Duration) { opt.ReadTimeout = du })</pre></code><tr class=miss><td>23<td><code><pre> d.wrapDurationSetter(option.WriteTimeout, func(du time.Duration) { opt.WriteTimeout = du })</pre></code><tr class=miss><td>24<td><code><pre> d.wrapDurationSetter(option.ConnMaxIdleTime, func(du time.Duration) { opt.ConnMaxIdleTime = du })</pre></code><tr class=miss><td>25<td><code><pre> d.wrapDurationSetter(option.ConnMaxLifetime, func(du time.Duration) { opt.ConnMaxLifetime = du })</pre></code><tr class=miss><td>26<td><code><pre> d.wrapDurationSetter(option.MinRetryBackoff, func(du time.Duration) { opt.MinRetryBackoff = du })</pre></code><tr class=miss><td>27<td><code><pre> d.wrapDurationSetter(option.MaxRetryBackoff, func(du time.Duration) { opt.MaxRetryBackoff = du })</pre></code><tr><td>28<td><code><pre></pre></code><tr class=miss><td>29<td><code><pre> rdsCli := redis.NewClusterClient(opt)</pre></code><tr><td>30<td><code><pre></pre></code><tr><td>31<td><code><pre> // authentication check</pre></code><tr class=miss><td>32<td><code><pre> if err = rdsCli.Ping(context.Background()).Err(); err != nil {</pre></code><tr class=miss><td>33<td><code><pre> return</pre></code><tr><td>34<td><code><pre> }</pre></code><tr><td>35<td><code><pre></pre></code><tr class=miss><td>36<td><code><pre> newOpt := utils.ApplyOptions[newOption](opts...)</pre></code><tr class=miss><td>37<td><code><pre> for _, hook := range newOpt.hooks {</pre></code><tr class=miss><td>38<td><code><pre> rdsCli.AddHook(hook)</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre></pre></code><tr class=miss><td>41<td><code><pre> return &Redis{redis: rdsCli}, nil</pre></code><tr><td>42<td><code><pre></pre></code><tr><td>43<td><code><pre> } else {</pre></code><tr><td>44<td><code><pre> opt := d.parseOption(option)</pre></code><tr><td>45<td><code><pre> d.wrapDurationSetter(option.PoolTimeout, func(du time.Duration) { opt.PoolTimeout = du })</pre></code><tr><td>46<td><code><pre> d.wrapDurationSetter(option.DialTimeout, func(du time.Duration) { opt.DialTimeout = du })</pre></code><tr><td>47<td><code><pre> d.wrapDurationSetter(option.ReadTimeout, func(du time.Duration) { opt.ReadTimeout = du })</pre></code><tr><td>48<td><code><pre> d.wrapDurationSetter(option.WriteTimeout, func(du time.Duration) { opt.WriteTimeout = du })</pre></code><tr><td>49<td><code><pre> d.wrapDurationSetter(option.ConnMaxIdleTime, func(du time.Duration) { opt.ConnMaxIdleTime = du })</pre></code><tr><td>50<td><code><pre> d.wrapDurationSetter(option.ConnMaxLifetime, func(du time.Duration) { opt.ConnMaxLifetime = du })</pre></code><tr><td>51<td><code><pre> d.wrapDurationSetter(option.MinRetryBackoff, func(du time.Duration) { opt.MinRetryBackoff = du })</pre></code><tr><td>52<td><code><pre> d.wrapDurationSetter(option.MaxRetryBackoff, func(du time.Duration) { opt.MaxRetryBackoff = du })</pre></code><tr><td>53<td><code><pre></pre></code><tr><td>54<td><code><pre> rdsCli := redis.NewClient(opt)</pre></code><tr><td>55<td><code><pre></pre></code><tr><td>56<td><code><pre> // authentication check</pre></code><tr><td>57<td><code><pre> if err = rdsCli.Ping(context.Background()).Err(); err != nil {</pre></code><tr class=miss><td>58<td><code><pre> return</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre></pre></code><tr><td>61<td><code><pre> newOpt := utils.ApplyOptions[newOption](opts...)</pre></code><tr><td>62<td><code><pre> for _, hook := range newOpt.hooks {</pre></code><tr><td>63<td><code><pre> rdsCli.AddHook(hook)</pre></code><tr><td>64<td><code><pre> }</pre></code><tr><td>65<td><code><pre></pre></code><tr><td>66<td><code><pre> return &Redis{redis: rdsCli}, nil</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre>}</pre></code></table><div class=funcname id=fn_Redis.PoolStatus>func Redis.PoolStatus</div><div class=info><a href=#s_fn_Redis.PoolStatus>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/interface.go</code>:</div><table class=listing><tr><td>101<td><code><pre>func (r *Redis) PoolStatus() *redis.PoolStats {</pre></code><tr class=miss><td>102<td><code><pre> switch rdsCli := r.redis.(type) {</pre></code><tr><td>103<td><code><pre> case *redis.ClusterClient:</pre></code><tr class=miss><td>104<td><code><pre> return rdsCli.PoolStats()</pre></code><tr><td>105<td><code><pre> case *redis.Client:</pre></code><tr class=miss><td>106<td><code><pre> return rdsCli.PoolStats()</pre></code><tr><td>107<td><code><pre> default:</pre></code><tr class=miss><td>108<td><code><pre> return new(redis.PoolStats)</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre>}</pre></code></table><div class=funcname id=fn_Redis.Close>func Redis.Close</div><div class=info><a href=#s_fn_Redis.Close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/interface.go</code>:</div><table class=listing><tr><td>90<td><code><pre>func (r *Redis) Close() error {</pre></code><tr class=miss><td>91<td><code><pre> switch rdsCli := r.redis.(type) {</pre></code><tr><td>92<td><code><pre> case *redis.ClusterClient:</pre></code><tr class=miss><td>93<td><code><pre> return rdsCli.Close()</pre></code><tr><td>94<td><code><pre> case *redis.Client:</pre></code><tr class=miss><td>95<td><code><pre> return rdsCli.Close()</pre></code><tr><td>96<td><code><pre> default:</pre></code><tr class=miss><td>97<td><code><pre> return nil</pre></code><tr><td>98<td><code><pre> }</pre></code><tr><td>99<td><code><pre>}</pre></code></table><div class=funcname id=fn_@26:48>func @26:48</div><div class=info><a href=#s_fn_@26:48>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr class=miss><td>26<td><code><pre>func(du time.Duration) { opt.MinRetryBackoff = du }</pre></code></table><div class=funcname id=fn_@45:44>func @45:44</div><div class=info><a href=#s_fn_@45:44>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr class=miss><td>45<td><code><pre>func(du time.Duration) { opt.PoolTimeout = du }</pre></code></table><div class=funcname id=fn_@27:48>func @27:48</div><div class=info><a href=#s_fn_@27:48>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr class=miss><td>27<td><code><pre>func(du time.Duration) { opt.MaxRetryBackoff = du }</pre></code></table><div class=funcname id=fn_@25:48>func @25:48</div><div class=info><a href=#s_fn_@25:48>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr class=miss><td>25<td><code><pre>func(du time.Duration) { opt.ConnMaxLifetime = du }</pre></code></table><div class=funcname id=fn_@24:48>func @24:48</div><div class=info><a href=#s_fn_@24:48>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr class=miss><td>24<td><code><pre>func(du time.Duration) { opt.ConnMaxIdleTime = du }</pre></code></table><div class=funcname id=fn_@23:45>func @23:45</div><div class=info><a href=#s_fn_@23:45>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr class=miss><td>23<td><code><pre>func(du time.Duration) { opt.WriteTimeout = du }</pre></code></table><div class=funcname id=fn_@22:44>func @22:44</div><div class=info><a href=#s_fn_@22:44>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr class=miss><td>22<td><code><pre>func(du time.Duration) { opt.ReadTimeout = du }</pre></code></table><div class=funcname id=fn_@21:44>func @21:44</div><div class=info><a href=#s_fn_@21:44>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr class=miss><td>21<td><code><pre>func(du time.Duration) { opt.DialTimeout = du }</pre></code></table><div class=funcname id=fn_@20:44>func @20:44</div><div class=info><a href=#s_fn_@20:44>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr class=miss><td>20<td><code><pre>func(du time.Duration) { opt.PoolTimeout = du }</pre></code></table><div class=funcname id=fn_defaultDialect.parseClusterOption>func defaultDialect.parseClusterOption</div><div class=info><a href=#s_fn_defaultDialect.parseClusterOption>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/infra/drivers/redis/redis.go</code>:</div><table class=listing><tr><td>93<td><code><pre>func (d *defaultDialect) parseClusterOption(option Option) (cfg *redis.ClusterOptions) {</pre></code><tr class=miss><td>94<td><code><pre> return &redis.ClusterOptions{</pre></code><tr><td>95<td><code><pre> Addrs: option.Endpoints,</pre></code><tr><td>96<td><code><pre> Username: option.User,</pre></code><tr><td>97<td><code><pre> Password: option.Password,</pre></code><tr><td>98<td><code><pre> MaxRetries: option.MaxRetries,</pre></code><tr><td>99<td><code><pre> MinIdleConns: option.MinIdleConns,</pre></code><tr><td>100<td><code><pre> MaxIdleConns: option.MaxIdleConns,</pre></code><tr><td>101<td><code><pre> PoolSize: option.PoolSize,</pre></code><tr><td>102<td><code><pre> }</pre></code><tr><td>103<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/common/utils class=funcname>Package Overview: github.com/wfusion/gofusion/common/utils 12 <span class=packageTotal>54.7%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_NginxID><td><code><a href=#fn_NginxID>NginxID(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>100.0%</code><td class=linecount><code>22/22</code><tr id=s_fn_GetCaller><td><code><a href=#fn_GetCaller>GetCaller(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>100.0%</code><td class=linecount><code>14/14</code><tr id=s_fn_.init><td><code><a href=#fn_.init>.init(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>12/12</code><tr id=s_fn_FuzzyKeyword><td><code><a href=#fn_FuzzyKeyword>FuzzyKeyword(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/string.go</code><td class=percent><code>100.0%</code><td class=linecount><code>10/10</code><tr id=s_fn_@117:9><td><code><a href=#fn_@117:9>@117:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/time.go</code><td class=percent><code>100.0%</code><td class=linecount><code>9/9</code><tr id=s_fn_Set[T].Items><td><code><a href=#fn_Set[T].Items>Set[T].Items(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sets.go</code><td class=percent><code>100.0%</code><td class=linecount><code>8/8</code><tr id=s_fn_TravelCtx><td><code><a href=#fn_TravelCtx>TravelCtx(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/context.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_MapMerge><td><code><a href=#fn_MapMerge>MapMerge(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/map.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_IsChannelClosed><td><code><a href=#fn_IsChannelClosed>IsChannelClosed(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/channel.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_SliceMapping><td><code><a href=#fn_SliceMapping>SliceMapping(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/conv.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_RandomLetterAndNumber><td><code><a href=#fn_RandomLetterAndNumber>RandomLetterAndNumber(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_@61:14><td><code><a href=#fn_@61:14>@61:14(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/ip.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_@133:14><td><code><a href=#fn_@133:14>@133:14(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_poolBytes.Reset><td><code><a href=#fn_poolBytes.Reset>poolBytes.Reset(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_ApplyOptions><td><code><a href=#fn_ApplyOptions>ApplyOptions(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/options.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_Set[T].Insert><td><code><a href=#fn_Set[T].Insert>Set[T].Insert(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sets.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_GetCtxAny><td><code><a href=#fn_GetCtxAny>GetCtxAny(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/context.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_Set[T].Remove><td><code><a href=#fn_Set[T].Remove>Set[T].Remove(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sets.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_LookupByFuzzyKeyword><td><code><a href=#fn_LookupByFuzzyKeyword>LookupByFuzzyKeyword(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_SliceToMap><td><code><a href=#fn_SliceToMap>SliceToMap(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/map.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_Set[T].Contains><td><code><a href=#fn_Set[T].Contains>Set[T].Contains(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sets.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_@45:9><td><code><a href=#fn_@45:9>@45:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_ParseTag><td><code><a href=#fn_ParseTag>ParseTag(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/tag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_@126:11><td><code><a href=#fn_@126:11>@126:11(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_ErrIgnore><td><code><a href=#fn_ErrIgnore>ErrIgnore(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_NewSet><td><code><a href=#fn_NewSet>NewSet(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sets.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_Random><td><code><a href=#fn_Random>Random(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_.Enum><td><code><a href=#fn_.Enum>.Enum(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_IfAny><td><code><a href=#fn_IfAny>IfAny(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@159:5><td><code><a href=#fn_@159:5>@159:5(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/time.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_SliceReverse><td><code><a href=#fn_SliceReverse>SliceReverse(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/slice.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_GetGormColumnValue><td><code><a href=#fn_GetGormColumnValue>GetGormColumnValue(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/reflect.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@89:11><td><code><a href=#fn_@89:11>@89:11(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@182:9><td><code><a href=#fn_@182:9>@182:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@190:9><td><code><a href=#fn_@190:9>@190:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_.IsValid><td><code><a href=#fn_.IsValid>.IsValid(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_MustJsonUnmarshal><td><code><a href=#fn_MustJsonUnmarshal>MustJsonUnmarshal(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/marshal.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_NewPool><td><code><a href=#fn_NewPool>NewPool(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_OptionFunc[T].applyOption><td><code><a href=#fn_OptionFunc[T].applyOption>OptionFunc[T].applyOption(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/options.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@176:3><td><code><a href=#fn_@176:3>@176:3(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@34:9><td><code><a href=#fn_@34:9>@34:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_WrapFunc2><td><code><a href=#fn_WrapFunc2>WrapFunc2(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_WrapFunc1><td><code><a href=#fn_WrapFunc1>WrapFunc1(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@26:9><td><code><a href=#fn_@26:9>@26:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/tag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_ParseTagUnmarshalType><td><code><a href=#fn_ParseTagUnmarshalType>ParseTagUnmarshalType(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/tag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@14:9><td><code><a href=#fn_@14:9>@14:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/tag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_ParseTagName><td><code><a href=#fn_ParseTagName>ParseTagName(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/tag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/string.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@43:36><td><code><a href=#fn_@43:36>@43:36(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/string.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@42:36><td><code><a href=#fn_@42:36>@42:36(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/string.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@41:36><td><code><a href=#fn_@41:36>@41:36(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/string.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@17:9><td><code><a href=#fn_@17:9>@17:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_WrapFunc><td><code><a href=#fn_WrapFunc>WrapFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_GetFuncName><td><code><a href=#fn_GetFuncName>GetFuncName(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_SkipRegexps><td><code><a href=#fn_SkipRegexps>SkipRegexps(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@16:3><td><code><a href=#fn_@16:3>@16:3(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_SkipGlobs><td><code><a href=#fn_SkipGlobs>SkipGlobs(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@20:3><td><code><a href=#fn_@20:3>@20:3(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_SkipKnownDepth><td><code><a href=#fn_SkipKnownDepth>SkipKnownDepth(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@198:9><td><code><a href=#fn_@198:9>@198:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@35:9><td><code><a href=#fn_@35:9>@35:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_IsStrPtrNotBlank><td><code><a href=#fn_IsStrPtrNotBlank>IsStrPtrNotBlank(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/string.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_IsStrNotBlank><td><code><a href=#fn_IsStrNotBlank>IsStrNotBlank(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/string.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_IsStrPtrBlank><td><code><a href=#fn_IsStrPtrBlank>IsStrPtrBlank(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/string.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@14:30><td><code><a href=#fn_@14:30>@14:30(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/string.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_IsStrBlank><td><code><a href=#fn_IsStrBlank>IsStrBlank(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/string.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_NextJitterIntervalFunc><td><code><a href=#fn_NextJitterIntervalFunc>NextJitterIntervalFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/time.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_TimeoutWg><td><code><a href=#fn_TimeoutWg>TimeoutWg(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/time.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_AnyPtr><td><code><a href=#fn_AnyPtr>AnyPtr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/conv.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@177:19><td><code><a href=#fn_@177:19>@177:19(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@53:9><td><code><a href=#fn_@53:9>@53:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@88:14><td><code><a href=#fn_@88:14>@88:14(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_SetCtxAny><td><code><a href=#fn_SetCtxAny>SetCtxAny(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/context.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@151:9><td><code><a href=#fn_@151:9>@151:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/time.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_poolSealer[T].Put><td><code><a href=#fn_poolSealer[T].Put>poolSealer[T].Put(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_poolBytesBufferEvict><td><code><a href=#fn_poolBytesBufferEvict>poolBytesBufferEvict(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_poolBytesEvict><td><code><a href=#fn_poolBytesEvict>poolBytesEvict(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_UUID><td><code><a href=#fn_UUID>UUID(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_MustJsonMarshal><td><code><a href=#fn_MustJsonMarshal>MustJsonMarshal(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/marshal.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_ShortUUID><td><code><a href=#fn_ShortUUID>ShortUUID(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_ULID><td><code><a href=#fn_ULID>ULID(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_localIP.String><td><code><a href=#fn_localIP.String>localIP.String(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/ip.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_CryptoRandom><td><code><a href=#fn_CryptoRandom>CryptoRandom(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_PoolableEvictFunc><td><code><a href=#fn_PoolableEvictFunc>PoolableEvictFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_TraverseValue><td><code><a href=#fn_TraverseValue>TraverseValue(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/reflect.go</code><td class=percent><code>93.3%</code><td class=linecount><code>28/30</code><tr id=s_fn_@60:9><td><code><a href=#fn_@60:9>@60:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/ip.go</code><td class=percent><code>92.9%</code><td class=linecount><code>13/14</code><tr id=s_fn_@152:28><td><code><a href=#fn_@152:28>@152:28(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/reflect.go</code><td class=percent><code>90.0%</code><td class=linecount><code>9/10</code><tr id=s_fn_EmbedsType><td><code><a href=#fn_EmbedsType>EmbedsType(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/reflect.go</code><td class=percent><code>88.9%</code><td class=linecount><code>16/18</code><tr id=s_fn_runVariadicFunc><td><code><a href=#fn_runVariadicFunc>runVariadicFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>87.5%</code><td class=linecount><code>21/24</code><tr id=s_fn_Timeout><td><code><a href=#fn_Timeout>Timeout(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/time.go</code><td class=percent><code>87.5%</code><td class=linecount><code>7/8</code><tr id=s_fn_newBuiltinLockedSource><td><code><a href=#fn_newBuiltinLockedSource>newBuiltinLockedSource(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_@11:8><td><code><a href=#fn_@11:8>@11:8(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/candy.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_Min><td><code><a href=#fn_Min>Min(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compare.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_MapKeys><td><code><a href=#fn_MapKeys>MapKeys(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/map.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_ComparableToSortable><td><code><a href=#fn_ComparableToSortable>ComparableToSortable(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/conv.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_IndirectType><td><code><a href=#fn_IndirectType>IndirectType(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/reflect.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_MapValues><td><code><a href=#fn_MapValues>MapValues(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/map.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_IndirectValue><td><code><a href=#fn_IndirectValue>IndirectValue(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/reflect.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_.String><td><code><a href=#fn_.String>.String(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/enum.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_localIP.Bytes><td><code><a href=#fn_localIP.Bytes>localIP.Bytes(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/ip.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_MapValuesByKeys><td><code><a href=#fn_MapValuesByKeys>MapValuesByKeys(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/map.go</code><td class=percent><code>77.8%</code><td class=linecount><code>7/9</code><tr id=s_fn_ParseVariadicFuncResult><td><code><a href=#fn_ParseVariadicFuncResult>ParseVariadicFuncResult(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>77.8%</code><td class=linecount><code>7/9</code><tr id=s_fn_IsBlank><td><code><a href=#fn_IsBlank>IsBlank(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/reflect.go</code><td class=percent><code>76.9%</code><td class=linecount><code>10/13</code><tr id=s_fn_@34:29><td><code><a href=#fn_@34:29>@34:29(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/tag.go</code><td class=percent><code>76.9%</code><td class=linecount><code>10/13</code><tr id=s_fn_poolSealer[T].Get><td><code><a href=#fn_poolSealer[T].Get>poolSealer[T].Get(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/pool.go</code><td class=percent><code>75.0%</code><td class=linecount><code>9/12</code><tr id=s_fn_Catch><td><code><a href=#fn_Catch>Catch(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/candy.go</code><td class=percent><code>75.0%</code><td class=linecount><code>9/12</code><tr id=s_fn_ClientIP><td><code><a href=#fn_ClientIP>ClientIP(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/ip.go</code><td class=percent><code>75.0%</code><td class=linecount><code>6/8</code><tr id=s_fn_CheckIfAny><td><code><a href=#fn_CheckIfAny>CheckIfAny(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/candy.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_NewEnumString><td><code><a href=#fn_NewEnumString>NewEnumString(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/enum.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_Max><td><code><a href=#fn_Max>Max(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compare.go</code><td class=percent><code>71.4%</code><td class=linecount><code>5/7</code><tr id=s_fn_SliceConvert><td><code><a href=#fn_SliceConvert>SliceConvert(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/conv.go</code><td class=percent><code>68.2%</code><td class=linecount><code>15/22</code><tr id=s_fn_CloseAnyway><td><code><a href=#fn_CloseAnyway>CloseAnyway(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/candy.go</code><td class=percent><code>66.7%</code><td class=linecount><code>4/6</code><tr id=s_fn_GetTimeStamp><td><code><a href=#fn_GetTimeStamp>GetTimeStamp(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/time.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_Must><td><code><a href=#fn_Must>Must(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/candy.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_.caseSensitivityConv><td><code><a href=#fn_.caseSensitivityConv>.caseSensitivityConv(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/enum.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_FlushAnyway><td><code><a href=#fn_FlushAnyway>FlushAnyway(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/candy.go</code><td class=percent><code>60.0%</code><td class=linecount><code>3/5</code><tr id=s_fn_Unmarshal><td><code><a href=#fn_Unmarshal>Unmarshal(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/marshal.go</code><td class=percent><code>50.0%</code><td class=linecount><code>11/22</code><tr id=s_fn_MustSuccess><td><code><a href=#fn_MustSuccess>MustSuccess(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/candy.go</code><td class=percent><code>50.0%</code><td class=linecount><code>1/2</code><tr id=s_fn_HostIPInDocker><td><code><a href=#fn_HostIPInDocker>HostIPInDocker(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/ip.go</code><td class=percent><code>42.9%</code><td class=linecount><code>3/7</code><tr id=s_fn_SortableToGeneric><td><code><a href=#fn_SortableToGeneric>SortableToGeneric(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/conv.go</code><td class=percent><code>7.1%</code><td class=linecount><code>2/28</code><tr id=s_fn_LoopWithInterval><td><code><a href=#fn_LoopWithInterval>LoopWithInterval(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/time.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/22</code><tr id=s_fn_Set[T].Equals><td><code><a href=#fn_Set[T].Equals>Set[T].Equals(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sets.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/13</code><tr id=s_fn_Set[T].IntersectsWith><td><code><a href=#fn_Set[T].IntersectsWith>Set[T].IntersectsWith(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sets.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/12</code><tr id=s_fn_SliceSplit><td><code><a href=#fn_SliceSplit>SliceSplit(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/slice.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/10</code><tr id=s_fn_Set[T].Clone><td><code><a href=#fn_Set[T].Clone>Set[T].Clone(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sets.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/10</code><tr id=s_fn_@132:28><td><code><a href=#fn_@132:28>@132:28(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/reflect.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/10</code><tr id=s_fn_@94:28><td><code><a href=#fn_@94:28>@94:28(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/reflect.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/10</code><tr id=s_fn_Heap[E].Clone><td><code><a href=#fn_Heap[E].Clone>Heap[E].Clone(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/9</code><tr id=s_fn_@114:28><td><code><a href=#fn_@114:28>@114:28(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/reflect.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/9</code><tr id=s_fn_@100:9><td><code><a href=#fn_@100:9>@100:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/9</code><tr id=s_fn_Set[T].IsSubsetOf><td><code><a href=#fn_Set[T].IsSubsetOf>Set[T].IsSubsetOf(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sets.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/8</code><tr id=s_fn_@87:9><td><code><a href=#fn_@87:9>@87:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/8</code><tr id=s_fn_CryptoRandomLetterAndNumber><td><code><a href=#fn_CryptoRandomLetterAndNumber>CryptoRandomLetterAndNumber(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_Heap[E].Copy><td><code><a href=#fn_Heap[E].Copy>Heap[E].Copy(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_CryptoRandomNumbers><td><code><a href=#fn_CryptoRandomNumbers>CryptoRandomNumbers(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_@75:9><td><code><a href=#fn_@75:9>@75:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_@64:9><td><code><a href=#fn_@64:9>@64:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_JsonStringify[T].MarshalJSON><td><code><a href=#fn_JsonStringify[T].MarshalJSON>JsonStringify[T].MarshalJSON(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/marshal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_JsonStringify[T].UnmarshalJSON><td><code><a href=#fn_JsonStringify[T].UnmarshalJSON>JsonStringify[T].UnmarshalJSON(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/marshal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_Set[T].Reject><td><code><a href=#fn_Set[T].Reject>Set[T].Reject(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sets.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_Set[T].Filter><td><code><a href=#fn_Set[T].Filter>Set[T].Filter(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sets.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_@54:9><td><code><a href=#fn_@54:9>@54:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_@54:9><td><code><a href=#fn_@54:9>@54:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/time.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_RandomNumbers><td><code><a href=#fn_RandomNumbers>RandomNumbers(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_InvalidUnmarshalError.Error><td><code><a href=#fn_InvalidUnmarshalError.Error>InvalidUnmarshalError.Error(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/marshal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_Set[T].Copy><td><code><a href=#fn_Set[T].Copy>Set[T].Copy(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sets.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_@23:9><td><code><a href=#fn_@23:9>@23:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_MapSliceToMap><td><code><a href=#fn_MapSliceToMap>MapSliceToMap(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/map.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_CryptoRandomBytes><td><code><a href=#fn_CryptoRandomBytes>CryptoRandomBytes(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_SliceRemove><td><code><a href=#fn_SliceRemove>SliceRemove(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/slice.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_DecimalPlaces><td><code><a href=#fn_DecimalPlaces>DecimalPlaces(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/number.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_UUID20><td><code><a href=#fn_UUID20>UUID20(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_Heap[E].Element><td><code><a href=#fn_Heap[E].Element>Heap[E].Element(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_IsInRange><td><code><a href=#fn_IsInRange>IsInRange(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compare.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_NewHeap><td><code><a href=#fn_NewHeap>NewHeap(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_MustOk><td><code><a href=#fn_MustOk>MustOk(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_Set[T].Size><td><code><a href=#fn_Set[T].Size>Set[T].Size(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sets.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_GetFieldByTagWithKeys><td><code><a href=#fn_GetFieldByTagWithKeys>GetFieldByTagWithKeys(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/reflect.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn__heap[E].Pop><td><code><a href=#fn__heap[E].Pop>_heap[E].Pop(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_GetFieldTagValue><td><code><a href=#fn_GetFieldTagValue>GetFieldTagValue(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/reflect.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@29:3><td><code><a href=#fn_@29:3>@29:3(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/number.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_IntNarrow><td><code><a href=#fn_IntNarrow>IntNarrow(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/number.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@30:3><td><code><a href=#fn_@30:3>@30:3(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/number.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_UUID22><td><code><a href=#fn_UUID22>UUID22(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@21:3><td><code><a href=#fn_@21:3>@21:3(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/number.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_GetFieldByTag><td><code><a href=#fn_GetFieldByTag>GetFieldByTag(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/reflect.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn__heap[E].Push><td><code><a href=#fn__heap[E].Push>_heap[E].Push(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@19:3><td><code><a href=#fn_@19:3>@19:3(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/number.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@20:3><td><code><a href=#fn_@20:3>@20:3(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/number.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@32:3><td><code><a href=#fn_@32:3>@32:3(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/number.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_IsValidTimestamp><td><code><a href=#fn_IsValidTimestamp>IsValidTimestamp(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/time.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@31:3><td><code><a href=#fn_@31:3>@31:3(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/number.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@181:3><td><code><a href=#fn_@181:3>@181:3(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_UintNarrow><td><code><a href=#fn_UintNarrow>UintNarrow(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/number.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@22:3><td><code><a href=#fn_@22:3>@22:3(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/number.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_Sort><td><code><a href=#fn_Sort>Sort(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sort.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_SortStable><td><code><a href=#fn_SortStable>SortStable(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sort.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_Heap[E].Data><td><code><a href=#fn_Heap[E].Data>Heap[E].Data(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_sortable[E].Swap><td><code><a href=#fn_sortable[E].Swap>sortable[E].Swap(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sort.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_sortable[E].Less><td><code><a href=#fn_sortable[E].Less>sortable[E].Less(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sort.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_sortable[E].Len><td><code><a href=#fn_sortable[E].Len>sortable[E].Len(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/sort.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Heap[E].CmpFn><td><code><a href=#fn_Heap[E].CmpFn>Heap[E].CmpFn(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn__heap[E].Swap><td><code><a href=#fn__heap[E].Swap>_heap[E].Swap(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn__heap[E].Less><td><code><a href=#fn__heap[E].Less>_heap[E].Less(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn__heap[E].Len><td><code><a href=#fn__heap[E].Len>_heap[E].Len(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@26:9><td><code><a href=#fn_@26:9>@26:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/enum.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_WrapFunc7><td><code><a href=#fn_WrapFunc7>WrapFunc7(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Heap[E].Push><td><code><a href=#fn_Heap[E].Push>Heap[E].Push(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_WrapFunc6><td><code><a href=#fn_WrapFunc6>WrapFunc6(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Heap[E].Pop><td><code><a href=#fn_Heap[E].Pop>Heap[E].Pop(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_WrapFunc5><td><code><a href=#fn_WrapFunc5>WrapFunc5(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_LoopJitterInterval><td><code><a href=#fn_LoopJitterInterval>LoopJitterInterval(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/time.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_ParseTagOverwrite><td><code><a href=#fn_ParseTagOverwrite>ParseTagOverwrite(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/tag.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@20:9><td><code><a href=#fn_@20:9>@20:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/tag.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_WrapFunc4><td><code><a href=#fn_WrapFunc4>WrapFunc4(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_NewSafeRand><td><code><a href=#fn_NewSafeRand>NewSafeRand(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_WrapFunc3><td><code><a href=#fn_WrapFunc3>WrapFunc3(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@182:19><td><code><a href=#fn_@182:19>@182:19(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_GetTime><td><code><a href=#fn_GetTime>GetTime(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/time.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_WrapFuncAny><td><code><a href=#fn_WrapFuncAny>WrapFuncAny(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/func.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_MustJsonMarshalString><td><code><a href=#fn_MustJsonMarshalString>MustJsonMarshalString(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/marshal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Heap[E].Remove><td><code><a href=#fn_Heap[E].Remove>Heap[E].Remove(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_UUID_><td><code><a href=#fn_UUID_>UUID_(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/random.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_LoopMaxTimes><td><code><a href=#fn_LoopMaxTimes>LoopMaxTimes(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/time.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@65:9><td><code><a href=#fn_@65:9>@65:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/time.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Heap[E].Len><td><code><a href=#fn_Heap[E].Len>Heap[E].Len(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_IgnoreEnumStringCase><td><code><a href=#fn_IgnoreEnumStringCase>IgnoreEnumStringCase(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/enum.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_UnsafeBytesToString><td><code><a href=#fn_UnsafeBytesToString>UnsafeBytesToString(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/conv.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_UnsafeStringToBytes><td><code><a href=#fn_UnsafeStringToBytes>UnsafeStringToBytes(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/conv.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Heap[E].Fix><td><code><a href=#fn_Heap[E].Fix>Heap[E].Fix(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Heap[E].Init><td><code><a href=#fn_Heap[E].Init>Heap[E].Init(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/heap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Error.Error><td><code><a href=#fn_Error.Error>Error.Error(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/error.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_NginxID>func NginxID</div><div class=info><a href=#s_fn_NginxID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>125<td><code><pre>func NginxID() string {</pre></code><tr><td>126<td><code><pre> upper := func(c byte) byte {</pre></code><tr><td>127<td><code><pre> val := c</pre></code><tr><td>128<td><code><pre> if val >= 97 && val <= 122 {</pre></code><tr><td>129<td><code><pre> return val - 32</pre></code><tr><td>130<td><code><pre> }</pre></code><tr><td>131<td><code><pre> return c</pre></code><tr><td>132<td><code><pre> }</pre></code><tr><td>133<td><code><pre> int2byte := func(bs []byte, val int) {</pre></code><tr><td>134<td><code><pre> size := 10</pre></code><tr><td>135<td><code><pre> l := len(bs) - 1</pre></code><tr><td>136<td><code><pre> for idx := l; idx >= 0; idx-- {</pre></code><tr><td>137<td><code><pre> bs[idx] = byte(uint(val%size) + uint('0'))</pre></code><tr><td>138<td><code><pre> val = val / size</pre></code><tr><td>139<td><code><pre> }</pre></code><tr><td>140<td><code><pre> }</pre></code><tr><td>141<td><code><pre></pre></code><tr><td>142<td><code><pre> ret := [33]byte{}</pre></code><tr><td>143<td><code><pre> t := time.Now()</pre></code><tr><td>144<td><code><pre> year, month, day := t.Date()</pre></code><tr><td>145<td><code><pre> hour, minute, second := t.Clock()</pre></code><tr><td>146<td><code><pre> int2byte(ret[:4], year)</pre></code><tr><td>147<td><code><pre> int2byte(ret[4:6], int(month))</pre></code><tr><td>148<td><code><pre> int2byte(ret[6:8], day)</pre></code><tr><td>149<td><code><pre> int2byte(ret[8:10], hour)</pre></code><tr><td>150<td><code><pre> int2byte(ret[10:12], minute)</pre></code><tr><td>151<td><code><pre> int2byte(ret[12:14], second)</pre></code><tr><td>152<td><code><pre> copy(ret[14:26], LocalIP.Bytes())</pre></code><tr><td>153<td><code><pre> ms := t.UnixNano() / 1e6 % 1000</pre></code><tr><td>154<td><code><pre> int2byte(ret[26:29], int(ms))</pre></code><tr><td>155<td><code><pre> u32 := rand.Uint32()</pre></code><tr><td>156<td><code><pre> u32 >>= 16</pre></code><tr><td>157<td><code><pre> src := []byte{byte(u32 & 0xff), byte((u32 >> 8) & 0xff)}</pre></code><tr><td>158<td><code><pre> hex.Encode(ret[29:33], src)</pre></code><tr><td>159<td><code><pre> for idx := 29; idx < 33; idx++ {</pre></code><tr><td>160<td><code><pre> ret[idx] = upper(ret[idx])</pre></code><tr><td>161<td><code><pre> }</pre></code><tr><td>162<td><code><pre> return string(ret[:])</pre></code><tr><td>163<td><code><pre>}</pre></code></table><div class=funcname id=fn_GetCaller>func GetCaller</div><div class=info><a href=#s_fn_GetCaller>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>204<td><code><pre>func GetCaller(maximumCallerDepth int, opts ...OptionExtender) (frame *runtime.Frame) {</pre></code><tr><td>205<td><code><pre> opt := ApplyOptions[getCallerOption](opts...)</pre></code><tr><td>206<td><code><pre> pcs := make([]uintptr, maximumCallerDepth)</pre></code><tr><td>207<td><code><pre> depth := runtime.Callers(opt.minimumCallerDepth, pcs)</pre></code><tr><td>208<td><code><pre> frames := runtime.CallersFrames(pcs[:depth])</pre></code><tr><td>209<td><code><pre>outer:</pre></code><tr><td>210<td><code><pre> for f, hasMore := frames.Next(); hasMore; f, hasMore = frames.Next() {</pre></code><tr><td>211<td><code><pre> frame = &f</pre></code><tr><td>212<td><code><pre></pre></code><tr><td>213<td><code><pre> // If the caller isn't part of this package, we're done</pre></code><tr><td>214<td><code><pre> for _, skipGlob := range opt.skipGlobList {</pre></code><tr><td>215<td><code><pre> if skipGlob.Match(f.File) {</pre></code><tr><td>216<td><code><pre> continue outer</pre></code><tr><td>217<td><code><pre> }</pre></code><tr><td>218<td><code><pre> }</pre></code><tr><td>219<td><code><pre> for _, s := range opt.skipRegList {</pre></code><tr><td>220<td><code><pre> if s.MatchString(f.File) {</pre></code><tr><td>221<td><code><pre> continue outer</pre></code><tr><td>222<td><code><pre> }</pre></code><tr><td>223<td><code><pre> }</pre></code><tr><td>224<td><code><pre> break</pre></code><tr><td>225<td><code><pre> }</pre></code><tr><td>226<td><code><pre></pre></code><tr><td>227<td><code><pre> return</pre></code><tr><td>228<td><code><pre>}</pre></code></table><div class=funcname id=fn_.init>func .init</div><div class=info><a href=#s_fn_.init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/enum.go</code>:</div><table class=listing><tr><td>84<td><code><pre>func (e *enumString[T, TS]) init() Enumerable[T, TS] {</pre></code><tr><td>85<td><code><pre> // get key</pre></code><tr><td>86<td><code><pre> var key any</pre></code><tr><td>87<td><code><pre> for k := range e.mapping {</pre></code><tr><td>88<td><code><pre> key = k</pre></code><tr><td>89<td><code><pre> break</pre></code><tr><td>90<td><code><pre> }</pre></code><tr><td>91<td><code><pre> e.elemType = reflect.TypeOf(key)</pre></code><tr><td>92<td><code><pre> e.elemSliceType = reflect.SliceOf(e.elemType)</pre></code><tr><td>93<td><code><pre></pre></code><tr><td>94<td><code><pre> // get prefix name</pre></code><tr><td>95<td><code><pre> e.prefix = cases.Title(language.English, cases.NoLower).String(e.elemType.Name())</pre></code><tr><td>96<td><code><pre></pre></code><tr><td>97<td><code><pre> // get reversed mapping</pre></code><tr><td>98<td><code><pre> e.reversedMapping = make(map[string]TS, len(e.mapping))</pre></code><tr><td>99<td><code><pre> for k, v := range e.mapping {</pre></code><tr><td>100<td><code><pre> v = e.caseSensitivityConv(v)</pre></code><tr><td>101<td><code><pre> e.reversedMapping[v] = append(e.reversedMapping[v], k)</pre></code><tr><td>102<td><code><pre> }</pre></code><tr><td>103<td><code><pre></pre></code><tr><td>104<td><code><pre> return e</pre></code><tr><td>105<td><code><pre>}</pre></code></table><div class=funcname id=fn_FuzzyKeyword>func FuzzyKeyword</div><div class=info><a href=#s_fn_FuzzyKeyword>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/string.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func FuzzyKeyword(keyword string) []string {</pre></code><tr><td>39<td><code><pre> words := strings.Fields(constant.NonNumberLetterReg.ReplaceAllString(keyword, " "))</pre></code><tr><td>40<td><code><pre> compact := strings.Join(words, "")</pre></code><tr><td>41<td><code><pre> lowerWords := SliceMapping(words, func(s string) string { return strings.ToLower(s) })</pre></code><tr><td>42<td><code><pre> upperWords := SliceMapping(words, func(s string) string { return strings.ToUpper(s) })</pre></code><tr><td>43<td><code><pre> titleWords := SliceMapping(words, func(s string) string { return cases.Title(language.English).String(s) })</pre></code><tr><td>44<td><code><pre></pre></code><tr><td>45<td><code><pre> s := NewSet(keyword)</pre></code><tr><td>46<td><code><pre> s.Insert(</pre></code><tr><td>47<td><code><pre> compact,</pre></code><tr><td>48<td><code><pre> strings.ToUpper(compact),</pre></code><tr><td>49<td><code><pre> strings.ToLower(compact),</pre></code><tr><td>50<td><code><pre> strcase.ToCamel(keyword),</pre></code><tr><td>51<td><code><pre> strcase.ToLowerCamel(keyword),</pre></code><tr><td>52<td><code><pre> strcase.ToKebab(keyword),</pre></code><tr><td>53<td><code><pre> strcase.ToSnake(keyword),</pre></code><tr><td>54<td><code><pre> strcase.ToScreamingSnake(keyword),</pre></code><tr><td>55<td><code><pre> strcase.ToScreamingKebab(keyword),</pre></code><tr><td>56<td><code><pre> )</pre></code><tr><td>57<td><code><pre> for _, delimited := range keywordFuzzyDelimited {</pre></code><tr><td>58<td><code><pre> s.Insert(</pre></code><tr><td>59<td><code><pre> strings.Join(lowerWords, delimited),</pre></code><tr><td>60<td><code><pre> strings.Join(upperWords, delimited),</pre></code><tr><td>61<td><code><pre> strings.Join(titleWords, delimited),</pre></code><tr><td>62<td><code><pre> )</pre></code><tr><td>63<td><code><pre> }</pre></code><tr><td>64<td><code><pre></pre></code><tr><td>65<td><code><pre> return s.Items()</pre></code><tr><td>66<td><code><pre>}</pre></code></table><div class=funcname id=fn_@117:9>func @117:9</div><div class=info><a href=#s_fn_@117:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/time.go</code>:</div><table class=listing><tr><td>117<td><code><pre>func() (interval time.Duration) {</pre></code><tr><td>118<td><code><pre> // add specified ratio jitter</pre></code><tr><td>119<td><code><pre> if !symmetric {</pre></code><tr><td>120<td><code><pre> // if ratio is 0.5</pre></code><tr><td>121<td><code><pre> // then interval = base + random(0.5*base) <=> [base, 1.5*base)</pre></code><tr><td>122<td><code><pre> // if ratio is 0.1</pre></code><tr><td>123<td><code><pre> // then interval = base + random(0.1*base) <=> [base, 1.1*base)</pre></code><tr><td>124<td><code><pre> _range := float64(base) * ratio * rand.Float64()</pre></code><tr><td>125<td><code><pre> interval = base + time.Duration(_range)</pre></code><tr><td>126<td><code><pre> } else {</pre></code><tr><td>127<td><code><pre> // if ratio is 0.5</pre></code><tr><td>128<td><code><pre> // then interval = base + random(0.5*base) - 0.25*base <=> [0.75*base, 1.25*base)</pre></code><tr><td>129<td><code><pre> // if ratio is 0.1</pre></code><tr><td>130<td><code><pre> // then interval = base + random(0.1*base) - 0.05*base <=> [0.95*base, 1.05*base)</pre></code><tr><td>131<td><code><pre> _range := float64(base) * ratio * rand.Float64()</pre></code><tr><td>132<td><code><pre> interval = base + time.Duration(_range) - time.Duration(float64(base)*(ratio/2))</pre></code><tr><td>133<td><code><pre> }</pre></code><tr><td>134<td><code><pre></pre></code><tr><td>135<td><code><pre> // double and clamp for next time</pre></code><tr><td>136<td><code><pre> base = time.Duration(float64(base) * exp)</pre></code><tr><td>137<td><code><pre> if base > max {</pre></code><tr><td>138<td><code><pre> base = max</pre></code><tr><td>139<td><code><pre> }</pre></code><tr><td>140<td><code><pre> return interval</pre></code><tr><td>141<td><code><pre> }</pre></code></table><div class=funcname id=fn_Set[T].Items>func Set[T].Items</div><div class=info><a href=#s_fn_Set[T].Items>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sets.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func (s *Set[T]) Items() []T {</pre></code><tr><td>32<td><code><pre> s.m.RLock()</pre></code><tr><td>33<td><code><pre> defer s.m.RUnlock()</pre></code><tr><td>34<td><code><pre></pre></code><tr><td>35<td><code><pre> i := 0</pre></code><tr><td>36<td><code><pre> ret := make([]T, len(s.storage))</pre></code><tr><td>37<td><code><pre> for key := range s.storage {</pre></code><tr><td>38<td><code><pre> ret[i] = key</pre></code><tr><td>39<td><code><pre> i++</pre></code><tr><td>40<td><code><pre> }</pre></code><tr><td>41<td><code><pre> return ret</pre></code><tr><td>42<td><code><pre>}</pre></code></table><div class=funcname id=fn_TravelCtx>func TravelCtx</div><div class=info><a href=#s_fn_TravelCtx>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/context.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func TravelCtx(child context.Context, fn func(ctx context.Context) bool) {</pre></code><tr><td>26<td><code><pre> v := reflect.ValueOf(child)</pre></code><tr><td>27<td><code><pre> for p := v; p.IsValid() && p.CanInterface(); p = p.FieldByName("Context") {</pre></code><tr><td>28<td><code><pre> parent, ok := p.Interface().(context.Context)</pre></code><tr><td>29<td><code><pre> if !ok || parent == nil || fn(parent) {</pre></code><tr><td>30<td><code><pre> break</pre></code><tr><td>31<td><code><pre> }</pre></code><tr><td>32<td><code><pre> if p = reflect.Indirect(p); p.Kind() != reflect.Struct {</pre></code><tr><td>33<td><code><pre> break</pre></code><tr><td>34<td><code><pre> }</pre></code><tr><td>35<td><code><pre> }</pre></code><tr><td>36<td><code><pre>}</pre></code></table><div class=funcname id=fn_MapMerge>func MapMerge</div><div class=info><a href=#s_fn_MapMerge>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/map.go</code>:</div><table class=listing><tr><td>40<td><code><pre>func MapMerge[T comparable, K any](a, b map[T]K) (r map[T]K) {</pre></code><tr><td>41<td><code><pre> r = make(map[T]K, len(a)+len(b))</pre></code><tr><td>42<td><code><pre> for k, v := range a {</pre></code><tr><td>43<td><code><pre> r[k] = v</pre></code><tr><td>44<td><code><pre> }</pre></code><tr><td>45<td><code><pre> for k, v := range b {</pre></code><tr><td>46<td><code><pre> r[k] = v</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> return</pre></code><tr><td>49<td><code><pre>}</pre></code></table><div class=funcname id=fn_IsChannelClosed>func IsChannelClosed</div><div class=info><a href=#s_fn_IsChannelClosed>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/channel.go</code>:</div><table class=listing><tr><td>3<td><code><pre>func IsChannelClosed[T any](ch <-chan T) (data T, ok bool) {</pre></code><tr><td>4<td><code><pre> select {</pre></code><tr><td>5<td><code><pre> case d, opened := <-ch:</pre></code><tr><td>6<td><code><pre> if !opened {</pre></code><tr><td>7<td><code><pre> ok = true</pre></code><tr><td>8<td><code><pre> }</pre></code><tr><td>9<td><code><pre> data = d</pre></code><tr><td>10<td><code><pre> return</pre></code><tr><td>11<td><code><pre> default:</pre></code><tr><td>12<td><code><pre> return</pre></code><tr><td>13<td><code><pre> }</pre></code><tr><td>14<td><code><pre>}</pre></code></table><div class=funcname id=fn_SliceMapping>func SliceMapping</div><div class=info><a href=#s_fn_SliceMapping>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/conv.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func SliceMapping[T, K any](s []T, mapFn func(t T) K) (d []K) {</pre></code><tr><td>16<td><code><pre> if s == nil {</pre></code><tr><td>17<td><code><pre> return</pre></code><tr><td>18<td><code><pre> }</pre></code><tr><td>19<td><code><pre> d = make([]K, 0, len(s))</pre></code><tr><td>20<td><code><pre> for _, item := range s {</pre></code><tr><td>21<td><code><pre> d = append(d, mapFn(item))</pre></code><tr><td>22<td><code><pre> }</pre></code><tr><td>23<td><code><pre> return</pre></code><tr><td>24<td><code><pre>}</pre></code></table><div class=funcname id=fn_RandomLetterAndNumber>func RandomLetterAndNumber</div><div class=info><a href=#s_fn_RandomLetterAndNumber>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>84<td><code><pre>func RandomLetterAndNumber(n int) string {</pre></code><tr><td>85<td><code><pre> random := make([]byte, 0, n)</pre></code><tr><td>86<td><code><pre> rand.Seed(time.Now().UnixNano())</pre></code><tr><td>87<td><code><pre> for i := 0; i < n; i++ {</pre></code><tr><td>88<td><code><pre> random = append(random, randomChars[rand.Intn(randomCharsLength)])</pre></code><tr><td>89<td><code><pre> }</pre></code><tr><td>90<td><code><pre></pre></code><tr><td>91<td><code><pre> return string(random)</pre></code><tr><td>92<td><code><pre>}</pre></code></table><div class=funcname id=fn_@61:14>func @61:14</div><div class=info><a href=#s_fn_@61:14>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/ip.go</code>:</div><table class=listing><tr><td>61<td><code><pre>func(bs []byte) {</pre></code><tr><td>62<td><code><pre> i, j := 0, len(bs)-1</pre></code><tr><td>63<td><code><pre> for i < j {</pre></code><tr><td>64<td><code><pre> bs[i], bs[j] = bs[j], bs[i]</pre></code><tr><td>65<td><code><pre> i++</pre></code><tr><td>66<td><code><pre> j--</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre> }</pre></code></table><div class=funcname id=fn_@133:14>func @133:14</div><div class=info><a href=#s_fn_@133:14>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>133<td><code><pre>func(bs []byte, val int) {</pre></code><tr><td>134<td><code><pre> size := 10</pre></code><tr><td>135<td><code><pre> l := len(bs) - 1</pre></code><tr><td>136<td><code><pre> for idx := l; idx >= 0; idx-- {</pre></code><tr><td>137<td><code><pre> bs[idx] = byte(uint(val%size) + uint('0'))</pre></code><tr><td>138<td><code><pre> val = val / size</pre></code><tr><td>139<td><code><pre> }</pre></code><tr><td>140<td><code><pre> }</pre></code></table><div class=funcname id=fn_poolBytes.Reset>func poolBytes.Reset</div><div class=info><a href=#s_fn_poolBytes.Reset>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/pool.go</code>:</div><table class=listing><tr><td>101<td><code><pre>func (p poolBytes) Reset(initLen any) poolBytes {</pre></code><tr><td>102<td><code><pre> iLen := cast.ToInt(initLen)</pre></code><tr><td>103<td><code><pre> pp := p</pre></code><tr><td>104<td><code><pre> if cap(p) < cast.ToInt(iLen) {</pre></code><tr><td>105<td><code><pre> pp = make([]byte, iLen)</pre></code><tr><td>106<td><code><pre> }</pre></code><tr><td>107<td><code><pre></pre></code><tr><td>108<td><code><pre> return pp[:iLen]</pre></code><tr><td>109<td><code><pre>}</pre></code></table><div class=funcname id=fn_ApplyOptions>func ApplyOptions</div><div class=info><a href=#s_fn_ApplyOptions>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/options.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func ApplyOptions[T any](opts ...OptionExtender) (t *T) {</pre></code><tr><td>16<td><code><pre> t = new(T)</pre></code><tr><td>17<td><code><pre> for _, optional := range opts {</pre></code><tr><td>18<td><code><pre> if optional != nil {</pre></code><tr><td>19<td><code><pre> optional.applyOption(t)</pre></code><tr><td>20<td><code><pre> }</pre></code><tr><td>21<td><code><pre> }</pre></code><tr><td>22<td><code><pre> return</pre></code><tr><td>23<td><code><pre>}</pre></code></table><div class=funcname id=fn_Set[T].Insert>func Set[T].Insert</div><div class=info><a href=#s_fn_Set[T].Insert>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sets.go</code>:</div><table class=listing><tr><td>44<td><code><pre>func (s *Set[T]) Insert(val ...T) *Set[T] {</pre></code><tr><td>45<td><code><pre> s.m.Lock()</pre></code><tr><td>46<td><code><pre> defer s.m.Unlock()</pre></code><tr><td>47<td><code><pre></pre></code><tr><td>48<td><code><pre> for _, v := range val {</pre></code><tr><td>49<td><code><pre> s.storage[v] = struct{}{}</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre> return s</pre></code><tr><td>52<td><code><pre>}</pre></code></table><div class=funcname id=fn_GetCtxAny>func GetCtxAny</div><div class=info><a href=#s_fn_GetCtxAny>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/context.go</code>:</div><table class=listing><tr><td>9<td><code><pre>func GetCtxAny[T any](ctx context.Context, key string, args ...T) (val T) {</pre></code><tr><td>10<td><code><pre> if v := ctx.Value(key); v != nil {</pre></code><tr><td>11<td><code><pre> return v.(T)</pre></code><tr><td>12<td><code><pre> }</pre></code><tr><td>13<td><code><pre> if len(args) == 0 {</pre></code><tr><td>14<td><code><pre> return</pre></code><tr><td>15<td><code><pre> }</pre></code><tr><td>16<td><code><pre> return args[0]</pre></code><tr><td>17<td><code><pre>}</pre></code></table><div class=funcname id=fn_Set[T].Remove>func Set[T].Remove</div><div class=info><a href=#s_fn_Set[T].Remove>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sets.go</code>:</div><table class=listing><tr><td>54<td><code><pre>func (s *Set[T]) Remove(val ...T) *Set[T] {</pre></code><tr><td>55<td><code><pre> s.m.Lock()</pre></code><tr><td>56<td><code><pre> defer s.m.Unlock()</pre></code><tr><td>57<td><code><pre></pre></code><tr><td>58<td><code><pre> for _, v := range val {</pre></code><tr><td>59<td><code><pre> delete(s.storage, v)</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre> return s</pre></code><tr><td>62<td><code><pre>}</pre></code></table><div class=funcname id=fn_LookupByFuzzyKeyword>func LookupByFuzzyKeyword</div><div class=info><a href=#s_fn_LookupByFuzzyKeyword>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/candy.go</code>:</div><table class=listing><tr><td>134<td><code><pre>func LookupByFuzzyKeyword[T any, F lookupByFuzzyKeywordFuncType[T]](lookup F, keyword string) (v T) {</pre></code><tr><td>135<td><code><pre> fn := WrapFunc1[T](lookup)</pre></code><tr><td>136<td><code><pre> for _, k := range FuzzyKeyword(keyword) {</pre></code><tr><td>137<td><code><pre> if v = fn(k); !IsBlank(v) {</pre></code><tr><td>138<td><code><pre> return</pre></code><tr><td>139<td><code><pre> }</pre></code><tr><td>140<td><code><pre> }</pre></code><tr><td>141<td><code><pre> return</pre></code><tr><td>142<td><code><pre>}</pre></code></table><div class=funcname id=fn_SliceToMap>func SliceToMap</div><div class=info><a href=#s_fn_SliceToMap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/map.go</code>:</div><table class=listing><tr><td>61<td><code><pre>func SliceToMap[K comparable, V any](s []V, groupFn func(v V) K) (d map[K]V) {</pre></code><tr><td>62<td><code><pre> d = make(map[K]V)</pre></code><tr><td>63<td><code><pre> for _, i := range s {</pre></code><tr><td>64<td><code><pre> d[groupFn(i)] = i</pre></code><tr><td>65<td><code><pre> }</pre></code><tr><td>66<td><code><pre> return</pre></code><tr><td>67<td><code><pre>}</pre></code></table><div class=funcname id=fn_Set[T].Contains>func Set[T].Contains</div><div class=info><a href=#s_fn_Set[T].Contains>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sets.go</code>:</div><table class=listing><tr><td>64<td><code><pre>func (s *Set[T]) Contains(val T) bool {</pre></code><tr><td>65<td><code><pre> s.m.RLock()</pre></code><tr><td>66<td><code><pre> defer s.m.RUnlock()</pre></code><tr><td>67<td><code><pre></pre></code><tr><td>68<td><code><pre> _, ok := s.storage[val]</pre></code><tr><td>69<td><code><pre> return ok</pre></code><tr><td>70<td><code><pre>}</pre></code></table><div class=funcname id=fn_@45:9>func @45:9</div><div class=info><a href=#s_fn_@45:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func(a ...any) (t1 T1, t2 T2) {</pre></code><tr><td>46<td><code><pre> ret := runVariadicFunc(fn, a...)</pre></code><tr><td>47<td><code><pre> t1 = ParseVariadicFuncResult[T1](ret, 0)</pre></code><tr><td>48<td><code><pre> t2 = ParseVariadicFuncResult[T2](ret, 1)</pre></code><tr><td>49<td><code><pre> return</pre></code><tr><td>50<td><code><pre> }</pre></code></table><div class=funcname id=fn_ParseTag>func ParseTag</div><div class=info><a href=#s_fn_ParseTag>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/tag.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func ParseTag(data any, opts ...OptionExtender) (err error) {</pre></code><tr><td>32<td><code><pre> opt := ApplyOptions[parseTagOption](opts...)</pre></code><tr><td>33<td><code><pre> stepInKinds := NewSet(reflect.Struct, reflect.Array, reflect.Slice, reflect.Map)</pre></code><tr><td>34<td><code><pre> TraverseValue(data, false, func(field reflect.StructField, value reflect.Value) (end, stepIn bool) {</pre></code><tr><td>35<td><code><pre> if !value.IsValid() || !value.CanSet() || !value.CanAddr() || !value.CanInterface() {</pre></code><tr><td>36<td><code><pre> return</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre></pre></code><tr><td>39<td><code><pre> vk := value.Kind()</pre></code><tr><td>40<td><code><pre> stepIn = stepInKinds.Contains(vk) ||</pre></code><tr><td>41<td><code><pre> (vk == reflect.Ptr && value.Elem().IsValid() && value.Elem().Kind() == reflect.Struct)</pre></code><tr><td>42<td><code><pre></pre></code><tr><td>43<td><code><pre> defaultString := field.Tag.Get(opt.tag)</pre></code><tr><td>44<td><code><pre> if IsStrBlank(defaultString) || (!opt.overwrite && !IsBlank(value)) {</pre></code><tr><td>45<td><code><pre> return</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre></pre></code><tr><td>48<td><code><pre> defaultValue := reflect.New(value.Type()).Interface()</pre></code><tr><td>49<td><code><pre> if err = Unmarshal(defaultString, defaultValue, opt.unmarshalType); err != nil {</pre></code><tr><td>50<td><code><pre> end = true</pre></code><tr><td>51<td><code><pre> return</pre></code><tr><td>52<td><code><pre> }</pre></code><tr><td>53<td><code><pre> value.Set(reflect.ValueOf(defaultValue).Elem())</pre></code><tr><td>54<td><code><pre> return</pre></code><tr><td>55<td><code><pre> })</pre></code><tr><td>56<td><code><pre></pre></code><tr><td>57<td><code><pre> return</pre></code><tr><td>58<td><code><pre>}</pre></code></table><div class=funcname id=fn_@126:11>func @126:11</div><div class=info><a href=#s_fn_@126:11>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>126<td><code><pre>func(c byte) byte {</pre></code><tr><td>127<td><code><pre> val := c</pre></code><tr><td>128<td><code><pre> if val >= 97 && val <= 122 {</pre></code><tr><td>129<td><code><pre> return val - 32</pre></code><tr><td>130<td><code><pre> }</pre></code><tr><td>131<td><code><pre> return c</pre></code><tr><td>132<td><code><pre> }</pre></code></table><div class=funcname id=fn_ErrIgnore>func ErrIgnore</div><div class=info><a href=#s_fn_ErrIgnore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/candy.go</code>:</div><table class=listing><tr><td>119<td><code><pre>func ErrIgnore(src error, ignored ...error) (dst error) {</pre></code><tr><td>120<td><code><pre> for _, target := range ignored {</pre></code><tr><td>121<td><code><pre> if errors.Is(src, target) {</pre></code><tr><td>122<td><code><pre> return</pre></code><tr><td>123<td><code><pre> }</pre></code><tr><td>124<td><code><pre> }</pre></code><tr><td>125<td><code><pre> return src</pre></code><tr><td>126<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewSet>func NewSet</div><div class=info><a href=#s_fn_NewSet>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sets.go</code>:</div><table class=listing><tr><td>14<td><code><pre>func NewSet[T comparable](arr ...T) (s *Set[T]) {</pre></code><tr><td>15<td><code><pre> s = &Set[T]{</pre></code><tr><td>16<td><code><pre> m: new(sync.RWMutex),</pre></code><tr><td>17<td><code><pre> storage: make(map[T]struct{}, len(arr)),</pre></code><tr><td>18<td><code><pre> }</pre></code><tr><td>19<td><code><pre> for _, item := range arr {</pre></code><tr><td>20<td><code><pre> s.storage[item] = struct{}{}</pre></code><tr><td>21<td><code><pre> }</pre></code><tr><td>22<td><code><pre> return</pre></code><tr><td>23<td><code><pre>}</pre></code></table><div class=funcname id=fn_Random>func Random</div><div class=info><a href=#s_fn_Random>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>94<td><code><pre>func Random(b []byte, seed int64) (n int, err error) {</pre></code><tr><td>95<td><code><pre> if seed == 0 {</pre></code><tr><td>96<td><code><pre> rand.Seed(time.Now().UnixNano())</pre></code><tr><td>97<td><code><pre> } else {</pre></code><tr><td>98<td><code><pre> rand.Seed(seed)</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre> return rand.Read(b)</pre></code><tr><td>101<td><code><pre>}</pre></code></table><div class=funcname id=fn_.Enum>func .Enum</div><div class=info><a href=#s_fn_.Enum>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/enum.go</code>:</div><table class=listing><tr><td>51<td><code><pre>func (e *enumString[T, TS]) Enum(s string) TS {</pre></code><tr><td>52<td><code><pre> s = e.caseSensitivityConv(s)</pre></code><tr><td>53<td><code><pre> if v, ok := e.reversedMapping[s]; ok {</pre></code><tr><td>54<td><code><pre> return SliceConvert(v, e.elemSliceType).(TS)</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre> return nil</pre></code><tr><td>57<td><code><pre>}</pre></code></table><div class=funcname id=fn_IfAny>func IfAny</div><div class=info><a href=#s_fn_IfAny>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/candy.go</code>:</div><table class=listing><tr><td>57<td><code><pre>func IfAny(fnList ...func() bool) {</pre></code><tr><td>58<td><code><pre> for _, fn := range fnList {</pre></code><tr><td>59<td><code><pre> if fn() {</pre></code><tr><td>60<td><code><pre> break</pre></code><tr><td>61<td><code><pre> }</pre></code><tr><td>62<td><code><pre> }</pre></code><tr><td>63<td><code><pre>}</pre></code></table><div class=funcname id=fn_@159:5>func @159:5</div><div class=info><a href=#s_fn_@159:5>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/time.go</code>:</div><table class=listing><tr><td>159<td><code><pre>func() {</pre></code><tr><td>160<td><code><pre> switch {</pre></code><tr><td>161<td><code><pre> case opt.wg != nil:</pre></code><tr><td>162<td><code><pre> opt.wg.Wait()</pre></code><tr><td>163<td><code><pre> }</pre></code><tr><td>164<td><code><pre> wgClosed <- struct{}{}</pre></code><tr><td>165<td><code><pre> }</pre></code></table><div class=funcname id=fn_SliceReverse>func SliceReverse</div><div class=info><a href=#s_fn_SliceReverse>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/slice.go</code>:</div><table class=listing><tr><td>12<td><code><pre>func SliceReverse[T any, TS ~[]T](s TS) {</pre></code><tr><td>13<td><code><pre> for i := len(s)/2 - 1; i >= 0; i-- {</pre></code><tr><td>14<td><code><pre> opp := len(s) - 1 - i</pre></code><tr><td>15<td><code><pre> s[i], s[opp] = s[opp], s[i]</pre></code><tr><td>16<td><code><pre> }</pre></code><tr><td>17<td><code><pre>}</pre></code></table><div class=funcname id=fn_GetGormColumnValue>func GetGormColumnValue</div><div class=info><a href=#s_fn_GetGormColumnValue>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/reflect.go</code>:</div><table class=listing><tr><td>150<td><code><pre>func GetGormColumnValue(data any, column string) (columnVal reflect.Value, ok bool) {</pre></code><tr><td>151<td><code><pre> tagKey := strings.ToUpper(column)</pre></code><tr><td>152<td><code><pre> TraverseValue(data, true, func(field reflect.StructField, value reflect.Value) (end, stepIn bool) {</pre></code><tr><td>153<td><code><pre> if !value.IsValid() {</pre></code><tr><td>154<td><code><pre> return false, false</pre></code><tr><td>155<td><code><pre> }</pre></code><tr><td>156<td><code><pre> if value.Type().Kind() == reflect.Struct {</pre></code><tr><td>157<td><code><pre> return false, true</pre></code><tr><td>158<td><code><pre> }</pre></code><tr><td>159<td><code><pre> tagSetting := schema.ParseTagSetting(field.Tag.Get("gorm"), ";")</pre></code><tr><td>160<td><code><pre> if _, ok := tagSetting[tagKey]; ok || tagSetting["COLUMN"] == column {</pre></code><tr><td>161<td><code><pre> columnVal = value</pre></code><tr><td>162<td><code><pre> end = true</pre></code><tr><td>163<td><code><pre> return</pre></code><tr><td>164<td><code><pre> }</pre></code><tr><td>165<td><code><pre> return</pre></code><tr><td>166<td><code><pre> })</pre></code><tr><td>167<td><code><pre> return</pre></code><tr><td>168<td><code><pre>}</pre></code></table><div class=funcname id=fn_@89:11>func @89:11</div><div class=info><a href=#s_fn_@89:11>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/pool.go</code>:</div><table class=listing><tr><td>89<td><code><pre>func() {</pre></code><tr><td>90<td><code><pre> if p.option.evict == nil || !p.option.evict(obj) {</pre></code><tr><td>91<td><code><pre> p.Put(obj)</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre> }</pre></code></table><div class=funcname id=fn_@182:9>func @182:9</div><div class=info><a href=#s_fn_@182:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>182<td><code><pre>func(o *getCallerOption) {</pre></code><tr><td>183<td><code><pre> for _, pattern := range patterns {</pre></code><tr><td>184<td><code><pre> o.skipRegList = append(o.skipRegList, regexp.MustCompile(pattern))</pre></code><tr><td>185<td><code><pre> }</pre></code><tr><td>186<td><code><pre> }</pre></code></table><div class=funcname id=fn_@190:9>func @190:9</div><div class=info><a href=#s_fn_@190:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>190<td><code><pre>func(o *getCallerOption) {</pre></code><tr><td>191<td><code><pre> for _, pattern := range patterns {</pre></code><tr><td>192<td><code><pre> o.skipGlobList = append(o.skipGlobList, glob.MustCompile(pattern))</pre></code><tr><td>193<td><code><pre> }</pre></code><tr><td>194<td><code><pre> }</pre></code></table><div class=funcname id=fn_.IsValid>func .IsValid</div><div class=info><a href=#s_fn_.IsValid>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/enum.go</code>:</div><table class=listing><tr><td>79<td><code><pre>func (e *enumString[T, TS]) IsValid(t T) bool {</pre></code><tr><td>80<td><code><pre> _, ok := e.mapping[t]</pre></code><tr><td>81<td><code><pre> return ok</pre></code><tr><td>82<td><code><pre>}</pre></code></table><div class=funcname id=fn_MustJsonUnmarshal>func MustJsonUnmarshal</div><div class=info><a href=#s_fn_MustJsonUnmarshal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/marshal.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func MustJsonUnmarshal[T any](s []byte) (t *T) { MustSuccess(json.Unmarshal(s, &t)); return }</pre></code></table><div class=funcname id=fn_NewPool>func NewPool</div><div class=info><a href=#s_fn_NewPool>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/pool.go</code>:</div><table class=listing><tr><td>47<td><code><pre>func NewPool[T any](newFn func() T, opts ...OptionExtender) Poolable[T] {</pre></code><tr><td>48<td><code><pre> opt := ApplyOptions[poolableOption[T]](opts...)</pre></code><tr><td>49<td><code><pre> return &poolSealer[T]{</pre></code><tr><td>50<td><code><pre> option: opt,</pre></code><tr><td>51<td><code><pre> newFn: newFn,</pre></code><tr><td>52<td><code><pre> inner: &sync.Pool{</pre></code><tr><td>53<td><code><pre> New: func() any {</pre></code><tr><td>54<td><code><pre> return any(newFn())</pre></code><tr><td>55<td><code><pre> },</pre></code><tr><td>56<td><code><pre> },</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre>}</pre></code></table><div class=funcname id=fn_OptionFunc[T].applyOption>func OptionFunc[T].applyOption</div><div class=info><a href=#s_fn_OptionFunc[T].applyOption>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/options.go</code>:</div><table class=listing><tr><td>9<td><code><pre>func (o OptionFunc[T]) applyOption(a any) {</pre></code><tr><td>10<td><code><pre> if t, ok := a.(*T); ok {</pre></code><tr><td>11<td><code><pre> o(t)</pre></code><tr><td>12<td><code><pre> }</pre></code><tr><td>13<td><code><pre>}</pre></code></table><div class=funcname id=fn_@176:3>func @176:3</div><div class=info><a href=#s_fn_@176:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>176<td><code><pre>func() bool {</pre></code><tr><td>177<td><code><pre> _, err = Catch(func() { inspect.SetField(source, "src", rand.NewSource(seed)) })</pre></code><tr><td>178<td><code><pre> return err == nil</pre></code><tr><td>179<td><code><pre> }</pre></code></table><div class=funcname id=fn_@34:9>func @34:9</div><div class=info><a href=#s_fn_@34:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>34<td><code><pre>func(a ...any) (t T) {</pre></code><tr><td>35<td><code><pre> ret := runVariadicFunc(fn, a...)</pre></code><tr><td>36<td><code><pre> return ParseVariadicFuncResult[T](ret, 0)</pre></code><tr><td>37<td><code><pre> }</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>193<td><code><pre>func init() {</pre></code><tr><td>194<td><code><pre> rand.Seed(time.Now().Unix())</pre></code><tr><td>195<td><code><pre></pre></code><tr><td>196<td><code><pre> // assert if rand.lockedSource struct is not changed</pre></code><tr><td>197<td><code><pre> newBuiltinLockedSource(1).Int63()</pre></code><tr><td>198<td><code><pre>}</pre></code></table><div class=funcname id=fn_WrapFunc2>func WrapFunc2</div><div class=info><a href=#s_fn_WrapFunc2>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>44<td><code><pre>func WrapFunc2[T1, T2 any](fn any) func(...any) (T1, T2) {</pre></code><tr><td>45<td><code><pre> return func(a ...any) (t1 T1, t2 T2) {</pre></code><tr><td>46<td><code><pre> ret := runVariadicFunc(fn, a...)</pre></code><tr><td>47<td><code><pre> t1 = ParseVariadicFuncResult[T1](ret, 0)</pre></code><tr><td>48<td><code><pre> t2 = ParseVariadicFuncResult[T2](ret, 1)</pre></code><tr><td>49<td><code><pre> return</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre>}</pre></code></table><div class=funcname id=fn_WrapFunc1>func WrapFunc1</div><div class=info><a href=#s_fn_WrapFunc1>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>33<td><code><pre>func WrapFunc1[T any](fn any) func(...any) T {</pre></code><tr><td>34<td><code><pre> return func(a ...any) (t T) {</pre></code><tr><td>35<td><code><pre> ret := runVariadicFunc(fn, a...)</pre></code><tr><td>36<td><code><pre> return ParseVariadicFuncResult[T](ret, 0)</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre>}</pre></code></table><div class=funcname id=fn_@26:9>func @26:9</div><div class=info><a href=#s_fn_@26:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/tag.go</code>:</div><table class=listing><tr><td>26<td><code><pre>func(o *parseTagOption) {</pre></code><tr><td>27<td><code><pre> o.unmarshalType = unmarshalTag</pre></code><tr><td>28<td><code><pre> }</pre></code></table><div class=funcname id=fn_ParseTagUnmarshalType>func ParseTagUnmarshalType</div><div class=info><a href=#s_fn_ParseTagUnmarshalType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/tag.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func ParseTagUnmarshalType(unmarshalTag unmarshalType) OptionFunc[parseTagOption] {</pre></code><tr><td>26<td><code><pre> return func(o *parseTagOption) {</pre></code><tr><td>27<td><code><pre> o.unmarshalType = unmarshalTag</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre>}</pre></code></table><div class=funcname id=fn_@14:9>func @14:9</div><div class=info><a href=#s_fn_@14:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/tag.go</code>:</div><table class=listing><tr><td>14<td><code><pre>func(o *parseTagOption) {</pre></code><tr><td>15<td><code><pre> o.tag = tag</pre></code><tr><td>16<td><code><pre> }</pre></code></table><div class=funcname id=fn_ParseTagName>func ParseTagName</div><div class=info><a href=#s_fn_ParseTagName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/tag.go</code>:</div><table class=listing><tr><td>13<td><code><pre>func ParseTagName(tag string) OptionFunc[parseTagOption] {</pre></code><tr><td>14<td><code><pre> return func(o *parseTagOption) {</pre></code><tr><td>15<td><code><pre> o.tag = tag</pre></code><tr><td>16<td><code><pre> }</pre></code><tr><td>17<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/string.go</code>:</div><table class=listing><tr><td>68<td><code><pre>func init() {</pre></code><tr><td>69<td><code><pre> strcase.ConfigureAcronym("I18n", "i18n")</pre></code><tr><td>70<td><code><pre>}</pre></code></table><div class=funcname id=fn_@43:36>func @43:36</div><div class=info><a href=#s_fn_@43:36>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/string.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func(s string) string { return cases.Title(language.English).String(s) }</pre></code></table><div class=funcname id=fn_@42:36>func @42:36</div><div class=info><a href=#s_fn_@42:36>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/string.go</code>:</div><table class=listing><tr><td>42<td><code><pre>func(s string) string { return strings.ToUpper(s) }</pre></code></table><div class=funcname id=fn_@41:36>func @41:36</div><div class=info><a href=#s_fn_@41:36>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/string.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func(s string) string { return strings.ToLower(s) }</pre></code></table><div class=funcname id=fn_@17:9>func @17:9</div><div class=info><a href=#s_fn_@17:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>17<td><code><pre>func(a ...any) {</pre></code><tr><td>18<td><code><pre> runVariadicFunc(fn, a...)</pre></code><tr><td>19<td><code><pre> }</pre></code></table><div class=funcname id=fn_WrapFunc>func WrapFunc</div><div class=info><a href=#s_fn_WrapFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func WrapFunc(fn any) func(...any) {</pre></code><tr><td>17<td><code><pre> return func(a ...any) {</pre></code><tr><td>18<td><code><pre> runVariadicFunc(fn, a...)</pre></code><tr><td>19<td><code><pre> }</pre></code><tr><td>20<td><code><pre>}</pre></code></table><div class=funcname id=fn_GetFuncName>func GetFuncName</div><div class=info><a href=#s_fn_GetFuncName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>12<td><code><pre>func GetFuncName(fn any) string {</pre></code><tr><td>13<td><code><pre> return runtime.FuncForPC(reflect.ValueOf(fn).Pointer()).Name()</pre></code><tr><td>14<td><code><pre>}</pre></code></table><div class=funcname id=fn_SkipRegexps>func SkipRegexps</div><div class=info><a href=#s_fn_SkipRegexps>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>181<td><code><pre>func SkipRegexps(patterns ...string) OptionFunc[getCallerOption] {</pre></code><tr><td>182<td><code><pre> return func(o *getCallerOption) {</pre></code><tr><td>183<td><code><pre> for _, pattern := range patterns {</pre></code><tr><td>184<td><code><pre> o.skipRegList = append(o.skipRegList, regexp.MustCompile(pattern))</pre></code><tr><td>185<td><code><pre> }</pre></code><tr><td>186<td><code><pre> }</pre></code><tr><td>187<td><code><pre>}</pre></code></table><div class=funcname id=fn_@16:3>func @16:3</div><div class=info><a href=#s_fn_@16:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/pool.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func() *bytes.Buffer { return bytes.NewBuffer(make([]byte, 0, 64)) }</pre></code></table><div class=funcname id=fn_SkipGlobs>func SkipGlobs</div><div class=info><a href=#s_fn_SkipGlobs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>189<td><code><pre>func SkipGlobs(patterns ...string) OptionFunc[getCallerOption] {</pre></code><tr><td>190<td><code><pre> return func(o *getCallerOption) {</pre></code><tr><td>191<td><code><pre> for _, pattern := range patterns {</pre></code><tr><td>192<td><code><pre> o.skipGlobList = append(o.skipGlobList, glob.MustCompile(pattern))</pre></code><tr><td>193<td><code><pre> }</pre></code><tr><td>194<td><code><pre> }</pre></code><tr><td>195<td><code><pre>}</pre></code></table><div class=funcname id=fn_@20:3>func @20:3</div><div class=info><a href=#s_fn_@20:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/pool.go</code>:</div><table class=listing><tr><td>20<td><code><pre>func() poolBytes { return make([]byte, 0, 64) }</pre></code></table><div class=funcname id=fn_SkipKnownDepth>func SkipKnownDepth</div><div class=info><a href=#s_fn_SkipKnownDepth>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>197<td><code><pre>func SkipKnownDepth(minimumCallerDepth int) OptionFunc[getCallerOption] {</pre></code><tr><td>198<td><code><pre> return func(o *getCallerOption) {</pre></code><tr><td>199<td><code><pre> o.minimumCallerDepth = minimumCallerDepth</pre></code><tr><td>200<td><code><pre> }</pre></code><tr><td>201<td><code><pre>}</pre></code></table><div class=funcname id=fn_@198:9>func @198:9</div><div class=info><a href=#s_fn_@198:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>198<td><code><pre>func(o *getCallerOption) {</pre></code><tr><td>199<td><code><pre> o.minimumCallerDepth = minimumCallerDepth</pre></code><tr><td>200<td><code><pre> }</pre></code></table><div class=funcname id=fn_@35:9>func @35:9</div><div class=info><a href=#s_fn_@35:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/pool.go</code>:</div><table class=listing><tr><td>35<td><code><pre>func(o *poolableOption[T]) {</pre></code><tr><td>36<td><code><pre> o.evict = fn</pre></code><tr><td>37<td><code><pre> }</pre></code></table><div class=funcname id=fn_IsStrPtrNotBlank>func IsStrPtrNotBlank</div><div class=info><a href=#s_fn_IsStrPtrNotBlank>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/string.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func IsStrPtrNotBlank(s *string) bool {</pre></code><tr><td>26<td><code><pre> return s != nil && IsStrNotBlank(*s)</pre></code><tr><td>27<td><code><pre>}</pre></code></table><div class=funcname id=fn_IsStrNotBlank>func IsStrNotBlank</div><div class=info><a href=#s_fn_IsStrNotBlank>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/string.go</code>:</div><table class=listing><tr><td>21<td><code><pre>func IsStrNotBlank(s string) bool {</pre></code><tr><td>22<td><code><pre> return !IsStrBlank(s)</pre></code><tr><td>23<td><code><pre>}</pre></code></table><div class=funcname id=fn_IsStrPtrBlank>func IsStrPtrBlank</div><div class=info><a href=#s_fn_IsStrPtrBlank>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/string.go</code>:</div><table class=listing><tr><td>17<td><code><pre>func IsStrPtrBlank(s *string) bool {</pre></code><tr><td>18<td><code><pre> return s == nil || IsStrBlank(*s)</pre></code><tr><td>19<td><code><pre>}</pre></code></table><div class=funcname id=fn_@14:30>func @14:30</div><div class=info><a href=#s_fn_@14:30>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/string.go</code>:</div><table class=listing><tr><td>14<td><code><pre>func(r rune) bool { return !(unicode.IsSpace(r)) }</pre></code></table><div class=funcname id=fn_IsStrBlank>func IsStrBlank</div><div class=info><a href=#s_fn_IsStrBlank>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/string.go</code>:</div><table class=listing><tr><td>13<td><code><pre>func IsStrBlank(s string) bool {</pre></code><tr><td>14<td><code><pre> return strings.IndexFunc(s, func(r rune) bool { return !(unicode.IsSpace(r)) }) < 0</pre></code><tr><td>15<td><code><pre>}</pre></code></table><div class=funcname id=fn_NextJitterIntervalFunc>func NextJitterIntervalFunc</div><div class=info><a href=#s_fn_NextJitterIntervalFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/time.go</code>:</div><table class=listing><tr><td>116<td><code><pre>func NextJitterIntervalFunc(base, max time.Duration, ratio, exp float64, symmetric bool) func() time.Duration {</pre></code><tr><td>117<td><code><pre> return func() (interval time.Duration) {</pre></code><tr><td>118<td><code><pre> // add specified ratio jitter</pre></code><tr><td>119<td><code><pre> if !symmetric {</pre></code><tr><td>120<td><code><pre> // if ratio is 0.5</pre></code><tr><td>121<td><code><pre> // then interval = base + random(0.5*base) <=> [base, 1.5*base)</pre></code><tr><td>122<td><code><pre> // if ratio is 0.1</pre></code><tr><td>123<td><code><pre> // then interval = base + random(0.1*base) <=> [base, 1.1*base)</pre></code><tr><td>124<td><code><pre> _range := float64(base) * ratio * rand.Float64()</pre></code><tr><td>125<td><code><pre> interval = base + time.Duration(_range)</pre></code><tr><td>126<td><code><pre> } else {</pre></code><tr><td>127<td><code><pre> // if ratio is 0.5</pre></code><tr><td>128<td><code><pre> // then interval = base + random(0.5*base) - 0.25*base <=> [0.75*base, 1.25*base)</pre></code><tr><td>129<td><code><pre> // if ratio is 0.1</pre></code><tr><td>130<td><code><pre> // then interval = base + random(0.1*base) - 0.05*base <=> [0.95*base, 1.05*base)</pre></code><tr><td>131<td><code><pre> _range := float64(base) * ratio * rand.Float64()</pre></code><tr><td>132<td><code><pre> interval = base + time.Duration(_range) - time.Duration(float64(base)*(ratio/2))</pre></code><tr><td>133<td><code><pre> }</pre></code><tr><td>134<td><code><pre></pre></code><tr><td>135<td><code><pre> // double and clamp for next time</pre></code><tr><td>136<td><code><pre> base = time.Duration(float64(base) * exp)</pre></code><tr><td>137<td><code><pre> if base > max {</pre></code><tr><td>138<td><code><pre> base = max</pre></code><tr><td>139<td><code><pre> }</pre></code><tr><td>140<td><code><pre> return interval</pre></code><tr><td>141<td><code><pre> }</pre></code><tr><td>142<td><code><pre>}</pre></code></table><div class=funcname id=fn_TimeoutWg>func TimeoutWg</div><div class=info><a href=#s_fn_TimeoutWg>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/time.go</code>:</div><table class=listing><tr><td>150<td><code><pre>func TimeoutWg(wg *sync.WaitGroup) OptionFunc[timeoutOption] {</pre></code><tr><td>151<td><code><pre> return func(o *timeoutOption) {</pre></code><tr><td>152<td><code><pre> o.wg = wg</pre></code><tr><td>153<td><code><pre> }</pre></code><tr><td>154<td><code><pre>}</pre></code></table><div class=funcname id=fn_AnyPtr>func AnyPtr</div><div class=info><a href=#s_fn_AnyPtr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/conv.go</code>:</div><table class=listing><tr><td>145<td><code><pre>func AnyPtr[T any](s T) *T { return &s }</pre></code></table><div class=funcname id=fn_@177:19>func @177:19</div><div class=info><a href=#s_fn_@177:19>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>177<td><code><pre>func() { inspect.SetField(source, "src", rand.NewSource(seed)) }</pre></code></table><div class=funcname id=fn_@53:9>func @53:9</div><div class=info><a href=#s_fn_@53:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/pool.go</code>:</div><table class=listing><tr><td>53<td><code><pre>func() any {</pre></code><tr><td>54<td><code><pre> return any(newFn())</pre></code><tr><td>55<td><code><pre> }</pre></code></table><div class=funcname id=fn_@88:14>func @88:14</div><div class=info><a href=#s_fn_@88:14>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/pool.go</code>:</div><table class=listing><tr><td>88<td><code><pre>func() {</pre></code><tr><td>89<td><code><pre> once.Do(func() {</pre></code><tr><td>90<td><code><pre> if p.option.evict == nil || !p.option.evict(obj) {</pre></code><tr><td>91<td><code><pre> p.Put(obj)</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre> })</pre></code><tr><td>94<td><code><pre> }</pre></code></table><div class=funcname id=fn_SetCtxAny>func SetCtxAny</div><div class=info><a href=#s_fn_SetCtxAny>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/context.go</code>:</div><table class=listing><tr><td>20<td><code><pre>func SetCtxAny[T any](ctx context.Context, key string, val T) context.Context {</pre></code><tr><td>21<td><code><pre> return context.WithValue(ctx, key, val)</pre></code><tr><td>22<td><code><pre>}</pre></code></table><div class=funcname id=fn_@151:9>func @151:9</div><div class=info><a href=#s_fn_@151:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/time.go</code>:</div><table class=listing><tr><td>151<td><code><pre>func(o *timeoutOption) {</pre></code><tr><td>152<td><code><pre> o.wg = wg</pre></code><tr><td>153<td><code><pre> }</pre></code></table><div class=funcname id=fn_poolSealer[T].Put>func poolSealer[T].Put</div><div class=info><a href=#s_fn_poolSealer[T].Put>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/pool.go</code>:</div><table class=listing><tr><td>97<td><code><pre>func (p *poolSealer[T]) Put(obj T) { p.inner.Put(obj) }</pre></code></table><div class=funcname id=fn_poolBytesBufferEvict>func poolBytesBufferEvict</div><div class=info><a href=#s_fn_poolBytesBufferEvict>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/pool.go</code>:</div><table class=listing><tr><td>111<td><code><pre>func poolBytesBufferEvict(b *bytes.Buffer) bool {</pre></code><tr><td>112<td><code><pre> return b.Cap() >= maxBytesPoolable</pre></code><tr><td>113<td><code><pre>}</pre></code></table><div class=funcname id=fn_poolBytesEvict>func poolBytesEvict</div><div class=info><a href=#s_fn_poolBytesEvict>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/pool.go</code>:</div><table class=listing><tr><td>115<td><code><pre>func poolBytesEvict(p poolBytes) bool {</pre></code><tr><td>116<td><code><pre> return cap(p) >= maxBytesPoolable</pre></code><tr><td>117<td><code><pre>}</pre></code></table><div class=funcname id=fn_UUID>func UUID</div><div class=info><a href=#s_fn_UUID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>22<td><code><pre>func UUID() string {</pre></code><tr><td>23<td><code><pre> return uuid.New().String()</pre></code><tr><td>24<td><code><pre>}</pre></code></table><div class=funcname id=fn_MustJsonMarshal>func MustJsonMarshal</div><div class=info><a href=#s_fn_MustJsonMarshal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/marshal.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func MustJsonMarshal(s any) []byte { return Must(json.Marshal(s)) }</pre></code></table><div class=funcname id=fn_ShortUUID>func ShortUUID</div><div class=info><a href=#s_fn_ShortUUID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>33<td><code><pre>func ShortUUID() string {</pre></code><tr><td>34<td><code><pre> return shortuuid.New()</pre></code><tr><td>35<td><code><pre>}</pre></code></table><div class=funcname id=fn_ULID>func ULID</div><div class=info><a href=#s_fn_ULID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func ULID() string {</pre></code><tr><td>39<td><code><pre> return ulid.MustNew(ulid.Now(), cryptoRand.Reader).String()</pre></code><tr><td>40<td><code><pre>}</pre></code></table><div class=funcname id=fn_localIP.String>func localIP.String</div><div class=info><a href=#s_fn_localIP.String>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/ip.go</code>:</div><table class=listing><tr><td>54<td><code><pre>func (l *localIP) String() string {</pre></code><tr><td>55<td><code><pre> return l.str</pre></code><tr><td>56<td><code><pre>}</pre></code></table><div class=funcname id=fn_CryptoRandom>func CryptoRandom</div><div class=info><a href=#s_fn_CryptoRandom>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>59<td><code><pre>func CryptoRandom(b []byte) (n int, err error) {</pre></code><tr><td>60<td><code><pre> return cryptoRand.Read(b)</pre></code><tr><td>61<td><code><pre>}</pre></code></table><div class=funcname id=fn_PoolableEvictFunc>func PoolableEvictFunc</div><div class=info><a href=#s_fn_PoolableEvictFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/pool.go</code>:</div><table class=listing><tr><td>34<td><code><pre>func PoolableEvictFunc[T any](fn func(obj T) bool) OptionFunc[poolableOption[T]] {</pre></code><tr><td>35<td><code><pre> return func(o *poolableOption[T]) {</pre></code><tr><td>36<td><code><pre> o.evict = fn</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre>}</pre></code></table><div class=funcname id=fn_TraverseValue>func TraverseValue</div><div class=info><a href=#s_fn_TraverseValue>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/reflect.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func TraverseValue(data any, indirect bool, handler func(reflect.StructField, reflect.Value) (end, stepIn bool)) {</pre></code><tr><td>44<td><code><pre> v, ok := data.(reflect.Value)</pre></code><tr><td>45<td><code><pre> if !ok {</pre></code><tr><td>46<td><code><pre> v = reflect.ValueOf(data)</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> v = IndirectValue(v)</pre></code><tr><td>49<td><code><pre> l := list.New()</pre></code><tr><td>50<td><code><pre> l.PushBack(v)</pre></code><tr><td>51<td><code><pre>TraverseStruct:</pre></code><tr><td>52<td><code><pre> for l.Len() > 0 {</pre></code><tr><td>53<td><code><pre> e := IndirectValue(l.Remove(l.Front()).(reflect.Value))</pre></code><tr><td>54<td><code><pre> if !e.IsValid() {</pre></code><tr class=miss><td>55<td><code><pre> continue</pre></code><tr><td>56<td><code><pre> }</pre></code><tr><td>57<td><code><pre> t := IndirectType(e.Type())</pre></code><tr><td>58<td><code><pre> switch e.Kind() {</pre></code><tr><td>59<td><code><pre> case reflect.Array, reflect.Slice:</pre></code><tr><td>60<td><code><pre> for i, num := 0, e.Len(); i < num; i++ {</pre></code><tr><td>61<td><code><pre> l.PushBack(e.Index(i))</pre></code><tr><td>62<td><code><pre> }</pre></code><tr><td>63<td><code><pre> case reflect.Map:</pre></code><tr><td>64<td><code><pre> for iter := e.MapRange(); iter.Next(); {</pre></code><tr><td>65<td><code><pre> l.PushBack(iter.Key())</pre></code><tr><td>66<td><code><pre> l.PushBack(iter.Value())</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre> case reflect.Struct:</pre></code><tr><td>69<td><code><pre> for i, num := 0, e.NumField(); i < num; i++ {</pre></code><tr><td>70<td><code><pre> ff := t.Field(i)</pre></code><tr><td>71<td><code><pre> fv := e.Field(i)</pre></code><tr><td>72<td><code><pre> if !fv.IsValid() {</pre></code><tr class=miss><td>73<td><code><pre> continue</pre></code><tr><td>74<td><code><pre> }</pre></code><tr><td>75<td><code><pre> if indirect {</pre></code><tr><td>76<td><code><pre> fv = IndirectValue(fv)</pre></code><tr><td>77<td><code><pre> ff.Type = IndirectType(ff.Type)</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre> end, stepIn := handler(ff, fv)</pre></code><tr><td>80<td><code><pre> if end {</pre></code><tr><td>81<td><code><pre> break TraverseStruct</pre></code><tr><td>82<td><code><pre> }</pre></code><tr><td>83<td><code><pre> if stepIn {</pre></code><tr><td>84<td><code><pre> l.PushBack(fv)</pre></code><tr><td>85<td><code><pre> }</pre></code><tr><td>86<td><code><pre> }</pre></code><tr><td>87<td><code><pre> default:</pre></code><tr><td>88<td><code><pre> // do nothing</pre></code><tr><td>89<td><code><pre> }</pre></code><tr><td>90<td><code><pre> }</pre></code><tr><td>91<td><code><pre>}</pre></code></table><div class=funcname id=fn_@60:9>func @60:9</div><div class=info><a href=#s_fn_@60:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/ip.go</code>:</div><table class=listing><tr><td>60<td><code><pre>func() []byte {</pre></code><tr><td>61<td><code><pre> reverse := func(bs []byte) {</pre></code><tr><td>62<td><code><pre> i, j := 0, len(bs)-1</pre></code><tr><td>63<td><code><pre> for i < j {</pre></code><tr><td>64<td><code><pre> bs[i], bs[j] = bs[j], bs[i]</pre></code><tr><td>65<td><code><pre> i++</pre></code><tr><td>66<td><code><pre> j--</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre></pre></code><tr><td>70<td><code><pre> if ipAddr := ClientIP(); ipAddr != "" {</pre></code><tr><td>71<td><code><pre> realIP := []byte("000000000000")</pre></code><tr><td>72<td><code><pre> idx := 0</pre></code><tr><td>73<td><code><pre> for i := len(ipAddr) - 1; i >= 0; i-- {</pre></code><tr><td>74<td><code><pre> c := ipAddr[i]</pre></code><tr><td>75<td><code><pre> if c == '.' {</pre></code><tr><td>76<td><code><pre> idx = (((idx - 1) / 3) + 1) * 3</pre></code><tr><td>77<td><code><pre> continue</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre> realIP[idx] = c</pre></code><tr><td>80<td><code><pre> idx++</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre> reverse(realIP)</pre></code><tr><td>83<td><code><pre> return realIP</pre></code><tr><td>84<td><code><pre> }</pre></code><tr class=miss><td>85<td><code><pre> return []byte("000000000000")</pre></code><tr><td>86<td><code><pre> }</pre></code></table><div class=funcname id=fn_@152:28>func @152:28</div><div class=info><a href=#s_fn_@152:28>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/reflect.go</code>:</div><table class=listing><tr><td>152<td><code><pre>func(field reflect.StructField, value reflect.Value) (end, stepIn bool) {</pre></code><tr><td>153<td><code><pre> if !value.IsValid() {</pre></code><tr class=miss><td>154<td><code><pre> return false, false</pre></code><tr><td>155<td><code><pre> }</pre></code><tr><td>156<td><code><pre> if value.Type().Kind() == reflect.Struct {</pre></code><tr><td>157<td><code><pre> return false, true</pre></code><tr><td>158<td><code><pre> }</pre></code><tr><td>159<td><code><pre> tagSetting := schema.ParseTagSetting(field.Tag.Get("gorm"), ";")</pre></code><tr><td>160<td><code><pre> if _, ok := tagSetting[tagKey]; ok || tagSetting["COLUMN"] == column {</pre></code><tr><td>161<td><code><pre> columnVal = value</pre></code><tr><td>162<td><code><pre> end = true</pre></code><tr><td>163<td><code><pre> return</pre></code><tr><td>164<td><code><pre> }</pre></code><tr><td>165<td><code><pre> return</pre></code><tr><td>166<td><code><pre> }</pre></code></table><div class=funcname id=fn_EmbedsType>func EmbedsType</div><div class=info><a href=#s_fn_EmbedsType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/reflect.go</code>:</div><table class=listing><tr><td>172<td><code><pre>func EmbedsType(i any, e reflect.Type) bool {</pre></code><tr><td>173<td><code><pre> // given `type A foo { *In }`, this function would return false for</pre></code><tr><td>174<td><code><pre> // embedding dig.In, which makes for some extra error checking in places</pre></code><tr><td>175<td><code><pre> // that call this function. Might be worthwhile to consider reflect.Indirect</pre></code><tr><td>176<td><code><pre> // usage to clean up the callers.</pre></code><tr><td>177<td><code><pre></pre></code><tr><td>178<td><code><pre> if i == nil {</pre></code><tr class=miss><td>179<td><code><pre> return false</pre></code><tr><td>180<td><code><pre> }</pre></code><tr><td>181<td><code><pre></pre></code><tr><td>182<td><code><pre> // maybe it's already a reflect.Type</pre></code><tr><td>183<td><code><pre> t, ok := i.(reflect.Type)</pre></code><tr><td>184<td><code><pre> if !ok {</pre></code><tr><td>185<td><code><pre> // take the type if it's not</pre></code><tr class=miss><td>186<td><code><pre> t = IndirectType(reflect.TypeOf(i))</pre></code><tr><td>187<td><code><pre> }</pre></code><tr><td>188<td><code><pre></pre></code><tr><td>189<td><code><pre> // We are going to do a breadth-first search of all embedded fields.</pre></code><tr><td>190<td><code><pre> types := list.New()</pre></code><tr><td>191<td><code><pre> types.PushBack(t)</pre></code><tr><td>192<td><code><pre> for types.Len() > 0 {</pre></code><tr><td>193<td><code><pre> t := types.Remove(types.Front()).(reflect.Type)</pre></code><tr><td>194<td><code><pre></pre></code><tr><td>195<td><code><pre> if t == e {</pre></code><tr><td>196<td><code><pre> return true</pre></code><tr><td>197<td><code><pre> }</pre></code><tr><td>198<td><code><pre></pre></code><tr><td>199<td><code><pre> if t.Kind() != reflect.Struct {</pre></code><tr><td>200<td><code><pre> continue</pre></code><tr><td>201<td><code><pre> }</pre></code><tr><td>202<td><code><pre></pre></code><tr><td>203<td><code><pre> for i := 0; i < t.NumField(); i++ {</pre></code><tr><td>204<td><code><pre> f := t.Field(i)</pre></code><tr><td>205<td><code><pre> if f.Anonymous {</pre></code><tr><td>206<td><code><pre> types.PushBack(f.Type)</pre></code><tr><td>207<td><code><pre> }</pre></code><tr><td>208<td><code><pre> }</pre></code><tr><td>209<td><code><pre> }</pre></code><tr><td>210<td><code><pre></pre></code><tr><td>211<td><code><pre> return false</pre></code><tr><td>212<td><code><pre>}</pre></code></table><div class=funcname id=fn_runVariadicFunc>func runVariadicFunc</div><div class=info><a href=#s_fn_runVariadicFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>113<td><code><pre>func runVariadicFunc(fn any, a ...any) []reflect.Value {</pre></code><tr><td>114<td><code><pre> var (</pre></code><tr><td>115<td><code><pre> variadic []reflect.Value</pre></code><tr><td>116<td><code><pre> typ = reflect.TypeOf(fn)</pre></code><tr><td>117<td><code><pre> val = reflect.ValueOf(fn)</pre></code><tr><td>118<td><code><pre> numIn = typ.NumIn()</pre></code><tr><td>119<td><code><pre> isVariadic = typ.IsVariadic()</pre></code><tr><td>120<td><code><pre> )</pre></code><tr><td>121<td><code><pre></pre></code><tr><td>122<td><code><pre> if isVariadic {</pre></code><tr><td>123<td><code><pre> b := a[numIn-1:]</pre></code><tr><td>124<td><code><pre> bt := typ.In(numIn - 1).Elem()</pre></code><tr><td>125<td><code><pre> variadic = make([]reflect.Value, 0, len(b))</pre></code><tr><td>126<td><code><pre> for _, param := range b {</pre></code><tr><td>127<td><code><pre> paramVal := reflect.ValueOf(param)</pre></code><tr><td>128<td><code><pre> if paramVal.CanConvert(bt) {</pre></code><tr><td>129<td><code><pre> variadic = append(variadic, paramVal.Convert(bt))</pre></code><tr><td>130<td><code><pre> } else {</pre></code><tr class=miss><td>131<td><code><pre> bo := reflect.New(bt).Elem().Interface()</pre></code><tr class=miss><td>132<td><code><pre> MustSuccess(mapstructure.Decode(param, &bo))</pre></code><tr class=miss><td>133<td><code><pre> variadic = append(variadic, reflect.ValueOf(bo))</pre></code><tr><td>134<td><code><pre> }</pre></code><tr><td>135<td><code><pre> }</pre></code><tr><td>136<td><code><pre> a = a[:numIn-1]</pre></code><tr><td>137<td><code><pre> }</pre></code><tr><td>138<td><code><pre></pre></code><tr><td>139<td><code><pre> in := make([]reflect.Value, 0, len(a)+len(variadic))</pre></code><tr><td>140<td><code><pre> for idx, param := range a {</pre></code><tr><td>141<td><code><pre> pt := typ.In(idx)</pre></code><tr><td>142<td><code><pre> paramVal := reflect.ValueOf(param)</pre></code><tr><td>143<td><code><pre> if paramVal.CanConvert(pt) {</pre></code><tr><td>144<td><code><pre> in = append(in, paramVal.Convert(pt))</pre></code><tr><td>145<td><code><pre> } else {</pre></code><tr><td>146<td><code><pre> po := reflect.New(pt).Elem().Interface()</pre></code><tr><td>147<td><code><pre> MustSuccess(mapstructure.Decode(param, &po))</pre></code><tr><td>148<td><code><pre> in = append(in, reflect.ValueOf(po))</pre></code><tr><td>149<td><code><pre> }</pre></code><tr><td>150<td><code><pre> }</pre></code><tr><td>151<td><code><pre> in = append(in, variadic...)</pre></code><tr><td>152<td><code><pre></pre></code><tr><td>153<td><code><pre> return val.Call(in)</pre></code><tr><td>154<td><code><pre>}</pre></code></table><div class=funcname id=fn_Timeout>func Timeout</div><div class=info><a href=#s_fn_Timeout>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/time.go</code>:</div><table class=listing><tr><td>156<td><code><pre>func Timeout(timeout time.Duration, opts ...OptionExtender) bool {</pre></code><tr><td>157<td><code><pre> opt := ApplyOptions[timeoutOption](opts...)</pre></code><tr><td>158<td><code><pre> wgClosed := make(chan struct{}, 1)</pre></code><tr><td>159<td><code><pre> go func() {</pre></code><tr><td>160<td><code><pre> switch {</pre></code><tr><td>161<td><code><pre> case opt.wg != nil:</pre></code><tr><td>162<td><code><pre> opt.wg.Wait()</pre></code><tr><td>163<td><code><pre> }</pre></code><tr><td>164<td><code><pre> wgClosed <- struct{}{}</pre></code><tr><td>165<td><code><pre> }()</pre></code><tr><td>166<td><code><pre></pre></code><tr><td>167<td><code><pre> timer := time.NewTimer(timeout)</pre></code><tr><td>168<td><code><pre> defer timer.Stop()</pre></code><tr><td>169<td><code><pre> select {</pre></code><tr><td>170<td><code><pre> case <-wgClosed:</pre></code><tr><td>171<td><code><pre> return false</pre></code><tr><td>172<td><code><pre> case <-timer.C:</pre></code><tr class=miss><td>173<td><code><pre> return true</pre></code><tr><td>174<td><code><pre> }</pre></code><tr><td>175<td><code><pre>}</pre></code></table><div class=funcname id=fn_newBuiltinLockedSource>func newBuiltinLockedSource</div><div class=info><a href=#s_fn_newBuiltinLockedSource>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>169<td><code><pre>func newBuiltinLockedSource(seed int64) rand.Source64 {</pre></code><tr><td>170<td><code><pre> t := inspect.TypeOf("math/rand.lockedSource")</pre></code><tr><td>171<td><code><pre> source := reflect.New(t).Interface()</pre></code><tr><td>172<td><code><pre></pre></code><tr><td>173<td><code><pre> var err error</pre></code><tr><td>174<td><code><pre> IfAny(</pre></code><tr><td>175<td><code><pre> // go1.16 - go1.19</pre></code><tr><td>176<td><code><pre> func() bool {</pre></code><tr><td>177<td><code><pre> _, err = Catch(func() { inspect.SetField(source, "src", rand.NewSource(seed)) })</pre></code><tr><td>178<td><code><pre> return err == nil</pre></code><tr><td>179<td><code><pre> },</pre></code><tr><td>180<td><code><pre> // go1.20 - go1.21, source is renamed and set seed when calling rather than constructing stage</pre></code><tr><td>181<td><code><pre> func() bool {</pre></code><tr><td>182<td><code><pre> _, err = Catch(func() { inspect.SetField(source, "s", rand.NewSource(seed)) })</pre></code><tr><td>183<td><code><pre> return err == nil</pre></code><tr><td>184<td><code><pre> },</pre></code><tr><td>185<td><code><pre> )</pre></code><tr><td>186<td><code><pre> if err != nil {</pre></code><tr class=miss><td>187<td><code><pre> panic(err)</pre></code><tr><td>188<td><code><pre> }</pre></code><tr><td>189<td><code><pre></pre></code><tr><td>190<td><code><pre> return source.(rand.Source64)</pre></code><tr><td>191<td><code><pre>}</pre></code></table><div class=funcname id=fn_@11:8>func @11:8</div><div class=info><a href=#s_fn_@11:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/candy.go</code>:</div><table class=listing><tr><td>11<td><code><pre>func() {</pre></code><tr><td>12<td><code><pre> r := recover()</pre></code><tr><td>13<td><code><pre> if r == nil {</pre></code><tr><td>14<td><code><pre> return</pre></code><tr><td>15<td><code><pre> }</pre></code><tr><td>16<td><code><pre></pre></code><tr><td>17<td><code><pre> isPanic = true</pre></code><tr><td>18<td><code><pre> switch v := r.(type) {</pre></code><tr><td>19<td><code><pre> case error:</pre></code><tr><td>20<td><code><pre> err = errors.Wrapf(v, "panic when call Catch function =>\n%s", debug.Stack())</pre></code><tr><td>21<td><code><pre> default:</pre></code><tr class=miss><td>22<td><code><pre> err = errors.Errorf("panic when call Catch function: %s =>\n%s", r, debug.Stack())</pre></code><tr><td>23<td><code><pre> }</pre></code><tr><td>24<td><code><pre> }</pre></code></table><div class=funcname id=fn_Min>func Min</div><div class=info><a href=#s_fn_Min>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compare.go</code>:</div><table class=listing><tr><td>28<td><code><pre>func Min[T constraint.Sortable](arr ...T) T {</pre></code><tr><td>29<td><code><pre> if len(arr) == 0 {</pre></code><tr class=miss><td>30<td><code><pre> panic(ErrEmptyArray)</pre></code><tr><td>31<td><code><pre> }</pre></code><tr><td>32<td><code><pre></pre></code><tr><td>33<td><code><pre> min := arr[0]</pre></code><tr><td>34<td><code><pre> for i := 1; i < len(arr); i++ {</pre></code><tr><td>35<td><code><pre> if arr[i] < min {</pre></code><tr><td>36<td><code><pre> min = arr[i]</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre></pre></code><tr><td>40<td><code><pre> return min</pre></code><tr><td>41<td><code><pre>}</pre></code></table><div class=funcname id=fn_MapKeys>func MapKeys</div><div class=info><a href=#s_fn_MapKeys>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/map.go</code>:</div><table class=listing><tr><td>3<td><code><pre>func MapKeys[T comparable, K any](m map[T]K) (keys []T) {</pre></code><tr><td>4<td><code><pre> if m == nil {</pre></code><tr class=miss><td>5<td><code><pre> return</pre></code><tr><td>6<td><code><pre> }</pre></code><tr><td>7<td><code><pre> keys = make([]T, 0, len(m))</pre></code><tr><td>8<td><code><pre> for key := range m {</pre></code><tr><td>9<td><code><pre> keys = append(keys, key)</pre></code><tr><td>10<td><code><pre> }</pre></code><tr><td>11<td><code><pre> return</pre></code><tr><td>12<td><code><pre>}</pre></code></table><div class=funcname id=fn_ComparableToSortable>func ComparableToSortable</div><div class=info><a href=#s_fn_ComparableToSortable>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/conv.go</code>:</div><table class=listing><tr><td>96<td><code><pre>func ComparableToSortable[T comparable](s T) (d any) {</pre></code><tr><td>97<td><code><pre> val := reflect.ValueOf(s)</pre></code><tr><td>98<td><code><pre> typ := val.Type()</pre></code><tr><td>99<td><code><pre> for _, sortableType := range sortableReflectType {</pre></code><tr><td>100<td><code><pre> if typ.ConvertibleTo(sortableType) {</pre></code><tr><td>101<td><code><pre> return val.Convert(sortableType).Interface()</pre></code><tr><td>102<td><code><pre> }</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre></pre></code><tr class=miss><td>105<td><code><pre> return</pre></code><tr><td>106<td><code><pre>}</pre></code></table><div class=funcname id=fn_IndirectType>func IndirectType</div><div class=info><a href=#s_fn_IndirectType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/reflect.go</code>:</div><table class=listing><tr><td>225<td><code><pre>func IndirectType(s reflect.Type) (d reflect.Type) {</pre></code><tr><td>226<td><code><pre> if s == nil {</pre></code><tr class=miss><td>227<td><code><pre> return s</pre></code><tr><td>228<td><code><pre> }</pre></code><tr><td>229<td><code><pre> d = s</pre></code><tr><td>230<td><code><pre> for d.Kind() == reflect.Ptr {</pre></code><tr><td>231<td><code><pre> d = d.Elem()</pre></code><tr><td>232<td><code><pre> }</pre></code><tr><td>233<td><code><pre> return</pre></code><tr><td>234<td><code><pre>}</pre></code></table><div class=funcname id=fn_MapValues>func MapValues</div><div class=info><a href=#s_fn_MapValues>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/map.go</code>:</div><table class=listing><tr><td>14<td><code><pre>func MapValues[T comparable, K any](m map[T]K) (vals []K) {</pre></code><tr><td>15<td><code><pre> if m == nil {</pre></code><tr class=miss><td>16<td><code><pre> return</pre></code><tr><td>17<td><code><pre> }</pre></code><tr><td>18<td><code><pre> vals = make([]K, 0, len(m))</pre></code><tr><td>19<td><code><pre> for _, val := range m {</pre></code><tr><td>20<td><code><pre> vals = append(vals, val)</pre></code><tr><td>21<td><code><pre> }</pre></code><tr><td>22<td><code><pre> return</pre></code><tr><td>23<td><code><pre>}</pre></code></table><div class=funcname id=fn_IndirectValue>func IndirectValue</div><div class=info><a href=#s_fn_IndirectValue>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/reflect.go</code>:</div><table class=listing><tr><td>214<td><code><pre>func IndirectValue(s reflect.Value) (d reflect.Value) {</pre></code><tr><td>215<td><code><pre> if !s.IsValid() {</pre></code><tr class=miss><td>216<td><code><pre> return s</pre></code><tr><td>217<td><code><pre> }</pre></code><tr><td>218<td><code><pre> d = s</pre></code><tr><td>219<td><code><pre> for d.Kind() == reflect.Ptr {</pre></code><tr><td>220<td><code><pre> d = d.Elem()</pre></code><tr><td>221<td><code><pre> }</pre></code><tr><td>222<td><code><pre> return</pre></code><tr><td>223<td><code><pre>}</pre></code></table><div class=funcname id=fn_.String>func .String</div><div class=info><a href=#s_fn_.String>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/enum.go</code>:</div><table class=listing><tr><td>59<td><code><pre>func (e *enumString[T, TS]) String(k any) string {</pre></code><tr><td>60<td><code><pre> if reflect.TypeOf(k).ConvertibleTo(e.elemType) {</pre></code><tr><td>61<td><code><pre> k = reflect.ValueOf(k).Convert(e.elemType).Interface().(T)</pre></code><tr><td>62<td><code><pre> }</pre></code><tr><td>63<td><code><pre> if t, ok := k.(T); !ok {</pre></code><tr class=miss><td>64<td><code><pre> return fmt.Sprintf("%s(%v)", e.prefix, k)</pre></code><tr><td>65<td><code><pre> } else {</pre></code><tr><td>66<td><code><pre> if v, ok := e.mapping[t]; ok {</pre></code><tr><td>67<td><code><pre> return v</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre> // avoid stack overflow for Stringer implement</pre></code><tr><td>70<td><code><pre> sortable := ComparableToSortable(t)</pre></code><tr><td>71<td><code><pre> if sortable != nil {</pre></code><tr><td>72<td><code><pre> return fmt.Sprintf("%s(%+v)", e.prefix, sortable)</pre></code><tr><td>73<td><code><pre> } else {</pre></code><tr class=miss><td>74<td><code><pre> return fmt.Sprintf("%s(N/A)", e.prefix)</pre></code><tr><td>75<td><code><pre> }</pre></code><tr><td>76<td><code><pre> }</pre></code><tr><td>77<td><code><pre>}</pre></code></table><div class=funcname id=fn_localIP.Bytes>func localIP.Bytes</div><div class=info><a href=#s_fn_localIP.Bytes>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/ip.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func (l *localIP) Bytes() (d []byte) {</pre></code><tr><td>46<td><code><pre> if l.bytes == nil {</pre></code><tr class=miss><td>47<td><code><pre> return</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre> d = make([]byte, len(l.bytes), cap(l.bytes))</pre></code><tr><td>50<td><code><pre> copy(d, l.bytes)</pre></code><tr><td>51<td><code><pre> return</pre></code><tr><td>52<td><code><pre>}</pre></code></table><div class=funcname id=fn_MapValuesByKeys>func MapValuesByKeys</div><div class=info><a href=#s_fn_MapValuesByKeys>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/map.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func MapValuesByKeys[T comparable, K any, TS ~[]T](m map[T]K, keys TS) (vals []K) {</pre></code><tr><td>26<td><code><pre> if m == nil {</pre></code><tr class=miss><td>27<td><code><pre> return</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre> vals = make([]K, 0, len(keys))</pre></code><tr><td>30<td><code><pre> for _, key := range keys {</pre></code><tr><td>31<td><code><pre> val, ok := m[key]</pre></code><tr><td>32<td><code><pre> if !ok {</pre></code><tr class=miss><td>33<td><code><pre> continue</pre></code><tr><td>34<td><code><pre> }</pre></code><tr><td>35<td><code><pre> vals = append(vals, val)</pre></code><tr><td>36<td><code><pre> }</pre></code><tr><td>37<td><code><pre> return</pre></code><tr><td>38<td><code><pre>}</pre></code></table><div class=funcname id=fn_ParseVariadicFuncResult>func ParseVariadicFuncResult</div><div class=info><a href=#s_fn_ParseVariadicFuncResult>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>156<td><code><pre>func ParseVariadicFuncResult[T any](rs []reflect.Value, idx int) (t T) {</pre></code><tr><td>157<td><code><pre> var (</pre></code><tr><td>158<td><code><pre> ok bool</pre></code><tr><td>159<td><code><pre> typ = reflect.TypeOf(t)</pre></code><tr><td>160<td><code><pre> )</pre></code><tr><td>161<td><code><pre> for i := idx; i < len(rs); i++ {</pre></code><tr><td>162<td><code><pre> r := rs[i]</pre></code><tr><td>163<td><code><pre> if !r.IsValid() || r.Type() == nil {</pre></code><tr class=miss><td>164<td><code><pre> continue</pre></code><tr><td>165<td><code><pre> }</pre></code><tr><td>166<td><code><pre> if v := r.Interface(); v != nil {</pre></code><tr><td>167<td><code><pre> if t, ok = v.(T); !ok && typ != nil && reflect.TypeOf(v).ConvertibleTo(typ) {</pre></code><tr class=miss><td>168<td><code><pre> t = r.Convert(typ).Interface().(T)</pre></code><tr><td>169<td><code><pre> }</pre></code><tr><td>170<td><code><pre> }</pre></code><tr><td>171<td><code><pre> }</pre></code><tr><td>172<td><code><pre> return</pre></code><tr><td>173<td><code><pre>}</pre></code></table><div class=funcname id=fn_IsBlank>func IsBlank</div><div class=info><a href=#s_fn_IsBlank>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/reflect.go</code>:</div><table class=listing><tr><td>14<td><code><pre>func IsBlank(object any) bool {</pre></code><tr><td>15<td><code><pre> // get nil case out of the way</pre></code><tr><td>16<td><code><pre> if object == nil {</pre></code><tr class=miss><td>17<td><code><pre> return true</pre></code><tr><td>18<td><code><pre> }</pre></code><tr><td>19<td><code><pre></pre></code><tr><td>20<td><code><pre> objVal, ok := object.(reflect.Value)</pre></code><tr><td>21<td><code><pre> if !ok {</pre></code><tr><td>22<td><code><pre> objVal = reflect.ValueOf(object)</pre></code><tr><td>23<td><code><pre> }</pre></code><tr><td>24<td><code><pre> switch objVal.Kind() {</pre></code><tr><td>25<td><code><pre> // collection types are empty when they have no element</pre></code><tr><td>26<td><code><pre> case reflect.Chan, reflect.Map, reflect.Slice:</pre></code><tr><td>27<td><code><pre> return objVal.Len() == 0</pre></code><tr><td>28<td><code><pre> // pointers are empty if nil or if the value they point to is empty</pre></code><tr><td>29<td><code><pre> case reflect.Ptr:</pre></code><tr><td>30<td><code><pre> if objVal.IsNil() {</pre></code><tr><td>31<td><code><pre> return true</pre></code><tr><td>32<td><code><pre> }</pre></code><tr class=miss><td>33<td><code><pre> deref := objVal.Elem().Interface()</pre></code><tr class=miss><td>34<td><code><pre> return IsBlank(deref)</pre></code><tr><td>35<td><code><pre> // for all other types, compare against the zero value</pre></code><tr><td>36<td><code><pre> // array types are empty when they match their zero-initialized state</pre></code><tr><td>37<td><code><pre> default:</pre></code><tr><td>38<td><code><pre> zero := reflect.Zero(objVal.Type())</pre></code><tr><td>39<td><code><pre> return reflect.DeepEqual(objVal.Interface(), zero.Interface())</pre></code><tr><td>40<td><code><pre> }</pre></code><tr><td>41<td><code><pre>}</pre></code></table><div class=funcname id=fn_@34:29>func @34:29</div><div class=info><a href=#s_fn_@34:29>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/tag.go</code>:</div><table class=listing><tr><td>34<td><code><pre>func(field reflect.StructField, value reflect.Value) (end, stepIn bool) {</pre></code><tr><td>35<td><code><pre> if !value.IsValid() || !value.CanSet() || !value.CanAddr() || !value.CanInterface() {</pre></code><tr class=miss><td>36<td><code><pre> return</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre></pre></code><tr><td>39<td><code><pre> vk := value.Kind()</pre></code><tr><td>40<td><code><pre> stepIn = stepInKinds.Contains(vk) ||</pre></code><tr><td>41<td><code><pre> (vk == reflect.Ptr && value.Elem().IsValid() && value.Elem().Kind() == reflect.Struct)</pre></code><tr><td>42<td><code><pre></pre></code><tr><td>43<td><code><pre> defaultString := field.Tag.Get(opt.tag)</pre></code><tr><td>44<td><code><pre> if IsStrBlank(defaultString) || (!opt.overwrite && !IsBlank(value)) {</pre></code><tr><td>45<td><code><pre> return</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre></pre></code><tr><td>48<td><code><pre> defaultValue := reflect.New(value.Type()).Interface()</pre></code><tr><td>49<td><code><pre> if err = Unmarshal(defaultString, defaultValue, opt.unmarshalType); err != nil {</pre></code><tr class=miss><td>50<td><code><pre> end = true</pre></code><tr class=miss><td>51<td><code><pre> return</pre></code><tr><td>52<td><code><pre> }</pre></code><tr><td>53<td><code><pre> value.Set(reflect.ValueOf(defaultValue).Elem())</pre></code><tr><td>54<td><code><pre> return</pre></code><tr><td>55<td><code><pre> }</pre></code></table><div class=funcname id=fn_poolSealer[T].Get>func poolSealer[T].Get</div><div class=info><a href=#s_fn_poolSealer[T].Get>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/pool.go</code>:</div><table class=listing><tr><td>66<td><code><pre>func (p *poolSealer[T]) Get(initialized any) (T, func()) {</pre></code><tr><td>67<td><code><pre> obj, ok := p.inner.Get().(T)</pre></code><tr><td>68<td><code><pre> if !ok {</pre></code><tr class=miss><td>69<td><code><pre> obj = p.newFn()</pre></code><tr><td>70<td><code><pre> }</pre></code><tr><td>71<td><code><pre></pre></code><tr><td>72<td><code><pre> switch resettable := any(obj).(type) {</pre></code><tr><td>73<td><code><pre> case poolResettableA[T]:</pre></code><tr><td>74<td><code><pre> obj = resettable.Reset(initialized)</pre></code><tr><td>75<td><code><pre> case poolResettableB:</pre></code><tr><td>76<td><code><pre> resettable.Reset()</pre></code><tr><td>77<td><code><pre> case poolResettableC:</pre></code><tr class=miss><td>78<td><code><pre> MustSuccess(resettable.Reset())</pre></code><tr><td>79<td><code><pre> case poolResettableD:</pre></code><tr><td>80<td><code><pre> resettable.Reset(initialized)</pre></code><tr><td>81<td><code><pre> case poolResettableE:</pre></code><tr><td>82<td><code><pre> MustSuccess(resettable.Reset(initialized))</pre></code><tr><td>83<td><code><pre> case poolResettableF[T]:</pre></code><tr class=miss><td>84<td><code><pre> obj = resettable.Reset()</pre></code><tr><td>85<td><code><pre> }</pre></code><tr><td>86<td><code><pre></pre></code><tr><td>87<td><code><pre> once := new(sync.Once)</pre></code><tr><td>88<td><code><pre> return obj, func() {</pre></code><tr><td>89<td><code><pre> once.Do(func() {</pre></code><tr><td>90<td><code><pre> if p.option.evict == nil || !p.option.evict(obj) {</pre></code><tr><td>91<td><code><pre> p.Put(obj)</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre> })</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre>}</pre></code></table><div class=funcname id=fn_Catch>func Catch</div><div class=info><a href=#s_fn_Catch>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/candy.go</code>:</div><table class=listing><tr><td>10<td><code><pre>func Catch(fn any) (isPanic bool, err error) {</pre></code><tr><td>11<td><code><pre> defer func() {</pre></code><tr><td>12<td><code><pre> r := recover()</pre></code><tr><td>13<td><code><pre> if r == nil {</pre></code><tr><td>14<td><code><pre> return</pre></code><tr><td>15<td><code><pre> }</pre></code><tr><td>16<td><code><pre></pre></code><tr><td>17<td><code><pre> isPanic = true</pre></code><tr><td>18<td><code><pre> switch v := r.(type) {</pre></code><tr><td>19<td><code><pre> case error:</pre></code><tr><td>20<td><code><pre> err = errors.Wrapf(v, "panic when call Catch function =>\n%s", debug.Stack())</pre></code><tr><td>21<td><code><pre> default:</pre></code><tr><td>22<td><code><pre> err = errors.Errorf("panic when call Catch function: %s =>\n%s", r, debug.Stack())</pre></code><tr><td>23<td><code><pre> }</pre></code><tr><td>24<td><code><pre> }()</pre></code><tr><td>25<td><code><pre></pre></code><tr><td>26<td><code><pre> // check supported function</pre></code><tr><td>27<td><code><pre> var v any</pre></code><tr><td>28<td><code><pre> switch f := fn.(type) {</pre></code><tr><td>29<td><code><pre> case func():</pre></code><tr><td>30<td><code><pre> f()</pre></code><tr><td>31<td><code><pre> case func() error:</pre></code><tr><td>32<td><code><pre> err = f()</pre></code><tr><td>33<td><code><pre> case func() (any, error):</pre></code><tr class=miss><td>34<td><code><pre> v, err = f()</pre></code><tr><td>35<td><code><pre> default:</pre></code><tr class=miss><td>36<td><code><pre> panic(errors.Errorf("unsupported function signature %T", fn))</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre></pre></code><tr><td>39<td><code><pre> if err != nil {</pre></code><tr><td>40<td><code><pre> return</pre></code><tr><td>41<td><code><pre> }</pre></code><tr><td>42<td><code><pre> if ve, ok := v.(error); ok {</pre></code><tr class=miss><td>43<td><code><pre> err = ve</pre></code><tr><td>44<td><code><pre> }</pre></code><tr><td>45<td><code><pre> return</pre></code><tr><td>46<td><code><pre>}</pre></code></table><div class=funcname id=fn_ClientIP>func ClientIP</div><div class=info><a href=#s_fn_ClientIP>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/ip.go</code>:</div><table class=listing><tr><td>7<td><code><pre>func ClientIP() (ip string) {</pre></code><tr><td>8<td><code><pre> addrs, err := net.InterfaceAddrs()</pre></code><tr><td>9<td><code><pre> if err != nil {</pre></code><tr class=miss><td>10<td><code><pre> panic(err)</pre></code><tr><td>11<td><code><pre> }</pre></code><tr><td>12<td><code><pre></pre></code><tr><td>13<td><code><pre> for _, address := range addrs {</pre></code><tr><td>14<td><code><pre> if addr, ok := address.(*net.IPNet); ok && !addr.IP.IsLoopback() {</pre></code><tr><td>15<td><code><pre> if addr.IP.To4() != nil {</pre></code><tr><td>16<td><code><pre> return addr.IP.String()</pre></code><tr><td>17<td><code><pre> }</pre></code><tr><td>18<td><code><pre></pre></code><tr><td>19<td><code><pre> }</pre></code><tr><td>20<td><code><pre> }</pre></code><tr><td>21<td><code><pre></pre></code><tr class=miss><td>22<td><code><pre> return</pre></code><tr><td>23<td><code><pre>}</pre></code></table><div class=funcname id=fn_CheckIfAny>func CheckIfAny</div><div class=info><a href=#s_fn_CheckIfAny>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/candy.go</code>:</div><table class=listing><tr><td>48<td><code><pre>func CheckIfAny(fnList ...func() error) error {</pre></code><tr><td>49<td><code><pre> for _, fn := range fnList {</pre></code><tr><td>50<td><code><pre> if err := fn(); err != nil {</pre></code><tr class=miss><td>51<td><code><pre> return err</pre></code><tr><td>52<td><code><pre> }</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre> return nil</pre></code><tr><td>55<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewEnumString>func NewEnumString</div><div class=info><a href=#s_fn_NewEnumString>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/enum.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func NewEnumString[T comparable, TS ~[]T](mapping map[T]string, opts ...OptionExtender) Enumerable[T, TS] {</pre></code><tr><td>32<td><code><pre> opt := ApplyOptions[enumStringOption](opts...)</pre></code><tr><td>33<td><code><pre> if len(mapping) == 0 {</pre></code><tr class=miss><td>34<td><code><pre> panic(errors.New("enum mapping is empty"))</pre></code><tr><td>35<td><code><pre> }</pre></code><tr><td>36<td><code><pre> return (&enumString[T, TS]{</pre></code><tr><td>37<td><code><pre> mapping: mapping,</pre></code><tr><td>38<td><code><pre> ignoreCase: opt.ignoreCaseSensitivity,</pre></code><tr><td>39<td><code><pre> }).init()</pre></code><tr><td>40<td><code><pre>}</pre></code></table><div class=funcname id=fn_Max>func Max</div><div class=info><a href=#s_fn_Max>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compare.go</code>:</div><table class=listing><tr><td>13<td><code><pre>func Max[T constraint.Sortable](arr ...T) T {</pre></code><tr><td>14<td><code><pre> if len(arr) == 0 {</pre></code><tr class=miss><td>15<td><code><pre> panic(ErrEmptyArray)</pre></code><tr><td>16<td><code><pre> }</pre></code><tr><td>17<td><code><pre></pre></code><tr><td>18<td><code><pre> max := arr[0]</pre></code><tr><td>19<td><code><pre> for i := 1; i < len(arr); i++ {</pre></code><tr><td>20<td><code><pre> if arr[i] > max {</pre></code><tr class=miss><td>21<td><code><pre> max = arr[i]</pre></code><tr><td>22<td><code><pre> }</pre></code><tr><td>23<td><code><pre> }</pre></code><tr><td>24<td><code><pre></pre></code><tr><td>25<td><code><pre> return max</pre></code><tr><td>26<td><code><pre>}</pre></code></table><div class=funcname id=fn_SliceConvert>func SliceConvert</div><div class=info><a href=#s_fn_SliceConvert>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/conv.go</code>:</div><table class=listing><tr><td>109<td><code><pre>func SliceConvert(src any, dstType reflect.Type) any {</pre></code><tr><td>110<td><code><pre> srcVal := reflect.ValueOf(src)</pre></code><tr><td>111<td><code><pre> srcType := reflect.TypeOf(src)</pre></code><tr><td>112<td><code><pre> dstVal := reflect.Indirect(reflect.New(dstType))</pre></code><tr><td>113<td><code><pre> if srcType.Kind() != reflect.Slice || dstType.Kind() != reflect.Slice {</pre></code><tr class=miss><td>114<td><code><pre> panic(errors.Errorf("src or dst type is invalid [src[%s] dst[%s]]", srcType.Kind(), dstType.Kind()))</pre></code><tr><td>115<td><code><pre> }</pre></code><tr><td>116<td><code><pre></pre></code><tr><td>117<td><code><pre> isInterfaceSlice := false</pre></code><tr><td>118<td><code><pre> srcElemType := srcType.Elem()</pre></code><tr><td>119<td><code><pre> if srcType == constant.AnySliceType {</pre></code><tr class=miss><td>120<td><code><pre> if srcVal.Len() == 0 {</pre></code><tr class=miss><td>121<td><code><pre> return dstVal.Interface()</pre></code><tr><td>122<td><code><pre> }</pre></code><tr class=miss><td>123<td><code><pre> srcElemType = reflect.TypeOf(srcVal.Index(0).Interface())</pre></code><tr class=miss><td>124<td><code><pre> isInterfaceSlice = true</pre></code><tr><td>125<td><code><pre> }</pre></code><tr><td>126<td><code><pre></pre></code><tr><td>127<td><code><pre> dstElemType := dstType.Elem()</pre></code><tr><td>128<td><code><pre> if !srcElemType.ConvertibleTo(dstElemType) {</pre></code><tr class=miss><td>129<td><code><pre> panic(errors.Errorf("src elem is not convertible to dst elem [src[%s] dst[%s]]",</pre></code><tr><td>130<td><code><pre> srcElemType.Kind(), dstElemType.Kind()))</pre></code><tr><td>131<td><code><pre> }</pre></code><tr><td>132<td><code><pre></pre></code><tr><td>133<td><code><pre> length := srcVal.Len()</pre></code><tr><td>134<td><code><pre> for i := 0; i < length; i++ {</pre></code><tr><td>135<td><code><pre> srcElem := srcVal.Index(i)</pre></code><tr><td>136<td><code><pre> if isInterfaceSlice {</pre></code><tr class=miss><td>137<td><code><pre> srcElem = reflect.ValueOf(srcVal.Index(i).Interface())</pre></code><tr><td>138<td><code><pre> }</pre></code><tr><td>139<td><code><pre> dstVal = reflect.Append(dstVal, srcElem.Convert(dstElemType))</pre></code><tr><td>140<td><code><pre> }</pre></code><tr><td>141<td><code><pre></pre></code><tr><td>142<td><code><pre> return dstVal.Interface()</pre></code><tr><td>143<td><code><pre>}</pre></code></table><div class=funcname id=fn_CloseAnyway>func CloseAnyway</div><div class=info><a href=#s_fn_CloseAnyway>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/candy.go</code>:</div><table class=listing><tr><td>88<td><code><pre>func CloseAnyway[T any](closer T) {</pre></code><tr><td>89<td><code><pre> if any(closer) == nil {</pre></code><tr class=miss><td>90<td><code><pre> return</pre></code><tr><td>91<td><code><pre> }</pre></code><tr><td>92<td><code><pre></pre></code><tr><td>93<td><code><pre> switch c := any(closer).(type) {</pre></code><tr><td>94<td><code><pre> case io.Closer:</pre></code><tr><td>95<td><code><pre> _ = c.Close()</pre></code><tr><td>96<td><code><pre> case closerA:</pre></code><tr><td>97<td><code><pre> c.Close()</pre></code><tr><td>98<td><code><pre> case closerB[T]:</pre></code><tr class=miss><td>99<td><code><pre> c.Close()</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre>}</pre></code></table><div class=funcname id=fn_GetTimeStamp>func GetTimeStamp</div><div class=info><a href=#s_fn_GetTimeStamp>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/time.go</code>:</div><table class=listing><tr><td>30<td><code><pre>func GetTimeStamp(t time.Time) int64 {</pre></code><tr><td>31<td><code><pre> if year := t.Year(); year >= maxYear || year < minYear {</pre></code><tr class=miss><td>32<td><code><pre> return t.Unix() * 1e3</pre></code><tr><td>33<td><code><pre> }</pre></code><tr><td>34<td><code><pre> return t.UnixNano() / 1e6</pre></code><tr><td>35<td><code><pre>}</pre></code></table><div class=funcname id=fn_Must>func Must</div><div class=info><a href=#s_fn_Must>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/candy.go</code>:</div><table class=listing><tr><td>71<td><code><pre>func Must[T any](out T, err error) T {</pre></code><tr><td>72<td><code><pre> if err != nil {</pre></code><tr class=miss><td>73<td><code><pre> panic(err)</pre></code><tr><td>74<td><code><pre> }</pre></code><tr><td>75<td><code><pre> return out</pre></code><tr><td>76<td><code><pre>}</pre></code></table><div class=funcname id=fn_.caseSensitivityConv>func .caseSensitivityConv</div><div class=info><a href=#s_fn_.caseSensitivityConv>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/enum.go</code>:</div><table class=listing><tr><td>107<td><code><pre>func (e *enumString[T, TS]) caseSensitivityConv(s string) string {</pre></code><tr><td>108<td><code><pre> if e.ignoreCase {</pre></code><tr class=miss><td>109<td><code><pre> return strings.ToLower(s)</pre></code><tr><td>110<td><code><pre> }</pre></code><tr><td>111<td><code><pre> return s</pre></code><tr><td>112<td><code><pre>}</pre></code></table><div class=funcname id=fn_FlushAnyway>func FlushAnyway</div><div class=info><a href=#s_fn_FlushAnyway>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/candy.go</code>:</div><table class=listing><tr><td>106<td><code><pre>func FlushAnyway[T any](flusher T) {</pre></code><tr><td>107<td><code><pre> if any(flusher) == nil {</pre></code><tr class=miss><td>108<td><code><pre> return</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre></pre></code><tr><td>111<td><code><pre> switch f := any(flusher).(type) {</pre></code><tr><td>112<td><code><pre> case flusherA:</pre></code><tr class=miss><td>113<td><code><pre> f.Flush()</pre></code><tr><td>114<td><code><pre> case flusherB:</pre></code><tr><td>115<td><code><pre> _ = f.Flush()</pre></code><tr><td>116<td><code><pre> }</pre></code><tr><td>117<td><code><pre>}</pre></code></table><div class=funcname id=fn_Unmarshal>func Unmarshal</div><div class=info><a href=#s_fn_Unmarshal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/marshal.go</code>:</div><table class=listing><tr><td>70<td><code><pre>func Unmarshal(s, d any, tag unmarshalType) (err error) {</pre></code><tr><td>71<td><code><pre> switch s.(type) {</pre></code><tr><td>72<td><code><pre> case string, []byte:</pre></code><tr><td>73<td><code><pre> bs, cb := BytesBufferPool.Get(nil)</pre></code><tr><td>74<td><code><pre> defer cb()</pre></code><tr><td>75<td><code><pre> if ss, ok := s.(string); ok {</pre></code><tr><td>76<td><code><pre> bs.WriteString(ss)</pre></code><tr><td>77<td><code><pre> } else {</pre></code><tr><td>78<td><code><pre> bs.Write(s.([]byte))</pre></code><tr><td>79<td><code><pre> }</pre></code><tr><td>80<td><code><pre></pre></code><tr><td>81<td><code><pre> switch tag {</pre></code><tr><td>82<td><code><pre> case UnmarshalTypeJson:</pre></code><tr class=miss><td>83<td><code><pre> return json.NewDecoder(bs).Decode(d)</pre></code><tr><td>84<td><code><pre> case UnmarshalTypeYaml:</pre></code><tr><td>85<td><code><pre> err = yaml.NewDecoder(bs).Decode(d)</pre></code><tr><td>86<td><code><pre> return</pre></code><tr><td>87<td><code><pre> case UnmarshalTypeToml:</pre></code><tr class=miss><td>88<td><code><pre> _, err = toml.NewDecoder(bs).Decode(d)</pre></code><tr class=miss><td>89<td><code><pre> return</pre></code><tr><td>90<td><code><pre> default:</pre></code><tr><td>91<td><code><pre> err = gob.NewDecoder(bs).Decode(d)</pre></code><tr><td>92<td><code><pre> return</pre></code><tr><td>93<td><code><pre> }</pre></code><tr><td>94<td><code><pre> default:</pre></code><tr class=miss><td>95<td><code><pre> cfg := &mapstructure.DecoderConfig{Result: d}</pre></code><tr class=miss><td>96<td><code><pre> if tag != "" {</pre></code><tr class=miss><td>97<td><code><pre> cfg.TagName = string(tag)</pre></code><tr><td>98<td><code><pre> }</pre></code><tr><td>99<td><code><pre></pre></code><tr class=miss><td>100<td><code><pre> var dec *mapstructure.Decoder</pre></code><tr class=miss><td>101<td><code><pre> if dec, err = mapstructure.NewDecoder(cfg); err != nil {</pre></code><tr class=miss><td>102<td><code><pre> return</pre></code><tr><td>103<td><code><pre> }</pre></code><tr class=miss><td>104<td><code><pre> err = dec.Decode(s)</pre></code><tr class=miss><td>105<td><code><pre> return</pre></code><tr><td>106<td><code><pre> }</pre></code><tr><td>107<td><code><pre>}</pre></code></table><div class=funcname id=fn_MustSuccess>func MustSuccess</div><div class=info><a href=#s_fn_MustSuccess>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/candy.go</code>:</div><table class=listing><tr><td>65<td><code><pre>func MustSuccess(err error) {</pre></code><tr><td>66<td><code><pre> if err != nil {</pre></code><tr class=miss><td>67<td><code><pre> panic(err)</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre>}</pre></code></table><div class=funcname id=fn_HostIPInDocker>func HostIPInDocker</div><div class=info><a href=#s_fn_HostIPInDocker>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/ip.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func HostIPInDocker() (ip string) {</pre></code><tr><td>26<td><code><pre> addrs, err := net.LookupIP("host.docker.internal")</pre></code><tr><td>27<td><code><pre> if err != nil {</pre></code><tr><td>28<td><code><pre> return</pre></code><tr><td>29<td><code><pre> }</pre></code><tr><td>30<td><code><pre></pre></code><tr class=miss><td>31<td><code><pre> for _, addr := range addrs {</pre></code><tr class=miss><td>32<td><code><pre> if addr.To4() != nil {</pre></code><tr class=miss><td>33<td><code><pre> return addr.String()</pre></code><tr><td>34<td><code><pre> }</pre></code><tr><td>35<td><code><pre> }</pre></code><tr class=miss><td>36<td><code><pre> return</pre></code><tr><td>37<td><code><pre>}</pre></code></table><div class=funcname id=fn_SortableToGeneric>func SortableToGeneric</div><div class=info><a href=#s_fn_SortableToGeneric>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/conv.go</code>:</div><table class=listing><tr><td>27<td><code><pre>func SortableToGeneric[T, K constraint.Sortable](s T) (d K) {</pre></code><tr><td>28<td><code><pre> switch any(d).(type) {</pre></code><tr><td>29<td><code><pre> case int:</pre></code><tr class=miss><td>30<td><code><pre> return any(cast.ToInt(s)).(K)</pre></code><tr><td>31<td><code><pre> case int8:</pre></code><tr class=miss><td>32<td><code><pre> return any(cast.ToInt8(s)).(K)</pre></code><tr><td>33<td><code><pre> case int16:</pre></code><tr class=miss><td>34<td><code><pre> return any(cast.ToInt16(s)).(K)</pre></code><tr><td>35<td><code><pre> case int32:</pre></code><tr class=miss><td>36<td><code><pre> return any(cast.ToInt32(s)).(K)</pre></code><tr><td>37<td><code><pre> case int64:</pre></code><tr class=miss><td>38<td><code><pre> return any(cast.ToInt64(s)).(K)</pre></code><tr><td>39<td><code><pre> case *int:</pre></code><tr class=miss><td>40<td><code><pre> return any(AnyPtr(cast.ToInt(s))).(K)</pre></code><tr><td>41<td><code><pre> case *int8:</pre></code><tr class=miss><td>42<td><code><pre> return any(AnyPtr(cast.ToInt8(s))).(K)</pre></code><tr><td>43<td><code><pre> case *int16:</pre></code><tr class=miss><td>44<td><code><pre> return any(AnyPtr(cast.ToInt16(s))).(K)</pre></code><tr><td>45<td><code><pre> case *int32:</pre></code><tr class=miss><td>46<td><code><pre> return any(AnyPtr(cast.ToInt32(s))).(K)</pre></code><tr><td>47<td><code><pre> case *int64:</pre></code><tr class=miss><td>48<td><code><pre> return any(AnyPtr(cast.ToInt64(s))).(K)</pre></code><tr><td>49<td><code><pre> case uint:</pre></code><tr class=miss><td>50<td><code><pre> return any(cast.ToUint(s)).(K)</pre></code><tr><td>51<td><code><pre> case uint8:</pre></code><tr class=miss><td>52<td><code><pre> return any(cast.ToUint8(s)).(K)</pre></code><tr><td>53<td><code><pre> case uint16:</pre></code><tr class=miss><td>54<td><code><pre> return any(cast.ToUint16(s)).(K)</pre></code><tr><td>55<td><code><pre> case uint32:</pre></code><tr class=miss><td>56<td><code><pre> return any(cast.ToUint32(s)).(K)</pre></code><tr><td>57<td><code><pre> case uint64:</pre></code><tr class=miss><td>58<td><code><pre> return any(cast.ToUint64(s)).(K)</pre></code><tr><td>59<td><code><pre> case *uint:</pre></code><tr class=miss><td>60<td><code><pre> return any(AnyPtr(cast.ToUint(s))).(K)</pre></code><tr><td>61<td><code><pre> case *uint8:</pre></code><tr class=miss><td>62<td><code><pre> return any(AnyPtr(cast.ToUint8(s))).(K)</pre></code><tr><td>63<td><code><pre> case *uint16:</pre></code><tr class=miss><td>64<td><code><pre> return any(AnyPtr(cast.ToUint16(s))).(K)</pre></code><tr><td>65<td><code><pre> case *uint32:</pre></code><tr class=miss><td>66<td><code><pre> return any(AnyPtr(cast.ToUint32(s))).(K)</pre></code><tr><td>67<td><code><pre> case *uint64:</pre></code><tr class=miss><td>68<td><code><pre> return any(AnyPtr(cast.ToUint64(s))).(K)</pre></code><tr><td>69<td><code><pre> case float32:</pre></code><tr class=miss><td>70<td><code><pre> return any(cast.ToFloat32(s)).(K)</pre></code><tr><td>71<td><code><pre> case float64:</pre></code><tr class=miss><td>72<td><code><pre> return any(cast.ToFloat64(s)).(K)</pre></code><tr><td>73<td><code><pre> case *float32:</pre></code><tr class=miss><td>74<td><code><pre> return any(AnyPtr(cast.ToFloat32(s))).(K)</pre></code><tr><td>75<td><code><pre> case *float64:</pre></code><tr class=miss><td>76<td><code><pre> return any(AnyPtr(cast.ToFloat64(s))).(K)</pre></code><tr><td>77<td><code><pre> case string:</pre></code><tr><td>78<td><code><pre> return any(cast.ToString(s)).(K)</pre></code><tr><td>79<td><code><pre> case *string:</pre></code><tr class=miss><td>80<td><code><pre> return any(AnyPtr(cast.ToString(s))).(K)</pre></code><tr><td>81<td><code><pre> default:</pre></code><tr class=miss><td>82<td><code><pre> panic(errors.Errorf("cannot mapping %T", d))</pre></code><tr><td>83<td><code><pre> }</pre></code><tr><td>84<td><code><pre>}</pre></code></table><div class=funcname id=fn_LoopWithInterval>func LoopWithInterval</div><div class=info><a href=#s_fn_LoopWithInterval>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/time.go</code>:</div><table class=listing><tr><td>71<td><code><pre>func LoopWithInterval(ctx context.Context, interval time.Duration,</pre></code><tr><td>72<td><code><pre> fn func() bool, opts ...OptionExtender) (err error) {</pre></code><tr class=miss><td>73<td><code><pre> var (</pre></code><tr><td>74<td><code><pre> maxTimes uint</pre></code><tr><td>75<td><code><pre> nextInterval func() time.Duration</pre></code><tr><td>76<td><code><pre> )</pre></code><tr><td>77<td><code><pre></pre></code><tr class=miss><td>78<td><code><pre> opt := ApplyOptions[loopWithIntervalOption](opts...)</pre></code><tr class=miss><td>79<td><code><pre> enableJitter := opt.base > 0</pre></code><tr class=miss><td>80<td><code><pre> enableMaxTimes := opt.maxTimes > 0</pre></code><tr class=miss><td>81<td><code><pre> if enableJitter {</pre></code><tr class=miss><td>82<td><code><pre> nextInterval = NextJitterIntervalFunc(opt.base, opt.max, opt.ratio, opt.exp, opt.symmetric)</pre></code><tr class=miss><td>83<td><code><pre> interval = nextInterval()</pre></code><tr><td>84<td><code><pre> }</pre></code><tr class=miss><td>85<td><code><pre> if enableMaxTimes {</pre></code><tr class=miss><td>86<td><code><pre> maxTimes = opt.maxTimes</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre></pre></code><tr class=miss><td>89<td><code><pre> timer := time.NewTimer(interval)</pre></code><tr class=miss><td>90<td><code><pre> defer timer.Stop()</pre></code><tr class=miss><td>91<td><code><pre> for {</pre></code><tr class=miss><td>92<td><code><pre> if fn() {</pre></code><tr class=miss><td>93<td><code><pre> return</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre></pre></code><tr class=miss><td>96<td><code><pre> if enableMaxTimes {</pre></code><tr class=miss><td>97<td><code><pre> if maxTimes--; maxTimes == 0 {</pre></code><tr class=miss><td>98<td><code><pre> return multierr.Append(err, errors.New("exceed the maximum times"))</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre></pre></code><tr><td>102<td><code><pre> // time.Sleep</pre></code><tr class=miss><td>103<td><code><pre> timer.Reset(interval)</pre></code><tr class=miss><td>104<td><code><pre> select {</pre></code><tr><td>105<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>106<td><code><pre> return ctx.Err()</pre></code><tr><td>107<td><code><pre> case <-timer.C:</pre></code><tr class=miss><td>108<td><code><pre> if enableJitter {</pre></code><tr class=miss><td>109<td><code><pre> interval = nextInterval()</pre></code><tr><td>110<td><code><pre> }</pre></code><tr><td>111<td><code><pre> }</pre></code><tr><td>112<td><code><pre> }</pre></code><tr><td>113<td><code><pre>}</pre></code></table><div class=funcname id=fn_Set[T].Equals>func Set[T].Equals</div><div class=info><a href=#s_fn_Set[T].Equals>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sets.go</code>:</div><table class=listing><tr><td>134<td><code><pre>func (s *Set[T]) Equals(o *Set[T]) bool {</pre></code><tr class=miss><td>135<td><code><pre> s.m.RLock()</pre></code><tr class=miss><td>136<td><code><pre> defer s.m.RUnlock()</pre></code><tr><td>137<td><code><pre></pre></code><tr class=miss><td>138<td><code><pre> if s == nil && o == nil {</pre></code><tr class=miss><td>139<td><code><pre> return true</pre></code><tr><td>140<td><code><pre> }</pre></code><tr class=miss><td>141<td><code><pre> if s == nil || o == nil || s.Size() != o.Size() {</pre></code><tr class=miss><td>142<td><code><pre> return false</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre></pre></code><tr class=miss><td>145<td><code><pre> for item := range s.storage {</pre></code><tr class=miss><td>146<td><code><pre> if _, ok := o.storage[item]; !ok {</pre></code><tr class=miss><td>147<td><code><pre> return false</pre></code><tr><td>148<td><code><pre> }</pre></code><tr><td>149<td><code><pre> }</pre></code><tr class=miss><td>150<td><code><pre> for item := range o.storage {</pre></code><tr class=miss><td>151<td><code><pre> if _, ok := s.storage[item]; !ok {</pre></code><tr class=miss><td>152<td><code><pre> return false</pre></code><tr><td>153<td><code><pre> }</pre></code><tr><td>154<td><code><pre> }</pre></code><tr><td>155<td><code><pre></pre></code><tr class=miss><td>156<td><code><pre> return true</pre></code><tr><td>157<td><code><pre>}</pre></code></table><div class=funcname id=fn_Set[T].IntersectsWith>func Set[T].IntersectsWith</div><div class=info><a href=#s_fn_Set[T].IntersectsWith>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sets.go</code>:</div><table class=listing><tr><td>90<td><code><pre>func (s *Set[T]) IntersectsWith(set *Set[T]) bool {</pre></code><tr class=miss><td>91<td><code><pre> s.m.RLock()</pre></code><tr class=miss><td>92<td><code><pre> defer s.m.RUnlock()</pre></code><tr><td>93<td><code><pre></pre></code><tr class=miss><td>94<td><code><pre> src := set.storage</pre></code><tr class=miss><td>95<td><code><pre> dst := s.storage</pre></code><tr class=miss><td>96<td><code><pre> if len(src) > len(dst) {</pre></code><tr class=miss><td>97<td><code><pre> src, dst = dst, src</pre></code><tr><td>98<td><code><pre> }</pre></code><tr class=miss><td>99<td><code><pre> for val := range src {</pre></code><tr class=miss><td>100<td><code><pre> if dst == nil {</pre></code><tr class=miss><td>101<td><code><pre> return false</pre></code><tr><td>102<td><code><pre> }</pre></code><tr class=miss><td>103<td><code><pre> if _, ok := dst[val]; ok {</pre></code><tr class=miss><td>104<td><code><pre> return true</pre></code><tr><td>105<td><code><pre> }</pre></code><tr><td>106<td><code><pre> }</pre></code><tr class=miss><td>107<td><code><pre> return false</pre></code><tr><td>108<td><code><pre>}</pre></code></table><div class=funcname id=fn_SliceSplit>func SliceSplit</div><div class=info><a href=#s_fn_SliceSplit>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/slice.go</code>:</div><table class=listing><tr><td>20<td><code><pre>func SliceSplit[T any, TS ~[]T](arr TS, size int) []TS {</pre></code><tr class=miss><td>21<td><code><pre> if size <= 0 {</pre></code><tr class=miss><td>22<td><code><pre> return []TS{arr}</pre></code><tr><td>23<td><code><pre> }</pre></code><tr><td>24<td><code><pre></pre></code><tr class=miss><td>25<td><code><pre> chunkSet := make([]TS, 0, len(arr)/size+1)</pre></code><tr><td>26<td><code><pre></pre></code><tr class=miss><td>27<td><code><pre> var chunk TS</pre></code><tr class=miss><td>28<td><code><pre> for len(arr) > size {</pre></code><tr class=miss><td>29<td><code><pre> chunk, arr = arr[:size], arr[size:]</pre></code><tr class=miss><td>30<td><code><pre> chunkSet = append(chunkSet, chunk)</pre></code><tr><td>31<td><code><pre> }</pre></code><tr class=miss><td>32<td><code><pre> if len(arr) > 0 {</pre></code><tr class=miss><td>33<td><code><pre> chunkSet = append(chunkSet, arr[:])</pre></code><tr><td>34<td><code><pre> }</pre></code><tr><td>35<td><code><pre></pre></code><tr class=miss><td>36<td><code><pre> return chunkSet</pre></code><tr><td>37<td><code><pre>}</pre></code></table><div class=funcname id=fn_Set[T].Clone>func Set[T].Clone</div><div class=info><a href=#s_fn_Set[T].Clone>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sets.go</code>:</div><table class=listing><tr><td>169<td><code><pre>func (s *Set[T]) Clone() (r *Set[T]) {</pre></code><tr class=miss><td>170<td><code><pre> if s == nil {</pre></code><tr class=miss><td>171<td><code><pre> return</pre></code><tr><td>172<td><code><pre> }</pre></code><tr><td>173<td><code><pre></pre></code><tr class=miss><td>174<td><code><pre> s.m.RLock()</pre></code><tr class=miss><td>175<td><code><pre> defer s.m.RUnlock()</pre></code><tr><td>176<td><code><pre></pre></code><tr class=miss><td>177<td><code><pre> r = NewSet[T]()</pre></code><tr class=miss><td>178<td><code><pre> for _, e := range s.Items() {</pre></code><tr class=miss><td>179<td><code><pre> if elem, ok := any(e).(clonable[T]); ok {</pre></code><tr class=miss><td>180<td><code><pre> r.Insert(elem.Clone())</pre></code><tr><td>181<td><code><pre> } else {</pre></code><tr class=miss><td>182<td><code><pre> r.Insert(clone.Clone(e))</pre></code><tr><td>183<td><code><pre> }</pre></code><tr><td>184<td><code><pre> }</pre></code><tr><td>185<td><code><pre></pre></code><tr class=miss><td>186<td><code><pre> return</pre></code><tr><td>187<td><code><pre>}</pre></code></table><div class=funcname id=fn_@132:28>func @132:28</div><div class=info><a href=#s_fn_@132:28>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/reflect.go</code>:</div><table class=listing><tr><td>132<td><code><pre>func(field reflect.StructField, value reflect.Value) (end, stepIn bool) {</pre></code><tr class=miss><td>133<td><code><pre> if !value.IsValid() {</pre></code><tr class=miss><td>134<td><code><pre> return false, false</pre></code><tr><td>135<td><code><pre> }</pre></code><tr class=miss><td>136<td><code><pre> if value.Type().Kind() == reflect.Struct {</pre></code><tr class=miss><td>137<td><code><pre> return false, true</pre></code><tr><td>138<td><code><pre> }</pre></code><tr class=miss><td>139<td><code><pre> tagV := field.Tag.Get(tag)</pre></code><tr class=miss><td>140<td><code><pre> if pattern.Match([]byte(tagV)) {</pre></code><tr class=miss><td>141<td><code><pre> tagValue = tagV</pre></code><tr class=miss><td>142<td><code><pre> end = true</pre></code><tr class=miss><td>143<td><code><pre> return</pre></code><tr><td>144<td><code><pre> }</pre></code><tr class=miss><td>145<td><code><pre> return</pre></code><tr><td>146<td><code><pre> }</pre></code></table><div class=funcname id=fn_@94:28>func @94:28</div><div class=info><a href=#s_fn_@94:28>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/reflect.go</code>:</div><table class=listing><tr><td>94<td><code><pre>func(field reflect.StructField, value reflect.Value) (end, stepIn bool) {</pre></code><tr class=miss><td>95<td><code><pre> if !value.IsValid() {</pre></code><tr class=miss><td>96<td><code><pre> return false, false</pre></code><tr><td>97<td><code><pre> }</pre></code><tr class=miss><td>98<td><code><pre> if value.Type().Kind() == reflect.Struct {</pre></code><tr class=miss><td>99<td><code><pre> return false, true</pre></code><tr><td>100<td><code><pre> }</pre></code><tr class=miss><td>101<td><code><pre> tagV := field.Tag.Get(tag)</pre></code><tr class=miss><td>102<td><code><pre> if tagV == key {</pre></code><tr class=miss><td>103<td><code><pre> r = value</pre></code><tr class=miss><td>104<td><code><pre> end = true</pre></code><tr class=miss><td>105<td><code><pre> return</pre></code><tr><td>106<td><code><pre> }</pre></code><tr class=miss><td>107<td><code><pre> return</pre></code><tr><td>108<td><code><pre> }</pre></code></table><div class=funcname id=fn_Heap[E].Clone>func Heap[E].Clone</div><div class=info><a href=#s_fn_Heap[E].Clone>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr><td>56<td><code><pre>func (h *Heap[E]) Clone() (r *Heap[E]) {</pre></code><tr class=miss><td>57<td><code><pre> if h == nil {</pre></code><tr class=miss><td>58<td><code><pre> return</pre></code><tr><td>59<td><code><pre> }</pre></code><tr class=miss><td>60<td><code><pre> ret := &_heap[E]{cmp: h.data.cmp, d: make([]E, 0, len(h.data.d))}</pre></code><tr class=miss><td>61<td><code><pre> for _, e := range h.data.d {</pre></code><tr class=miss><td>62<td><code><pre> if elem, ok := any(e).(clonable[E]); ok {</pre></code><tr class=miss><td>63<td><code><pre> ret.d = append(ret.d, elem.Clone())</pre></code><tr><td>64<td><code><pre> } else {</pre></code><tr class=miss><td>65<td><code><pre> ret.d = append(ret.d, clone.Clone(e))</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre> }</pre></code><tr class=miss><td>68<td><code><pre> heap.Init(ret)</pre></code><tr class=miss><td>69<td><code><pre> return &Heap[E]{data: ret}</pre></code><tr><td>70<td><code><pre>}</pre></code></table><div class=funcname id=fn_@114:28>func @114:28</div><div class=info><a href=#s_fn_@114:28>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/reflect.go</code>:</div><table class=listing><tr><td>114<td><code><pre>func(field reflect.StructField, value reflect.Value) (end, stepIn bool) {</pre></code><tr class=miss><td>115<td><code><pre> if !value.IsValid() {</pre></code><tr class=miss><td>116<td><code><pre> return false, false</pre></code><tr><td>117<td><code><pre> }</pre></code><tr class=miss><td>118<td><code><pre> if value.Type().Kind() == reflect.Struct {</pre></code><tr class=miss><td>119<td><code><pre> return false, true</pre></code><tr><td>120<td><code><pre> }</pre></code><tr class=miss><td>121<td><code><pre> if keySet.Contains(field.Tag.Get(tag)) {</pre></code><tr class=miss><td>122<td><code><pre> r = value</pre></code><tr class=miss><td>123<td><code><pre> end = true</pre></code><tr class=miss><td>124<td><code><pre> return</pre></code><tr><td>125<td><code><pre> }</pre></code><tr class=miss><td>126<td><code><pre> return</pre></code><tr><td>127<td><code><pre> }</pre></code></table><div class=funcname id=fn_@100:9>func @100:9</div><div class=info><a href=#s_fn_@100:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>100<td><code><pre>func(a ...any) (t1 T1, t2 T2, t3 T3, t4 T4, t5 T5, t6 T6, t7 T7) {</pre></code><tr class=miss><td>101<td><code><pre> ret := runVariadicFunc(fn, a...)</pre></code><tr class=miss><td>102<td><code><pre> t1 = ParseVariadicFuncResult[T1](ret, 0)</pre></code><tr class=miss><td>103<td><code><pre> t2 = ParseVariadicFuncResult[T2](ret, 1)</pre></code><tr class=miss><td>104<td><code><pre> t3 = ParseVariadicFuncResult[T3](ret, 2)</pre></code><tr class=miss><td>105<td><code><pre> t4 = ParseVariadicFuncResult[T4](ret, 3)</pre></code><tr class=miss><td>106<td><code><pre> t5 = ParseVariadicFuncResult[T5](ret, 4)</pre></code><tr class=miss><td>107<td><code><pre> t6 = ParseVariadicFuncResult[T6](ret, 5)</pre></code><tr class=miss><td>108<td><code><pre> t7 = ParseVariadicFuncResult[T7](ret, 6)</pre></code><tr class=miss><td>109<td><code><pre> return</pre></code><tr><td>110<td><code><pre> }</pre></code></table><div class=funcname id=fn_Set[T].IsSubsetOf>func Set[T].IsSubsetOf</div><div class=info><a href=#s_fn_Set[T].IsSubsetOf>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sets.go</code>:</div><table class=listing><tr><td>72<td><code><pre>func (s *Set[T]) IsSubsetOf(set *Set[T]) bool {</pre></code><tr class=miss><td>73<td><code><pre> s.m.RLock()</pre></code><tr class=miss><td>74<td><code><pre> defer s.m.RUnlock()</pre></code><tr><td>75<td><code><pre></pre></code><tr class=miss><td>76<td><code><pre> for val := range s.storage {</pre></code><tr><td>77<td><code><pre> // The empty set is a subset of all sets, but in common business use,</pre></code><tr><td>78<td><code><pre> // there is rarely such a mathematical interpretation of the empty set being considered as</pre></code><tr><td>79<td><code><pre> // a subset relationship, so false is chosen here.</pre></code><tr class=miss><td>80<td><code><pre> if set == nil {</pre></code><tr class=miss><td>81<td><code><pre> return false</pre></code><tr><td>82<td><code><pre> }</pre></code><tr class=miss><td>83<td><code><pre> if _, ok := set.storage[val]; !ok {</pre></code><tr class=miss><td>84<td><code><pre> return false</pre></code><tr><td>85<td><code><pre> }</pre></code><tr><td>86<td><code><pre> }</pre></code><tr class=miss><td>87<td><code><pre> return true</pre></code><tr><td>88<td><code><pre>}</pre></code></table><div class=funcname id=fn_@87:9>func @87:9</div><div class=info><a href=#s_fn_@87:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>87<td><code><pre>func(a ...any) (t1 T1, t2 T2, t3 T3, t4 T4, t5 T5, t6 T6) {</pre></code><tr class=miss><td>88<td><code><pre> ret := runVariadicFunc(fn, a...)</pre></code><tr class=miss><td>89<td><code><pre> t1 = ParseVariadicFuncResult[T1](ret, 0)</pre></code><tr class=miss><td>90<td><code><pre> t2 = ParseVariadicFuncResult[T2](ret, 1)</pre></code><tr class=miss><td>91<td><code><pre> t3 = ParseVariadicFuncResult[T3](ret, 2)</pre></code><tr class=miss><td>92<td><code><pre> t4 = ParseVariadicFuncResult[T4](ret, 3)</pre></code><tr class=miss><td>93<td><code><pre> t5 = ParseVariadicFuncResult[T5](ret, 4)</pre></code><tr class=miss><td>94<td><code><pre> t6 = ParseVariadicFuncResult[T6](ret, 5)</pre></code><tr class=miss><td>95<td><code><pre> return</pre></code><tr><td>96<td><code><pre> }</pre></code></table><div class=funcname id=fn_CryptoRandomLetterAndNumber>func CryptoRandomLetterAndNumber</div><div class=info><a href=#s_fn_CryptoRandomLetterAndNumber>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>71<td><code><pre>func CryptoRandomLetterAndNumber(n int) (string, error) {</pre></code><tr class=miss><td>72<td><code><pre> b, err := CryptoRandomBytes(n)</pre></code><tr class=miss><td>73<td><code><pre> if err != nil {</pre></code><tr class=miss><td>74<td><code><pre> return "", err</pre></code><tr><td>75<td><code><pre> }</pre></code><tr><td>76<td><code><pre></pre></code><tr class=miss><td>77<td><code><pre> random := make([]byte, 0, n)</pre></code><tr class=miss><td>78<td><code><pre> for i := 0; i < n; i++ {</pre></code><tr class=miss><td>79<td><code><pre> random = append(random, randomChars[b[i]%uint8(randomCharsLength)])</pre></code><tr><td>80<td><code><pre> }</pre></code><tr class=miss><td>81<td><code><pre> return string(random), nil</pre></code><tr><td>82<td><code><pre>}</pre></code></table><div class=funcname id=fn_Heap[E].Copy>func Heap[E].Copy</div><div class=info><a href=#s_fn_Heap[E].Copy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr><td>73<td><code><pre>func (h *Heap[E]) Copy() (r *Heap[E]) {</pre></code><tr class=miss><td>74<td><code><pre> if h == nil {</pre></code><tr class=miss><td>75<td><code><pre> return</pre></code><tr><td>76<td><code><pre> }</pre></code><tr class=miss><td>77<td><code><pre> ret := &_heap[E]{cmp: h.data.cmp}</pre></code><tr class=miss><td>78<td><code><pre> ret.d = make([]E, len(h.data.d))</pre></code><tr class=miss><td>79<td><code><pre> copy(ret.d, h.data.d)</pre></code><tr class=miss><td>80<td><code><pre> heap.Init(ret)</pre></code><tr class=miss><td>81<td><code><pre> return &Heap[E]{data: ret}</pre></code><tr><td>82<td><code><pre>}</pre></code></table><div class=funcname id=fn_CryptoRandomNumbers>func CryptoRandomNumbers</div><div class=info><a href=#s_fn_CryptoRandomNumbers>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>112<td><code><pre>func CryptoRandomNumbers(n int) (string, error) {</pre></code><tr class=miss><td>113<td><code><pre> b, err := CryptoRandomBytes(n)</pre></code><tr class=miss><td>114<td><code><pre> if err != nil {</pre></code><tr class=miss><td>115<td><code><pre> return "", err</pre></code><tr><td>116<td><code><pre> }</pre></code><tr><td>117<td><code><pre></pre></code><tr class=miss><td>118<td><code><pre> random := make([]byte, 0, n)</pre></code><tr class=miss><td>119<td><code><pre> for i := 0; i < n; i++ {</pre></code><tr class=miss><td>120<td><code><pre> random = append(random, randomChars[b[i]%uint8(10)])</pre></code><tr><td>121<td><code><pre> }</pre></code><tr class=miss><td>122<td><code><pre> return string(random), nil</pre></code><tr><td>123<td><code><pre>}</pre></code></table><div class=funcname id=fn_@75:9>func @75:9</div><div class=info><a href=#s_fn_@75:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>75<td><code><pre>func(a ...any) (t1 T1, t2 T2, t3 T3, t4 T4, t5 T5) {</pre></code><tr class=miss><td>76<td><code><pre> ret := runVariadicFunc(fn, a...)</pre></code><tr class=miss><td>77<td><code><pre> t1 = ParseVariadicFuncResult[T1](ret, 0)</pre></code><tr class=miss><td>78<td><code><pre> t2 = ParseVariadicFuncResult[T2](ret, 1)</pre></code><tr class=miss><td>79<td><code><pre> t3 = ParseVariadicFuncResult[T3](ret, 2)</pre></code><tr class=miss><td>80<td><code><pre> t4 = ParseVariadicFuncResult[T4](ret, 3)</pre></code><tr class=miss><td>81<td><code><pre> t5 = ParseVariadicFuncResult[T5](ret, 4)</pre></code><tr class=miss><td>82<td><code><pre> return</pre></code><tr><td>83<td><code><pre> }</pre></code></table><div class=funcname id=fn_@64:9>func @64:9</div><div class=info><a href=#s_fn_@64:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>64<td><code><pre>func(a ...any) (t1 T1, t2 T2, t3 T3, t4 T4) {</pre></code><tr class=miss><td>65<td><code><pre> ret := runVariadicFunc(fn, a...)</pre></code><tr class=miss><td>66<td><code><pre> t1 = ParseVariadicFuncResult[T1](ret, 0)</pre></code><tr class=miss><td>67<td><code><pre> t2 = ParseVariadicFuncResult[T2](ret, 1)</pre></code><tr class=miss><td>68<td><code><pre> t3 = ParseVariadicFuncResult[T3](ret, 2)</pre></code><tr class=miss><td>69<td><code><pre> t4 = ParseVariadicFuncResult[T4](ret, 3)</pre></code><tr class=miss><td>70<td><code><pre> return</pre></code><tr><td>71<td><code><pre> }</pre></code></table><div class=funcname id=fn_JsonStringify[T].MarshalJSON>func JsonStringify[T].MarshalJSON</div><div class=info><a href=#s_fn_JsonStringify[T].MarshalJSON>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/marshal.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func (j *JsonStringify[T]) MarshalJSON() (output []byte, err error) {</pre></code><tr class=miss><td>20<td><code><pre> var buf []byte</pre></code><tr class=miss><td>21<td><code><pre> if buf, err = json.Marshal(j.Value); err != nil {</pre></code><tr class=miss><td>22<td><code><pre> return</pre></code><tr><td>23<td><code><pre> }</pre></code><tr class=miss><td>24<td><code><pre> if output, err = json.Marshal(buf); err != nil {</pre></code><tr class=miss><td>25<td><code><pre> return</pre></code><tr><td>26<td><code><pre> }</pre></code><tr class=miss><td>27<td><code><pre> return</pre></code><tr><td>28<td><code><pre>}</pre></code></table><div class=funcname id=fn_JsonStringify[T].UnmarshalJSON>func JsonStringify[T].UnmarshalJSON</div><div class=info><a href=#s_fn_JsonStringify[T].UnmarshalJSON>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/marshal.go</code>:</div><table class=listing><tr><td>30<td><code><pre>func (j *JsonStringify[T]) UnmarshalJSON(input []byte) (err error) {</pre></code><tr class=miss><td>31<td><code><pre> var buf string</pre></code><tr class=miss><td>32<td><code><pre> if err = json.Unmarshal(input, &buf); err != nil {</pre></code><tr class=miss><td>33<td><code><pre> return</pre></code><tr><td>34<td><code><pre> }</pre></code><tr class=miss><td>35<td><code><pre> if err = json.Unmarshal(UnsafeStringToBytes(buf), &j.Value); err != nil {</pre></code><tr class=miss><td>36<td><code><pre> return</pre></code><tr><td>37<td><code><pre> }</pre></code><tr class=miss><td>38<td><code><pre> return</pre></code><tr><td>39<td><code><pre>}</pre></code></table><div class=funcname id=fn_Set[T].Reject>func Set[T].Reject</div><div class=info><a href=#s_fn_Set[T].Reject>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sets.go</code>:</div><table class=listing><tr><td>110<td><code><pre>func (s *Set[T]) Reject(fn func(T) bool) *Set[T] {</pre></code><tr class=miss><td>111<td><code><pre> s.m.Lock()</pre></code><tr class=miss><td>112<td><code><pre> defer s.m.Unlock()</pre></code><tr><td>113<td><code><pre></pre></code><tr class=miss><td>114<td><code><pre> for key := range s.storage {</pre></code><tr class=miss><td>115<td><code><pre> if fn(key) {</pre></code><tr class=miss><td>116<td><code><pre> delete(s.storage, key)</pre></code><tr><td>117<td><code><pre> }</pre></code><tr><td>118<td><code><pre> }</pre></code><tr class=miss><td>119<td><code><pre> return s</pre></code><tr><td>120<td><code><pre>}</pre></code></table><div class=funcname id=fn_Set[T].Filter>func Set[T].Filter</div><div class=info><a href=#s_fn_Set[T].Filter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sets.go</code>:</div><table class=listing><tr><td>122<td><code><pre>func (s *Set[T]) Filter(fn func(T) bool) *Set[T] {</pre></code><tr class=miss><td>123<td><code><pre> s.m.Lock()</pre></code><tr class=miss><td>124<td><code><pre> defer s.m.Unlock()</pre></code><tr><td>125<td><code><pre></pre></code><tr class=miss><td>126<td><code><pre> for key := range s.storage {</pre></code><tr class=miss><td>127<td><code><pre> if !fn(key) {</pre></code><tr class=miss><td>128<td><code><pre> delete(s.storage, key)</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre> }</pre></code><tr class=miss><td>131<td><code><pre> return s</pre></code><tr><td>132<td><code><pre>}</pre></code></table><div class=funcname id=fn_@54:9>func @54:9</div><div class=info><a href=#s_fn_@54:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>54<td><code><pre>func(a ...any) (t1 T1, t2 T2, t3 T3) {</pre></code><tr class=miss><td>55<td><code><pre> ret := runVariadicFunc(fn, a...)</pre></code><tr class=miss><td>56<td><code><pre> t1 = ParseVariadicFuncResult[T1](ret, 0)</pre></code><tr class=miss><td>57<td><code><pre> t2 = ParseVariadicFuncResult[T2](ret, 1)</pre></code><tr class=miss><td>58<td><code><pre> t3 = ParseVariadicFuncResult[T3](ret, 2)</pre></code><tr class=miss><td>59<td><code><pre> return</pre></code><tr><td>60<td><code><pre> }</pre></code></table><div class=funcname id=fn_@54:9>func @54:9</div><div class=info><a href=#s_fn_@54:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/time.go</code>:</div><table class=listing><tr><td>54<td><code><pre>func(o *loopWithIntervalOption) {</pre></code><tr class=miss><td>55<td><code><pre> o.base = base</pre></code><tr class=miss><td>56<td><code><pre> o.max = max</pre></code><tr class=miss><td>57<td><code><pre> o.ratio = ratio</pre></code><tr class=miss><td>58<td><code><pre> o.exp = exp</pre></code><tr class=miss><td>59<td><code><pre> o.symmetric = symmetric</pre></code><tr><td>60<td><code><pre> }</pre></code></table><div class=funcname id=fn_RandomNumbers>func RandomNumbers</div><div class=info><a href=#s_fn_RandomNumbers>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>103<td><code><pre>func RandomNumbers(n int) string {</pre></code><tr class=miss><td>104<td><code><pre> rand.Seed(time.Now().UnixNano())</pre></code><tr class=miss><td>105<td><code><pre> ret := ""</pre></code><tr class=miss><td>106<td><code><pre> for i := 0; i < n; i++ {</pre></code><tr class=miss><td>107<td><code><pre> ret += strconv.Itoa(rand.Intn(10))</pre></code><tr><td>108<td><code><pre> }</pre></code><tr class=miss><td>109<td><code><pre> return ret</pre></code><tr><td>110<td><code><pre>}</pre></code></table><div class=funcname id=fn_InvalidUnmarshalError.Error>func InvalidUnmarshalError.Error</div><div class=info><a href=#s_fn_InvalidUnmarshalError.Error>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/marshal.go</code>:</div><table class=listing><tr><td>59<td><code><pre>func (e *InvalidUnmarshalError) Error() string {</pre></code><tr class=miss><td>60<td><code><pre> if e.Type == nil {</pre></code><tr class=miss><td>61<td><code><pre> return "common/utils: Unmarshal(nil)"</pre></code><tr><td>62<td><code><pre> }</pre></code><tr><td>63<td><code><pre></pre></code><tr class=miss><td>64<td><code><pre> if e.Type.Kind() != reflect.Pointer {</pre></code><tr class=miss><td>65<td><code><pre> return "common/utils: Unmarshal(non-pointer " + e.Type.String() + ")"</pre></code><tr><td>66<td><code><pre> }</pre></code><tr class=miss><td>67<td><code><pre> return "common/utils: Unmarshal(nil " + e.Type.String() + ")"</pre></code><tr><td>68<td><code><pre>}</pre></code></table><div class=funcname id=fn_Set[T].Copy>func Set[T].Copy</div><div class=info><a href=#s_fn_Set[T].Copy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sets.go</code>:</div><table class=listing><tr><td>159<td><code><pre>func (s *Set[T]) Copy() (r *Set[T]) {</pre></code><tr class=miss><td>160<td><code><pre> if s == nil {</pre></code><tr class=miss><td>161<td><code><pre> return</pre></code><tr><td>162<td><code><pre> }</pre></code><tr><td>163<td><code><pre></pre></code><tr class=miss><td>164<td><code><pre> s.m.RLock()</pre></code><tr class=miss><td>165<td><code><pre> defer s.m.RUnlock()</pre></code><tr class=miss><td>166<td><code><pre> return NewSet(s.Items()...)</pre></code><tr><td>167<td><code><pre>}</pre></code></table><div class=funcname id=fn_@23:9>func @23:9</div><div class=info><a href=#s_fn_@23:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>23<td><code><pre>func(a ...any) (b []any) {</pre></code><tr class=miss><td>24<td><code><pre> ret := runVariadicFunc(fn, a...)</pre></code><tr class=miss><td>25<td><code><pre> b = make([]any, 0, len(b))</pre></code><tr class=miss><td>26<td><code><pre> for i := 0; i < len(ret); i++ {</pre></code><tr class=miss><td>27<td><code><pre> b = append(b, ret[i].Interface())</pre></code><tr><td>28<td><code><pre> }</pre></code><tr class=miss><td>29<td><code><pre> return</pre></code><tr><td>30<td><code><pre> }</pre></code></table><div class=funcname id=fn_MapSliceToMap>func MapSliceToMap</div><div class=info><a href=#s_fn_MapSliceToMap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/map.go</code>:</div><table class=listing><tr><td>51<td><code><pre>func MapSliceToMap[T comparable, K any](s []map[T]K) (d map[T]K) {</pre></code><tr class=miss><td>52<td><code><pre> d = make(map[T]K, len(s))</pre></code><tr class=miss><td>53<td><code><pre> for _, kv := range s {</pre></code><tr class=miss><td>54<td><code><pre> for k, v := range kv {</pre></code><tr class=miss><td>55<td><code><pre> d[k] = v</pre></code><tr><td>56<td><code><pre> }</pre></code><tr><td>57<td><code><pre> }</pre></code><tr class=miss><td>58<td><code><pre> return</pre></code><tr><td>59<td><code><pre>}</pre></code></table><div class=funcname id=fn_CryptoRandomBytes>func CryptoRandomBytes</div><div class=info><a href=#s_fn_CryptoRandomBytes>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>63<td><code><pre>func CryptoRandomBytes(size int) ([]byte, error) {</pre></code><tr class=miss><td>64<td><code><pre> b := make([]byte, size)</pre></code><tr class=miss><td>65<td><code><pre> if _, err := cryptoRand.Read(b); err != nil {</pre></code><tr class=miss><td>66<td><code><pre> return nil, err</pre></code><tr><td>67<td><code><pre> }</pre></code><tr class=miss><td>68<td><code><pre> return b, nil</pre></code><tr><td>69<td><code><pre>}</pre></code></table><div class=funcname id=fn_SliceRemove>func SliceRemove</div><div class=info><a href=#s_fn_SliceRemove>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/slice.go</code>:</div><table class=listing><tr><td>3<td><code><pre>func SliceRemove[T any, TS ~[]T](s TS, filter func(t T) bool) (d TS) {</pre></code><tr class=miss><td>4<td><code><pre> for i := len(s) - 1; i >= 0; i-- {</pre></code><tr class=miss><td>5<td><code><pre> if filter(s[i]) {</pre></code><tr class=miss><td>6<td><code><pre> s = append(s[:i], s[i+1:]...)</pre></code><tr><td>7<td><code><pre> }</pre></code><tr><td>8<td><code><pre> }</pre></code><tr class=miss><td>9<td><code><pre> return s</pre></code><tr><td>10<td><code><pre>}</pre></code></table><div class=funcname id=fn_DecimalPlaces>func DecimalPlaces</div><div class=info><a href=#s_fn_DecimalPlaces>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/number.go</code>:</div><table class=listing><tr><td>9<td><code><pre>func DecimalPlaces(num float64) int {</pre></code><tr class=miss><td>10<td><code><pre> str := strconv.FormatFloat(num, 'f', -1, 64)</pre></code><tr class=miss><td>11<td><code><pre> if i := strings.LastIndex(str, "."); i >= 0 {</pre></code><tr class=miss><td>12<td><code><pre> return len(str[i+1:])</pre></code><tr><td>13<td><code><pre> }</pre></code><tr class=miss><td>14<td><code><pre> return 0</pre></code><tr><td>15<td><code><pre>}</pre></code></table><div class=funcname id=fn_UUID20>func UUID20</div><div class=info><a href=#s_fn_UUID20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>42<td><code><pre>func UUID20() string {</pre></code><tr class=miss><td>43<td><code><pre> id := uuid.New()</pre></code><tr class=miss><td>44<td><code><pre> t := make([]byte, ascii85.MaxEncodedLen(len(id)))</pre></code><tr class=miss><td>45<td><code><pre> n := ascii85.Encode(t, id[:])</pre></code><tr class=miss><td>46<td><code><pre> return string(t[:n])</pre></code><tr><td>47<td><code><pre>}</pre></code></table><div class=funcname id=fn_Heap[E].Element>func Heap[E].Element</div><div class=info><a href=#s_fn_Heap[E].Element>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr><td>39<td><code><pre>func (h *Heap[E]) Element(index int) (e E, err error) {</pre></code><tr class=miss><td>40<td><code><pre> if index < 0 || index >= h.data.Len() {</pre></code><tr class=miss><td>41<td><code><pre> return e, ErrOutOfRange</pre></code><tr><td>42<td><code><pre> }</pre></code><tr class=miss><td>43<td><code><pre> return h.data.d[index], nil</pre></code><tr><td>44<td><code><pre>}</pre></code></table><div class=funcname id=fn_IsInRange>func IsInRange</div><div class=info><a href=#s_fn_IsInRange>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compare.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func IsInRange[T constraint.Sortable](num, min, max T) bool {</pre></code><tr class=miss><td>44<td><code><pre> if num < min || num > max {</pre></code><tr class=miss><td>45<td><code><pre> return false</pre></code><tr><td>46<td><code><pre> }</pre></code><tr class=miss><td>47<td><code><pre> return true</pre></code><tr><td>48<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewHeap>func NewHeap</div><div class=info><a href=#s_fn_NewHeap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr><td>85<td><code><pre>func NewHeap[E any](t []E, cmp func(e1, e2 E) bool) *Heap[E] {</pre></code><tr class=miss><td>86<td><code><pre> ret := &_heap[E]{d: t, cmp: cmp}</pre></code><tr class=miss><td>87<td><code><pre> heap.Init(ret)</pre></code><tr class=miss><td>88<td><code><pre> return &Heap[E]{data: ret}</pre></code><tr><td>89<td><code><pre>}</pre></code></table><div class=funcname id=fn_MustOk>func MustOk</div><div class=info><a href=#s_fn_MustOk>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/candy.go</code>:</div><table class=listing><tr><td>78<td><code><pre>func MustOk[T any](out T, ok bool) T {</pre></code><tr class=miss><td>79<td><code><pre> if !ok {</pre></code><tr class=miss><td>80<td><code><pre> panic(errors.Errorf("get %T with ok is false", out))</pre></code><tr><td>81<td><code><pre> }</pre></code><tr class=miss><td>82<td><code><pre> return out</pre></code><tr><td>83<td><code><pre>}</pre></code></table><div class=funcname id=fn_Set[T].Size>func Set[T].Size</div><div class=info><a href=#s_fn_Set[T].Size>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sets.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func (s *Set[T]) Size() int {</pre></code><tr class=miss><td>26<td><code><pre> s.m.RLock()</pre></code><tr class=miss><td>27<td><code><pre> defer s.m.RUnlock()</pre></code><tr class=miss><td>28<td><code><pre> return len(s.storage)</pre></code><tr><td>29<td><code><pre>}</pre></code></table><div class=funcname id=fn_GetFieldByTagWithKeys>func GetFieldByTagWithKeys</div><div class=info><a href=#s_fn_GetFieldByTagWithKeys>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/reflect.go</code>:</div><table class=listing><tr><td>112<td><code><pre>func GetFieldByTagWithKeys(data any, tag string, keys []string) (r reflect.Value, e error) {</pre></code><tr class=miss><td>113<td><code><pre> keySet := NewSet[string](keys...)</pre></code><tr class=miss><td>114<td><code><pre> TraverseValue(data, true, func(field reflect.StructField, value reflect.Value) (end, stepIn bool) {</pre></code><tr><td>115<td><code><pre> if !value.IsValid() {</pre></code><tr><td>116<td><code><pre> return false, false</pre></code><tr><td>117<td><code><pre> }</pre></code><tr><td>118<td><code><pre> if value.Type().Kind() == reflect.Struct {</pre></code><tr><td>119<td><code><pre> return false, true</pre></code><tr><td>120<td><code><pre> }</pre></code><tr><td>121<td><code><pre> if keySet.Contains(field.Tag.Get(tag)) {</pre></code><tr><td>122<td><code><pre> r = value</pre></code><tr><td>123<td><code><pre> end = true</pre></code><tr><td>124<td><code><pre> return</pre></code><tr><td>125<td><code><pre> }</pre></code><tr><td>126<td><code><pre> return</pre></code><tr><td>127<td><code><pre> })</pre></code><tr class=miss><td>128<td><code><pre> return</pre></code><tr><td>129<td><code><pre>}</pre></code></table><div class=funcname id=fn__heap[E].Pop>func _heap[E].Pop</div><div class=info><a href=#s_fn__heap[E].Pop>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr class=miss><td>23<td><code><pre>func (h *_heap[E]) Pop() (x any) { x, h.d = h.d[len(h.d)-1], h.d[0:len(h.d)-1]; return x }</pre></code></table><div class=funcname id=fn_GetFieldTagValue>func GetFieldTagValue</div><div class=info><a href=#s_fn_GetFieldTagValue>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/reflect.go</code>:</div><table class=listing><tr><td>131<td><code><pre>func GetFieldTagValue(data any, tag string, pattern *regexp.Regexp) (tagValue string, e error) {</pre></code><tr class=miss><td>132<td><code><pre> TraverseValue(data, true, func(field reflect.StructField, value reflect.Value) (end, stepIn bool) {</pre></code><tr><td>133<td><code><pre> if !value.IsValid() {</pre></code><tr><td>134<td><code><pre> return false, false</pre></code><tr><td>135<td><code><pre> }</pre></code><tr><td>136<td><code><pre> if value.Type().Kind() == reflect.Struct {</pre></code><tr><td>137<td><code><pre> return false, true</pre></code><tr><td>138<td><code><pre> }</pre></code><tr><td>139<td><code><pre> tagV := field.Tag.Get(tag)</pre></code><tr><td>140<td><code><pre> if pattern.Match([]byte(tagV)) {</pre></code><tr><td>141<td><code><pre> tagValue = tagV</pre></code><tr><td>142<td><code><pre> end = true</pre></code><tr><td>143<td><code><pre> return</pre></code><tr><td>144<td><code><pre> }</pre></code><tr><td>145<td><code><pre> return</pre></code><tr><td>146<td><code><pre> })</pre></code><tr class=miss><td>147<td><code><pre> return</pre></code><tr><td>148<td><code><pre>}</pre></code></table><div class=funcname id=fn_@29:3>func @29:3</div><div class=info><a href=#s_fn_@29:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/number.go</code>:</div><table class=listing><tr class=miss><td>29<td><code><pre>func() bool { result = uint8(num); return IsInRange(num, 0, math.MaxUint8) }</pre></code></table><div class=funcname id=fn_IntNarrow>func IntNarrow</div><div class=info><a href=#s_fn_IntNarrow>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/number.go</code>:</div><table class=listing><tr><td>17<td><code><pre>func IntNarrow(num int) (result any) {</pre></code><tr class=miss><td>18<td><code><pre> IfAny(</pre></code><tr><td>19<td><code><pre> func() bool { result = int8(num); return IsInRange(num, math.MinInt8, math.MaxInt8) },</pre></code><tr><td>20<td><code><pre> func() bool { result = int16(num); return IsInRange(num, math.MinInt16, math.MaxInt16) },</pre></code><tr><td>21<td><code><pre> func() bool { result = int32(num); return IsInRange(num, math.MinInt32, math.MaxInt32) },</pre></code><tr><td>22<td><code><pre> func() bool { result = int64(num); return IsInRange(num, math.MinInt64, math.MaxInt64) },</pre></code><tr><td>23<td><code><pre> )</pre></code><tr class=miss><td>24<td><code><pre> return</pre></code><tr><td>25<td><code><pre>}</pre></code></table><div class=funcname id=fn_@30:3>func @30:3</div><div class=info><a href=#s_fn_@30:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/number.go</code>:</div><table class=listing><tr class=miss><td>30<td><code><pre>func() bool { result = uint16(num); return IsInRange(num, 0, math.MaxUint16) }</pre></code></table><div class=funcname id=fn_UUID22>func UUID22</div><div class=info><a href=#s_fn_UUID22>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func UUID22() string {</pre></code><tr class=miss><td>50<td><code><pre> id := uuid.New()</pre></code><tr class=miss><td>51<td><code><pre> return base64.RawURLEncoding.EncodeToString(id[:])</pre></code><tr><td>52<td><code><pre>}</pre></code></table><div class=funcname id=fn_@21:3>func @21:3</div><div class=info><a href=#s_fn_@21:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/number.go</code>:</div><table class=listing><tr class=miss><td>21<td><code><pre>func() bool { result = int32(num); return IsInRange(num, math.MinInt32, math.MaxInt32) }</pre></code></table><div class=funcname id=fn_GetFieldByTag>func GetFieldByTag</div><div class=info><a href=#s_fn_GetFieldByTag>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/reflect.go</code>:</div><table class=listing><tr><td>93<td><code><pre>func GetFieldByTag(data any, tag, key string) (r reflect.Value, e error) {</pre></code><tr class=miss><td>94<td><code><pre> TraverseValue(data, true, func(field reflect.StructField, value reflect.Value) (end, stepIn bool) {</pre></code><tr><td>95<td><code><pre> if !value.IsValid() {</pre></code><tr><td>96<td><code><pre> return false, false</pre></code><tr><td>97<td><code><pre> }</pre></code><tr><td>98<td><code><pre> if value.Type().Kind() == reflect.Struct {</pre></code><tr><td>99<td><code><pre> return false, true</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre> tagV := field.Tag.Get(tag)</pre></code><tr><td>102<td><code><pre> if tagV == key {</pre></code><tr><td>103<td><code><pre> r = value</pre></code><tr><td>104<td><code><pre> end = true</pre></code><tr><td>105<td><code><pre> return</pre></code><tr><td>106<td><code><pre> }</pre></code><tr><td>107<td><code><pre> return</pre></code><tr><td>108<td><code><pre> })</pre></code><tr class=miss><td>109<td><code><pre> return</pre></code><tr><td>110<td><code><pre>}</pre></code></table><div class=funcname id=fn__heap[E].Push>func _heap[E].Push</div><div class=info><a href=#s_fn__heap[E].Push>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr class=miss><td>22<td><code><pre>func (h *_heap[E]) Push(x any) { v := append(h.d, x.(E)); h.d = v }</pre></code></table><div class=funcname id=fn_@19:3>func @19:3</div><div class=info><a href=#s_fn_@19:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/number.go</code>:</div><table class=listing><tr class=miss><td>19<td><code><pre>func() bool { result = int8(num); return IsInRange(num, math.MinInt8, math.MaxInt8) }</pre></code></table><div class=funcname id=fn_@20:3>func @20:3</div><div class=info><a href=#s_fn_@20:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/number.go</code>:</div><table class=listing><tr class=miss><td>20<td><code><pre>func() bool { result = int16(num); return IsInRange(num, math.MinInt16, math.MaxInt16) }</pre></code></table><div class=funcname id=fn_@32:3>func @32:3</div><div class=info><a href=#s_fn_@32:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/number.go</code>:</div><table class=listing><tr class=miss><td>32<td><code><pre>func() bool { result = uint64(num); return IsInRange(num, 0, math.MaxUint64) }</pre></code></table><div class=funcname id=fn_IsValidTimestamp>func IsValidTimestamp</div><div class=info><a href=#s_fn_IsValidTimestamp>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/time.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func IsValidTimestamp(timeMS int64) bool {</pre></code><tr class=miss><td>39<td><code><pre> year := GetTime(timeMS).Year()</pre></code><tr class=miss><td>40<td><code><pre> return year >= minYear && year < maxYear</pre></code><tr><td>41<td><code><pre>}</pre></code></table><div class=funcname id=fn_@31:3>func @31:3</div><div class=info><a href=#s_fn_@31:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/number.go</code>:</div><table class=listing><tr class=miss><td>31<td><code><pre>func() bool { result = uint32(num); return IsInRange(num, 0, math.MaxUint32) }</pre></code></table><div class=funcname id=fn_@181:3>func @181:3</div><div class=info><a href=#s_fn_@181:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>181<td><code><pre>func() bool {</pre></code><tr class=miss><td>182<td><code><pre> _, err = Catch(func() { inspect.SetField(source, "s", rand.NewSource(seed)) })</pre></code><tr class=miss><td>183<td><code><pre> return err == nil</pre></code><tr><td>184<td><code><pre> }</pre></code></table><div class=funcname id=fn_UintNarrow>func UintNarrow</div><div class=info><a href=#s_fn_UintNarrow>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/number.go</code>:</div><table class=listing><tr><td>27<td><code><pre>func UintNarrow(num uint) (result any) {</pre></code><tr class=miss><td>28<td><code><pre> IfAny(</pre></code><tr><td>29<td><code><pre> func() bool { result = uint8(num); return IsInRange(num, 0, math.MaxUint8) },</pre></code><tr><td>30<td><code><pre> func() bool { result = uint16(num); return IsInRange(num, 0, math.MaxUint16) },</pre></code><tr><td>31<td><code><pre> func() bool { result = uint32(num); return IsInRange(num, 0, math.MaxUint32) },</pre></code><tr><td>32<td><code><pre> func() bool { result = uint64(num); return IsInRange(num, 0, math.MaxUint64) },</pre></code><tr><td>33<td><code><pre> )</pre></code><tr class=miss><td>34<td><code><pre> return</pre></code><tr><td>35<td><code><pre>}</pre></code></table><div class=funcname id=fn_@22:3>func @22:3</div><div class=info><a href=#s_fn_@22:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/number.go</code>:</div><table class=listing><tr class=miss><td>22<td><code><pre>func() bool { result = int64(num); return IsInRange(num, math.MinInt64, math.MaxInt64) }</pre></code></table><div class=funcname id=fn_Sort>func Sort</div><div class=info><a href=#s_fn_Sort>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sort.go</code>:</div><table class=listing><tr><td>5<td><code><pre>func Sort[E any](data []E, cmp func(e1, e2 E) bool) {</pre></code><tr class=miss><td>6<td><code><pre> sortObj := sortable[E]{data: data, cmp: cmp}</pre></code><tr class=miss><td>7<td><code><pre> sort.Sort(sortObj)</pre></code><tr><td>8<td><code><pre>}</pre></code></table><div class=funcname id=fn_SortStable>func SortStable</div><div class=info><a href=#s_fn_SortStable>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sort.go</code>:</div><table class=listing><tr><td>10<td><code><pre>func SortStable[E any](data []E, cmp func(e1, e2 E) bool) {</pre></code><tr class=miss><td>11<td><code><pre> sortObj := sortable[E]{data: data, cmp: cmp}</pre></code><tr class=miss><td>12<td><code><pre> sort.Stable(sortObj)</pre></code><tr><td>13<td><code><pre>}</pre></code></table><div class=funcname id=fn_Heap[E].Data>func Heap[E].Data</div><div class=info><a href=#s_fn_Heap[E].Data>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr class=miss><td>50<td><code><pre>func (h *Heap[E]) Data() []E { return h.data.d }</pre></code></table><div class=funcname id=fn_sortable[E].Swap>func sortable[E].Swap</div><div class=info><a href=#s_fn_sortable[E].Swap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sort.go</code>:</div><table class=listing><tr class=miss><td>21<td><code><pre>func (s sortable[E]) Swap(i, j int) { s.data[i], s.data[j] = s.data[j], s.data[i] }</pre></code></table><div class=funcname id=fn_sortable[E].Less>func sortable[E].Less</div><div class=info><a href=#s_fn_sortable[E].Less>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sort.go</code>:</div><table class=listing><tr class=miss><td>22<td><code><pre>func (s sortable[E]) Less(i, j int) bool { return s.cmp(s.data[i], s.data[j]) }</pre></code></table><div class=funcname id=fn_sortable[E].Len>func sortable[E].Len</div><div class=info><a href=#s_fn_sortable[E].Len>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/sort.go</code>:</div><table class=listing><tr class=miss><td>20<td><code><pre>func (s sortable[E]) Len() int { return len(s.data) }</pre></code></table><div class=funcname id=fn_Heap[E].CmpFn>func Heap[E].CmpFn</div><div class=info><a href=#s_fn_Heap[E].CmpFn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr class=miss><td>53<td><code><pre>func (h *Heap[E]) CmpFn() func(e1, e2 E) bool { return h.data.cmp }</pre></code></table><div class=funcname id=fn__heap[E].Swap>func _heap[E].Swap</div><div class=info><a href=#s_fn__heap[E].Swap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr class=miss><td>21<td><code><pre>func (h *_heap[E]) Swap(i, j int) { h.d[i], h.d[j] = h.d[j], h.d[i] }</pre></code></table><div class=funcname id=fn__heap[E].Less>func _heap[E].Less</div><div class=info><a href=#s_fn__heap[E].Less>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr class=miss><td>20<td><code><pre>func (h *_heap[E]) Less(i, j int) bool { return h.cmp(h.d[i], h.d[j]) }</pre></code></table><div class=funcname id=fn__heap[E].Len>func _heap[E].Len</div><div class=info><a href=#s_fn__heap[E].Len>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr class=miss><td>19<td><code><pre>func (h *_heap[E]) Len() int { return len(h.d) }</pre></code></table><div class=funcname id=fn_@26:9>func @26:9</div><div class=info><a href=#s_fn_@26:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/enum.go</code>:</div><table class=listing><tr><td>26<td><code><pre>func(e *enumStringOption) {</pre></code><tr class=miss><td>27<td><code><pre> e.ignoreCaseSensitivity = true</pre></code><tr><td>28<td><code><pre> }</pre></code></table><div class=funcname id=fn_WrapFunc7>func WrapFunc7</div><div class=info><a href=#s_fn_WrapFunc7>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>99<td><code><pre>func WrapFunc7[T1, T2, T3, T4, T5, T6, T7 any](fn any) func(...any) (T1, T2, T3, T4, T5, T6, T7) {</pre></code><tr class=miss><td>100<td><code><pre> return func(a ...any) (t1 T1, t2 T2, t3 T3, t4 T4, t5 T5, t6 T6, t7 T7) {</pre></code><tr><td>101<td><code><pre> ret := runVariadicFunc(fn, a...)</pre></code><tr><td>102<td><code><pre> t1 = ParseVariadicFuncResult[T1](ret, 0)</pre></code><tr><td>103<td><code><pre> t2 = ParseVariadicFuncResult[T2](ret, 1)</pre></code><tr><td>104<td><code><pre> t3 = ParseVariadicFuncResult[T3](ret, 2)</pre></code><tr><td>105<td><code><pre> t4 = ParseVariadicFuncResult[T4](ret, 3)</pre></code><tr><td>106<td><code><pre> t5 = ParseVariadicFuncResult[T5](ret, 4)</pre></code><tr><td>107<td><code><pre> t6 = ParseVariadicFuncResult[T6](ret, 5)</pre></code><tr><td>108<td><code><pre> t7 = ParseVariadicFuncResult[T7](ret, 6)</pre></code><tr><td>109<td><code><pre> return</pre></code><tr><td>110<td><code><pre> }</pre></code><tr><td>111<td><code><pre>}</pre></code></table><div class=funcname id=fn_Heap[E].Push>func Heap[E].Push</div><div class=info><a href=#s_fn_Heap[E].Push>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr class=miss><td>32<td><code><pre>func (h *Heap[E]) Push(v E) { heap.Push(h.data, v) }</pre></code></table><div class=funcname id=fn_WrapFunc6>func WrapFunc6</div><div class=info><a href=#s_fn_WrapFunc6>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>86<td><code><pre>func WrapFunc6[T1, T2, T3, T4, T5, T6 any](fn any) func(...any) (T1, T2, T3, T4, T5, T6) {</pre></code><tr class=miss><td>87<td><code><pre> return func(a ...any) (t1 T1, t2 T2, t3 T3, t4 T4, t5 T5, t6 T6) {</pre></code><tr><td>88<td><code><pre> ret := runVariadicFunc(fn, a...)</pre></code><tr><td>89<td><code><pre> t1 = ParseVariadicFuncResult[T1](ret, 0)</pre></code><tr><td>90<td><code><pre> t2 = ParseVariadicFuncResult[T2](ret, 1)</pre></code><tr><td>91<td><code><pre> t3 = ParseVariadicFuncResult[T3](ret, 2)</pre></code><tr><td>92<td><code><pre> t4 = ParseVariadicFuncResult[T4](ret, 3)</pre></code><tr><td>93<td><code><pre> t5 = ParseVariadicFuncResult[T5](ret, 4)</pre></code><tr><td>94<td><code><pre> t6 = ParseVariadicFuncResult[T6](ret, 5)</pre></code><tr><td>95<td><code><pre> return</pre></code><tr><td>96<td><code><pre> }</pre></code><tr><td>97<td><code><pre>}</pre></code></table><div class=funcname id=fn_Heap[E].Pop>func Heap[E].Pop</div><div class=info><a href=#s_fn_Heap[E].Pop>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr class=miss><td>37<td><code><pre>func (h *Heap[E]) Pop() E { return heap.Pop(h.data).(E) }</pre></code></table><div class=funcname id=fn_WrapFunc5>func WrapFunc5</div><div class=info><a href=#s_fn_WrapFunc5>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>74<td><code><pre>func WrapFunc5[T1, T2, T3, T4, T5 any](fn any) func(...any) (T1, T2, T3, T4, T5) {</pre></code><tr class=miss><td>75<td><code><pre> return func(a ...any) (t1 T1, t2 T2, t3 T3, t4 T4, t5 T5) {</pre></code><tr><td>76<td><code><pre> ret := runVariadicFunc(fn, a...)</pre></code><tr><td>77<td><code><pre> t1 = ParseVariadicFuncResult[T1](ret, 0)</pre></code><tr><td>78<td><code><pre> t2 = ParseVariadicFuncResult[T2](ret, 1)</pre></code><tr><td>79<td><code><pre> t3 = ParseVariadicFuncResult[T3](ret, 2)</pre></code><tr><td>80<td><code><pre> t4 = ParseVariadicFuncResult[T4](ret, 3)</pre></code><tr><td>81<td><code><pre> t5 = ParseVariadicFuncResult[T5](ret, 4)</pre></code><tr><td>82<td><code><pre> return</pre></code><tr><td>83<td><code><pre> }</pre></code><tr><td>84<td><code><pre>}</pre></code></table><div class=funcname id=fn_LoopJitterInterval>func LoopJitterInterval</div><div class=info><a href=#s_fn_LoopJitterInterval>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/time.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func LoopJitterInterval(base, max time.Duration, ratio, exp float64,</pre></code><tr><td>53<td><code><pre> symmetric bool) OptionFunc[loopWithIntervalOption] {</pre></code><tr class=miss><td>54<td><code><pre> return func(o *loopWithIntervalOption) {</pre></code><tr><td>55<td><code><pre> o.base = base</pre></code><tr><td>56<td><code><pre> o.max = max</pre></code><tr><td>57<td><code><pre> o.ratio = ratio</pre></code><tr><td>58<td><code><pre> o.exp = exp</pre></code><tr><td>59<td><code><pre> o.symmetric = symmetric</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre>}</pre></code></table><div class=funcname id=fn_ParseTagOverwrite>func ParseTagOverwrite</div><div class=info><a href=#s_fn_ParseTagOverwrite>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/tag.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func ParseTagOverwrite(overwrite bool) OptionFunc[parseTagOption] {</pre></code><tr class=miss><td>20<td><code><pre> return func(o *parseTagOption) {</pre></code><tr><td>21<td><code><pre> o.overwrite = overwrite</pre></code><tr><td>22<td><code><pre> }</pre></code><tr><td>23<td><code><pre>}</pre></code></table><div class=funcname id=fn_@20:9>func @20:9</div><div class=info><a href=#s_fn_@20:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/tag.go</code>:</div><table class=listing><tr><td>20<td><code><pre>func(o *parseTagOption) {</pre></code><tr class=miss><td>21<td><code><pre> o.overwrite = overwrite</pre></code><tr><td>22<td><code><pre> }</pre></code></table><div class=funcname id=fn_WrapFunc4>func WrapFunc4</div><div class=info><a href=#s_fn_WrapFunc4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>63<td><code><pre>func WrapFunc4[T1, T2, T3, T4 any](fn any) func(...any) (T1, T2, T3, T4) {</pre></code><tr class=miss><td>64<td><code><pre> return func(a ...any) (t1 T1, t2 T2, t3 T3, t4 T4) {</pre></code><tr><td>65<td><code><pre> ret := runVariadicFunc(fn, a...)</pre></code><tr><td>66<td><code><pre> t1 = ParseVariadicFuncResult[T1](ret, 0)</pre></code><tr><td>67<td><code><pre> t2 = ParseVariadicFuncResult[T2](ret, 1)</pre></code><tr><td>68<td><code><pre> t3 = ParseVariadicFuncResult[T3](ret, 2)</pre></code><tr><td>69<td><code><pre> t4 = ParseVariadicFuncResult[T4](ret, 3)</pre></code><tr><td>70<td><code><pre> return</pre></code><tr><td>71<td><code><pre> }</pre></code><tr><td>72<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewSafeRand>func NewSafeRand</div><div class=info><a href=#s_fn_NewSafeRand>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>165<td><code><pre>func NewSafeRand(seed int64) *rand.Rand {</pre></code><tr class=miss><td>166<td><code><pre> return rand.New(newBuiltinLockedSource(seed))</pre></code><tr><td>167<td><code><pre>}</pre></code></table><div class=funcname id=fn_WrapFunc3>func WrapFunc3</div><div class=info><a href=#s_fn_WrapFunc3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>53<td><code><pre>func WrapFunc3[T1, T2, T3 any](fn any) func(...any) (T1, T2, T3) {</pre></code><tr class=miss><td>54<td><code><pre> return func(a ...any) (t1 T1, t2 T2, t3 T3) {</pre></code><tr><td>55<td><code><pre> ret := runVariadicFunc(fn, a...)</pre></code><tr><td>56<td><code><pre> t1 = ParseVariadicFuncResult[T1](ret, 0)</pre></code><tr><td>57<td><code><pre> t2 = ParseVariadicFuncResult[T2](ret, 1)</pre></code><tr><td>58<td><code><pre> t3 = ParseVariadicFuncResult[T3](ret, 2)</pre></code><tr><td>59<td><code><pre> return</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre>}</pre></code></table><div class=funcname id=fn_@182:19>func @182:19</div><div class=info><a href=#s_fn_@182:19>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr class=miss><td>182<td><code><pre>func() { inspect.SetField(source, "s", rand.NewSource(seed)) }</pre></code></table><div class=funcname id=fn_GetTime>func GetTime</div><div class=info><a href=#s_fn_GetTime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/time.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func GetTime(timestampMs int64) time.Time {</pre></code><tr class=miss><td>26<td><code><pre> return time.UnixMilli(timestampMs)</pre></code><tr><td>27<td><code><pre>}</pre></code></table><div class=funcname id=fn_WrapFuncAny>func WrapFuncAny</div><div class=info><a href=#s_fn_WrapFuncAny>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/func.go</code>:</div><table class=listing><tr><td>22<td><code><pre>func WrapFuncAny(fn any) func(...any) []any {</pre></code><tr class=miss><td>23<td><code><pre> return func(a ...any) (b []any) {</pre></code><tr><td>24<td><code><pre> ret := runVariadicFunc(fn, a...)</pre></code><tr><td>25<td><code><pre> b = make([]any, 0, len(b))</pre></code><tr><td>26<td><code><pre> for i := 0; i < len(ret); i++ {</pre></code><tr><td>27<td><code><pre> b = append(b, ret[i].Interface())</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre> return</pre></code><tr><td>30<td><code><pre> }</pre></code><tr><td>31<td><code><pre>}</pre></code></table><div class=funcname id=fn_MustJsonMarshalString>func MustJsonMarshalString</div><div class=info><a href=#s_fn_MustJsonMarshalString>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/marshal.go</code>:</div><table class=listing><tr class=miss><td>42<td><code><pre>func MustJsonMarshalString(s any) string { return string(MustJsonMarshal(s)) }</pre></code></table><div class=funcname id=fn_Heap[E].Remove>func Heap[E].Remove</div><div class=info><a href=#s_fn_Heap[E].Remove>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr class=miss><td>48<td><code><pre>func (h *Heap[E]) Remove(index int) E { return heap.Remove(h.data, index).(E) }</pre></code></table><div class=funcname id=fn_UUID_>func UUID_</div><div class=info><a href=#s_fn_UUID_>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/random.go</code>:</div><table class=listing><tr><td>28<td><code><pre>func UUID_() string {</pre></code><tr class=miss><td>29<td><code><pre> return strings.Replace(uuid.New().String(), constant.Hyphen, "", -1)</pre></code><tr><td>30<td><code><pre>}</pre></code></table><div class=funcname id=fn_LoopMaxTimes>func LoopMaxTimes</div><div class=info><a href=#s_fn_LoopMaxTimes>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/time.go</code>:</div><table class=listing><tr><td>64<td><code><pre>func LoopMaxTimes(maxTimes uint) OptionFunc[loopWithIntervalOption] {</pre></code><tr class=miss><td>65<td><code><pre> return func(o *loopWithIntervalOption) {</pre></code><tr><td>66<td><code><pre> o.maxTimes = maxTimes</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre>}</pre></code></table><div class=funcname id=fn_@65:9>func @65:9</div><div class=info><a href=#s_fn_@65:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/time.go</code>:</div><table class=listing><tr><td>65<td><code><pre>func(o *loopWithIntervalOption) {</pre></code><tr class=miss><td>66<td><code><pre> o.maxTimes = maxTimes</pre></code><tr><td>67<td><code><pre> }</pre></code></table><div class=funcname id=fn_Heap[E].Len>func Heap[E].Len</div><div class=info><a href=#s_fn_Heap[E].Len>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr class=miss><td>49<td><code><pre>func (h *Heap[E]) Len() int { return len(h.data.d) }</pre></code></table><div class=funcname id=fn_IgnoreEnumStringCase>func IgnoreEnumStringCase</div><div class=info><a href=#s_fn_IgnoreEnumStringCase>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/enum.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func IgnoreEnumStringCase() enumStringOptFn {</pre></code><tr class=miss><td>26<td><code><pre> return func(e *enumStringOption) {</pre></code><tr><td>27<td><code><pre> e.ignoreCaseSensitivity = true</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre>}</pre></code></table><div class=funcname id=fn_UnsafeBytesToString>func UnsafeBytesToString</div><div class=info><a href=#s_fn_UnsafeBytesToString>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/conv.go</code>:</div><table class=listing><tr><td>160<td><code><pre>func UnsafeBytesToString(b []byte) string {</pre></code><tr class=miss><td>161<td><code><pre> return *(*string)(unsafe.Pointer(&b))</pre></code><tr><td>162<td><code><pre>}</pre></code></table><div class=funcname id=fn_UnsafeStringToBytes>func UnsafeStringToBytes</div><div class=info><a href=#s_fn_UnsafeStringToBytes>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/conv.go</code>:</div><table class=listing><tr><td>149<td><code><pre>func UnsafeStringToBytes(s string) []byte {</pre></code><tr class=miss><td>150<td><code><pre> return *(*[]byte)(unsafe.Pointer(</pre></code><tr><td>151<td><code><pre> &struct {</pre></code><tr><td>152<td><code><pre> string</pre></code><tr><td>153<td><code><pre> Cap int</pre></code><tr><td>154<td><code><pre> }{s, len(s)},</pre></code><tr><td>155<td><code><pre> ))</pre></code><tr><td>156<td><code><pre>}</pre></code></table><div class=funcname id=fn_Heap[E].Fix>func Heap[E].Fix</div><div class=info><a href=#s_fn_Heap[E].Fix>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr class=miss><td>51<td><code><pre>func (h *Heap[E]) Fix(index int) { heap.Fix(h.data, index) }</pre></code></table><div class=funcname id=fn_Heap[E].Init>func Heap[E].Init</div><div class=info><a href=#s_fn_Heap[E].Init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/heap.go</code>:</div><table class=listing><tr class=miss><td>52<td><code><pre>func (h *Heap[E]) Init() { heap.Init(h.data) }</pre></code></table><div class=funcname id=fn_Error.Error>func Error.Error</div><div class=info><a href=#s_fn_Error.Error>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/error.go</code>:</div><table class=listing><tr><td>5<td><code><pre>func (e Error) Error() string {</pre></code><tr class=miss><td>6<td><code><pre> return string(e)</pre></code><tr><td>7<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/common/utils/cipher class=funcname>Package Overview: github.com/wfusion/gofusion/common/utils/cipher 13 <span class=packageTotal>85.6%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_newBlockModeWrapper><td><code><a href=#fn_newBlockModeWrapper>newBlockModeWrapper(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_@36:8><td><code><a href=#fn_@36:8>@36:8(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_EncryptStreamFunc><td><code><a href=#fn_EncryptStreamFunc>EncryptStreamFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_@40:8><td><code><a href=#fn_@40:8>@40:8(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_enc.Flush><td><code><a href=#fn_enc.Flush>enc.Flush(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_dec.Close><td><code><a href=#fn_dec.Close>dec.Close(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_@159:8><td><code><a href=#fn_@159:8>@159:8(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@28:9><td><code><a href=#fn_@28:9>@28:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@233:8><td><code><a href=#fn_@233:8>@233:8(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@19:9><td><code><a href=#fn_@19:9>@19:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@162:8><td><code><a href=#fn_@162:8>@162:8(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_wrapErr><td><code><a href=#fn_wrapErr>wrapErr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_newAbstractAEADWrapper><td><code><a href=#fn_newAbstractAEADWrapper>newAbstractAEADWrapper(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/aead_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@54:8><td><code><a href=#fn_@54:8>@54:8(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_enc.Close><td><code><a href=#fn_enc.Close>enc.Close(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@36:9><td><code><a href=#fn_@36:9>@36:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@43:9><td><code><a href=#fn_@43:9>@43:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_Mode.NeedIV><td><code><a href=#fn_Mode.NeedIV>Mode.NeedIV(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/mode_enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_wrapStream><td><code><a href=#fn_wrapStream>wrapStream(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_blockModeWrapper.CipherMode><td><code><a href=#fn_blockModeWrapper.CipherMode>blockModeWrapper.CipherMode(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_blockModeWrapper.PlainBlockSize><td><code><a href=#fn_blockModeWrapper.PlainBlockSize>blockModeWrapper.PlainBlockSize(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_wrapBlockMode><td><code><a href=#fn_wrapBlockMode>wrapBlockMode(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@74:12><td><code><a href=#fn_@74:12>@74:12(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@59:12><td><code><a href=#fn_@59:12>@59:12(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@54:12><td><code><a href=#fn_@54:12>@54:12(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@49:12><td><code><a href=#fn_@49:12>@49:12(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@35:23><td><code><a href=#fn_@35:23>@35:23(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_blockModeWrapper.CipherBlockSize><td><code><a href=#fn_blockModeWrapper.CipherBlockSize>blockModeWrapper.CipherBlockSize(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@44:12><td><code><a href=#fn_@44:12>@44:12(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@39:12><td><code><a href=#fn_@39:12>@39:12(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@35:18><td><code><a href=#fn_@35:18>@35:18(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_wrapBlock><td><code><a href=#fn_wrapBlock>wrapBlock(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@165:9><td><code><a href=#fn_@165:9>@165:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Mode.IsValid><td><code><a href=#fn_Mode.IsValid>Mode.IsValid(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/mode_enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@79:12><td><code><a href=#fn_@79:12>@79:12(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@34:18><td><code><a href=#fn_@34:18>@34:18(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Algorithm.String><td><code><a href=#fn_Algorithm.String>Algorithm.String(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/algorithm_enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@89:12><td><code><a href=#fn_@89:12>@89:12(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@31:23><td><code><a href=#fn_@31:23>@31:23(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_newAEADDecryptWrapper><td><code><a href=#fn_newAEADDecryptWrapper>newAEADDecryptWrapper(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/aead_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@33:18><td><code><a href=#fn_@33:18>@33:18(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@94:12><td><code><a href=#fn_@94:12>@94:12(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@32:18><td><code><a href=#fn_@32:18>@32:18(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Algorithm.IsValid><td><code><a href=#fn_Algorithm.IsValid>Algorithm.IsValid(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/algorithm_enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_newAEADEncryptWrapper><td><code><a href=#fn_newAEADEncryptWrapper>newAEADEncryptWrapper(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/aead_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@162:9><td><code><a href=#fn_@162:9>@162:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_rc4Wrapper.CipherBlockSize><td><code><a href=#fn_rc4Wrapper.CipherBlockSize>rc4Wrapper.CipherBlockSize(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/rc4_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_rc4Wrapper.PlainBlockSize><td><code><a href=#fn_rc4Wrapper.PlainBlockSize>rc4Wrapper.PlainBlockSize(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/rc4_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_abstractAEADWrapper.CipherMode><td><code><a href=#fn_abstractAEADWrapper.CipherMode>abstractAEADWrapper.CipherMode(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/aead_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_abstractAEADWrapper.CipherBlockSize><td><code><a href=#fn_abstractAEADWrapper.CipherBlockSize>abstractAEADWrapper.CipherBlockSize(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/aead_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_abstractAEADWrapper.PlainBlockSize><td><code><a href=#fn_abstractAEADWrapper.PlainBlockSize>abstractAEADWrapper.PlainBlockSize(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/aead_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_rc4Wrapper.CipherMode><td><code><a href=#fn_rc4Wrapper.CipherMode>rc4Wrapper.CipherMode(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/rc4_wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Mode.String><td><code><a href=#fn_Mode.String>Mode.String(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/mode_enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Mode.SupportStream><td><code><a href=#fn_Mode.SupportStream>Mode.SupportStream(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/mode_enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Mode.ShouldPadding><td><code><a href=#fn_Mode.ShouldPadding>Mode.ShouldPadding(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/mode_enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@84:12><td><code><a href=#fn_@84:12>@84:12(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_encrypt><td><code><a href=#fn_encrypt>encrypt(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code><td class=percent><code>92.6%</code><td class=linecount><code>25/27</code><tr id=s_fn_decrypt><td><code><a href=#fn_decrypt>decrypt(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code><td class=percent><code>92.3%</code><td class=linecount><code>24/26</code><tr id=s_fn_NewEncFunc><td><code><a href=#fn_NewEncFunc>NewEncFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code><td class=percent><code>92.3%</code><td class=linecount><code>12/13</code><tr id=s_fn_dec.Read><td><code><a href=#fn_dec.Read>dec.Read(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code><td class=percent><code>89.7%</code><td class=linecount><code>35/39</code><tr id=s_fn_enc.Write><td><code><a href=#fn_enc.Write>enc.Write(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code><td class=percent><code>89.5%</code><td class=linecount><code>17/19</code><tr id=s_fn_NewDecFunc><td><code><a href=#fn_NewDecFunc>NewDecFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code><td class=percent><code>84.6%</code><td class=linecount><code>11/13</code><tr id=s_fn_@19:9><td><code><a href=#fn_@19:9>@19:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_DecryptStreamFunc><td><code><a href=#fn_DecryptStreamFunc>DecryptStreamFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_EncryptBytesFunc><td><code><a href=#fn_EncryptBytesFunc>EncryptBytesFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_blockModeWrapper.CryptBlocks><td><code><a href=#fn_blockModeWrapper.CryptBlocks>blockModeWrapper.CryptBlocks(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code><td class=percent><code>81.8%</code><td class=linecount><code>9/11</code><tr id=s_fn_aeadEncryptWrapper.CryptBlocks><td><code><a href=#fn_aeadEncryptWrapper.CryptBlocks>aeadEncryptWrapper.CryptBlocks(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/aead_wrapper.go</code><td class=percent><code>81.8%</code><td class=linecount><code>9/11</code><tr id=s_fn_@126:31><td><code><a href=#fn_@126:31>@126:31(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_@136:17><td><code><a href=#fn_@136:17>@136:17(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_@118:30><td><code><a href=#fn_@118:30>@118:30(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_@144:30><td><code><a href=#fn_@144:30>@144:30(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_@110:17><td><code><a href=#fn_@110:17>@110:17(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_DecryptBytesFunc><td><code><a href=#fn_DecryptBytesFunc>DecryptBytesFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_rc4Wrapper.CryptBlocks><td><code><a href=#fn_rc4Wrapper.CryptBlocks>rc4Wrapper.CryptBlocks(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/rc4_wrapper.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_@152:31><td><code><a href=#fn_@152:31>@152:31(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_@99:12><td><code><a href=#fn_@99:12>@99:12(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_@64:12><td><code><a href=#fn_@64:12>@64:12(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/types.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_aeadDecryptWrapper.CryptBlocks><td><code><a href=#fn_aeadDecryptWrapper.CryptBlocks>aeadDecryptWrapper.CryptBlocks(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/aead_wrapper.go</code><td class=percent><code>76.9%</code><td class=linecount><code>10/13</code><tr id=s_fn_PKCS7Pad><td><code><a href=#fn_PKCS7Pad>PKCS7Pad(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/padding.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_getEncrypter><td><code><a href=#fn_getEncrypter>getEncrypter(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code><td class=percent><code>70.0%</code><td class=linecount><code>14/20</code><tr id=s_fn_getDecrypter><td><code><a href=#fn_getDecrypter>getDecrypter(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code><td class=percent><code>70.0%</code><td class=linecount><code>14/20</code><tr id=s_fn_enc.flush><td><code><a href=#fn_enc.flush>enc.flush(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code><td class=percent><code>70.0%</code><td class=linecount><code>7/10</code><tr id=s_fn_PKCS7Unpad><td><code><a href=#fn_PKCS7Unpad>PKCS7Unpad(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/padding.go</code><td class=percent><code>70.0%</code><td class=linecount><code>7/10</code><tr id=s_fn_ParseMode><td><code><a href=#fn_ParseMode>ParseMode(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/mode_enum.go</code><td class=percent><code>50.0%</code><td class=linecount><code>3/6</code><tr id=s_fn_ParseAlgorithm><td><code><a href=#fn_ParseAlgorithm>ParseAlgorithm(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/algorithm_enum.go</code><td class=percent><code>50.0%</code><td class=linecount><code>3/6</code><tr id=s_fn_Algorithm.Value><td><code><a href=#fn_Algorithm.Value>Algorithm.Value(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/algorithm_enum.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Mode.Value><td><code><a href=#fn_Mode.Value>Mode.Value(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cipher/mode_enum.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_newBlockModeWrapper>func newBlockModeWrapper</div><div class=info><a href=#s_fn_newBlockModeWrapper>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func newBlockModeWrapper(opts ...utils.OptionExtender) (w *blockModeWrapper) {</pre></code><tr><td>50<td><code><pre> opt := utils.ApplyOptions[blockModeOption](opts...)</pre></code><tr><td>51<td><code><pre> w = &blockModeWrapper{</pre></code><tr><td>52<td><code><pre> block: opt.block,</pre></code><tr><td>53<td><code><pre> blockMode: opt.blockMode,</pre></code><tr><td>54<td><code><pre> stream: opt.stream,</pre></code><tr><td>55<td><code><pre> blockSize: 0,</pre></code><tr><td>56<td><code><pre> mode: opt.mode,</pre></code><tr><td>57<td><code><pre> isEncoder: opt.isEncoder,</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre></pre></code><tr><td>60<td><code><pre> switch {</pre></code><tr><td>61<td><code><pre> case opt.block != nil:</pre></code><tr><td>62<td><code><pre> w.blockSize = w.block.BlockSize()</pre></code><tr><td>63<td><code><pre> case opt.blockMode != nil:</pre></code><tr><td>64<td><code><pre> w.blockSize = w.blockMode.BlockSize()</pre></code><tr><td>65<td><code><pre> case opt.stream != nil:</pre></code><tr><td>66<td><code><pre> w.blockSize = defaultBlockSize * blockSizeTimes</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre></pre></code><tr><td>69<td><code><pre> return</pre></code><tr><td>70<td><code><pre>}</pre></code></table><div class=funcname id=fn_@36:8>func @36:8</div><div class=info><a href=#s_fn_@36:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func(dst io.Writer, src io.Reader) (err error) {</pre></code><tr><td>37<td><code><pre> buf, cb := utils.BytesPool.Get(defaultBlockSize * blockSizeTimes)</pre></code><tr><td>38<td><code><pre> defer cb()</pre></code><tr><td>39<td><code><pre></pre></code><tr><td>40<td><code><pre> wrapper := fn(dst)</pre></code><tr><td>41<td><code><pre> defer utils.CloseAnyway(wrapper)</pre></code><tr><td>42<td><code><pre></pre></code><tr><td>43<td><code><pre> _, err = io.CopyBuffer(wrapper, src, buf)</pre></code><tr><td>44<td><code><pre> return</pre></code><tr><td>45<td><code><pre> }</pre></code></table><div class=funcname id=fn_EncryptStreamFunc>func EncryptStreamFunc</div><div class=info><a href=#s_fn_EncryptStreamFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code>:</div><table class=listing><tr><td>27<td><code><pre>func EncryptStreamFunc(algo Algorithm, mode Mode, key, iv []byte) (</pre></code><tr><td>28<td><code><pre> enc func(dst io.Writer, src io.Reader) (err error), err error) {</pre></code><tr><td>29<td><code><pre> var fn func(w io.Writer) io.WriteCloser</pre></code><tr><td>30<td><code><pre></pre></code><tr><td>31<td><code><pre> _, err = utils.Catch(func() { fn = NewEncFunc(algo, mode, key, iv) })</pre></code><tr><td>32<td><code><pre> if err != nil {</pre></code><tr><td>33<td><code><pre> return nil, err</pre></code><tr><td>34<td><code><pre> }</pre></code><tr><td>35<td><code><pre></pre></code><tr><td>36<td><code><pre> enc = func(dst io.Writer, src io.Reader) (err error) {</pre></code><tr><td>37<td><code><pre> buf, cb := utils.BytesPool.Get(defaultBlockSize * blockSizeTimes)</pre></code><tr><td>38<td><code><pre> defer cb()</pre></code><tr><td>39<td><code><pre></pre></code><tr><td>40<td><code><pre> wrapper := fn(dst)</pre></code><tr><td>41<td><code><pre> defer utils.CloseAnyway(wrapper)</pre></code><tr><td>42<td><code><pre></pre></code><tr><td>43<td><code><pre> _, err = io.CopyBuffer(wrapper, src, buf)</pre></code><tr><td>44<td><code><pre> return</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre></pre></code><tr><td>47<td><code><pre> return</pre></code><tr><td>48<td><code><pre>}</pre></code></table><div class=funcname id=fn_@40:8>func @40:8</div><div class=info><a href=#s_fn_@40:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code>:</div><table class=listing><tr><td>40<td><code><pre>func(dst io.Writer, src io.Reader) (err error) {</pre></code><tr><td>41<td><code><pre> buf, cb := utils.BytesPool.Get(defaultBlockSize * blockSizeTimes)</pre></code><tr><td>42<td><code><pre> defer cb()</pre></code><tr><td>43<td><code><pre></pre></code><tr><td>44<td><code><pre> wrapper := fn(src)</pre></code><tr><td>45<td><code><pre> defer utils.CloseAnyway(wrapper)</pre></code><tr><td>46<td><code><pre> _, err = io.CopyBuffer(dst, wrapper, buf)</pre></code><tr><td>47<td><code><pre> return</pre></code><tr><td>48<td><code><pre> }</pre></code></table><div class=funcname id=fn_enc.Flush>func enc.Flush</div><div class=info><a href=#s_fn_enc.Flush>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code>:</div><table class=listing><tr><td>224<td><code><pre>func (e *enc) Flush() (err error) {</pre></code><tr><td>225<td><code><pre> defer utils.FlushAnyway(e.w)</pre></code><tr><td>226<td><code><pre> if e.n > 0 {</pre></code><tr><td>227<td><code><pre> err = e.flush()</pre></code><tr><td>228<td><code><pre> }</pre></code><tr><td>229<td><code><pre> return</pre></code><tr><td>230<td><code><pre>}</pre></code></table><div class=funcname id=fn_dec.Close>func dec.Close</div><div class=info><a href=#s_fn_dec.Close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code>:</div><table class=listing><tr><td>246<td><code><pre>func (d *dec) Close() (err error) {</pre></code><tr><td>247<td><code><pre> utils.CloseAnyway(d.r)</pre></code><tr><td>248<td><code><pre> if d.cb != nil {</pre></code><tr><td>249<td><code><pre> d.cb()</pre></code><tr><td>250<td><code><pre> }</pre></code><tr><td>251<td><code><pre> return</pre></code><tr><td>252<td><code><pre>}</pre></code></table><div class=funcname id=fn_@159:8>func @159:8</div><div class=info><a href=#s_fn_@159:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code>:</div><table class=listing><tr><td>159<td><code><pre>func() { bcb(); scb(); sbcb() }</pre></code></table><div class=funcname id=fn_@28:9>func @28:9</div><div class=info><a href=#s_fn_@28:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code>:</div><table class=listing><tr><td>28<td><code><pre>func(o *blockModeOption) {</pre></code><tr><td>29<td><code><pre> o.mode = mode</pre></code><tr><td>30<td><code><pre> o.block = block</pre></code><tr><td>31<td><code><pre> o.isEncoder = isEncoder</pre></code><tr><td>32<td><code><pre> }</pre></code></table><div class=funcname id=fn_@233:8>func @233:8</div><div class=info><a href=#s_fn_@233:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code>:</div><table class=listing><tr><td>233<td><code><pre>func() {</pre></code><tr><td>234<td><code><pre> utils.CloseAnyway(e.w)</pre></code><tr><td>235<td><code><pre> if e.cb != nil {</pre></code><tr><td>236<td><code><pre> e.cb()</pre></code><tr><td>237<td><code><pre> }</pre></code><tr><td>238<td><code><pre> }</pre></code></table><div class=funcname id=fn_@19:9>func @19:9</div><div class=info><a href=#s_fn_@19:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func(src []byte) (dst []byte, err error) {</pre></code><tr><td>20<td><code><pre> if mode.ShouldPadding() {</pre></code><tr><td>21<td><code><pre> src = PKCS7Pad(src, plainBlockSize)</pre></code><tr><td>22<td><code><pre> }</pre></code><tr><td>23<td><code><pre> return encrypt(bm, src)</pre></code><tr><td>24<td><code><pre> }</pre></code></table><div class=funcname id=fn_@162:8>func @162:8</div><div class=info><a href=#s_fn_@162:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code>:</div><table class=listing><tr><td>162<td><code><pre>func() { bcb(); ucb(); ubcb() }</pre></code></table><div class=funcname id=fn_wrapErr>func wrapErr</div><div class=info><a href=#s_fn_wrapErr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>163<td><code><pre>func wrapErr[T any](a T) (b T, err error) { b = a; return }</pre></code></table><div class=funcname id=fn_newAbstractAEADWrapper>func newAbstractAEADWrapper</div><div class=info><a href=#s_fn_newAbstractAEADWrapper>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/aead_wrapper.go</code>:</div><table class=listing><tr><td>27<td><code><pre>func newAbstractAEADWrapper(cipherAEAD cipher.AEAD, blockSize int, mode Mode) abstractAEADWrapper {</pre></code><tr><td>28<td><code><pre> plainBlockSize := blockSize * blockSizeTimes</pre></code><tr><td>29<td><code><pre> return abstractAEADWrapper{</pre></code><tr><td>30<td><code><pre> AEAD: cipherAEAD,</pre></code><tr><td>31<td><code><pre> overheadSize: cipherAEAD.Overhead(),</pre></code><tr><td>32<td><code><pre> nonceSize: cipherAEAD.NonceSize(),</pre></code><tr><td>33<td><code><pre> blockSize: blockSize,</pre></code><tr><td>34<td><code><pre> plainBlockSize: plainBlockSize,</pre></code><tr><td>35<td><code><pre> cipherBlockSize: cipherAEAD.NonceSize() + cipherAEAD.Overhead() + plainBlockSize,</pre></code><tr><td>36<td><code><pre> sealedSize: cipherAEAD.Overhead() + plainBlockSize,</pre></code><tr><td>37<td><code><pre> mode: mode,</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre>}</pre></code></table><div class=funcname id=fn_@54:8>func @54:8</div><div class=info><a href=#s_fn_@54:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code>:</div><table class=listing><tr><td>54<td><code><pre>func() {</pre></code><tr><td>55<td><code><pre> for _, cb := range defers {</pre></code><tr><td>56<td><code><pre> cb()</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre> }</pre></code></table><div class=funcname id=fn_enc.Close>func enc.Close</div><div class=info><a href=#s_fn_enc.Close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code>:</div><table class=listing><tr><td>232<td><code><pre>func (e *enc) Close() (err error) {</pre></code><tr><td>233<td><code><pre> defer func() {</pre></code><tr><td>234<td><code><pre> utils.CloseAnyway(e.w)</pre></code><tr><td>235<td><code><pre> if e.cb != nil {</pre></code><tr><td>236<td><code><pre> e.cb()</pre></code><tr><td>237<td><code><pre> }</pre></code><tr><td>238<td><code><pre> }()</pre></code><tr><td>239<td><code><pre></pre></code><tr><td>240<td><code><pre> return e.Flush()</pre></code><tr><td>241<td><code><pre>}</pre></code></table><div class=funcname id=fn_@36:9>func @36:9</div><div class=info><a href=#s_fn_@36:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func(o *blockModeOption) {</pre></code><tr><td>37<td><code><pre> o.mode = mode</pre></code><tr><td>38<td><code><pre> o.blockMode = bm</pre></code><tr><td>39<td><code><pre> }</pre></code></table><div class=funcname id=fn_@43:9>func @43:9</div><div class=info><a href=#s_fn_@43:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func(o *blockModeOption) {</pre></code><tr><td>44<td><code><pre> o.mode = mode</pre></code><tr><td>45<td><code><pre> o.stream = stream</pre></code><tr><td>46<td><code><pre> }</pre></code></table><div class=funcname id=fn_Mode.NeedIV>func Mode.NeedIV</div><div class=info><a href=#s_fn_Mode.NeedIV>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/mode_enum.go</code>:</div><table class=listing><tr><td>57<td><code><pre>func (m Mode) NeedIV() bool {</pre></code><tr><td>58<td><code><pre> return ivMode.Contains(m)</pre></code><tr><td>59<td><code><pre>}</pre></code></table><div class=funcname id=fn_wrapStream>func wrapStream</div><div class=info><a href=#s_fn_wrapStream>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code>:</div><table class=listing><tr><td>42<td><code><pre>func wrapStream(stream cipher.Stream, mode Mode) utils.OptionFunc[blockModeOption] {</pre></code><tr><td>43<td><code><pre> return func(o *blockModeOption) {</pre></code><tr><td>44<td><code><pre> o.mode = mode</pre></code><tr><td>45<td><code><pre> o.stream = stream</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre>}</pre></code></table><div class=funcname id=fn_blockModeWrapper.CipherMode>func blockModeWrapper.CipherMode</div><div class=info><a href=#s_fn_blockModeWrapper.CipherMode>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code>:</div><table class=listing><tr><td>72<td><code><pre>func (b *blockModeWrapper) CipherMode() Mode { return b.mode }</pre></code></table><div class=funcname id=fn_blockModeWrapper.PlainBlockSize>func blockModeWrapper.PlainBlockSize</div><div class=info><a href=#s_fn_blockModeWrapper.PlainBlockSize>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code>:</div><table class=listing><tr><td>73<td><code><pre>func (b *blockModeWrapper) PlainBlockSize() int { return b.blockSize }</pre></code></table><div class=funcname id=fn_wrapBlockMode>func wrapBlockMode</div><div class=info><a href=#s_fn_wrapBlockMode>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code>:</div><table class=listing><tr><td>35<td><code><pre>func wrapBlockMode(bm cipher.BlockMode, mode Mode) utils.OptionFunc[blockModeOption] {</pre></code><tr><td>36<td><code><pre> return func(o *blockModeOption) {</pre></code><tr><td>37<td><code><pre> o.mode = mode</pre></code><tr><td>38<td><code><pre> o.blockMode = bm</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre>}</pre></code></table><div class=funcname id=fn_@74:12>func @74:12</div><div class=info><a href=#s_fn_@74:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>74<td><code><pre>func(b cipher.Block, iv []byte) (e blockMode, err error) {</pre></code><tr><td>75<td><code><pre> return wrapErr(newBlockModeWrapper(</pre></code><tr><td>76<td><code><pre> wrapBlock(b, ModeECB, false)),</pre></code><tr><td>77<td><code><pre> )</pre></code><tr><td>78<td><code><pre> }</pre></code></table><div class=funcname id=fn_@59:12>func @59:12</div><div class=info><a href=#s_fn_@59:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>59<td><code><pre>func(b cipher.Block, iv []byte) (e blockMode, err error) {</pre></code><tr><td>60<td><code><pre> return wrapErr(newBlockModeWrapper(</pre></code><tr><td>61<td><code><pre> wrapStream(cipher.NewOFB(b, iv), ModeOFB)),</pre></code><tr><td>62<td><code><pre> )</pre></code><tr><td>63<td><code><pre> }</pre></code></table><div class=funcname id=fn_@54:12>func @54:12</div><div class=info><a href=#s_fn_@54:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>54<td><code><pre>func(b cipher.Block, iv []byte) (e blockMode, err error) {</pre></code><tr><td>55<td><code><pre> return wrapErr(newBlockModeWrapper(</pre></code><tr><td>56<td><code><pre> wrapStream(cipher.NewCTR(b, iv), ModeCTR)),</pre></code><tr><td>57<td><code><pre> )</pre></code><tr><td>58<td><code><pre> }</pre></code></table><div class=funcname id=fn_@49:12>func @49:12</div><div class=info><a href=#s_fn_@49:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func(b cipher.Block, iv []byte) (e blockMode, err error) {</pre></code><tr><td>50<td><code><pre> return wrapErr(newBlockModeWrapper(</pre></code><tr><td>51<td><code><pre> wrapStream(cipher.NewCFBEncrypter(b, iv), ModeCFB)),</pre></code><tr><td>52<td><code><pre> )</pre></code><tr><td>53<td><code><pre> }</pre></code></table><div class=funcname id=fn_@35:23>func @35:23</div><div class=info><a href=#s_fn_@35:23>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code>:</div><table class=listing><tr><td>35<td><code><pre>func() { fn = NewDecFunc(algo, mode, key, iv) }</pre></code></table><div class=funcname id=fn_blockModeWrapper.CipherBlockSize>func blockModeWrapper.CipherBlockSize</div><div class=info><a href=#s_fn_blockModeWrapper.CipherBlockSize>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code>:</div><table class=listing><tr><td>74<td><code><pre>func (b *blockModeWrapper) CipherBlockSize() int { return b.blockSize }</pre></code></table><div class=funcname id=fn_@44:12>func @44:12</div><div class=info><a href=#s_fn_@44:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>44<td><code><pre>func(b cipher.Block, iv []byte) (e blockMode, err error) {</pre></code><tr><td>45<td><code><pre> return wrapErr(newBlockModeWrapper(</pre></code><tr><td>46<td><code><pre> wrapBlockMode(cipher.NewCBCEncrypter(b, iv), ModeCBC)),</pre></code><tr><td>47<td><code><pre> )</pre></code><tr><td>48<td><code><pre> }</pre></code></table><div class=funcname id=fn_@39:12>func @39:12</div><div class=info><a href=#s_fn_@39:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>39<td><code><pre>func(b cipher.Block, iv []byte) (e blockMode, err error) {</pre></code><tr><td>40<td><code><pre> return wrapErr(newBlockModeWrapper(</pre></code><tr><td>41<td><code><pre> wrapBlock(b, ModeECB, true)),</pre></code><tr><td>42<td><code><pre> )</pre></code><tr><td>43<td><code><pre> }</pre></code></table><div class=funcname id=fn_@35:18>func @35:18</div><div class=info><a href=#s_fn_@35:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>35<td><code><pre>func(key []byte) (cipher.Block, error) { return sm4.NewCipher(key) }</pre></code></table><div class=funcname id=fn_wrapBlock>func wrapBlock</div><div class=info><a href=#s_fn_wrapBlock>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code>:</div><table class=listing><tr><td>27<td><code><pre>func wrapBlock(block cipher.Block, mode Mode, isEncoder bool) utils.OptionFunc[blockModeOption] {</pre></code><tr><td>28<td><code><pre> return func(o *blockModeOption) {</pre></code><tr><td>29<td><code><pre> o.mode = mode</pre></code><tr><td>30<td><code><pre> o.block = block</pre></code><tr><td>31<td><code><pre> o.isEncoder = isEncoder</pre></code><tr><td>32<td><code><pre> }</pre></code><tr><td>33<td><code><pre>}</pre></code></table><div class=funcname id=fn_@165:9>func @165:9</div><div class=info><a href=#s_fn_@165:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code>:</div><table class=listing><tr><td>165<td><code><pre>func(r io.Reader) io.ReadCloser {</pre></code><tr><td>166<td><code><pre> return &dec{</pre></code><tr><td>167<td><code><pre> bm: bm,</pre></code><tr><td>168<td><code><pre> r: r,</pre></code><tr><td>169<td><code><pre> buf: buf,</pre></code><tr><td>170<td><code><pre> cb: cb,</pre></code><tr><td>171<td><code><pre> n: 0,</pre></code><tr><td>172<td><code><pre> end: 0,</pre></code><tr><td>173<td><code><pre> size: size,</pre></code><tr><td>174<td><code><pre> eof: false,</pre></code><tr><td>175<td><code><pre> unsealed: unsealed,</pre></code><tr><td>176<td><code><pre> unsealBuf: unsealBuf,</pre></code><tr><td>177<td><code><pre> }</pre></code><tr><td>178<td><code><pre> }</pre></code></table><div class=funcname id=fn_Mode.IsValid>func Mode.IsValid</div><div class=info><a href=#s_fn_Mode.IsValid>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/mode_enum.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func (m Mode) IsValid() bool {</pre></code><tr><td>50<td><code><pre> return modeEnum.IsValid(m)</pre></code><tr><td>51<td><code><pre>}</pre></code></table><div class=funcname id=fn_@79:12>func @79:12</div><div class=info><a href=#s_fn_@79:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>79<td><code><pre>func(b cipher.Block, iv []byte) (bm blockMode, err error) {</pre></code><tr><td>80<td><code><pre> return wrapErr(newBlockModeWrapper(</pre></code><tr><td>81<td><code><pre> wrapBlockMode(cipher.NewCBCDecrypter(b, iv), ModeCBC)),</pre></code><tr><td>82<td><code><pre> )</pre></code><tr><td>83<td><code><pre> }</pre></code></table><div class=funcname id=fn_@34:18>func @34:18</div><div class=info><a href=#s_fn_@34:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>34<td><code><pre>func(key []byte) (cipher.Block, error) { return aes.NewCipher(key) }</pre></code></table><div class=funcname id=fn_Algorithm.String>func Algorithm.String</div><div class=info><a href=#s_fn_Algorithm.String>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/algorithm_enum.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func (e Algorithm) String() string {</pre></code><tr><td>42<td><code><pre> return algorithmEnum.String(e)</pre></code><tr><td>43<td><code><pre>}</pre></code></table><div class=funcname id=fn_@89:12>func @89:12</div><div class=info><a href=#s_fn_@89:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>89<td><code><pre>func(b cipher.Block, iv []byte) (bm blockMode, err error) {</pre></code><tr><td>90<td><code><pre> return wrapErr(newBlockModeWrapper(</pre></code><tr><td>91<td><code><pre> wrapStream(cipher.NewCTR(b, iv), ModeCTR)),</pre></code><tr><td>92<td><code><pre> )</pre></code><tr><td>93<td><code><pre> }</pre></code></table><div class=funcname id=fn_@31:23>func @31:23</div><div class=info><a href=#s_fn_@31:23>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func() { fn = NewEncFunc(algo, mode, key, iv) }</pre></code></table><div class=funcname id=fn_newAEADDecryptWrapper>func newAEADDecryptWrapper</div><div class=info><a href=#s_fn_newAEADDecryptWrapper>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/aead_wrapper.go</code>:</div><table class=listing><tr><td>75<td><code><pre>func newAEADDecryptWrapper(cipherAEAD cipher.AEAD, blockSize int, mode Mode) blockMode {</pre></code><tr><td>76<td><code><pre> return &aeadDecryptWrapper{abstractAEADWrapper: newAbstractAEADWrapper(cipherAEAD, blockSize, mode)}</pre></code><tr><td>77<td><code><pre>}</pre></code></table><div class=funcname id=fn_@33:18>func @33:18</div><div class=info><a href=#s_fn_@33:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>33<td><code><pre>func(key []byte) (cipher.Block, error) { return des.NewTripleDESCipher(key) }</pre></code></table><div class=funcname id=fn_@94:12>func @94:12</div><div class=info><a href=#s_fn_@94:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>94<td><code><pre>func(b cipher.Block, iv []byte) (bm blockMode, err error) {</pre></code><tr><td>95<td><code><pre> return wrapErr(newBlockModeWrapper(</pre></code><tr><td>96<td><code><pre> wrapStream(cipher.NewOFB(b, iv), ModeOFB)),</pre></code><tr><td>97<td><code><pre> )</pre></code><tr><td>98<td><code><pre> }</pre></code></table><div class=funcname id=fn_@32:18>func @32:18</div><div class=info><a href=#s_fn_@32:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func(key []byte) (cipher.Block, error) { return des.NewCipher(key) }</pre></code></table><div class=funcname id=fn_Algorithm.IsValid>func Algorithm.IsValid</div><div class=info><a href=#s_fn_Algorithm.IsValid>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/algorithm_enum.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func (e Algorithm) IsValid() bool {</pre></code><tr><td>46<td><code><pre> return algorithmEnum.IsValid(e)</pre></code><tr><td>47<td><code><pre>}</pre></code></table><div class=funcname id=fn_newAEADEncryptWrapper>func newAEADEncryptWrapper</div><div class=info><a href=#s_fn_newAEADEncryptWrapper>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/aead_wrapper.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func newAEADEncryptWrapper(cipherAEAD cipher.AEAD, blockSize int, mode Mode) blockMode {</pre></code><tr><td>50<td><code><pre> return &aeadEncryptWrapper{abstractAEADWrapper: newAbstractAEADWrapper(cipherAEAD, blockSize, mode)}</pre></code><tr><td>51<td><code><pre>}</pre></code></table><div class=funcname id=fn_@162:9>func @162:9</div><div class=info><a href=#s_fn_@162:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code>:</div><table class=listing><tr><td>162<td><code><pre>func(w io.Writer) io.WriteCloser {</pre></code><tr><td>163<td><code><pre> return &enc{</pre></code><tr><td>164<td><code><pre> bm: bm,</pre></code><tr><td>165<td><code><pre> w: w,</pre></code><tr><td>166<td><code><pre> n: 0,</pre></code><tr><td>167<td><code><pre> buf: buf,</pre></code><tr><td>168<td><code><pre> cb: cb,</pre></code><tr><td>169<td><code><pre> sealed: sealed,</pre></code><tr><td>170<td><code><pre> sealBuf: sealBuf,</pre></code><tr><td>171<td><code><pre> }</pre></code><tr><td>172<td><code><pre> }</pre></code></table><div class=funcname id=fn_rc4Wrapper.CipherBlockSize>func rc4Wrapper.CipherBlockSize</div><div class=info><a href=#s_fn_rc4Wrapper.CipherBlockSize>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/rc4_wrapper.go</code>:</div><table class=listing><tr><td>11<td><code><pre>func (r *rc4Wrapper) CipherBlockSize() int { return 0 }</pre></code></table><div class=funcname id=fn_rc4Wrapper.PlainBlockSize>func rc4Wrapper.PlainBlockSize</div><div class=info><a href=#s_fn_rc4Wrapper.PlainBlockSize>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/rc4_wrapper.go</code>:</div><table class=listing><tr><td>10<td><code><pre>func (r *rc4Wrapper) PlainBlockSize() int { return 0 }</pre></code></table><div class=funcname id=fn_abstractAEADWrapper.CipherMode>func abstractAEADWrapper.CipherMode</div><div class=info><a href=#s_fn_abstractAEADWrapper.CipherMode>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/aead_wrapper.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func (a *abstractAEADWrapper) CipherMode() Mode { return a.mode }</pre></code></table><div class=funcname id=fn_abstractAEADWrapper.CipherBlockSize>func abstractAEADWrapper.CipherBlockSize</div><div class=info><a href=#s_fn_abstractAEADWrapper.CipherBlockSize>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/aead_wrapper.go</code>:</div><table class=listing><tr><td>42<td><code><pre>func (a *abstractAEADWrapper) CipherBlockSize() int { return a.cipherBlockSize }</pre></code></table><div class=funcname id=fn_abstractAEADWrapper.PlainBlockSize>func abstractAEADWrapper.PlainBlockSize</div><div class=info><a href=#s_fn_abstractAEADWrapper.PlainBlockSize>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/aead_wrapper.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func (a *abstractAEADWrapper) PlainBlockSize() int { return a.plainBlockSize }</pre></code></table><div class=funcname id=fn_rc4Wrapper.CipherMode>func rc4Wrapper.CipherMode</div><div class=info><a href=#s_fn_rc4Wrapper.CipherMode>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/rc4_wrapper.go</code>:</div><table class=listing><tr><td>9<td><code><pre>func (r *rc4Wrapper) CipherMode() Mode { return modeStream }</pre></code></table><div class=funcname id=fn_Mode.String>func Mode.String</div><div class=info><a href=#s_fn_Mode.String>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/mode_enum.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func (m Mode) String() string {</pre></code><tr><td>46<td><code><pre> return modeEnum.String(m)</pre></code><tr><td>47<td><code><pre>}</pre></code></table><div class=funcname id=fn_Mode.SupportStream>func Mode.SupportStream</div><div class=info><a href=#s_fn_Mode.SupportStream>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/mode_enum.go</code>:</div><table class=listing><tr><td>61<td><code><pre>func (m Mode) SupportStream() bool {</pre></code><tr><td>62<td><code><pre> return streamMode.Contains(m)</pre></code><tr><td>63<td><code><pre>}</pre></code></table><div class=funcname id=fn_Mode.ShouldPadding>func Mode.ShouldPadding</div><div class=info><a href=#s_fn_Mode.ShouldPadding>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/mode_enum.go</code>:</div><table class=listing><tr><td>53<td><code><pre>func (m Mode) ShouldPadding() bool {</pre></code><tr><td>54<td><code><pre> return paddingMode.Contains(m)</pre></code><tr><td>55<td><code><pre>}</pre></code></table><div class=funcname id=fn_@84:12>func @84:12</div><div class=info><a href=#s_fn_@84:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>84<td><code><pre>func(b cipher.Block, iv []byte) (bm blockMode, err error) {</pre></code><tr><td>85<td><code><pre> return wrapErr(newBlockModeWrapper(</pre></code><tr><td>86<td><code><pre> wrapStream(cipher.NewCFBDecrypter(b, iv), ModeCFB)),</pre></code><tr><td>87<td><code><pre> )</pre></code><tr><td>88<td><code><pre> }</pre></code></table><div class=funcname id=fn_encrypt>func encrypt</div><div class=info><a href=#s_fn_encrypt>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code>:</div><table class=listing><tr><td>50<td><code><pre>func encrypt(bm blockMode, src []byte) (dst []byte, err error) {</pre></code><tr><td>51<td><code><pre> plainBlockSize := bm.PlainBlockSize()</pre></code><tr><td>52<td><code><pre> cipherBlockSize := bm.CipherBlockSize()</pre></code><tr><td>53<td><code><pre> defers := make([]func(), 0, 3)</pre></code><tr><td>54<td><code><pre> defer func() {</pre></code><tr><td>55<td><code><pre> for _, cb := range defers {</pre></code><tr><td>56<td><code><pre> cb()</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre> }()</pre></code><tr><td>59<td><code><pre></pre></code><tr><td>60<td><code><pre> w, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>61<td><code><pre> defers = append(defers, cb)</pre></code><tr><td>62<td><code><pre></pre></code><tr><td>63<td><code><pre> if plainBlockSize != 0 && cipherBlockSize != 0 {</pre></code><tr><td>64<td><code><pre> w.Grow((len(src) / plainBlockSize) * cipherBlockSize)</pre></code><tr><td>65<td><code><pre> } else {</pre></code><tr><td>66<td><code><pre> plainBlockSize, cipherBlockSize = len(src), len(src)</pre></code><tr><td>67<td><code><pre> w.Grow(cipherBlockSize)</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre></pre></code><tr><td>70<td><code><pre> sealed, cb := utils.BytesPool.Get(cipherBlockSize)</pre></code><tr><td>71<td><code><pre> defers = append(defers, cb)</pre></code><tr><td>72<td><code><pre></pre></code><tr><td>73<td><code><pre> buf, cb := utils.BytesPool.Get(plainBlockSize)</pre></code><tr><td>74<td><code><pre> defers = append(defers, cb)</pre></code><tr><td>75<td><code><pre></pre></code><tr><td>76<td><code><pre> var n, blockSize int</pre></code><tr><td>77<td><code><pre> for len(src) > 0 {</pre></code><tr><td>78<td><code><pre> blockSize = utils.Min(plainBlockSize, len(src))</pre></code><tr><td>79<td><code><pre> n, err = bm.CryptBlocks(sealed[:cipherBlockSize], src[:blockSize], buf)</pre></code><tr><td>80<td><code><pre> if err != nil {</pre></code><tr class=miss><td>81<td><code><pre> return</pre></code><tr><td>82<td><code><pre> }</pre></code><tr><td>83<td><code><pre> if _, err = w.Write(sealed[:n]); err != nil {</pre></code><tr class=miss><td>84<td><code><pre> return</pre></code><tr><td>85<td><code><pre> }</pre></code><tr><td>86<td><code><pre> src = src[blockSize:]</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre></pre></code><tr><td>89<td><code><pre> bs := w.Bytes()</pre></code><tr><td>90<td><code><pre> dst = make([]byte, len(bs))</pre></code><tr><td>91<td><code><pre> copy(dst, bs)</pre></code><tr><td>92<td><code><pre> return</pre></code><tr><td>93<td><code><pre>}</pre></code></table><div class=funcname id=fn_decrypt>func decrypt</div><div class=info><a href=#s_fn_decrypt>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code>:</div><table class=listing><tr><td>53<td><code><pre>func decrypt(bm blockMode, src []byte) (dst []byte, err error) {</pre></code><tr><td>54<td><code><pre> plainBlockSize := bm.PlainBlockSize()</pre></code><tr><td>55<td><code><pre> cipherBlockSize := bm.CipherBlockSize()</pre></code><tr><td>56<td><code><pre> defers := make([]func(), 0, 3)</pre></code><tr><td>57<td><code><pre></pre></code><tr><td>58<td><code><pre> w, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>59<td><code><pre> defers = append(defers, cb)</pre></code><tr><td>60<td><code><pre></pre></code><tr><td>61<td><code><pre> if plainBlockSize != 0 && cipherBlockSize != 0 {</pre></code><tr><td>62<td><code><pre> w.Grow((len(src) / cipherBlockSize) * plainBlockSize)</pre></code><tr><td>63<td><code><pre> } else {</pre></code><tr><td>64<td><code><pre> plainBlockSize, cipherBlockSize = len(src), len(src)</pre></code><tr><td>65<td><code><pre> w.Grow(plainBlockSize)</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre></pre></code><tr><td>68<td><code><pre> unsealed, cb := utils.BytesPool.Get(plainBlockSize)</pre></code><tr><td>69<td><code><pre> defers = append(defers, cb)</pre></code><tr><td>70<td><code><pre></pre></code><tr><td>71<td><code><pre> buf, cb := utils.BytesPool.Get(plainBlockSize)</pre></code><tr><td>72<td><code><pre> defers = append(defers, cb)</pre></code><tr><td>73<td><code><pre></pre></code><tr><td>74<td><code><pre> var n, blockSize int</pre></code><tr><td>75<td><code><pre> for len(src) > 0 {</pre></code><tr><td>76<td><code><pre> blockSize = utils.Min(cipherBlockSize, len(src))</pre></code><tr><td>77<td><code><pre> n, err = bm.CryptBlocks(unsealed[:plainBlockSize], src[:blockSize], buf)</pre></code><tr><td>78<td><code><pre> if err != nil {</pre></code><tr class=miss><td>79<td><code><pre> return</pre></code><tr><td>80<td><code><pre> }</pre></code><tr><td>81<td><code><pre> if _, err = w.Write(unsealed[:n]); err != nil {</pre></code><tr class=miss><td>82<td><code><pre> return</pre></code><tr><td>83<td><code><pre> }</pre></code><tr><td>84<td><code><pre> src = src[blockSize:]</pre></code><tr><td>85<td><code><pre> }</pre></code><tr><td>86<td><code><pre></pre></code><tr><td>87<td><code><pre> bs := w.Bytes()</pre></code><tr><td>88<td><code><pre> dst = make([]byte, len(bs))</pre></code><tr><td>89<td><code><pre> copy(dst, bs)</pre></code><tr><td>90<td><code><pre> return</pre></code><tr><td>91<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewEncFunc>func NewEncFunc</div><div class=info><a href=#s_fn_NewEncFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code>:</div><table class=listing><tr><td>141<td><code><pre>func NewEncFunc(algo Algorithm, mode Mode, key, iv []byte) func(w io.Writer) io.WriteCloser {</pre></code><tr><td>142<td><code><pre> bm, err := getEncrypter(algo, mode, key, iv)</pre></code><tr><td>143<td><code><pre> if err != nil {</pre></code><tr class=miss><td>144<td><code><pre> panic(err)</pre></code><tr><td>145<td><code><pre> }</pre></code><tr><td>146<td><code><pre> if !bm.CipherMode().SupportStream() {</pre></code><tr><td>147<td><code><pre> panic(ErrNotSupportStream)</pre></code><tr><td>148<td><code><pre> }</pre></code><tr><td>149<td><code><pre></pre></code><tr><td>150<td><code><pre> var (</pre></code><tr><td>151<td><code><pre> buf, sealed, sealBuf []byte</pre></code><tr><td>152<td><code><pre> cb func()</pre></code><tr><td>153<td><code><pre> )</pre></code><tr><td>154<td><code><pre> if bm.PlainBlockSize() > 0 {</pre></code><tr><td>155<td><code><pre> var bcb, scb, sbcb func()</pre></code><tr><td>156<td><code><pre> buf, bcb = utils.BytesPool.Get(bm.PlainBlockSize())</pre></code><tr><td>157<td><code><pre> sealed, scb = utils.BytesPool.Get(bm.CipherBlockSize())</pre></code><tr><td>158<td><code><pre> sealBuf, sbcb = utils.BytesPool.Get(bm.PlainBlockSize())</pre></code><tr><td>159<td><code><pre> cb = func() { bcb(); scb(); sbcb() }</pre></code><tr><td>160<td><code><pre> }</pre></code><tr><td>161<td><code><pre></pre></code><tr><td>162<td><code><pre> return func(w io.Writer) io.WriteCloser {</pre></code><tr><td>163<td><code><pre> return &enc{</pre></code><tr><td>164<td><code><pre> bm: bm,</pre></code><tr><td>165<td><code><pre> w: w,</pre></code><tr><td>166<td><code><pre> n: 0,</pre></code><tr><td>167<td><code><pre> buf: buf,</pre></code><tr><td>168<td><code><pre> cb: cb,</pre></code><tr><td>169<td><code><pre> sealed: sealed,</pre></code><tr><td>170<td><code><pre> sealBuf: sealBuf,</pre></code><tr><td>171<td><code><pre> }</pre></code><tr><td>172<td><code><pre> }</pre></code><tr><td>173<td><code><pre>}</pre></code></table><div class=funcname id=fn_dec.Read>func dec.Read</div><div class=info><a href=#s_fn_dec.Read>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code>:</div><table class=listing><tr><td>181<td><code><pre>func (d *dec) Read(p []byte) (n int, err error) {</pre></code><tr><td>182<td><code><pre> var (</pre></code><tr><td>183<td><code><pre> nr, nc int</pre></code><tr><td>184<td><code><pre> dst []byte</pre></code><tr><td>185<td><code><pre> )</pre></code><tr><td>186<td><code><pre></pre></code><tr><td>187<td><code><pre> if d.buf == nil {</pre></code><tr><td>188<td><code><pre> n, err = d.r.Read(p)</pre></code><tr><td>189<td><code><pre> d.eof = errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF)</pre></code><tr><td>190<td><code><pre> if err != nil && !d.eof {</pre></code><tr class=miss><td>191<td><code><pre> return</pre></code><tr><td>192<td><code><pre> }</pre></code><tr><td>193<td><code><pre> dst, err = decrypt(d.bm, p[:n])</pre></code><tr><td>194<td><code><pre> if err != nil {</pre></code><tr class=miss><td>195<td><code><pre> return</pre></code><tr><td>196<td><code><pre> }</pre></code><tr><td>197<td><code><pre> n = copy(p[:len(dst)], dst)</pre></code><tr><td>198<td><code><pre> if d.eof {</pre></code><tr><td>199<td><code><pre> err = io.EOF</pre></code><tr><td>200<td><code><pre> }</pre></code><tr><td>201<td><code><pre> return</pre></code><tr><td>202<td><code><pre> }</pre></code><tr><td>203<td><code><pre></pre></code><tr><td>204<td><code><pre> for len(p) > 0 {</pre></code><tr><td>205<td><code><pre> // read from buffer</pre></code><tr><td>206<td><code><pre> if length := d.end - d.n; length > 0 {</pre></code><tr><td>207<td><code><pre> copied := utils.Min(length, len(p))</pre></code><tr><td>208<td><code><pre> n += copy(p[:copied], d.buf[d.n:d.n+copied])</pre></code><tr><td>209<td><code><pre> d.n += copied</pre></code><tr><td>210<td><code><pre> p = p[copied:]</pre></code><tr><td>211<td><code><pre> continue</pre></code><tr><td>212<td><code><pre> }</pre></code><tr><td>213<td><code><pre></pre></code><tr><td>214<td><code><pre> // buffer is empty, write new buffer</pre></code><tr><td>215<td><code><pre> if d.eof {</pre></code><tr><td>216<td><code><pre> return n, io.EOF</pre></code><tr><td>217<td><code><pre> }</pre></code><tr><td>218<td><code><pre> d.n = 0</pre></code><tr><td>219<td><code><pre> d.end = 0</pre></code><tr><td>220<td><code><pre> for {</pre></code><tr><td>221<td><code><pre> nr, err = d.r.Read(d.buf[d.n:d.size])</pre></code><tr><td>222<td><code><pre> d.eof = errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF)</pre></code><tr><td>223<td><code><pre> if err != nil && !d.eof {</pre></code><tr class=miss><td>224<td><code><pre> return</pre></code><tr><td>225<td><code><pre> }</pre></code><tr><td>226<td><code><pre></pre></code><tr><td>227<td><code><pre> d.n += nr</pre></code><tr><td>228<td><code><pre> if d.n < d.size && !d.eof {</pre></code><tr><td>229<td><code><pre> continue</pre></code><tr><td>230<td><code><pre> }</pre></code><tr><td>231<td><code><pre></pre></code><tr><td>232<td><code><pre> nc, err = d.bm.CryptBlocks(d.unsealed, d.buf[:d.n], d.unsealBuf)</pre></code><tr><td>233<td><code><pre> if err != nil {</pre></code><tr class=miss><td>234<td><code><pre> return</pre></code><tr><td>235<td><code><pre> }</pre></code><tr><td>236<td><code><pre></pre></code><tr><td>237<td><code><pre> d.end += copy(d.buf[:nc], d.unsealed[:nc])</pre></code><tr><td>238<td><code><pre> d.n = 0</pre></code><tr><td>239<td><code><pre> break</pre></code><tr><td>240<td><code><pre> }</pre></code><tr><td>241<td><code><pre> }</pre></code><tr><td>242<td><code><pre></pre></code><tr><td>243<td><code><pre> return</pre></code><tr><td>244<td><code><pre>}</pre></code></table><div class=funcname id=fn_enc.Write>func enc.Write</div><div class=info><a href=#s_fn_enc.Write>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code>:</div><table class=listing><tr><td>175<td><code><pre>func (e *enc) Write(p []byte) (n int, err error) {</pre></code><tr><td>176<td><code><pre> if e.buf == nil {</pre></code><tr><td>177<td><code><pre> var dst []byte</pre></code><tr><td>178<td><code><pre> dst, err = encrypt(e.bm, p)</pre></code><tr><td>179<td><code><pre> if err != nil {</pre></code><tr class=miss><td>180<td><code><pre> return</pre></code><tr><td>181<td><code><pre> }</pre></code><tr><td>182<td><code><pre> n = len(p)</pre></code><tr><td>183<td><code><pre> _, err = e.w.Write(dst)</pre></code><tr><td>184<td><code><pre> return</pre></code><tr><td>185<td><code><pre> }</pre></code><tr><td>186<td><code><pre></pre></code><tr><td>187<td><code><pre> written := 0</pre></code><tr><td>188<td><code><pre> for len(p) > 0 {</pre></code><tr><td>189<td><code><pre> nCopy := utils.Min(len(p), len(e.buf)-e.n)</pre></code><tr><td>190<td><code><pre> copy(e.buf[e.n:], p[:nCopy])</pre></code><tr><td>191<td><code><pre> e.n += nCopy</pre></code><tr><td>192<td><code><pre> written += nCopy</pre></code><tr><td>193<td><code><pre> p = p[nCopy:]</pre></code><tr><td>194<td><code><pre></pre></code><tr><td>195<td><code><pre> if e.n == len(e.buf) {</pre></code><tr><td>196<td><code><pre> if err = e.flush(); err != nil {</pre></code><tr class=miss><td>197<td><code><pre> return written, err</pre></code><tr><td>198<td><code><pre> }</pre></code><tr><td>199<td><code><pre> }</pre></code><tr><td>200<td><code><pre> }</pre></code><tr><td>201<td><code><pre></pre></code><tr><td>202<td><code><pre> return written, nil</pre></code><tr><td>203<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewDecFunc>func NewDecFunc</div><div class=info><a href=#s_fn_NewDecFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code>:</div><table class=listing><tr><td>142<td><code><pre>func NewDecFunc(algo Algorithm, mode Mode, key, iv []byte) func(r io.Reader) io.ReadCloser {</pre></code><tr><td>143<td><code><pre> bm, err := getDecrypter(algo, mode, key, iv)</pre></code><tr><td>144<td><code><pre> if err != nil {</pre></code><tr class=miss><td>145<td><code><pre> panic(err)</pre></code><tr><td>146<td><code><pre> }</pre></code><tr><td>147<td><code><pre> if !bm.CipherMode().SupportStream() {</pre></code><tr class=miss><td>148<td><code><pre> panic(ErrNotSupportStream)</pre></code><tr><td>149<td><code><pre> }</pre></code><tr><td>150<td><code><pre></pre></code><tr><td>151<td><code><pre> var (</pre></code><tr><td>152<td><code><pre> buf, unsealed, unsealBuf []byte</pre></code><tr><td>153<td><code><pre> cb func()</pre></code><tr><td>154<td><code><pre> size int</pre></code><tr><td>155<td><code><pre> )</pre></code><tr><td>156<td><code><pre></pre></code><tr><td>157<td><code><pre> if size = bm.CipherBlockSize(); size > 0 {</pre></code><tr><td>158<td><code><pre> var bcb, ucb, ubcb func()</pre></code><tr><td>159<td><code><pre> buf, bcb = utils.BytesPool.Get(size)</pre></code><tr><td>160<td><code><pre> unsealed, ucb = utils.BytesPool.Get(bm.PlainBlockSize())</pre></code><tr><td>161<td><code><pre> unsealBuf, ubcb = utils.BytesPool.Get(bm.PlainBlockSize())</pre></code><tr><td>162<td><code><pre> cb = func() { bcb(); ucb(); ubcb() }</pre></code><tr><td>163<td><code><pre> }</pre></code><tr><td>164<td><code><pre></pre></code><tr><td>165<td><code><pre> return func(r io.Reader) io.ReadCloser {</pre></code><tr><td>166<td><code><pre> return &dec{</pre></code><tr><td>167<td><code><pre> bm: bm,</pre></code><tr><td>168<td><code><pre> r: r,</pre></code><tr><td>169<td><code><pre> buf: buf,</pre></code><tr><td>170<td><code><pre> cb: cb,</pre></code><tr><td>171<td><code><pre> n: 0,</pre></code><tr><td>172<td><code><pre> end: 0,</pre></code><tr><td>173<td><code><pre> size: size,</pre></code><tr><td>174<td><code><pre> eof: false,</pre></code><tr><td>175<td><code><pre> unsealed: unsealed,</pre></code><tr><td>176<td><code><pre> unsealBuf: unsealBuf,</pre></code><tr><td>177<td><code><pre> }</pre></code><tr><td>178<td><code><pre> }</pre></code><tr><td>179<td><code><pre>}</pre></code></table><div class=funcname id=fn_@19:9>func @19:9</div><div class=info><a href=#s_fn_@19:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func(src []byte) (dst []byte, err error) {</pre></code><tr><td>20<td><code><pre> dst, err = decrypt(bm, src)</pre></code><tr><td>21<td><code><pre> if err != nil {</pre></code><tr class=miss><td>22<td><code><pre> return</pre></code><tr><td>23<td><code><pre> }</pre></code><tr><td>24<td><code><pre> if mode.ShouldPadding() {</pre></code><tr><td>25<td><code><pre> dst, err = PKCS7Unpad(dst)</pre></code><tr><td>26<td><code><pre> }</pre></code><tr><td>27<td><code><pre> return</pre></code><tr><td>28<td><code><pre> }</pre></code></table><div class=funcname id=fn_DecryptStreamFunc>func DecryptStreamFunc</div><div class=info><a href=#s_fn_DecryptStreamFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func DecryptStreamFunc(algo Algorithm, mode Mode, key, iv []byte) (</pre></code><tr><td>32<td><code><pre> dec func(dst io.Writer, src io.Reader) (err error), err error) {</pre></code><tr><td>33<td><code><pre> var fn func(src io.Reader) io.ReadCloser</pre></code><tr><td>34<td><code><pre></pre></code><tr><td>35<td><code><pre> _, err = utils.Catch(func() { fn = NewDecFunc(algo, mode, key, iv) })</pre></code><tr><td>36<td><code><pre> if err != nil {</pre></code><tr class=miss><td>37<td><code><pre> return</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre></pre></code><tr><td>40<td><code><pre> dec = func(dst io.Writer, src io.Reader) (err error) {</pre></code><tr><td>41<td><code><pre> buf, cb := utils.BytesPool.Get(defaultBlockSize * blockSizeTimes)</pre></code><tr><td>42<td><code><pre> defer cb()</pre></code><tr><td>43<td><code><pre></pre></code><tr><td>44<td><code><pre> wrapper := fn(src)</pre></code><tr><td>45<td><code><pre> defer utils.CloseAnyway(wrapper)</pre></code><tr><td>46<td><code><pre> _, err = io.CopyBuffer(dst, wrapper, buf)</pre></code><tr><td>47<td><code><pre> return</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre></pre></code><tr><td>50<td><code><pre> return</pre></code><tr><td>51<td><code><pre>}</pre></code></table><div class=funcname id=fn_EncryptBytesFunc>func EncryptBytesFunc</div><div class=info><a href=#s_fn_EncryptBytesFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code>:</div><table class=listing><tr><td>11<td><code><pre>func EncryptBytesFunc(algo Algorithm, mode Mode, key, iv []byte) (</pre></code><tr><td>12<td><code><pre> enc func(src []byte) (dst []byte, err error), err error) {</pre></code><tr><td>13<td><code><pre> bm, err := getEncrypter(algo, mode, key, iv)</pre></code><tr><td>14<td><code><pre> if err != nil {</pre></code><tr class=miss><td>15<td><code><pre> return</pre></code><tr><td>16<td><code><pre> }</pre></code><tr><td>17<td><code><pre> mode = bm.CipherMode()</pre></code><tr><td>18<td><code><pre> plainBlockSize := bm.PlainBlockSize()</pre></code><tr><td>19<td><code><pre> return func(src []byte) (dst []byte, err error) {</pre></code><tr><td>20<td><code><pre> if mode.ShouldPadding() {</pre></code><tr><td>21<td><code><pre> src = PKCS7Pad(src, plainBlockSize)</pre></code><tr><td>22<td><code><pre> }</pre></code><tr><td>23<td><code><pre> return encrypt(bm, src)</pre></code><tr><td>24<td><code><pre> }, err</pre></code><tr><td>25<td><code><pre>}</pre></code></table><div class=funcname id=fn_blockModeWrapper.CryptBlocks>func blockModeWrapper.CryptBlocks</div><div class=info><a href=#s_fn_blockModeWrapper.CryptBlocks>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/block_mode_wrapper.go</code>:</div><table class=listing><tr><td>75<td><code><pre>func (b *blockModeWrapper) CryptBlocks(dst, src, buf []byte) (n int, err error) {</pre></code><tr><td>76<td><code><pre> if len(src) == 0 {</pre></code><tr class=miss><td>77<td><code><pre> return</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre> n = len(src)</pre></code><tr><td>80<td><code><pre> switch {</pre></code><tr><td>81<td><code><pre> case b.blockMode != nil:</pre></code><tr><td>82<td><code><pre> b.blockMode.CryptBlocks(dst, src)</pre></code><tr><td>83<td><code><pre> case b.block != nil:</pre></code><tr><td>84<td><code><pre> if b.isEncoder {</pre></code><tr><td>85<td><code><pre> b.block.Encrypt(dst, src)</pre></code><tr><td>86<td><code><pre> } else {</pre></code><tr><td>87<td><code><pre> b.block.Decrypt(dst, src)</pre></code><tr><td>88<td><code><pre> }</pre></code><tr><td>89<td><code><pre> case b.stream != nil:</pre></code><tr><td>90<td><code><pre> b.stream.XORKeyStream(dst, src)</pre></code><tr><td>91<td><code><pre> default:</pre></code><tr class=miss><td>92<td><code><pre> copy(dst, src)</pre></code><tr><td>93<td><code><pre> }</pre></code><tr><td>94<td><code><pre> return</pre></code><tr><td>95<td><code><pre>}</pre></code></table><div class=funcname id=fn_aeadEncryptWrapper.CryptBlocks>func aeadEncryptWrapper.CryptBlocks</div><div class=info><a href=#s_fn_aeadEncryptWrapper.CryptBlocks>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/aead_wrapper.go</code>:</div><table class=listing><tr><td>53<td><code><pre>func (a *aeadEncryptWrapper) CryptBlocks(dst, src, buf []byte) (n int, err error) {</pre></code><tr><td>54<td><code><pre> if len(src) == 0 {</pre></code><tr class=miss><td>55<td><code><pre> return</pre></code><tr><td>56<td><code><pre> }</pre></code><tr><td>57<td><code><pre></pre></code><tr><td>58<td><code><pre> nonce, cb := utils.BytesPool.Get(a.nonceSize)</pre></code><tr><td>59<td><code><pre> defer cb()</pre></code><tr><td>60<td><code><pre> if _, err = utils.CryptoRandom(nonce); err != nil {</pre></code><tr class=miss><td>61<td><code><pre> return</pre></code><tr><td>62<td><code><pre> }</pre></code><tr><td>63<td><code><pre></pre></code><tr><td>64<td><code><pre> sealed := a.Seal(buf[:0], nonce, src[:utils.Min(a.plainBlockSize, len(src))], nil)</pre></code><tr><td>65<td><code><pre> copy(dst[:a.nonceSize], nonce)</pre></code><tr><td>66<td><code><pre> copy(dst[a.nonceSize:], sealed)</pre></code><tr><td>67<td><code><pre> n = len(nonce) + len(sealed)</pre></code><tr><td>68<td><code><pre> return</pre></code><tr><td>69<td><code><pre>}</pre></code></table><div class=funcname id=fn_@126:31>func @126:31</div><div class=info><a href=#s_fn_@126:31>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>126<td><code><pre>func(key []byte) (bm blockMode, err error) {</pre></code><tr><td>127<td><code><pre> cipherAEAD, err := chacha20poly1305.NewX(key)</pre></code><tr><td>128<td><code><pre> if err != nil {</pre></code><tr class=miss><td>129<td><code><pre> return</pre></code><tr><td>130<td><code><pre> }</pre></code><tr><td>131<td><code><pre> bm = newAEADEncryptWrapper(cipherAEAD, defaultBlockSize, modeStream)</pre></code><tr><td>132<td><code><pre> return</pre></code><tr><td>133<td><code><pre> }</pre></code></table><div class=funcname id=fn_@136:17>func @136:17</div><div class=info><a href=#s_fn_@136:17>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>136<td><code><pre>func(key []byte) (bm blockMode, err error) {</pre></code><tr><td>137<td><code><pre> cipher, err := rc4.NewCipher(key)</pre></code><tr><td>138<td><code><pre> if err != nil {</pre></code><tr class=miss><td>139<td><code><pre> return</pre></code><tr><td>140<td><code><pre> }</pre></code><tr><td>141<td><code><pre> bm = &rc4Wrapper{rc: cipher}</pre></code><tr><td>142<td><code><pre> return</pre></code><tr><td>143<td><code><pre> }</pre></code></table><div class=funcname id=fn_@118:30>func @118:30</div><div class=info><a href=#s_fn_@118:30>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>118<td><code><pre>func(key []byte) (bm blockMode, err error) {</pre></code><tr><td>119<td><code><pre> cipherAEAD, err := chacha20poly1305.New(key)</pre></code><tr><td>120<td><code><pre> if err != nil {</pre></code><tr class=miss><td>121<td><code><pre> return</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre> bm = newAEADEncryptWrapper(cipherAEAD, defaultBlockSize, modeStream)</pre></code><tr><td>124<td><code><pre> return</pre></code><tr><td>125<td><code><pre> }</pre></code></table><div class=funcname id=fn_@144:30>func @144:30</div><div class=info><a href=#s_fn_@144:30>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>144<td><code><pre>func(key []byte) (bm blockMode, err error) {</pre></code><tr><td>145<td><code><pre> cipherAEAD, err := chacha20poly1305.New(key)</pre></code><tr><td>146<td><code><pre> if err != nil {</pre></code><tr class=miss><td>147<td><code><pre> return</pre></code><tr><td>148<td><code><pre> }</pre></code><tr><td>149<td><code><pre> bm = newAEADDecryptWrapper(cipherAEAD, defaultBlockSize, modeStream)</pre></code><tr><td>150<td><code><pre> return</pre></code><tr><td>151<td><code><pre> }</pre></code></table><div class=funcname id=fn_@110:17>func @110:17</div><div class=info><a href=#s_fn_@110:17>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>110<td><code><pre>func(key []byte) (bm blockMode, err error) {</pre></code><tr><td>111<td><code><pre> cipher, err := rc4.NewCipher(key)</pre></code><tr><td>112<td><code><pre> if err != nil {</pre></code><tr class=miss><td>113<td><code><pre> return</pre></code><tr><td>114<td><code><pre> }</pre></code><tr><td>115<td><code><pre> bm = &rc4Wrapper{rc: cipher}</pre></code><tr><td>116<td><code><pre> return</pre></code><tr><td>117<td><code><pre> }</pre></code></table><div class=funcname id=fn_DecryptBytesFunc>func DecryptBytesFunc</div><div class=info><a href=#s_fn_DecryptBytesFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code>:</div><table class=listing><tr><td>12<td><code><pre>func DecryptBytesFunc(algo Algorithm, mode Mode, key, iv []byte) (</pre></code><tr><td>13<td><code><pre> enc func(src []byte) (dst []byte, err error), err error) {</pre></code><tr><td>14<td><code><pre> bm, err := getDecrypter(algo, mode, key, iv)</pre></code><tr><td>15<td><code><pre> if err != nil {</pre></code><tr class=miss><td>16<td><code><pre> return</pre></code><tr><td>17<td><code><pre> }</pre></code><tr><td>18<td><code><pre> mode = bm.CipherMode()</pre></code><tr><td>19<td><code><pre> return func(src []byte) (dst []byte, err error) {</pre></code><tr><td>20<td><code><pre> dst, err = decrypt(bm, src)</pre></code><tr><td>21<td><code><pre> if err != nil {</pre></code><tr><td>22<td><code><pre> return</pre></code><tr><td>23<td><code><pre> }</pre></code><tr><td>24<td><code><pre> if mode.ShouldPadding() {</pre></code><tr><td>25<td><code><pre> dst, err = PKCS7Unpad(dst)</pre></code><tr><td>26<td><code><pre> }</pre></code><tr><td>27<td><code><pre> return</pre></code><tr><td>28<td><code><pre> }, err</pre></code><tr><td>29<td><code><pre>}</pre></code></table><div class=funcname id=fn_rc4Wrapper.CryptBlocks>func rc4Wrapper.CryptBlocks</div><div class=info><a href=#s_fn_rc4Wrapper.CryptBlocks>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/rc4_wrapper.go</code>:</div><table class=listing><tr><td>12<td><code><pre>func (r *rc4Wrapper) CryptBlocks(dst, src, buf []byte) (n int, err error) {</pre></code><tr><td>13<td><code><pre> if len(src) == 0 {</pre></code><tr class=miss><td>14<td><code><pre> return</pre></code><tr><td>15<td><code><pre> }</pre></code><tr><td>16<td><code><pre> r.rc.XORKeyStream(dst, src)</pre></code><tr><td>17<td><code><pre> n = len(src)</pre></code><tr><td>18<td><code><pre> return</pre></code><tr><td>19<td><code><pre>}</pre></code></table><div class=funcname id=fn_@152:31>func @152:31</div><div class=info><a href=#s_fn_@152:31>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>152<td><code><pre>func(key []byte) (bm blockMode, err error) {</pre></code><tr><td>153<td><code><pre> cipherAEAD, err := chacha20poly1305.NewX(key)</pre></code><tr><td>154<td><code><pre> if err != nil {</pre></code><tr class=miss><td>155<td><code><pre> return</pre></code><tr><td>156<td><code><pre> }</pre></code><tr><td>157<td><code><pre> bm = newAEADDecryptWrapper(cipherAEAD, defaultBlockSize, modeStream)</pre></code><tr><td>158<td><code><pre> return</pre></code><tr><td>159<td><code><pre> }</pre></code></table><div class=funcname id=fn_@99:12>func @99:12</div><div class=info><a href=#s_fn_@99:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>99<td><code><pre>func(b cipher.Block, iv []byte) (bm blockMode, err error) {</pre></code><tr><td>100<td><code><pre> cipherAEAD, err := cipher.NewGCM(b)</pre></code><tr><td>101<td><code><pre> if err != nil {</pre></code><tr class=miss><td>102<td><code><pre> return</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre> bm = newAEADDecryptWrapper(cipherAEAD, b.BlockSize(), ModeGCM)</pre></code><tr><td>105<td><code><pre> return</pre></code><tr><td>106<td><code><pre> }</pre></code></table><div class=funcname id=fn_@64:12>func @64:12</div><div class=info><a href=#s_fn_@64:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/types.go</code>:</div><table class=listing><tr><td>64<td><code><pre>func(b cipher.Block, iv []byte) (e blockMode, err error) {</pre></code><tr><td>65<td><code><pre> aead, err := cipher.NewGCM(b)</pre></code><tr><td>66<td><code><pre> if err != nil {</pre></code><tr class=miss><td>67<td><code><pre> return</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre> e = newAEADEncryptWrapper(aead, b.BlockSize(), ModeGCM)</pre></code><tr><td>70<td><code><pre> return</pre></code><tr><td>71<td><code><pre> }</pre></code></table><div class=funcname id=fn_aeadDecryptWrapper.CryptBlocks>func aeadDecryptWrapper.CryptBlocks</div><div class=info><a href=#s_fn_aeadDecryptWrapper.CryptBlocks>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/aead_wrapper.go</code>:</div><table class=listing><tr><td>79<td><code><pre>func (a *aeadDecryptWrapper) CryptBlocks(dst, src, buf []byte) (n int, err error) {</pre></code><tr><td>80<td><code><pre> if len(src) == 0 {</pre></code><tr class=miss><td>81<td><code><pre> return</pre></code><tr><td>82<td><code><pre> }</pre></code><tr><td>83<td><code><pre> sealedSize := utils.Min(a.sealedSize, len(src)-a.nonceSize)</pre></code><tr><td>84<td><code><pre> if sealedSize < 0 {</pre></code><tr class=miss><td>85<td><code><pre> return 0, errors.New("input not full blocks when decrypt")</pre></code><tr><td>86<td><code><pre> }</pre></code><tr><td>87<td><code><pre></pre></code><tr><td>88<td><code><pre> nonce := src[:a.nonceSize]</pre></code><tr><td>89<td><code><pre> src = src[a.nonceSize:]</pre></code><tr><td>90<td><code><pre> unsealed, err := a.Open(buf[:0], nonce, src[:sealedSize], nil)</pre></code><tr><td>91<td><code><pre> if err != nil {</pre></code><tr class=miss><td>92<td><code><pre> return</pre></code><tr><td>93<td><code><pre> }</pre></code><tr><td>94<td><code><pre></pre></code><tr><td>95<td><code><pre> copy(dst, unsealed)</pre></code><tr><td>96<td><code><pre> n = len(unsealed)</pre></code><tr><td>97<td><code><pre> return</pre></code><tr><td>98<td><code><pre>}</pre></code></table><div class=funcname id=fn_PKCS7Pad>func PKCS7Pad</div><div class=info><a href=#s_fn_PKCS7Pad>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/padding.go</code>:</div><table class=listing><tr><td>9<td><code><pre>func PKCS7Pad(data []byte, blockSize int) []byte {</pre></code><tr><td>10<td><code><pre> if blockSize == 0 {</pre></code><tr class=miss><td>11<td><code><pre> return data</pre></code><tr><td>12<td><code><pre> }</pre></code><tr><td>13<td><code><pre> padding := blockSize - len(data)%blockSize</pre></code><tr><td>14<td><code><pre> return append(data, bytes.Repeat([]byte{byte(padding)}, padding)...)</pre></code><tr><td>15<td><code><pre>}</pre></code></table><div class=funcname id=fn_getEncrypter>func getEncrypter</div><div class=info><a href=#s_fn_getEncrypter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code>:</div><table class=listing><tr><td>95<td><code><pre>func getEncrypter(algo Algorithm, mode Mode, key, iv []byte) (bm blockMode, err error) {</pre></code><tr><td>96<td><code><pre> if blockMapping, ok := cipherBlockMapping[algo]; ok {</pre></code><tr><td>97<td><code><pre> var cipherBlock cipher.Block</pre></code><tr><td>98<td><code><pre> cipherBlock, err = blockMapping(key)</pre></code><tr><td>99<td><code><pre> if err != nil {</pre></code><tr class=miss><td>100<td><code><pre> return</pre></code><tr><td>101<td><code><pre> }</pre></code><tr><td>102<td><code><pre> modeMapping, ok := encryptModeMapping[mode]</pre></code><tr><td>103<td><code><pre> if !ok {</pre></code><tr class=miss><td>104<td><code><pre> return nil, fmt.Errorf("unknown cipher mode %+v", mode)</pre></code><tr><td>105<td><code><pre> }</pre></code><tr><td>106<td><code><pre> bm, err = modeMapping(cipherBlock, iv)</pre></code><tr><td>107<td><code><pre> if err != nil {</pre></code><tr class=miss><td>108<td><code><pre> return</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre> }</pre></code><tr><td>111<td><code><pre></pre></code><tr><td>112<td><code><pre> // stream</pre></code><tr><td>113<td><code><pre> if bm == nil {</pre></code><tr><td>114<td><code><pre> blockMapping, ok := streamEncryptMapping[algo]</pre></code><tr><td>115<td><code><pre> if !ok {</pre></code><tr class=miss><td>116<td><code><pre> return nil, fmt.Errorf("unknown cipher algorithm %+v", algo)</pre></code><tr><td>117<td><code><pre> }</pre></code><tr><td>118<td><code><pre> if bm, err = blockMapping(key); err != nil {</pre></code><tr class=miss><td>119<td><code><pre> return</pre></code><tr><td>120<td><code><pre> }</pre></code><tr><td>121<td><code><pre> }</pre></code><tr><td>122<td><code><pre></pre></code><tr><td>123<td><code><pre> if bm == nil {</pre></code><tr class=miss><td>124<td><code><pre> return nil, fmt.Errorf("unknown cipher algorithm(%+v) or mode(%+v)", algo, mode)</pre></code><tr><td>125<td><code><pre> }</pre></code><tr><td>126<td><code><pre></pre></code><tr><td>127<td><code><pre> return</pre></code><tr><td>128<td><code><pre>}</pre></code></table><div class=funcname id=fn_getDecrypter>func getDecrypter</div><div class=info><a href=#s_fn_getDecrypter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/decrypt.go</code>:</div><table class=listing><tr><td>93<td><code><pre>func getDecrypter(algo Algorithm, mode Mode, key, iv []byte) (bm blockMode, err error) {</pre></code><tr><td>94<td><code><pre> if blockMapping, ok := cipherBlockMapping[algo]; ok {</pre></code><tr><td>95<td><code><pre> var cipherBlock cipher.Block</pre></code><tr><td>96<td><code><pre> cipherBlock, err = blockMapping(key)</pre></code><tr><td>97<td><code><pre> if err != nil {</pre></code><tr class=miss><td>98<td><code><pre> return</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre> modeMapping, ok := decryptModeMapping[mode]</pre></code><tr><td>101<td><code><pre> if !ok {</pre></code><tr class=miss><td>102<td><code><pre> return nil, fmt.Errorf("unknown cipher mode %+v", mode)</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre> bm, err = modeMapping(cipherBlock, iv)</pre></code><tr><td>105<td><code><pre> if err != nil {</pre></code><tr class=miss><td>106<td><code><pre> return</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre> }</pre></code><tr><td>109<td><code><pre></pre></code><tr><td>110<td><code><pre> // stream</pre></code><tr><td>111<td><code><pre> if bm == nil {</pre></code><tr><td>112<td><code><pre> blockMapping, ok := streamDecryptMapping[algo]</pre></code><tr><td>113<td><code><pre> if !ok {</pre></code><tr class=miss><td>114<td><code><pre> return nil, fmt.Errorf("unknown cipher algorithm %+v", algo)</pre></code><tr><td>115<td><code><pre> }</pre></code><tr><td>116<td><code><pre> if bm, err = blockMapping(key); err != nil {</pre></code><tr class=miss><td>117<td><code><pre> return</pre></code><tr><td>118<td><code><pre> }</pre></code><tr><td>119<td><code><pre> }</pre></code><tr><td>120<td><code><pre></pre></code><tr><td>121<td><code><pre> if bm == nil {</pre></code><tr class=miss><td>122<td><code><pre> return nil, fmt.Errorf("unknown cipher algorithm(%+v) or mode(%+v)", algo, mode)</pre></code><tr><td>123<td><code><pre> }</pre></code><tr><td>124<td><code><pre></pre></code><tr><td>125<td><code><pre> return</pre></code><tr><td>126<td><code><pre>}</pre></code></table><div class=funcname id=fn_enc.flush>func enc.flush</div><div class=info><a href=#s_fn_enc.flush>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/encrypt.go</code>:</div><table class=listing><tr><td>205<td><code><pre>func (e *enc) flush() (err error) {</pre></code><tr><td>206<td><code><pre> if e.buf == nil {</pre></code><tr class=miss><td>207<td><code><pre> return</pre></code><tr><td>208<td><code><pre> }</pre></code><tr><td>209<td><code><pre></pre></code><tr><td>210<td><code><pre> n, err := e.bm.CryptBlocks(e.sealed, e.buf[:e.n], e.sealBuf)</pre></code><tr><td>211<td><code><pre> if err != nil {</pre></code><tr class=miss><td>212<td><code><pre> return</pre></code><tr><td>213<td><code><pre> }</pre></code><tr><td>214<td><code><pre></pre></code><tr><td>215<td><code><pre> _, err = e.w.Write(e.sealed[:n])</pre></code><tr><td>216<td><code><pre> if err != nil {</pre></code><tr class=miss><td>217<td><code><pre> return err</pre></code><tr><td>218<td><code><pre> }</pre></code><tr><td>219<td><code><pre></pre></code><tr><td>220<td><code><pre> e.n = 0</pre></code><tr><td>221<td><code><pre> return</pre></code><tr><td>222<td><code><pre>}</pre></code></table><div class=funcname id=fn_PKCS7Unpad>func PKCS7Unpad</div><div class=info><a href=#s_fn_PKCS7Unpad>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/padding.go</code>:</div><table class=listing><tr><td>18<td><code><pre>func PKCS7Unpad(data []byte) ([]byte, error) {</pre></code><tr><td>19<td><code><pre> length := len(data)</pre></code><tr><td>20<td><code><pre> if length == 0 {</pre></code><tr class=miss><td>21<td><code><pre> return data, nil</pre></code><tr><td>22<td><code><pre> }</pre></code><tr><td>23<td><code><pre> padding := int(data[length-1])</pre></code><tr><td>24<td><code><pre> if padding == 0 || padding > len(data) {</pre></code><tr class=miss><td>25<td><code><pre> return data, errors.New("invalid pkcs7 padding (padding size > data)")</pre></code><tr><td>26<td><code><pre> }</pre></code><tr><td>27<td><code><pre> for i := 1; i < padding; i++ {</pre></code><tr><td>28<td><code><pre> if data[length-1-i] != byte(padding) {</pre></code><tr class=miss><td>29<td><code><pre> return data, errors.New("invalid pkcs7 padding (pad[i] != padding text)")</pre></code><tr><td>30<td><code><pre> }</pre></code><tr><td>31<td><code><pre> }</pre></code><tr><td>32<td><code><pre></pre></code><tr><td>33<td><code><pre> return data[:(length - padding)], nil</pre></code><tr><td>34<td><code><pre>}</pre></code></table><div class=funcname id=fn_ParseMode>func ParseMode</div><div class=info><a href=#s_fn_ParseMode>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/mode_enum.go</code>:</div><table class=listing><tr><td>65<td><code><pre>func ParseMode(s any) Mode {</pre></code><tr><td>66<td><code><pre> switch v := s.(type) {</pre></code><tr><td>67<td><code><pre> case string:</pre></code><tr><td>68<td><code><pre> if enumList := modeEnum.Enum(v); len(enumList) > 0 {</pre></code><tr><td>69<td><code><pre> return enumList[0]</pre></code><tr><td>70<td><code><pre> }</pre></code><tr><td>71<td><code><pre> case Mode:</pre></code><tr class=miss><td>72<td><code><pre> return v</pre></code><tr><td>73<td><code><pre> default:</pre></code><tr class=miss><td>74<td><code><pre> return Mode(cast.ToInt(s))</pre></code><tr><td>75<td><code><pre> }</pre></code><tr class=miss><td>76<td><code><pre> return ModeUnknown</pre></code><tr><td>77<td><code><pre>}</pre></code></table><div class=funcname id=fn_ParseAlgorithm>func ParseAlgorithm</div><div class=info><a href=#s_fn_ParseAlgorithm>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/algorithm_enum.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func ParseAlgorithm(s any) Algorithm {</pre></code><tr><td>50<td><code><pre> switch v := s.(type) {</pre></code><tr><td>51<td><code><pre> case string:</pre></code><tr><td>52<td><code><pre> if enumList := algorithmEnum.Enum(v); len(enumList) > 0 {</pre></code><tr><td>53<td><code><pre> return enumList[0]</pre></code><tr><td>54<td><code><pre> }</pre></code><tr><td>55<td><code><pre> case Algorithm:</pre></code><tr class=miss><td>56<td><code><pre> return v</pre></code><tr><td>57<td><code><pre> default:</pre></code><tr class=miss><td>58<td><code><pre> return Algorithm(cast.ToInt(s))</pre></code><tr><td>59<td><code><pre> }</pre></code><tr class=miss><td>60<td><code><pre> return AlgorithmUnknown</pre></code><tr><td>61<td><code><pre>}</pre></code></table><div class=funcname id=fn_Algorithm.Value>func Algorithm.Value</div><div class=info><a href=#s_fn_Algorithm.Value>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/algorithm_enum.go</code>:</div><table class=listing><tr><td>37<td><code><pre>func (e Algorithm) Value() uint8 {</pre></code><tr class=miss><td>38<td><code><pre> return uint8(e)</pre></code><tr><td>39<td><code><pre>}</pre></code></table><div class=funcname id=fn_Mode.Value>func Mode.Value</div><div class=info><a href=#s_fn_Mode.Value>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cipher/mode_enum.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func (m Mode) Value() uint8 {</pre></code><tr class=miss><td>42<td><code><pre> return uint8(m)</pre></code><tr><td>43<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/common/utils/clone class=funcname>Package Overview: github.com/wfusion/gofusion/common/utils/clone 14 <span class=packageTotal>37.5%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/structtype.go</code><td class=percent><code>100.0%</code><td class=linecount><code>14/14</code><tr id=s_fn_Allocator.lookupStructType><td><code><a href=#fn_Allocator.lookupStructType>Allocator.lookupStructType(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>100.0%</code><td class=linecount><code>9/9</code><tr id=s_fn_SliceComparable><td><code><a href=#fn_SliceComparable>SliceComparable(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/base.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_cloneState.cloneInterface><td><code><a href=#fn_cloneState.cloneInterface>cloneState.cloneInterface(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_cloneState.cloneStruct><td><code><a href=#fn_cloneState.cloneStruct>cloneState.cloneStruct(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_IsScalar><td><code><a href=#fn_IsScalar>IsScalar(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/structtype.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_cloneState.cloneArray><td><code><a href=#fn_cloneState.cloneArray>cloneState.cloneArray(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_parseReflectValue><td><code><a href=#fn_parseReflectValue>parseReflectValue(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/interfacedata.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_Allocator.MarkAsOpaquePointer><td><code><a href=#fn_Allocator.MarkAsOpaquePointer>Allocator.MarkAsOpaquePointer(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_Clone><td><code><a href=#fn_Clone>Clone(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_markAsOpaquePointer><td><code><a href=#fn_markAsOpaquePointer>markAsOpaquePointer(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/structtype.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_MakeCloner><td><code><a href=#fn_MakeCloner>MakeCloner(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/cloner.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Cloner.Clone><td><code><a href=#fn_Cloner.Clone>Cloner.Clone(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/cloner.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_mapIter><td><code><a href=#fn_mapIter>mapIter(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/mapiter_go112.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Cloner.CloneSlowly><td><code><a href=#fn_Cloner.CloneSlowly>Cloner.CloneSlowly(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/cloner.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Allocator.MakeMap><td><code><a href=#fn_Allocator.MakeMap>Allocator.MakeMap(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_heapNew><td><code><a href=#fn_heapNew>heapNew(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_heapMakeSlice><td><code><a href=#fn_heapMakeSlice>heapMakeSlice(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_heapMakeMap><td><code><a href=#fn_heapMakeMap>heapMakeMap(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Allocator.MakeSlice><td><code><a href=#fn_Allocator.MakeSlice>Allocator.MakeSlice(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_setCustomFunc><td><code><a href=#fn_setCustomFunc>setCustomFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/structtype.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_SetCustomFunc><td><code><a href=#fn_SetCustomFunc>SetCustomFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_MarkAsScalar><td><code><a href=#fn_MarkAsScalar>MarkAsScalar(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_MarkAsOpaquePointer><td><code><a href=#fn_MarkAsOpaquePointer>MarkAsOpaquePointer(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_structType.CanShadowCopy><td><code><a href=#fn_structType.CanShadowCopy>structType.CanShadowCopy(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/structtype.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Allocator.New><td><code><a href=#fn_Allocator.New>Allocator.New(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Slowly><td><code><a href=#fn_Slowly>Slowly(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_markAsScalar><td><code><a href=#fn_markAsScalar>markAsScalar(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/structtype.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_cloneState.cloneSlice><td><code><a href=#fn_cloneState.cloneSlice>cloneState.cloneSlice(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>95.7%</code><td class=linecount><code>22/23</code><tr id=s_fn_cloneState.copyStruct><td><code><a href=#fn_cloneState.copyStruct>cloneState.copyStruct(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>94.7%</code><td class=linecount><code>18/19</code><tr id=s_fn_cloneState.cloneMap><td><code><a href=#fn_cloneState.cloneMap>cloneState.cloneMap(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>93.8%</code><td class=linecount><code>15/16</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/interfacedata.go</code><td class=percent><code>90.9%</code><td class=linecount><code>10/11</code><tr id=s_fn_Allocator.loadStructType><td><code><a href=#fn_Allocator.loadStructType>Allocator.loadStructType(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>85.3%</code><td class=linecount><code>29/34</code><tr id=s_fn_Allocator.isOpaquePointer><td><code><a href=#fn_Allocator.isOpaquePointer>Allocator.isOpaquePointer(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_clone><td><code><a href=#fn_clone>clone(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_cloneSlowly><td><code><a href=#fn_cloneSlowly>cloneSlowly(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_cloneState.clone><td><code><a href=#fn_cloneState.clone>cloneState.clone(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>75.0%</code><td class=linecount><code>9/12</code><tr id=s_fn_cloneState.copyArray><td><code><a href=#fn_cloneState.copyArray>cloneState.copyArray(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>75.0%</code><td class=linecount><code>6/8</code><tr id=s_fn_Allocator.cloneSlowly><td><code><a href=#fn_Allocator.cloneSlowly>Allocator.cloneSlowly(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>75.0%</code><td class=linecount><code>6/8</code><tr id=s_fn_Allocator.MarkAsScalar><td><code><a href=#fn_Allocator.MarkAsScalar>Allocator.MarkAsScalar(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_cloneState.clonePtr><td><code><a href=#fn_cloneState.clonePtr>cloneState.clonePtr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>72.4%</code><td class=linecount><code>21/29</code><tr id=s_fn_forceClearROFlag><td><code><a href=#fn_forceClearROFlag>forceClearROFlag(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/structtype.go</code><td class=percent><code>69.2%</code><td class=linecount><code>9/13</code><tr id=s_fn_indirectType><td><code><a href=#fn_indirectType>indirectType(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/utils.go</code><td class=percent><code>66.7%</code><td class=linecount><code>4/6</code><tr id=s_fn_Allocator.clone><td><code><a href=#fn_Allocator.clone>Allocator.clone(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>66.7%</code><td class=linecount><code>4/6</code><tr id=s_fn_Allocator.SetCustomFunc><td><code><a href=#fn_Allocator.SetCustomFunc>Allocator.SetCustomFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>57.1%</code><td class=linecount><code>4/7</code><tr id=s_fn_structType.Init><td><code><a href=#fn_structType.Init>structType.Init(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/structtype.go</code><td class=percent><code>54.5%</code><td class=linecount><code>6/11</code><tr id=s_fn_shadowCopy><td><code><a href=#fn_shadowCopy>shadowCopy(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>50.0%</code><td class=linecount><code>28/56</code><tr id=s_fn_cloneState.fix><td><code><a href=#fn_cloneState.fix>cloneState.fix(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>50.0%</code><td class=linecount><code>2/4</code><tr id=s_fn_copyScalarValue><td><code><a href=#fn_copyScalarValue>copyScalarValue(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/structtype.go</code><td class=percent><code>26.9%</code><td class=linecount><code>7/26</code><tr id=s_fn_fixState.fixMap><td><code><a href=#fn_fixState.fixMap>fixState.fixMap(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/46</code><tr id=s_fn_fixState.fixStruct><td><code><a href=#fn_fixState.fixStruct>fixState.fixStruct(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/32</code><tr id=s_fn_fixState.fixArray><td><code><a href=#fn_fixState.fixArray>fixState.fixArray(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/29</code><tr id=s_fn_fixState.fixSlice><td><code><a href=#fn_fixState.fixSlice>fixState.fixSlice(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/29</code><tr id=s_fn_wrap><td><code><a href=#fn_wrap>wrap(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/wrapper.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/24</code><tr id=s_fn_newAllocator><td><code><a href=#fn_newAllocator>newAllocator(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/15</code><tr id=s_fn_fixState.fixInterface><td><code><a href=#fn_fixState.fixInterface>fixState.fixInterface(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/15</code><tr id=s_fn_fixState.fix><td><code><a href=#fn_fixState.fix>fixState.fix(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/12</code><tr id=s_fn_fixState.fixPtr><td><code><a href=#fn_fixState.fixPtr>fixState.fixPtr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/11</code><tr id=s_fn_cloneState.cloneString><td><code><a href=#fn_cloneState.cloneString>cloneState.cloneString(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/10</code><tr id=s_fn_forceSetMapIndex><td><code><a href=#fn_forceSetMapIndex>forceSetMapIndex(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/9</code><tr id=s_fn_undo><td><code><a href=#fn_undo>undo(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/wrapper.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/8</code><tr id=s_fn_AllocatorMethods.new><td><code><a href=#fn_AllocatorMethods.new>AllocatorMethods.new(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_unwrap><td><code><a href=#fn_unwrap>unwrap(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/wrapper.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_AllocatorMethods.makeChan><td><code><a href=#fn_AllocatorMethods.makeChan>AllocatorMethods.makeChan(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_AllocatorMethods.makeSlice><td><code><a href=#fn_AllocatorMethods.makeSlice>AllocatorMethods.makeSlice(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_AllocatorMethods.makeMap><td><code><a href=#fn_AllocatorMethods.makeMap>AllocatorMethods.makeMap(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_@90:48><td><code><a href=#fn_@90:48>@90:48(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/structtype.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_Slice><td><code><a href=#fn_Slice>Slice(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/base.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_origin><td><code><a href=#fn_origin>origin(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/wrapper.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_isWrapped><td><code><a href=#fn_isWrapped>isWrapped(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/wrapper.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_Map><td><code><a href=#fn_Map>Map(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/base.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_AllocatorMethods.isScalar><td><code><a href=#fn_AllocatorMethods.isScalar>AllocatorMethods.isScalar(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_@75:44><td><code><a href=#fn_@75:44>@75:44(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/structtype.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_SliceComparablePtr><td><code><a href=#fn_SliceComparablePtr>SliceComparablePtr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/base.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_TimePtr><td><code><a href=#fn_TimePtr>TimePtr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/base.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_ComparablePtr><td><code><a href=#fn_ComparablePtr>ComparablePtr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/base.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_validateChecksum><td><code><a href=#fn_validateChecksum>validateChecksum(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/wrapper.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_DecimalPtr><td><code><a href=#fn_DecimalPtr>DecimalPtr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/base.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_makeChecksum><td><code><a href=#fn_makeChecksum>makeChecksum(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/wrapper.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_@83:16><td><code><a href=#fn_@83:16>@83:16(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/structtype.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_TimeLocationPtr><td><code><a href=#fn_TimeLocationPtr>TimeLocationPtr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/base.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_AllocatorMethods.parent><td><code><a href=#fn_AllocatorMethods.parent>AllocatorMethods.parent(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@63:45><td><code><a href=#fn_@63:45>@63:45(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/structtype.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@69:45><td><code><a href=#fn_@69:45>@69:45(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/structtype.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_GormModelPtr><td><code><a href=#fn_GormModelPtr>GormModelPtr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/base.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_NewAllocator><td><code><a href=#fn_NewAllocator>NewAllocator(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_fixState.new><td><code><a href=#fn_fixState.new>fixState.new(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/clone.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_FromHeap><td><code><a href=#fn_FromHeap>FromHeap(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Undo><td><code><a href=#fn_Undo>Undo(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Unwrap><td><code><a href=#fn_Unwrap>Unwrap(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Wrap><td><code><a href=#fn_Wrap>Wrap(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@96:11><td><code><a href=#fn_@96:11>@96:11(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@78:11><td><code><a href=#fn_@78:11>@78:11(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@60:11><td><code><a href=#fn_@60:11>@60:11(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@42:11><td><code><a href=#fn_@42:11>@42:11(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_heapMakeChan><td><code><a href=#fn_heapMakeChan>heapMakeChan(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Allocator.CloneSlowly><td><code><a href=#fn_Allocator.CloneSlowly>Allocator.CloneSlowly(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_getOrigin><td><code><a href=#fn_getOrigin>getOrigin(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/wrapper.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Allocator.Clone><td><code><a href=#fn_Allocator.Clone>Allocator.Clone(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Allocator.MakeChan><td><code><a href=#fn_Allocator.MakeChan>Allocator.MakeChan(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_fromHeap><td><code><a href=#fn_fromHeap>fromHeap(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/allocator.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_emptyCloneFunc><td><code><a href=#fn_emptyCloneFunc>emptyCloneFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/clone/structtype.go</code><td class=percent><code>100.0%</code><td class=linecount><code>0/0</code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/structtype.go</code>:</div><table class=listing><tr><td>28<td><code><pre>func init() {</pre></code><tr><td>29<td><code><pre> // Some well-known scalar-like structs.</pre></code><tr><td>30<td><code><pre> MarkAsScalar(reflect.TypeOf(time.Time{}))</pre></code><tr><td>31<td><code><pre> MarkAsScalar(reflect.TypeOf(reflect.Value{}))</pre></code><tr><td>32<td><code><pre></pre></code><tr><td>33<td><code><pre> // Special case for elliptic.Curve which is used by TLS ECC certificate.</pre></code><tr><td>34<td><code><pre> // Package crypto/tls uses elliptic.Curve as enum values</pre></code><tr><td>35<td><code><pre> // so that they should be treated as opaque pointers.</pre></code><tr><td>36<td><code><pre> //</pre></code><tr><td>37<td><code><pre> // As elliptic.Curve is an interface, it can be *elliptic.CurveParam or elliptic.p256Curve.</pre></code><tr><td>38<td><code><pre> MarkAsOpaquePointer(reflect.TypeOf(&elliptic.CurveParams{}))</pre></code><tr><td>39<td><code><pre> curves := []elliptic.Curve{</pre></code><tr><td>40<td><code><pre> elliptic.P224(),</pre></code><tr><td>41<td><code><pre> elliptic.P256(),</pre></code><tr><td>42<td><code><pre> elliptic.P384(),</pre></code><tr><td>43<td><code><pre> elliptic.P521(),</pre></code><tr><td>44<td><code><pre> }</pre></code><tr><td>45<td><code><pre></pre></code><tr><td>46<td><code><pre> for _, curve := range curves {</pre></code><tr><td>47<td><code><pre> MarkAsOpaquePointer(reflect.ValueOf(curve).Type())</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre></pre></code><tr><td>50<td><code><pre> // Special case for reflect.Type (actually *reflect.rtype):</pre></code><tr><td>51<td><code><pre> // The *reflect.rtype should not be copied as it is immutable and</pre></code><tr><td>52<td><code><pre> // may point to a variable that actual type is not reflect.rtype,</pre></code><tr><td>53<td><code><pre> // e.g. *reflect.arrayType or *reflect.chanType.</pre></code><tr><td>54<td><code><pre> MarkAsOpaquePointer(reflect.TypeOf(reflect.TypeOf(0)))</pre></code><tr><td>55<td><code><pre></pre></code><tr><td>56<td><code><pre> // Some well-known no-copy structs.</pre></code><tr><td>57<td><code><pre> //</pre></code><tr><td>58<td><code><pre> // Almost all structs defined in package "sync" and "go.uber.org/atomic" are set</pre></code><tr><td>59<td><code><pre> // except `sync.Once` which can be safely cloned with a correct done value.</pre></code><tr><td>60<td><code><pre> SetCustomFunc(reflect.TypeOf(sync.Mutex{}), emptyCloneFunc)</pre></code><tr><td>61<td><code><pre> SetCustomFunc(reflect.TypeOf(sync.RWMutex{}), emptyCloneFunc)</pre></code><tr><td>62<td><code><pre> SetCustomFunc(reflect.TypeOf(sync.WaitGroup{}), emptyCloneFunc)</pre></code><tr><td>63<td><code><pre> SetCustomFunc(reflect.TypeOf(sync.Cond{}), func(allocator *Allocator, old, new reflect.Value) {</pre></code><tr><td>64<td><code><pre> // Copy the New func from old value.</pre></code><tr><td>65<td><code><pre> oldL := old.FieldByName("L")</pre></code><tr><td>66<td><code><pre> newL := allocator.Clone(oldL)</pre></code><tr><td>67<td><code><pre> new.FieldByName("L").Set(newL)</pre></code><tr><td>68<td><code><pre> })</pre></code><tr><td>69<td><code><pre> SetCustomFunc(reflect.TypeOf(sync.Pool{}), func(allocator *Allocator, old, new reflect.Value) {</pre></code><tr><td>70<td><code><pre> // Copy the New func from old value.</pre></code><tr><td>71<td><code><pre> oldFn := old.FieldByName("New")</pre></code><tr><td>72<td><code><pre> newFn := allocator.Clone(oldFn)</pre></code><tr><td>73<td><code><pre> new.FieldByName("New").Set(newFn)</pre></code><tr><td>74<td><code><pre> })</pre></code><tr><td>75<td><code><pre> SetCustomFunc(reflect.TypeOf(sync.Map{}), func(allocator *Allocator, old, new reflect.Value) {</pre></code><tr><td>76<td><code><pre> if !old.CanAddr() {</pre></code><tr><td>77<td><code><pre> return</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre></pre></code><tr><td>80<td><code><pre> // Clone all values inside sync.Map.</pre></code><tr><td>81<td><code><pre> oldMap := old.Addr().Interface().(*sync.Map)</pre></code><tr><td>82<td><code><pre> newMap := new.Addr().Interface().(*sync.Map)</pre></code><tr><td>83<td><code><pre> oldMap.Range(func(key, value interface{}) bool {</pre></code><tr><td>84<td><code><pre> k := clone(allocator, key)</pre></code><tr><td>85<td><code><pre> v := clone(allocator, value)</pre></code><tr><td>86<td><code><pre> newMap.Store(k, v)</pre></code><tr><td>87<td><code><pre> return true</pre></code><tr><td>88<td><code><pre> })</pre></code><tr><td>89<td><code><pre> })</pre></code><tr><td>90<td><code><pre> SetCustomFunc(reflect.TypeOf(atomic.Value{}), func(allocator *Allocator, old, new reflect.Value) {</pre></code><tr><td>91<td><code><pre> if !old.CanAddr() {</pre></code><tr><td>92<td><code><pre> return</pre></code><tr><td>93<td><code><pre> }</pre></code><tr><td>94<td><code><pre></pre></code><tr><td>95<td><code><pre> // Clone value inside atomic.Value.</pre></code><tr><td>96<td><code><pre> oldValue := old.Addr().Interface().(*atomic.Value)</pre></code><tr><td>97<td><code><pre> newValue := new.Addr().Interface().(*atomic.Value)</pre></code><tr><td>98<td><code><pre> v := oldValue.Load()</pre></code><tr><td>99<td><code><pre> cloned := clone(allocator, v)</pre></code><tr><td>100<td><code><pre> newValue.Store(cloned)</pre></code><tr><td>101<td><code><pre> })</pre></code><tr><td>102<td><code><pre>}</pre></code></table><div class=funcname id=fn_Allocator.lookupStructType>func Allocator.lookupStructType</div><div class=info><a href=#s_fn_Allocator.lookupStructType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>216<td><code><pre>func (a *Allocator) lookupStructType(t reflect.Type) (st structType, ok bool) {</pre></code><tr><td>217<td><code><pre> var v interface{}</pre></code><tr><td>218<td><code><pre> current := a</pre></code><tr><td>219<td><code><pre></pre></code><tr><td>220<td><code><pre> for current != nil {</pre></code><tr><td>221<td><code><pre> v, ok = current.cachedStructTypes.Load(t)</pre></code><tr><td>222<td><code><pre></pre></code><tr><td>223<td><code><pre> if ok {</pre></code><tr><td>224<td><code><pre> st = v.(structType)</pre></code><tr><td>225<td><code><pre> return</pre></code><tr><td>226<td><code><pre> }</pre></code><tr><td>227<td><code><pre></pre></code><tr><td>228<td><code><pre> current = current.parent</pre></code><tr><td>229<td><code><pre> }</pre></code><tr><td>230<td><code><pre></pre></code><tr><td>231<td><code><pre> return</pre></code><tr><td>232<td><code><pre>}</pre></code></table><div class=funcname id=fn_SliceComparable>func SliceComparable</div><div class=info><a href=#s_fn_SliceComparable>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/base.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func SliceComparable[T comparable, TS ~[]T](s TS) (d TS) {</pre></code><tr><td>20<td><code><pre> if s == nil {</pre></code><tr><td>21<td><code><pre> return</pre></code><tr><td>22<td><code><pre> }</pre></code><tr><td>23<td><code><pre> d = make(TS, len(s), cap(s))</pre></code><tr><td>24<td><code><pre> copy(d, s)</pre></code><tr><td>25<td><code><pre> return</pre></code><tr><td>26<td><code><pre>}</pre></code></table><div class=funcname id=fn_cloneState.cloneInterface>func cloneState.cloneInterface</div><div class=info><a href=#s_fn_cloneState.cloneInterface>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>106<td><code><pre>func (state *cloneState) cloneInterface(v reflect.Value) reflect.Value {</pre></code><tr><td>107<td><code><pre> if v.IsNil() {</pre></code><tr><td>108<td><code><pre> return reflect.Zero(v.Type())</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre></pre></code><tr><td>111<td><code><pre> t := v.Type()</pre></code><tr><td>112<td><code><pre> elem := v.Elem()</pre></code><tr><td>113<td><code><pre> return state.clone(elem).Convert(elem.Type()).Convert(t)</pre></code><tr><td>114<td><code><pre>}</pre></code></table><div class=funcname id=fn_cloneState.cloneStruct>func cloneState.cloneStruct</div><div class=info><a href=#s_fn_cloneState.cloneStruct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>266<td><code><pre>func (state *cloneState) cloneStruct(v reflect.Value) reflect.Value {</pre></code><tr><td>267<td><code><pre> t := v.Type()</pre></code><tr><td>268<td><code><pre> nv := state.allocator.New(t)</pre></code><tr><td>269<td><code><pre> state.copyStruct(v, nv)</pre></code><tr><td>270<td><code><pre> return nv.Elem()</pre></code><tr><td>271<td><code><pre>}</pre></code></table><div class=funcname id=fn_IsScalar>func IsScalar</div><div class=info><a href=#s_fn_IsScalar>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/structtype.go</code>:</div><table class=listing><tr><td>188<td><code><pre>func IsScalar(k reflect.Kind) bool {</pre></code><tr><td>189<td><code><pre> switch k {</pre></code><tr><td>190<td><code><pre> case reflect.Bool,</pre></code><tr><td>191<td><code><pre> reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,</pre></code><tr><td>192<td><code><pre> reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr,</pre></code><tr><td>193<td><code><pre> reflect.Float32, reflect.Float64,</pre></code><tr><td>194<td><code><pre> reflect.Complex64, reflect.Complex128,</pre></code><tr><td>195<td><code><pre> reflect.Func,</pre></code><tr><td>196<td><code><pre> reflect.UnsafePointer,</pre></code><tr><td>197<td><code><pre> reflect.Invalid:</pre></code><tr><td>198<td><code><pre> return true</pre></code><tr><td>199<td><code><pre></pre></code><tr><td>200<td><code><pre> case reflect.String:</pre></code><tr><td>201<td><code><pre> // If arena is not enabled, string can be copied as scalar safely</pre></code><tr><td>202<td><code><pre> // as it's immutable by design.</pre></code><tr><td>203<td><code><pre> return !arenaIsEnabled</pre></code><tr><td>204<td><code><pre> }</pre></code><tr><td>205<td><code><pre></pre></code><tr><td>206<td><code><pre> return false</pre></code><tr><td>207<td><code><pre>}</pre></code></table><div class=funcname id=fn_cloneState.cloneArray>func cloneState.cloneArray</div><div class=info><a href=#s_fn_cloneState.cloneArray>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>85<td><code><pre>func (state *cloneState) cloneArray(v reflect.Value) reflect.Value {</pre></code><tr><td>86<td><code><pre> dst := state.allocator.New(v.Type())</pre></code><tr><td>87<td><code><pre> state.copyArray(v, dst)</pre></code><tr><td>88<td><code><pre> return dst.Elem()</pre></code><tr><td>89<td><code><pre>}</pre></code></table><div class=funcname id=fn_parseReflectValue>func parseReflectValue</div><div class=info><a href=#s_fn_parseReflectValue>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/interfacedata.go</code>:</div><table class=listing><tr><td>46<td><code><pre>func parseReflectValue(v reflect.Value) interfaceData {</pre></code><tr><td>47<td><code><pre> pv := (unsafe.Pointer)(uintptr(unsafe.Pointer(&v)) + reflectValuePtrOffset)</pre></code><tr><td>48<td><code><pre> ptr := *(*unsafe.Pointer)(pv)</pre></code><tr><td>49<td><code><pre> return *(*interfaceData)(ptr)</pre></code><tr><td>50<td><code><pre>}</pre></code></table><div class=funcname id=fn_Allocator.MarkAsOpaquePointer>func Allocator.MarkAsOpaquePointer</div><div class=info><a href=#s_fn_Allocator.MarkAsOpaquePointer>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>272<td><code><pre>func (a *Allocator) MarkAsOpaquePointer(t reflect.Type) {</pre></code><tr><td>273<td><code><pre> if t.Kind() != reflect.Ptr {</pre></code><tr><td>274<td><code><pre> return</pre></code><tr><td>275<td><code><pre> }</pre></code><tr><td>276<td><code><pre></pre></code><tr><td>277<td><code><pre> a.cachedPointerTypes.Store(t, struct{}{})</pre></code><tr><td>278<td><code><pre>}</pre></code></table><div class=funcname id=fn_Clone>func Clone</div><div class=info><a href=#s_fn_Clone>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code>:</div><table class=listing><tr><td>27<td><code><pre>func Clone[T any](t T) T {</pre></code><tr><td>28<td><code><pre> return cloner.Clone(t).(T)</pre></code><tr><td>29<td><code><pre>}</pre></code></table><div class=funcname id=fn_markAsOpaquePointer>func markAsOpaquePointer</div><div class=info><a href=#s_fn_markAsOpaquePointer>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/structtype.go</code>:</div><table class=listing><tr><td>125<td><code><pre>func markAsOpaquePointer(t reflect.Type) {</pre></code><tr><td>126<td><code><pre> defaultAllocator.MarkAsOpaquePointer(t)</pre></code><tr><td>127<td><code><pre>}</pre></code></table><div class=funcname id=fn_MakeCloner>func MakeCloner</div><div class=info><a href=#s_fn_MakeCloner>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/cloner.go</code>:</div><table class=listing><tr><td>12<td><code><pre>func MakeCloner(allocator *Allocator) Cloner {</pre></code><tr><td>13<td><code><pre> return Cloner{</pre></code><tr><td>14<td><code><pre> allocator: allocator,</pre></code><tr><td>15<td><code><pre> }</pre></code><tr><td>16<td><code><pre>}</pre></code></table><div class=funcname id=fn_Cloner.Clone>func Cloner.Clone</div><div class=info><a href=#s_fn_Cloner.Clone>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/cloner.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func (c Cloner) Clone(v interface{}) interface{} {</pre></code><tr><td>20<td><code><pre> return clone(c.allocator, v)</pre></code><tr><td>21<td><code><pre>}</pre></code></table><div class=funcname id=fn_mapIter>func mapIter</div><div class=info><a href=#s_fn_mapIter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/mapiter_go112.go</code>:</div><table class=listing><tr><td>13<td><code><pre>func mapIter(m reflect.Value) *reflect.MapIter {</pre></code><tr><td>14<td><code><pre> return m.MapRange()</pre></code><tr><td>15<td><code><pre>}</pre></code></table><div class=funcname id=fn_Cloner.CloneSlowly>func Cloner.CloneSlowly</div><div class=info><a href=#s_fn_Cloner.CloneSlowly>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/cloner.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func (c Cloner) CloneSlowly(v interface{}) interface{} {</pre></code><tr><td>26<td><code><pre> return cloneSlowly(c.allocator, v)</pre></code><tr><td>27<td><code><pre>}</pre></code></table><div class=funcname id=fn_Allocator.MakeMap>func Allocator.MakeMap</div><div class=info><a href=#s_fn_Allocator.MakeMap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>87<td><code><pre>func (a *Allocator) MakeMap(t reflect.Type, n int) reflect.Value {</pre></code><tr><td>88<td><code><pre> return a.makeMap(a.pool, t, n)</pre></code><tr><td>89<td><code><pre>}</pre></code></table><div class=funcname id=fn_heapNew>func heapNew</div><div class=info><a href=#s_fn_heapNew>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>298<td><code><pre>func heapNew(pool unsafe.Pointer, t reflect.Type) reflect.Value {</pre></code><tr><td>299<td><code><pre> return reflect.New(t)</pre></code><tr><td>300<td><code><pre>}</pre></code></table><div class=funcname id=fn_heapMakeSlice>func heapMakeSlice</div><div class=info><a href=#s_fn_heapMakeSlice>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>302<td><code><pre>func heapMakeSlice(pool unsafe.Pointer, t reflect.Type, len, cap int) reflect.Value {</pre></code><tr><td>303<td><code><pre> return reflect.MakeSlice(t, len, cap)</pre></code><tr><td>304<td><code><pre>}</pre></code></table><div class=funcname id=fn_heapMakeMap>func heapMakeMap</div><div class=info><a href=#s_fn_heapMakeMap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>306<td><code><pre>func heapMakeMap(pool unsafe.Pointer, t reflect.Type, n int) reflect.Value {</pre></code><tr><td>307<td><code><pre> return reflect.MakeMapWithSize(t, n)</pre></code><tr><td>308<td><code><pre>}</pre></code></table><div class=funcname id=fn_Allocator.MakeSlice>func Allocator.MakeSlice</div><div class=info><a href=#s_fn_Allocator.MakeSlice>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>82<td><code><pre>func (a *Allocator) MakeSlice(t reflect.Type, len, cap int) reflect.Value {</pre></code><tr><td>83<td><code><pre> return a.makeSlice(a.pool, t, len, cap)</pre></code><tr><td>84<td><code><pre>}</pre></code></table><div class=funcname id=fn_setCustomFunc>func setCustomFunc</div><div class=info><a href=#s_fn_setCustomFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/structtype.go</code>:</div><table class=listing><tr><td>144<td><code><pre>func setCustomFunc(t reflect.Type, fn Func) {</pre></code><tr><td>145<td><code><pre> defaultAllocator.SetCustomFunc(t, fn)</pre></code><tr><td>146<td><code><pre>}</pre></code></table><div class=funcname id=fn_SetCustomFunc>func SetCustomFunc</div><div class=info><a href=#s_fn_SetCustomFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code>:</div><table class=listing><tr><td>97<td><code><pre>func SetCustomFunc(t reflect.Type, fn Func) {</pre></code><tr><td>98<td><code><pre> setCustomFunc(t, fn)</pre></code><tr><td>99<td><code><pre>}</pre></code></table><div class=funcname id=fn_MarkAsScalar>func MarkAsScalar</div><div class=info><a href=#s_fn_MarkAsScalar>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code>:</div><table class=listing><tr><td>89<td><code><pre>func MarkAsScalar(t reflect.Type) {</pre></code><tr><td>90<td><code><pre> markAsScalar(t)</pre></code><tr><td>91<td><code><pre>}</pre></code></table><div class=funcname id=fn_MarkAsOpaquePointer>func MarkAsOpaquePointer</div><div class=info><a href=#s_fn_MarkAsOpaquePointer>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code>:</div><table class=listing><tr><td>75<td><code><pre>func MarkAsOpaquePointer(t reflect.Type) {</pre></code><tr><td>76<td><code><pre> markAsOpaquePointer(t)</pre></code><tr><td>77<td><code><pre>}</pre></code></table><div class=funcname id=fn_structType.CanShadowCopy>func structType.CanShadowCopy</div><div class=info><a href=#s_fn_structType.CanShadowCopy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/structtype.go</code>:</div><table class=listing><tr><td>172<td><code><pre>func (st *structType) CanShadowCopy() bool {</pre></code><tr><td>173<td><code><pre> return len(st.PointerFields) == 0 && st.fn == nil</pre></code><tr><td>174<td><code><pre>}</pre></code></table><div class=funcname id=fn_Allocator.New>func Allocator.New</div><div class=info><a href=#s_fn_Allocator.New>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>77<td><code><pre>func (a *Allocator) New(t reflect.Type) reflect.Value {</pre></code><tr><td>78<td><code><pre> return a.new(a.pool, t)</pre></code><tr><td>79<td><code><pre>}</pre></code></table><div class=funcname id=fn_Slowly>func Slowly</div><div class=info><a href=#s_fn_Slowly>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code>:</div><table class=listing><tr><td>35<td><code><pre>func Slowly[T any](t T) T {</pre></code><tr><td>36<td><code><pre> return cloner.CloneSlowly(t).(T)</pre></code><tr><td>37<td><code><pre>}</pre></code></table><div class=funcname id=fn_markAsScalar>func markAsScalar</div><div class=info><a href=#s_fn_markAsScalar>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/structtype.go</code>:</div><table class=listing><tr><td>114<td><code><pre>func markAsScalar(t reflect.Type) {</pre></code><tr><td>115<td><code><pre> defaultAllocator.MarkAsScalar(t)</pre></code><tr><td>116<td><code><pre>}</pre></code></table><div class=funcname id=fn_cloneState.cloneSlice>func cloneState.cloneSlice</div><div class=info><a href=#s_fn_cloneState.cloneSlice>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>217<td><code><pre>func (state *cloneState) cloneSlice(v reflect.Value) reflect.Value {</pre></code><tr><td>218<td><code><pre> if v.IsNil() {</pre></code><tr><td>219<td><code><pre> return reflect.Zero(v.Type())</pre></code><tr><td>220<td><code><pre> }</pre></code><tr><td>221<td><code><pre></pre></code><tr><td>222<td><code><pre> t := v.Type()</pre></code><tr><td>223<td><code><pre> num := v.Len()</pre></code><tr><td>224<td><code><pre></pre></code><tr><td>225<td><code><pre> if state.visited != nil {</pre></code><tr><td>226<td><code><pre> vst := visit{</pre></code><tr><td>227<td><code><pre> p: v.Pointer(),</pre></code><tr><td>228<td><code><pre> extra: num,</pre></code><tr><td>229<td><code><pre> t: t,</pre></code><tr><td>230<td><code><pre> }</pre></code><tr><td>231<td><code><pre></pre></code><tr><td>232<td><code><pre> if val, ok := state.visited[vst]; ok {</pre></code><tr class=miss><td>233<td><code><pre> return val</pre></code><tr><td>234<td><code><pre> }</pre></code><tr><td>235<td><code><pre> }</pre></code><tr><td>236<td><code><pre></pre></code><tr><td>237<td><code><pre> c := v.Cap()</pre></code><tr><td>238<td><code><pre> nv := state.allocator.MakeSlice(t, num, c)</pre></code><tr><td>239<td><code><pre></pre></code><tr><td>240<td><code><pre> if state.visited != nil {</pre></code><tr><td>241<td><code><pre> vst := visit{</pre></code><tr><td>242<td><code><pre> p: v.Pointer(),</pre></code><tr><td>243<td><code><pre> extra: num,</pre></code><tr><td>244<td><code><pre> t: t,</pre></code><tr><td>245<td><code><pre> }</pre></code><tr><td>246<td><code><pre> state.visited[vst] = nv</pre></code><tr><td>247<td><code><pre> }</pre></code><tr><td>248<td><code><pre></pre></code><tr><td>249<td><code><pre> // For scalar slice, copy underlying values directly.</pre></code><tr><td>250<td><code><pre> if state.allocator.isScalar(t.Elem().Kind()) {</pre></code><tr><td>251<td><code><pre> src := unsafe.Pointer(v.Pointer())</pre></code><tr><td>252<td><code><pre> dst := unsafe.Pointer(nv.Pointer())</pre></code><tr><td>253<td><code><pre> sz := int(t.Elem().Size())</pre></code><tr><td>254<td><code><pre> l := num * sz</pre></code><tr><td>255<td><code><pre> cc := c * sz</pre></code><tr><td>256<td><code><pre> copy((*[maxByteSize]byte)(dst)[:l:cc], (*[maxByteSize]byte)(src)[:l:cc])</pre></code><tr><td>257<td><code><pre> } else {</pre></code><tr><td>258<td><code><pre> for i := 0; i < num; i++ {</pre></code><tr><td>259<td><code><pre> nv.Index(i).Set(state.clone(v.Index(i)))</pre></code><tr><td>260<td><code><pre> }</pre></code><tr><td>261<td><code><pre> }</pre></code><tr><td>262<td><code><pre></pre></code><tr><td>263<td><code><pre> return nv</pre></code><tr><td>264<td><code><pre>}</pre></code></table><div class=funcname id=fn_cloneState.copyStruct>func cloneState.copyStruct</div><div class=info><a href=#s_fn_cloneState.copyStruct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>294<td><code><pre>func (state *cloneState) copyStruct(src, nv reflect.Value) {</pre></code><tr><td>295<td><code><pre> t := src.Type()</pre></code><tr><td>296<td><code><pre> st := state.allocator.loadStructType(t)</pre></code><tr><td>297<td><code><pre> ptr := unsafe.Pointer(nv.Pointer())</pre></code><tr><td>298<td><code><pre></pre></code><tr><td>299<td><code><pre> if st.Init(state.allocator, src, nv, state.skipCustomFuncValue == src) {</pre></code><tr><td>300<td><code><pre> return</pre></code><tr><td>301<td><code><pre> }</pre></code><tr><td>302<td><code><pre></pre></code><tr><td>303<td><code><pre> for _, pf := range st.PointerFields {</pre></code><tr><td>304<td><code><pre> i := int(pf.Index)</pre></code><tr><td>305<td><code><pre> p := unsafe.Pointer(uintptr(ptr) + pf.Offset)</pre></code><tr><td>306<td><code><pre> field := src.Field(i)</pre></code><tr><td>307<td><code><pre></pre></code><tr><td>308<td><code><pre> // This field can be referenced by a pointer or interface inside itself.</pre></code><tr><td>309<td><code><pre> // Put the pointer to this field to visited to avoid any error.</pre></code><tr><td>310<td><code><pre> //</pre></code><tr><td>311<td><code><pre> // See https://github.com/huandu/go-clone/issues/3.</pre></code><tr><td>312<td><code><pre> if state.visited != nil && field.CanAddr() {</pre></code><tr><td>313<td><code><pre> ft := field.Type()</pre></code><tr><td>314<td><code><pre> fp := field.Addr().Pointer()</pre></code><tr><td>315<td><code><pre> vst := visit{</pre></code><tr><td>316<td><code><pre> p: fp,</pre></code><tr><td>317<td><code><pre> t: reflect.PtrTo(ft),</pre></code><tr><td>318<td><code><pre> }</pre></code><tr><td>319<td><code><pre> nv := reflect.NewAt(ft, p)</pre></code><tr><td>320<td><code><pre></pre></code><tr><td>321<td><code><pre> // The address of this field was visited, so fp must be a cycle pointer.</pre></code><tr><td>322<td><code><pre> // As this field is not fully cloned, the val stored in visited[visit] must be wrong.</pre></code><tr><td>323<td><code><pre> // It must be replaced by nv which will be the right value (it's incomplete right now).</pre></code><tr><td>324<td><code><pre> //</pre></code><tr><td>325<td><code><pre> // Unfortunately, if the val was used by previous clone routines,</pre></code><tr><td>326<td><code><pre> // there is no easy way to fix wrong values - all pointers must be traversed and fixed.</pre></code><tr><td>327<td><code><pre> if val, ok := state.visited[vst]; ok {</pre></code><tr class=miss><td>328<td><code><pre> state.invalid[visit{</pre></code><tr><td>329<td><code><pre> p: val.Pointer(),</pre></code><tr><td>330<td><code><pre> t: vst.t,</pre></code><tr><td>331<td><code><pre> }] = nv</pre></code><tr><td>332<td><code><pre> }</pre></code><tr><td>333<td><code><pre></pre></code><tr><td>334<td><code><pre> state.visited[vst] = nv</pre></code><tr><td>335<td><code><pre> }</pre></code><tr><td>336<td><code><pre></pre></code><tr><td>337<td><code><pre> v := state.clone(field)</pre></code><tr><td>338<td><code><pre> shadowCopy(v, p)</pre></code><tr><td>339<td><code><pre> }</pre></code><tr><td>340<td><code><pre>}</pre></code></table><div class=funcname id=fn_cloneState.cloneMap>func cloneState.cloneMap</div><div class=info><a href=#s_fn_cloneState.cloneMap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>116<td><code><pre>func (state *cloneState) cloneMap(v reflect.Value) reflect.Value {</pre></code><tr><td>117<td><code><pre> if v.IsNil() {</pre></code><tr><td>118<td><code><pre> return reflect.Zero(v.Type())</pre></code><tr><td>119<td><code><pre> }</pre></code><tr><td>120<td><code><pre></pre></code><tr><td>121<td><code><pre> t := v.Type()</pre></code><tr><td>122<td><code><pre></pre></code><tr><td>123<td><code><pre> if state.visited != nil {</pre></code><tr><td>124<td><code><pre> vst := visit{</pre></code><tr><td>125<td><code><pre> p: v.Pointer(),</pre></code><tr><td>126<td><code><pre> t: t,</pre></code><tr><td>127<td><code><pre> }</pre></code><tr><td>128<td><code><pre></pre></code><tr><td>129<td><code><pre> if val, ok := state.visited[vst]; ok {</pre></code><tr class=miss><td>130<td><code><pre> return val</pre></code><tr><td>131<td><code><pre> }</pre></code><tr><td>132<td><code><pre> }</pre></code><tr><td>133<td><code><pre></pre></code><tr><td>134<td><code><pre> nv := state.allocator.MakeMap(t, v.Len())</pre></code><tr><td>135<td><code><pre></pre></code><tr><td>136<td><code><pre> if state.visited != nil {</pre></code><tr><td>137<td><code><pre> vst := visit{</pre></code><tr><td>138<td><code><pre> p: v.Pointer(),</pre></code><tr><td>139<td><code><pre> t: t,</pre></code><tr><td>140<td><code><pre> }</pre></code><tr><td>141<td><code><pre> state.visited[vst] = nv</pre></code><tr><td>142<td><code><pre> }</pre></code><tr><td>143<td><code><pre></pre></code><tr><td>144<td><code><pre> for iter := mapIter(v); iter.Next(); {</pre></code><tr><td>145<td><code><pre> key := state.clone(iter.Key())</pre></code><tr><td>146<td><code><pre> value := state.clone(iter.Value())</pre></code><tr><td>147<td><code><pre> nv.SetMapIndex(key, value)</pre></code><tr><td>148<td><code><pre> }</pre></code><tr><td>149<td><code><pre></pre></code><tr><td>150<td><code><pre> return nv</pre></code><tr><td>151<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/interfacedata.go</code>:</div><table class=listing><tr><td>24<td><code><pre>func init() {</pre></code><tr><td>25<td><code><pre> t := reflect.TypeOf(reflect.Value{})</pre></code><tr><td>26<td><code><pre> found := false</pre></code><tr><td>27<td><code><pre> fields := t.NumField()</pre></code><tr><td>28<td><code><pre></pre></code><tr><td>29<td><code><pre> for i := 0; i < fields; i++ {</pre></code><tr><td>30<td><code><pre> field := t.Field(i)</pre></code><tr><td>31<td><code><pre></pre></code><tr><td>32<td><code><pre> if field.Type.Kind() == reflect.UnsafePointer {</pre></code><tr><td>33<td><code><pre> found = true</pre></code><tr><td>34<td><code><pre> reflectValuePtrOffset = field.Offset</pre></code><tr><td>35<td><code><pre> break</pre></code><tr><td>36<td><code><pre> }</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre></pre></code><tr><td>39<td><code><pre> if !found {</pre></code><tr class=miss><td>40<td><code><pre> panic("go-clone: fail to find internal ptr field in reflect.Value")</pre></code><tr><td>41<td><code><pre> }</pre></code><tr><td>42<td><code><pre>}</pre></code></table><div class=funcname id=fn_Allocator.loadStructType>func Allocator.loadStructType</div><div class=info><a href=#s_fn_Allocator.loadStructType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>143<td><code><pre>func (a *Allocator) loadStructType(t reflect.Type) (st structType) {</pre></code><tr><td>144<td><code><pre> st, ok := a.lookupStructType(t)</pre></code><tr><td>145<td><code><pre></pre></code><tr><td>146<td><code><pre> if ok {</pre></code><tr><td>147<td><code><pre> return</pre></code><tr><td>148<td><code><pre> }</pre></code><tr><td>149<td><code><pre></pre></code><tr><td>150<td><code><pre> num := t.NumField()</pre></code><tr><td>151<td><code><pre> pointerFields := make([]structFieldType, 0, num)</pre></code><tr><td>152<td><code><pre></pre></code><tr><td>153<td><code><pre> // Find pointer fields in depth-first order.</pre></code><tr><td>154<td><code><pre> for i := 0; i < num; i++ {</pre></code><tr><td>155<td><code><pre> field := t.Field(i)</pre></code><tr><td>156<td><code><pre> ft := field.Type</pre></code><tr><td>157<td><code><pre> k := ft.Kind()</pre></code><tr><td>158<td><code><pre></pre></code><tr><td>159<td><code><pre> if a.isScalar(k) {</pre></code><tr><td>160<td><code><pre> continue</pre></code><tr><td>161<td><code><pre> }</pre></code><tr><td>162<td><code><pre></pre></code><tr><td>163<td><code><pre> switch k {</pre></code><tr><td>164<td><code><pre> case reflect.Array:</pre></code><tr><td>165<td><code><pre> if ft.Len() == 0 {</pre></code><tr class=miss><td>166<td><code><pre> continue</pre></code><tr><td>167<td><code><pre> }</pre></code><tr><td>168<td><code><pre></pre></code><tr><td>169<td><code><pre> elem := ft.Elem()</pre></code><tr><td>170<td><code><pre></pre></code><tr><td>171<td><code><pre> if a.isScalar(elem.Kind()) {</pre></code><tr><td>172<td><code><pre> continue</pre></code><tr><td>173<td><code><pre> }</pre></code><tr><td>174<td><code><pre></pre></code><tr><td>175<td><code><pre> if elem.Kind() == reflect.Struct {</pre></code><tr class=miss><td>176<td><code><pre> if fst := a.loadStructType(elem); fst.CanShadowCopy() {</pre></code><tr class=miss><td>177<td><code><pre> continue</pre></code><tr><td>178<td><code><pre> }</pre></code><tr><td>179<td><code><pre> }</pre></code><tr><td>180<td><code><pre> case reflect.Struct:</pre></code><tr><td>181<td><code><pre> if fst := a.loadStructType(ft); fst.CanShadowCopy() {</pre></code><tr><td>182<td><code><pre> continue</pre></code><tr><td>183<td><code><pre> }</pre></code><tr><td>184<td><code><pre> }</pre></code><tr><td>185<td><code><pre></pre></code><tr><td>186<td><code><pre> pointerFields = append(pointerFields, structFieldType{</pre></code><tr><td>187<td><code><pre> Offset: field.Offset,</pre></code><tr><td>188<td><code><pre> Index: i,</pre></code><tr><td>189<td><code><pre> })</pre></code><tr><td>190<td><code><pre> }</pre></code><tr><td>191<td><code><pre></pre></code><tr><td>192<td><code><pre> if len(pointerFields) == 0 {</pre></code><tr><td>193<td><code><pre> pointerFields = nil // Release memory ASAP.</pre></code><tr><td>194<td><code><pre> }</pre></code><tr><td>195<td><code><pre></pre></code><tr><td>196<td><code><pre> st = structType{</pre></code><tr><td>197<td><code><pre> PointerFields: pointerFields,</pre></code><tr><td>198<td><code><pre> }</pre></code><tr><td>199<td><code><pre></pre></code><tr><td>200<td><code><pre> // Load custom function.</pre></code><tr><td>201<td><code><pre> current := a</pre></code><tr><td>202<td><code><pre></pre></code><tr><td>203<td><code><pre> for current != nil {</pre></code><tr><td>204<td><code><pre> if fn, ok := current.cachedCustomFuncTypes.Load(t); ok {</pre></code><tr class=miss><td>205<td><code><pre> st.fn = fn.(Func)</pre></code><tr class=miss><td>206<td><code><pre> break</pre></code><tr><td>207<td><code><pre> }</pre></code><tr><td>208<td><code><pre></pre></code><tr><td>209<td><code><pre> current = current.parent</pre></code><tr><td>210<td><code><pre> }</pre></code><tr><td>211<td><code><pre></pre></code><tr><td>212<td><code><pre> a.cachedStructTypes.LoadOrStore(t, st)</pre></code><tr><td>213<td><code><pre> return</pre></code><tr><td>214<td><code><pre>}</pre></code></table><div class=funcname id=fn_Allocator.isOpaquePointer>func Allocator.isOpaquePointer</div><div class=info><a href=#s_fn_Allocator.isOpaquePointer>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>234<td><code><pre>func (a *Allocator) isOpaquePointer(t reflect.Type) (ok bool) {</pre></code><tr><td>235<td><code><pre> current := a</pre></code><tr><td>236<td><code><pre></pre></code><tr><td>237<td><code><pre> for current != nil {</pre></code><tr><td>238<td><code><pre> if _, ok = current.cachedPointerTypes.Load(t); ok {</pre></code><tr class=miss><td>239<td><code><pre> return</pre></code><tr><td>240<td><code><pre> }</pre></code><tr><td>241<td><code><pre></pre></code><tr><td>242<td><code><pre> current = current.parent</pre></code><tr><td>243<td><code><pre> }</pre></code><tr><td>244<td><code><pre></pre></code><tr><td>245<td><code><pre> return</pre></code><tr><td>246<td><code><pre>}</pre></code></table><div class=funcname id=fn_clone>func clone</div><div class=info><a href=#s_fn_clone>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func clone(allocator *Allocator, v interface{}) interface{} {</pre></code><tr><td>20<td><code><pre> if v == nil {</pre></code><tr class=miss><td>21<td><code><pre> return nil</pre></code><tr><td>22<td><code><pre> }</pre></code><tr><td>23<td><code><pre></pre></code><tr><td>24<td><code><pre> val := reflect.ValueOf(v)</pre></code><tr><td>25<td><code><pre> cloned := allocator.clone(val, false)</pre></code><tr><td>26<td><code><pre> return cloned.Interface()</pre></code><tr><td>27<td><code><pre>}</pre></code></table><div class=funcname id=fn_cloneSlowly>func cloneSlowly</div><div class=info><a href=#s_fn_cloneSlowly>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>29<td><code><pre>func cloneSlowly(allocator *Allocator, v interface{}) interface{} {</pre></code><tr><td>30<td><code><pre> if v == nil {</pre></code><tr class=miss><td>31<td><code><pre> return nil</pre></code><tr><td>32<td><code><pre> }</pre></code><tr><td>33<td><code><pre></pre></code><tr><td>34<td><code><pre> val := reflect.ValueOf(v)</pre></code><tr><td>35<td><code><pre> cloned := allocator.cloneSlowly(val, false)</pre></code><tr><td>36<td><code><pre> return cloned.Interface()</pre></code><tr><td>37<td><code><pre>}</pre></code></table><div class=funcname id=fn_cloneState.clone>func cloneState.clone</div><div class=info><a href=#s_fn_cloneState.clone>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>58<td><code><pre>func (state *cloneState) clone(v reflect.Value) reflect.Value {</pre></code><tr><td>59<td><code><pre> if state.allocator.isScalar(v.Kind()) {</pre></code><tr><td>60<td><code><pre> return copyScalarValue(v)</pre></code><tr><td>61<td><code><pre> }</pre></code><tr><td>62<td><code><pre></pre></code><tr><td>63<td><code><pre> switch v.Kind() {</pre></code><tr><td>64<td><code><pre> case reflect.Array:</pre></code><tr><td>65<td><code><pre> return state.cloneArray(v)</pre></code><tr><td>66<td><code><pre> case reflect.Chan:</pre></code><tr class=miss><td>67<td><code><pre> return state.allocator.MakeChan(v.Type(), v.Cap())</pre></code><tr><td>68<td><code><pre> case reflect.Interface:</pre></code><tr><td>69<td><code><pre> return state.cloneInterface(v)</pre></code><tr><td>70<td><code><pre> case reflect.Map:</pre></code><tr><td>71<td><code><pre> return state.cloneMap(v)</pre></code><tr><td>72<td><code><pre> case reflect.Ptr:</pre></code><tr><td>73<td><code><pre> return state.clonePtr(v)</pre></code><tr><td>74<td><code><pre> case reflect.Slice:</pre></code><tr><td>75<td><code><pre> return state.cloneSlice(v)</pre></code><tr><td>76<td><code><pre> case reflect.Struct:</pre></code><tr><td>77<td><code><pre> return state.cloneStruct(v)</pre></code><tr><td>78<td><code><pre> case reflect.String:</pre></code><tr class=miss><td>79<td><code><pre> return state.cloneString(v)</pre></code><tr><td>80<td><code><pre> default:</pre></code><tr class=miss><td>81<td><code><pre> panic(fmt.Errorf("go-clone: <bug> unsupported type `%v`", v.Type()))</pre></code><tr><td>82<td><code><pre> }</pre></code><tr><td>83<td><code><pre>}</pre></code></table><div class=funcname id=fn_cloneState.copyArray>func cloneState.copyArray</div><div class=info><a href=#s_fn_cloneState.copyArray>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>91<td><code><pre>func (state *cloneState) copyArray(src, nv reflect.Value) {</pre></code><tr><td>92<td><code><pre> p := unsafe.Pointer(nv.Pointer()) // dst must be a Ptr.</pre></code><tr><td>93<td><code><pre> dst := nv.Elem()</pre></code><tr><td>94<td><code><pre> num := src.Len()</pre></code><tr><td>95<td><code><pre></pre></code><tr><td>96<td><code><pre> if state.allocator.isScalar(src.Type().Elem().Kind()) {</pre></code><tr class=miss><td>97<td><code><pre> shadowCopy(src, p)</pre></code><tr class=miss><td>98<td><code><pre> return</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre></pre></code><tr><td>101<td><code><pre> for i := 0; i < num; i++ {</pre></code><tr><td>102<td><code><pre> dst.Index(i).Set(state.clone(src.Index(i)))</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre>}</pre></code></table><div class=funcname id=fn_Allocator.cloneSlowly>func Allocator.cloneSlowly</div><div class=info><a href=#s_fn_Allocator.cloneSlowly>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>123<td><code><pre>func (a *Allocator) cloneSlowly(val reflect.Value, inCustomFunc bool) reflect.Value {</pre></code><tr><td>124<td><code><pre> if !val.IsValid() {</pre></code><tr class=miss><td>125<td><code><pre> return val</pre></code><tr><td>126<td><code><pre> }</pre></code><tr><td>127<td><code><pre></pre></code><tr><td>128<td><code><pre> state := &cloneState{</pre></code><tr><td>129<td><code><pre> allocator: a,</pre></code><tr><td>130<td><code><pre> visited: visitMap{},</pre></code><tr><td>131<td><code><pre> invalid: invalidPointers{},</pre></code><tr><td>132<td><code><pre> }</pre></code><tr><td>133<td><code><pre></pre></code><tr><td>134<td><code><pre> if inCustomFunc {</pre></code><tr class=miss><td>135<td><code><pre> state.skipCustomFuncValue = val</pre></code><tr><td>136<td><code><pre> }</pre></code><tr><td>137<td><code><pre></pre></code><tr><td>138<td><code><pre> cloned := state.clone(val)</pre></code><tr><td>139<td><code><pre> state.fix(cloned)</pre></code><tr><td>140<td><code><pre> return cloned</pre></code><tr><td>141<td><code><pre>}</pre></code></table><div class=funcname id=fn_Allocator.MarkAsScalar>func Allocator.MarkAsScalar</div><div class=info><a href=#s_fn_Allocator.MarkAsScalar>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>257<td><code><pre>func (a *Allocator) MarkAsScalar(t reflect.Type) {</pre></code><tr><td>258<td><code><pre> t = indirectType(t)</pre></code><tr><td>259<td><code><pre> if t.Kind() != reflect.Struct {</pre></code><tr class=miss><td>260<td><code><pre> return</pre></code><tr><td>261<td><code><pre> }</pre></code><tr><td>262<td><code><pre></pre></code><tr><td>263<td><code><pre> a.cachedStructTypes.Store(t, zeroStructType)</pre></code><tr><td>264<td><code><pre>}</pre></code></table><div class=funcname id=fn_cloneState.clonePtr>func cloneState.clonePtr</div><div class=info><a href=#s_fn_cloneState.clonePtr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>153<td><code><pre>func (state *cloneState) clonePtr(v reflect.Value) reflect.Value {</pre></code><tr><td>154<td><code><pre> if v.IsNil() {</pre></code><tr><td>155<td><code><pre> return reflect.Zero(v.Type())</pre></code><tr><td>156<td><code><pre> }</pre></code><tr><td>157<td><code><pre></pre></code><tr><td>158<td><code><pre> t := v.Type()</pre></code><tr><td>159<td><code><pre></pre></code><tr><td>160<td><code><pre> if state.allocator.isOpaquePointer(t) {</pre></code><tr class=miss><td>161<td><code><pre> if v.CanInterface() {</pre></code><tr class=miss><td>162<td><code><pre> return v</pre></code><tr><td>163<td><code><pre> }</pre></code><tr><td>164<td><code><pre></pre></code><tr class=miss><td>165<td><code><pre> ptr := state.allocator.New(t)</pre></code><tr class=miss><td>166<td><code><pre> p := unsafe.Pointer(ptr.Pointer())</pre></code><tr class=miss><td>167<td><code><pre> shadowCopy(v, p)</pre></code><tr class=miss><td>168<td><code><pre> return ptr.Elem()</pre></code><tr><td>169<td><code><pre> }</pre></code><tr><td>170<td><code><pre></pre></code><tr><td>171<td><code><pre> if state.visited != nil {</pre></code><tr><td>172<td><code><pre> vst := visit{</pre></code><tr><td>173<td><code><pre> p: v.Pointer(),</pre></code><tr><td>174<td><code><pre> t: t,</pre></code><tr><td>175<td><code><pre> }</pre></code><tr><td>176<td><code><pre></pre></code><tr><td>177<td><code><pre> if val, ok := state.visited[vst]; ok {</pre></code><tr class=miss><td>178<td><code><pre> return val</pre></code><tr><td>179<td><code><pre> }</pre></code><tr><td>180<td><code><pre> }</pre></code><tr><td>181<td><code><pre></pre></code><tr><td>182<td><code><pre> src := v.Elem()</pre></code><tr><td>183<td><code><pre> elemType := src.Type()</pre></code><tr><td>184<td><code><pre> elemKind := src.Kind()</pre></code><tr><td>185<td><code><pre> nv := state.allocator.New(elemType)</pre></code><tr><td>186<td><code><pre></pre></code><tr><td>187<td><code><pre> if state.visited != nil {</pre></code><tr><td>188<td><code><pre> vst := visit{</pre></code><tr><td>189<td><code><pre> p: v.Pointer(),</pre></code><tr><td>190<td><code><pre> t: t,</pre></code><tr><td>191<td><code><pre> }</pre></code><tr><td>192<td><code><pre> state.visited[vst] = nv</pre></code><tr><td>193<td><code><pre> }</pre></code><tr><td>194<td><code><pre></pre></code><tr><td>195<td><code><pre> switch elemKind {</pre></code><tr><td>196<td><code><pre> case reflect.Struct:</pre></code><tr><td>197<td><code><pre> state.copyStruct(src, nv)</pre></code><tr><td>198<td><code><pre> case reflect.Array:</pre></code><tr class=miss><td>199<td><code><pre> state.copyArray(src, nv)</pre></code><tr><td>200<td><code><pre> default:</pre></code><tr><td>201<td><code><pre> nv.Elem().Set(state.clone(src))</pre></code><tr><td>202<td><code><pre> }</pre></code><tr><td>203<td><code><pre></pre></code><tr><td>204<td><code><pre> // If this pointer is the address of a struct field and it's a cycle pointer,</pre></code><tr><td>205<td><code><pre> // it may be updated.</pre></code><tr><td>206<td><code><pre> if state.visited != nil {</pre></code><tr><td>207<td><code><pre> vst := visit{</pre></code><tr><td>208<td><code><pre> p: v.Pointer(),</pre></code><tr><td>209<td><code><pre> t: t,</pre></code><tr><td>210<td><code><pre> }</pre></code><tr><td>211<td><code><pre> nv = state.visited[vst]</pre></code><tr><td>212<td><code><pre> }</pre></code><tr><td>213<td><code><pre></pre></code><tr><td>214<td><code><pre> return nv</pre></code><tr><td>215<td><code><pre>}</pre></code></table><div class=funcname id=fn_forceClearROFlag>func forceClearROFlag</div><div class=info><a href=#s_fn_forceClearROFlag>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/structtype.go</code>:</div><table class=listing><tr><td>277<td><code><pre>func forceClearROFlag(v reflect.Value) reflect.Value {</pre></code><tr><td>278<td><code><pre> var i interface{}</pre></code><tr><td>279<td><code><pre> indirect := 0</pre></code><tr><td>280<td><code><pre></pre></code><tr><td>281<td><code><pre> // Save flagAddr.</pre></code><tr><td>282<td><code><pre> for v.CanAddr() {</pre></code><tr class=miss><td>283<td><code><pre> v = v.Addr()</pre></code><tr class=miss><td>284<td><code><pre> indirect++</pre></code><tr><td>285<td><code><pre> }</pre></code><tr><td>286<td><code><pre></pre></code><tr><td>287<td><code><pre> v = v.Convert(typeOfInterface)</pre></code><tr><td>288<td><code><pre> nv := reflect.ValueOf(&i)</pre></code><tr><td>289<td><code><pre> *(*interfaceData)(unsafe.Pointer(nv.Pointer())) = parseReflectValue(v)</pre></code><tr><td>290<td><code><pre> cleared := nv.Elem().Elem()</pre></code><tr><td>291<td><code><pre></pre></code><tr><td>292<td><code><pre> for indirect > 0 {</pre></code><tr class=miss><td>293<td><code><pre> cleared = cleared.Elem()</pre></code><tr class=miss><td>294<td><code><pre> indirect--</pre></code><tr><td>295<td><code><pre> }</pre></code><tr><td>296<td><code><pre></pre></code><tr><td>297<td><code><pre> return cleared</pre></code><tr><td>298<td><code><pre>}</pre></code></table><div class=funcname id=fn_indirectType>func indirectType</div><div class=info><a href=#s_fn_indirectType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/utils.go</code>:</div><table class=listing><tr><td>5<td><code><pre>func indirectType(s reflect.Type) (d reflect.Type) {</pre></code><tr><td>6<td><code><pre> if s == nil {</pre></code><tr class=miss><td>7<td><code><pre> return s</pre></code><tr><td>8<td><code><pre> }</pre></code><tr><td>9<td><code><pre> d = s</pre></code><tr><td>10<td><code><pre> for d.Kind() == reflect.Ptr {</pre></code><tr class=miss><td>11<td><code><pre> d = d.Elem()</pre></code><tr><td>12<td><code><pre> }</pre></code><tr><td>13<td><code><pre> return</pre></code><tr><td>14<td><code><pre>}</pre></code></table><div class=funcname id=fn_Allocator.clone>func Allocator.clone</div><div class=info><a href=#s_fn_Allocator.clone>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>101<td><code><pre>func (a *Allocator) clone(val reflect.Value, inCustomFunc bool) reflect.Value {</pre></code><tr><td>102<td><code><pre> if !val.IsValid() {</pre></code><tr class=miss><td>103<td><code><pre> return val</pre></code><tr><td>104<td><code><pre> }</pre></code><tr><td>105<td><code><pre></pre></code><tr><td>106<td><code><pre> state := &cloneState{</pre></code><tr><td>107<td><code><pre> allocator: a,</pre></code><tr><td>108<td><code><pre> }</pre></code><tr><td>109<td><code><pre></pre></code><tr><td>110<td><code><pre> if inCustomFunc {</pre></code><tr class=miss><td>111<td><code><pre> state.skipCustomFuncValue = val</pre></code><tr><td>112<td><code><pre> }</pre></code><tr><td>113<td><code><pre></pre></code><tr><td>114<td><code><pre> return state.clone(val)</pre></code><tr><td>115<td><code><pre>}</pre></code></table><div class=funcname id=fn_Allocator.SetCustomFunc>func Allocator.SetCustomFunc</div><div class=info><a href=#s_fn_Allocator.SetCustomFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>284<td><code><pre>func (a *Allocator) SetCustomFunc(t reflect.Type, fn Func) {</pre></code><tr><td>285<td><code><pre> if fn == nil {</pre></code><tr class=miss><td>286<td><code><pre> a.cachedCustomFuncTypes.Delete(t)</pre></code><tr class=miss><td>287<td><code><pre> return</pre></code><tr><td>288<td><code><pre> }</pre></code><tr><td>289<td><code><pre></pre></code><tr><td>290<td><code><pre> t = indirectType(t)</pre></code><tr><td>291<td><code><pre> if t.Kind() != reflect.Struct {</pre></code><tr class=miss><td>292<td><code><pre> return</pre></code><tr><td>293<td><code><pre> }</pre></code><tr><td>294<td><code><pre></pre></code><tr><td>295<td><code><pre> a.cachedCustomFuncTypes.Store(t, fn)</pre></code><tr><td>296<td><code><pre>}</pre></code></table><div class=funcname id=fn_structType.Init>func structType.Init</div><div class=info><a href=#s_fn_structType.Init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/structtype.go</code>:</div><table class=listing><tr><td>153<td><code><pre>func (st *structType) Init(allocator *Allocator, src, nv reflect.Value, noCustomFunc bool) (done bool) {</pre></code><tr><td>154<td><code><pre> dst := nv.Elem()</pre></code><tr><td>155<td><code><pre></pre></code><tr><td>156<td><code><pre> if !noCustomFunc && st.fn != nil {</pre></code><tr class=miss><td>157<td><code><pre> if !src.CanInterface() {</pre></code><tr class=miss><td>158<td><code><pre> src = forceClearROFlag(src)</pre></code><tr><td>159<td><code><pre> }</pre></code><tr><td>160<td><code><pre></pre></code><tr class=miss><td>161<td><code><pre> st.fn(allocator, src, dst)</pre></code><tr class=miss><td>162<td><code><pre> done = true</pre></code><tr class=miss><td>163<td><code><pre> return</pre></code><tr><td>164<td><code><pre> }</pre></code><tr><td>165<td><code><pre></pre></code><tr><td>166<td><code><pre> ptr := unsafe.Pointer(nv.Pointer())</pre></code><tr><td>167<td><code><pre> shadowCopy(src, ptr)</pre></code><tr><td>168<td><code><pre> done = len(st.PointerFields) == 0</pre></code><tr><td>169<td><code><pre> return</pre></code><tr><td>170<td><code><pre>}</pre></code></table><div class=funcname id=fn_shadowCopy>func shadowCopy</div><div class=info><a href=#s_fn_shadowCopy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>344<td><code><pre>func shadowCopy(src reflect.Value, p unsafe.Pointer) {</pre></code><tr><td>345<td><code><pre> switch src.Kind() {</pre></code><tr><td>346<td><code><pre> case reflect.Bool:</pre></code><tr><td>347<td><code><pre> *(*bool)(p) = src.Bool()</pre></code><tr><td>348<td><code><pre> case reflect.Int:</pre></code><tr><td>349<td><code><pre> *(*int)(p) = int(src.Int())</pre></code><tr><td>350<td><code><pre> case reflect.Int8:</pre></code><tr class=miss><td>351<td><code><pre> *(*int8)(p) = int8(src.Int())</pre></code><tr><td>352<td><code><pre> case reflect.Int16:</pre></code><tr class=miss><td>353<td><code><pre> *(*int16)(p) = int16(src.Int())</pre></code><tr><td>354<td><code><pre> case reflect.Int32:</pre></code><tr class=miss><td>355<td><code><pre> *(*int32)(p) = int32(src.Int())</pre></code><tr><td>356<td><code><pre> case reflect.Int64:</pre></code><tr><td>357<td><code><pre> *(*int64)(p) = src.Int()</pre></code><tr><td>358<td><code><pre> case reflect.Uint:</pre></code><tr class=miss><td>359<td><code><pre> *(*uint)(p) = uint(src.Uint())</pre></code><tr><td>360<td><code><pre> case reflect.Uint8:</pre></code><tr><td>361<td><code><pre> *(*uint8)(p) = uint8(src.Uint())</pre></code><tr><td>362<td><code><pre> case reflect.Uint16:</pre></code><tr class=miss><td>363<td><code><pre> *(*uint16)(p) = uint16(src.Uint())</pre></code><tr><td>364<td><code><pre> case reflect.Uint32:</pre></code><tr class=miss><td>365<td><code><pre> *(*uint32)(p) = uint32(src.Uint())</pre></code><tr><td>366<td><code><pre> case reflect.Uint64:</pre></code><tr class=miss><td>367<td><code><pre> *(*uint64)(p) = src.Uint()</pre></code><tr><td>368<td><code><pre> case reflect.Uintptr:</pre></code><tr class=miss><td>369<td><code><pre> *(*uintptr)(p) = uintptr(src.Uint())</pre></code><tr><td>370<td><code><pre> case reflect.Float32:</pre></code><tr class=miss><td>371<td><code><pre> *(*float32)(p) = float32(src.Float())</pre></code><tr><td>372<td><code><pre> case reflect.Float64:</pre></code><tr class=miss><td>373<td><code><pre> *(*float64)(p) = src.Float()</pre></code><tr><td>374<td><code><pre> case reflect.Complex64:</pre></code><tr class=miss><td>375<td><code><pre> *(*complex64)(p) = complex64(src.Complex())</pre></code><tr><td>376<td><code><pre> case reflect.Complex128:</pre></code><tr class=miss><td>377<td><code><pre> *(*complex128)(p) = src.Complex()</pre></code><tr><td>378<td><code><pre></pre></code><tr><td>379<td><code><pre> case reflect.Array:</pre></code><tr><td>380<td><code><pre> t := src.Type()</pre></code><tr><td>381<td><code><pre></pre></code><tr><td>382<td><code><pre> if src.CanAddr() {</pre></code><tr><td>383<td><code><pre> srcPtr := unsafe.Pointer(src.UnsafeAddr())</pre></code><tr><td>384<td><code><pre> sz := t.Size()</pre></code><tr><td>385<td><code><pre> copy((*[maxByteSize]byte)(p)[:sz:sz], (*[maxByteSize]byte)(srcPtr)[:sz:sz])</pre></code><tr><td>386<td><code><pre> return</pre></code><tr><td>387<td><code><pre> }</pre></code><tr><td>388<td><code><pre></pre></code><tr class=miss><td>389<td><code><pre> val := reflect.NewAt(t, p).Elem()</pre></code><tr><td>390<td><code><pre></pre></code><tr class=miss><td>391<td><code><pre> if src.CanInterface() {</pre></code><tr class=miss><td>392<td><code><pre> val.Set(src)</pre></code><tr class=miss><td>393<td><code><pre> return</pre></code><tr><td>394<td><code><pre> }</pre></code><tr><td>395<td><code><pre></pre></code><tr class=miss><td>396<td><code><pre> sz := t.Elem().Size()</pre></code><tr class=miss><td>397<td><code><pre> num := src.Len()</pre></code><tr><td>398<td><code><pre></pre></code><tr class=miss><td>399<td><code><pre> for i := 0; i < num; i++ {</pre></code><tr class=miss><td>400<td><code><pre> elemPtr := unsafe.Pointer(uintptr(p) + uintptr(i)*sz)</pre></code><tr class=miss><td>401<td><code><pre> shadowCopy(src.Index(i), elemPtr)</pre></code><tr><td>402<td><code><pre> }</pre></code><tr><td>403<td><code><pre> case reflect.Chan:</pre></code><tr class=miss><td>404<td><code><pre> *((*uintptr)(p)) = src.Pointer()</pre></code><tr><td>405<td><code><pre> case reflect.Func:</pre></code><tr class=miss><td>406<td><code><pre> t := src.Type()</pre></code><tr class=miss><td>407<td><code><pre> src = copyScalarValue(src)</pre></code><tr class=miss><td>408<td><code><pre> val := reflect.NewAt(t, p).Elem()</pre></code><tr class=miss><td>409<td><code><pre> val.Set(src)</pre></code><tr><td>410<td><code><pre> case reflect.Interface:</pre></code><tr><td>411<td><code><pre> *((*interfaceData)(p)) = parseReflectValue(src)</pre></code><tr><td>412<td><code><pre> case reflect.Map:</pre></code><tr><td>413<td><code><pre> *((*uintptr)(p)) = src.Pointer()</pre></code><tr><td>414<td><code><pre> case reflect.Ptr:</pre></code><tr><td>415<td><code><pre> *((*uintptr)(p)) = src.Pointer()</pre></code><tr><td>416<td><code><pre> case reflect.Slice:</pre></code><tr><td>417<td><code><pre> *(*sliceHeader)(p) = sliceHeader{</pre></code><tr><td>418<td><code><pre> Data: src.Pointer(),</pre></code><tr><td>419<td><code><pre> Len: src.Len(),</pre></code><tr><td>420<td><code><pre> Cap: src.Cap(),</pre></code><tr><td>421<td><code><pre> }</pre></code><tr><td>422<td><code><pre> case reflect.String:</pre></code><tr><td>423<td><code><pre> s := src.String()</pre></code><tr><td>424<td><code><pre> val := reflect.NewAt(typeOfString, p).Elem()</pre></code><tr><td>425<td><code><pre> val.SetString(s)</pre></code><tr><td>426<td><code><pre> case reflect.Struct:</pre></code><tr><td>427<td><code><pre> t := src.Type()</pre></code><tr><td>428<td><code><pre> val := reflect.NewAt(t, p).Elem()</pre></code><tr><td>429<td><code><pre></pre></code><tr><td>430<td><code><pre> if src.CanInterface() {</pre></code><tr><td>431<td><code><pre> val.Set(src)</pre></code><tr><td>432<td><code><pre> return</pre></code><tr><td>433<td><code><pre> }</pre></code><tr><td>434<td><code><pre></pre></code><tr><td>435<td><code><pre> num := t.NumField()</pre></code><tr><td>436<td><code><pre></pre></code><tr><td>437<td><code><pre> for i := 0; i < num; i++ {</pre></code><tr><td>438<td><code><pre> field := t.Field(i)</pre></code><tr><td>439<td><code><pre> fieldPtr := unsafe.Pointer(uintptr(p) + field.Offset)</pre></code><tr><td>440<td><code><pre> shadowCopy(src.Field(i), fieldPtr)</pre></code><tr><td>441<td><code><pre> }</pre></code><tr><td>442<td><code><pre> case reflect.UnsafePointer:</pre></code><tr><td>443<td><code><pre> // There is no way to copy unsafe.Pointer value.</pre></code><tr class=miss><td>444<td><code><pre> *((*uintptr)(p)) = src.Pointer()</pre></code><tr><td>445<td><code><pre></pre></code><tr><td>446<td><code><pre> default:</pre></code><tr class=miss><td>447<td><code><pre> panic(fmt.Errorf("go-clone: <bug> impossible type `%v` when cloning private field", src.Type()))</pre></code><tr><td>448<td><code><pre> }</pre></code><tr><td>449<td><code><pre>}</pre></code></table><div class=funcname id=fn_cloneState.fix>func cloneState.fix</div><div class=info><a href=#s_fn_cloneState.fix>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>452<td><code><pre>func (state *cloneState) fix(v reflect.Value) {</pre></code><tr><td>453<td><code><pre> if state == nil || len(state.invalid) == 0 {</pre></code><tr><td>454<td><code><pre> return</pre></code><tr><td>455<td><code><pre> }</pre></code><tr><td>456<td><code><pre></pre></code><tr class=miss><td>457<td><code><pre> fix := &fixState{</pre></code><tr><td>458<td><code><pre> allocator: state.allocator,</pre></code><tr><td>459<td><code><pre> fixed: fixMap{},</pre></code><tr><td>460<td><code><pre> invalid: state.invalid,</pre></code><tr><td>461<td><code><pre> }</pre></code><tr class=miss><td>462<td><code><pre> fix.fix(v)</pre></code><tr><td>463<td><code><pre>}</pre></code></table><div class=funcname id=fn_copyScalarValue>func copyScalarValue</div><div class=info><a href=#s_fn_copyScalarValue>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/structtype.go</code>:</div><table class=listing><tr><td>209<td><code><pre>func copyScalarValue(src reflect.Value) reflect.Value {</pre></code><tr><td>210<td><code><pre> if src.CanInterface() {</pre></code><tr><td>211<td><code><pre> return src</pre></code><tr><td>212<td><code><pre> }</pre></code><tr><td>213<td><code><pre></pre></code><tr><td>214<td><code><pre> // src is an unexported field value. Copy its value.</pre></code><tr><td>215<td><code><pre> switch src.Kind() {</pre></code><tr><td>216<td><code><pre> case reflect.Bool:</pre></code><tr class=miss><td>217<td><code><pre> return reflect.ValueOf(src.Bool())</pre></code><tr><td>218<td><code><pre></pre></code><tr><td>219<td><code><pre> case reflect.Int:</pre></code><tr><td>220<td><code><pre> return reflect.ValueOf(int(src.Int()))</pre></code><tr><td>221<td><code><pre> case reflect.Int8:</pre></code><tr class=miss><td>222<td><code><pre> return reflect.ValueOf(int8(src.Int()))</pre></code><tr><td>223<td><code><pre> case reflect.Int16:</pre></code><tr class=miss><td>224<td><code><pre> return reflect.ValueOf(int16(src.Int()))</pre></code><tr><td>225<td><code><pre> case reflect.Int32:</pre></code><tr class=miss><td>226<td><code><pre> return reflect.ValueOf(int32(src.Int()))</pre></code><tr><td>227<td><code><pre> case reflect.Int64:</pre></code><tr class=miss><td>228<td><code><pre> return reflect.ValueOf(src.Int())</pre></code><tr><td>229<td><code><pre></pre></code><tr><td>230<td><code><pre> case reflect.Uint:</pre></code><tr class=miss><td>231<td><code><pre> return reflect.ValueOf(uint(src.Uint()))</pre></code><tr><td>232<td><code><pre> case reflect.Uint8:</pre></code><tr class=miss><td>233<td><code><pre> return reflect.ValueOf(uint8(src.Uint()))</pre></code><tr><td>234<td><code><pre> case reflect.Uint16:</pre></code><tr class=miss><td>235<td><code><pre> return reflect.ValueOf(uint16(src.Uint()))</pre></code><tr><td>236<td><code><pre> case reflect.Uint32:</pre></code><tr class=miss><td>237<td><code><pre> return reflect.ValueOf(uint32(src.Uint()))</pre></code><tr><td>238<td><code><pre> case reflect.Uint64:</pre></code><tr class=miss><td>239<td><code><pre> return reflect.ValueOf(src.Uint())</pre></code><tr><td>240<td><code><pre> case reflect.Uintptr:</pre></code><tr class=miss><td>241<td><code><pre> return reflect.ValueOf(uintptr(src.Uint()))</pre></code><tr><td>242<td><code><pre></pre></code><tr><td>243<td><code><pre> case reflect.Float32:</pre></code><tr class=miss><td>244<td><code><pre> return reflect.ValueOf(float32(src.Float()))</pre></code><tr><td>245<td><code><pre> case reflect.Float64:</pre></code><tr class=miss><td>246<td><code><pre> return reflect.ValueOf(src.Float())</pre></code><tr><td>247<td><code><pre></pre></code><tr><td>248<td><code><pre> case reflect.Complex64:</pre></code><tr class=miss><td>249<td><code><pre> return reflect.ValueOf(complex64(src.Complex()))</pre></code><tr><td>250<td><code><pre> case reflect.Complex128:</pre></code><tr class=miss><td>251<td><code><pre> return reflect.ValueOf(src.Complex())</pre></code><tr><td>252<td><code><pre></pre></code><tr><td>253<td><code><pre> case reflect.String:</pre></code><tr class=miss><td>254<td><code><pre> return reflect.ValueOf(src.String())</pre></code><tr><td>255<td><code><pre> case reflect.Func:</pre></code><tr><td>256<td><code><pre> t := src.Type()</pre></code><tr><td>257<td><code><pre></pre></code><tr><td>258<td><code><pre> if src.IsNil() {</pre></code><tr class=miss><td>259<td><code><pre> return reflect.Zero(t)</pre></code><tr><td>260<td><code><pre> }</pre></code><tr><td>261<td><code><pre></pre></code><tr><td>262<td><code><pre> // Don't use this trick unless we have no choice.</pre></code><tr><td>263<td><code><pre> return forceClearROFlag(src)</pre></code><tr><td>264<td><code><pre> case reflect.UnsafePointer:</pre></code><tr class=miss><td>265<td><code><pre> return reflect.ValueOf(unsafe.Pointer(src.Pointer()))</pre></code><tr><td>266<td><code><pre> }</pre></code><tr><td>267<td><code><pre></pre></code><tr class=miss><td>268<td><code><pre> panic(fmt.Errorf("go-clone: <bug> impossible type `%v` when cloning private field", src.Type()))</pre></code><tr><td>269<td><code><pre>}</pre></code></table><div class=funcname id=fn_fixState.fixMap>func fixState.fixMap</div><div class=info><a href=#s_fn_fixState.fixMap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>593<td><code><pre>func (fix *fixState) fixMap(v reflect.Value) (copied reflect.Value, changed int) {</pre></code><tr class=miss><td>594<td><code><pre> if v.IsNil() {</pre></code><tr class=miss><td>595<td><code><pre> return</pre></code><tr><td>596<td><code><pre> }</pre></code><tr><td>597<td><code><pre></pre></code><tr class=miss><td>598<td><code><pre> t := v.Type()</pre></code><tr class=miss><td>599<td><code><pre> vst := visit{</pre></code><tr><td>600<td><code><pre> p: v.Pointer(),</pre></code><tr><td>601<td><code><pre> t: t,</pre></code><tr><td>602<td><code><pre> }</pre></code><tr><td>603<td><code><pre></pre></code><tr class=miss><td>604<td><code><pre> if _, ok := fix.fixed[vst]; ok {</pre></code><tr class=miss><td>605<td><code><pre> return</pre></code><tr><td>606<td><code><pre> }</pre></code><tr><td>607<td><code><pre></pre></code><tr class=miss><td>608<td><code><pre> fix.fixed[vst] = struct{}{}</pre></code><tr><td>609<td><code><pre></pre></code><tr class=miss><td>610<td><code><pre> kt := t.Key()</pre></code><tr class=miss><td>611<td><code><pre> et := t.Elem()</pre></code><tr class=miss><td>612<td><code><pre> keyKind := kt.Kind()</pre></code><tr class=miss><td>613<td><code><pre> elemKind := et.Kind()</pre></code><tr><td>614<td><code><pre></pre></code><tr class=miss><td>615<td><code><pre> if isScalar := fix.allocator.isScalar; isScalar(keyKind) && isScalar(elemKind) {</pre></code><tr class=miss><td>616<td><code><pre> return</pre></code><tr><td>617<td><code><pre> }</pre></code><tr><td>618<td><code><pre></pre></code><tr class=miss><td>619<td><code><pre> invalidKeys := map[reflect.Value][2]reflect.Value{}</pre></code><tr><td>620<td><code><pre></pre></code><tr class=miss><td>621<td><code><pre> for iter := mapIter(v); iter.Next(); {</pre></code><tr class=miss><td>622<td><code><pre> key := iter.Key()</pre></code><tr class=miss><td>623<td><code><pre> elem := iter.Value()</pre></code><tr class=miss><td>624<td><code><pre> var fixed reflect.Value</pre></code><tr class=miss><td>625<td><code><pre> c := 0</pre></code><tr><td>626<td><code><pre></pre></code><tr class=miss><td>627<td><code><pre> if elemKind == reflect.Ptr {</pre></code><tr class=miss><td>628<td><code><pre> vst := visit{</pre></code><tr><td>629<td><code><pre> p: elem.Pointer(),</pre></code><tr><td>630<td><code><pre> t: et,</pre></code><tr><td>631<td><code><pre> }</pre></code><tr><td>632<td><code><pre></pre></code><tr class=miss><td>633<td><code><pre> if nv, ok := fix.invalid[vst]; ok {</pre></code><tr class=miss><td>634<td><code><pre> fixed = nv</pre></code><tr class=miss><td>635<td><code><pre> c++</pre></code><tr><td>636<td><code><pre> } else {</pre></code><tr class=miss><td>637<td><code><pre> fixed, c = fix.fixPtr(elem)</pre></code><tr><td>638<td><code><pre> }</pre></code><tr><td>639<td><code><pre> } else {</pre></code><tr class=miss><td>640<td><code><pre> fixed, c = fix.fix(elem)</pre></code><tr><td>641<td><code><pre> }</pre></code><tr><td>642<td><code><pre></pre></code><tr class=miss><td>643<td><code><pre> changed += c</pre></code><tr class=miss><td>644<td><code><pre> c = 0</pre></code><tr><td>645<td><code><pre></pre></code><tr class=miss><td>646<td><code><pre> if fixed.IsValid() {</pre></code><tr class=miss><td>647<td><code><pre> v = forceSetMapIndex(v, key, fixed)</pre></code><tr class=miss><td>648<td><code><pre> elem = fixed</pre></code><tr class=miss><td>649<td><code><pre> fixed = reflect.Value{}</pre></code><tr><td>650<td><code><pre> }</pre></code><tr><td>651<td><code><pre></pre></code><tr class=miss><td>652<td><code><pre> if keyKind == reflect.Ptr {</pre></code><tr class=miss><td>653<td><code><pre> vst := visit{</pre></code><tr><td>654<td><code><pre> p: key.Pointer(),</pre></code><tr><td>655<td><code><pre> t: kt,</pre></code><tr><td>656<td><code><pre> }</pre></code><tr><td>657<td><code><pre></pre></code><tr class=miss><td>658<td><code><pre> if nv, ok := fix.invalid[vst]; ok {</pre></code><tr class=miss><td>659<td><code><pre> fixed = nv</pre></code><tr class=miss><td>660<td><code><pre> c++</pre></code><tr><td>661<td><code><pre> } else {</pre></code><tr class=miss><td>662<td><code><pre> fixed, c = fix.fixPtr(key)</pre></code><tr><td>663<td><code><pre> }</pre></code><tr><td>664<td><code><pre> } else {</pre></code><tr class=miss><td>665<td><code><pre> fixed, c = fix.fix(key)</pre></code><tr><td>666<td><code><pre> }</pre></code><tr><td>667<td><code><pre></pre></code><tr class=miss><td>668<td><code><pre> changed += c</pre></code><tr><td>669<td><code><pre></pre></code><tr><td>670<td><code><pre> // Key cannot be changed immediately inside map range iteration.</pre></code><tr><td>671<td><code><pre> // Do it later.</pre></code><tr class=miss><td>672<td><code><pre> if fixed.IsValid() {</pre></code><tr class=miss><td>673<td><code><pre> invalidKeys[key] = [2]reflect.Value{fixed, elem}</pre></code><tr><td>674<td><code><pre> }</pre></code><tr><td>675<td><code><pre> }</pre></code><tr><td>676<td><code><pre></pre></code><tr class=miss><td>677<td><code><pre> for key, kv := range invalidKeys {</pre></code><tr class=miss><td>678<td><code><pre> v = forceSetMapIndex(v, key, reflect.Value{})</pre></code><tr class=miss><td>679<td><code><pre> v = forceSetMapIndex(v, kv[0], kv[1])</pre></code><tr><td>680<td><code><pre> }</pre></code><tr><td>681<td><code><pre></pre></code><tr class=miss><td>682<td><code><pre> return</pre></code><tr><td>683<td><code><pre>}</pre></code></table><div class=funcname id=fn_fixState.fixStruct>func fixState.fixStruct</div><div class=info><a href=#s_fn_fixState.fixStruct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>788<td><code><pre>func (fix *fixState) fixStruct(v reflect.Value) (copied reflect.Value, changed int) {</pre></code><tr class=miss><td>789<td><code><pre> t := v.Type()</pre></code><tr class=miss><td>790<td><code><pre> st := fix.allocator.loadStructType(t)</pre></code><tr><td>791<td><code><pre></pre></code><tr class=miss><td>792<td><code><pre> if len(st.PointerFields) == 0 {</pre></code><tr class=miss><td>793<td><code><pre> return</pre></code><tr><td>794<td><code><pre> }</pre></code><tr><td>795<td><code><pre></pre></code><tr class=miss><td>796<td><code><pre> for _, pf := range st.PointerFields {</pre></code><tr class=miss><td>797<td><code><pre> i := int(pf.Index)</pre></code><tr class=miss><td>798<td><code><pre> field := v.Field(i)</pre></code><tr><td>799<td><code><pre></pre></code><tr class=miss><td>800<td><code><pre> ft := field.Type()</pre></code><tr><td>801<td><code><pre></pre></code><tr class=miss><td>802<td><code><pre> if ft.Kind() == reflect.Ptr {</pre></code><tr class=miss><td>803<td><code><pre> vst := visit{</pre></code><tr><td>804<td><code><pre> p: field.Pointer(),</pre></code><tr><td>805<td><code><pre> t: ft,</pre></code><tr><td>806<td><code><pre> }</pre></code><tr><td>807<td><code><pre></pre></code><tr class=miss><td>808<td><code><pre> if nv, ok := fix.invalid[vst]; ok {</pre></code><tr><td>809<td><code><pre> // If v is not addressable, a new struct must be allocated.</pre></code><tr><td>810<td><code><pre> // Don't do it unless there is no other choices.</pre></code><tr class=miss><td>811<td><code><pre> if !v.CanAddr() {</pre></code><tr class=miss><td>812<td><code><pre> copied = fix.new(t).Elem()</pre></code><tr class=miss><td>813<td><code><pre> shadowCopy(v, unsafe.Pointer(copied.Addr().Pointer()))</pre></code><tr class=miss><td>814<td><code><pre> _, changed = fix.fixStruct(copied)</pre></code><tr class=miss><td>815<td><code><pre> return</pre></code><tr><td>816<td><code><pre> }</pre></code><tr><td>817<td><code><pre></pre></code><tr class=miss><td>818<td><code><pre> ptr := unsafe.Pointer(v.Addr().Pointer())</pre></code><tr class=miss><td>819<td><code><pre> p := unsafe.Pointer(uintptr(ptr) + pf.Offset)</pre></code><tr class=miss><td>820<td><code><pre> shadowCopy(nv, p)</pre></code><tr class=miss><td>821<td><code><pre> continue</pre></code><tr><td>822<td><code><pre> }</pre></code><tr><td>823<td><code><pre> }</pre></code><tr><td>824<td><code><pre></pre></code><tr class=miss><td>825<td><code><pre> fixed, c := fix.fix(field)</pre></code><tr class=miss><td>826<td><code><pre> changed += c</pre></code><tr><td>827<td><code><pre></pre></code><tr class=miss><td>828<td><code><pre> if fixed.IsValid() {</pre></code><tr><td>829<td><code><pre> // If v is not addressable, a new struct must be allocated.</pre></code><tr><td>830<td><code><pre> // Don't do it unless there is no other choices.</pre></code><tr class=miss><td>831<td><code><pre> if !v.CanAddr() {</pre></code><tr class=miss><td>832<td><code><pre> copied = fix.new(t).Elem()</pre></code><tr class=miss><td>833<td><code><pre> shadowCopy(v, unsafe.Pointer(copied.Addr().Pointer()))</pre></code><tr class=miss><td>834<td><code><pre> _, changed = fix.fixStruct(copied)</pre></code><tr class=miss><td>835<td><code><pre> return</pre></code><tr><td>836<td><code><pre> }</pre></code><tr><td>837<td><code><pre></pre></code><tr class=miss><td>838<td><code><pre> ptr := unsafe.Pointer(v.Addr().Pointer())</pre></code><tr class=miss><td>839<td><code><pre> p := unsafe.Pointer(uintptr(ptr) + pf.Offset)</pre></code><tr class=miss><td>840<td><code><pre> shadowCopy(fixed, p)</pre></code><tr><td>841<td><code><pre> }</pre></code><tr><td>842<td><code><pre> }</pre></code><tr><td>843<td><code><pre></pre></code><tr class=miss><td>844<td><code><pre> return</pre></code><tr><td>845<td><code><pre>}</pre></code></table><div class=funcname id=fn_fixState.fixArray>func fixState.fixArray</div><div class=info><a href=#s_fn_fixState.fixArray>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>506<td><code><pre>func (fix *fixState) fixArray(v reflect.Value) (copied reflect.Value, changed int) {</pre></code><tr class=miss><td>507<td><code><pre> t := v.Type()</pre></code><tr class=miss><td>508<td><code><pre> et := t.Elem()</pre></code><tr class=miss><td>509<td><code><pre> kind := et.Kind()</pre></code><tr><td>510<td><code><pre></pre></code><tr class=miss><td>511<td><code><pre> if fix.allocator.isScalar(kind) {</pre></code><tr class=miss><td>512<td><code><pre> return</pre></code><tr><td>513<td><code><pre> }</pre></code><tr><td>514<td><code><pre></pre></code><tr class=miss><td>515<td><code><pre> l := v.Len()</pre></code><tr><td>516<td><code><pre></pre></code><tr class=miss><td>517<td><code><pre> for i := 0; i < l; i++ {</pre></code><tr class=miss><td>518<td><code><pre> elem := v.Index(i)</pre></code><tr><td>519<td><code><pre></pre></code><tr class=miss><td>520<td><code><pre> if kind == reflect.Ptr {</pre></code><tr class=miss><td>521<td><code><pre> vst := visit{</pre></code><tr><td>522<td><code><pre> p: elem.Pointer(),</pre></code><tr><td>523<td><code><pre> t: et,</pre></code><tr><td>524<td><code><pre> }</pre></code><tr><td>525<td><code><pre></pre></code><tr class=miss><td>526<td><code><pre> if nv, ok := fix.invalid[vst]; ok {</pre></code><tr><td>527<td><code><pre> // If elem cannot be set, v must be copied to make it settable.</pre></code><tr><td>528<td><code><pre> // Don't do it unless there is no other choices.</pre></code><tr class=miss><td>529<td><code><pre> if !elem.CanSet() {</pre></code><tr class=miss><td>530<td><code><pre> copied = fix.new(t).Elem()</pre></code><tr class=miss><td>531<td><code><pre> shadowCopy(v, unsafe.Pointer(copied.Addr().Pointer()))</pre></code><tr class=miss><td>532<td><code><pre> _, changed = fix.fixArray(copied)</pre></code><tr class=miss><td>533<td><code><pre> return</pre></code><tr><td>534<td><code><pre> }</pre></code><tr><td>535<td><code><pre></pre></code><tr class=miss><td>536<td><code><pre> elem.Set(nv)</pre></code><tr class=miss><td>537<td><code><pre> changed++</pre></code><tr class=miss><td>538<td><code><pre> continue</pre></code><tr><td>539<td><code><pre> }</pre></code><tr><td>540<td><code><pre> }</pre></code><tr><td>541<td><code><pre></pre></code><tr class=miss><td>542<td><code><pre> fixed, c := fix.fix(elem)</pre></code><tr class=miss><td>543<td><code><pre> changed += c</pre></code><tr><td>544<td><code><pre></pre></code><tr class=miss><td>545<td><code><pre> if fixed.IsValid() {</pre></code><tr><td>546<td><code><pre> // If elem cannot be set, v must be copied to make it settable.</pre></code><tr><td>547<td><code><pre> // Don't do it unless there is no other choices.</pre></code><tr class=miss><td>548<td><code><pre> if !elem.CanSet() {</pre></code><tr class=miss><td>549<td><code><pre> copied = fix.new(t).Elem()</pre></code><tr class=miss><td>550<td><code><pre> shadowCopy(v, unsafe.Pointer(copied.Addr().Pointer()))</pre></code><tr class=miss><td>551<td><code><pre> _, changed = fix.fixArray(copied)</pre></code><tr class=miss><td>552<td><code><pre> return</pre></code><tr><td>553<td><code><pre> }</pre></code><tr><td>554<td><code><pre></pre></code><tr class=miss><td>555<td><code><pre> elem.Set(fixed)</pre></code><tr><td>556<td><code><pre> }</pre></code><tr><td>557<td><code><pre> }</pre></code><tr><td>558<td><code><pre></pre></code><tr class=miss><td>559<td><code><pre> return</pre></code><tr><td>560<td><code><pre>}</pre></code></table><div class=funcname id=fn_fixState.fixSlice>func fixState.fixSlice</div><div class=info><a href=#s_fn_fixState.fixSlice>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>729<td><code><pre>func (fix *fixState) fixSlice(v reflect.Value) (copied reflect.Value, changed int) {</pre></code><tr class=miss><td>730<td><code><pre> if v.IsNil() {</pre></code><tr class=miss><td>731<td><code><pre> return</pre></code><tr><td>732<td><code><pre> }</pre></code><tr><td>733<td><code><pre></pre></code><tr class=miss><td>734<td><code><pre> t := v.Type()</pre></code><tr class=miss><td>735<td><code><pre> et := t.Elem()</pre></code><tr class=miss><td>736<td><code><pre> kind := et.Kind()</pre></code><tr><td>737<td><code><pre></pre></code><tr class=miss><td>738<td><code><pre> if fix.allocator.isScalar(kind) {</pre></code><tr class=miss><td>739<td><code><pre> return</pre></code><tr><td>740<td><code><pre> }</pre></code><tr><td>741<td><code><pre></pre></code><tr class=miss><td>742<td><code><pre> l := v.Len()</pre></code><tr class=miss><td>743<td><code><pre> p := unsafe.Pointer(v.Pointer())</pre></code><tr class=miss><td>744<td><code><pre> vst := visit{</pre></code><tr><td>745<td><code><pre> p: uintptr(p),</pre></code><tr><td>746<td><code><pre> extra: l,</pre></code><tr><td>747<td><code><pre> t: t,</pre></code><tr><td>748<td><code><pre> }</pre></code><tr><td>749<td><code><pre></pre></code><tr class=miss><td>750<td><code><pre> if _, ok := fix.fixed[vst]; ok {</pre></code><tr class=miss><td>751<td><code><pre> return</pre></code><tr><td>752<td><code><pre> }</pre></code><tr><td>753<td><code><pre></pre></code><tr class=miss><td>754<td><code><pre> fix.fixed[vst] = struct{}{}</pre></code><tr><td>755<td><code><pre></pre></code><tr class=miss><td>756<td><code><pre> for i := 0; i < l; i++ {</pre></code><tr class=miss><td>757<td><code><pre> elem := v.Index(i)</pre></code><tr class=miss><td>758<td><code><pre> var fixed reflect.Value</pre></code><tr class=miss><td>759<td><code><pre> c := 0</pre></code><tr><td>760<td><code><pre></pre></code><tr class=miss><td>761<td><code><pre> if kind == reflect.Ptr {</pre></code><tr class=miss><td>762<td><code><pre> vst := visit{</pre></code><tr><td>763<td><code><pre> p: elem.Pointer(),</pre></code><tr><td>764<td><code><pre> t: et,</pre></code><tr><td>765<td><code><pre> }</pre></code><tr><td>766<td><code><pre></pre></code><tr class=miss><td>767<td><code><pre> if nv, ok := fix.invalid[vst]; ok {</pre></code><tr class=miss><td>768<td><code><pre> fixed = nv</pre></code><tr><td>769<td><code><pre> } else {</pre></code><tr class=miss><td>770<td><code><pre> fixed, c = fix.fixPtr(elem)</pre></code><tr><td>771<td><code><pre> }</pre></code><tr><td>772<td><code><pre> } else {</pre></code><tr class=miss><td>773<td><code><pre> fixed, c = fix.fix(elem)</pre></code><tr><td>774<td><code><pre> }</pre></code><tr><td>775<td><code><pre></pre></code><tr class=miss><td>776<td><code><pre> changed += c</pre></code><tr><td>777<td><code><pre></pre></code><tr class=miss><td>778<td><code><pre> if fixed.IsValid() {</pre></code><tr class=miss><td>779<td><code><pre> sz := et.Size()</pre></code><tr class=miss><td>780<td><code><pre> elemPtr := unsafe.Pointer(uintptr(p) + sz*uintptr(i))</pre></code><tr class=miss><td>781<td><code><pre> shadowCopy(fixed, elemPtr)</pre></code><tr><td>782<td><code><pre> }</pre></code><tr><td>783<td><code><pre> }</pre></code><tr><td>784<td><code><pre></pre></code><tr class=miss><td>785<td><code><pre> return</pre></code><tr><td>786<td><code><pre>}</pre></code></table><div class=funcname id=fn_wrap>func wrap</div><div class=info><a href=#s_fn_wrap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/wrapper.go</code>:</div><table class=listing><tr><td>35<td><code><pre>func wrap(v interface{}) interface{} {</pre></code><tr class=miss><td>36<td><code><pre> if v == nil {</pre></code><tr class=miss><td>37<td><code><pre> return v</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre></pre></code><tr class=miss><td>40<td><code><pre> val := reflect.ValueOf(v)</pre></code><tr class=miss><td>41<td><code><pre> pt := val.Type()</pre></code><tr><td>42<td><code><pre></pre></code><tr class=miss><td>43<td><code><pre> if val.Kind() != reflect.Ptr {</pre></code><tr class=miss><td>44<td><code><pre> return v</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre></pre></code><tr class=miss><td>47<td><code><pre> t := pt.Elem()</pre></code><tr class=miss><td>48<td><code><pre> elem := val.Elem()</pre></code><tr class=miss><td>49<td><code><pre> ptr := unsafe.Pointer(val.Pointer())</pre></code><tr class=miss><td>50<td><code><pre> cache, ok := cachedWrapperTypes.Load(t)</pre></code><tr><td>51<td><code><pre></pre></code><tr class=miss><td>52<td><code><pre> if !ok {</pre></code><tr class=miss><td>53<td><code><pre> cache = reflect.StructOf([]reflect.StructField{</pre></code><tr><td>54<td><code><pre> {</pre></code><tr><td>55<td><code><pre> Name: "T",</pre></code><tr><td>56<td><code><pre> Type: t,</pre></code><tr><td>57<td><code><pre> Anonymous: true,</pre></code><tr><td>58<td><code><pre> },</pre></code><tr><td>59<td><code><pre> {</pre></code><tr><td>60<td><code><pre> Name: "Checksum",</pre></code><tr><td>61<td><code><pre> Type: reflect.TypeOf(uint64(0)),</pre></code><tr><td>62<td><code><pre> },</pre></code><tr><td>63<td><code><pre> {</pre></code><tr><td>64<td><code><pre> Name: "Origin",</pre></code><tr><td>65<td><code><pre> Type: pt,</pre></code><tr><td>66<td><code><pre> },</pre></code><tr><td>67<td><code><pre> })</pre></code><tr class=miss><td>68<td><code><pre> cachedWrapperTypes.Store(t, cache)</pre></code><tr><td>69<td><code><pre> }</pre></code><tr><td>70<td><code><pre></pre></code><tr class=miss><td>71<td><code><pre> wrapperType := cache.(reflect.Type)</pre></code><tr class=miss><td>72<td><code><pre> pw := defaultAllocator.New(wrapperType)</pre></code><tr><td>73<td><code><pre></pre></code><tr class=miss><td>74<td><code><pre> wrapperPtr := unsafe.Pointer(pw.Pointer())</pre></code><tr class=miss><td>75<td><code><pre> wrapper := pw.Elem()</pre></code><tr><td>76<td><code><pre></pre></code><tr><td>77<td><code><pre> // Equivalent code: wrapper.T = Clone(v)</pre></code><tr class=miss><td>78<td><code><pre> field := wrapper.Field(0)</pre></code><tr class=miss><td>79<td><code><pre> field.Set(heapCloneState.clone(elem))</pre></code><tr><td>80<td><code><pre></pre></code><tr><td>81<td><code><pre> // Equivalent code: wrapper.Checksum = makeChecksum(v)</pre></code><tr class=miss><td>82<td><code><pre> checksumPtr := unsafe.Pointer(uintptr(wrapperPtr) + t.Size())</pre></code><tr class=miss><td>83<td><code><pre> *(*uint64)(checksumPtr) = makeChecksum(t, uintptr(wrapperPtr), uintptr(ptr))</pre></code><tr><td>84<td><code><pre></pre></code><tr><td>85<td><code><pre> // Equivalent code: wrapper.Origin = v</pre></code><tr class=miss><td>86<td><code><pre> originPtr := unsafe.Pointer(uintptr(wrapperPtr) + t.Size() + sizeOfChecksum)</pre></code><tr class=miss><td>87<td><code><pre> *(*uintptr)(originPtr) = uintptr(ptr)</pre></code><tr><td>88<td><code><pre></pre></code><tr class=miss><td>89<td><code><pre> return field.Addr().Interface()</pre></code><tr><td>90<td><code><pre>}</pre></code></table><div class=funcname id=fn_newAllocator>func newAllocator</div><div class=info><a href=#s_fn_newAllocator>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func newAllocator(pool unsafe.Pointer, methods *AllocatorMethods) (allocator *Allocator) {</pre></code><tr class=miss><td>53<td><code><pre> parent := methods.parent()</pre></code><tr class=miss><td>54<td><code><pre> new := methods.new(parent, pool)</pre></code><tr><td>55<td><code><pre></pre></code><tr><td>56<td><code><pre> // Allocate the allocator from the pool.</pre></code><tr class=miss><td>57<td><code><pre> val := new(pool, typeOfAllocator)</pre></code><tr class=miss><td>58<td><code><pre> allocator = (*Allocator)(unsafe.Pointer(val.Pointer()))</pre></code><tr class=miss><td>59<td><code><pre> runtime.KeepAlive(val)</pre></code><tr><td>60<td><code><pre></pre></code><tr class=miss><td>61<td><code><pre> allocator.pool = pool</pre></code><tr class=miss><td>62<td><code><pre> allocator.new = new</pre></code><tr class=miss><td>63<td><code><pre> allocator.makeSlice = methods.makeSlice(parent, pool)</pre></code><tr class=miss><td>64<td><code><pre> allocator.makeMap = methods.makeMap(parent, pool)</pre></code><tr class=miss><td>65<td><code><pre> allocator.makeChan = methods.makeChan(parent, pool)</pre></code><tr class=miss><td>66<td><code><pre> allocator.isScalar = methods.isScalar(parent)</pre></code><tr><td>67<td><code><pre></pre></code><tr class=miss><td>68<td><code><pre> if parent == nil {</pre></code><tr class=miss><td>69<td><code><pre> parent = defaultAllocator</pre></code><tr><td>70<td><code><pre> }</pre></code><tr><td>71<td><code><pre></pre></code><tr class=miss><td>72<td><code><pre> allocator.parent = parent</pre></code><tr class=miss><td>73<td><code><pre> return</pre></code><tr><td>74<td><code><pre>}</pre></code></table><div class=funcname id=fn_fixState.fixInterface>func fixState.fixInterface</div><div class=info><a href=#s_fn_fixState.fixInterface>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>562<td><code><pre>func (fix *fixState) fixInterface(v reflect.Value) (copied reflect.Value, changed int) {</pre></code><tr class=miss><td>563<td><code><pre> if v.IsNil() {</pre></code><tr class=miss><td>564<td><code><pre> return</pre></code><tr><td>565<td><code><pre> }</pre></code><tr><td>566<td><code><pre></pre></code><tr class=miss><td>567<td><code><pre> elem := v.Elem()</pre></code><tr class=miss><td>568<td><code><pre> t := elem.Type()</pre></code><tr class=miss><td>569<td><code><pre> kind := elem.Kind()</pre></code><tr><td>570<td><code><pre></pre></code><tr class=miss><td>571<td><code><pre> if kind == reflect.Ptr {</pre></code><tr class=miss><td>572<td><code><pre> vst := visit{</pre></code><tr><td>573<td><code><pre> p: elem.Pointer(),</pre></code><tr><td>574<td><code><pre> t: t,</pre></code><tr><td>575<td><code><pre> }</pre></code><tr><td>576<td><code><pre></pre></code><tr class=miss><td>577<td><code><pre> if nv, ok := fix.invalid[vst]; ok {</pre></code><tr class=miss><td>578<td><code><pre> copied = nv.Convert(v.Type())</pre></code><tr class=miss><td>579<td><code><pre> changed++</pre></code><tr class=miss><td>580<td><code><pre> return</pre></code><tr><td>581<td><code><pre> }</pre></code><tr><td>582<td><code><pre> }</pre></code><tr><td>583<td><code><pre></pre></code><tr class=miss><td>584<td><code><pre> copied, changed = fix.fix(elem)</pre></code><tr><td>585<td><code><pre></pre></code><tr class=miss><td>586<td><code><pre> if copied.IsValid() {</pre></code><tr class=miss><td>587<td><code><pre> copied = copied.Convert(v.Type())</pre></code><tr><td>588<td><code><pre> }</pre></code><tr><td>589<td><code><pre></pre></code><tr class=miss><td>590<td><code><pre> return</pre></code><tr><td>591<td><code><pre>}</pre></code></table><div class=funcname id=fn_fixState.fix>func fixState.fix</div><div class=info><a href=#s_fn_fixState.fix>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>477<td><code><pre>func (fix *fixState) fix(v reflect.Value) (copied reflect.Value, changed int) {</pre></code><tr class=miss><td>478<td><code><pre> if fix.allocator.isScalar(v.Kind()) {</pre></code><tr class=miss><td>479<td><code><pre> return</pre></code><tr><td>480<td><code><pre> }</pre></code><tr><td>481<td><code><pre></pre></code><tr class=miss><td>482<td><code><pre> switch v.Kind() {</pre></code><tr><td>483<td><code><pre> case reflect.Array:</pre></code><tr class=miss><td>484<td><code><pre> return fix.fixArray(v)</pre></code><tr><td>485<td><code><pre> case reflect.Chan:</pre></code><tr><td>486<td><code><pre> // Do nothing.</pre></code><tr class=miss><td>487<td><code><pre> return</pre></code><tr><td>488<td><code><pre> case reflect.Interface:</pre></code><tr class=miss><td>489<td><code><pre> return fix.fixInterface(v)</pre></code><tr><td>490<td><code><pre> case reflect.Map:</pre></code><tr class=miss><td>491<td><code><pre> return fix.fixMap(v)</pre></code><tr><td>492<td><code><pre> case reflect.Ptr:</pre></code><tr class=miss><td>493<td><code><pre> return fix.fixPtr(v)</pre></code><tr><td>494<td><code><pre> case reflect.Slice:</pre></code><tr class=miss><td>495<td><code><pre> return fix.fixSlice(v)</pre></code><tr><td>496<td><code><pre> case reflect.Struct:</pre></code><tr class=miss><td>497<td><code><pre> return fix.fixStruct(v)</pre></code><tr><td>498<td><code><pre> case reflect.String:</pre></code><tr><td>499<td><code><pre> // Do nothing.</pre></code><tr class=miss><td>500<td><code><pre> return</pre></code><tr><td>501<td><code><pre> default:</pre></code><tr class=miss><td>502<td><code><pre> panic(fmt.Errorf("go-clone: <bug> unsupported type `%v`", v.Type()))</pre></code><tr><td>503<td><code><pre> }</pre></code><tr><td>504<td><code><pre>}</pre></code></table><div class=funcname id=fn_fixState.fixPtr>func fixState.fixPtr</div><div class=info><a href=#s_fn_fixState.fixPtr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>704<td><code><pre>func (fix *fixState) fixPtr(v reflect.Value) (copied reflect.Value, changed int) {</pre></code><tr class=miss><td>705<td><code><pre> if v.IsNil() {</pre></code><tr class=miss><td>706<td><code><pre> return</pre></code><tr><td>707<td><code><pre> }</pre></code><tr><td>708<td><code><pre></pre></code><tr class=miss><td>709<td><code><pre> vst := visit{</pre></code><tr><td>710<td><code><pre> p: v.Pointer(),</pre></code><tr><td>711<td><code><pre> t: v.Type(),</pre></code><tr><td>712<td><code><pre> }</pre></code><tr><td>713<td><code><pre></pre></code><tr class=miss><td>714<td><code><pre> if _, ok := fix.invalid[vst]; ok {</pre></code><tr class=miss><td>715<td><code><pre> panic(fmt.Errorf("go-clone: <bug> invalid pointers must have been fixed in other methods"))</pre></code><tr><td>716<td><code><pre> }</pre></code><tr><td>717<td><code><pre></pre></code><tr class=miss><td>718<td><code><pre> if _, ok := fix.fixed[vst]; ok {</pre></code><tr class=miss><td>719<td><code><pre> return</pre></code><tr><td>720<td><code><pre> }</pre></code><tr><td>721<td><code><pre></pre></code><tr class=miss><td>722<td><code><pre> fix.fixed[vst] = struct{}{}</pre></code><tr><td>723<td><code><pre></pre></code><tr class=miss><td>724<td><code><pre> elem := v.Elem()</pre></code><tr class=miss><td>725<td><code><pre> _, changed = fix.fix(elem)</pre></code><tr class=miss><td>726<td><code><pre> return</pre></code><tr><td>727<td><code><pre>}</pre></code></table><div class=funcname id=fn_cloneState.cloneString>func cloneState.cloneString</div><div class=info><a href=#s_fn_cloneState.cloneString>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>275<td><code><pre>func (state *cloneState) cloneString(v reflect.Value) reflect.Value {</pre></code><tr class=miss><td>276<td><code><pre> t := v.Type()</pre></code><tr class=miss><td>277<td><code><pre> l := v.Len()</pre></code><tr class=miss><td>278<td><code><pre> data := state.allocator.MakeSlice(typeOfByteSlice, l, l)</pre></code><tr><td>279<td><code><pre></pre></code><tr><td>280<td><code><pre> // The v is an unexported struct field.</pre></code><tr class=miss><td>281<td><code><pre> if !v.CanInterface() {</pre></code><tr class=miss><td>282<td><code><pre> v = reflect.ValueOf(v.String())</pre></code><tr><td>283<td><code><pre> }</pre></code><tr><td>284<td><code><pre></pre></code><tr class=miss><td>285<td><code><pre> reflect.Copy(data, v)</pre></code><tr><td>286<td><code><pre></pre></code><tr class=miss><td>287<td><code><pre> nv := state.allocator.New(t)</pre></code><tr class=miss><td>288<td><code><pre> slice := data.Interface().([]byte)</pre></code><tr class=miss><td>289<td><code><pre> *(*stringHeader)(unsafe.Pointer(nv.Pointer())) = *(*stringHeader)(unsafe.Pointer(&slice))</pre></code><tr><td>290<td><code><pre></pre></code><tr class=miss><td>291<td><code><pre> return nv.Elem()</pre></code><tr><td>292<td><code><pre>}</pre></code></table><div class=funcname id=fn_forceSetMapIndex>func forceSetMapIndex</div><div class=info><a href=#s_fn_forceSetMapIndex>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>685<td><code><pre>func forceSetMapIndex(v, key, elem reflect.Value) (nv reflect.Value) {</pre></code><tr class=miss><td>686<td><code><pre> nv = v</pre></code><tr><td>687<td><code><pre></pre></code><tr class=miss><td>688<td><code><pre> if !v.CanInterface() {</pre></code><tr class=miss><td>689<td><code><pre> nv = forceClearROFlag(v)</pre></code><tr><td>690<td><code><pre> }</pre></code><tr><td>691<td><code><pre></pre></code><tr class=miss><td>692<td><code><pre> if !key.CanInterface() {</pre></code><tr class=miss><td>693<td><code><pre> key = forceClearROFlag(key)</pre></code><tr><td>694<td><code><pre> }</pre></code><tr><td>695<td><code><pre></pre></code><tr class=miss><td>696<td><code><pre> if elem.IsValid() && !elem.CanInterface() {</pre></code><tr class=miss><td>697<td><code><pre> elem = forceClearROFlag(elem)</pre></code><tr><td>698<td><code><pre> }</pre></code><tr><td>699<td><code><pre></pre></code><tr class=miss><td>700<td><code><pre> nv.SetMapIndex(key, elem)</pre></code><tr class=miss><td>701<td><code><pre> return</pre></code><tr><td>702<td><code><pre>}</pre></code></table><div class=funcname id=fn_undo>func undo</div><div class=info><a href=#s_fn_undo>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/wrapper.go</code>:</div><table class=listing><tr><td>140<td><code><pre>func undo(v interface{}) {</pre></code><tr class=miss><td>141<td><code><pre> if v == nil {</pre></code><tr class=miss><td>142<td><code><pre> return</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre></pre></code><tr class=miss><td>145<td><code><pre> val := reflect.ValueOf(v)</pre></code><tr><td>146<td><code><pre></pre></code><tr class=miss><td>147<td><code><pre> if !isWrapped(val) {</pre></code><tr class=miss><td>148<td><code><pre> return</pre></code><tr><td>149<td><code><pre> }</pre></code><tr><td>150<td><code><pre></pre></code><tr class=miss><td>151<td><code><pre> origVal := origin(val)</pre></code><tr class=miss><td>152<td><code><pre> elem := val.Elem()</pre></code><tr class=miss><td>153<td><code><pre> elem.Set(heapCloneState.clone(origVal.Elem()))</pre></code><tr><td>154<td><code><pre>}</pre></code></table><div class=funcname id=fn_AllocatorMethods.new>func AllocatorMethods.new</div><div class=info><a href=#s_fn_AllocatorMethods.new>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code>:</div><table class=listing><tr><td>33<td><code><pre>func (am *AllocatorMethods) new(parent *Allocator, pool unsafe.Pointer) func(pool unsafe.Pointer, t reflect.Type) reflect.Value {</pre></code><tr class=miss><td>34<td><code><pre> if am != nil && am.New != nil {</pre></code><tr class=miss><td>35<td><code><pre> return am.New</pre></code><tr><td>36<td><code><pre> }</pre></code><tr><td>37<td><code><pre></pre></code><tr class=miss><td>38<td><code><pre> if parent != nil {</pre></code><tr class=miss><td>39<td><code><pre> if parent.pool == pool {</pre></code><tr class=miss><td>40<td><code><pre> return parent.new</pre></code><tr><td>41<td><code><pre> } else {</pre></code><tr class=miss><td>42<td><code><pre> return func(pool unsafe.Pointer, t reflect.Type) reflect.Value {</pre></code><tr><td>43<td><code><pre> return parent.New(t)</pre></code><tr><td>44<td><code><pre> }</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre></pre></code><tr class=miss><td>48<td><code><pre> return defaultAllocator.new</pre></code><tr><td>49<td><code><pre>}</pre></code></table><div class=funcname id=fn_unwrap>func unwrap</div><div class=info><a href=#s_fn_unwrap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/wrapper.go</code>:</div><table class=listing><tr><td>114<td><code><pre>func unwrap(v interface{}) interface{} {</pre></code><tr class=miss><td>115<td><code><pre> if v == nil {</pre></code><tr class=miss><td>116<td><code><pre> return v</pre></code><tr><td>117<td><code><pre> }</pre></code><tr><td>118<td><code><pre></pre></code><tr class=miss><td>119<td><code><pre> val := reflect.ValueOf(v)</pre></code><tr><td>120<td><code><pre></pre></code><tr class=miss><td>121<td><code><pre> if !isWrapped(val) {</pre></code><tr class=miss><td>122<td><code><pre> return v</pre></code><tr><td>123<td><code><pre> }</pre></code><tr><td>124<td><code><pre></pre></code><tr class=miss><td>125<td><code><pre> origVal := origin(val)</pre></code><tr class=miss><td>126<td><code><pre> return origVal.Interface()</pre></code><tr><td>127<td><code><pre>}</pre></code></table><div class=funcname id=fn_AllocatorMethods.makeChan>func AllocatorMethods.makeChan</div><div class=info><a href=#s_fn_AllocatorMethods.makeChan>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code>:</div><table class=listing><tr><td>87<td><code><pre>func (am *AllocatorMethods) makeChan(parent *Allocator, pool unsafe.Pointer) func(pool unsafe.Pointer, t reflect.Type, buffer int) reflect.Value {</pre></code><tr class=miss><td>88<td><code><pre> if am != nil && am.MakeChan != nil {</pre></code><tr class=miss><td>89<td><code><pre> return am.MakeChan</pre></code><tr><td>90<td><code><pre> }</pre></code><tr><td>91<td><code><pre></pre></code><tr class=miss><td>92<td><code><pre> if parent != nil {</pre></code><tr class=miss><td>93<td><code><pre> if parent.pool == pool {</pre></code><tr class=miss><td>94<td><code><pre> return parent.makeChan</pre></code><tr><td>95<td><code><pre> } else {</pre></code><tr class=miss><td>96<td><code><pre> return func(pool unsafe.Pointer, t reflect.Type, buffer int) reflect.Value {</pre></code><tr><td>97<td><code><pre> return parent.MakeChan(t, buffer)</pre></code><tr><td>98<td><code><pre> }</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre></pre></code><tr class=miss><td>102<td><code><pre> return defaultAllocator.makeChan</pre></code><tr><td>103<td><code><pre>}</pre></code></table><div class=funcname id=fn_AllocatorMethods.makeSlice>func AllocatorMethods.makeSlice</div><div class=info><a href=#s_fn_AllocatorMethods.makeSlice>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code>:</div><table class=listing><tr><td>51<td><code><pre>func (am *AllocatorMethods) makeSlice(parent *Allocator, pool unsafe.Pointer) func(pool unsafe.Pointer, t reflect.Type, len, cap int) reflect.Value {</pre></code><tr class=miss><td>52<td><code><pre> if am != nil && am.MakeSlice != nil {</pre></code><tr class=miss><td>53<td><code><pre> return am.MakeSlice</pre></code><tr><td>54<td><code><pre> }</pre></code><tr><td>55<td><code><pre></pre></code><tr class=miss><td>56<td><code><pre> if parent != nil {</pre></code><tr class=miss><td>57<td><code><pre> if parent.pool == pool {</pre></code><tr class=miss><td>58<td><code><pre> return parent.makeSlice</pre></code><tr><td>59<td><code><pre> } else {</pre></code><tr class=miss><td>60<td><code><pre> return func(pool unsafe.Pointer, t reflect.Type, len, cap int) reflect.Value {</pre></code><tr><td>61<td><code><pre> return parent.MakeSlice(t, len, cap)</pre></code><tr><td>62<td><code><pre> }</pre></code><tr><td>63<td><code><pre> }</pre></code><tr><td>64<td><code><pre> }</pre></code><tr><td>65<td><code><pre></pre></code><tr class=miss><td>66<td><code><pre> return defaultAllocator.makeSlice</pre></code><tr><td>67<td><code><pre>}</pre></code></table><div class=funcname id=fn_AllocatorMethods.makeMap>func AllocatorMethods.makeMap</div><div class=info><a href=#s_fn_AllocatorMethods.makeMap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code>:</div><table class=listing><tr><td>69<td><code><pre>func (am *AllocatorMethods) makeMap(parent *Allocator, pool unsafe.Pointer) func(pool unsafe.Pointer, t reflect.Type, n int) reflect.Value {</pre></code><tr class=miss><td>70<td><code><pre> if am != nil && am.MakeMap != nil {</pre></code><tr class=miss><td>71<td><code><pre> return am.MakeMap</pre></code><tr><td>72<td><code><pre> }</pre></code><tr><td>73<td><code><pre></pre></code><tr class=miss><td>74<td><code><pre> if parent != nil {</pre></code><tr class=miss><td>75<td><code><pre> if parent.pool == pool {</pre></code><tr class=miss><td>76<td><code><pre> return parent.makeMap</pre></code><tr><td>77<td><code><pre> } else {</pre></code><tr class=miss><td>78<td><code><pre> return func(pool unsafe.Pointer, t reflect.Type, n int) reflect.Value {</pre></code><tr><td>79<td><code><pre> return parent.MakeMap(t, n)</pre></code><tr><td>80<td><code><pre> }</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre> }</pre></code><tr><td>83<td><code><pre></pre></code><tr class=miss><td>84<td><code><pre> return defaultAllocator.makeMap</pre></code><tr><td>85<td><code><pre>}</pre></code></table><div class=funcname id=fn_@90:48>func @90:48</div><div class=info><a href=#s_fn_@90:48>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/structtype.go</code>:</div><table class=listing><tr><td>90<td><code><pre>func(allocator *Allocator, old, new reflect.Value) {</pre></code><tr class=miss><td>91<td><code><pre> if !old.CanAddr() {</pre></code><tr class=miss><td>92<td><code><pre> return</pre></code><tr><td>93<td><code><pre> }</pre></code><tr><td>94<td><code><pre></pre></code><tr><td>95<td><code><pre> // Clone value inside atomic.Value.</pre></code><tr class=miss><td>96<td><code><pre> oldValue := old.Addr().Interface().(*atomic.Value)</pre></code><tr class=miss><td>97<td><code><pre> newValue := new.Addr().Interface().(*atomic.Value)</pre></code><tr class=miss><td>98<td><code><pre> v := oldValue.Load()</pre></code><tr class=miss><td>99<td><code><pre> cloned := clone(allocator, v)</pre></code><tr class=miss><td>100<td><code><pre> newValue.Store(cloned)</pre></code><tr><td>101<td><code><pre> }</pre></code></table><div class=funcname id=fn_Slice>func Slice</div><div class=info><a href=#s_fn_Slice>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/base.go</code>:</div><table class=listing><tr><td>83<td><code><pre>func Slice[T Clonable[T], TS ~[]T](s TS) (d TS) {</pre></code><tr class=miss><td>84<td><code><pre> if s == nil {</pre></code><tr class=miss><td>85<td><code><pre> return</pre></code><tr><td>86<td><code><pre> }</pre></code><tr class=miss><td>87<td><code><pre> d = make(TS, 0, len(s))</pre></code><tr class=miss><td>88<td><code><pre> for _, item := range s {</pre></code><tr class=miss><td>89<td><code><pre> d = append(d, item.Clone())</pre></code><tr><td>90<td><code><pre> }</pre></code><tr class=miss><td>91<td><code><pre> return</pre></code><tr><td>92<td><code><pre>}</pre></code></table><div class=funcname id=fn_origin>func origin</div><div class=info><a href=#s_fn_origin>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/wrapper.go</code>:</div><table class=listing><tr><td>129<td><code><pre>func origin(val reflect.Value) reflect.Value {</pre></code><tr class=miss><td>130<td><code><pre> pt := val.Type()</pre></code><tr class=miss><td>131<td><code><pre> t := pt.Elem()</pre></code><tr class=miss><td>132<td><code><pre> ptr := unsafe.Pointer(val.Pointer())</pre></code><tr class=miss><td>133<td><code><pre> orig := getOrigin(t, ptr)</pre></code><tr class=miss><td>134<td><code><pre> origVal := reflect.NewAt(t, orig)</pre></code><tr class=miss><td>135<td><code><pre> return origVal</pre></code><tr><td>136<td><code><pre>}</pre></code></table><div class=funcname id=fn_isWrapped>func isWrapped</div><div class=info><a href=#s_fn_isWrapped>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/wrapper.go</code>:</div><table class=listing><tr><td>156<td><code><pre>func isWrapped(val reflect.Value) bool {</pre></code><tr class=miss><td>157<td><code><pre> pt := val.Type()</pre></code><tr><td>158<td><code><pre></pre></code><tr class=miss><td>159<td><code><pre> if pt.Kind() != reflect.Ptr {</pre></code><tr class=miss><td>160<td><code><pre> return false</pre></code><tr><td>161<td><code><pre> }</pre></code><tr><td>162<td><code><pre></pre></code><tr class=miss><td>163<td><code><pre> t := pt.Elem()</pre></code><tr class=miss><td>164<td><code><pre> ptr := unsafe.Pointer(val.Pointer())</pre></code><tr class=miss><td>165<td><code><pre> return validateChecksum(t, ptr)</pre></code><tr><td>166<td><code><pre>}</pre></code></table><div class=funcname id=fn_Map>func Map</div><div class=info><a href=#s_fn_Map>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/base.go</code>:</div><table class=listing><tr><td>94<td><code><pre>func Map[T Clonable[T], K comparable](s map[K]T) (d map[K]T) {</pre></code><tr class=miss><td>95<td><code><pre> if s == nil {</pre></code><tr class=miss><td>96<td><code><pre> return</pre></code><tr><td>97<td><code><pre> }</pre></code><tr class=miss><td>98<td><code><pre> d = make(map[K]T, len(s))</pre></code><tr class=miss><td>99<td><code><pre> for k, v := range s {</pre></code><tr class=miss><td>100<td><code><pre> d[k] = v.Clone()</pre></code><tr><td>101<td><code><pre> }</pre></code><tr class=miss><td>102<td><code><pre> return</pre></code><tr><td>103<td><code><pre>}</pre></code></table><div class=funcname id=fn_AllocatorMethods.isScalar>func AllocatorMethods.isScalar</div><div class=info><a href=#s_fn_AllocatorMethods.isScalar>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code>:</div><table class=listing><tr><td>105<td><code><pre>func (am *AllocatorMethods) isScalar(parent *Allocator) func(t reflect.Kind) bool {</pre></code><tr class=miss><td>106<td><code><pre> if am != nil && am.IsScalar != nil {</pre></code><tr class=miss><td>107<td><code><pre> return am.IsScalar</pre></code><tr><td>108<td><code><pre> }</pre></code><tr><td>109<td><code><pre></pre></code><tr class=miss><td>110<td><code><pre> if parent != nil {</pre></code><tr class=miss><td>111<td><code><pre> return parent.isScalar</pre></code><tr><td>112<td><code><pre> }</pre></code><tr><td>113<td><code><pre></pre></code><tr class=miss><td>114<td><code><pre> return defaultAllocator.isScalar</pre></code><tr><td>115<td><code><pre>}</pre></code></table><div class=funcname id=fn_@75:44>func @75:44</div><div class=info><a href=#s_fn_@75:44>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/structtype.go</code>:</div><table class=listing><tr><td>75<td><code><pre>func(allocator *Allocator, old, new reflect.Value) {</pre></code><tr class=miss><td>76<td><code><pre> if !old.CanAddr() {</pre></code><tr class=miss><td>77<td><code><pre> return</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre></pre></code><tr><td>80<td><code><pre> // Clone all values inside sync.Map.</pre></code><tr class=miss><td>81<td><code><pre> oldMap := old.Addr().Interface().(*sync.Map)</pre></code><tr class=miss><td>82<td><code><pre> newMap := new.Addr().Interface().(*sync.Map)</pre></code><tr class=miss><td>83<td><code><pre> oldMap.Range(func(key, value interface{}) bool {</pre></code><tr><td>84<td><code><pre> k := clone(allocator, key)</pre></code><tr><td>85<td><code><pre> v := clone(allocator, value)</pre></code><tr><td>86<td><code><pre> newMap.Store(k, v)</pre></code><tr><td>87<td><code><pre> return true</pre></code><tr><td>88<td><code><pre> })</pre></code><tr><td>89<td><code><pre> }</pre></code></table><div class=funcname id=fn_SliceComparablePtr>func SliceComparablePtr</div><div class=info><a href=#s_fn_SliceComparablePtr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/base.go</code>:</div><table class=listing><tr><td>28<td><code><pre>func SliceComparablePtr[T comparable, TS ~[]*T](s TS) (d TS) {</pre></code><tr class=miss><td>29<td><code><pre> if s == nil {</pre></code><tr class=miss><td>30<td><code><pre> return</pre></code><tr><td>31<td><code><pre> }</pre></code><tr class=miss><td>32<td><code><pre> d = make(TS, len(s), cap(s))</pre></code><tr class=miss><td>33<td><code><pre> copy(d, s)</pre></code><tr class=miss><td>34<td><code><pre> return</pre></code><tr><td>35<td><code><pre>}</pre></code></table><div class=funcname id=fn_TimePtr>func TimePtr</div><div class=info><a href=#s_fn_TimePtr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/base.go</code>:</div><table class=listing><tr><td>37<td><code><pre>func TimePtr(s *time.Time) (d *time.Time) {</pre></code><tr class=miss><td>38<td><code><pre> if s == nil {</pre></code><tr class=miss><td>39<td><code><pre> return</pre></code><tr><td>40<td><code><pre> }</pre></code><tr class=miss><td>41<td><code><pre> d = new(time.Time)</pre></code><tr class=miss><td>42<td><code><pre> *d = time.Date(s.Year(), s.Month(), s.Day(), s.Hour(), s.Minute(), s.Second(), s.Nanosecond(),</pre></code><tr><td>43<td><code><pre> TimeLocationPtr(s.Location()))</pre></code><tr class=miss><td>44<td><code><pre> return</pre></code><tr><td>45<td><code><pre>}</pre></code></table><div class=funcname id=fn_ComparablePtr>func ComparablePtr</div><div class=info><a href=#s_fn_ComparablePtr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/base.go</code>:</div><table class=listing><tr><td>10<td><code><pre>func ComparablePtr[T comparable](s *T) (d *T) {</pre></code><tr class=miss><td>11<td><code><pre> if s == nil {</pre></code><tr class=miss><td>12<td><code><pre> return</pre></code><tr><td>13<td><code><pre> }</pre></code><tr class=miss><td>14<td><code><pre> d = new(T)</pre></code><tr class=miss><td>15<td><code><pre> *d = *s</pre></code><tr class=miss><td>16<td><code><pre> return</pre></code><tr><td>17<td><code><pre>}</pre></code></table><div class=funcname id=fn_validateChecksum>func validateChecksum</div><div class=info><a href=#s_fn_validateChecksum>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/wrapper.go</code>:</div><table class=listing><tr><td>92<td><code><pre>func validateChecksum(t reflect.Type, ptr unsafe.Pointer) bool {</pre></code><tr class=miss><td>93<td><code><pre> pw := uintptr(ptr)</pre></code><tr class=miss><td>94<td><code><pre> orig := uintptr(getOrigin(t, ptr))</pre></code><tr class=miss><td>95<td><code><pre> checksum := *(*uint64)(unsafe.Pointer(uintptr(ptr) + t.Size()))</pre></code><tr class=miss><td>96<td><code><pre> expected := makeChecksum(t, pw, orig)</pre></code><tr><td>97<td><code><pre></pre></code><tr class=miss><td>98<td><code><pre> return checksum == expected</pre></code><tr><td>99<td><code><pre>}</pre></code></table><div class=funcname id=fn_DecimalPtr>func DecimalPtr</div><div class=info><a href=#s_fn_DecimalPtr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/base.go</code>:</div><table class=listing><tr><td>55<td><code><pre>func DecimalPtr(s *decimal.Decimal) (d *decimal.Decimal) {</pre></code><tr class=miss><td>56<td><code><pre> if s == nil {</pre></code><tr class=miss><td>57<td><code><pre> return</pre></code><tr><td>58<td><code><pre> }</pre></code><tr class=miss><td>59<td><code><pre> d = new(decimal.Decimal)</pre></code><tr class=miss><td>60<td><code><pre> *d = s.Copy()</pre></code><tr class=miss><td>61<td><code><pre> return</pre></code><tr><td>62<td><code><pre>}</pre></code></table><div class=funcname id=fn_makeChecksum>func makeChecksum</div><div class=info><a href=#s_fn_makeChecksum>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/wrapper.go</code>:</div><table class=listing><tr><td>101<td><code><pre>func makeChecksum(t reflect.Type, pw uintptr, orig uintptr) uint64 {</pre></code><tr class=miss><td>102<td><code><pre> var data [binary.MaxVarintLen64 * 2]byte</pre></code><tr class=miss><td>103<td><code><pre> binary.PutUvarint(data[:binary.MaxVarintLen64], uint64(pw))</pre></code><tr class=miss><td>104<td><code><pre> binary.PutUvarint(data[binary.MaxVarintLen64:], uint64(orig))</pre></code><tr class=miss><td>105<td><code><pre> return crc64.Checksum(data[:], crc64Table)</pre></code><tr><td>106<td><code><pre>}</pre></code></table><div class=funcname id=fn_@83:16>func @83:16</div><div class=info><a href=#s_fn_@83:16>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/structtype.go</code>:</div><table class=listing><tr><td>83<td><code><pre>func(key, value interface{}) bool {</pre></code><tr class=miss><td>84<td><code><pre> k := clone(allocator, key)</pre></code><tr class=miss><td>85<td><code><pre> v := clone(allocator, value)</pre></code><tr class=miss><td>86<td><code><pre> newMap.Store(k, v)</pre></code><tr class=miss><td>87<td><code><pre> return true</pre></code><tr><td>88<td><code><pre> }</pre></code></table><div class=funcname id=fn_TimeLocationPtr>func TimeLocationPtr</div><div class=info><a href=#s_fn_TimeLocationPtr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/base.go</code>:</div><table class=listing><tr><td>47<td><code><pre>func TimeLocationPtr(s *time.Location) (d *time.Location) {</pre></code><tr class=miss><td>48<td><code><pre> if s == nil {</pre></code><tr class=miss><td>49<td><code><pre> return</pre></code><tr><td>50<td><code><pre> }</pre></code><tr class=miss><td>51<td><code><pre> d, _ = time.LoadLocation(s.String())</pre></code><tr class=miss><td>52<td><code><pre> return</pre></code><tr><td>53<td><code><pre>}</pre></code></table><div class=funcname id=fn_AllocatorMethods.parent>func AllocatorMethods.parent</div><div class=info><a href=#s_fn_AllocatorMethods.parent>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func (am *AllocatorMethods) parent() *Allocator {</pre></code><tr class=miss><td>26<td><code><pre> if am != nil && am.Parent != nil {</pre></code><tr class=miss><td>27<td><code><pre> return am.Parent</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre></pre></code><tr class=miss><td>30<td><code><pre> return nil</pre></code><tr><td>31<td><code><pre>}</pre></code></table><div class=funcname id=fn_@63:45>func @63:45</div><div class=info><a href=#s_fn_@63:45>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/structtype.go</code>:</div><table class=listing><tr><td>63<td><code><pre>func(allocator *Allocator, old, new reflect.Value) {</pre></code><tr><td>64<td><code><pre> // Copy the New func from old value.</pre></code><tr class=miss><td>65<td><code><pre> oldL := old.FieldByName("L")</pre></code><tr class=miss><td>66<td><code><pre> newL := allocator.Clone(oldL)</pre></code><tr class=miss><td>67<td><code><pre> new.FieldByName("L").Set(newL)</pre></code><tr><td>68<td><code><pre> }</pre></code></table><div class=funcname id=fn_@69:45>func @69:45</div><div class=info><a href=#s_fn_@69:45>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/structtype.go</code>:</div><table class=listing><tr><td>69<td><code><pre>func(allocator *Allocator, old, new reflect.Value) {</pre></code><tr><td>70<td><code><pre> // Copy the New func from old value.</pre></code><tr class=miss><td>71<td><code><pre> oldFn := old.FieldByName("New")</pre></code><tr class=miss><td>72<td><code><pre> newFn := allocator.Clone(oldFn)</pre></code><tr class=miss><td>73<td><code><pre> new.FieldByName("New").Set(newFn)</pre></code><tr><td>74<td><code><pre> }</pre></code></table><div class=funcname id=fn_GormModelPtr>func GormModelPtr</div><div class=info><a href=#s_fn_GormModelPtr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/base.go</code>:</div><table class=listing><tr><td>64<td><code><pre>func GormModelPtr(s *gorm.Model) (d *gorm.Model) {</pre></code><tr class=miss><td>65<td><code><pre> if s == nil {</pre></code><tr class=miss><td>66<td><code><pre> return</pre></code><tr><td>67<td><code><pre> }</pre></code><tr class=miss><td>68<td><code><pre> return &gorm.Model{</pre></code><tr><td>69<td><code><pre> ID: s.ID,</pre></code><tr><td>70<td><code><pre> CreatedAt: *TimePtr(&s.CreatedAt),</pre></code><tr><td>71<td><code><pre> UpdatedAt: *TimePtr(&s.UpdatedAt),</pre></code><tr><td>72<td><code><pre> DeletedAt: gorm.DeletedAt{</pre></code><tr><td>73<td><code><pre> Time: *TimePtr(&s.DeletedAt.Time),</pre></code><tr><td>74<td><code><pre> Valid: s.DeletedAt.Valid,</pre></code><tr><td>75<td><code><pre> },</pre></code><tr><td>76<td><code><pre> }</pre></code><tr><td>77<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewAllocator>func NewAllocator</div><div class=info><a href=#s_fn_NewAllocator>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code>:</div><table class=listing><tr><td>113<td><code><pre>func NewAllocator(pool unsafe.Pointer, methods *AllocatorMethods) (allocator *Allocator) {</pre></code><tr class=miss><td>114<td><code><pre> return newAllocator(pool, methods)</pre></code><tr><td>115<td><code><pre>}</pre></code></table><div class=funcname id=fn_fixState.new>func fixState.new</div><div class=info><a href=#s_fn_fixState.new>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/clone.go</code>:</div><table class=listing><tr><td>473<td><code><pre>func (fix *fixState) new(t reflect.Type) reflect.Value {</pre></code><tr class=miss><td>474<td><code><pre> return fix.allocator.New(t)</pre></code><tr><td>475<td><code><pre>}</pre></code></table><div class=funcname id=fn_FromHeap>func FromHeap</div><div class=info><a href=#s_fn_FromHeap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code>:</div><table class=listing><tr><td>102<td><code><pre>func FromHeap() *Allocator {</pre></code><tr class=miss><td>103<td><code><pre> return fromHeap()</pre></code><tr><td>104<td><code><pre>}</pre></code></table><div class=funcname id=fn_Undo>func Undo</div><div class=info><a href=#s_fn_Undo>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code>:</div><table class=listing><tr><td>64<td><code><pre>func Undo[T any](t T) {</pre></code><tr class=miss><td>65<td><code><pre> undo(t)</pre></code><tr><td>66<td><code><pre>}</pre></code></table><div class=funcname id=fn_Unwrap>func Unwrap</div><div class=info><a href=#s_fn_Unwrap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code>:</div><table class=listing><tr><td>58<td><code><pre>func Unwrap[T any](t T) T {</pre></code><tr class=miss><td>59<td><code><pre> return unwrap(t).(T)</pre></code><tr><td>60<td><code><pre>}</pre></code></table><div class=funcname id=fn_Wrap>func Wrap</div><div class=info><a href=#s_fn_Wrap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/api_go118.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func Wrap[T any](t T) T {</pre></code><tr class=miss><td>53<td><code><pre> return wrap(t).(T)</pre></code><tr><td>54<td><code><pre>}</pre></code></table><div class=funcname id=fn_@96:11>func @96:11</div><div class=info><a href=#s_fn_@96:11>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code>:</div><table class=listing><tr><td>96<td><code><pre>func(pool unsafe.Pointer, t reflect.Type, buffer int) reflect.Value {</pre></code><tr class=miss><td>97<td><code><pre> return parent.MakeChan(t, buffer)</pre></code><tr><td>98<td><code><pre> }</pre></code></table><div class=funcname id=fn_@78:11>func @78:11</div><div class=info><a href=#s_fn_@78:11>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code>:</div><table class=listing><tr><td>78<td><code><pre>func(pool unsafe.Pointer, t reflect.Type, n int) reflect.Value {</pre></code><tr class=miss><td>79<td><code><pre> return parent.MakeMap(t, n)</pre></code><tr><td>80<td><code><pre> }</pre></code></table><div class=funcname id=fn_@60:11>func @60:11</div><div class=info><a href=#s_fn_@60:11>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code>:</div><table class=listing><tr><td>60<td><code><pre>func(pool unsafe.Pointer, t reflect.Type, len, cap int) reflect.Value {</pre></code><tr class=miss><td>61<td><code><pre> return parent.MakeSlice(t, len, cap)</pre></code><tr><td>62<td><code><pre> }</pre></code></table><div class=funcname id=fn_@42:11>func @42:11</div><div class=info><a href=#s_fn_@42:11>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocatormethods.go</code>:</div><table class=listing><tr><td>42<td><code><pre>func(pool unsafe.Pointer, t reflect.Type) reflect.Value {</pre></code><tr class=miss><td>43<td><code><pre> return parent.New(t)</pre></code><tr><td>44<td><code><pre> }</pre></code></table><div class=funcname id=fn_heapMakeChan>func heapMakeChan</div><div class=info><a href=#s_fn_heapMakeChan>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>310<td><code><pre>func heapMakeChan(pool unsafe.Pointer, t reflect.Type, buffer int) reflect.Value {</pre></code><tr class=miss><td>311<td><code><pre> return reflect.MakeChan(t, buffer)</pre></code><tr><td>312<td><code><pre>}</pre></code></table><div class=funcname id=fn_Allocator.CloneSlowly>func Allocator.CloneSlowly</div><div class=info><a href=#s_fn_Allocator.CloneSlowly>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>119<td><code><pre>func (a *Allocator) CloneSlowly(val reflect.Value) reflect.Value {</pre></code><tr class=miss><td>120<td><code><pre> return a.cloneSlowly(val, true)</pre></code><tr><td>121<td><code><pre>}</pre></code></table><div class=funcname id=fn_getOrigin>func getOrigin</div><div class=info><a href=#s_fn_getOrigin>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/wrapper.go</code>:</div><table class=listing><tr><td>108<td><code><pre>func getOrigin(t reflect.Type, ptr unsafe.Pointer) unsafe.Pointer {</pre></code><tr class=miss><td>109<td><code><pre> return *(*unsafe.Pointer)(unsafe.Pointer(uintptr(ptr) + t.Size() + sizeOfChecksum))</pre></code><tr><td>110<td><code><pre>}</pre></code></table><div class=funcname id=fn_Allocator.Clone>func Allocator.Clone</div><div class=info><a href=#s_fn_Allocator.Clone>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>97<td><code><pre>func (a *Allocator) Clone(val reflect.Value) reflect.Value {</pre></code><tr class=miss><td>98<td><code><pre> return a.clone(val, true)</pre></code><tr><td>99<td><code><pre>}</pre></code></table><div class=funcname id=fn_Allocator.MakeChan>func Allocator.MakeChan</div><div class=info><a href=#s_fn_Allocator.MakeChan>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>92<td><code><pre>func (a *Allocator) MakeChan(t reflect.Type, buffer int) reflect.Value {</pre></code><tr class=miss><td>93<td><code><pre> return a.makeChan(a.pool, t, buffer)</pre></code><tr><td>94<td><code><pre>}</pre></code></table><div class=funcname id=fn_fromHeap>func fromHeap</div><div class=info><a href=#s_fn_fromHeap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/allocator.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func fromHeap() *Allocator {</pre></code><tr class=miss><td>42<td><code><pre> return newAllocator(nil, nil)</pre></code><tr><td>43<td><code><pre>}</pre></code></table><div class=funcname id=fn_emptyCloneFunc>func emptyCloneFunc</div><div class=info><a href=#s_fn_emptyCloneFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/clone/structtype.go</code>:</div><table class=listing><tr><td>138<td><code><pre>func emptyCloneFunc(allocator *Allocator, old, new reflect.Value) {}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/common/utils/cmp class=funcname>Package Overview: github.com/wfusion/gofusion/common/utils/cmp 15 <span class=packageTotal>23.1%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_MapAny><td><code><a href=#fn_MapAny>MapAny(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cmp/base.go</code><td class=percent><code>77.8%</code><td class=linecount><code>7/9</code><tr id=s_fn_SliceComparable><td><code><a href=#fn_SliceComparable>SliceComparable(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cmp/base.go</code><td class=percent><code>62.5%</code><td class=linecount><code>5/8</code><tr id=s_fn_ComparablePtr><td><code><a href=#fn_ComparablePtr>ComparablePtr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cmp/base.go</code><td class=percent><code>60.0%</code><td class=linecount><code>3/5</code><tr id=s_fn_SliceAny><td><code><a href=#fn_SliceAny>SliceAny(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cmp/base.go</code><td class=percent><code>54.5%</code><td class=linecount><code>6/11</code><tr id=s_fn_anything><td><code><a href=#fn_anything>anything(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cmp/base.go</code><td class=percent><code>22.5%</code><td class=linecount><code>9/40</code><tr id=s_fn_deref><td><code><a href=#fn_deref>deref(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cmp/base.go</code><td class=percent><code>13.6%</code><td class=linecount><code>3/22</code><tr id=s_fn_Slice><td><code><a href=#fn_Slice>Slice(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cmp/base.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/11</code><tr id=s_fn_Map><td><code><a href=#fn_Map>Map(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cmp/base.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/9</code><tr id=s_fn_SliceComparablePtr><td><code><a href=#fn_SliceComparablePtr>SliceComparablePtr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cmp/base.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/8</code><tr id=s_fn_DecimalPtr><td><code><a href=#fn_DecimalPtr>DecimalPtr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cmp/base.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_TimeLocationPtr><td><code><a href=#fn_TimeLocationPtr>TimeLocationPtr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cmp/base.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_TimePtr><td><code><a href=#fn_TimePtr>TimePtr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cmp/base.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_GormModelPtr><td><code><a href=#fn_GormModelPtr>GormModelPtr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/cmp/base.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code></table><div class=funcname id=fn_MapAny>func MapAny</div><div class=info><a href=#s_fn_MapAny>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cmp/base.go</code>:</div><table class=listing><tr><td>165<td><code><pre>func MapAny[K comparable, T any](a, b map[K]T) bool {</pre></code><tr><td>166<td><code><pre> if a == nil && b == nil {</pre></code><tr class=miss><td>167<td><code><pre> return true</pre></code><tr><td>168<td><code><pre> }</pre></code><tr><td>169<td><code><pre> if a == nil || b == nil || len(a) != len(b) {</pre></code><tr class=miss><td>170<td><code><pre> return false</pre></code><tr><td>171<td><code><pre> }</pre></code><tr><td>172<td><code><pre></pre></code><tr><td>173<td><code><pre> for ak, av := range a {</pre></code><tr><td>174<td><code><pre> bv, ok := b[ak]</pre></code><tr><td>175<td><code><pre> if !ok || !anything(av, bv) {</pre></code><tr><td>176<td><code><pre> return false</pre></code><tr><td>177<td><code><pre> }</pre></code><tr><td>178<td><code><pre></pre></code><tr><td>179<td><code><pre> }</pre></code><tr><td>180<td><code><pre> return true</pre></code><tr><td>181<td><code><pre>}</pre></code></table><div class=funcname id=fn_SliceComparable>func SliceComparable</div><div class=info><a href=#s_fn_SliceComparable>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cmp/base.go</code>:</div><table class=listing><tr><td>24<td><code><pre>func SliceComparable[T comparable, TS ~[]T](a, b TS) bool {</pre></code><tr><td>25<td><code><pre> if a == nil && b == nil {</pre></code><tr class=miss><td>26<td><code><pre> return true</pre></code><tr><td>27<td><code><pre> }</pre></code><tr><td>28<td><code><pre> if a == nil || b == nil || len(a) != len(b) {</pre></code><tr class=miss><td>29<td><code><pre> return false</pre></code><tr><td>30<td><code><pre> }</pre></code><tr><td>31<td><code><pre> for i := 0; i < len(a); i++ {</pre></code><tr><td>32<td><code><pre> if a[i] != b[i] {</pre></code><tr class=miss><td>33<td><code><pre> return false</pre></code><tr><td>34<td><code><pre> }</pre></code><tr><td>35<td><code><pre> }</pre></code><tr><td>36<td><code><pre> return true</pre></code><tr><td>37<td><code><pre>}</pre></code></table><div class=funcname id=fn_ComparablePtr>func ComparablePtr</div><div class=info><a href=#s_fn_ComparablePtr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cmp/base.go</code>:</div><table class=listing><tr><td>14<td><code><pre>func ComparablePtr[T comparable](a, b *T) bool {</pre></code><tr><td>15<td><code><pre> if a == nil && b == nil {</pre></code><tr class=miss><td>16<td><code><pre> return true</pre></code><tr><td>17<td><code><pre> }</pre></code><tr><td>18<td><code><pre> if a == nil || b == nil {</pre></code><tr class=miss><td>19<td><code><pre> return false</pre></code><tr><td>20<td><code><pre> }</pre></code><tr><td>21<td><code><pre></pre></code><tr><td>22<td><code><pre> return *a == *b</pre></code><tr><td>23<td><code><pre>}</pre></code></table><div class=funcname id=fn_SliceAny>func SliceAny</div><div class=info><a href=#s_fn_SliceAny>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cmp/base.go</code>:</div><table class=listing><tr><td>126<td><code><pre>func SliceAny[T any, TS ~[]T](a, b TS, sortFn func(i, j T) bool) bool {</pre></code><tr><td>127<td><code><pre> if a == nil && b == nil {</pre></code><tr class=miss><td>128<td><code><pre> return true</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre> if a == nil || b == nil || len(a) != len(b) {</pre></code><tr class=miss><td>131<td><code><pre> return false</pre></code><tr><td>132<td><code><pre> }</pre></code><tr><td>133<td><code><pre></pre></code><tr><td>134<td><code><pre> if sortFn != nil {</pre></code><tr class=miss><td>135<td><code><pre> utils.SortStable(a, sortFn)</pre></code><tr class=miss><td>136<td><code><pre> utils.SortStable(b, sortFn)</pre></code><tr><td>137<td><code><pre> }</pre></code><tr><td>138<td><code><pre></pre></code><tr><td>139<td><code><pre> for i := 0; i < len(a); i++ {</pre></code><tr><td>140<td><code><pre> if !anything(a[i], b[i]) {</pre></code><tr class=miss><td>141<td><code><pre> return false</pre></code><tr><td>142<td><code><pre> }</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre> return true</pre></code><tr><td>145<td><code><pre>}</pre></code></table><div class=funcname id=fn_anything>func anything</div><div class=info><a href=#s_fn_anything>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cmp/base.go</code>:</div><table class=listing><tr><td>183<td><code><pre>func anything(a, b any) bool {</pre></code><tr><td>184<td><code><pre> switch av := a.(type) {</pre></code><tr><td>185<td><code><pre> case</pre></code><tr><td>186<td><code><pre> bool,</pre></code><tr><td>187<td><code><pre> string, uintptr,</pre></code><tr><td>188<td><code><pre> int, int8, int16, int32, int64,</pre></code><tr><td>189<td><code><pre> uint, uint8, uint16, uint32, uint64,</pre></code><tr><td>190<td><code><pre> float32, float64,</pre></code><tr><td>191<td><code><pre> complex64, complex128:</pre></code><tr><td>192<td><code><pre> return a == b</pre></code><tr><td>193<td><code><pre> case</pre></code><tr><td>194<td><code><pre> *bool,</pre></code><tr><td>195<td><code><pre> *string, *uintptr,</pre></code><tr><td>196<td><code><pre> *int, *int8, *int16, *int32, *int64,</pre></code><tr><td>197<td><code><pre> *uint, *uint8, *uint16, *uint32, *uint64,</pre></code><tr><td>198<td><code><pre> *float32, *float64,</pre></code><tr><td>199<td><code><pre> *complex64, *complex128:</pre></code><tr><td>200<td><code><pre> if a == nil && b == nil {</pre></code><tr class=miss><td>201<td><code><pre> return true</pre></code><tr><td>202<td><code><pre> }</pre></code><tr><td>203<td><code><pre> if a == nil || b == nil {</pre></code><tr class=miss><td>204<td><code><pre> return false</pre></code><tr><td>205<td><code><pre> }</pre></code><tr><td>206<td><code><pre> return anything(deref(a), deref(b))</pre></code><tr><td>207<td><code><pre> case decimal.Decimal:</pre></code><tr class=miss><td>208<td><code><pre> bv := b.(decimal.Decimal)</pre></code><tr class=miss><td>209<td><code><pre> return DecimalPtr(&av, &bv)</pre></code><tr><td>210<td><code><pre> case *decimal.Decimal:</pre></code><tr class=miss><td>211<td><code><pre> bv := b.(*decimal.Decimal)</pre></code><tr class=miss><td>212<td><code><pre> return DecimalPtr(av, bv)</pre></code><tr><td>213<td><code><pre> case time.Time:</pre></code><tr class=miss><td>214<td><code><pre> bv := b.(time.Time)</pre></code><tr class=miss><td>215<td><code><pre> return TimePtr(&av, &bv)</pre></code><tr><td>216<td><code><pre> case *time.Time:</pre></code><tr class=miss><td>217<td><code><pre> bv := b.(*time.Time)</pre></code><tr class=miss><td>218<td><code><pre> return TimePtr(av, bv)</pre></code><tr><td>219<td><code><pre> case time.Location:</pre></code><tr class=miss><td>220<td><code><pre> bv := b.(time.Location)</pre></code><tr class=miss><td>221<td><code><pre> return TimeLocationPtr(&av, &bv)</pre></code><tr><td>222<td><code><pre> case *time.Location:</pre></code><tr class=miss><td>223<td><code><pre> bv := b.(*time.Location)</pre></code><tr class=miss><td>224<td><code><pre> return TimeLocationPtr(av, bv)</pre></code><tr><td>225<td><code><pre> case []bool:</pre></code><tr class=miss><td>226<td><code><pre> return SliceComparable(a.([]bool), b.([]bool))</pre></code><tr><td>227<td><code><pre> case []string:</pre></code><tr class=miss><td>228<td><code><pre> return SliceComparable(a.([]string), b.([]string))</pre></code><tr><td>229<td><code><pre> case []uintptr:</pre></code><tr class=miss><td>230<td><code><pre> return SliceComparable(a.([]uintptr), b.([]uintptr))</pre></code><tr><td>231<td><code><pre> case []int:</pre></code><tr><td>232<td><code><pre> return SliceComparable(a.([]int), b.([]int))</pre></code><tr><td>233<td><code><pre> case []int8:</pre></code><tr class=miss><td>234<td><code><pre> return SliceComparable(a.([]int8), b.([]int8))</pre></code><tr><td>235<td><code><pre> case []int16:</pre></code><tr class=miss><td>236<td><code><pre> return SliceComparable(a.([]int16), b.([]int16))</pre></code><tr><td>237<td><code><pre> case []int32:</pre></code><tr class=miss><td>238<td><code><pre> return SliceComparable(a.([]int32), b.([]int32))</pre></code><tr><td>239<td><code><pre> case []int64:</pre></code><tr class=miss><td>240<td><code><pre> return SliceComparable(a.([]int64), b.([]int64))</pre></code><tr><td>241<td><code><pre> case []uint:</pre></code><tr class=miss><td>242<td><code><pre> return SliceComparable(a.([]uint), b.([]uint))</pre></code><tr><td>243<td><code><pre> case []uint8:</pre></code><tr><td>244<td><code><pre> return SliceComparable(a.([]uint8), b.([]uint8))</pre></code><tr><td>245<td><code><pre> case []uint16:</pre></code><tr class=miss><td>246<td><code><pre> return SliceComparable(a.([]uint16), b.([]uint16))</pre></code><tr><td>247<td><code><pre> case []uint32:</pre></code><tr class=miss><td>248<td><code><pre> return SliceComparable(a.([]uint32), b.([]uint32))</pre></code><tr><td>249<td><code><pre> case []uint64:</pre></code><tr class=miss><td>250<td><code><pre> return SliceComparable(a.([]uint64), b.([]uint64))</pre></code><tr><td>251<td><code><pre> case []float32:</pre></code><tr class=miss><td>252<td><code><pre> return SliceComparable(a.([]float32), b.([]float32))</pre></code><tr><td>253<td><code><pre> case []float64:</pre></code><tr class=miss><td>254<td><code><pre> return SliceComparable(a.([]float64), b.([]float64))</pre></code><tr><td>255<td><code><pre> case []complex64:</pre></code><tr class=miss><td>256<td><code><pre> return SliceComparable(a.([]complex64), b.([]complex64))</pre></code><tr><td>257<td><code><pre> case []complex128:</pre></code><tr class=miss><td>258<td><code><pre> return SliceComparable(a.([]complex128), b.([]complex128))</pre></code><tr><td>259<td><code><pre> case []any:</pre></code><tr><td>260<td><code><pre> return SliceAny(a.([]any), b.([]any), nil)</pre></code><tr><td>261<td><code><pre> case []map[string]any:</pre></code><tr class=miss><td>262<td><code><pre> return SliceAny(a.([]map[string]any), b.([]map[string]any), nil)</pre></code><tr><td>263<td><code><pre> case map[string]any:</pre></code><tr><td>264<td><code><pre> return MapAny(av, b.(map[string]any))</pre></code><tr><td>265<td><code><pre> default:</pre></code><tr class=miss><td>266<td><code><pre> return reflect.DeepEqual(a, b)</pre></code><tr><td>267<td><code><pre> }</pre></code><tr><td>268<td><code><pre>}</pre></code></table><div class=funcname id=fn_deref>func deref</div><div class=info><a href=#s_fn_deref>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cmp/base.go</code>:</div><table class=listing><tr><td>270<td><code><pre>func deref(p any) (v any) {</pre></code><tr><td>271<td><code><pre> switch pp := p.(type) {</pre></code><tr><td>272<td><code><pre> case *bool:</pre></code><tr class=miss><td>273<td><code><pre> v = *pp</pre></code><tr><td>274<td><code><pre> case *string:</pre></code><tr><td>275<td><code><pre> v = *pp</pre></code><tr><td>276<td><code><pre> case *int:</pre></code><tr class=miss><td>277<td><code><pre> v = *pp</pre></code><tr><td>278<td><code><pre> case *int8:</pre></code><tr class=miss><td>279<td><code><pre> v = *pp</pre></code><tr><td>280<td><code><pre> case *int16:</pre></code><tr class=miss><td>281<td><code><pre> v = *pp</pre></code><tr><td>282<td><code><pre> case *int32:</pre></code><tr class=miss><td>283<td><code><pre> v = *pp</pre></code><tr><td>284<td><code><pre> case *int64:</pre></code><tr class=miss><td>285<td><code><pre> v = *pp</pre></code><tr><td>286<td><code><pre> case *uint:</pre></code><tr class=miss><td>287<td><code><pre> v = *pp</pre></code><tr><td>288<td><code><pre> case *uint8:</pre></code><tr class=miss><td>289<td><code><pre> v = *pp</pre></code><tr><td>290<td><code><pre> case *uint16:</pre></code><tr class=miss><td>291<td><code><pre> v = *pp</pre></code><tr><td>292<td><code><pre> case *uint32:</pre></code><tr class=miss><td>293<td><code><pre> v = *pp</pre></code><tr><td>294<td><code><pre> case *uint64:</pre></code><tr class=miss><td>295<td><code><pre> v = *pp</pre></code><tr><td>296<td><code><pre> case *float32:</pre></code><tr class=miss><td>297<td><code><pre> v = *pp</pre></code><tr><td>298<td><code><pre> case *float64:</pre></code><tr class=miss><td>299<td><code><pre> v = *pp</pre></code><tr><td>300<td><code><pre> case *complex64:</pre></code><tr class=miss><td>301<td><code><pre> v = *pp</pre></code><tr><td>302<td><code><pre> case *complex128:</pre></code><tr class=miss><td>303<td><code><pre> v = *pp</pre></code><tr><td>304<td><code><pre> case *uintptr:</pre></code><tr class=miss><td>305<td><code><pre> v = *pp</pre></code><tr><td>306<td><code><pre> case *[]byte:</pre></code><tr class=miss><td>307<td><code><pre> v = *pp</pre></code><tr><td>308<td><code><pre> case *any:</pre></code><tr class=miss><td>309<td><code><pre> v = *pp</pre></code><tr><td>310<td><code><pre> default:</pre></code><tr class=miss><td>311<td><code><pre> panic(fmt.Errorf("unsupported type %T", pp))</pre></code><tr><td>312<td><code><pre> }</pre></code><tr><td>313<td><code><pre> return</pre></code><tr><td>314<td><code><pre>}</pre></code></table><div class=funcname id=fn_Slice>func Slice</div><div class=info><a href=#s_fn_Slice>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cmp/base.go</code>:</div><table class=listing><tr><td>105<td><code><pre>func Slice[T _comparable[T], TS ~[]T](a, b TS, sortFn func(i, j T) bool) bool {</pre></code><tr class=miss><td>106<td><code><pre> if a == nil && b == nil {</pre></code><tr class=miss><td>107<td><code><pre> return true</pre></code><tr><td>108<td><code><pre> }</pre></code><tr class=miss><td>109<td><code><pre> if a == nil || b == nil || len(a) != len(b) {</pre></code><tr class=miss><td>110<td><code><pre> return false</pre></code><tr><td>111<td><code><pre> }</pre></code><tr><td>112<td><code><pre></pre></code><tr class=miss><td>113<td><code><pre> if sortFn != nil {</pre></code><tr class=miss><td>114<td><code><pre> utils.SortStable(a, sortFn)</pre></code><tr class=miss><td>115<td><code><pre> utils.SortStable(b, sortFn)</pre></code><tr><td>116<td><code><pre> }</pre></code><tr><td>117<td><code><pre></pre></code><tr class=miss><td>118<td><code><pre> for i := 0; i < len(a); i++ {</pre></code><tr class=miss><td>119<td><code><pre> if !a[i].Equals(b[i]) {</pre></code><tr class=miss><td>120<td><code><pre> return false</pre></code><tr><td>121<td><code><pre> }</pre></code><tr><td>122<td><code><pre> }</pre></code><tr class=miss><td>123<td><code><pre> return true</pre></code><tr><td>124<td><code><pre>}</pre></code></table><div class=funcname id=fn_Map>func Map</div><div class=info><a href=#s_fn_Map>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cmp/base.go</code>:</div><table class=listing><tr><td>147<td><code><pre>func Map[T _comparable[T], K comparable](a, b map[K]T) bool {</pre></code><tr class=miss><td>148<td><code><pre> if a == nil && b == nil {</pre></code><tr class=miss><td>149<td><code><pre> return true</pre></code><tr><td>150<td><code><pre> }</pre></code><tr class=miss><td>151<td><code><pre> if a == nil || b == nil || len(a) != len(b) {</pre></code><tr class=miss><td>152<td><code><pre> return false</pre></code><tr><td>153<td><code><pre> }</pre></code><tr><td>154<td><code><pre></pre></code><tr class=miss><td>155<td><code><pre> for ak, av := range a {</pre></code><tr class=miss><td>156<td><code><pre> bv, ok := b[ak]</pre></code><tr class=miss><td>157<td><code><pre> if !ok || !av.Equals(bv) {</pre></code><tr class=miss><td>158<td><code><pre> return false</pre></code><tr><td>159<td><code><pre> }</pre></code><tr><td>160<td><code><pre> }</pre></code><tr><td>161<td><code><pre></pre></code><tr class=miss><td>162<td><code><pre> return true</pre></code><tr><td>163<td><code><pre>}</pre></code></table><div class=funcname id=fn_SliceComparablePtr>func SliceComparablePtr</div><div class=info><a href=#s_fn_SliceComparablePtr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cmp/base.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func SliceComparablePtr[T comparable, TS ~[]*T](a, b TS) bool {</pre></code><tr class=miss><td>39<td><code><pre> if a == nil && b == nil {</pre></code><tr class=miss><td>40<td><code><pre> return true</pre></code><tr><td>41<td><code><pre> }</pre></code><tr class=miss><td>42<td><code><pre> if a == nil || b == nil || len(a) != len(b) {</pre></code><tr class=miss><td>43<td><code><pre> return false</pre></code><tr><td>44<td><code><pre> }</pre></code><tr class=miss><td>45<td><code><pre> for i := 0; i < len(a); i++ {</pre></code><tr class=miss><td>46<td><code><pre> if deref(a[i]) != deref(b[i]) {</pre></code><tr class=miss><td>47<td><code><pre> return false</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre> }</pre></code><tr class=miss><td>50<td><code><pre> return true</pre></code><tr><td>51<td><code><pre>}</pre></code></table><div class=funcname id=fn_DecimalPtr>func DecimalPtr</div><div class=info><a href=#s_fn_DecimalPtr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cmp/base.go</code>:</div><table class=listing><tr><td>75<td><code><pre>func DecimalPtr(a, b *decimal.Decimal) bool {</pre></code><tr class=miss><td>76<td><code><pre> if a == nil && b == nil {</pre></code><tr class=miss><td>77<td><code><pre> return true</pre></code><tr><td>78<td><code><pre> }</pre></code><tr class=miss><td>79<td><code><pre> if a == nil || b == nil {</pre></code><tr class=miss><td>80<td><code><pre> return false</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre></pre></code><tr class=miss><td>83<td><code><pre> return a.Equal(*b)</pre></code><tr><td>84<td><code><pre>}</pre></code></table><div class=funcname id=fn_TimeLocationPtr>func TimeLocationPtr</div><div class=info><a href=#s_fn_TimeLocationPtr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cmp/base.go</code>:</div><table class=listing><tr><td>64<td><code><pre>func TimeLocationPtr(a, b *time.Location) bool {</pre></code><tr class=miss><td>65<td><code><pre> if a == nil && b == nil {</pre></code><tr class=miss><td>66<td><code><pre> return true</pre></code><tr><td>67<td><code><pre> }</pre></code><tr class=miss><td>68<td><code><pre> if a == nil || b == nil {</pre></code><tr class=miss><td>69<td><code><pre> return false</pre></code><tr><td>70<td><code><pre> }</pre></code><tr><td>71<td><code><pre></pre></code><tr class=miss><td>72<td><code><pre> return a.String() == b.String()</pre></code><tr><td>73<td><code><pre>}</pre></code></table><div class=funcname id=fn_TimePtr>func TimePtr</div><div class=info><a href=#s_fn_TimePtr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cmp/base.go</code>:</div><table class=listing><tr><td>53<td><code><pre>func TimePtr(a, b *time.Time) bool {</pre></code><tr class=miss><td>54<td><code><pre> if a == nil && b == nil {</pre></code><tr class=miss><td>55<td><code><pre> return true</pre></code><tr><td>56<td><code><pre> }</pre></code><tr class=miss><td>57<td><code><pre> if a == nil || b == nil {</pre></code><tr class=miss><td>58<td><code><pre> return false</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre></pre></code><tr class=miss><td>61<td><code><pre> return a.Equal(*b) && TimeLocationPtr(a.Location(), b.Location())</pre></code><tr><td>62<td><code><pre>}</pre></code></table><div class=funcname id=fn_GormModelPtr>func GormModelPtr</div><div class=info><a href=#s_fn_GormModelPtr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/cmp/base.go</code>:</div><table class=listing><tr><td>86<td><code><pre>func GormModelPtr(a, b *gorm.Model) bool {</pre></code><tr class=miss><td>87<td><code><pre> if a == nil && b == nil {</pre></code><tr class=miss><td>88<td><code><pre> return true</pre></code><tr><td>89<td><code><pre> }</pre></code><tr class=miss><td>90<td><code><pre> if a == nil || b == nil {</pre></code><tr class=miss><td>91<td><code><pre> return false</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre></pre></code><tr class=miss><td>94<td><code><pre> return a.ID == b.ID &&</pre></code><tr><td>95<td><code><pre> TimePtr(&a.CreatedAt, &b.CreatedAt) &&</pre></code><tr><td>96<td><code><pre> TimePtr(&a.UpdatedAt, &b.UpdatedAt) &&</pre></code><tr><td>97<td><code><pre> a.DeletedAt.Valid == b.DeletedAt.Valid &&</pre></code><tr><td>98<td><code><pre> TimePtr(&a.DeletedAt.Time, &b.DeletedAt.Time)</pre></code><tr><td>99<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/common/utils/compress class=funcname>Package Overview: github.com/wfusion/gofusion/common/utils/compress 16 <span class=packageTotal>73.7%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_@20:9><td><code><a href=#fn_@20:9>@20:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/decode.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@31:24><td><code><a href=#fn_@31:24>@31:24(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/decode.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@32:24><td><code><a href=#fn_@32:24>@32:24(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/encode.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@21:9><td><code><a href=#fn_@21:9>@21:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/encode.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_decoder.Close><td><code><a href=#fn_decoder.Close>decoder.Close(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/decode.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_encoder.Close><td><code><a href=#fn_encoder.Close>encoder.Close(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/encode.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@92:9><td><code><a href=#fn_@92:9>@92:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/decode.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_deflateDecodable.Reset><td><code><a href=#fn_deflateDecodable.Reset>deflateDecodable.Reset(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_gzipDecodable.Reset><td><code><a href=#fn_gzipDecodable.Reset>gzipDecodable.Reset(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_s2Decodable.Reset><td><code><a href=#fn_s2Decodable.Reset>s2Decodable.Reset(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_encoder.Flush><td><code><a href=#fn_encoder.Flush>encoder.Flush(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/encode.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_zlibDecodable.Reset><td><code><a href=#fn_zlibDecodable.Reset>zlibDecodable.Reset(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@33:32><td><code><a href=#fn_@33:32>@33:32(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_NewDecFunc><td><code><a href=#fn_NewDecFunc>NewDecFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/decode.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_zlibDecodable.Read><td><code><a href=#fn_zlibDecodable.Read>zlibDecodable.Read(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Algorithm.String><td><code><a href=#fn_Algorithm.String>Algorithm.String(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/algorithm_enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_decoder.Read><td><code><a href=#fn_decoder.Read>decoder.Read(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/decode.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_deflateDecodable.Read><td><code><a href=#fn_deflateDecodable.Read>deflateDecodable.Read(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_EncodeBytesFunc><td><code><a href=#fn_EncodeBytesFunc>EncodeBytesFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/encode.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Algorithm.IsValid><td><code><a href=#fn_Algorithm.IsValid>Algorithm.IsValid(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/algorithm_enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_gzipDecodable.Read><td><code><a href=#fn_gzipDecodable.Read>gzipDecodable.Read(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_s2Decodable.Read><td><code><a href=#fn_s2Decodable.Read>s2Decodable.Read(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/wrapper.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_writerPoolSealer.Reset><td><code><a href=#fn_writerPoolSealer.Reset>writerPoolSealer.Reset(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_readerPoolSealer.Reset><td><code><a href=#fn_readerPoolSealer.Reset>readerPoolSealer.Reset(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@54:35><td><code><a href=#fn_@54:35>@54:35(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@51:32><td><code><a href=#fn_@51:32>@51:32(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@48:30><td><code><a href=#fn_@48:30>@48:30(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_NewEncFunc><td><code><a href=#fn_NewEncFunc>NewEncFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/encode.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@45:32><td><code><a href=#fn_@45:32>@45:32(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_encoder.Write><td><code><a href=#fn_encoder.Write>encoder.Write(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/encode.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@42:32><td><code><a href=#fn_@42:32>@42:32(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_DecodeBytesFunc><td><code><a href=#fn_DecodeBytesFunc>DecodeBytesFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/decode.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@36:35><td><code><a href=#fn_@36:35>@36:35(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@24:32><td><code><a href=#fn_@24:32>@24:32(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@27:32><td><code><a href=#fn_@27:32>@27:32(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@30:30><td><code><a href=#fn_@30:30>@30:30(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Algorithm.Value><td><code><a href=#fn_Algorithm.Value>Algorithm.Value(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/algorithm_enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@15:9><td><code><a href=#fn_@15:9>@15:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/decode.go</code><td class=percent><code>87.5%</code><td class=linecount><code>14/16</code><tr id=s_fn_ParseAlgorithm><td><code><a href=#fn_ParseAlgorithm>ParseAlgorithm(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/algorithm_enum.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_getDecoder><td><code><a href=#fn_getDecoder>getDecoder(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/decode.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_getEncoder><td><code><a href=#fn_getEncoder>getEncoder(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/encode.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_@103:9><td><code><a href=#fn_@103:9>@103:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/encode.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_@16:9><td><code><a href=#fn_@16:9>@16:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/encode.go</code><td class=percent><code>73.7%</code><td class=linecount><code>14/19</code><tr id=s_fn_@61:9><td><code><a href=#fn_@61:9>@61:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/encode.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/9</code><tr id=s_fn_@54:9><td><code><a href=#fn_@54:9>@54:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/decode.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_@69:9><td><code><a href=#fn_@69:9>@69:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/encode.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@59:9><td><code><a href=#fn_@59:9>@59:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/decode.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_EncodeStreamFunc><td><code><a href=#fn_EncodeStreamFunc>EncodeStreamFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/encode.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@66:27><td><code><a href=#fn_@66:27>@66:27(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/encode.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_encoder.Reset><td><code><a href=#fn_encoder.Reset>encoder.Reset(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/encode.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_decoder.Reset><td><code><a href=#fn_decoder.Reset>decoder.Reset(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/decode.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@65:27><td><code><a href=#fn_@65:27>@65:27(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/decode.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_DecodeStreamFunc><td><code><a href=#fn_DecodeStreamFunc>DecodeStreamFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/compress/decode.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_@20:9>func @20:9</div><div class=info><a href=#s_fn_@20:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/decode.go</code>:</div><table class=listing><tr><td>20<td><code><pre>func() {</pre></code><tr><td>21<td><code><pre> for _, cb := range recycles {</pre></code><tr><td>22<td><code><pre> if cb != nil {</pre></code><tr><td>23<td><code><pre> cb()</pre></code><tr><td>24<td><code><pre> }</pre></code><tr><td>25<td><code><pre> }</pre></code><tr><td>26<td><code><pre> }</pre></code></table><div class=funcname id=fn_@31:24>func @31:24</div><div class=info><a href=#s_fn_@31:24>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/decode.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func() {</pre></code><tr><td>32<td><code><pre> var cb func()</pre></code><tr><td>33<td><code><pre> dec, cb = getDecoder(algo, srcBuffer)</pre></code><tr><td>34<td><code><pre> recycles = append(recycles, cb)</pre></code><tr><td>35<td><code><pre> }</pre></code></table><div class=funcname id=fn_@32:24>func @32:24</div><div class=info><a href=#s_fn_@32:24>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/encode.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func() {</pre></code><tr><td>33<td><code><pre> var cb func()</pre></code><tr><td>34<td><code><pre> enc, cb = getEncoder(algo, dstBuffer)</pre></code><tr><td>35<td><code><pre> recycles = append(recycles, cb)</pre></code><tr><td>36<td><code><pre> }</pre></code></table><div class=funcname id=fn_@21:9>func @21:9</div><div class=info><a href=#s_fn_@21:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/encode.go</code>:</div><table class=listing><tr><td>21<td><code><pre>func() {</pre></code><tr><td>22<td><code><pre> for _, cb := range recycles {</pre></code><tr><td>23<td><code><pre> if cb != nil {</pre></code><tr><td>24<td><code><pre> cb()</pre></code><tr><td>25<td><code><pre> }</pre></code><tr><td>26<td><code><pre> }</pre></code><tr><td>27<td><code><pre> }</pre></code></table><div class=funcname id=fn_decoder.Close>func decoder.Close</div><div class=info><a href=#s_fn_decoder.Close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/decode.go</code>:</div><table class=listing><tr><td>104<td><code><pre>func (e *decoder) Close() (err error) { defer e.cb(); utils.CloseAnyway(e.r); return }</pre></code></table><div class=funcname id=fn_encoder.Close>func encoder.Close</div><div class=info><a href=#s_fn_encoder.Close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/encode.go</code>:</div><table class=listing><tr><td>119<td><code><pre>func (e *encoder) Close() (err error) {</pre></code><tr><td>120<td><code><pre> defer e.cb()</pre></code><tr><td>121<td><code><pre> defer utils.CloseAnyway(e.w)</pre></code><tr><td>122<td><code><pre> return e.Flush()</pre></code><tr><td>123<td><code><pre>}</pre></code></table><div class=funcname id=fn_@92:9>func @92:9</div><div class=info><a href=#s_fn_@92:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/decode.go</code>:</div><table class=listing><tr><td>92<td><code><pre>func(r io.Reader) io.ReadCloser {</pre></code><tr><td>93<td><code><pre> dec, cb := getDecoder(algo, r)</pre></code><tr><td>94<td><code><pre> return &decoder{</pre></code><tr><td>95<td><code><pre> dec: dec,</pre></code><tr><td>96<td><code><pre> r: r,</pre></code><tr><td>97<td><code><pre> cb: cb,</pre></code><tr><td>98<td><code><pre> }</pre></code><tr><td>99<td><code><pre> }</pre></code></table><div class=funcname id=fn_deflateDecodable.Reset>func deflateDecodable.Reset</div><div class=info><a href=#s_fn_deflateDecodable.Reset>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/wrapper.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func (d *deflateDecodable) Reset(r io.Reader) (err error) { d.ReadCloser = flate.NewReader(r); return }</pre></code></table><div class=funcname id=fn_gzipDecodable.Reset>func gzipDecodable.Reset</div><div class=info><a href=#s_fn_gzipDecodable.Reset>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/wrapper.go</code>:</div><table class=listing><tr><td>24<td><code><pre>func (g *gzipDecodable) Reset(r io.Reader) (err error) { g.ReadCloser, err = gzip.NewReader(r); return }</pre></code></table><div class=funcname id=fn_s2Decodable.Reset>func s2Decodable.Reset</div><div class=info><a href=#s_fn_s2Decodable.Reset>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/wrapper.go</code>:</div><table class=listing><tr><td>17<td><code><pre>func (s *s2Decodable) Reset(r io.Reader) (err error) { s.Reader.Reset(r); return }</pre></code></table><div class=funcname id=fn_encoder.Flush>func encoder.Flush</div><div class=info><a href=#s_fn_encoder.Flush>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/encode.go</code>:</div><table class=listing><tr><td>118<td><code><pre>func (e *encoder) Flush() (err error) { defer utils.FlushAnyway(e.w); return e.enc.Flush() }</pre></code></table><div class=funcname id=fn_zlibDecodable.Reset>func zlibDecodable.Reset</div><div class=info><a href=#s_fn_zlibDecodable.Reset>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/wrapper.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func (z *zlibDecodable) Reset(r io.Reader) (err error) { z.ReadCloser, err = zlib.NewReader(r); return }</pre></code></table><div class=funcname id=fn_@33:32>func @33:32</div><div class=info><a href=#s_fn_@33:32>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/types.go</code>:</div><table class=listing><tr><td>33<td><code><pre>func() *writerPoolSealer {</pre></code><tr><td>34<td><code><pre> return &writerPoolSealer{gzip.NewWriter(nil)}</pre></code><tr><td>35<td><code><pre> }</pre></code></table><div class=funcname id=fn_NewDecFunc>func NewDecFunc</div><div class=info><a href=#s_fn_NewDecFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/decode.go</code>:</div><table class=listing><tr><td>91<td><code><pre>func NewDecFunc(algo Algorithm) func(r io.Reader) io.ReadCloser {</pre></code><tr><td>92<td><code><pre> return func(r io.Reader) io.ReadCloser {</pre></code><tr><td>93<td><code><pre> dec, cb := getDecoder(algo, r)</pre></code><tr><td>94<td><code><pre> return &decoder{</pre></code><tr><td>95<td><code><pre> dec: dec,</pre></code><tr><td>96<td><code><pre> r: r,</pre></code><tr><td>97<td><code><pre> cb: cb,</pre></code><tr><td>98<td><code><pre> }</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre>}</pre></code></table><div class=funcname id=fn_zlibDecodable.Read>func zlibDecodable.Read</div><div class=info><a href=#s_fn_zlibDecodable.Read>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/wrapper.go</code>:</div><table class=listing><tr><td>37<td><code><pre>func (z *zlibDecodable) Read(p []byte) (n int, err error) { return z.ReadCloser.Read(p) }</pre></code></table><div class=funcname id=fn_Algorithm.String>func Algorithm.String</div><div class=info><a href=#s_fn_Algorithm.String>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/algorithm_enum.go</code>:</div><table class=listing><tr><td>37<td><code><pre>func (e Algorithm) String() string {</pre></code><tr><td>38<td><code><pre> return algorithmEnum.String(e)</pre></code><tr><td>39<td><code><pre>}</pre></code></table><div class=funcname id=fn_decoder.Read>func decoder.Read</div><div class=info><a href=#s_fn_decoder.Read>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/decode.go</code>:</div><table class=listing><tr><td>103<td><code><pre>func (e *decoder) Read(p []byte) (n int, err error) { return e.dec.Read(p) }</pre></code></table><div class=funcname id=fn_deflateDecodable.Read>func deflateDecodable.Read</div><div class=info><a href=#s_fn_deflateDecodable.Read>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/wrapper.go</code>:</div><table class=listing><tr><td>30<td><code><pre>func (d *deflateDecodable) Read(p []byte) (n int, err error) { return d.ReadCloser.Read(p) }</pre></code></table><div class=funcname id=fn_EncodeBytesFunc>func EncodeBytesFunc</div><div class=info><a href=#s_fn_EncodeBytesFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/encode.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func EncodeBytesFunc(algo Algorithm) func(src []byte) (dst []byte, err error) {</pre></code><tr><td>16<td><code><pre> return func(src []byte) (dst []byte, err error) {</pre></code><tr><td>17<td><code><pre> var (</pre></code><tr><td>18<td><code><pre> enc encodable</pre></code><tr><td>19<td><code><pre> recycles []func()</pre></code><tr><td>20<td><code><pre> )</pre></code><tr><td>21<td><code><pre> defer func() {</pre></code><tr><td>22<td><code><pre> for _, cb := range recycles {</pre></code><tr><td>23<td><code><pre> if cb != nil {</pre></code><tr><td>24<td><code><pre> cb()</pre></code><tr><td>25<td><code><pre> }</pre></code><tr><td>26<td><code><pre> }</pre></code><tr><td>27<td><code><pre> }()</pre></code><tr><td>28<td><code><pre></pre></code><tr><td>29<td><code><pre> dstBuffer, bufferCb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>30<td><code><pre> recycles = append(recycles, bufferCb)</pre></code><tr><td>31<td><code><pre></pre></code><tr><td>32<td><code><pre> _, err = utils.Catch(func() {</pre></code><tr><td>33<td><code><pre> var cb func()</pre></code><tr><td>34<td><code><pre> enc, cb = getEncoder(algo, dstBuffer)</pre></code><tr><td>35<td><code><pre> recycles = append(recycles, cb)</pre></code><tr><td>36<td><code><pre> })</pre></code><tr><td>37<td><code><pre> if err != nil || enc == nil {</pre></code><tr><td>38<td><code><pre> return</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre></pre></code><tr><td>41<td><code><pre> srcBuffer, bufferCb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>42<td><code><pre> recycles = append(recycles, bufferCb)</pre></code><tr><td>43<td><code><pre> srcBuffer.Write(src)</pre></code><tr><td>44<td><code><pre> if _, err = io.Copy(enc, srcBuffer); err != nil {</pre></code><tr><td>45<td><code><pre> if err = utils.ErrIgnore(err, eofErrs...); err != nil {</pre></code><tr><td>46<td><code><pre> return</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre> if err = enc.Flush(); err != nil {</pre></code><tr><td>50<td><code><pre> if err = utils.ErrIgnore(err, eofErrs...); err != nil {</pre></code><tr><td>51<td><code><pre> return</pre></code><tr><td>52<td><code><pre> }</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre> dst = make([]byte, dstBuffer.Len())</pre></code><tr><td>55<td><code><pre> copy(dst, dstBuffer.Bytes())</pre></code><tr><td>56<td><code><pre> return</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre>}</pre></code></table><div class=funcname id=fn_Algorithm.IsValid>func Algorithm.IsValid</div><div class=info><a href=#s_fn_Algorithm.IsValid>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/algorithm_enum.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func (e Algorithm) IsValid() bool {</pre></code><tr><td>42<td><code><pre> return algorithmEnum.IsValid(e)</pre></code><tr><td>43<td><code><pre>}</pre></code></table><div class=funcname id=fn_gzipDecodable.Read>func gzipDecodable.Read</div><div class=info><a href=#s_fn_gzipDecodable.Read>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/wrapper.go</code>:</div><table class=listing><tr><td>23<td><code><pre>func (g *gzipDecodable) Read(p []byte) (n int, err error) { return g.ReadCloser.Read(p) }</pre></code></table><div class=funcname id=fn_s2Decodable.Read>func s2Decodable.Read</div><div class=info><a href=#s_fn_s2Decodable.Read>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/wrapper.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func (s *s2Decodable) Read(p []byte) (n int, err error) { return s.Reader.Read(p) }</pre></code></table><div class=funcname id=fn_writerPoolSealer.Reset>func writerPoolSealer.Reset</div><div class=info><a href=#s_fn_writerPoolSealer.Reset>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/types.go</code>:</div><table class=listing><tr><td>70<td><code><pre>func (w *writerPoolSealer) Reset(obj any) {</pre></code><tr><td>71<td><code><pre> w.encodable.Reset(obj.(io.Writer))</pre></code><tr><td>72<td><code><pre>}</pre></code></table><div class=funcname id=fn_readerPoolSealer.Reset>func readerPoolSealer.Reset</div><div class=info><a href=#s_fn_readerPoolSealer.Reset>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/types.go</code>:</div><table class=listing><tr><td>64<td><code><pre>func (r *readerPoolSealer) Reset(obj any) error {</pre></code><tr><td>65<td><code><pre> return r.decodable.Reset(obj.(io.Reader))</pre></code><tr><td>66<td><code><pre>}</pre></code></table><div class=funcname id=fn_@54:35>func @54:35</div><div class=info><a href=#s_fn_@54:35>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/types.go</code>:</div><table class=listing><tr><td>54<td><code><pre>func() *readerPoolSealer {</pre></code><tr><td>55<td><code><pre> return &readerPoolSealer{new(deflateDecodable)} // init when call reset method</pre></code><tr><td>56<td><code><pre> }</pre></code></table><div class=funcname id=fn_@51:32>func @51:32</div><div class=info><a href=#s_fn_@51:32>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/types.go</code>:</div><table class=listing><tr><td>51<td><code><pre>func() *readerPoolSealer {</pre></code><tr><td>52<td><code><pre> return &readerPoolSealer{new(gzipDecodable)} // init when call reset method</pre></code><tr><td>53<td><code><pre> }</pre></code></table><div class=funcname id=fn_@48:30>func @48:30</div><div class=info><a href=#s_fn_@48:30>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/types.go</code>:</div><table class=listing><tr><td>48<td><code><pre>func() *readerPoolSealer {</pre></code><tr><td>49<td><code><pre> return &readerPoolSealer{&s2Decodable{s2.NewReader(nil)}}</pre></code><tr><td>50<td><code><pre> }</pre></code></table><div class=funcname id=fn_NewEncFunc>func NewEncFunc</div><div class=info><a href=#s_fn_NewEncFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/encode.go</code>:</div><table class=listing><tr><td>102<td><code><pre>func NewEncFunc(algo Algorithm) func(w io.Writer) encodable {</pre></code><tr><td>103<td><code><pre> return func(w io.Writer) encodable {</pre></code><tr><td>104<td><code><pre> enc, cb := getEncoder(algo, w)</pre></code><tr><td>105<td><code><pre> if enc == nil {</pre></code><tr><td>106<td><code><pre> panic(ErrUnknownAlgorithm)</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre> return &encoder{</pre></code><tr><td>109<td><code><pre> enc: enc,</pre></code><tr><td>110<td><code><pre> w: w,</pre></code><tr><td>111<td><code><pre> cb: cb,</pre></code><tr><td>112<td><code><pre> }</pre></code><tr><td>113<td><code><pre> }</pre></code><tr><td>114<td><code><pre>}</pre></code></table><div class=funcname id=fn_@45:32>func @45:32</div><div class=info><a href=#s_fn_@45:32>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/types.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func() *readerPoolSealer {</pre></code><tr><td>46<td><code><pre> return &readerPoolSealer{new(zlibDecodable)} // init when call reset method</pre></code><tr><td>47<td><code><pre> }</pre></code></table><div class=funcname id=fn_encoder.Write>func encoder.Write</div><div class=info><a href=#s_fn_encoder.Write>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/encode.go</code>:</div><table class=listing><tr><td>116<td><code><pre>func (e *encoder) Write(p []byte) (n int, err error) { return e.enc.Write(p) }</pre></code></table><div class=funcname id=fn_@42:32>func @42:32</div><div class=info><a href=#s_fn_@42:32>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/types.go</code>:</div><table class=listing><tr><td>42<td><code><pre>func() *readerPoolSealer {</pre></code><tr><td>43<td><code><pre> return &readerPoolSealer{utils.Must(zstd.NewReader(nil))}</pre></code><tr><td>44<td><code><pre> }</pre></code></table><div class=funcname id=fn_DecodeBytesFunc>func DecodeBytesFunc</div><div class=info><a href=#s_fn_DecodeBytesFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/decode.go</code>:</div><table class=listing><tr><td>14<td><code><pre>func DecodeBytesFunc(algo Algorithm) func(src []byte) (dst []byte, err error) {</pre></code><tr><td>15<td><code><pre> return func(src []byte) (dst []byte, err error) {</pre></code><tr><td>16<td><code><pre> var (</pre></code><tr><td>17<td><code><pre> dec decodable</pre></code><tr><td>18<td><code><pre> recycles []func()</pre></code><tr><td>19<td><code><pre> )</pre></code><tr><td>20<td><code><pre> defer func() {</pre></code><tr><td>21<td><code><pre> for _, cb := range recycles {</pre></code><tr><td>22<td><code><pre> if cb != nil {</pre></code><tr><td>23<td><code><pre> cb()</pre></code><tr><td>24<td><code><pre> }</pre></code><tr><td>25<td><code><pre> }</pre></code><tr><td>26<td><code><pre> }()</pre></code><tr><td>27<td><code><pre></pre></code><tr><td>28<td><code><pre> srcBuffer, bufferCb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>29<td><code><pre> recycles = append(recycles, bufferCb)</pre></code><tr><td>30<td><code><pre> srcBuffer.Write(src)</pre></code><tr><td>31<td><code><pre> _, err = utils.Catch(func() {</pre></code><tr><td>32<td><code><pre> var cb func()</pre></code><tr><td>33<td><code><pre> dec, cb = getDecoder(algo, srcBuffer)</pre></code><tr><td>34<td><code><pre> recycles = append(recycles, cb)</pre></code><tr><td>35<td><code><pre> })</pre></code><tr><td>36<td><code><pre> if err != nil || dec == nil {</pre></code><tr><td>37<td><code><pre> return</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre></pre></code><tr><td>40<td><code><pre> dstBuffer, bufferCb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>41<td><code><pre> recycles = append(recycles, bufferCb)</pre></code><tr><td>42<td><code><pre> if _, err = io.Copy(dstBuffer, dec); err != nil {</pre></code><tr><td>43<td><code><pre> if err = utils.ErrIgnore(err, eofErrs...); err != nil {</pre></code><tr><td>44<td><code><pre> return</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre> dst = make([]byte, dstBuffer.Len())</pre></code><tr><td>48<td><code><pre> copy(dst, dstBuffer.Bytes())</pre></code><tr><td>49<td><code><pre> return</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre>}</pre></code></table><div class=funcname id=fn_@36:35>func @36:35</div><div class=info><a href=#s_fn_@36:35>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/types.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func() *writerPoolSealer {</pre></code><tr><td>37<td><code><pre> return &writerPoolSealer{utils.Must(flate.NewWriter(nil, flate.DefaultCompression))}</pre></code><tr><td>38<td><code><pre> }</pre></code></table><div class=funcname id=fn_@24:32>func @24:32</div><div class=info><a href=#s_fn_@24:32>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/types.go</code>:</div><table class=listing><tr><td>24<td><code><pre>func() *writerPoolSealer {</pre></code><tr><td>25<td><code><pre> return &writerPoolSealer{utils.Must(zstd.NewWriter(nil))}</pre></code><tr><td>26<td><code><pre> }</pre></code></table><div class=funcname id=fn_@27:32>func @27:32</div><div class=info><a href=#s_fn_@27:32>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/types.go</code>:</div><table class=listing><tr><td>27<td><code><pre>func() *writerPoolSealer {</pre></code><tr><td>28<td><code><pre> return &writerPoolSealer{zlib.NewWriter(nil)}</pre></code><tr><td>29<td><code><pre> }</pre></code></table><div class=funcname id=fn_@30:30>func @30:30</div><div class=info><a href=#s_fn_@30:30>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/types.go</code>:</div><table class=listing><tr><td>30<td><code><pre>func() *writerPoolSealer {</pre></code><tr><td>31<td><code><pre> return &writerPoolSealer{s2.NewWriter(nil)}</pre></code><tr><td>32<td><code><pre> }</pre></code></table><div class=funcname id=fn_Algorithm.Value>func Algorithm.Value</div><div class=info><a href=#s_fn_Algorithm.Value>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/algorithm_enum.go</code>:</div><table class=listing><tr><td>33<td><code><pre>func (e Algorithm) Value() uint8 {</pre></code><tr><td>34<td><code><pre> return uint8(e)</pre></code><tr><td>35<td><code><pre>}</pre></code></table><div class=funcname id=fn_@15:9>func @15:9</div><div class=info><a href=#s_fn_@15:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/decode.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func(src []byte) (dst []byte, err error) {</pre></code><tr><td>16<td><code><pre> var (</pre></code><tr><td>17<td><code><pre> dec decodable</pre></code><tr><td>18<td><code><pre> recycles []func()</pre></code><tr><td>19<td><code><pre> )</pre></code><tr><td>20<td><code><pre> defer func() {</pre></code><tr><td>21<td><code><pre> for _, cb := range recycles {</pre></code><tr><td>22<td><code><pre> if cb != nil {</pre></code><tr><td>23<td><code><pre> cb()</pre></code><tr><td>24<td><code><pre> }</pre></code><tr><td>25<td><code><pre> }</pre></code><tr><td>26<td><code><pre> }()</pre></code><tr><td>27<td><code><pre></pre></code><tr><td>28<td><code><pre> srcBuffer, bufferCb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>29<td><code><pre> recycles = append(recycles, bufferCb)</pre></code><tr><td>30<td><code><pre> srcBuffer.Write(src)</pre></code><tr><td>31<td><code><pre> _, err = utils.Catch(func() {</pre></code><tr><td>32<td><code><pre> var cb func()</pre></code><tr><td>33<td><code><pre> dec, cb = getDecoder(algo, srcBuffer)</pre></code><tr><td>34<td><code><pre> recycles = append(recycles, cb)</pre></code><tr><td>35<td><code><pre> })</pre></code><tr><td>36<td><code><pre> if err != nil || dec == nil {</pre></code><tr class=miss><td>37<td><code><pre> return</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre></pre></code><tr><td>40<td><code><pre> dstBuffer, bufferCb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>41<td><code><pre> recycles = append(recycles, bufferCb)</pre></code><tr><td>42<td><code><pre> if _, err = io.Copy(dstBuffer, dec); err != nil {</pre></code><tr><td>43<td><code><pre> if err = utils.ErrIgnore(err, eofErrs...); err != nil {</pre></code><tr class=miss><td>44<td><code><pre> return</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre> dst = make([]byte, dstBuffer.Len())</pre></code><tr><td>48<td><code><pre> copy(dst, dstBuffer.Bytes())</pre></code><tr><td>49<td><code><pre> return</pre></code><tr><td>50<td><code><pre> }</pre></code></table><div class=funcname id=fn_ParseAlgorithm>func ParseAlgorithm</div><div class=info><a href=#s_fn_ParseAlgorithm>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/algorithm_enum.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func ParseAlgorithm(s any) Algorithm {</pre></code><tr><td>46<td><code><pre> switch v := s.(type) {</pre></code><tr><td>47<td><code><pre> case string:</pre></code><tr><td>48<td><code><pre> if enumList := algorithmEnum.Enum(v); len(enumList) > 0 {</pre></code><tr><td>49<td><code><pre> return enumList[0]</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre> case Algorithm:</pre></code><tr><td>52<td><code><pre> return v</pre></code><tr><td>53<td><code><pre> default:</pre></code><tr class=miss><td>54<td><code><pre> return Algorithm(cast.ToInt(s))</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre> return AlgorithmUnknown</pre></code><tr><td>57<td><code><pre>}</pre></code></table><div class=funcname id=fn_getDecoder>func getDecoder</div><div class=info><a href=#s_fn_getDecoder>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/decode.go</code>:</div><table class=listing><tr><td>74<td><code><pre>func getDecoder(algo Algorithm, src io.Reader) (dec decodable, recycle func()) {</pre></code><tr><td>75<td><code><pre> p, ok := decoderPools[algo]</pre></code><tr><td>76<td><code><pre> if !algo.IsValid() || !ok {</pre></code><tr class=miss><td>77<td><code><pre> panic(ErrUnknownAlgorithm)</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre></pre></code><tr><td>80<td><code><pre> sealer, recycle := p.Get(src)</pre></code><tr><td>81<td><code><pre> dec = sealer.decodable</pre></code><tr><td>82<td><code><pre> return</pre></code><tr><td>83<td><code><pre>}</pre></code></table><div class=funcname id=fn_getEncoder>func getEncoder</div><div class=info><a href=#s_fn_getEncoder>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/encode.go</code>:</div><table class=listing><tr><td>85<td><code><pre>func getEncoder(algo Algorithm, dst io.Writer) (enc encodable, recycle func()) {</pre></code><tr><td>86<td><code><pre> p, ok := encoderPools[algo]</pre></code><tr><td>87<td><code><pre> if !algo.IsValid() || !ok {</pre></code><tr class=miss><td>88<td><code><pre> panic(ErrUnknownAlgorithm)</pre></code><tr><td>89<td><code><pre> }</pre></code><tr><td>90<td><code><pre></pre></code><tr><td>91<td><code><pre> sealer, recycle := p.Get(dst)</pre></code><tr><td>92<td><code><pre> enc = sealer.encodable</pre></code><tr><td>93<td><code><pre> return</pre></code><tr><td>94<td><code><pre>}</pre></code></table><div class=funcname id=fn_@103:9>func @103:9</div><div class=info><a href=#s_fn_@103:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/encode.go</code>:</div><table class=listing><tr><td>103<td><code><pre>func(w io.Writer) encodable {</pre></code><tr><td>104<td><code><pre> enc, cb := getEncoder(algo, w)</pre></code><tr><td>105<td><code><pre> if enc == nil {</pre></code><tr class=miss><td>106<td><code><pre> panic(ErrUnknownAlgorithm)</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre> return &encoder{</pre></code><tr><td>109<td><code><pre> enc: enc,</pre></code><tr><td>110<td><code><pre> w: w,</pre></code><tr><td>111<td><code><pre> cb: cb,</pre></code><tr><td>112<td><code><pre> }</pre></code><tr><td>113<td><code><pre> }</pre></code></table><div class=funcname id=fn_@16:9>func @16:9</div><div class=info><a href=#s_fn_@16:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/encode.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func(src []byte) (dst []byte, err error) {</pre></code><tr><td>17<td><code><pre> var (</pre></code><tr><td>18<td><code><pre> enc encodable</pre></code><tr><td>19<td><code><pre> recycles []func()</pre></code><tr><td>20<td><code><pre> )</pre></code><tr><td>21<td><code><pre> defer func() {</pre></code><tr><td>22<td><code><pre> for _, cb := range recycles {</pre></code><tr><td>23<td><code><pre> if cb != nil {</pre></code><tr><td>24<td><code><pre> cb()</pre></code><tr><td>25<td><code><pre> }</pre></code><tr><td>26<td><code><pre> }</pre></code><tr><td>27<td><code><pre> }()</pre></code><tr><td>28<td><code><pre></pre></code><tr><td>29<td><code><pre> dstBuffer, bufferCb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>30<td><code><pre> recycles = append(recycles, bufferCb)</pre></code><tr><td>31<td><code><pre></pre></code><tr><td>32<td><code><pre> _, err = utils.Catch(func() {</pre></code><tr><td>33<td><code><pre> var cb func()</pre></code><tr><td>34<td><code><pre> enc, cb = getEncoder(algo, dstBuffer)</pre></code><tr><td>35<td><code><pre> recycles = append(recycles, cb)</pre></code><tr><td>36<td><code><pre> })</pre></code><tr><td>37<td><code><pre> if err != nil || enc == nil {</pre></code><tr class=miss><td>38<td><code><pre> return</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre></pre></code><tr><td>41<td><code><pre> srcBuffer, bufferCb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>42<td><code><pre> recycles = append(recycles, bufferCb)</pre></code><tr><td>43<td><code><pre> srcBuffer.Write(src)</pre></code><tr><td>44<td><code><pre> if _, err = io.Copy(enc, srcBuffer); err != nil {</pre></code><tr class=miss><td>45<td><code><pre> if err = utils.ErrIgnore(err, eofErrs...); err != nil {</pre></code><tr class=miss><td>46<td><code><pre> return</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre> if err = enc.Flush(); err != nil {</pre></code><tr class=miss><td>50<td><code><pre> if err = utils.ErrIgnore(err, eofErrs...); err != nil {</pre></code><tr class=miss><td>51<td><code><pre> return</pre></code><tr><td>52<td><code><pre> }</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre> dst = make([]byte, dstBuffer.Len())</pre></code><tr><td>55<td><code><pre> copy(dst, dstBuffer.Bytes())</pre></code><tr><td>56<td><code><pre> return</pre></code><tr><td>57<td><code><pre> }</pre></code></table><div class=funcname id=fn_@61:9>func @61:9</div><div class=info><a href=#s_fn_@61:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/encode.go</code>:</div><table class=listing><tr><td>61<td><code><pre>func(dst io.Writer, src io.Reader) (err error) {</pre></code><tr class=miss><td>62<td><code><pre> var (</pre></code><tr><td>63<td><code><pre> enc encodable</pre></code><tr><td>64<td><code><pre> cb func()</pre></code><tr><td>65<td><code><pre> )</pre></code><tr class=miss><td>66<td><code><pre> if _, err = utils.Catch(func() { enc, cb = getEncoder(algo, dst) }); err != nil {</pre></code><tr class=miss><td>67<td><code><pre> return</pre></code><tr><td>68<td><code><pre> }</pre></code><tr class=miss><td>69<td><code><pre> defer func() {</pre></code><tr><td>70<td><code><pre> if cb != nil {</pre></code><tr><td>71<td><code><pre> cb()</pre></code><tr><td>72<td><code><pre> }</pre></code><tr><td>73<td><code><pre> }()</pre></code><tr><td>74<td><code><pre></pre></code><tr class=miss><td>75<td><code><pre> if _, err = io.Copy(enc, src); err != nil {</pre></code><tr class=miss><td>76<td><code><pre> if err = utils.ErrIgnore(err, eofErrs...); err != nil {</pre></code><tr class=miss><td>77<td><code><pre> return</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre> }</pre></code><tr class=miss><td>80<td><code><pre> err = enc.Flush()</pre></code><tr class=miss><td>81<td><code><pre> return utils.ErrIgnore(err, eofErrs...)</pre></code><tr><td>82<td><code><pre> }</pre></code></table><div class=funcname id=fn_@54:9>func @54:9</div><div class=info><a href=#s_fn_@54:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/decode.go</code>:</div><table class=listing><tr><td>54<td><code><pre>func(dst io.Writer, src io.Reader) (err error) {</pre></code><tr class=miss><td>55<td><code><pre> var (</pre></code><tr><td>56<td><code><pre> dec decodable</pre></code><tr><td>57<td><code><pre> cb func()</pre></code><tr><td>58<td><code><pre> )</pre></code><tr class=miss><td>59<td><code><pre> defer func() {</pre></code><tr><td>60<td><code><pre> if cb != nil {</pre></code><tr><td>61<td><code><pre> cb()</pre></code><tr><td>62<td><code><pre> }</pre></code><tr><td>63<td><code><pre> }()</pre></code><tr><td>64<td><code><pre></pre></code><tr class=miss><td>65<td><code><pre> if _, err = utils.Catch(func() { dec, cb = getDecoder(algo, src) }); err != nil {</pre></code><tr class=miss><td>66<td><code><pre> return</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre></pre></code><tr class=miss><td>69<td><code><pre> _, err = io.Copy(dst, dec)</pre></code><tr class=miss><td>70<td><code><pre> return utils.ErrIgnore(err, eofErrs...)</pre></code><tr><td>71<td><code><pre> }</pre></code></table><div class=funcname id=fn_@69:9>func @69:9</div><div class=info><a href=#s_fn_@69:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/encode.go</code>:</div><table class=listing><tr><td>69<td><code><pre>func() {</pre></code><tr class=miss><td>70<td><code><pre> if cb != nil {</pre></code><tr class=miss><td>71<td><code><pre> cb()</pre></code><tr><td>72<td><code><pre> }</pre></code><tr><td>73<td><code><pre> }</pre></code></table><div class=funcname id=fn_@59:9>func @59:9</div><div class=info><a href=#s_fn_@59:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/decode.go</code>:</div><table class=listing><tr><td>59<td><code><pre>func() {</pre></code><tr class=miss><td>60<td><code><pre> if cb != nil {</pre></code><tr class=miss><td>61<td><code><pre> cb()</pre></code><tr><td>62<td><code><pre> }</pre></code><tr><td>63<td><code><pre> }</pre></code></table><div class=funcname id=fn_EncodeStreamFunc>func EncodeStreamFunc</div><div class=info><a href=#s_fn_EncodeStreamFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/encode.go</code>:</div><table class=listing><tr><td>60<td><code><pre>func EncodeStreamFunc(algo Algorithm) func(dst io.Writer, src io.Reader) (err error) {</pre></code><tr class=miss><td>61<td><code><pre> return func(dst io.Writer, src io.Reader) (err error) {</pre></code><tr><td>62<td><code><pre> var (</pre></code><tr><td>63<td><code><pre> enc encodable</pre></code><tr><td>64<td><code><pre> cb func()</pre></code><tr><td>65<td><code><pre> )</pre></code><tr><td>66<td><code><pre> if _, err = utils.Catch(func() { enc, cb = getEncoder(algo, dst) }); err != nil {</pre></code><tr><td>67<td><code><pre> return</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre> defer func() {</pre></code><tr><td>70<td><code><pre> if cb != nil {</pre></code><tr><td>71<td><code><pre> cb()</pre></code><tr><td>72<td><code><pre> }</pre></code><tr><td>73<td><code><pre> }()</pre></code><tr><td>74<td><code><pre></pre></code><tr><td>75<td><code><pre> if _, err = io.Copy(enc, src); err != nil {</pre></code><tr><td>76<td><code><pre> if err = utils.ErrIgnore(err, eofErrs...); err != nil {</pre></code><tr><td>77<td><code><pre> return</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre> }</pre></code><tr><td>80<td><code><pre> err = enc.Flush()</pre></code><tr><td>81<td><code><pre> return utils.ErrIgnore(err, eofErrs...)</pre></code><tr><td>82<td><code><pre> }</pre></code><tr><td>83<td><code><pre>}</pre></code></table><div class=funcname id=fn_@66:27>func @66:27</div><div class=info><a href=#s_fn_@66:27>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/encode.go</code>:</div><table class=listing><tr class=miss><td>66<td><code><pre>func() { enc, cb = getEncoder(algo, dst) }</pre></code></table><div class=funcname id=fn_encoder.Reset>func encoder.Reset</div><div class=info><a href=#s_fn_encoder.Reset>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/encode.go</code>:</div><table class=listing><tr class=miss><td>117<td><code><pre>func (e *encoder) Reset(w io.Writer) { e.enc.Reset(w) }</pre></code></table><div class=funcname id=fn_decoder.Reset>func decoder.Reset</div><div class=info><a href=#s_fn_decoder.Reset>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/decode.go</code>:</div><table class=listing><tr class=miss><td>102<td><code><pre>func (e *decoder) Reset(r io.Reader) error { return e.dec.Reset(r) }</pre></code></table><div class=funcname id=fn_@65:27>func @65:27</div><div class=info><a href=#s_fn_@65:27>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/decode.go</code>:</div><table class=listing><tr class=miss><td>65<td><code><pre>func() { dec, cb = getDecoder(algo, src) }</pre></code></table><div class=funcname id=fn_DecodeStreamFunc>func DecodeStreamFunc</div><div class=info><a href=#s_fn_DecodeStreamFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/compress/decode.go</code>:</div><table class=listing><tr><td>53<td><code><pre>func DecodeStreamFunc(algo Algorithm) func(dst io.Writer, src io.Reader) (err error) {</pre></code><tr class=miss><td>54<td><code><pre> return func(dst io.Writer, src io.Reader) (err error) {</pre></code><tr><td>55<td><code><pre> var (</pre></code><tr><td>56<td><code><pre> dec decodable</pre></code><tr><td>57<td><code><pre> cb func()</pre></code><tr><td>58<td><code><pre> )</pre></code><tr><td>59<td><code><pre> defer func() {</pre></code><tr><td>60<td><code><pre> if cb != nil {</pre></code><tr><td>61<td><code><pre> cb()</pre></code><tr><td>62<td><code><pre> }</pre></code><tr><td>63<td><code><pre> }()</pre></code><tr><td>64<td><code><pre></pre></code><tr><td>65<td><code><pre> if _, err = utils.Catch(func() { dec, cb = getDecoder(algo, src) }); err != nil {</pre></code><tr><td>66<td><code><pre> return</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre></pre></code><tr><td>69<td><code><pre> _, err = io.Copy(dst, dec)</pre></code><tr><td>70<td><code><pre> return utils.ErrIgnore(err, eofErrs...)</pre></code><tr><td>71<td><code><pre> }</pre></code><tr><td>72<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/common/utils/encode class=funcname>Package Overview: github.com/wfusion/gofusion/common/utils/encode 17 <span class=packageTotal>84.3%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_codecStream.Decode><td><code><a href=#fn_codecStream.Decode>codecStream.Decode(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/stream.go</code><td class=percent><code>100.0%</code><td class=linecount><code>12/12</code><tr id=s_fn_@193:9><td><code><a href=#fn_@193:9>@193:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/stream.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_@46:9><td><code><a href=#fn_@46:9>@46:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_codec.Decode><td><code><a href=#fn_codec.Decode>codec.Decode(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/codec.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_codec.Encode><td><code><a href=#fn_codec.Encode>codec.Encode(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/codec.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_@133:9><td><code><a href=#fn_@133:9>@133:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/stream.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_decoder.Close><td><code><a href=#fn_decoder.Close>decoder.Close(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/stream.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_encoder.Close><td><code><a href=#fn_encoder.Close>encoder.Close(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/stream.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_Cipher><td><code><a href=#fn_Cipher>Cipher(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Compress><td><code><a href=#fn_Compress>Compress(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@38:26><td><code><a href=#fn_@38:26>@38:26(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/codec.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@55:9><td><code><a href=#fn_@55:9>@55:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_encoder.Write><td><code><a href=#fn_encoder.Write>encoder.Write(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/stream.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_newEncoder><td><code><a href=#fn_newEncoder>newEncoder(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/stream.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Encode><td><code><a href=#fn_Encode>Encode(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_EncodedType.IsValid><td><code><a href=#fn_EncodedType.IsValid>EncodedType.IsValid(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/encode_type_enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_decoder.Read><td><code><a href=#fn_decoder.Read>decoder.Read(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/stream.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_newDecoder><td><code><a href=#fn_newDecoder>newDecoder(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/stream.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Algorithm.IsValid><td><code><a href=#fn_Algorithm.IsValid>Algorithm.IsValid(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/algorithm_enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Algorithm.String><td><code><a href=#fn_Algorithm.String>Algorithm.String(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/algorithm_enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@109:16><td><code><a href=#fn_@109:16>@109:16(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/stream.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@61:9><td><code><a href=#fn_@61:9>@61:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_NewEncodeFunc><td><code><a href=#fn_NewEncodeFunc>NewEncodeFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/stream.go</code><td class=percent><code>94.4%</code><td class=linecount><code>17/18</code><tr id=s_fn_NewDecodeFunc><td><code><a href=#fn_NewDecodeFunc>NewDecodeFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/stream.go</code><td class=percent><code>94.4%</code><td class=linecount><code>17/18</code><tr id=s_fn_codecStream.Encode><td><code><a href=#fn_codecStream.Encode>codecStream.Encode(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/stream.go</code><td class=percent><code>91.7%</code><td class=linecount><code>11/12</code><tr id=s_fn_NewWriter><td><code><a href=#fn_NewWriter>NewWriter(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/stream.go</code><td class=percent><code>88.9%</code><td class=linecount><code>8/9</code><tr id=s_fn_From><td><code><a href=#fn_From>From(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/codec.go</code><td class=percent><code>87.5%</code><td class=linecount><code>7/8</code><tr id=s_fn_NewCodecStream><td><code><a href=#fn_NewCodecStream>NewCodecStream(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/stream.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_parseEncodedType><td><code><a href=#fn_parseEncodedType>parseEncodedType(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/encode_type_enum.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_NewReader><td><code><a href=#fn_NewReader>NewReader(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/stream.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_codec.ToBytes><td><code><a href=#fn_codec.ToBytes>codec.ToBytes(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/codec.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_codec.decode><td><code><a href=#fn_codec.decode>codec.decode(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/codec.go</code><td class=percent><code>78.6%</code><td class=linecount><code>11/14</code><tr id=s_fn_codec.encode><td><code><a href=#fn_codec.encode>codec.encode(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/codec.go</code><td class=percent><code>78.6%</code><td class=linecount><code>11/14</code><tr id=s_fn_codec.transform><td><code><a href=#fn_codec.transform>codec.transform(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/codec.go</code><td class=percent><code>75.0%</code><td class=linecount><code>6/8</code><tr id=s_fn_codec.ToString><td><code><a href=#fn_codec.ToString>codec.ToString(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/codec.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_ParseAlgorithm><td><code><a href=#fn_ParseAlgorithm>ParseAlgorithm(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/algorithm_enum.go</code><td class=percent><code>50.0%</code><td class=linecount><code>3/6</code><tr id=s_fn_ParseEncodedType><td><code><a href=#fn_ParseEncodedType>ParseEncodedType(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/encode_type_enum.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_EncodedType.Value><td><code><a href=#fn_EncodedType.Value>EncodedType.Value(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/encode_type_enum.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_EncodedType.String><td><code><a href=#fn_EncodedType.String>EncodedType.String(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/encode_type_enum.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Algorithm.Value><td><code><a href=#fn_Algorithm.Value>Algorithm.Value(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/encode/algorithm_enum.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_codecStream.Decode>func codecStream.Decode</div><div class=info><a href=#s_fn_codecStream.Decode>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/stream.go</code>:</div><table class=listing><tr><td>59<td><code><pre>func (w *codecStream) Decode(dst io.Writer, src io.Reader) (n int64, err error) {</pre></code><tr><td>60<td><code><pre> for i := len(w.encodeOrder) - 1; i >= 0; i-- {</pre></code><tr><td>61<td><code><pre> switch w.encodeOrder[i] {</pre></code><tr><td>62<td><code><pre> case EncodedTypeCompress:</pre></code><tr><td>63<td><code><pre> src = compress.NewDecFunc(w.o.compressAlgo)(src)</pre></code><tr><td>64<td><code><pre> case EncodedTypeCipher:</pre></code><tr><td>65<td><code><pre> src = cipher.NewDecFunc(w.o.cipherAlgo, w.o.cipherMode, w.o.key, w.o.iv)(src)</pre></code><tr><td>66<td><code><pre> case EncodedTypeEncode:</pre></code><tr><td>67<td><code><pre> src = NewReader(w.o.printableAlgo, src)</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre> }</pre></code><tr><td>70<td><code><pre></pre></code><tr><td>71<td><code><pre> buf, cb := utils.BytesPool.Get(defaultBufferSize)</pre></code><tr><td>72<td><code><pre> defer cb()</pre></code><tr><td>73<td><code><pre> defer utils.CloseAnyway(src)</pre></code><tr><td>74<td><code><pre> n, err = io.CopyBuffer(dst, src, buf)</pre></code><tr><td>75<td><code><pre> if errors.Is(err, io.ErrUnexpectedEOF) || errors.Is(err, io.EOF) {</pre></code><tr><td>76<td><code><pre> err = nil</pre></code><tr><td>77<td><code><pre> }</pre></code><tr><td>78<td><code><pre> return</pre></code><tr><td>79<td><code><pre>}</pre></code></table><div class=funcname id=fn_@193:9>func @193:9</div><div class=info><a href=#s_fn_@193:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/stream.go</code>:</div><table class=listing><tr><td>193<td><code><pre>func(src []byte) (dst []byte, err error) {</pre></code><tr><td>194<td><code><pre> dst = make([]byte, decodedLenFunc(len(src)))</pre></code><tr><td>195<td><code><pre> n, err := decodeFunc(dst, src)</pre></code><tr><td>196<td><code><pre> if err == nil {</pre></code><tr><td>197<td><code><pre> dst = dst[:n]</pre></code><tr><td>198<td><code><pre> }</pre></code><tr><td>199<td><code><pre> return</pre></code><tr><td>200<td><code><pre> }</pre></code></table><div class=funcname id=fn_@46:9>func @46:9</div><div class=info><a href=#s_fn_@46:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/types.go</code>:</div><table class=listing><tr><td>46<td><code><pre>func(o *option) {</pre></code><tr><td>47<td><code><pre> o.cipherAlgo = algo</pre></code><tr><td>48<td><code><pre> o.cipherMode = mode</pre></code><tr><td>49<td><code><pre> o.key = clone.SliceComparable(key)</pre></code><tr><td>50<td><code><pre> o.iv = clone.SliceComparable(iv)</pre></code><tr><td>51<td><code><pre> }</pre></code></table><div class=funcname id=fn_codec.Decode>func codec.Decode</div><div class=info><a href=#s_fn_codec.Decode>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/codec.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func (c *codec) Decode(opts ...utils.OptionExtender) Codecable {</pre></code><tr><td>50<td><code><pre> for i, p := 0, len(c.decOpts); i < len(opts); i++ {</pre></code><tr><td>51<td><code><pre> c.queue = append(c.queue, [2]int{p + i, 1})</pre></code><tr><td>52<td><code><pre> }</pre></code><tr><td>53<td><code><pre> c.decOpts = append(c.decOpts, opts...)</pre></code><tr><td>54<td><code><pre> return c</pre></code><tr><td>55<td><code><pre>}</pre></code></table><div class=funcname id=fn_codec.Encode>func codec.Encode</div><div class=info><a href=#s_fn_codec.Encode>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/codec.go</code>:</div><table class=listing><tr><td>42<td><code><pre>func (c *codec) Encode(opts ...utils.OptionExtender) Codecable {</pre></code><tr><td>43<td><code><pre> for i, p := 0, len(c.encOpts); i < len(opts); i++ {</pre></code><tr><td>44<td><code><pre> c.queue = append(c.queue, [2]int{p + i, 0})</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre> c.encOpts = append(c.encOpts, opts...)</pre></code><tr><td>47<td><code><pre> return c</pre></code><tr><td>48<td><code><pre>}</pre></code></table><div class=funcname id=fn_@133:9>func @133:9</div><div class=info><a href=#s_fn_@133:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/stream.go</code>:</div><table class=listing><tr><td>133<td><code><pre>func(src []byte) (dst []byte, err error) {</pre></code><tr><td>134<td><code><pre> dst = make([]byte, encodedLenFunc(len(src)))</pre></code><tr><td>135<td><code><pre> encodeFunc(dst, src)</pre></code><tr><td>136<td><code><pre> return</pre></code><tr><td>137<td><code><pre> }</pre></code></table><div class=funcname id=fn_decoder.Close>func decoder.Close</div><div class=info><a href=#s_fn_decoder.Close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/stream.go</code>:</div><table class=listing><tr><td>212<td><code><pre>func (e *decoder) Close() { utils.CloseAnyway(e.r); utils.CloseAnyway(e.dec) }</pre></code></table><div class=funcname id=fn_encoder.Close>func encoder.Close</div><div class=info><a href=#s_fn_encoder.Close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/stream.go</code>:</div><table class=listing><tr><td>223<td><code><pre>func (e *encoder) Close() { utils.CloseAnyway(e.enc); utils.CloseAnyway(e.w) }</pre></code></table><div class=funcname id=fn_Cipher>func Cipher</div><div class=info><a href=#s_fn_Cipher>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/types.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func Cipher(algo cipher.Algorithm, mode cipher.Mode, key, iv []byte) utils.OptionFunc[option] {</pre></code><tr><td>46<td><code><pre> return func(o *option) {</pre></code><tr><td>47<td><code><pre> o.cipherAlgo = algo</pre></code><tr><td>48<td><code><pre> o.cipherMode = mode</pre></code><tr><td>49<td><code><pre> o.key = clone.SliceComparable(key)</pre></code><tr><td>50<td><code><pre> o.iv = clone.SliceComparable(iv)</pre></code><tr><td>51<td><code><pre> }</pre></code><tr><td>52<td><code><pre>}</pre></code></table><div class=funcname id=fn_Compress>func Compress</div><div class=info><a href=#s_fn_Compress>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/types.go</code>:</div><table class=listing><tr><td>54<td><code><pre>func Compress(algo compress.Algorithm) utils.OptionFunc[option] {</pre></code><tr><td>55<td><code><pre> return func(o *option) {</pre></code><tr><td>56<td><code><pre> o.compressAlgo = algo</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre>}</pre></code></table><div class=funcname id=fn_@38:26>func @38:26</div><div class=info><a href=#s_fn_@38:26>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/codec.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func(c *codec) { c.release() }</pre></code></table><div class=funcname id=fn_@55:9>func @55:9</div><div class=info><a href=#s_fn_@55:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/types.go</code>:</div><table class=listing><tr><td>55<td><code><pre>func(o *option) {</pre></code><tr><td>56<td><code><pre> o.compressAlgo = algo</pre></code><tr><td>57<td><code><pre> }</pre></code></table><div class=funcname id=fn_encoder.Write>func encoder.Write</div><div class=info><a href=#s_fn_encoder.Write>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/stream.go</code>:</div><table class=listing><tr><td>222<td><code><pre>func (e *encoder) Write(p []byte) (n int, err error) { return e.enc.Write(p) }</pre></code></table><div class=funcname id=fn_newEncoder>func newEncoder</div><div class=info><a href=#s_fn_newEncoder>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/stream.go</code>:</div><table class=listing><tr><td>218<td><code><pre>func newEncoder(enc, w io.Writer) io.Writer {</pre></code><tr><td>219<td><code><pre> return &encoder{enc: enc, w: w}</pre></code><tr><td>220<td><code><pre>}</pre></code></table><div class=funcname id=fn_Encode>func Encode</div><div class=info><a href=#s_fn_Encode>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/types.go</code>:</div><table class=listing><tr><td>60<td><code><pre>func Encode(algo Algorithm) utils.OptionFunc[option] {</pre></code><tr><td>61<td><code><pre> return func(o *option) {</pre></code><tr><td>62<td><code><pre> o.printableAlgo = algo</pre></code><tr><td>63<td><code><pre> }</pre></code><tr><td>64<td><code><pre>}</pre></code></table><div class=funcname id=fn_EncodedType.IsValid>func EncodedType.IsValid</div><div class=info><a href=#s_fn_EncodedType.IsValid>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/encode_type_enum.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func (e EncodedType) IsValid() bool {</pre></code><tr><td>37<td><code><pre> return encodeTypeEnum.IsValid(e)</pre></code><tr><td>38<td><code><pre>}</pre></code></table><div class=funcname id=fn_decoder.Read>func decoder.Read</div><div class=info><a href=#s_fn_decoder.Read>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/stream.go</code>:</div><table class=listing><tr><td>211<td><code><pre>func (e *decoder) Read(p []byte) (n int, err error) { return e.dec.Read(p) }</pre></code></table><div class=funcname id=fn_newDecoder>func newDecoder</div><div class=info><a href=#s_fn_newDecoder>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/stream.go</code>:</div><table class=listing><tr><td>207<td><code><pre>func newDecoder(dec, r io.Reader) io.Reader {</pre></code><tr><td>208<td><code><pre> return &decoder{dec: dec, r: r}</pre></code><tr><td>209<td><code><pre>}</pre></code></table><div class=funcname id=fn_Algorithm.IsValid>func Algorithm.IsValid</div><div class=info><a href=#s_fn_Algorithm.IsValid>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/algorithm_enum.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func (e Algorithm) IsValid() bool {</pre></code><tr><td>46<td><code><pre> return algorithmEnum.IsValid(e)</pre></code><tr><td>47<td><code><pre>}</pre></code></table><div class=funcname id=fn_Algorithm.String>func Algorithm.String</div><div class=info><a href=#s_fn_Algorithm.String>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/algorithm_enum.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func (e Algorithm) String() string {</pre></code><tr><td>42<td><code><pre> return algorithmEnum.String(e)</pre></code><tr><td>43<td><code><pre>}</pre></code></table><div class=funcname id=fn_@109:16>func @109:16</div><div class=info><a href=#s_fn_@109:16>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/stream.go</code>:</div><table class=listing><tr><td>109<td><code><pre>func(src, dst []byte) { hex.Encode(src, dst) }</pre></code></table><div class=funcname id=fn_@61:9>func @61:9</div><div class=info><a href=#s_fn_@61:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/types.go</code>:</div><table class=listing><tr><td>61<td><code><pre>func(o *option) {</pre></code><tr><td>62<td><code><pre> o.printableAlgo = algo</pre></code><tr><td>63<td><code><pre> }</pre></code></table><div class=funcname id=fn_NewEncodeFunc>func NewEncodeFunc</div><div class=info><a href=#s_fn_NewEncodeFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/stream.go</code>:</div><table class=listing><tr><td>102<td><code><pre>func NewEncodeFunc(algo Algorithm) func([]byte) ([]byte, error) {</pre></code><tr><td>103<td><code><pre> var (</pre></code><tr><td>104<td><code><pre> encodeFunc func(src, dst []byte)</pre></code><tr><td>105<td><code><pre> encodedLenFunc func(int) int</pre></code><tr><td>106<td><code><pre> )</pre></code><tr><td>107<td><code><pre> switch algo {</pre></code><tr><td>108<td><code><pre> case AlgorithmHex:</pre></code><tr><td>109<td><code><pre> encodeFunc = func(src, dst []byte) { hex.Encode(src, dst) }</pre></code><tr><td>110<td><code><pre> encodedLenFunc = hex.EncodedLen</pre></code><tr><td>111<td><code><pre> case AlgorithmBase32Std:</pre></code><tr><td>112<td><code><pre> encodeFunc = base32.StdEncoding.Encode</pre></code><tr><td>113<td><code><pre> encodedLenFunc = base32.StdEncoding.EncodedLen</pre></code><tr><td>114<td><code><pre> case AlgorithmBase32Hex:</pre></code><tr><td>115<td><code><pre> encodeFunc = base32.HexEncoding.Encode</pre></code><tr><td>116<td><code><pre> encodedLenFunc = base32.HexEncoding.EncodedLen</pre></code><tr><td>117<td><code><pre> case AlgorithmBase64Std:</pre></code><tr><td>118<td><code><pre> encodeFunc = base64.StdEncoding.Encode</pre></code><tr><td>119<td><code><pre> encodedLenFunc = base64.StdEncoding.EncodedLen</pre></code><tr><td>120<td><code><pre> case AlgorithmBase64URL:</pre></code><tr><td>121<td><code><pre> encodeFunc = base64.URLEncoding.Encode</pre></code><tr><td>122<td><code><pre> encodedLenFunc = base64.URLEncoding.EncodedLen</pre></code><tr><td>123<td><code><pre> case AlgorithmBase64RawStd:</pre></code><tr><td>124<td><code><pre> encodeFunc = base64.RawStdEncoding.Encode</pre></code><tr><td>125<td><code><pre> encodedLenFunc = base64.RawStdEncoding.EncodedLen</pre></code><tr><td>126<td><code><pre> case AlgorithmBase64RawURL:</pre></code><tr><td>127<td><code><pre> encodeFunc = base64.RawURLEncoding.Encode</pre></code><tr><td>128<td><code><pre> encodedLenFunc = base64.RawURLEncoding.EncodedLen</pre></code><tr><td>129<td><code><pre> default:</pre></code><tr class=miss><td>130<td><code><pre> panic(ErrUnknownAlgorithm)</pre></code><tr><td>131<td><code><pre> }</pre></code><tr><td>132<td><code><pre></pre></code><tr><td>133<td><code><pre> return func(src []byte) (dst []byte, err error) {</pre></code><tr><td>134<td><code><pre> dst = make([]byte, encodedLenFunc(len(src)))</pre></code><tr><td>135<td><code><pre> encodeFunc(dst, src)</pre></code><tr><td>136<td><code><pre> return</pre></code><tr><td>137<td><code><pre> }</pre></code><tr><td>138<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewDecodeFunc>func NewDecodeFunc</div><div class=info><a href=#s_fn_NewDecodeFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/stream.go</code>:</div><table class=listing><tr><td>162<td><code><pre>func NewDecodeFunc(algo Algorithm) func([]byte) ([]byte, error) {</pre></code><tr><td>163<td><code><pre> var (</pre></code><tr><td>164<td><code><pre> decodeFunc func(src, dst []byte) (int, error)</pre></code><tr><td>165<td><code><pre> decodedLenFunc func(int) int</pre></code><tr><td>166<td><code><pre> )</pre></code><tr><td>167<td><code><pre> switch algo {</pre></code><tr><td>168<td><code><pre> case AlgorithmHex:</pre></code><tr><td>169<td><code><pre> decodeFunc = hex.Decode</pre></code><tr><td>170<td><code><pre> decodedLenFunc = hex.DecodedLen</pre></code><tr><td>171<td><code><pre> case AlgorithmBase32Std:</pre></code><tr><td>172<td><code><pre> decodeFunc = base32.StdEncoding.Decode</pre></code><tr><td>173<td><code><pre> decodedLenFunc = base32.StdEncoding.DecodedLen</pre></code><tr><td>174<td><code><pre> case AlgorithmBase32Hex:</pre></code><tr><td>175<td><code><pre> decodeFunc = base32.HexEncoding.Decode</pre></code><tr><td>176<td><code><pre> decodedLenFunc = base32.HexEncoding.DecodedLen</pre></code><tr><td>177<td><code><pre> case AlgorithmBase64Std:</pre></code><tr><td>178<td><code><pre> decodeFunc = base64.StdEncoding.Decode</pre></code><tr><td>179<td><code><pre> decodedLenFunc = base64.StdEncoding.DecodedLen</pre></code><tr><td>180<td><code><pre> case AlgorithmBase64URL:</pre></code><tr><td>181<td><code><pre> decodeFunc = base64.URLEncoding.Decode</pre></code><tr><td>182<td><code><pre> decodedLenFunc = base64.URLEncoding.DecodedLen</pre></code><tr><td>183<td><code><pre> case AlgorithmBase64RawStd:</pre></code><tr><td>184<td><code><pre> decodeFunc = base64.RawStdEncoding.Decode</pre></code><tr><td>185<td><code><pre> decodedLenFunc = base64.RawStdEncoding.DecodedLen</pre></code><tr><td>186<td><code><pre> case AlgorithmBase64RawURL:</pre></code><tr><td>187<td><code><pre> decodeFunc = base64.RawURLEncoding.Decode</pre></code><tr><td>188<td><code><pre> decodedLenFunc = base64.RawURLEncoding.DecodedLen</pre></code><tr><td>189<td><code><pre> default:</pre></code><tr class=miss><td>190<td><code><pre> panic(ErrUnknownAlgorithm)</pre></code><tr><td>191<td><code><pre> }</pre></code><tr><td>192<td><code><pre></pre></code><tr><td>193<td><code><pre> return func(src []byte) (dst []byte, err error) {</pre></code><tr><td>194<td><code><pre> dst = make([]byte, decodedLenFunc(len(src)))</pre></code><tr><td>195<td><code><pre> n, err := decodeFunc(dst, src)</pre></code><tr><td>196<td><code><pre> if err == nil {</pre></code><tr><td>197<td><code><pre> dst = dst[:n]</pre></code><tr><td>198<td><code><pre> }</pre></code><tr><td>199<td><code><pre> return</pre></code><tr><td>200<td><code><pre> }</pre></code><tr><td>201<td><code><pre>}</pre></code></table><div class=funcname id=fn_codecStream.Encode>func codecStream.Encode</div><div class=info><a href=#s_fn_codecStream.Encode>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/stream.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func (w *codecStream) Encode(dst io.Writer, src io.Reader) (n int64, err error) {</pre></code><tr><td>37<td><code><pre> for i := len(w.encodeOrder) - 1; i >= 0; i-- {</pre></code><tr><td>38<td><code><pre> switch w.encodeOrder[i] {</pre></code><tr><td>39<td><code><pre> case EncodedTypeCompress:</pre></code><tr><td>40<td><code><pre> dst = compress.NewEncFunc(w.o.compressAlgo)(dst)</pre></code><tr><td>41<td><code><pre> case EncodedTypeCipher:</pre></code><tr><td>42<td><code><pre> dst = cipher.NewEncFunc(w.o.cipherAlgo, w.o.cipherMode, w.o.key, w.o.iv)(dst)</pre></code><tr><td>43<td><code><pre> case EncodedTypeEncode:</pre></code><tr><td>44<td><code><pre> dst = NewWriter(w.o.printableAlgo, dst)</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre></pre></code><tr><td>48<td><code><pre> buf, cb := utils.BytesPool.Get(defaultBufferSize)</pre></code><tr><td>49<td><code><pre> defer cb()</pre></code><tr><td>50<td><code><pre></pre></code><tr><td>51<td><code><pre> defer utils.CloseAnyway(dst)</pre></code><tr><td>52<td><code><pre> n, err = io.CopyBuffer(dst, src, buf)</pre></code><tr><td>53<td><code><pre> if errors.Is(err, io.ErrUnexpectedEOF) || errors.Is(err, io.EOF) {</pre></code><tr class=miss><td>54<td><code><pre> err = nil</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre> return</pre></code><tr><td>57<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewWriter>func NewWriter</div><div class=info><a href=#s_fn_NewWriter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/stream.go</code>:</div><table class=listing><tr><td>81<td><code><pre>func NewWriter(algo Algorithm, w io.Writer) io.Writer {</pre></code><tr><td>82<td><code><pre> switch algo {</pre></code><tr><td>83<td><code><pre> case AlgorithmHex:</pre></code><tr><td>84<td><code><pre> return newEncoder(hex.NewEncoder(w), w)</pre></code><tr><td>85<td><code><pre> case AlgorithmBase32Std:</pre></code><tr><td>86<td><code><pre> return newEncoder(base32.NewEncoder(base32.StdEncoding, w), w)</pre></code><tr><td>87<td><code><pre> case AlgorithmBase32Hex:</pre></code><tr><td>88<td><code><pre> return newEncoder(base32.NewEncoder(base32.HexEncoding, w), w)</pre></code><tr><td>89<td><code><pre> case AlgorithmBase64Std:</pre></code><tr><td>90<td><code><pre> return newEncoder(base64.NewEncoder(base64.StdEncoding, w), w)</pre></code><tr><td>91<td><code><pre> case AlgorithmBase64URL:</pre></code><tr><td>92<td><code><pre> return newEncoder(base64.NewEncoder(base64.URLEncoding, w), w)</pre></code><tr><td>93<td><code><pre> case AlgorithmBase64RawStd:</pre></code><tr><td>94<td><code><pre> return newEncoder(base64.NewEncoder(base64.RawStdEncoding, w), w)</pre></code><tr><td>95<td><code><pre> case AlgorithmBase64RawURL:</pre></code><tr><td>96<td><code><pre> return newEncoder(base64.NewEncoder(base64.RawURLEncoding, w), w)</pre></code><tr><td>97<td><code><pre> default:</pre></code><tr class=miss><td>98<td><code><pre> panic(ErrUnknownAlgorithm)</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre>}</pre></code></table><div class=funcname id=fn_From>func From</div><div class=info><a href=#s_fn_From>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/codec.go</code>:</div><table class=listing><tr><td>21<td><code><pre>func From[T ~[]byte | ~string](src T) (c Codecable) {</pre></code><tr><td>22<td><code><pre> buf, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>23<td><code><pre></pre></code><tr><td>24<td><code><pre> switch v := any(src).(type) {</pre></code><tr><td>25<td><code><pre> case []byte:</pre></code><tr><td>26<td><code><pre> buf.Write(v)</pre></code><tr><td>27<td><code><pre> case string:</pre></code><tr><td>28<td><code><pre> buf.WriteString(v)</pre></code><tr><td>29<td><code><pre> default:</pre></code><tr class=miss><td>30<td><code><pre> buf.Write([]byte(src))</pre></code><tr><td>31<td><code><pre> }</pre></code><tr><td>32<td><code><pre></pre></code><tr><td>33<td><code><pre> c = &codec{</pre></code><tr><td>34<td><code><pre> buf: buf,</pre></code><tr><td>35<td><code><pre> release: cb,</pre></code><tr><td>36<td><code><pre> }</pre></code><tr><td>37<td><code><pre></pre></code><tr><td>38<td><code><pre> runtime.SetFinalizer(c, func(c *codec) { c.release() })</pre></code><tr><td>39<td><code><pre> return</pre></code><tr><td>40<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewCodecStream>func NewCodecStream</div><div class=info><a href=#s_fn_NewCodecStream>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/stream.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func NewCodecStream(opts ...utils.OptionExtender) Streamable {</pre></code><tr><td>16<td><code><pre> encodeOrder := make([]EncodedType, 0, len(opts))</pre></code><tr><td>17<td><code><pre> for _, opt := range opts {</pre></code><tr><td>18<td><code><pre> if encType := parseEncodedType(opt); encType.IsValid() {</pre></code><tr><td>19<td><code><pre> encodeOrder = append(encodeOrder, encType)</pre></code><tr><td>20<td><code><pre> }</pre></code><tr><td>21<td><code><pre> }</pre></code><tr><td>22<td><code><pre> if len(encodeOrder) == 0 {</pre></code><tr class=miss><td>23<td><code><pre> panic(ErrEncodeMethodNotFound)</pre></code><tr><td>24<td><code><pre> }</pre></code><tr><td>25<td><code><pre> return &codecStream{</pre></code><tr><td>26<td><code><pre> o: utils.ApplyOptions[option](opts...),</pre></code><tr><td>27<td><code><pre> encodeOrder: encodeOrder,</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre>}</pre></code></table><div class=funcname id=fn_parseEncodedType>func parseEncodedType</div><div class=info><a href=#s_fn_parseEncodedType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/encode_type_enum.go</code>:</div><table class=listing><tr><td>54<td><code><pre>func parseEncodedType(one utils.OptionExtender) EncodedType {</pre></code><tr><td>55<td><code><pre> opts := utils.ApplyOptions[option](one)</pre></code><tr><td>56<td><code><pre> switch {</pre></code><tr><td>57<td><code><pre> case opts.cipherAlgo.IsValid():</pre></code><tr><td>58<td><code><pre> return EncodedTypeCipher</pre></code><tr><td>59<td><code><pre> case opts.compressAlgo.IsValid():</pre></code><tr><td>60<td><code><pre> return EncodedTypeCompress</pre></code><tr><td>61<td><code><pre> case opts.printableAlgo.IsValid():</pre></code><tr><td>62<td><code><pre> return EncodedTypeEncode</pre></code><tr><td>63<td><code><pre> default:</pre></code><tr class=miss><td>64<td><code><pre> return EncodedTypeUnknown</pre></code><tr><td>65<td><code><pre> }</pre></code><tr><td>66<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewReader>func NewReader</div><div class=info><a href=#s_fn_NewReader>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/stream.go</code>:</div><table class=listing><tr><td>140<td><code><pre>func NewReader(algo Algorithm, r io.Reader) io.Reader {</pre></code><tr><td>141<td><code><pre> switch algo {</pre></code><tr><td>142<td><code><pre> case AlgorithmHex:</pre></code><tr><td>143<td><code><pre> return newDecoder(hex.NewDecoder(r), r)</pre></code><tr><td>144<td><code><pre> case AlgorithmBase32Std:</pre></code><tr><td>145<td><code><pre> return newDecoder(base32.NewDecoder(base32.StdEncoding, r), r)</pre></code><tr><td>146<td><code><pre> case AlgorithmBase32Hex:</pre></code><tr><td>147<td><code><pre> return newDecoder(base32.NewDecoder(base32.HexEncoding, r), r)</pre></code><tr><td>148<td><code><pre> case AlgorithmBase64Std:</pre></code><tr><td>149<td><code><pre> return newDecoder(base64.NewDecoder(base64.StdEncoding, r), r)</pre></code><tr><td>150<td><code><pre> case AlgorithmBase64URL:</pre></code><tr><td>151<td><code><pre> return newDecoder(base64.NewDecoder(base64.URLEncoding, r), r)</pre></code><tr><td>152<td><code><pre> case AlgorithmBase64RawStd:</pre></code><tr><td>153<td><code><pre> return newDecoder(base64.NewDecoder(base64.RawStdEncoding, r), r)</pre></code><tr><td>154<td><code><pre> case AlgorithmBase64RawURL:</pre></code><tr><td>155<td><code><pre> return newDecoder(base64.NewDecoder(base64.RawURLEncoding, r), r)</pre></code><tr><td>156<td><code><pre> default:</pre></code><tr class=miss><td>157<td><code><pre> panic(ErrUnknownAlgorithm)</pre></code><tr><td>158<td><code><pre> }</pre></code><tr class=miss><td>159<td><code><pre> return nil</pre></code><tr><td>160<td><code><pre>}</pre></code></table><div class=funcname id=fn_codec.ToBytes>func codec.ToBytes</div><div class=info><a href=#s_fn_codec.ToBytes>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/codec.go</code>:</div><table class=listing><tr><td>56<td><code><pre>func (c *codec) ToBytes() (dst []byte, err error) {</pre></code><tr><td>57<td><code><pre> if err = c.transform(); err != nil {</pre></code><tr class=miss><td>58<td><code><pre> return</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre> dst = make([]byte, c.buf.Len())</pre></code><tr><td>61<td><code><pre> copy(dst, c.buf.Bytes())</pre></code><tr><td>62<td><code><pre> return</pre></code><tr><td>63<td><code><pre>}</pre></code></table><div class=funcname id=fn_codec.decode>func codec.decode</div><div class=info><a href=#s_fn_codec.decode>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/codec.go</code>:</div><table class=listing><tr><td>114<td><code><pre>func (c *codec) decode(opt utils.OptionExtender) (err error) {</pre></code><tr><td>115<td><code><pre> var dec func([]byte) ([]byte, error)</pre></code><tr><td>116<td><code><pre></pre></code><tr><td>117<td><code><pre> switch option := utils.ApplyOptions[option](opt); parseEncodedType(opt) {</pre></code><tr><td>118<td><code><pre> case EncodedTypeCompress:</pre></code><tr><td>119<td><code><pre> dec = compress.DecodeBytesFunc(option.compressAlgo)</pre></code><tr><td>120<td><code><pre> case EncodedTypeCipher:</pre></code><tr><td>121<td><code><pre> dec, err = cipher.DecryptBytesFunc(option.cipherAlgo, option.cipherMode, option.key, option.iv)</pre></code><tr><td>122<td><code><pre> case EncodedTypeEncode:</pre></code><tr><td>123<td><code><pre> dec = NewDecodeFunc(option.printableAlgo)</pre></code><tr><td>124<td><code><pre> default:</pre></code><tr class=miss><td>125<td><code><pre> return ErrEncodeMethodNotFound</pre></code><tr><td>126<td><code><pre> }</pre></code><tr><td>127<td><code><pre> if err != nil {</pre></code><tr class=miss><td>128<td><code><pre> return</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre></pre></code><tr><td>131<td><code><pre> dst, err := dec(c.buf.Bytes())</pre></code><tr><td>132<td><code><pre> if err != nil {</pre></code><tr class=miss><td>133<td><code><pre> return</pre></code><tr><td>134<td><code><pre> }</pre></code><tr><td>135<td><code><pre> c.buf.Reset()</pre></code><tr><td>136<td><code><pre> c.buf.Write(dst)</pre></code><tr><td>137<td><code><pre> return</pre></code><tr><td>138<td><code><pre>}</pre></code></table><div class=funcname id=fn_codec.encode>func codec.encode</div><div class=info><a href=#s_fn_codec.encode>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/codec.go</code>:</div><table class=listing><tr><td>89<td><code><pre>func (c *codec) encode(opt utils.OptionExtender) (err error) {</pre></code><tr><td>90<td><code><pre> var enc func([]byte) ([]byte, error)</pre></code><tr><td>91<td><code><pre></pre></code><tr><td>92<td><code><pre> switch option := utils.ApplyOptions[option](opt); parseEncodedType(opt) {</pre></code><tr><td>93<td><code><pre> case EncodedTypeCompress:</pre></code><tr><td>94<td><code><pre> enc = compress.EncodeBytesFunc(option.compressAlgo)</pre></code><tr><td>95<td><code><pre> case EncodedTypeCipher:</pre></code><tr><td>96<td><code><pre> enc, err = cipher.EncryptBytesFunc(option.cipherAlgo, option.cipherMode, option.key, option.iv)</pre></code><tr><td>97<td><code><pre> case EncodedTypeEncode:</pre></code><tr><td>98<td><code><pre> enc = NewEncodeFunc(option.printableAlgo)</pre></code><tr><td>99<td><code><pre> default:</pre></code><tr class=miss><td>100<td><code><pre> return ErrEncodeMethodNotFound</pre></code><tr><td>101<td><code><pre> }</pre></code><tr><td>102<td><code><pre> if err != nil {</pre></code><tr class=miss><td>103<td><code><pre> return</pre></code><tr><td>104<td><code><pre> }</pre></code><tr><td>105<td><code><pre></pre></code><tr><td>106<td><code><pre> dst, err := enc(c.buf.Bytes())</pre></code><tr><td>107<td><code><pre> if err != nil {</pre></code><tr class=miss><td>108<td><code><pre> return</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre> c.buf.Reset()</pre></code><tr><td>111<td><code><pre> c.buf.Write(dst)</pre></code><tr><td>112<td><code><pre> return</pre></code><tr><td>113<td><code><pre>}</pre></code></table><div class=funcname id=fn_codec.transform>func codec.transform</div><div class=info><a href=#s_fn_codec.transform>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/codec.go</code>:</div><table class=listing><tr><td>72<td><code><pre>func (c *codec) transform() (err error) {</pre></code><tr><td>73<td><code><pre> for _, elem := range c.queue {</pre></code><tr><td>74<td><code><pre> idx, isEnc := elem[0], elem[1] == 0</pre></code><tr><td>75<td><code><pre> if isEnc {</pre></code><tr><td>76<td><code><pre> if err = c.encode(c.encOpts[idx]); err != nil {</pre></code><tr class=miss><td>77<td><code><pre> return</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre> } else {</pre></code><tr><td>80<td><code><pre> if err = c.decode(c.decOpts[idx]); err != nil {</pre></code><tr class=miss><td>81<td><code><pre> return</pre></code><tr><td>82<td><code><pre> }</pre></code><tr><td>83<td><code><pre></pre></code><tr><td>84<td><code><pre> }</pre></code><tr><td>85<td><code><pre> }</pre></code><tr><td>86<td><code><pre></pre></code><tr><td>87<td><code><pre> return</pre></code><tr><td>88<td><code><pre>}</pre></code></table><div class=funcname id=fn_codec.ToString>func codec.ToString</div><div class=info><a href=#s_fn_codec.ToString>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/codec.go</code>:</div><table class=listing><tr><td>64<td><code><pre>func (c *codec) ToString() (dst string, err error) {</pre></code><tr><td>65<td><code><pre> if err = c.transform(); err != nil {</pre></code><tr class=miss><td>66<td><code><pre> return</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre> dst = c.buf.String()</pre></code><tr><td>69<td><code><pre> return</pre></code><tr><td>70<td><code><pre>}</pre></code></table><div class=funcname id=fn_ParseAlgorithm>func ParseAlgorithm</div><div class=info><a href=#s_fn_ParseAlgorithm>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/algorithm_enum.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func ParseAlgorithm(s any) Algorithm {</pre></code><tr><td>50<td><code><pre> switch v := s.(type) {</pre></code><tr><td>51<td><code><pre> case string:</pre></code><tr><td>52<td><code><pre> if enumList := algorithmEnum.Enum(v); len(enumList) > 0 {</pre></code><tr><td>53<td><code><pre> return enumList[0]</pre></code><tr><td>54<td><code><pre> }</pre></code><tr><td>55<td><code><pre> case Algorithm:</pre></code><tr class=miss><td>56<td><code><pre> return v</pre></code><tr><td>57<td><code><pre> default:</pre></code><tr class=miss><td>58<td><code><pre> return Algorithm(cast.ToInt(s))</pre></code><tr><td>59<td><code><pre> }</pre></code><tr class=miss><td>60<td><code><pre> return AlgorithmUnknown</pre></code><tr><td>61<td><code><pre>}</pre></code></table><div class=funcname id=fn_ParseEncodedType>func ParseEncodedType</div><div class=info><a href=#s_fn_ParseEncodedType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/encode_type_enum.go</code>:</div><table class=listing><tr><td>40<td><code><pre>func ParseEncodedType(s any) EncodedType {</pre></code><tr class=miss><td>41<td><code><pre> switch v := s.(type) {</pre></code><tr><td>42<td><code><pre> case string:</pre></code><tr class=miss><td>43<td><code><pre> if enumList := encodeTypeEnum.Enum(v); len(enumList) > 0 {</pre></code><tr class=miss><td>44<td><code><pre> return enumList[0]</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre> case EncodedType:</pre></code><tr class=miss><td>47<td><code><pre> return v</pre></code><tr><td>48<td><code><pre> default:</pre></code><tr class=miss><td>49<td><code><pre> return EncodedType(cast.ToInt(s))</pre></code><tr><td>50<td><code><pre> }</pre></code><tr class=miss><td>51<td><code><pre> return EncodedTypeUnknown</pre></code><tr><td>52<td><code><pre>}</pre></code></table><div class=funcname id=fn_EncodedType.Value>func EncodedType.Value</div><div class=info><a href=#s_fn_EncodedType.Value>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/encode_type_enum.go</code>:</div><table class=listing><tr><td>28<td><code><pre>func (e EncodedType) Value() uint8 {</pre></code><tr class=miss><td>29<td><code><pre> return uint8(e)</pre></code><tr><td>30<td><code><pre>}</pre></code></table><div class=funcname id=fn_EncodedType.String>func EncodedType.String</div><div class=info><a href=#s_fn_EncodedType.String>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/encode_type_enum.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func (e EncodedType) String() string {</pre></code><tr class=miss><td>33<td><code><pre> return encodeTypeEnum.String(e)</pre></code><tr><td>34<td><code><pre>}</pre></code></table><div class=funcname id=fn_Algorithm.Value>func Algorithm.Value</div><div class=info><a href=#s_fn_Algorithm.Value>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/encode/algorithm_enum.go</code>:</div><table class=listing><tr><td>37<td><code><pre>func (e Algorithm) Value() uint8 {</pre></code><tr class=miss><td>38<td><code><pre> return uint8(e)</pre></code><tr><td>39<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/common/utils/inspect class=funcname>Package Overview: github.com/wfusion/gofusion/common/utils/inspect 18 <span class=packageTotal>67.7%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_@95:17><td><code><a href=#fn_@95:17>@95:17(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_packType><td><code><a href=#fn_packType>packType(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/rtype.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_Field.read><td><code><a href=#fn_Field.read>Field.read(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/field.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_Field.addr><td><code><a href=#fn_Field.addr>Field.addr(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/field.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@106:17><td><code><a href=#fn_@106:17>@106:17(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_derefValue><td><code><a href=#fn_derefValue>derefValue(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/field.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_eface.pack><td><code><a href=#fn_eface.pack>eface.pack(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/rtype.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@71:14><td><code><a href=#fn_@71:14>@71:14(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/rtype.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_GetField><td><code><a href=#fn_GetField>GetField(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/field_go118.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_SetField><td><code><a href=#fn_SetField>SetField(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/field_go118.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_newField><td><code><a href=#fn_newField>newField(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/field.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_unpackType><td><code><a href=#fn_unpackType>unpackType(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/rtype.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_enumerateTypes><td><code><a href=#fn_enumerateTypes>enumerateTypes(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/init_go118.go</code><td class=percent><code>91.7%</code><td class=linecount><code>11/12</code><tr id=s_fn_enumerateFuncs><td><code><a href=#fn_enumerateFuncs>enumerateFuncs(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/init_go118.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_TypeOf><td><code><a href=#fn_TypeOf>TypeOf(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_FuncOf><td><code><a href=#fn_FuncOf>FuncOf(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_Field.Set><td><code><a href=#fn_Field.Set>Field.Set(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/field.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_FieldByName><td><code><a href=#fn_FieldByName>FieldByName(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/field_go118.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_mustOk><td><code><a href=#fn_mustOk>mustOk(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/misc_go118.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_Field.Get><td><code><a href=#fn_Field.Get>Field.Get(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/field.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_@80:17><td><code><a href=#fn_@80:17>@80:17(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_@56:17><td><code><a href=#fn_@56:17>@56:17(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_getField><td><code><a href=#fn_getField>getField(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/field_go118.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_FieldAt><td><code><a href=#fn_FieldAt>FieldAt(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/field_go118.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_derefType><td><code><a href=#fn_derefType>derefType(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/field.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_setField><td><code><a href=#fn_setField>setField(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/field_go118.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_RuntimeFuncOf><td><code><a href=#fn_RuntimeFuncOf>RuntimeFuncOf(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_RuntimeTypeOf><td><code><a href=#fn_RuntimeTypeOf>RuntimeTypeOf(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code></table><div class=funcname id=fn_@95:17>func @95:17</div><div class=info><a href=#s_fn_@95:17>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code>:</div><table class=listing><tr><td>95<td><code><pre>func(typ reflect.Type) bool {</pre></code><tr><td>96<td><code><pre> pkgName := typ.PkgPath()</pre></code><tr><td>97<td><code><pre> typeName := typ.Name()</pre></code><tr><td>98<td><code><pre> if pkgName != "" && typeName != "" {</pre></code><tr><td>99<td><code><pre> structs[pkgName+"."+typeName] = typ</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre></pre></code><tr><td>102<td><code><pre> return true</pre></code><tr><td>103<td><code><pre> }</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code>:</div><table class=listing><tr><td>90<td><code><pre>func init() {</pre></code><tr><td>91<td><code><pre> lock.Lock()</pre></code><tr><td>92<td><code><pre> defer lock.Unlock()</pre></code><tr><td>93<td><code><pre></pre></code><tr><td>94<td><code><pre> // inspect structs</pre></code><tr><td>95<td><code><pre> enumerateTypes(func(typ reflect.Type) bool {</pre></code><tr><td>96<td><code><pre> pkgName := typ.PkgPath()</pre></code><tr><td>97<td><code><pre> typeName := typ.Name()</pre></code><tr><td>98<td><code><pre> if pkgName != "" && typeName != "" {</pre></code><tr><td>99<td><code><pre> structs[pkgName+"."+typeName] = typ</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre></pre></code><tr><td>102<td><code><pre> return true</pre></code><tr><td>103<td><code><pre> })</pre></code><tr><td>104<td><code><pre></pre></code><tr><td>105<td><code><pre> // inspect function</pre></code><tr><td>106<td><code><pre> enumerateFuncs(func(fn *runtime.Func, addr uintptr) bool {</pre></code><tr><td>107<td><code><pre> if funcName := fn.Name(); funcName != "" {</pre></code><tr><td>108<td><code><pre> funcs[funcName] = unsafe.Pointer(&addr)</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre> return true</pre></code><tr><td>111<td><code><pre> })</pre></code><tr><td>112<td><code><pre>}</pre></code></table><div class=funcname id=fn_packType>func packType</div><div class=info><a href=#s_fn_packType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/rtype.go</code>:</div><table class=listing><tr><td>81<td><code><pre>func packType(t *rtype) (r reflect.Type) {</pre></code><tr><td>82<td><code><pre> (*iface)(unsafe.Pointer(&r)).tab = itabRtype</pre></code><tr><td>83<td><code><pre> (*iface)(unsafe.Pointer(&r)).data = unsafe.Pointer(t)</pre></code><tr><td>84<td><code><pre> return</pre></code><tr><td>85<td><code><pre>}</pre></code></table><div class=funcname id=fn_Field.read>func Field.read</div><div class=info><a href=#s_fn_Field.read>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/field.go</code>:</div><table class=listing><tr><td>34<td><code><pre>func (f Field) read() eface {</pre></code><tr><td>35<td><code><pre> if ifaceIndir(f.t) {</pre></code><tr><td>36<td><code><pre> return eface{_type: f.t, data: f.p}</pre></code><tr><td>37<td><code><pre> } else {</pre></code><tr><td>38<td><code><pre> return eface{_type: f.t, data: *(*unsafe.Pointer)(f.p)}</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre>}</pre></code></table><div class=funcname id=fn_Field.addr>func Field.addr</div><div class=info><a href=#s_fn_Field.addr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/field.go</code>:</div><table class=listing><tr><td>42<td><code><pre>func (f Field) addr(v reflect.Value) unsafe.Pointer {</pre></code><tr><td>43<td><code><pre> if ifaceIndir(f.t) {</pre></code><tr><td>44<td><code><pre> return (*eface)(unsafe.Pointer(&v)).data</pre></code><tr><td>45<td><code><pre> } else {</pre></code><tr><td>46<td><code><pre> return unsafe.Pointer(&((*eface)(unsafe.Pointer(&v)).data))</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre>}</pre></code></table><div class=funcname id=fn_@106:17>func @106:17</div><div class=info><a href=#s_fn_@106:17>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code>:</div><table class=listing><tr><td>106<td><code><pre>func(fn *runtime.Func, addr uintptr) bool {</pre></code><tr><td>107<td><code><pre> if funcName := fn.Name(); funcName != "" {</pre></code><tr><td>108<td><code><pre> funcs[funcName] = unsafe.Pointer(&addr)</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre> return true</pre></code><tr><td>111<td><code><pre> }</pre></code></table><div class=funcname id=fn_derefValue>func derefValue</div><div class=info><a href=#s_fn_derefValue>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/field.go</code>:</div><table class=listing><tr><td>64<td><code><pre>func derefValue(t reflect.Value) reflect.Value {</pre></code><tr><td>65<td><code><pre> for t.Kind() == reflect.Ptr {</pre></code><tr><td>66<td><code><pre> t = t.Elem()</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre> return t</pre></code><tr><td>69<td><code><pre>}</pre></code></table><div class=funcname id=fn_eface.pack>func eface.pack</div><div class=info><a href=#s_fn_eface.pack>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/rtype.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func (e eface) pack() (r interface{}) { *(*eface)(unsafe.Pointer(&r)) = e; return }</pre></code></table><div class=funcname id=fn_@71:14>func @71:14</div><div class=info><a href=#s_fn_@71:14>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/rtype.go</code>:</div><table class=listing><tr><td>71<td><code><pre>func(v interface{}) *itab {</pre></code><tr><td>72<td><code><pre> t := reflect.TypeOf(v).Elem()</pre></code><tr><td>73<td><code><pre> return (*iface)(unsafe.Pointer(&t)).tab</pre></code><tr><td>74<td><code><pre> }</pre></code></table><div class=funcname id=fn_GetField>func GetField</div><div class=info><a href=#s_fn_GetField>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/field_go118.go</code>:</div><table class=listing><tr><td>35<td><code><pre>func GetField[T any](obj any, fieldName string) (r T) {</pre></code><tr><td>36<td><code><pre> r, _ = mustOk(FieldByName(derefValue(reflect.ValueOf(obj)), fieldName)).Get().Interface().(T)</pre></code><tr><td>37<td><code><pre> return</pre></code><tr><td>38<td><code><pre>}</pre></code></table><div class=funcname id=fn_SetField>func SetField</div><div class=info><a href=#s_fn_SetField>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/field_go118.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func SetField[T any](obj any, fieldName string, val T) {</pre></code><tr><td>32<td><code><pre> mustOk(FieldByName(derefValue(reflect.ValueOf(obj)), fieldName)).Set(reflect.ValueOf(val))</pre></code><tr><td>33<td><code><pre>}</pre></code></table><div class=funcname id=fn_newField>func newField</div><div class=info><a href=#s_fn_newField>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/field.go</code>:</div><table class=listing><tr><td>50<td><code><pre>func newField(v reflect.Value, fv reflect.StructField) Field {</pre></code><tr><td>51<td><code><pre> return Field{</pre></code><tr><td>52<td><code><pre> t: unpackType(fv.Type),</pre></code><tr><td>53<td><code><pre> p: unsafe.Pointer(uintptr((*eface)(unsafe.Pointer(&v)).data) + fv.Offset),</pre></code><tr><td>54<td><code><pre> }</pre></code><tr><td>55<td><code><pre>}</pre></code></table><div class=funcname id=fn_unpackType>func unpackType</div><div class=info><a href=#s_fn_unpackType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/rtype.go</code>:</div><table class=listing><tr><td>77<td><code><pre>func unpackType(t reflect.Type) *rtype {</pre></code><tr><td>78<td><code><pre> return (*rtype)((*eface)(unsafe.Pointer(&t)).data)</pre></code><tr><td>79<td><code><pre>}</pre></code></table><div class=funcname id=fn_enumerateTypes>func enumerateTypes</div><div class=info><a href=#s_fn_enumerateTypes>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/init_go118.go</code>:</div><table class=listing><tr><td>12<td><code><pre>func enumerateTypes(cb func(reflect.Type) bool) {</pre></code><tr><td>13<td><code><pre> t0 := reflect.TypeOf(struct{}{})</pre></code><tr><td>14<td><code><pre> sections, typeLinks := typelinks()</pre></code><tr><td>15<td><code><pre> for i, typeLink := range typeLinks {</pre></code><tr><td>16<td><code><pre> for _, link := range typeLink {</pre></code><tr><td>17<td><code><pre> (*eface)(unsafe.Pointer(&t0)).data = resolveTypeOff(sections[i], link)</pre></code><tr><td>18<td><code><pre> if t0.Kind() != reflect.Ptr || !supportTypes[t0.Elem().Kind()] {</pre></code><tr><td>19<td><code><pre> continue</pre></code><tr><td>20<td><code><pre> }</pre></code><tr><td>21<td><code><pre> typ := t0.Elem()</pre></code><tr><td>22<td><code><pre> if typ.PkgPath() == "" || typ.Name() == "" {</pre></code><tr><td>23<td><code><pre> continue</pre></code><tr><td>24<td><code><pre> }</pre></code><tr><td>25<td><code><pre> if !cb(typ) {</pre></code><tr class=miss><td>26<td><code><pre> return</pre></code><tr><td>27<td><code><pre> }</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre> }</pre></code><tr><td>30<td><code><pre>}</pre></code></table><div class=funcname id=fn_enumerateFuncs>func enumerateFuncs</div><div class=info><a href=#s_fn_enumerateFuncs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/init_go118.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func enumerateFuncs(cb func(*runtime.Func, uintptr) bool) {</pre></code><tr><td>33<td><code><pre> for _, md := range activeModules() {</pre></code><tr><td>34<td><code><pre> for _, tab := range md.ftab {</pre></code><tr><td>35<td><code><pre> f := tab // should not take from &tab.entry because go syntax</pre></code><tr><td>36<td><code><pre> absoluteAddr := textAddr(md, f.entry)</pre></code><tr><td>37<td><code><pre> if fn := runtime.FuncForPC(absoluteAddr); fn != nil {</pre></code><tr><td>38<td><code><pre> if !cb(fn, absoluteAddr) {</pre></code><tr class=miss><td>39<td><code><pre> return</pre></code><tr><td>40<td><code><pre> }</pre></code><tr><td>41<td><code><pre> }</pre></code><tr><td>42<td><code><pre> }</pre></code><tr><td>43<td><code><pre> }</pre></code><tr><td>44<td><code><pre>}</pre></code></table><div class=funcname id=fn_TypeOf>func TypeOf</div><div class=info><a href=#s_fn_TypeOf>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func TypeOf(typeName string) reflect.Type {</pre></code><tr><td>46<td><code><pre> lock.RLock()</pre></code><tr><td>47<td><code><pre> defer lock.RUnlock()</pre></code><tr><td>48<td><code><pre> if typ, ok := structs[typeName]; ok {</pre></code><tr><td>49<td><code><pre> return typ</pre></code><tr><td>50<td><code><pre> }</pre></code><tr class=miss><td>51<td><code><pre> return nil</pre></code><tr><td>52<td><code><pre>}</pre></code></table><div class=funcname id=fn_FuncOf>func FuncOf</div><div class=info><a href=#s_fn_FuncOf>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code>:</div><table class=listing><tr><td>68<td><code><pre>func FuncOf(funcName string) unsafe.Pointer {</pre></code><tr><td>69<td><code><pre> lock.RLock()</pre></code><tr><td>70<td><code><pre> defer lock.RUnlock()</pre></code><tr><td>71<td><code><pre> if entry, ok := funcs[funcName]; ok {</pre></code><tr><td>72<td><code><pre> return unsafe.Pointer(&entry)</pre></code><tr><td>73<td><code><pre> }</pre></code><tr class=miss><td>74<td><code><pre> return nil</pre></code><tr><td>75<td><code><pre>}</pre></code></table><div class=funcname id=fn_Field.Set>func Field.Set</div><div class=info><a href=#s_fn_Field.Set>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/field.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func (f Field) Set(v reflect.Value) {</pre></code><tr><td>26<td><code><pre> if f.t == nil {</pre></code><tr class=miss><td>27<td><code><pre> panic(errors.New("inspect: invalid field"))</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre></pre></code><tr><td>30<td><code><pre> v = v.Convert(packType(f.t))</pre></code><tr><td>31<td><code><pre> typedmemmove(f.t, f.p, f.addr(v))</pre></code><tr><td>32<td><code><pre>}</pre></code></table><div class=funcname id=fn_FieldByName>func FieldByName</div><div class=info><a href=#s_fn_FieldByName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/field_go118.go</code>:</div><table class=listing><tr><td>14<td><code><pre>func FieldByName(v reflect.Value, name string) (Field, bool) {</pre></code><tr><td>15<td><code><pre> if fv, ok := v.Type().FieldByName(name); !ok {</pre></code><tr class=miss><td>16<td><code><pre> return Field{}, false</pre></code><tr><td>17<td><code><pre> } else {</pre></code><tr><td>18<td><code><pre> return newField(v, fv), true</pre></code><tr><td>19<td><code><pre> }</pre></code><tr><td>20<td><code><pre>}</pre></code></table><div class=funcname id=fn_mustOk>func mustOk</div><div class=info><a href=#s_fn_mustOk>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/misc_go118.go</code>:</div><table class=listing><tr><td>8<td><code><pre>func mustOk[T any](out T, ok bool) T {</pre></code><tr><td>9<td><code><pre> if !ok {</pre></code><tr class=miss><td>10<td><code><pre> panic(errors.Errorf("get %T with ok is false", out))</pre></code><tr><td>11<td><code><pre> }</pre></code><tr><td>12<td><code><pre> return out</pre></code><tr><td>13<td><code><pre>}</pre></code></table><div class=funcname id=fn_Field.Get>func Field.Get</div><div class=info><a href=#s_fn_Field.Get>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/field.go</code>:</div><table class=listing><tr><td>17<td><code><pre>func (f Field) Get() reflect.Value {</pre></code><tr><td>18<td><code><pre> if f.t == nil {</pre></code><tr class=miss><td>19<td><code><pre> panic(errors.New("inspect: invalid field"))</pre></code><tr><td>20<td><code><pre> }</pre></code><tr><td>21<td><code><pre> return reflect.ValueOf(f.read().pack())</pre></code><tr><td>22<td><code><pre>}</pre></code></table><div class=funcname id=fn_@80:17>func @80:17</div><div class=info><a href=#s_fn_@80:17>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code>:</div><table class=listing><tr><td>80<td><code><pre>func(fn *runtime.Func, addr uintptr) bool {</pre></code><tr class=miss><td>81<td><code><pre> if fn.Name() == funcName {</pre></code><tr class=miss><td>82<td><code><pre> r = unsafe.Pointer(&addr)</pre></code><tr class=miss><td>83<td><code><pre> return false</pre></code><tr><td>84<td><code><pre> }</pre></code><tr class=miss><td>85<td><code><pre> return true</pre></code><tr><td>86<td><code><pre> }</pre></code></table><div class=funcname id=fn_@56:17>func @56:17</div><div class=info><a href=#s_fn_@56:17>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code>:</div><table class=listing><tr><td>56<td><code><pre>func(typ reflect.Type) bool {</pre></code><tr class=miss><td>57<td><code><pre> if typ.PkgPath()+"."+typ.Name() == typeName {</pre></code><tr class=miss><td>58<td><code><pre> r = typ</pre></code><tr class=miss><td>59<td><code><pre> return false</pre></code><tr><td>60<td><code><pre> }</pre></code><tr class=miss><td>61<td><code><pre> return true</pre></code><tr><td>62<td><code><pre> }</pre></code></table><div class=funcname id=fn_getField>func getField</div><div class=info><a href=#s_fn_getField>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/field_go118.go</code>:</div><table class=listing><tr><td>48<td><code><pre>func getField[T any](obj any, fieldName string) (r T) {</pre></code><tr class=miss><td>49<td><code><pre> v := reflect.Indirect(reflect.ValueOf(obj))</pre></code><tr class=miss><td>50<td><code><pre> r, _ = valueInterface(v.FieldByName(fieldName), false).(T)</pre></code><tr class=miss><td>51<td><code><pre> return</pre></code><tr><td>52<td><code><pre>}</pre></code></table><div class=funcname id=fn_FieldAt>func FieldAt</div><div class=info><a href=#s_fn_FieldAt>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/field_go118.go</code>:</div><table class=listing><tr><td>23<td><code><pre>func FieldAt(v reflect.Value, idx int) (Field, bool) {</pre></code><tr class=miss><td>24<td><code><pre> if idx < 0 || idx >= v.NumField() {</pre></code><tr class=miss><td>25<td><code><pre> return Field{}, false</pre></code><tr><td>26<td><code><pre> } else {</pre></code><tr class=miss><td>27<td><code><pre> return newField(v, v.Type().Field(idx)), true</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre>}</pre></code></table><div class=funcname id=fn_derefType>func derefType</div><div class=info><a href=#s_fn_derefType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/field.go</code>:</div><table class=listing><tr><td>57<td><code><pre>func derefType(t reflect.Type) reflect.Type {</pre></code><tr class=miss><td>58<td><code><pre> for t.Kind() == reflect.Ptr {</pre></code><tr class=miss><td>59<td><code><pre> t = t.Elem()</pre></code><tr><td>60<td><code><pre> }</pre></code><tr class=miss><td>61<td><code><pre> return t</pre></code><tr><td>62<td><code><pre>}</pre></code></table><div class=funcname id=fn_setField>func setField</div><div class=info><a href=#s_fn_setField>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/field_go118.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func setField[T any](obj any, fieldName string, val T) {</pre></code><tr class=miss><td>42<td><code><pre> v := reflect.ValueOf(obj)</pre></code><tr class=miss><td>43<td><code><pre> t := reflect.Indirect(v).Type()</pre></code><tr class=miss><td>44<td><code><pre> *(*T)(unsafe.Pointer(v.Pointer() + mustOk(t.FieldByName(fieldName)).Offset)) = val</pre></code><tr><td>45<td><code><pre>}</pre></code></table><div class=funcname id=fn_RuntimeFuncOf>func RuntimeFuncOf</div><div class=info><a href=#s_fn_RuntimeFuncOf>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code>:</div><table class=listing><tr><td>79<td><code><pre>func RuntimeFuncOf(funcName string) (r unsafe.Pointer) {</pre></code><tr class=miss><td>80<td><code><pre> enumerateFuncs(func(fn *runtime.Func, addr uintptr) bool {</pre></code><tr><td>81<td><code><pre> if fn.Name() == funcName {</pre></code><tr><td>82<td><code><pre> r = unsafe.Pointer(&addr)</pre></code><tr><td>83<td><code><pre> return false</pre></code><tr><td>84<td><code><pre> }</pre></code><tr><td>85<td><code><pre> return true</pre></code><tr><td>86<td><code><pre> })</pre></code><tr class=miss><td>87<td><code><pre> return</pre></code><tr><td>88<td><code><pre>}</pre></code></table><div class=funcname id=fn_RuntimeTypeOf>func RuntimeTypeOf</div><div class=info><a href=#s_fn_RuntimeTypeOf>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/inspect/inspect.go</code>:</div><table class=listing><tr><td>55<td><code><pre>func RuntimeTypeOf(typeName string) (r reflect.Type) {</pre></code><tr class=miss><td>56<td><code><pre> enumerateTypes(func(typ reflect.Type) bool {</pre></code><tr><td>57<td><code><pre> if typ.PkgPath()+"."+typ.Name() == typeName {</pre></code><tr><td>58<td><code><pre> r = typ</pre></code><tr><td>59<td><code><pre> return false</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre> return true</pre></code><tr><td>62<td><code><pre> })</pre></code><tr class=miss><td>63<td><code><pre> return</pre></code><tr><td>64<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/common/utils/serialize class=funcname>Package Overview: github.com/wfusion/gofusion/common/utils/serialize 19 <span class=packageTotal>66.7%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_@17:9><td><code><a href=#fn_@17:9>@17:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/unmarshal.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_@19:18><td><code><a href=#fn_@19:18>@19:18(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_@27:21><td><code><a href=#fn_@27:21>@27:21(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_@52:21><td><code><a href=#fn_@52:21>@52:21(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@55:9><td><code><a href=#fn_@55:9>@55:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/unmarshal.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@57:18><td><code><a href=#fn_@57:18>@57:18(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Algorithm.Value><td><code><a href=#fn_Algorithm.Value>Algorithm.Value(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/algorithm_enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@36:9><td><code><a href=#fn_@36:9>@36:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/marshal.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@16:17><td><code><a href=#fn_@16:17>@16:17(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Algorithm.IsValid><td><code><a href=#fn_Algorithm.IsValid>Algorithm.IsValid(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/algorithm_enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Algorithm.String><td><code><a href=#fn_Algorithm.String>Algorithm.String(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/algorithm_enum.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@33:18><td><code><a href=#fn_@33:18>@33:18(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@39:17><td><code><a href=#fn_@39:17>@39:17(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@83:9><td><code><a href=#fn_@83:9>@83:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_JsonEscapeHTML><td><code><a href=#fn_JsonEscapeHTML>JsonEscapeHTML(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@16:9><td><code><a href=#fn_@16:9>@16:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/marshal.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_ParseAlgorithm><td><code><a href=#fn_ParseAlgorithm>ParseAlgorithm(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/algorithm_enum.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_UnmarshalStreamFunc><td><code><a href=#fn_UnmarshalStreamFunc>UnmarshalStreamFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/unmarshal.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_MarshalFunc><td><code><a href=#fn_MarshalFunc>MarshalFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/marshal.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_UnmarshalFunc><td><code><a href=#fn_UnmarshalFunc>UnmarshalFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/unmarshal.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_MarshalStreamFunc><td><code><a href=#fn_MarshalStreamFunc>MarshalStreamFunc(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/marshal.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_@71:9><td><code><a href=#fn_@71:9>@71:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/unmarshal.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_UnmarshalStreamFuncByType><td><code><a href=#fn_UnmarshalStreamFuncByType>UnmarshalStreamFuncByType(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/unmarshal.go</code><td class=percent><code>75.0%</code><td class=linecount><code>6/8</code><tr id=s_fn_@42:18><td><code><a href=#fn_@42:18>@42:18(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>66.7%</code><td class=linecount><code>4/6</code><tr id=s_fn_UnmarshalFuncByType><td><code><a href=#fn_UnmarshalFuncByType>UnmarshalFuncByType(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/unmarshal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/8</code><tr id=s_fn_@37:9><td><code><a href=#fn_@37:9>@37:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/unmarshal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_JsonIndent><td><code><a href=#fn_JsonIndent>JsonIndent(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@106:9><td><code><a href=#fn_@106:9>@106:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@77:9><td><code><a href=#fn_@77:9>@77:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@71:9><td><code><a href=#fn_@71:9>@71:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_DisallowUnknownFields><td><code><a href=#fn_DisallowUnknownFields>DisallowUnknownFields(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@100:9><td><code><a href=#fn_@100:9>@100:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_MsgpackUseCompactInts><td><code><a href=#fn_MsgpackUseCompactInts>MsgpackUseCompactInts(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_JsonNumber><td><code><a href=#fn_JsonNumber>JsonNumber(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@89:9><td><code><a href=#fn_@89:9>@89:9(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_MsgpackUseCompactFloats><td><code><a href=#fn_MsgpackUseCompactFloats>MsgpackUseCompactFloats(...)</a></code><td><code>github.com/wfusion/gofusion/common/utils/serialize/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_@17:9>func @17:9</div><div class=info><a href=#s_fn_@17:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/unmarshal.go</code>:</div><table class=listing><tr><td>17<td><code><pre>func(src []byte) (dst T, err error) {</pre></code><tr><td>18<td><code><pre> bs, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>19<td><code><pre> defer cb()</pre></code><tr><td>20<td><code><pre></pre></code><tr><td>21<td><code><pre> bs.Write(src)</pre></code><tr><td>22<td><code><pre> err = fn(&dst, bs, opt)</pre></code><tr><td>23<td><code><pre> return</pre></code><tr><td>24<td><code><pre> }</pre></code></table><div class=funcname id=fn_@19:18>func @19:18</div><div class=info><a href=#s_fn_@19:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func(dst io.Writer, src any, opt *marshalOption) (err error) {</pre></code><tr><td>20<td><code><pre> enc := json.NewEncoder(dst)</pre></code><tr><td>21<td><code><pre> if !opt.jsonEscapeHTML {</pre></code><tr><td>22<td><code><pre> enc.SetEscapeHTML(false)</pre></code><tr><td>23<td><code><pre> }</pre></code><tr><td>24<td><code><pre> enc.SetIndent(opt.jsonIndentPrefix, opt.jsonIndent)</pre></code><tr><td>25<td><code><pre> return enc.Encode(src)</pre></code><tr><td>26<td><code><pre> }</pre></code></table><div class=funcname id=fn_@27:21>func @27:21</div><div class=info><a href=#s_fn_@27:21>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>27<td><code><pre>func(dst io.Writer, src any, opt *marshalOption) (err error) {</pre></code><tr><td>28<td><code><pre> enc := msgpack.NewEncoder(dst)</pre></code><tr><td>29<td><code><pre> enc.UseCompactInts(opt.msgpackUseCompactInts)</pre></code><tr><td>30<td><code><pre> enc.UseCompactFloats(opt.msgpackUseCompactFloats)</pre></code><tr><td>31<td><code><pre> return enc.Encode(src)</pre></code><tr><td>32<td><code><pre> }</pre></code></table><div class=funcname id=fn_@52:21>func @52:21</div><div class=info><a href=#s_fn_@52:21>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func(dst any, src io.Reader, opt *unmarshalOption) (err error) {</pre></code><tr><td>53<td><code><pre> dec := msgpack.NewDecoder(src)</pre></code><tr><td>54<td><code><pre> dec.DisallowUnknownFields(opt.disallowUnknownFields)</pre></code><tr><td>55<td><code><pre> return dec.Decode(dst)</pre></code><tr><td>56<td><code><pre> }</pre></code></table><div class=funcname id=fn_@55:9>func @55:9</div><div class=info><a href=#s_fn_@55:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/unmarshal.go</code>:</div><table class=listing><tr><td>55<td><code><pre>func(src io.Reader) (dst T, err error) {</pre></code><tr><td>56<td><code><pre> err = fn(&dst, src, opt)</pre></code><tr><td>57<td><code><pre> return</pre></code><tr><td>58<td><code><pre> }</pre></code></table><div class=funcname id=fn_@57:18>func @57:18</div><div class=info><a href=#s_fn_@57:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>57<td><code><pre>func(dst any, src io.Reader, opt *unmarshalOption) (err error) {</pre></code><tr><td>58<td><code><pre> return cbor.NewDecoder(src).Decode(dst)</pre></code><tr><td>59<td><code><pre> }</pre></code></table><div class=funcname id=fn_Algorithm.Value>func Algorithm.Value</div><div class=info><a href=#s_fn_Algorithm.Value>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/algorithm_enum.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func (e Algorithm) Value() uint8 {</pre></code><tr><td>32<td><code><pre> return uint8(e)</pre></code><tr><td>33<td><code><pre>}</pre></code></table><div class=funcname id=fn_@36:9>func @36:9</div><div class=info><a href=#s_fn_@36:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/marshal.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func(dst io.Writer, src any) error {</pre></code><tr><td>37<td><code><pre> return fn(dst, src, opt)</pre></code><tr><td>38<td><code><pre> }</pre></code></table><div class=funcname id=fn_@16:17>func @16:17</div><div class=info><a href=#s_fn_@16:17>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func(dst io.Writer, src any, opt *marshalOption) (err error) {</pre></code><tr><td>17<td><code><pre> return gob.NewEncoder(dst).Encode(src)</pre></code><tr><td>18<td><code><pre> }</pre></code></table><div class=funcname id=fn_Algorithm.IsValid>func Algorithm.IsValid</div><div class=info><a href=#s_fn_Algorithm.IsValid>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/algorithm_enum.go</code>:</div><table class=listing><tr><td>39<td><code><pre>func (e Algorithm) IsValid() bool {</pre></code><tr><td>40<td><code><pre> return algorithmEnum.IsValid(e)</pre></code><tr><td>41<td><code><pre>}</pre></code></table><div class=funcname id=fn_Algorithm.String>func Algorithm.String</div><div class=info><a href=#s_fn_Algorithm.String>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/algorithm_enum.go</code>:</div><table class=listing><tr><td>35<td><code><pre>func (e Algorithm) String() string {</pre></code><tr><td>36<td><code><pre> return algorithmEnum.String(e)</pre></code><tr><td>37<td><code><pre>}</pre></code></table><div class=funcname id=fn_@33:18>func @33:18</div><div class=info><a href=#s_fn_@33:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>33<td><code><pre>func(dst io.Writer, src any, opt *marshalOption) (err error) {</pre></code><tr><td>34<td><code><pre> return cbor.NewEncoder(dst).Encode(src)</pre></code><tr><td>35<td><code><pre> }</pre></code></table><div class=funcname id=fn_@39:17>func @39:17</div><div class=info><a href=#s_fn_@39:17>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>39<td><code><pre>func(dst any, src io.Reader, opt *unmarshalOption) (err error) {</pre></code><tr><td>40<td><code><pre> return gob.NewDecoder(src).Decode(dst)</pre></code><tr><td>41<td><code><pre> }</pre></code></table><div class=funcname id=fn_@83:9>func @83:9</div><div class=info><a href=#s_fn_@83:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>83<td><code><pre>func(o *marshalOption) {</pre></code><tr><td>84<td><code><pre> o.jsonEscapeHTML = on</pre></code><tr><td>85<td><code><pre> }</pre></code></table><div class=funcname id=fn_JsonEscapeHTML>func JsonEscapeHTML</div><div class=info><a href=#s_fn_JsonEscapeHTML>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>82<td><code><pre>func JsonEscapeHTML(on bool) utils.OptionFunc[marshalOption] {</pre></code><tr><td>83<td><code><pre> return func(o *marshalOption) {</pre></code><tr><td>84<td><code><pre> o.jsonEscapeHTML = on</pre></code><tr><td>85<td><code><pre> }</pre></code><tr><td>86<td><code><pre>}</pre></code></table><div class=funcname id=fn_@16:9>func @16:9</div><div class=info><a href=#s_fn_@16:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/marshal.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func(src any) (dst []byte, err error) {</pre></code><tr><td>17<td><code><pre> bs, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>18<td><code><pre> defer cb()</pre></code><tr><td>19<td><code><pre></pre></code><tr><td>20<td><code><pre> if err = fn(bs, src, opt); err != nil {</pre></code><tr class=miss><td>21<td><code><pre> return</pre></code><tr><td>22<td><code><pre> }</pre></code><tr><td>23<td><code><pre></pre></code><tr><td>24<td><code><pre> dst = make([]byte, bs.Len())</pre></code><tr><td>25<td><code><pre> copy(dst, bs.Bytes())</pre></code><tr><td>26<td><code><pre> return</pre></code><tr><td>27<td><code><pre> }</pre></code></table><div class=funcname id=fn_ParseAlgorithm>func ParseAlgorithm</div><div class=info><a href=#s_fn_ParseAlgorithm>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/algorithm_enum.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func ParseAlgorithm(s any) Algorithm {</pre></code><tr><td>44<td><code><pre> switch v := s.(type) {</pre></code><tr><td>45<td><code><pre> case string:</pre></code><tr><td>46<td><code><pre> if enumList := algorithmEnum.Enum(v); len(enumList) > 0 {</pre></code><tr><td>47<td><code><pre> return enumList[0]</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre> case Algorithm:</pre></code><tr><td>50<td><code><pre> return v</pre></code><tr><td>51<td><code><pre> default:</pre></code><tr class=miss><td>52<td><code><pre> return Algorithm(cast.ToInt(s))</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre> return AlgorithmUnknown</pre></code><tr><td>55<td><code><pre>}</pre></code></table><div class=funcname id=fn_UnmarshalStreamFunc>func UnmarshalStreamFunc</div><div class=info><a href=#s_fn_UnmarshalStreamFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/unmarshal.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func UnmarshalStreamFunc[T any](algo Algorithm, opts ...utils.OptionExtender) func(io.Reader) (T, error) {</pre></code><tr><td>50<td><code><pre> fn, ok := unmarshalFuncMap[algo]</pre></code><tr><td>51<td><code><pre> if !ok {</pre></code><tr class=miss><td>52<td><code><pre> panic(fmt.Errorf("unknown serialize algorithm type %+v", algo))</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre> opt := utils.ApplyOptions[unmarshalOption](opts...)</pre></code><tr><td>55<td><code><pre> return func(src io.Reader) (dst T, err error) {</pre></code><tr><td>56<td><code><pre> err = fn(&dst, src, opt)</pre></code><tr><td>57<td><code><pre> return</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre>}</pre></code></table><div class=funcname id=fn_MarshalFunc>func MarshalFunc</div><div class=info><a href=#s_fn_MarshalFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/marshal.go</code>:</div><table class=listing><tr><td>10<td><code><pre>func MarshalFunc(algo Algorithm, opts ...utils.OptionExtender) func(src any) ([]byte, error) {</pre></code><tr><td>11<td><code><pre> fn, ok := marshalFuncMap[algo]</pre></code><tr><td>12<td><code><pre> if !ok {</pre></code><tr class=miss><td>13<td><code><pre> panic(fmt.Errorf("unknown serialize algorithm type %+v", algo))</pre></code><tr><td>14<td><code><pre> }</pre></code><tr><td>15<td><code><pre> opt := utils.ApplyOptions[marshalOption](opts...)</pre></code><tr><td>16<td><code><pre> return func(src any) (dst []byte, err error) {</pre></code><tr><td>17<td><code><pre> bs, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>18<td><code><pre> defer cb()</pre></code><tr><td>19<td><code><pre></pre></code><tr><td>20<td><code><pre> if err = fn(bs, src, opt); err != nil {</pre></code><tr><td>21<td><code><pre> return</pre></code><tr><td>22<td><code><pre> }</pre></code><tr><td>23<td><code><pre></pre></code><tr><td>24<td><code><pre> dst = make([]byte, bs.Len())</pre></code><tr><td>25<td><code><pre> copy(dst, bs.Bytes())</pre></code><tr><td>26<td><code><pre> return</pre></code><tr><td>27<td><code><pre> }</pre></code><tr><td>28<td><code><pre>}</pre></code></table><div class=funcname id=fn_UnmarshalFunc>func UnmarshalFunc</div><div class=info><a href=#s_fn_UnmarshalFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/unmarshal.go</code>:</div><table class=listing><tr><td>11<td><code><pre>func UnmarshalFunc[T any](algo Algorithm, opts ...utils.OptionExtender) func(src []byte) (T, error) {</pre></code><tr><td>12<td><code><pre> fn, ok := unmarshalFuncMap[algo]</pre></code><tr><td>13<td><code><pre> if !ok {</pre></code><tr class=miss><td>14<td><code><pre> panic(fmt.Errorf("unknown serialize algorithm type %+v", algo))</pre></code><tr><td>15<td><code><pre> }</pre></code><tr><td>16<td><code><pre> opt := utils.ApplyOptions[unmarshalOption](opts...)</pre></code><tr><td>17<td><code><pre> return func(src []byte) (dst T, err error) {</pre></code><tr><td>18<td><code><pre> bs, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>19<td><code><pre> defer cb()</pre></code><tr><td>20<td><code><pre></pre></code><tr><td>21<td><code><pre> bs.Write(src)</pre></code><tr><td>22<td><code><pre> err = fn(&dst, bs, opt)</pre></code><tr><td>23<td><code><pre> return</pre></code><tr><td>24<td><code><pre> }</pre></code><tr><td>25<td><code><pre>}</pre></code></table><div class=funcname id=fn_MarshalStreamFunc>func MarshalStreamFunc</div><div class=info><a href=#s_fn_MarshalStreamFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/marshal.go</code>:</div><table class=listing><tr><td>30<td><code><pre>func MarshalStreamFunc(algo Algorithm, opts ...utils.OptionExtender) func(dst io.Writer, src any) error {</pre></code><tr><td>31<td><code><pre> fn, ok := marshalFuncMap[algo]</pre></code><tr><td>32<td><code><pre> if !ok {</pre></code><tr class=miss><td>33<td><code><pre> panic(fmt.Errorf("unknown serialize algorithm type %+v", algo))</pre></code><tr><td>34<td><code><pre> }</pre></code><tr><td>35<td><code><pre> opt := utils.ApplyOptions[marshalOption](opts...)</pre></code><tr><td>36<td><code><pre> return func(dst io.Writer, src any) error {</pre></code><tr><td>37<td><code><pre> return fn(dst, src, opt)</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre>}</pre></code></table><div class=funcname id=fn_@71:9>func @71:9</div><div class=info><a href=#s_fn_@71:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/unmarshal.go</code>:</div><table class=listing><tr><td>71<td><code><pre>func(src io.Reader) (dst any, err error) {</pre></code><tr><td>72<td><code><pre> d := reflect.New(dstType).Interface()</pre></code><tr><td>73<td><code><pre> if err = fn(d, src, opt); err != nil {</pre></code><tr class=miss><td>74<td><code><pre> return</pre></code><tr><td>75<td><code><pre> }</pre></code><tr><td>76<td><code><pre> dst = reflect.Indirect(reflect.ValueOf(d)).Interface()</pre></code><tr><td>77<td><code><pre> return</pre></code><tr><td>78<td><code><pre> }</pre></code></table><div class=funcname id=fn_UnmarshalStreamFuncByType>func UnmarshalStreamFuncByType</div><div class=info><a href=#s_fn_UnmarshalStreamFuncByType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/unmarshal.go</code>:</div><table class=listing><tr><td>61<td><code><pre>func UnmarshalStreamFuncByType(algo Algorithm, dst any, opts ...utils.OptionExtender) func(io.Reader) (any, error) {</pre></code><tr><td>62<td><code><pre> fn, ok := unmarshalFuncMap[algo]</pre></code><tr><td>63<td><code><pre> if !ok {</pre></code><tr class=miss><td>64<td><code><pre> panic(fmt.Errorf("unknown serialize algorithm type %+v", algo))</pre></code><tr><td>65<td><code><pre> }</pre></code><tr><td>66<td><code><pre> dstType, ok := dst.(reflect.Type)</pre></code><tr><td>67<td><code><pre> if !ok {</pre></code><tr class=miss><td>68<td><code><pre> dstType = reflect.TypeOf(dst)</pre></code><tr><td>69<td><code><pre> }</pre></code><tr><td>70<td><code><pre> opt := utils.ApplyOptions[unmarshalOption](opts...)</pre></code><tr><td>71<td><code><pre> return func(src io.Reader) (dst any, err error) {</pre></code><tr><td>72<td><code><pre> d := reflect.New(dstType).Interface()</pre></code><tr><td>73<td><code><pre> if err = fn(d, src, opt); err != nil {</pre></code><tr><td>74<td><code><pre> return</pre></code><tr><td>75<td><code><pre> }</pre></code><tr><td>76<td><code><pre> dst = reflect.Indirect(reflect.ValueOf(d)).Interface()</pre></code><tr><td>77<td><code><pre> return</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre>}</pre></code></table><div class=funcname id=fn_@42:18>func @42:18</div><div class=info><a href=#s_fn_@42:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>42<td><code><pre>func(dst any, src io.Reader, opt *unmarshalOption) (err error) {</pre></code><tr><td>43<td><code><pre> dec := json.NewDecoder(src)</pre></code><tr><td>44<td><code><pre> if opt.jsonNumber {</pre></code><tr class=miss><td>45<td><code><pre> dec.UseNumber()</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre> if opt.disallowUnknownFields {</pre></code><tr class=miss><td>48<td><code><pre> dec.DisallowUnknownFields()</pre></code><tr><td>49<td><code><pre> }</pre></code><tr><td>50<td><code><pre> return dec.Decode(dst)</pre></code><tr><td>51<td><code><pre> }</pre></code></table><div class=funcname id=fn_UnmarshalFuncByType>func UnmarshalFuncByType</div><div class=info><a href=#s_fn_UnmarshalFuncByType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/unmarshal.go</code>:</div><table class=listing><tr><td>27<td><code><pre>func UnmarshalFuncByType(algo Algorithm, dst any, opts ...utils.OptionExtender) func([]byte) (any, error) {</pre></code><tr class=miss><td>28<td><code><pre> fn, ok := unmarshalFuncMap[algo]</pre></code><tr class=miss><td>29<td><code><pre> if !ok {</pre></code><tr class=miss><td>30<td><code><pre> panic(fmt.Errorf("unknown serialize algorithm type %+v", algo))</pre></code><tr><td>31<td><code><pre> }</pre></code><tr class=miss><td>32<td><code><pre> dstType, ok := dst.(reflect.Type)</pre></code><tr class=miss><td>33<td><code><pre> if !ok {</pre></code><tr class=miss><td>34<td><code><pre> dstType = reflect.TypeOf(dst)</pre></code><tr><td>35<td><code><pre> }</pre></code><tr class=miss><td>36<td><code><pre> opt := utils.ApplyOptions[unmarshalOption](opts...)</pre></code><tr class=miss><td>37<td><code><pre> return func(src []byte) (dst any, err error) {</pre></code><tr><td>38<td><code><pre> dst = reflect.New(dstType).Interface()</pre></code><tr><td>39<td><code><pre></pre></code><tr><td>40<td><code><pre> bs, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>41<td><code><pre> defer cb()</pre></code><tr><td>42<td><code><pre></pre></code><tr><td>43<td><code><pre> bs.Write(src)</pre></code><tr><td>44<td><code><pre> err = fn(dst, bs, opt)</pre></code><tr><td>45<td><code><pre> return</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre>}</pre></code></table><div class=funcname id=fn_@37:9>func @37:9</div><div class=info><a href=#s_fn_@37:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/unmarshal.go</code>:</div><table class=listing><tr><td>37<td><code><pre>func(src []byte) (dst any, err error) {</pre></code><tr class=miss><td>38<td><code><pre> dst = reflect.New(dstType).Interface()</pre></code><tr><td>39<td><code><pre></pre></code><tr class=miss><td>40<td><code><pre> bs, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr class=miss><td>41<td><code><pre> defer cb()</pre></code><tr><td>42<td><code><pre></pre></code><tr class=miss><td>43<td><code><pre> bs.Write(src)</pre></code><tr class=miss><td>44<td><code><pre> err = fn(dst, bs, opt)</pre></code><tr class=miss><td>45<td><code><pre> return</pre></code><tr><td>46<td><code><pre> }</pre></code></table><div class=funcname id=fn_JsonIndent>func JsonIndent</div><div class=info><a href=#s_fn_JsonIndent>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>88<td><code><pre>func JsonIndent(prefix, indent string) utils.OptionFunc[marshalOption] {</pre></code><tr class=miss><td>89<td><code><pre> return func(o *marshalOption) {</pre></code><tr><td>90<td><code><pre> o.jsonIndentPrefix, o.jsonIndent = prefix, indent</pre></code><tr><td>91<td><code><pre> }</pre></code><tr><td>92<td><code><pre>}</pre></code></table><div class=funcname id=fn_@106:9>func @106:9</div><div class=info><a href=#s_fn_@106:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>106<td><code><pre>func(o *unmarshalOption) {</pre></code><tr class=miss><td>107<td><code><pre> o.disallowUnknownFields = true</pre></code><tr><td>108<td><code><pre> }</pre></code></table><div class=funcname id=fn_@77:9>func @77:9</div><div class=info><a href=#s_fn_@77:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>77<td><code><pre>func(o *marshalOption) {</pre></code><tr class=miss><td>78<td><code><pre> o.msgpackUseCompactFloats = on</pre></code><tr><td>79<td><code><pre> }</pre></code></table><div class=funcname id=fn_@71:9>func @71:9</div><div class=info><a href=#s_fn_@71:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>71<td><code><pre>func(o *marshalOption) {</pre></code><tr class=miss><td>72<td><code><pre> o.msgpackUseCompactInts = on</pre></code><tr><td>73<td><code><pre> }</pre></code></table><div class=funcname id=fn_DisallowUnknownFields>func DisallowUnknownFields</div><div class=info><a href=#s_fn_DisallowUnknownFields>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>105<td><code><pre>func DisallowUnknownFields() utils.OptionFunc[unmarshalOption] {</pre></code><tr class=miss><td>106<td><code><pre> return func(o *unmarshalOption) {</pre></code><tr><td>107<td><code><pre> o.disallowUnknownFields = true</pre></code><tr><td>108<td><code><pre> }</pre></code><tr><td>109<td><code><pre>}</pre></code></table><div class=funcname id=fn_@100:9>func @100:9</div><div class=info><a href=#s_fn_@100:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>100<td><code><pre>func(o *unmarshalOption) {</pre></code><tr class=miss><td>101<td><code><pre> o.jsonNumber = true</pre></code><tr><td>102<td><code><pre> }</pre></code></table><div class=funcname id=fn_MsgpackUseCompactInts>func MsgpackUseCompactInts</div><div class=info><a href=#s_fn_MsgpackUseCompactInts>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>70<td><code><pre>func MsgpackUseCompactInts(on bool) utils.OptionFunc[marshalOption] {</pre></code><tr class=miss><td>71<td><code><pre> return func(o *marshalOption) {</pre></code><tr><td>72<td><code><pre> o.msgpackUseCompactInts = on</pre></code><tr><td>73<td><code><pre> }</pre></code><tr><td>74<td><code><pre>}</pre></code></table><div class=funcname id=fn_JsonNumber>func JsonNumber</div><div class=info><a href=#s_fn_JsonNumber>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>99<td><code><pre>func JsonNumber() utils.OptionFunc[unmarshalOption] {</pre></code><tr class=miss><td>100<td><code><pre> return func(o *unmarshalOption) {</pre></code><tr><td>101<td><code><pre> o.jsonNumber = true</pre></code><tr><td>102<td><code><pre> }</pre></code><tr><td>103<td><code><pre>}</pre></code></table><div class=funcname id=fn_@89:9>func @89:9</div><div class=info><a href=#s_fn_@89:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>89<td><code><pre>func(o *marshalOption) {</pre></code><tr class=miss><td>90<td><code><pre> o.jsonIndentPrefix, o.jsonIndent = prefix, indent</pre></code><tr><td>91<td><code><pre> }</pre></code></table><div class=funcname id=fn_MsgpackUseCompactFloats>func MsgpackUseCompactFloats</div><div class=info><a href=#s_fn_MsgpackUseCompactFloats>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/common/utils/serialize/types.go</code>:</div><table class=listing><tr><td>76<td><code><pre>func MsgpackUseCompactFloats(on bool) utils.OptionFunc[marshalOption] {</pre></code><tr class=miss><td>77<td><code><pre> return func(o *marshalOption) {</pre></code><tr><td>78<td><code><pre> o.msgpackUseCompactFloats = on</pre></code><tr><td>79<td><code><pre> }</pre></code><tr><td>80<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/config class=funcname>Package Overview: github.com/wfusion/gofusion/config 20 <span class=packageTotal>79.1%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_registry.initComponents><td><code><a href=#fn_registry.initComponents>registry.initComponents(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>21/21</code><tr id=s_fn_registry.initByConfigFile><td><code><a href=#fn_registry.initByConfigFile>registry.initByConfigFile(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>17/17</code><tr id=s_fn_@460:11><td><code><a href=#fn_@460:11>@460:11(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>14/14</code><tr id=s_fn_registry.GetAllConfigs><td><code><a href=#fn_registry.GetAllConfigs>registry.GetAllConfigs(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>12/12</code><tr id=s_fn_cryptoConf.cryptoConfuseKey><td><code><a href=#fn_cryptoConf.cryptoConfuseKey>cryptoConf.cryptoConfuseKey(...)</a></code><td><code>github.com/wfusion/gofusion/config/crypto.go</code><td class=percent><code>100.0%</code><td class=linecount><code>10/10</code><tr id=s_fn_@113:16><td><code><a href=#fn_@113:16>@113:16(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>10/10</code><tr id=s_fn_registry.Init><td><code><a href=#fn_registry.Init>registry.Init(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>9/9</code><tr id=s_fn_New><td><code><a href=#fn_New>New(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_CryptoConstruct><td><code><a href=#fn_CryptoConstruct>CryptoConstruct(...)</a></code><td><code>github.com/wfusion/gofusion/config/crypto.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_registry.makeAllConfigStruct><td><code><a href=#fn_registry.makeAllConfigStruct>registry.makeAllConfigStruct(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_CryptoDecryptByTag><td><code><a href=#fn_CryptoDecryptByTag>CryptoDecryptByTag(...)</a></code><td><code>github.com/wfusion/gofusion/config/crypto.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/config/flag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_registry.makeComponentsConfigFields><td><code><a href=#fn_registry.makeComponentsConfigFields>registry.makeComponentsConfigFields(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_@364:26><td><code><a href=#fn_@364:26>@364:26(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_registry.Debug><td><code><a href=#fn_registry.Debug>registry.Debug(...)</a></code><td><code>github.com/wfusion/gofusion/config/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_registry.AppName><td><code><a href=#fn_registry.AppName>registry.AppName(...)</a></code><td><code>github.com/wfusion/gofusion/config/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_AddComponent><td><code><a href=#fn_AddComponent>AddComponent(...)</a></code><td><code>github.com/wfusion/gofusion/config/component.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_getComponents><td><code><a href=#fn_getComponents>getComponents(...)</a></code><td><code>github.com/wfusion/gofusion/config/component.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_registry.initAllConfigByLoadFunc><td><code><a href=#fn_registry.initAllConfigByLoadFunc>registry.initAllConfigByLoadFunc(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_parseFlags><td><code><a href=#fn_parseFlags>parseFlags(...)</a></code><td><code>github.com/wfusion/gofusion/config/flag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_registry.makeComponentsConfigStruct><td><code><a href=#fn_registry.makeComponentsConfigStruct>registry.makeComponentsConfigStruct(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_AppName><td><code><a href=#fn_AppName>AppName(...)</a></code><td><code>github.com/wfusion/gofusion/config/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@366:32><td><code><a href=#fn_@366:32>@366:32(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/config/crypto.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@372:34><td><code><a href=#fn_@372:34>@372:34(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@121:9><td><code><a href=#fn_@121:9>@121:9(...)</a></code><td><code>github.com/wfusion/gofusion/config/component.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@29:9><td><code><a href=#fn_@29:9>@29:9(...)</a></code><td><code>github.com/wfusion/gofusion/config/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_registry.getBaseObject><td><code><a href=#fn_registry.getBaseObject>registry.getBaseObject(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_registry.loadComponents><td><code><a href=#fn_registry.loadComponents>registry.loadComponents(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_WithFlag><td><code><a href=#fn_WithFlag>WithFlag(...)</a></code><td><code>github.com/wfusion/gofusion/config/component.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@138:12><td><code><a href=#fn_@138:12>@138:12(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@459:9><td><code><a href=#fn_@459:9>@459:9(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@137:16><td><code><a href=#fn_@137:16>@137:16(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_WithTag><td><code><a href=#fn_WithTag>WithTag(...)</a></code><td><code>github.com/wfusion/gofusion/config/component.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_newOptions><td><code><a href=#fn_newOptions>newOptions(...)</a></code><td><code>github.com/wfusion/gofusion/config/component.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_NewDefaultLoader><td><code><a href=#fn_NewDefaultLoader>NewDefaultLoader(...)</a></code><td><code>github.com/wfusion/gofusion/config/loader.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_loader.Unmarshal><td><code><a href=#fn_loader.Unmarshal>loader.Unmarshal(...)</a></code><td><code>github.com/wfusion/gofusion/config/loader.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@39:23><td><code><a href=#fn_@39:23>@39:23(...)</a></code><td><code>github.com/wfusion/gofusion/config/loader.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@23:9><td><code><a href=#fn_@23:9>@23:9(...)</a></code><td><code>github.com/wfusion/gofusion/config/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_DI><td><code><a href=#fn_DI>DI(...)</a></code><td><code>github.com/wfusion/gofusion/config/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_registry.DI><td><code><a href=#fn_registry.DI>registry.DI(...)</a></code><td><code>github.com/wfusion/gofusion/config/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Ctx><td><code><a href=#fn_Ctx>Ctx(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@85:9><td><code><a href=#fn_@85:9>@85:9(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Loader><td><code><a href=#fn_Loader>Loader(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@91:9><td><code><a href=#fn_@91:9>@91:9(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Files><td><code><a href=#fn_Files>Files(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@97:9><td><code><a href=#fn_@97:9>@97:9(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@108:9><td><code><a href=#fn_@108:9>@108:9(...)</a></code><td><code>github.com/wfusion/gofusion/config/component.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@201:35><td><code><a href=#fn_@201:35>@201:35(...)</a></code><td><code>github.com/wfusion/gofusion/config/crypto.go</code><td class=percent><code>93.8%</code><td class=linecount><code>15/16</code><tr id=s_fn_registry.AddComponent><td><code><a href=#fn_registry.AddComponent>registry.AddComponent(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>93.1%</code><td class=linecount><code>27/29</code><tr id=s_fn_@36:18><td><code><a href=#fn_@36:18>@36:18(...)</a></code><td><code>github.com/wfusion/gofusion/config/candy.go</code><td class=percent><code>90.0%</code><td class=linecount><code>9/10</code><tr id=s_fn_CryptoConf.ToOptionMap><td><code><a href=#fn_CryptoConf.ToOptionMap>CryptoConf.ToOptionMap(...)</a></code><td><code>github.com/wfusion/gofusion/config/crypto.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_Use><td><code><a href=#fn_Use>Use(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_cryptoConf.ToOptions><td><code><a href=#fn_cryptoConf.ToOptions>cryptoConf.ToOptions(...)</a></code><td><code>github.com/wfusion/gofusion/config/crypto.go</code><td class=percent><code>81.8%</code><td class=linecount><code>9/11</code><tr id=s_fn_registry.cryptoConfig><td><code><a href=#fn_registry.cryptoConfig>registry.cryptoConfig(...)</a></code><td><code>github.com/wfusion/gofusion/config/candy.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_registry.LoadComponentConfig><td><code><a href=#fn_registry.LoadComponentConfig>registry.LoadComponentConfig(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>71.4%</code><td class=linecount><code>20/28</code><tr id=s_fn_loadConfig><td><code><a href=#fn_loadConfig>loadConfig(...)</a></code><td><code>github.com/wfusion/gofusion/config/loader.go</code><td class=percent><code>70.6%</code><td class=linecount><code>24/34</code><tr id=s_fn_@493:37><td><code><a href=#fn_@493:37>@493:37(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>66.7%</code><td class=linecount><code>6/9</code><tr id=s_fn_registry.checkBusinessConfig><td><code><a href=#fn_registry.checkBusinessConfig>registry.checkBusinessConfig(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_parseConstructor><td><code><a href=#fn_parseConstructor>parseConstructor(...)</a></code><td><code>github.com/wfusion/gofusion/config/component.go</code><td class=percent><code>60.0%</code><td class=linecount><code>15/25</code><tr id=s_fn_registry.initAllConfigByFlag><td><code><a href=#fn_registry.initAllConfigByFlag>registry.initAllConfigByFlag(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>60.0%</code><td class=linecount><code>9/15</code><tr id=s_fn_indexComponent><td><code><a href=#fn_indexComponent>indexComponent(...)</a></code><td><code>github.com/wfusion/gofusion/config/component.go</code><td class=percent><code>60.0%</code><td class=linecount><code>3/5</code><tr id=s_fn_checkCryptoConf><td><code><a href=#fn_checkCryptoConf>checkCryptoConf(...)</a></code><td><code>github.com/wfusion/gofusion/config/crypto.go</code><td class=percent><code>57.9%</code><td class=linecount><code>11/19</code><tr id=s_fn_registry.addComponent><td><code><a href=#fn_registry.addComponent>registry.addComponent(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>52.9%</code><td class=linecount><code>9/17</code><tr id=s_fn_@179:27><td><code><a href=#fn_@179:27>@179:27(...)</a></code><td><code>github.com/wfusion/gofusion/config/component.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/8</code><tr id=s_fn_CryptoDecryptFunc><td><code><a href=#fn_CryptoDecryptFunc>CryptoDecryptFunc(...)</a></code><td><code>github.com/wfusion/gofusion/config/crypto.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_CryptoEncryptFunc><td><code><a href=#fn_CryptoEncryptFunc>CryptoEncryptFunc(...)</a></code><td><code>github.com/wfusion/gofusion/config/crypto.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_@115:9><td><code><a href=#fn_@115:9>@115:9(...)</a></code><td><code>github.com/wfusion/gofusion/config/component.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_WithCore><td><code><a href=#fn_WithCore>WithCore(...)</a></code><td><code>github.com/wfusion/gofusion/config/component.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Component.Clone><td><code><a href=#fn_Component.Clone>Component.Clone(...)</a></code><td><code>github.com/wfusion/gofusion/config/component.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_CryptoConfigName><td><code><a href=#fn_CryptoConfigName>CryptoConfigName(...)</a></code><td><code>github.com/wfusion/gofusion/config/crypto.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@165:9><td><code><a href=#fn_@165:9>@165:9(...)</a></code><td><code>github.com/wfusion/gofusion/config/crypto.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@175:9><td><code><a href=#fn_@175:9>@175:9(...)</a></code><td><code>github.com/wfusion/gofusion/config/crypto.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@188:9><td><code><a href=#fn_@188:9>@188:9(...)</a></code><td><code>github.com/wfusion/gofusion/config/crypto.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Debug><td><code><a href=#fn_Debug>Debug(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@103:9><td><code><a href=#fn_@103:9>@103:9(...)</a></code><td><code>github.com/wfusion/gofusion/config/registry.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@120:9><td><code><a href=#fn_@120:9>@120:9(...)</a></code><td><code>github.com/wfusion/gofusion/config/crypto.go</code><td class=percent><code>100.0%</code><td class=linecount><code>0/0</code></table><div class=funcname id=fn_registry.initComponents>func registry.initComponents</div><div class=info><a href=#s_fn_registry.initComponents>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>431<td><code><pre>func (r *registry) initComponents(parent context.Context) func() {</pre></code><tr><td>432<td><code><pre> ctx, cancel := context.WithCancel(parent)</pre></code><tr><td>433<td><code><pre> ctxVal := reflect.ValueOf(ctx)</pre></code><tr><td>434<td><code><pre> o1 := reflect.ValueOf(utils.OptionExtender(AppName(r.appName)))</pre></code><tr><td>435<td><code><pre> o2 := reflect.ValueOf(utils.OptionExtender(DI(r.di)))</pre></code><tr><td>436<td><code><pre></pre></code><tr><td>437<td><code><pre> baseObject := r.getBaseObject()</pre></code><tr><td>438<td><code><pre> destructors := make([]reflect.Value, 0, len(r.componentList))</pre></code><tr><td>439<td><code><pre> componentNames := make([]string, 0, len(r.componentList))</pre></code><tr><td>440<td><code><pre> hasCallbackComponentNames := make([]string, 0, len(r.componentList))</pre></code><tr><td>441<td><code><pre> for i := 0; i < len(r.componentList); i++ {</pre></code><tr><td>442<td><code><pre> com := r.componentList[i]</pre></code><tr><td>443<td><code><pre> comArgs := reflect.ValueOf(clone.Clone(baseObject.FieldByName(com.name).Interface()))</pre></code><tr><td>444<td><code><pre> componentNames = append(componentNames, com.name)</pre></code><tr><td>445<td><code><pre> if out := com.constructor.Call([]reflect.Value{ctxVal, comArgs, o1, o2}); len(out) > 0 && !out[0].IsNil() {</pre></code><tr><td>446<td><code><pre> destructors = append(destructors, out[0])</pre></code><tr><td>447<td><code><pre> hasCallbackComponentNames = append(hasCallbackComponentNames, com.name)</pre></code><tr><td>448<td><code><pre> }</pre></code><tr><td>449<td><code><pre> }</pre></code><tr><td>450<td><code><pre></pre></code><tr><td>451<td><code><pre> /* print summary to stdout */</pre></code><tr><td>452<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>453<td><code><pre> app := r.AppName()</pre></code><tr><td>454<td><code><pre> log.SetFlags(log.Lshortfile | log.Ldate | log.Lmicroseconds)</pre></code><tr><td>455<td><code><pre> log.Printf("%v [Gofusion] %s initialized total %d components below: %s\n",</pre></code><tr><td>456<td><code><pre> pid, app, len(componentNames), strings.Join(componentNames, ", "))</pre></code><tr><td>457<td><code><pre></pre></code><tr><td>458<td><code><pre> once := new(sync.Once)</pre></code><tr><td>459<td><code><pre> return func() {</pre></code><tr><td>460<td><code><pre> once.Do(func() {</pre></code><tr><td>461<td><code><pre> initLocker.Lock()</pre></code><tr><td>462<td><code><pre> defer initLocker.Unlock()</pre></code><tr><td>463<td><code><pre></pre></code><tr><td>464<td><code><pre> defer close(r.closeCh)</pre></code><tr><td>465<td><code><pre></pre></code><tr><td>466<td><code><pre> r.initWg.Done()</pre></code><tr><td>467<td><code><pre> r.initWg.Wait()</pre></code><tr><td>468<td><code><pre> cancel()</pre></code><tr><td>469<td><code><pre> for i := len(destructors) - 1; i >= 0; i-- {</pre></code><tr><td>470<td><code><pre> log.Printf("%v [Gofusion] %s %s exiting...", pid, app, hasCallbackComponentNames[i])</pre></code><tr><td>471<td><code><pre> destructors[i].Call(nil)</pre></code><tr><td>472<td><code><pre> log.Printf("%v [Gofusion] %s %s exited", pid, app, hasCallbackComponentNames[i])</pre></code><tr><td>473<td><code><pre> }</pre></code><tr><td>474<td><code><pre></pre></code><tr><td>475<td><code><pre> r.di.Clear()</pre></code><tr><td>476<td><code><pre> r.businessConfig = nil</pre></code><tr><td>477<td><code><pre> r.componentConfigs = nil</pre></code><tr><td>478<td><code><pre> r.initOnce = new(sync.Once)</pre></code><tr><td>479<td><code><pre> })</pre></code><tr><td>480<td><code><pre> }</pre></code><tr><td>481<td><code><pre>}</pre></code></table><div class=funcname id=fn_registry.initByConfigFile>func registry.initByConfigFile</div><div class=info><a href=#s_fn_registry.initByConfigFile>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>268<td><code><pre>func (r *registry) initByConfigFile(parent context.Context, businessConfig any,</pre></code><tr><td>269<td><code><pre> loadFn loadConfigFunc, opts ...utils.OptionExtender) func() {</pre></code><tr><td>270<td><code><pre> r.loadComponents()</pre></code><tr><td>271<td><code><pre> r.checkBusinessConfig(businessConfig)</pre></code><tr><td>272<td><code><pre></pre></code><tr><td>273<td><code><pre> businessConfigVal := reflect.ValueOf(businessConfig)</pre></code><tr><td>274<td><code><pre> r.businessConfigType = utils.IndirectType(businessConfigVal.Type())</pre></code><tr><td>275<td><code><pre> r.businessConfig = reflect.New(r.businessConfigType).Interface()</pre></code><tr><td>276<td><code><pre> r.componentConfigs = reflect.New(r.makeComponentsConfigStruct()).Interface()</pre></code><tr><td>277<td><code><pre></pre></code><tr><td>278<td><code><pre> r.initAllConfigByLoadFunc(loadFn, opts...)</pre></code><tr><td>279<td><code><pre> r.initAllConfigByFlag()</pre></code><tr><td>280<td><code><pre></pre></code><tr><td>281<td><code><pre> appName := r.AppName()</pre></code><tr><td>282<td><code><pre> registryLock.Lock()</pre></code><tr><td>283<td><code><pre> if _, ok := registryMap[appName]; !ok {</pre></code><tr><td>284<td><code><pre> registryMap[appName] = r</pre></code><tr><td>285<td><code><pre> }</pre></code><tr><td>286<td><code><pre> registryLock.Unlock()</pre></code><tr><td>287<td><code><pre></pre></code><tr><td>288<td><code><pre> // decrypt</pre></code><tr><td>289<td><code><pre> CryptoDecryptByTag(r.businessConfig, AppName(r.AppName()))</pre></code><tr><td>290<td><code><pre> CryptoDecryptByTag(r.componentConfigs, AppName(r.AppName()))</pre></code><tr><td>291<td><code><pre></pre></code><tr><td>292<td><code><pre> // give back</pre></code><tr><td>293<td><code><pre> reflect.Indirect(reflect.ValueOf(businessConfig)).Set(reflect.ValueOf(r.businessConfig))</pre></code><tr><td>294<td><code><pre></pre></code><tr><td>295<td><code><pre> return r.initComponents(parent)</pre></code><tr><td>296<td><code><pre>}</pre></code></table><div class=funcname id=fn_@460:11>func @460:11</div><div class=info><a href=#s_fn_@460:11>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>460<td><code><pre>func() {</pre></code><tr><td>461<td><code><pre> initLocker.Lock()</pre></code><tr><td>462<td><code><pre> defer initLocker.Unlock()</pre></code><tr><td>463<td><code><pre></pre></code><tr><td>464<td><code><pre> defer close(r.closeCh)</pre></code><tr><td>465<td><code><pre></pre></code><tr><td>466<td><code><pre> r.initWg.Done()</pre></code><tr><td>467<td><code><pre> r.initWg.Wait()</pre></code><tr><td>468<td><code><pre> cancel()</pre></code><tr><td>469<td><code><pre> for i := len(destructors) - 1; i >= 0; i-- {</pre></code><tr><td>470<td><code><pre> log.Printf("%v [Gofusion] %s %s exiting...", pid, app, hasCallbackComponentNames[i])</pre></code><tr><td>471<td><code><pre> destructors[i].Call(nil)</pre></code><tr><td>472<td><code><pre> log.Printf("%v [Gofusion] %s %s exited", pid, app, hasCallbackComponentNames[i])</pre></code><tr><td>473<td><code><pre> }</pre></code><tr><td>474<td><code><pre></pre></code><tr><td>475<td><code><pre> r.di.Clear()</pre></code><tr><td>476<td><code><pre> r.businessConfig = nil</pre></code><tr><td>477<td><code><pre> r.componentConfigs = nil</pre></code><tr><td>478<td><code><pre> r.initOnce = new(sync.Once)</pre></code><tr><td>479<td><code><pre> }</pre></code></table><div class=funcname id=fn_registry.GetAllConfigs>func registry.GetAllConfigs</div><div class=info><a href=#s_fn_registry.GetAllConfigs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>247<td><code><pre>func (r *registry) GetAllConfigs() any {</pre></code><tr><td>248<td><code><pre> val := reflect.New(r.makeAllConfigStruct())</pre></code><tr><td>249<td><code><pre> derefVal := reflect.Indirect(val)</pre></code><tr><td>250<td><code><pre></pre></code><tr><td>251<td><code><pre> // business configs</pre></code><tr><td>252<td><code><pre> businessConfigsVal := reflect.Indirect(reflect.ValueOf(r.businessConfig))</pre></code><tr><td>253<td><code><pre> numFields := businessConfigsVal.NumField()</pre></code><tr><td>254<td><code><pre> for i := 0; i < numFields; i++ {</pre></code><tr><td>255<td><code><pre> derefVal.Field(i + 1).Set(businessConfigsVal.Field(i))</pre></code><tr><td>256<td><code><pre> }</pre></code><tr><td>257<td><code><pre></pre></code><tr><td>258<td><code><pre> // component configs</pre></code><tr><td>259<td><code><pre> derefComponentConfigsVal := derefVal.FieldByName(componentConfigFieldName)</pre></code><tr><td>260<td><code><pre> componentConfigsVal := reflect.Indirect(reflect.ValueOf(r.componentConfigs)).FieldByName(componentConfigFieldName)</pre></code><tr><td>261<td><code><pre> numFields = componentConfigsVal.NumField()</pre></code><tr><td>262<td><code><pre> for i := 0; i < numFields; i++ {</pre></code><tr><td>263<td><code><pre> derefComponentConfigsVal.Field(i).Set(componentConfigsVal.Field(i))</pre></code><tr><td>264<td><code><pre> }</pre></code><tr><td>265<td><code><pre> return clone.Clone(val.Interface())</pre></code><tr><td>266<td><code><pre>}</pre></code></table><div class=funcname id=fn_cryptoConf.cryptoConfuseKey>func cryptoConf.cryptoConfuseKey</div><div class=info><a href=#s_fn_cryptoConf.cryptoConfuseKey>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/crypto.go</code>:</div><table class=listing><tr><td>91<td><code><pre>func (c *cryptoConf) cryptoConfuseKey(key []byte) (confused []byte) {</pre></code><tr><td>92<td><code><pre> var (</pre></code><tr><td>93<td><code><pre> k1 = make([]byte, len(key))</pre></code><tr><td>94<td><code><pre> k2 = make([]byte, len(key))</pre></code><tr><td>95<td><code><pre> k3 = make([]byte, len(key))</pre></code><tr><td>96<td><code><pre> )</pre></code><tr><td>97<td><code><pre> rndSeed := int64(crc64.Checksum(key, crc64.MakeTable(crc64.ISO)))</pre></code><tr><td>98<td><code><pre> utils.Must(rand.New(rand.NewSource(cipher.RndSeed ^ compress.RndSeed ^ rndSeed)).Read(k1))</pre></code><tr><td>99<td><code><pre> utils.Must(rand.New(rand.NewSource(cipher.RndSeed ^ encode.RndSeed ^ rndSeed)).Read(k2))</pre></code><tr><td>100<td><code><pre> utils.Must(rand.New(rand.NewSource(compress.RndSeed ^ encode.RndSeed ^ rndSeed)).Read(k3))</pre></code><tr><td>101<td><code><pre></pre></code><tr><td>102<td><code><pre> confused = make([]byte, len(key))</pre></code><tr><td>103<td><code><pre> utils.Must(rand.New(rand.NewSource(cipher.RndSeed ^ compress.RndSeed ^ encode.RndSeed)).Read(confused))</pre></code><tr><td>104<td><code><pre> for i := 0; i < len(confused); i++ {</pre></code><tr><td>105<td><code><pre> confused[i] ^= k1[i] ^ k2[i] ^ k3[i]</pre></code><tr><td>106<td><code><pre> }</pre></code><tr><td>107<td><code><pre> return</pre></code><tr><td>108<td><code><pre>}</pre></code></table><div class=funcname id=fn_@113:16>func @113:16</div><div class=info><a href=#s_fn_@113:16>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>113<td><code><pre>func() {</pre></code><tr><td>114<td><code><pre> opt := utils.ApplyOptions[initOption](opts...)</pre></code><tr><td>115<td><code><pre> r.debug = opt.debug</pre></code><tr><td>116<td><code><pre> r.closeCh = make(chan struct{})</pre></code><tr><td>117<td><code><pre></pre></code><tr><td>118<td><code><pre> // context</pre></code><tr><td>119<td><code><pre> parent := context.Background()</pre></code><tr><td>120<td><code><pre> if opt.bizCtx != nil {</pre></code><tr><td>121<td><code><pre> parent = opt.bizCtx</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre></pre></code><tr><td>124<td><code><pre> // load config function</pre></code><tr><td>125<td><code><pre> loadFn := loadConfig</pre></code><tr><td>126<td><code><pre> if opt.customLoadFunc != nil {</pre></code><tr><td>127<td><code><pre> loadFn = opt.customLoadFunc</pre></code><tr><td>128<td><code><pre> }</pre></code><tr><td>129<td><code><pre></pre></code><tr><td>130<td><code><pre> gracefully = r.initByConfigFile(parent, businessConfig, loadFn, opts...)</pre></code><tr><td>131<td><code><pre> }</pre></code></table><div class=funcname id=fn_registry.Init>func registry.Init</div><div class=info><a href=#s_fn_registry.Init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>108<td><code><pre>func (r *registry) Init(businessConfig any, opts ...utils.OptionExtender) (gracefully func()) {</pre></code><tr><td>109<td><code><pre> initLocker.Lock()</pre></code><tr><td>110<td><code><pre> defer initLocker.Unlock()</pre></code><tr><td>111<td><code><pre></pre></code><tr><td>112<td><code><pre> r.initWg.Add(1)</pre></code><tr><td>113<td><code><pre> r.initOnce.Do(func() {</pre></code><tr><td>114<td><code><pre> opt := utils.ApplyOptions[initOption](opts...)</pre></code><tr><td>115<td><code><pre> r.debug = opt.debug</pre></code><tr><td>116<td><code><pre> r.closeCh = make(chan struct{})</pre></code><tr><td>117<td><code><pre></pre></code><tr><td>118<td><code><pre> // context</pre></code><tr><td>119<td><code><pre> parent := context.Background()</pre></code><tr><td>120<td><code><pre> if opt.bizCtx != nil {</pre></code><tr><td>121<td><code><pre> parent = opt.bizCtx</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre></pre></code><tr><td>124<td><code><pre> // load config function</pre></code><tr><td>125<td><code><pre> loadFn := loadConfig</pre></code><tr><td>126<td><code><pre> if opt.customLoadFunc != nil {</pre></code><tr><td>127<td><code><pre> loadFn = opt.customLoadFunc</pre></code><tr><td>128<td><code><pre> }</pre></code><tr><td>129<td><code><pre></pre></code><tr><td>130<td><code><pre> gracefully = r.initByConfigFile(parent, businessConfig, loadFn, opts...)</pre></code><tr><td>131<td><code><pre> })</pre></code><tr><td>132<td><code><pre> if gracefully == nil {</pre></code><tr><td>133<td><code><pre> // give back</pre></code><tr><td>134<td><code><pre> reflect.Indirect(reflect.ValueOf(businessConfig)).Set(reflect.ValueOf(r.businessConfig))</pre></code><tr><td>135<td><code><pre></pre></code><tr><td>136<td><code><pre> once := new(sync.Once)</pre></code><tr><td>137<td><code><pre> gracefully = func() {</pre></code><tr><td>138<td><code><pre> once.Do(func() {</pre></code><tr><td>139<td><code><pre> r.initWg.Done()</pre></code><tr><td>140<td><code><pre> })</pre></code><tr><td>141<td><code><pre> }</pre></code><tr><td>142<td><code><pre> }</pre></code><tr><td>143<td><code><pre> return</pre></code><tr><td>144<td><code><pre>}</pre></code></table><div class=funcname id=fn_New>func New</div><div class=info><a href=#s_fn_New>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func New(appName string) Configurable {</pre></code><tr><td>46<td><code><pre> registryLock.Lock()</pre></code><tr><td>47<td><code><pre> defer registryLock.Unlock()</pre></code><tr><td>48<td><code><pre> if reg, ok := registryMap[appName]; ok {</pre></code><tr><td>49<td><code><pre> return reg</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre></pre></code><tr><td>52<td><code><pre> reg := &registry{</pre></code><tr><td>53<td><code><pre> di: di.NewDI(),</pre></code><tr><td>54<td><code><pre> appName: appName,</pre></code><tr><td>55<td><code><pre> initOnce: new(sync.Once),</pre></code><tr><td>56<td><code><pre> closeCh: make(chan struct{}),</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre> registryMap[appName] = reg</pre></code><tr><td>59<td><code><pre> return reg</pre></code><tr><td>60<td><code><pre>}</pre></code></table><div class=funcname id=fn_CryptoConstruct>func CryptoConstruct</div><div class=info><a href=#s_fn_CryptoConstruct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/crypto.go</code>:</div><table class=listing><tr><td>110<td><code><pre>func CryptoConstruct(ctx context.Context, c CryptoConf, _ ...utils.OptionExtender) func() {</pre></code><tr><td>111<td><code><pre> if c.Config != nil {</pre></code><tr><td>112<td><code><pre> checkCryptoConf("", c.Config)</pre></code><tr><td>113<td><code><pre> }</pre></code><tr><td>114<td><code><pre> for name, cfg := range c.Custom {</pre></code><tr><td>115<td><code><pre> if cfg != nil {</pre></code><tr><td>116<td><code><pre> checkCryptoConf(name, cfg)</pre></code><tr><td>117<td><code><pre> }</pre></code><tr><td>118<td><code><pre> }</pre></code><tr><td>119<td><code><pre></pre></code><tr><td>120<td><code><pre> return func() {</pre></code><tr><td>121<td><code><pre></pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre>}</pre></code></table><div class=funcname id=fn_registry.makeAllConfigStruct>func registry.makeAllConfigStruct</div><div class=info><a href=#s_fn_registry.makeAllConfigStruct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>328<td><code><pre>func (r *registry) makeAllConfigStruct() reflect.Type {</pre></code><tr><td>329<td><code><pre> /* AllConfig struct may look like below</pre></code><tr><td>330<td><code><pre> type AllConfig struct {</pre></code><tr><td>331<td><code><pre> XXXBase struct {</pre></code><tr><td>332<td><code><pre> Debug bool</pre></code><tr><td>333<td><code><pre> App string</pre></code><tr><td>334<td><code><pre> DB map[string]*db.Conf</pre></code><tr><td>335<td><code><pre> Redis map[string]*redis.Conf</pre></code><tr><td>336<td><code><pre> Log *log.Conf</pre></code><tr><td>337<td><code><pre> ...</pre></code><tr><td>338<td><code><pre> } `yaml:"base" json:"base" toml:"base"`</pre></code><tr><td>339<td><code><pre></pre></code><tr><td>340<td><code><pre> BusinessConfigField1</pre></code><tr><td>341<td><code><pre> BusinessConfigField2</pre></code><tr><td>342<td><code><pre> BusinessConfigField3</pre></code><tr><td>343<td><code><pre></pre></code><tr><td>344<td><code><pre> ...</pre></code><tr><td>345<td><code><pre> }</pre></code><tr><td>346<td><code><pre> */</pre></code><tr><td>347<td><code><pre></pre></code><tr><td>348<td><code><pre> numFields := r.businessConfigType.NumField()</pre></code><tr><td>349<td><code><pre> fieldList := make([]reflect.StructField, 0, numFields+1)</pre></code><tr><td>350<td><code><pre> fieldList = append(fieldList, reflect.StructField{</pre></code><tr><td>351<td><code><pre> Name: componentConfigFieldName,</pre></code><tr><td>352<td><code><pre> Type: reflect.StructOf(r.makeComponentsConfigFields()),</pre></code><tr><td>353<td><code><pre> Tag: `yaml:"base" json:"base" toml:"base"`,</pre></code><tr><td>354<td><code><pre> Anonymous: true,</pre></code><tr><td>355<td><code><pre> })</pre></code><tr><td>356<td><code><pre> for i := 0; i < numFields; i++ {</pre></code><tr><td>357<td><code><pre> fieldList = append(fieldList, r.businessConfigType.Field(i))</pre></code><tr><td>358<td><code><pre> }</pre></code><tr><td>359<td><code><pre></pre></code><tr><td>360<td><code><pre> return reflect.StructOf(fieldList)</pre></code><tr><td>361<td><code><pre>}</pre></code></table><div class=funcname id=fn_CryptoDecryptByTag>func CryptoDecryptByTag</div><div class=info><a href=#s_fn_CryptoDecryptByTag>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/crypto.go</code>:</div><table class=listing><tr><td>193<td><code><pre>func CryptoDecryptByTag(data any, opts ...utils.OptionExtender) {</pre></code><tr><td>194<td><code><pre> o := utils.ApplyOptions[InitOption](opts...)</pre></code><tr><td>195<td><code><pre> optsMap := Use(o.AppName).(*registry).cryptoConfig().ToOptionMap()</pre></code><tr><td>196<td><code><pre> for _, opts := range optsMap {</pre></code><tr><td>197<td><code><pre> utils.SliceReverse(opts)</pre></code><tr><td>198<td><code><pre> }</pre></code><tr><td>199<td><code><pre></pre></code><tr><td>200<td><code><pre> supportedFields := utils.NewSet(reflect.Struct, reflect.Array, reflect.Slice, reflect.Map)</pre></code><tr><td>201<td><code><pre> utils.TraverseValue(data, false, func(field reflect.StructField, value reflect.Value) (end, stepIn bool) {</pre></code><tr><td>202<td><code><pre> if !value.IsValid() || !value.CanInterface() || !value.CanSet() {</pre></code><tr><td>203<td><code><pre> return</pre></code><tr><td>204<td><code><pre> }</pre></code><tr><td>205<td><code><pre></pre></code><tr><td>206<td><code><pre> vk := value.Kind()</pre></code><tr><td>207<td><code><pre> stepIn = supportedFields.Contains(vk) ||</pre></code><tr><td>208<td><code><pre> (vk == reflect.Ptr && value.Elem().IsValid() && value.Elem().Kind() == reflect.Struct)</pre></code><tr><td>209<td><code><pre></pre></code><tr><td>210<td><code><pre> configName, ok := field.Tag.Lookup(cryptoTagKey)</pre></code><tr><td>211<td><code><pre> if !ok {</pre></code><tr><td>212<td><code><pre> return</pre></code><tr><td>213<td><code><pre> }</pre></code><tr><td>214<td><code><pre> opts, ok := optsMap[configName]</pre></code><tr><td>215<td><code><pre> if !ok {</pre></code><tr><td>216<td><code><pre> return</pre></code><tr><td>217<td><code><pre> }</pre></code><tr><td>218<td><code><pre> src := cast.ToString(value.Interface())</pre></code><tr><td>219<td><code><pre> if utils.IsStrBlank(src) {</pre></code><tr><td>220<td><code><pre> return</pre></code><tr><td>221<td><code><pre> }</pre></code><tr><td>222<td><code><pre></pre></code><tr><td>223<td><code><pre> dst := utils.Must(encode.From(src).Decode(opts...).ToString())</pre></code><tr><td>224<td><code><pre> value.SetString(dst)</pre></code><tr><td>225<td><code><pre> return</pre></code><tr><td>226<td><code><pre> })</pre></code><tr><td>227<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/flag.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func init() {</pre></code><tr><td>17<td><code><pre> pflag.StringSliceVar(&customConfigPath, "config-file", nil, "specify config file path, e.g. configs/app.yml")</pre></code><tr><td>18<td><code><pre> pflag.StringVarP(&appFlagString, "app", "", "", "app name")</pre></code><tr><td>19<td><code><pre> pflag.BoolVarP(&debugFlag, "debug", "", false,</pre></code><tr><td>20<td><code><pre> "enable debug mode, only works for http and db component now")</pre></code><tr><td>21<td><code><pre> pflag.StringVarP(&appBizFlagString, "app-config", "", "", "json string for app config")</pre></code><tr><td>22<td><code><pre> pflag.CommandLine.ParseErrorsWhitelist.UnknownFlags = true</pre></code><tr><td>23<td><code><pre>}</pre></code></table><div class=funcname id=fn_registry.makeComponentsConfigFields>func registry.makeComponentsConfigFields</div><div class=info><a href=#s_fn_registry.makeComponentsConfigFields>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>314<td><code><pre>func (r *registry) makeComponentsConfigFields() []reflect.StructField {</pre></code><tr><td>315<td><code><pre> fieldList := make([]reflect.StructField, len(r.componentList))</pre></code><tr><td>316<td><code><pre> for i := 0; i < len(r.componentList); i++ {</pre></code><tr><td>317<td><code><pre> component := r.componentList[i]</pre></code><tr><td>318<td><code><pre> fieldList[i] = reflect.StructField{</pre></code><tr><td>319<td><code><pre> Name: component.name,</pre></code><tr><td>320<td><code><pre> Type: component.constructorInputType,</pre></code><tr><td>321<td><code><pre> Tag: reflect.StructTag(component.tag),</pre></code><tr><td>322<td><code><pre> }</pre></code><tr><td>323<td><code><pre> }</pre></code><tr><td>324<td><code><pre></pre></code><tr><td>325<td><code><pre> return fieldList</pre></code><tr><td>326<td><code><pre>}</pre></code></table><div class=funcname id=fn_@364:26>func @364:26</div><div class=info><a href=#s_fn_@364:26>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>364<td><code><pre>func() {</pre></code><tr><td>365<td><code><pre> // app</pre></code><tr><td>366<td><code><pre> r.AddComponent(ComponentApp, func(context.Context, string, ...utils.OptionExtender) func() { return nil },</pre></code><tr><td>367<td><code><pre> WithTag("yaml", "app"), WithTag("json", "app"), WithTag("toml", "app"),</pre></code><tr><td>368<td><code><pre> WithFlag(utils.AnyPtr("null")),</pre></code><tr><td>369<td><code><pre> )</pre></code><tr><td>370<td><code><pre></pre></code><tr><td>371<td><code><pre> // debug</pre></code><tr><td>372<td><code><pre> r.AddComponent(ComponentDebug, func(context.Context, bool, ...utils.OptionExtender) func() { return nil },</pre></code><tr><td>373<td><code><pre> WithTag("yaml", "debug"), WithTag("json", "debug"), WithTag("toml", "debug"),</pre></code><tr><td>374<td><code><pre> WithFlag(utils.AnyPtr("null")),</pre></code><tr><td>375<td><code><pre> )</pre></code><tr><td>376<td><code><pre></pre></code><tr><td>377<td><code><pre> // crypto</pre></code><tr><td>378<td><code><pre> r.AddComponent(ComponentCrypto, CryptoConstruct,</pre></code><tr><td>379<td><code><pre> WithTag("yaml", "crypto"), WithTag("json", "crypto"), WithTag("toml", "crypto"),</pre></code><tr><td>380<td><code><pre> WithFlag(&cryptoFlagString),</pre></code><tr><td>381<td><code><pre> )</pre></code><tr><td>382<td><code><pre></pre></code><tr><td>383<td><code><pre> for _, item := range getComponents() {</pre></code><tr><td>384<td><code><pre> r.AddComponent(item.name, item.constructor, item.opt...)</pre></code><tr><td>385<td><code><pre> }</pre></code><tr><td>386<td><code><pre></pre></code><tr><td>387<td><code><pre> /* example */</pre></code><tr><td>388<td><code><pre> // registry.AddComponent("ComponentExample", func(context.Context, string) func() { return nil },</pre></code><tr><td>389<td><code><pre> // WithTag("custom_tag", "val"), WithTag("yaml", "val"))</pre></code><tr><td>390<td><code><pre> }</pre></code></table><div class=funcname id=fn_registry.Debug>func registry.Debug</div><div class=info><a href=#s_fn_registry.Debug>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/candy.go</code>:</div><table class=listing><tr><td>13<td><code><pre>func (r *registry) Debug() (debug bool) {</pre></code><tr><td>14<td><code><pre> if r.appName != "" {</pre></code><tr><td>15<td><code><pre> return r.debug</pre></code><tr><td>16<td><code><pre> }</pre></code><tr><td>17<td><code><pre> _ = r.LoadComponentConfig(ComponentDebug, &debug)</pre></code><tr><td>18<td><code><pre> return</pre></code><tr><td>19<td><code><pre>}</pre></code></table><div class=funcname id=fn_registry.AppName>func registry.AppName</div><div class=info><a href=#s_fn_registry.AppName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/candy.go</code>:</div><table class=listing><tr><td>21<td><code><pre>func (r *registry) AppName() (name string) {</pre></code><tr><td>22<td><code><pre> if r.appName != "" {</pre></code><tr><td>23<td><code><pre> return r.appName</pre></code><tr><td>24<td><code><pre> }</pre></code><tr><td>25<td><code><pre> _ = r.LoadComponentConfig(ComponentApp, &name)</pre></code><tr><td>26<td><code><pre> return</pre></code><tr><td>27<td><code><pre>}</pre></code></table><div class=funcname id=fn_AddComponent>func AddComponent</div><div class=info><a href=#s_fn_AddComponent>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/component.go</code>:</div><table class=listing><tr><td>132<td><code><pre>func AddComponent(name string, constructor any, opts ...ComponentOption) {</pre></code><tr><td>133<td><code><pre> componentLocker.Lock()</pre></code><tr><td>134<td><code><pre> defer componentLocker.Unlock()</pre></code><tr><td>135<td><code><pre> parseConstructor(constructor)</pre></code><tr><td>136<td><code><pre> components = append(components, &componentItem{name, constructor, opts})</pre></code><tr><td>137<td><code><pre>}</pre></code></table><div class=funcname id=fn_getComponents>func getComponents</div><div class=info><a href=#s_fn_getComponents>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/component.go</code>:</div><table class=listing><tr><td>139<td><code><pre>func getComponents() []*componentItem {</pre></code><tr><td>140<td><code><pre> componentLocker.RLock()</pre></code><tr><td>141<td><code><pre> defer componentLocker.RUnlock()</pre></code><tr><td>142<td><code><pre> return clone.Clone(components)</pre></code><tr><td>143<td><code><pre>}</pre></code></table><div class=funcname id=fn_registry.initAllConfigByLoadFunc>func registry.initAllConfigByLoadFunc</div><div class=info><a href=#s_fn_registry.initAllConfigByLoadFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>393<td><code><pre>func (r *registry) initAllConfigByLoadFunc(loadFn loadConfigFunc, opts ...utils.OptionExtender) {</pre></code><tr><td>394<td><code><pre> if loadFn != nil {</pre></code><tr><td>395<td><code><pre> loadFn(r.businessConfig, opts...)</pre></code><tr><td>396<td><code><pre> loadFn(r.componentConfigs, opts...)</pre></code><tr><td>397<td><code><pre> }</pre></code><tr><td>398<td><code><pre>}</pre></code></table><div class=funcname id=fn_parseFlags>func parseFlags</div><div class=info><a href=#s_fn_parseFlags>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/flag.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func parseFlags() {</pre></code><tr><td>26<td><code><pre> if !pflag.Parsed() {</pre></code><tr><td>27<td><code><pre> pflag.CommandLine.AddGoFlagSet(flag.CommandLine)</pre></code><tr><td>28<td><code><pre> pflag.Parse()</pre></code><tr><td>29<td><code><pre> }</pre></code><tr><td>30<td><code><pre>}</pre></code></table><div class=funcname id=fn_registry.makeComponentsConfigStruct>func registry.makeComponentsConfigStruct</div><div class=info><a href=#s_fn_registry.makeComponentsConfigStruct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>302<td><code><pre>func (r *registry) makeComponentsConfigStruct() reflect.Type {</pre></code><tr><td>303<td><code><pre> fieldList := r.makeComponentsConfigFields()</pre></code><tr><td>304<td><code><pre> return reflect.StructOf([]reflect.StructField{</pre></code><tr><td>305<td><code><pre> {</pre></code><tr><td>306<td><code><pre> Name: componentConfigFieldName,</pre></code><tr><td>307<td><code><pre> Type: reflect.StructOf(fieldList),</pre></code><tr><td>308<td><code><pre> Tag: `yaml:"base" json:"base" toml:"base"`,</pre></code><tr><td>309<td><code><pre> Anonymous: true,</pre></code><tr><td>310<td><code><pre> },</pre></code><tr><td>311<td><code><pre> })</pre></code><tr><td>312<td><code><pre>}</pre></code></table><div class=funcname id=fn_AppName>func AppName</div><div class=info><a href=#s_fn_AppName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/types.go</code>:</div><table class=listing><tr><td>22<td><code><pre>func AppName(name string) utils.OptionFunc[InitOption] {</pre></code><tr><td>23<td><code><pre> return func(o *InitOption) {</pre></code><tr><td>24<td><code><pre> o.AppName = name</pre></code><tr><td>25<td><code><pre> }</pre></code><tr><td>26<td><code><pre>}</pre></code></table><div class=funcname id=fn_@366:32>func @366:32</div><div class=info><a href=#s_fn_@366:32>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>366<td><code><pre>func(context.Context, string, ...utils.OptionExtender) func() { return nil }</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/crypto.go</code>:</div><table class=listing><tr><td>28<td><code><pre>func init() {</pre></code><tr><td>29<td><code><pre> pflag.StringVarP(&cryptoFlagString, "crypto-config", "", "", "json string for crypto config")</pre></code><tr><td>30<td><code><pre>}</pre></code></table><div class=funcname id=fn_@372:34>func @372:34</div><div class=info><a href=#s_fn_@372:34>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>372<td><code><pre>func(context.Context, bool, ...utils.OptionExtender) func() { return nil }</pre></code></table><div class=funcname id=fn_@121:9>func @121:9</div><div class=info><a href=#s_fn_@121:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/component.go</code>:</div><table class=listing><tr><td>121<td><code><pre>func(o *options) {</pre></code><tr><td>122<td><code><pre> o.flagValue = flagValue</pre></code><tr><td>123<td><code><pre> }</pre></code></table><div class=funcname id=fn_@29:9>func @29:9</div><div class=info><a href=#s_fn_@29:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/types.go</code>:</div><table class=listing><tr><td>29<td><code><pre>func(o *InitOption) {</pre></code><tr><td>30<td><code><pre> o.DI = di</pre></code><tr><td>31<td><code><pre> }</pre></code></table><div class=funcname id=fn_registry.getBaseObject>func registry.getBaseObject</div><div class=info><a href=#s_fn_registry.getBaseObject>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>298<td><code><pre>func (r *registry) getBaseObject() reflect.Value {</pre></code><tr><td>299<td><code><pre> return reflect.Indirect(reflect.ValueOf(r.componentConfigs)).FieldByName(componentConfigFieldName)</pre></code><tr><td>300<td><code><pre>}</pre></code></table><div class=funcname id=fn_registry.loadComponents>func registry.loadComponents</div><div class=info><a href=#s_fn_registry.loadComponents>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>363<td><code><pre>func (r *registry) loadComponents() {</pre></code><tr><td>364<td><code><pre> r.loadComponentsOnce.Do(func() {</pre></code><tr><td>365<td><code><pre> // app</pre></code><tr><td>366<td><code><pre> r.AddComponent(ComponentApp, func(context.Context, string, ...utils.OptionExtender) func() { return nil },</pre></code><tr><td>367<td><code><pre> WithTag("yaml", "app"), WithTag("json", "app"), WithTag("toml", "app"),</pre></code><tr><td>368<td><code><pre> WithFlag(utils.AnyPtr("null")),</pre></code><tr><td>369<td><code><pre> )</pre></code><tr><td>370<td><code><pre></pre></code><tr><td>371<td><code><pre> // debug</pre></code><tr><td>372<td><code><pre> r.AddComponent(ComponentDebug, func(context.Context, bool, ...utils.OptionExtender) func() { return nil },</pre></code><tr><td>373<td><code><pre> WithTag("yaml", "debug"), WithTag("json", "debug"), WithTag("toml", "debug"),</pre></code><tr><td>374<td><code><pre> WithFlag(utils.AnyPtr("null")),</pre></code><tr><td>375<td><code><pre> )</pre></code><tr><td>376<td><code><pre></pre></code><tr><td>377<td><code><pre> // crypto</pre></code><tr><td>378<td><code><pre> r.AddComponent(ComponentCrypto, CryptoConstruct,</pre></code><tr><td>379<td><code><pre> WithTag("yaml", "crypto"), WithTag("json", "crypto"), WithTag("toml", "crypto"),</pre></code><tr><td>380<td><code><pre> WithFlag(&cryptoFlagString),</pre></code><tr><td>381<td><code><pre> )</pre></code><tr><td>382<td><code><pre></pre></code><tr><td>383<td><code><pre> for _, item := range getComponents() {</pre></code><tr><td>384<td><code><pre> r.AddComponent(item.name, item.constructor, item.opt...)</pre></code><tr><td>385<td><code><pre> }</pre></code><tr><td>386<td><code><pre></pre></code><tr><td>387<td><code><pre> /* example */</pre></code><tr><td>388<td><code><pre> // registry.AddComponent("ComponentExample", func(context.Context, string) func() { return nil },</pre></code><tr><td>389<td><code><pre> // WithTag("custom_tag", "val"), WithTag("yaml", "val"))</pre></code><tr><td>390<td><code><pre> })</pre></code><tr><td>391<td><code><pre>}</pre></code></table><div class=funcname id=fn_WithFlag>func WithFlag</div><div class=info><a href=#s_fn_WithFlag>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/component.go</code>:</div><table class=listing><tr><td>120<td><code><pre>func WithFlag(flagValue *string) ComponentOption {</pre></code><tr><td>121<td><code><pre> return func(o *options) {</pre></code><tr><td>122<td><code><pre> o.flagValue = flagValue</pre></code><tr><td>123<td><code><pre> }</pre></code><tr><td>124<td><code><pre>}</pre></code></table><div class=funcname id=fn_@138:12>func @138:12</div><div class=info><a href=#s_fn_@138:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>138<td><code><pre>func() {</pre></code><tr><td>139<td><code><pre> r.initWg.Done()</pre></code><tr><td>140<td><code><pre> }</pre></code></table><div class=funcname id=fn_@459:9>func @459:9</div><div class=info><a href=#s_fn_@459:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>459<td><code><pre>func() {</pre></code><tr><td>460<td><code><pre> once.Do(func() {</pre></code><tr><td>461<td><code><pre> initLocker.Lock()</pre></code><tr><td>462<td><code><pre> defer initLocker.Unlock()</pre></code><tr><td>463<td><code><pre></pre></code><tr><td>464<td><code><pre> defer close(r.closeCh)</pre></code><tr><td>465<td><code><pre></pre></code><tr><td>466<td><code><pre> r.initWg.Done()</pre></code><tr><td>467<td><code><pre> r.initWg.Wait()</pre></code><tr><td>468<td><code><pre> cancel()</pre></code><tr><td>469<td><code><pre> for i := len(destructors) - 1; i >= 0; i-- {</pre></code><tr><td>470<td><code><pre> log.Printf("%v [Gofusion] %s %s exiting...", pid, app, hasCallbackComponentNames[i])</pre></code><tr><td>471<td><code><pre> destructors[i].Call(nil)</pre></code><tr><td>472<td><code><pre> log.Printf("%v [Gofusion] %s %s exited", pid, app, hasCallbackComponentNames[i])</pre></code><tr><td>473<td><code><pre> }</pre></code><tr><td>474<td><code><pre></pre></code><tr><td>475<td><code><pre> r.di.Clear()</pre></code><tr><td>476<td><code><pre> r.businessConfig = nil</pre></code><tr><td>477<td><code><pre> r.componentConfigs = nil</pre></code><tr><td>478<td><code><pre> r.initOnce = new(sync.Once)</pre></code><tr><td>479<td><code><pre> })</pre></code><tr><td>480<td><code><pre> }</pre></code></table><div class=funcname id=fn_@137:16>func @137:16</div><div class=info><a href=#s_fn_@137:16>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>137<td><code><pre>func() {</pre></code><tr><td>138<td><code><pre> once.Do(func() {</pre></code><tr><td>139<td><code><pre> r.initWg.Done()</pre></code><tr><td>140<td><code><pre> })</pre></code><tr><td>141<td><code><pre> }</pre></code></table><div class=funcname id=fn_WithTag>func WithTag</div><div class=info><a href=#s_fn_WithTag>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/component.go</code>:</div><table class=listing><tr><td>107<td><code><pre>func WithTag(name, val string) ComponentOption {</pre></code><tr><td>108<td><code><pre> return func(opt *options) {</pre></code><tr><td>109<td><code><pre> opt.tagList = append(opt.tagList, fmt.Sprintf(`%s:"%s"`, name, val))</pre></code><tr><td>110<td><code><pre> }</pre></code><tr><td>111<td><code><pre>}</pre></code></table><div class=funcname id=fn_newOptions>func newOptions</div><div class=info><a href=#s_fn_newOptions>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/component.go</code>:</div><table class=listing><tr><td>102<td><code><pre>func newOptions() *options {</pre></code><tr><td>103<td><code><pre> return &options{}</pre></code><tr><td>104<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewDefaultLoader>func NewDefaultLoader</div><div class=info><a href=#s_fn_NewDefaultLoader>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/loader.go</code>:</div><table class=listing><tr><td>22<td><code><pre>func NewDefaultLoader(files ...string) *loader {</pre></code><tr><td>23<td><code><pre> return &loader{</pre></code><tr><td>24<td><code><pre> files: files,</pre></code><tr><td>25<td><code><pre> }</pre></code><tr><td>26<td><code><pre>}</pre></code></table><div class=funcname id=fn_loader.Unmarshal>func loader.Unmarshal</div><div class=info><a href=#s_fn_loader.Unmarshal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/loader.go</code>:</div><table class=listing><tr><td>30<td><code><pre>func (l *loader) Unmarshal(out any) (err error) {</pre></code><tr><td>31<td><code><pre> return configor.New(&configor.Config{</pre></code><tr><td>32<td><code><pre> Environment: env.GetEnv(),</pre></code><tr><td>33<td><code><pre> ENVPrefix: "",</pre></code><tr><td>34<td><code><pre> Debug: false,</pre></code><tr><td>35<td><code><pre> Verbose: false,</pre></code><tr><td>36<td><code><pre> Silent: true,</pre></code><tr><td>37<td><code><pre> AutoReload: true,</pre></code><tr><td>38<td><code><pre> AutoReloadInterval: 0,</pre></code><tr><td>39<td><code><pre> AutoReloadCallback: func(config any) {</pre></code><tr><td>40<td><code><pre> log.Printf("%v [Gofusion] Config auto reload config successfully => \n%s",</pre></code><tr><td>41<td><code><pre> syscall.Getpid(), utils.Must(yaml.Marshal(config)))</pre></code><tr><td>42<td><code><pre> },</pre></code><tr><td>43<td><code><pre> ErrorOnUnmatchedKeys: false,</pre></code><tr><td>44<td><code><pre> FS: nil,</pre></code><tr><td>45<td><code><pre> }).Load(out, l.files...)</pre></code><tr><td>46<td><code><pre>}</pre></code></table><div class=funcname id=fn_@39:23>func @39:23</div><div class=info><a href=#s_fn_@39:23>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/loader.go</code>:</div><table class=listing><tr><td>39<td><code><pre>func(config any) {</pre></code><tr><td>40<td><code><pre> log.Printf("%v [Gofusion] Config auto reload config successfully => \n%s",</pre></code><tr><td>41<td><code><pre> syscall.Getpid(), utils.Must(yaml.Marshal(config)))</pre></code><tr><td>42<td><code><pre> }</pre></code></table><div class=funcname id=fn_@23:9>func @23:9</div><div class=info><a href=#s_fn_@23:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/types.go</code>:</div><table class=listing><tr><td>23<td><code><pre>func(o *InitOption) {</pre></code><tr><td>24<td><code><pre> o.AppName = name</pre></code><tr><td>25<td><code><pre> }</pre></code></table><div class=funcname id=fn_DI>func DI</div><div class=info><a href=#s_fn_DI>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/types.go</code>:</div><table class=listing><tr><td>28<td><code><pre>func DI(di di.DI) utils.OptionFunc[InitOption] {</pre></code><tr><td>29<td><code><pre> return func(o *InitOption) {</pre></code><tr><td>30<td><code><pre> o.DI = di</pre></code><tr><td>31<td><code><pre> }</pre></code><tr><td>32<td><code><pre>}</pre></code></table><div class=funcname id=fn_registry.DI>func registry.DI</div><div class=info><a href=#s_fn_registry.DI>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/candy.go</code>:</div><table class=listing><tr><td>29<td><code><pre>func (r *registry) DI() di.DI { return r.di }</pre></code></table><div class=funcname id=fn_Ctx>func Ctx</div><div class=info><a href=#s_fn_Ctx>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>84<td><code><pre>func Ctx(ctx context.Context) utils.OptionFunc[initOption] {</pre></code><tr><td>85<td><code><pre> return func(o *initOption) {</pre></code><tr><td>86<td><code><pre> o.bizCtx = ctx</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre>}</pre></code></table><div class=funcname id=fn_@85:9>func @85:9</div><div class=info><a href=#s_fn_@85:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>85<td><code><pre>func(o *initOption) {</pre></code><tr><td>86<td><code><pre> o.bizCtx = ctx</pre></code><tr><td>87<td><code><pre> }</pre></code></table><div class=funcname id=fn_Loader>func Loader</div><div class=info><a href=#s_fn_Loader>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>90<td><code><pre>func Loader(fn func(any, ...utils.OptionExtender)) utils.OptionFunc[initOption] {</pre></code><tr><td>91<td><code><pre> return func(o *initOption) {</pre></code><tr><td>92<td><code><pre> o.customLoadFunc = fn</pre></code><tr><td>93<td><code><pre> }</pre></code><tr><td>94<td><code><pre>}</pre></code></table><div class=funcname id=fn_@91:9>func @91:9</div><div class=info><a href=#s_fn_@91:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>91<td><code><pre>func(o *initOption) {</pre></code><tr><td>92<td><code><pre> o.customLoadFunc = fn</pre></code><tr><td>93<td><code><pre> }</pre></code></table><div class=funcname id=fn_Files>func Files</div><div class=info><a href=#s_fn_Files>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>96<td><code><pre>func Files(filenames []string) utils.OptionFunc[initOption] {</pre></code><tr><td>97<td><code><pre> return func(o *initOption) {</pre></code><tr><td>98<td><code><pre> o.filenames = filenames</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre>}</pre></code></table><div class=funcname id=fn_@97:9>func @97:9</div><div class=info><a href=#s_fn_@97:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>97<td><code><pre>func(o *initOption) {</pre></code><tr><td>98<td><code><pre> o.filenames = filenames</pre></code><tr><td>99<td><code><pre> }</pre></code></table><div class=funcname id=fn_@108:9>func @108:9</div><div class=info><a href=#s_fn_@108:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/component.go</code>:</div><table class=listing><tr><td>108<td><code><pre>func(opt *options) {</pre></code><tr><td>109<td><code><pre> opt.tagList = append(opt.tagList, fmt.Sprintf(`%s:"%s"`, name, val))</pre></code><tr><td>110<td><code><pre> }</pre></code></table><div class=funcname id=fn_@201:35>func @201:35</div><div class=info><a href=#s_fn_@201:35>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/crypto.go</code>:</div><table class=listing><tr><td>201<td><code><pre>func(field reflect.StructField, value reflect.Value) (end, stepIn bool) {</pre></code><tr><td>202<td><code><pre> if !value.IsValid() || !value.CanInterface() || !value.CanSet() {</pre></code><tr class=miss><td>203<td><code><pre> return</pre></code><tr><td>204<td><code><pre> }</pre></code><tr><td>205<td><code><pre></pre></code><tr><td>206<td><code><pre> vk := value.Kind()</pre></code><tr><td>207<td><code><pre> stepIn = supportedFields.Contains(vk) ||</pre></code><tr><td>208<td><code><pre> (vk == reflect.Ptr && value.Elem().IsValid() && value.Elem().Kind() == reflect.Struct)</pre></code><tr><td>209<td><code><pre></pre></code><tr><td>210<td><code><pre> configName, ok := field.Tag.Lookup(cryptoTagKey)</pre></code><tr><td>211<td><code><pre> if !ok {</pre></code><tr><td>212<td><code><pre> return</pre></code><tr><td>213<td><code><pre> }</pre></code><tr><td>214<td><code><pre> opts, ok := optsMap[configName]</pre></code><tr><td>215<td><code><pre> if !ok {</pre></code><tr><td>216<td><code><pre> return</pre></code><tr><td>217<td><code><pre> }</pre></code><tr><td>218<td><code><pre> src := cast.ToString(value.Interface())</pre></code><tr><td>219<td><code><pre> if utils.IsStrBlank(src) {</pre></code><tr><td>220<td><code><pre> return</pre></code><tr><td>221<td><code><pre> }</pre></code><tr><td>222<td><code><pre></pre></code><tr><td>223<td><code><pre> dst := utils.Must(encode.From(src).Decode(opts...).ToString())</pre></code><tr><td>224<td><code><pre> value.SetString(dst)</pre></code><tr><td>225<td><code><pre> return</pre></code><tr><td>226<td><code><pre> }</pre></code></table><div class=funcname id=fn_registry.AddComponent>func registry.AddComponent</div><div class=info><a href=#s_fn_registry.AddComponent>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>146<td><code><pre>func (r *registry) AddComponent(name string, constructor any, opts ...ComponentOption) {</pre></code><tr><td>147<td><code><pre> if name[0] < 'A' || name[0] > 'Z' {</pre></code><tr class=miss><td>148<td><code><pre> panic("component name should start with A-Z")</pre></code><tr><td>149<td><code><pre> }</pre></code><tr><td>150<td><code><pre> for idx, com := range r.componentList {</pre></code><tr><td>151<td><code><pre> if com.name == name {</pre></code><tr class=miss><td>152<td><code><pre> r.componentList = append(r.componentList[:idx], r.componentList[idx+1:]...)</pre></code><tr><td>153<td><code><pre> }</pre></code><tr><td>154<td><code><pre> }</pre></code><tr><td>155<td><code><pre> opt := newOptions()</pre></code><tr><td>156<td><code><pre> for _, fn := range opts {</pre></code><tr><td>157<td><code><pre> fn(opt)</pre></code><tr><td>158<td><code><pre> }</pre></code><tr><td>159<td><code><pre></pre></code><tr><td>160<td><code><pre> com := &Component{</pre></code><tr><td>161<td><code><pre> name: name,</pre></code><tr><td>162<td><code><pre> isCore: opt.isCoreComponent,</pre></code><tr><td>163<td><code><pre> flagString: opt.flagValue,</pre></code><tr><td>164<td><code><pre> }</pre></code><tr><td>165<td><code><pre></pre></code><tr><td>166<td><code><pre> hasYamlTag := false</pre></code><tr><td>167<td><code><pre> hasJsonTag := false</pre></code><tr><td>168<td><code><pre> hasTomlTag := false</pre></code><tr><td>169<td><code><pre> for _, tag := range opt.tagList {</pre></code><tr><td>170<td><code><pre> hasYamlTag = strings.HasPrefix(tag, "`yaml:")</pre></code><tr><td>171<td><code><pre> hasJsonTag = strings.HasPrefix(tag, "`json:")</pre></code><tr><td>172<td><code><pre> hasTomlTag = strings.HasPrefix(tag, "`toml:")</pre></code><tr><td>173<td><code><pre> }</pre></code><tr><td>174<td><code><pre> lowerName := strcase.ToSnake(name)</pre></code><tr><td>175<td><code><pre> if name == ComponentI18n {</pre></code><tr><td>176<td><code><pre> lowerName = strings.ToLower(name)</pre></code><tr><td>177<td><code><pre> }</pre></code><tr><td>178<td><code><pre> if !hasYamlTag {</pre></code><tr><td>179<td><code><pre> opt.tagList = append(opt.tagList, fmt.Sprintf(`yaml:"%s"`, lowerName))</pre></code><tr><td>180<td><code><pre> }</pre></code><tr><td>181<td><code><pre> if !hasJsonTag {</pre></code><tr><td>182<td><code><pre> opt.tagList = append(opt.tagList, fmt.Sprintf(`json:"%s"`, lowerName))</pre></code><tr><td>183<td><code><pre> }</pre></code><tr><td>184<td><code><pre> if !hasTomlTag {</pre></code><tr><td>185<td><code><pre> opt.tagList = append(opt.tagList, fmt.Sprintf(`toml:"%s"`, lowerName))</pre></code><tr><td>186<td><code><pre> }</pre></code><tr><td>187<td><code><pre> if len(opt.tagList) > 0 {</pre></code><tr><td>188<td><code><pre> com.tag = strings.Join(opt.tagList, " ")</pre></code><tr><td>189<td><code><pre> }</pre></code><tr><td>190<td><code><pre></pre></code><tr><td>191<td><code><pre> com.constructor, com.constructorInputType = parseConstructor(constructor)</pre></code><tr><td>192<td><code><pre></pre></code><tr><td>193<td><code><pre> r.addComponent(com)</pre></code><tr><td>194<td><code><pre>}</pre></code></table><div class=funcname id=fn_@36:18>func @36:18</div><div class=info><a href=#s_fn_@36:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/candy.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func(c *cryptoConf) {</pre></code><tr><td>37<td><code><pre> if c == nil {</pre></code><tr><td>38<td><code><pre> return</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre> c.Algorithm = cipher.ParseAlgorithm(c.AlgorithmString)</pre></code><tr><td>41<td><code><pre> c.Mode = cipher.ParseMode(c.ModeString)</pre></code><tr><td>42<td><code><pre> c.Key = utils.Must(base64.StdEncoding.DecodeString(c.KeyBase64))</pre></code><tr><td>43<td><code><pre> c.IV = utils.Must(base64.StdEncoding.DecodeString(c.IVBase64))</pre></code><tr><td>44<td><code><pre></pre></code><tr><td>45<td><code><pre> if utils.IsStrPtrNotBlank(c.CompressAlgorithmString) {</pre></code><tr class=miss><td>46<td><code><pre> c.CompressAlgorithm = compress.ParseAlgorithm(*c.CompressAlgorithmString)</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> if utils.IsStrPtrNotBlank(c.OutputAlgorithmString) {</pre></code><tr><td>49<td><code><pre> c.OutputAlgorithm = encode.ParseAlgorithm(*c.OutputAlgorithmString)</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre> }</pre></code></table><div class=funcname id=fn_CryptoConf.ToOptionMap>func CryptoConf.ToOptionMap</div><div class=info><a href=#s_fn_CryptoConf.ToOptionMap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/crypto.go</code>:</div><table class=listing><tr><td>37<td><code><pre>func (c *CryptoConf) ToOptionMap() (result map[string][]utils.OptionExtender) {</pre></code><tr><td>38<td><code><pre> result = make(map[string][]utils.OptionExtender)</pre></code><tr><td>39<td><code><pre> if c.Config != nil {</pre></code><tr><td>40<td><code><pre> result[""] = c.Config.ToOptions()</pre></code><tr><td>41<td><code><pre> }</pre></code><tr><td>42<td><code><pre> for name, cfg := range c.Custom {</pre></code><tr class=miss><td>43<td><code><pre> result[name] = cfg.ToOptions()</pre></code><tr><td>44<td><code><pre> }</pre></code><tr><td>45<td><code><pre> return</pre></code><tr><td>46<td><code><pre>}</pre></code></table><div class=funcname id=fn_Use>func Use</div><div class=info><a href=#s_fn_Use>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>35<td><code><pre>func Use(appName string, opts ...utils.OptionExtender) Configurable {</pre></code><tr><td>36<td><code><pre> registryLock.RLock()</pre></code><tr><td>37<td><code><pre> defer registryLock.RUnlock()</pre></code><tr><td>38<td><code><pre> cfg, ok := registryMap[appName]</pre></code><tr><td>39<td><code><pre> if !ok {</pre></code><tr class=miss><td>40<td><code><pre> panic(errors.Errorf("app register config not found: %s", appName))</pre></code><tr><td>41<td><code><pre> }</pre></code><tr><td>42<td><code><pre> return cfg</pre></code><tr><td>43<td><code><pre>}</pre></code></table><div class=funcname id=fn_cryptoConf.ToOptions>func cryptoConf.ToOptions</div><div class=info><a href=#s_fn_cryptoConf.ToOptions>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/crypto.go</code>:</div><table class=listing><tr><td>71<td><code><pre>func (c *cryptoConf) ToOptions() (opts []utils.OptionExtender) {</pre></code><tr><td>72<td><code><pre> if !c.Algorithm.IsValid() {</pre></code><tr class=miss><td>73<td><code><pre> return nil</pre></code><tr><td>74<td><code><pre> }</pre></code><tr><td>75<td><code><pre></pre></code><tr><td>76<td><code><pre> if c.ConfuseKey {</pre></code><tr><td>77<td><code><pre> c.Key = c.cryptoConfuseKey(c.Key)</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre></pre></code><tr><td>80<td><code><pre> opts = make([]utils.OptionExtender, 0, 3)</pre></code><tr><td>81<td><code><pre> opts = append(opts, encode.Cipher(c.Algorithm, c.Mode, c.Key, c.IV))</pre></code><tr><td>82<td><code><pre> if c.CompressAlgorithm.IsValid() {</pre></code><tr class=miss><td>83<td><code><pre> opts = append(opts, encode.Compress(c.CompressAlgorithm))</pre></code><tr><td>84<td><code><pre> }</pre></code><tr><td>85<td><code><pre> if c.OutputAlgorithm.IsValid() {</pre></code><tr><td>86<td><code><pre> opts = append(opts, encode.Encode(c.OutputAlgorithm))</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre> return</pre></code><tr><td>89<td><code><pre>}</pre></code></table><div class=funcname id=fn_registry.cryptoConfig>func registry.cryptoConfig</div><div class=info><a href=#s_fn_registry.cryptoConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/candy.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func (r *registry) cryptoConfig() (conf *CryptoConf) {</pre></code><tr><td>32<td><code><pre> conf = new(CryptoConf)</pre></code><tr><td>33<td><code><pre> if err := r.LoadComponentConfig(ComponentCrypto, &conf); err != nil {</pre></code><tr class=miss><td>34<td><code><pre> return</pre></code><tr><td>35<td><code><pre> }</pre></code><tr><td>36<td><code><pre> parseCfgFunc := func(c *cryptoConf) {</pre></code><tr><td>37<td><code><pre> if c == nil {</pre></code><tr><td>38<td><code><pre> return</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre> c.Algorithm = cipher.ParseAlgorithm(c.AlgorithmString)</pre></code><tr><td>41<td><code><pre> c.Mode = cipher.ParseMode(c.ModeString)</pre></code><tr><td>42<td><code><pre> c.Key = utils.Must(base64.StdEncoding.DecodeString(c.KeyBase64))</pre></code><tr><td>43<td><code><pre> c.IV = utils.Must(base64.StdEncoding.DecodeString(c.IVBase64))</pre></code><tr><td>44<td><code><pre></pre></code><tr><td>45<td><code><pre> if utils.IsStrPtrNotBlank(c.CompressAlgorithmString) {</pre></code><tr><td>46<td><code><pre> c.CompressAlgorithm = compress.ParseAlgorithm(*c.CompressAlgorithmString)</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> if utils.IsStrPtrNotBlank(c.OutputAlgorithmString) {</pre></code><tr><td>49<td><code><pre> c.OutputAlgorithm = encode.ParseAlgorithm(*c.OutputAlgorithmString)</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre> }</pre></code><tr><td>52<td><code><pre></pre></code><tr><td>53<td><code><pre> if conf != nil {</pre></code><tr><td>54<td><code><pre> parseCfgFunc(conf.Config)</pre></code><tr><td>55<td><code><pre> conf.Custom = make(map[string]*cryptoConf)</pre></code><tr><td>56<td><code><pre> for _, c := range conf.Custom {</pre></code><tr class=miss><td>57<td><code><pre> parseCfgFunc(c)</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre></pre></code><tr><td>61<td><code><pre> return</pre></code><tr><td>62<td><code><pre>}</pre></code></table><div class=funcname id=fn_registry.LoadComponentConfig>func registry.LoadComponentConfig</div><div class=info><a href=#s_fn_registry.LoadComponentConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>196<td><code><pre>func (r *registry) LoadComponentConfig(name string, componentConfig any) (err error) {</pre></code><tr><td>197<td><code><pre> val := reflect.ValueOf(componentConfig)</pre></code><tr><td>198<td><code><pre> typ := val.Type()</pre></code><tr><td>199<td><code><pre> if typ.Kind() != reflect.Ptr {</pre></code><tr class=miss><td>200<td><code><pre> return errors.New("componentConfig should be pointer")</pre></code><tr><td>201<td><code><pre> }</pre></code><tr><td>202<td><code><pre></pre></code><tr><td>203<td><code><pre> var found bool</pre></code><tr><td>204<td><code><pre> for _, com := range r.componentList {</pre></code><tr><td>205<td><code><pre> if com.name == name {</pre></code><tr><td>206<td><code><pre> found = true</pre></code><tr><td>207<td><code><pre> break</pre></code><tr><td>208<td><code><pre> }</pre></code><tr><td>209<td><code><pre> }</pre></code><tr><td>210<td><code><pre> if !found {</pre></code><tr class=miss><td>211<td><code><pre> return errors.Errorf("no such component [%s]", name)</pre></code><tr><td>212<td><code><pre> }</pre></code><tr><td>213<td><code><pre></pre></code><tr><td>214<td><code><pre> // load config</pre></code><tr><td>215<td><code><pre> if r.componentConfigs == nil {</pre></code><tr class=miss><td>216<td><code><pre> return</pre></code><tr><td>217<td><code><pre> }</pre></code><tr><td>218<td><code><pre> componentConfigsValue := utils.IndirectValue(reflect.ValueOf(clone.Clone(r.componentConfigs)))</pre></code><tr><td>219<td><code><pre> if !componentConfigsValue.IsValid() {</pre></code><tr class=miss><td>220<td><code><pre> return errors.Errorf("component configs not initialize now [%s]", name)</pre></code><tr><td>221<td><code><pre> }</pre></code><tr><td>222<td><code><pre> componentConfigValue := componentConfigsValue.FieldByName(componentConfigFieldName).FieldByName(name)</pre></code><tr><td>223<td><code><pre></pre></code><tr><td>224<td><code><pre> if componentConfigValue.Type().Kind() == reflect.Ptr {</pre></code><tr class=miss><td>225<td><code><pre> if componentConfigValue.IsNil() {</pre></code><tr class=miss><td>226<td><code><pre> return</pre></code><tr><td>227<td><code><pre> }</pre></code><tr class=miss><td>228<td><code><pre> componentConfigValue = componentConfigValue.Elem()</pre></code><tr><td>229<td><code><pre> }</pre></code><tr><td>230<td><code><pre> if componentConfigValue.Type() == typ.Elem() || componentConfigValue.Type().ConvertibleTo(typ.Elem()) {</pre></code><tr><td>231<td><code><pre> val.Elem().Set(reflect.ValueOf(clone.Clone(componentConfigValue.Convert(typ.Elem()).Interface())))</pre></code><tr><td>232<td><code><pre> return</pre></code><tr><td>233<td><code><pre> }</pre></code><tr><td>234<td><code><pre></pre></code><tr><td>235<td><code><pre> decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{</pre></code><tr><td>236<td><code><pre> Metadata: nil,</pre></code><tr><td>237<td><code><pre> Result: componentConfig,</pre></code><tr><td>238<td><code><pre> TagName: "yaml",</pre></code><tr><td>239<td><code><pre> WeaklyTypedInput: true,</pre></code><tr><td>240<td><code><pre> })</pre></code><tr><td>241<td><code><pre> if err != nil {</pre></code><tr class=miss><td>242<td><code><pre> return</pre></code><tr><td>243<td><code><pre> }</pre></code><tr><td>244<td><code><pre> return decoder.Decode(componentConfigValue.Interface())</pre></code><tr><td>245<td><code><pre>}</pre></code></table><div class=funcname id=fn_loadConfig>func loadConfig</div><div class=info><a href=#s_fn_loadConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/loader.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func loadConfig(out any, opts ...utils.OptionExtender) {</pre></code><tr><td>53<td><code><pre> parseFlags()</pre></code><tr><td>54<td><code><pre></pre></code><tr><td>55<td><code><pre> opt := utils.ApplyOptions[initOption](opts...)</pre></code><tr><td>56<td><code><pre></pre></code><tr><td>57<td><code><pre> files := make([]string, 0, 2)</pre></code><tr><td>58<td><code><pre> switch {</pre></code><tr><td>59<td><code><pre> case len(customConfigPath) > 0:</pre></code><tr class=miss><td>60<td><code><pre> for _, p := range customConfigPath {</pre></code><tr class=miss><td>61<td><code><pre> files = append(files, filepath.Clean(p))</pre></code><tr><td>62<td><code><pre> }</pre></code><tr><td>63<td><code><pre> case len(opt.filenames) > 0:</pre></code><tr><td>64<td><code><pre> files = append(files, opt.filenames...)</pre></code><tr><td>65<td><code><pre> default:</pre></code><tr><td>66<td><code><pre> defaultPathPrefix := filepath.Join(env.WorkDir, "configs", "app.")</pre></code><tr><td>67<td><code><pre> defaultLocal1PathPrefix := filepath.Join(env.WorkDir, "configs", "app.local.")</pre></code><tr><td>68<td><code><pre> defaultLocal2PathPrefix := filepath.Join(env.WorkDir, "configs", "app_local.")</pre></code><tr><td>69<td><code><pre> defaultLocal3PathPrefix := filepath.Join(env.WorkDir, "configs", "app-local.")</pre></code><tr><td>70<td><code><pre> extensions := []string{"yaml", "yml", "json", "toml"}</pre></code><tr><td>71<td><code><pre> for _, ext := range extensions {</pre></code><tr><td>72<td><code><pre> localFilename := defaultLocal1PathPrefix + ext</pre></code><tr><td>73<td><code><pre> if _, err := os.Stat(localFilename); err == nil {</pre></code><tr><td>74<td><code><pre> files = append(files, localFilename)</pre></code><tr><td>75<td><code><pre> continue</pre></code><tr><td>76<td><code><pre> }</pre></code><tr><td>77<td><code><pre> localFilename = defaultLocal2PathPrefix + ext</pre></code><tr><td>78<td><code><pre> if _, err := os.Stat(localFilename); err == nil {</pre></code><tr class=miss><td>79<td><code><pre> files = append(files, localFilename)</pre></code><tr class=miss><td>80<td><code><pre> continue</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre> localFilename = defaultLocal3PathPrefix + ext</pre></code><tr><td>83<td><code><pre> if _, err := os.Stat(localFilename); err == nil {</pre></code><tr class=miss><td>84<td><code><pre> files = append(files, localFilename)</pre></code><tr class=miss><td>85<td><code><pre> continue</pre></code><tr><td>86<td><code><pre> }</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre> for _, ext := range extensions {</pre></code><tr><td>89<td><code><pre> defaultFilename := defaultPathPrefix + ext</pre></code><tr><td>90<td><code><pre> files = append(files, defaultFilename)</pre></code><tr><td>91<td><code><pre> }</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre></pre></code><tr><td>94<td><code><pre> if profile != "" {</pre></code><tr class=miss><td>95<td><code><pre> if err := configor.New(&configor.Config{Environment: profile}).Load(out, files...); err != nil {</pre></code><tr class=miss><td>96<td><code><pre> panic(errors.Errorf("parse config file of config env %s error: %v", profile, err))</pre></code><tr><td>97<td><code><pre> }</pre></code><tr class=miss><td>98<td><code><pre> return</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre></pre></code><tr><td>101<td><code><pre> if err := NewDefaultLoader(files...).Unmarshal(out); err != nil {</pre></code><tr class=miss><td>102<td><code><pre> panic(errors.Errorf("parse config file error! %s", err))</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre>}</pre></code></table><div class=funcname id=fn_@493:37>func @493:37</div><div class=info><a href=#s_fn_@493:37>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>493<td><code><pre>func(i, j int) bool {</pre></code><tr><td>494<td><code><pre> // core component would not be sorted</pre></code><tr><td>495<td><code><pre> if r.componentList[i].isCore || r.componentList[j].isCore {</pre></code><tr class=miss><td>496<td><code><pre> return false</pre></code><tr><td>497<td><code><pre> }</pre></code><tr><td>498<td><code><pre></pre></code><tr><td>499<td><code><pre> orderA := indexComponent(r.componentList[i].name)</pre></code><tr><td>500<td><code><pre> if orderA == -1 {</pre></code><tr class=miss><td>501<td><code><pre> return false</pre></code><tr><td>502<td><code><pre> }</pre></code><tr><td>503<td><code><pre> orderB := indexComponent(r.componentList[j].name)</pre></code><tr><td>504<td><code><pre> if orderB == -1 {</pre></code><tr class=miss><td>505<td><code><pre> return true</pre></code><tr><td>506<td><code><pre> }</pre></code><tr><td>507<td><code><pre></pre></code><tr><td>508<td><code><pre> return orderA < orderB</pre></code><tr><td>509<td><code><pre> }</pre></code></table><div class=funcname id=fn_registry.checkBusinessConfig>func registry.checkBusinessConfig</div><div class=info><a href=#s_fn_registry.checkBusinessConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>527<td><code><pre>func (r *registry) checkBusinessConfig(businessConfig any) {</pre></code><tr><td>528<td><code><pre> typ := reflect.TypeOf(businessConfig)</pre></code><tr><td>529<td><code><pre> if typ.Kind() != reflect.Ptr || typ.Elem().Kind() != reflect.Ptr {</pre></code><tr class=miss><td>530<td><code><pre> panic(errors.New("businessConfig should be a **struct"))</pre></code><tr><td>531<td><code><pre> }</pre></code><tr><td>532<td><code><pre>}</pre></code></table><div class=funcname id=fn_parseConstructor>func parseConstructor</div><div class=info><a href=#s_fn_parseConstructor>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/component.go</code>:</div><table class=listing><tr><td>145<td><code><pre>func parseConstructor(fn any) (fnVal reflect.Value, input reflect.Type) {</pre></code><tr><td>146<td><code><pre> fnVal = reflect.ValueOf(fn)</pre></code><tr><td>147<td><code><pre> typ := reflect.TypeOf(fn)</pre></code><tr><td>148<td><code><pre> if typ.Kind() != reflect.Func {</pre></code><tr class=miss><td>149<td><code><pre> panic(errors.New("component constructor should be a function"))</pre></code><tr><td>150<td><code><pre> }</pre></code><tr><td>151<td><code><pre></pre></code><tr><td>152<td><code><pre> // check output</pre></code><tr><td>153<td><code><pre> if typ.NumOut() != 1 {</pre></code><tr class=miss><td>154<td><code><pre> panic(errors.New("component constructor should return one finalizer function"))</pre></code><tr><td>155<td><code><pre> }</pre></code><tr><td>156<td><code><pre> retTyp := typ.Out(0)</pre></code><tr><td>157<td><code><pre> if retTyp.Kind() != reflect.Func {</pre></code><tr class=miss><td>158<td><code><pre> panic(errors.New("component constructor should return one finalizer function"))</pre></code><tr><td>159<td><code><pre> }</pre></code><tr><td>160<td><code><pre> if retTyp.NumIn() != 0 {</pre></code><tr class=miss><td>161<td><code><pre> panic(errors.New("component constructor should return one finalizer function looks like func()"))</pre></code><tr><td>162<td><code><pre> }</pre></code><tr><td>163<td><code><pre></pre></code><tr><td>164<td><code><pre> // check input</pre></code><tr><td>165<td><code><pre> fnType := fnVal.Type()</pre></code><tr><td>166<td><code><pre> if n := fnType.NumIn(); n != 1 && (!fnType.IsVariadic() && n != 3) {</pre></code><tr class=miss><td>167<td><code><pre> panic(errors.New("component constructor should receive input looks like " +</pre></code><tr><td>168<td><code><pre> "func(context.Context), func(context.Context, *serializableConf, ...utils.OptionExtender)"))</pre></code><tr><td>169<td><code><pre> }</pre></code><tr><td>170<td><code><pre> if fnType.In(0) != constant.ContextType {</pre></code><tr class=miss><td>171<td><code><pre> panic(errors.New("component constructor should receive context.Context as first input " +</pre></code><tr><td>172<td><code><pre> "looks like func(context.Context), func(context.Context, *serializableConf, ...utils.OptionExtender)"))</pre></code><tr><td>173<td><code><pre> }</pre></code><tr><td>174<td><code><pre></pre></code><tr><td>175<td><code><pre> // wrapper</pre></code><tr><td>176<td><code><pre> switch typ.NumIn() {</pre></code><tr><td>177<td><code><pre> case 1:</pre></code><tr class=miss><td>178<td><code><pre> input = reflect.TypeOf(int(0))</pre></code><tr class=miss><td>179<td><code><pre> fnVal = reflect.ValueOf(func(ctx context.Context, mock int, _ ...utils.OptionExtender) func() {</pre></code><tr><td>180<td><code><pre> out := reflect.ValueOf(fn).Call([]reflect.Value{reflect.ValueOf(ctx)})</pre></code><tr><td>181<td><code><pre> if retfn := out[0]; retfn.IsNil() {</pre></code><tr><td>182<td><code><pre> return nil</pre></code><tr><td>183<td><code><pre> } else if obj := retfn.Interface(); obj == nil {</pre></code><tr><td>184<td><code><pre> return nil</pre></code><tr><td>185<td><code><pre> } else if fn, ok := obj.(func()); !ok {</pre></code><tr><td>186<td><code><pre> return nil</pre></code><tr><td>187<td><code><pre> } else {</pre></code><tr><td>188<td><code><pre> return fn</pre></code><tr><td>189<td><code><pre> }</pre></code><tr><td>190<td><code><pre> })</pre></code><tr><td>191<td><code><pre> case 3:</pre></code><tr><td>192<td><code><pre> input = typ.In(1)</pre></code><tr><td>193<td><code><pre> argsType := typ.In(2)</pre></code><tr><td>194<td><code><pre> if argsType.Kind() != reflect.Slice ||</pre></code><tr><td>195<td><code><pre> argsType.Elem() != reflect.TypeOf((*utils.OptionExtender)(nil)).Elem() {</pre></code><tr class=miss><td>196<td><code><pre> panic(errors.New("component constructor only receive utils.OptionExtender variadic input"))</pre></code><tr><td>197<td><code><pre> }</pre></code><tr><td>198<td><code><pre> default:</pre></code><tr class=miss><td>199<td><code><pre> panic(errors.New("component constructor should receive one or three inputs looks like " +</pre></code><tr><td>200<td><code><pre> "func(context.Context), func(context.Context, *serializableConf, ...utils.OptionExtender)"))</pre></code><tr><td>201<td><code><pre> }</pre></code><tr><td>202<td><code><pre> return</pre></code><tr><td>203<td><code><pre>}</pre></code></table><div class=funcname id=fn_registry.initAllConfigByFlag>func registry.initAllConfigByFlag</div><div class=info><a href=#s_fn_registry.initAllConfigByFlag>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>400<td><code><pre>func (r *registry) initAllConfigByFlag() {</pre></code><tr><td>401<td><code><pre> configVal := utils.IndirectValue(reflect.ValueOf(r.componentConfigs)).FieldByName(componentConfigFieldName)</pre></code><tr><td>402<td><code><pre> for i := 0; i < len(r.componentList); i++ {</pre></code><tr><td>403<td><code><pre> com := r.componentList[i]</pre></code><tr><td>404<td><code><pre> if utils.IsStrPtrBlank(com.flagString) {</pre></code><tr><td>405<td><code><pre> continue</pre></code><tr><td>406<td><code><pre> }</pre></code><tr><td>407<td><code><pre> switch com.name {</pre></code><tr><td>408<td><code><pre> case ComponentApp:</pre></code><tr><td>409<td><code><pre> if utils.IsStrNotBlank(appFlagString) {</pre></code><tr class=miss><td>410<td><code><pre> configVal.FieldByName(com.name).SetString(appFlagString)</pre></code><tr><td>411<td><code><pre> }</pre></code><tr><td>412<td><code><pre> case ComponentDebug:</pre></code><tr><td>413<td><code><pre> if debugFlag {</pre></code><tr class=miss><td>414<td><code><pre> configVal.FieldByName(com.name).SetBool(debugFlag)</pre></code><tr><td>415<td><code><pre> }</pre></code><tr><td>416<td><code><pre> default:</pre></code><tr class=miss><td>417<td><code><pre> comValp := configVal.FieldByName(com.name).Addr()</pre></code><tr class=miss><td>418<td><code><pre> utils.MustSuccess(json.Unmarshal([]byte(*com.flagString), comValp.Interface()))</pre></code><tr><td>419<td><code><pre></pre></code><tr><td>420<td><code><pre> // process defaults</pre></code><tr class=miss><td>421<td><code><pre> _ = utils.ParseTag(comValp.Interface(), utils.ParseTagName("default"),</pre></code><tr><td>422<td><code><pre> utils.ParseTagUnmarshalType(utils.UnmarshalTypeYaml))</pre></code><tr><td>423<td><code><pre> }</pre></code><tr><td>424<td><code><pre> }</pre></code><tr><td>425<td><code><pre></pre></code><tr><td>426<td><code><pre> if len(appBizFlagString) > 0 {</pre></code><tr class=miss><td>427<td><code><pre> utils.MustSuccess(json.Unmarshal([]byte(appBizFlagString), &r.businessConfig))</pre></code><tr><td>428<td><code><pre> }</pre></code><tr><td>429<td><code><pre>}</pre></code></table><div class=funcname id=fn_indexComponent>func indexComponent</div><div class=info><a href=#s_fn_indexComponent>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/component.go</code>:</div><table class=listing><tr><td>64<td><code><pre>func indexComponent(name string) (idx int) {</pre></code><tr><td>65<td><code><pre> for idx = 0; idx < len(componentOrder); idx++ {</pre></code><tr><td>66<td><code><pre> if componentOrder[idx] == name {</pre></code><tr><td>67<td><code><pre> return</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre> }</pre></code><tr class=miss><td>70<td><code><pre> idx = -1</pre></code><tr class=miss><td>71<td><code><pre> return</pre></code><tr><td>72<td><code><pre>}</pre></code></table><div class=funcname id=fn_checkCryptoConf>func checkCryptoConf</div><div class=info><a href=#s_fn_checkCryptoConf>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/crypto.go</code>:</div><table class=listing><tr><td>125<td><code><pre>func checkCryptoConf(name string, c *cryptoConf) {</pre></code><tr><td>126<td><code><pre> // cipher</pre></code><tr><td>127<td><code><pre> if c.Algorithm = cipher.ParseAlgorithm(c.AlgorithmString); !c.Algorithm.IsValid() {</pre></code><tr class=miss><td>128<td><code><pre> panic(errors.Errorf("unknown config %s algorithm: %s", name, c.AlgorithmString))</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre> c.Mode = cipher.ParseMode(c.ModeString)</pre></code><tr><td>131<td><code><pre> if !c.Mode.IsValid() {</pre></code><tr class=miss><td>132<td><code><pre> panic(errors.Errorf("unknown config %s mode: %s", name, c.ModeString))</pre></code><tr><td>133<td><code><pre> }</pre></code><tr><td>134<td><code><pre> if utils.IsStrBlank(c.KeyBase64) {</pre></code><tr class=miss><td>135<td><code><pre> panic(errors.Errorf("%s not found crypto key", name))</pre></code><tr><td>136<td><code><pre> }</pre></code><tr><td>137<td><code><pre> c.Key = utils.Must(base64.StdEncoding.DecodeString(c.KeyBase64))</pre></code><tr><td>138<td><code><pre> if c.Mode.NeedIV() && utils.IsStrBlank(c.IVBase64) {</pre></code><tr class=miss><td>139<td><code><pre> panic(errors.Errorf("%s not found crypto iv", name))</pre></code><tr><td>140<td><code><pre> }</pre></code><tr><td>141<td><code><pre> c.IV = utils.Must(base64.StdEncoding.DecodeString(c.IVBase64))</pre></code><tr><td>142<td><code><pre></pre></code><tr><td>143<td><code><pre> // compress</pre></code><tr><td>144<td><code><pre> if utils.IsStrPtrNotBlank(c.CompressAlgorithmString) {</pre></code><tr class=miss><td>145<td><code><pre> c.CompressAlgorithm = compress.ParseAlgorithm(*c.CompressAlgorithmString)</pre></code><tr class=miss><td>146<td><code><pre> if !c.CompressAlgorithm.IsValid() {</pre></code><tr class=miss><td>147<td><code><pre> panic(errors.Errorf("unknown config %s compress algorithm: %s", name, *c.CompressAlgorithmString))</pre></code><tr><td>148<td><code><pre> }</pre></code><tr><td>149<td><code><pre> }</pre></code><tr><td>150<td><code><pre></pre></code><tr><td>151<td><code><pre> // output</pre></code><tr><td>152<td><code><pre> if utils.IsStrPtrNotBlank(c.OutputAlgorithmString) {</pre></code><tr><td>153<td><code><pre> c.OutputAlgorithm = encode.ParseAlgorithm(*c.OutputAlgorithmString)</pre></code><tr><td>154<td><code><pre> if !c.OutputAlgorithm.IsValid() {</pre></code><tr class=miss><td>155<td><code><pre> panic(errors.Errorf("unknown config %s output algorithm: %s", name, *c.OutputAlgorithmString))</pre></code><tr><td>156<td><code><pre> }</pre></code><tr><td>157<td><code><pre> }</pre></code><tr><td>158<td><code><pre>}</pre></code></table><div class=funcname id=fn_registry.addComponent>func registry.addComponent</div><div class=info><a href=#s_fn_registry.addComponent>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>483<td><code><pre>func (r *registry) addComponent(com *Component) {</pre></code><tr><td>484<td><code><pre> firstNonCoreComIndex := -1</pre></code><tr><td>485<td><code><pre> for i, cp := range r.componentList {</pre></code><tr><td>486<td><code><pre> if !cp.isCore {</pre></code><tr><td>487<td><code><pre> firstNonCoreComIndex = i</pre></code><tr><td>488<td><code><pre> break</pre></code><tr><td>489<td><code><pre> }</pre></code><tr><td>490<td><code><pre> }</pre></code><tr><td>491<td><code><pre> if !com.isCore || firstNonCoreComIndex == -1 {</pre></code><tr><td>492<td><code><pre> r.componentList = append(r.componentList, com)</pre></code><tr><td>493<td><code><pre> sort.SliceStable(r.componentList, func(i, j int) bool {</pre></code><tr><td>494<td><code><pre> // core component would not be sorted</pre></code><tr><td>495<td><code><pre> if r.componentList[i].isCore || r.componentList[j].isCore {</pre></code><tr><td>496<td><code><pre> return false</pre></code><tr><td>497<td><code><pre> }</pre></code><tr><td>498<td><code><pre></pre></code><tr><td>499<td><code><pre> orderA := indexComponent(r.componentList[i].name)</pre></code><tr><td>500<td><code><pre> if orderA == -1 {</pre></code><tr><td>501<td><code><pre> return false</pre></code><tr><td>502<td><code><pre> }</pre></code><tr><td>503<td><code><pre> orderB := indexComponent(r.componentList[j].name)</pre></code><tr><td>504<td><code><pre> if orderB == -1 {</pre></code><tr><td>505<td><code><pre> return true</pre></code><tr><td>506<td><code><pre> }</pre></code><tr><td>507<td><code><pre></pre></code><tr><td>508<td><code><pre> return orderA < orderB</pre></code><tr><td>509<td><code><pre> })</pre></code><tr><td>510<td><code><pre></pre></code><tr><td>511<td><code><pre> return</pre></code><tr><td>512<td><code><pre> }</pre></code><tr class=miss><td>513<td><code><pre> list := make([]*Component, len(r.componentList)+1)</pre></code><tr class=miss><td>514<td><code><pre> for i := range list {</pre></code><tr class=miss><td>515<td><code><pre> if i < firstNonCoreComIndex {</pre></code><tr class=miss><td>516<td><code><pre> list[i] = r.componentList[i]</pre></code><tr class=miss><td>517<td><code><pre> } else if i == firstNonCoreComIndex {</pre></code><tr class=miss><td>518<td><code><pre> list[i] = com</pre></code><tr><td>519<td><code><pre> } else {</pre></code><tr class=miss><td>520<td><code><pre> list[i] = r.componentList[i-1]</pre></code><tr><td>521<td><code><pre> }</pre></code><tr><td>522<td><code><pre> }</pre></code><tr><td>523<td><code><pre></pre></code><tr class=miss><td>524<td><code><pre> r.componentList = list</pre></code><tr><td>525<td><code><pre>}</pre></code></table><div class=funcname id=fn_@179:27>func @179:27</div><div class=info><a href=#s_fn_@179:27>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/component.go</code>:</div><table class=listing><tr><td>179<td><code><pre>func(ctx context.Context, mock int, _ ...utils.OptionExtender) func() {</pre></code><tr class=miss><td>180<td><code><pre> out := reflect.ValueOf(fn).Call([]reflect.Value{reflect.ValueOf(ctx)})</pre></code><tr class=miss><td>181<td><code><pre> if retfn := out[0]; retfn.IsNil() {</pre></code><tr class=miss><td>182<td><code><pre> return nil</pre></code><tr class=miss><td>183<td><code><pre> } else if obj := retfn.Interface(); obj == nil {</pre></code><tr class=miss><td>184<td><code><pre> return nil</pre></code><tr class=miss><td>185<td><code><pre> } else if fn, ok := obj.(func()); !ok {</pre></code><tr class=miss><td>186<td><code><pre> return nil</pre></code><tr><td>187<td><code><pre> } else {</pre></code><tr class=miss><td>188<td><code><pre> return fn</pre></code><tr><td>189<td><code><pre> }</pre></code><tr><td>190<td><code><pre> }</pre></code></table><div class=funcname id=fn_CryptoDecryptFunc>func CryptoDecryptFunc</div><div class=info><a href=#s_fn_CryptoDecryptFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/crypto.go</code>:</div><table class=listing><tr><td>180<td><code><pre>func CryptoDecryptFunc(opts ...utils.OptionExtender) func(src string) (dst string) {</pre></code><tr class=miss><td>181<td><code><pre> o := utils.ApplyOptions[InitOption](opts...)</pre></code><tr class=miss><td>182<td><code><pre> opt := utils.ApplyOptions[cryptoConfigOption](opts...)</pre></code><tr class=miss><td>183<td><code><pre> optsMap := Use(o.AppName).(*registry).cryptoConfig().ToOptionMap()</pre></code><tr class=miss><td>184<td><code><pre> for _, opts := range optsMap {</pre></code><tr class=miss><td>185<td><code><pre> utils.SliceReverse(opts)</pre></code><tr><td>186<td><code><pre> }</pre></code><tr class=miss><td>187<td><code><pre> opts = optsMap[opt.name]</pre></code><tr class=miss><td>188<td><code><pre> return func(src string) (dst string) {</pre></code><tr><td>189<td><code><pre> return utils.Must(encode.From(src).Decode(opts...).ToString())</pre></code><tr><td>190<td><code><pre> }</pre></code><tr><td>191<td><code><pre>}</pre></code></table><div class=funcname id=fn_CryptoEncryptFunc>func CryptoEncryptFunc</div><div class=info><a href=#s_fn_CryptoEncryptFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/crypto.go</code>:</div><table class=listing><tr><td>170<td><code><pre>func CryptoEncryptFunc(opts ...utils.OptionExtender) func(src string) (dst string) {</pre></code><tr class=miss><td>171<td><code><pre> o := utils.ApplyOptions[InitOption](opts...)</pre></code><tr class=miss><td>172<td><code><pre> opt := utils.ApplyOptions[cryptoConfigOption](opts...)</pre></code><tr class=miss><td>173<td><code><pre> optsMap := Use(o.AppName).(*registry).cryptoConfig().ToOptionMap()</pre></code><tr class=miss><td>174<td><code><pre> opts = optsMap[opt.name]</pre></code><tr class=miss><td>175<td><code><pre> return func(src string) (dst string) {</pre></code><tr><td>176<td><code><pre> return utils.Must(encode.From(src).Encode(opts...).ToString())</pre></code><tr><td>177<td><code><pre> }</pre></code><tr><td>178<td><code><pre>}</pre></code></table><div class=funcname id=fn_@115:9>func @115:9</div><div class=info><a href=#s_fn_@115:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/component.go</code>:</div><table class=listing><tr><td>115<td><code><pre>func(opt *options) {</pre></code><tr class=miss><td>116<td><code><pre> opt.isCoreComponent = true</pre></code><tr><td>117<td><code><pre> }</pre></code></table><div class=funcname id=fn_WithCore>func WithCore</div><div class=info><a href=#s_fn_WithCore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/component.go</code>:</div><table class=listing><tr><td>114<td><code><pre>func WithCore() ComponentOption {</pre></code><tr class=miss><td>115<td><code><pre> return func(opt *options) {</pre></code><tr><td>116<td><code><pre> opt.isCoreComponent = true</pre></code><tr><td>117<td><code><pre> }</pre></code><tr><td>118<td><code><pre>}</pre></code></table><div class=funcname id=fn_Component.Clone>func Component.Clone</div><div class=info><a href=#s_fn_Component.Clone>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/component.go</code>:</div><table class=listing><tr><td>83<td><code><pre>func (c *Component) Clone() (r *Component) {</pre></code><tr class=miss><td>84<td><code><pre> return &Component{</pre></code><tr><td>85<td><code><pre> name: c.name,</pre></code><tr><td>86<td><code><pre> tag: c.tag,</pre></code><tr><td>87<td><code><pre> constructor: c.constructor,</pre></code><tr><td>88<td><code><pre> constructorInputType: c.constructorInputType,</pre></code><tr><td>89<td><code><pre> isCore: c.isCore,</pre></code><tr><td>90<td><code><pre> flagString: c.flagString,</pre></code><tr><td>91<td><code><pre> }</pre></code><tr><td>92<td><code><pre>}</pre></code></table><div class=funcname id=fn_CryptoConfigName>func CryptoConfigName</div><div class=info><a href=#s_fn_CryptoConfigName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/crypto.go</code>:</div><table class=listing><tr><td>164<td><code><pre>func CryptoConfigName(name string) utils.OptionFunc[cryptoConfigOption] {</pre></code><tr class=miss><td>165<td><code><pre> return func(o *cryptoConfigOption) {</pre></code><tr><td>166<td><code><pre> o.name = name</pre></code><tr><td>167<td><code><pre> }</pre></code><tr><td>168<td><code><pre>}</pre></code></table><div class=funcname id=fn_@165:9>func @165:9</div><div class=info><a href=#s_fn_@165:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/crypto.go</code>:</div><table class=listing><tr><td>165<td><code><pre>func(o *cryptoConfigOption) {</pre></code><tr class=miss><td>166<td><code><pre> o.name = name</pre></code><tr><td>167<td><code><pre> }</pre></code></table><div class=funcname id=fn_@175:9>func @175:9</div><div class=info><a href=#s_fn_@175:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/crypto.go</code>:</div><table class=listing><tr><td>175<td><code><pre>func(src string) (dst string) {</pre></code><tr class=miss><td>176<td><code><pre> return utils.Must(encode.From(src).Encode(opts...).ToString())</pre></code><tr><td>177<td><code><pre> }</pre></code></table><div class=funcname id=fn_@188:9>func @188:9</div><div class=info><a href=#s_fn_@188:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/crypto.go</code>:</div><table class=listing><tr><td>188<td><code><pre>func(src string) (dst string) {</pre></code><tr class=miss><td>189<td><code><pre> return utils.Must(encode.From(src).Decode(opts...).ToString())</pre></code><tr><td>190<td><code><pre> }</pre></code></table><div class=funcname id=fn_Debug>func Debug</div><div class=info><a href=#s_fn_Debug>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>102<td><code><pre>func Debug() utils.OptionFunc[initOption] {</pre></code><tr class=miss><td>103<td><code><pre> return func(o *initOption) {</pre></code><tr><td>104<td><code><pre> o.debug = true</pre></code><tr><td>105<td><code><pre> }</pre></code><tr><td>106<td><code><pre>}</pre></code></table><div class=funcname id=fn_@103:9>func @103:9</div><div class=info><a href=#s_fn_@103:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/registry.go</code>:</div><table class=listing><tr><td>103<td><code><pre>func(o *initOption) {</pre></code><tr class=miss><td>104<td><code><pre> o.debug = true</pre></code><tr><td>105<td><code><pre> }</pre></code></table><div class=funcname id=fn_@120:9>func @120:9</div><div class=info><a href=#s_fn_@120:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/config/crypto.go</code>:</div><table class=listing><tr><td>120<td><code><pre>func() {</pre></code><tr><td>121<td><code><pre></pre></code><tr><td>122<td><code><pre> }</pre></code></table><div id=pkg_github.com/wfusion/gofusion/context class=funcname>Package Overview: github.com/wfusion/gofusion/context 21 <span class=packageTotal>75.0%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn__context.Marshal><td><code><a href=#fn__context.Marshal>_context.Marshal(...)</a></code><td><code>github.com/wfusion/gofusion/context/context.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_@182:9><td><code><a href=#fn_@182:9>@182:9(...)</a></code><td><code>github.com/wfusion/gofusion/context/context.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@146:14><td><code><a href=#fn_@146:14>@146:14(...)</a></code><td><code>github.com/wfusion/gofusion/context/context.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_SetTraceID><td><code><a href=#fn_SetTraceID>SetTraceID(...)</a></code><td><code>github.com/wfusion/gofusion/context/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_GetLangs><td><code><a href=#fn_GetLangs>GetLangs(...)</a></code><td><code>github.com/wfusion/gofusion/context/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Watermill><td><code><a href=#fn_Watermill>Watermill(...)</a></code><td><code>github.com/wfusion/gofusion/context/context.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_GetCronTaskID><td><code><a href=#fn_GetCronTaskID>GetCronTaskID(...)</a></code><td><code>github.com/wfusion/gofusion/context/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@189:9><td><code><a href=#fn_@189:9>@189:9(...)</a></code><td><code>github.com/wfusion/gofusion/context/context.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_GetCronTaskName><td><code><a href=#fn_GetCronTaskName>GetCronTaskName(...)</a></code><td><code>github.com/wfusion/gofusion/context/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_SetCronTaskName><td><code><a href=#fn_SetCronTaskName>SetCronTaskName(...)</a></code><td><code>github.com/wfusion/gofusion/context/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Gin><td><code><a href=#fn_Gin>Gin(...)</a></code><td><code>github.com/wfusion/gofusion/context/context.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_GetTraceID><td><code><a href=#fn_GetTraceID>GetTraceID(...)</a></code><td><code>github.com/wfusion/gofusion/context/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_GetUserID><td><code><a href=#fn_GetUserID>GetUserID(...)</a></code><td><code>github.com/wfusion/gofusion/context/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@195:9><td><code><a href=#fn_@195:9>@195:9(...)</a></code><td><code>github.com/wfusion/gofusion/context/context.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Context><td><code><a href=#fn_Context>Context(...)</a></code><td><code>github.com/wfusion/gofusion/context/context.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_newOption.messageUnmarshal><td><code><a href=#fn_newOption.messageUnmarshal>newOption.messageUnmarshal(...)</a></code><td><code>github.com/wfusion/gofusion/context/context.go</code><td class=percent><code>75.0%</code><td class=linecount><code>18/24</code><tr id=s_fn_Flatten><td><code><a href=#fn_Flatten>Flatten(...)</a></code><td><code>github.com/wfusion/gofusion/context/context.go</code><td class=percent><code>73.3%</code><td class=linecount><code>11/15</code><tr id=s_fn_New><td><code><a href=#fn_New>New(...)</a></code><td><code>github.com/wfusion/gofusion/context/context.go</code><td class=percent><code>71.4%</code><td class=linecount><code>5/7</code><tr id=s_fn__context.unmarshal><td><code><a href=#fn__context.unmarshal>_context.unmarshal(...)</a></code><td><code>github.com/wfusion/gofusion/context/context.go</code><td class=percent><code>70.6%</code><td class=linecount><code>12/17</code><tr id=s_fn_newOption.ginUnmarshal><td><code><a href=#fn_newOption.ginUnmarshal>newOption.ginUnmarshal(...)</a></code><td><code>github.com/wfusion/gofusion/context/context.go</code><td class=percent><code>69.2%</code><td class=linecount><code>9/13</code><tr id=s_fn_WatermillMetadata><td><code><a href=#fn_WatermillMetadata>WatermillMetadata(...)</a></code><td><code>github.com/wfusion/gofusion/context/context.go</code><td class=percent><code>68.8%</code><td class=linecount><code>11/16</code><tr id=s_fn_SetCronTaskID><td><code><a href=#fn_SetCronTaskID>SetCronTaskID(...)</a></code><td><code>github.com/wfusion/gofusion/context/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_SetLangs><td><code><a href=#fn_SetLangs>SetLangs(...)</a></code><td><code>github.com/wfusion/gofusion/context/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_SetUserID><td><code><a href=#fn_SetUserID>SetUserID(...)</a></code><td><code>github.com/wfusion/gofusion/context/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn__context.Marshal>func _context.Marshal</div><div class=info><a href=#s_fn__context.Marshal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/context.go</code>:</div><table class=listing><tr><td>58<td><code><pre>func (c *_context) Marshal() (b []byte) {</pre></code><tr><td>59<td><code><pre> bs, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>60<td><code><pre> defer cb()</pre></code><tr><td>61<td><code><pre> utils.MustSuccess(gob.NewEncoder(bs).Encode(c))</pre></code><tr><td>62<td><code><pre></pre></code><tr><td>63<td><code><pre> b = make([]byte, bs.Len())</pre></code><tr><td>64<td><code><pre> copy(b, bs.Bytes())</pre></code><tr><td>65<td><code><pre> return</pre></code><tr><td>66<td><code><pre>}</pre></code></table><div class=funcname id=fn_@182:9>func @182:9</div><div class=info><a href=#s_fn_@182:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/context.go</code>:</div><table class=listing><tr><td>182<td><code><pre>func(o *newOption) {</pre></code><tr><td>183<td><code><pre> o.c = new(_context)</pre></code><tr><td>184<td><code><pre> utils.MustSuccess(utils.Unmarshal(c, o.c, ""))</pre></code><tr><td>185<td><code><pre> }</pre></code></table><div class=funcname id=fn_@146:14>func @146:14</div><div class=info><a href=#s_fn_@146:14>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/context.go</code>:</div><table class=listing><tr><td>146<td><code><pre>func(k string) string { return o.m[k] }</pre></code></table><div class=funcname id=fn_SetTraceID>func SetTraceID</div><div class=info><a href=#s_fn_SetTraceID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/candy.go</code>:</div><table class=listing><tr><td>21<td><code><pre>func SetTraceID(ctx context.Context, val string) context.Context {</pre></code><tr><td>22<td><code><pre> return utils.SetCtxAny(ctx, KeyTraceID, val)</pre></code><tr><td>23<td><code><pre>}</pre></code></table><div class=funcname id=fn_GetLangs>func GetLangs</div><div class=info><a href=#s_fn_GetLangs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/candy.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func GetLangs(ctx context.Context, args ...[]string) (langs []string) {</pre></code><tr><td>26<td><code><pre> return utils.GetCtxAny(ctx, KeyLangs, args...)</pre></code><tr><td>27<td><code><pre>}</pre></code></table><div class=funcname id=fn_Watermill>func Watermill</div><div class=info><a href=#s_fn_Watermill>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/context.go</code>:</div><table class=listing><tr><td>194<td><code><pre>func Watermill(m message.Metadata) utils.OptionFunc[newOption] {</pre></code><tr><td>195<td><code><pre> return func(o *newOption) {</pre></code><tr><td>196<td><code><pre> o.m = m</pre></code><tr><td>197<td><code><pre> }</pre></code><tr><td>198<td><code><pre>}</pre></code></table><div class=funcname id=fn_GetCronTaskID>func GetCronTaskID</div><div class=info><a href=#s_fn_GetCronTaskID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/candy.go</code>:</div><table class=listing><tr><td>33<td><code><pre>func GetCronTaskID(ctx context.Context, args ...string) (userID string) {</pre></code><tr><td>34<td><code><pre> return utils.GetCtxAny(ctx, KeyCronTaskID, args...)</pre></code><tr><td>35<td><code><pre>}</pre></code></table><div class=funcname id=fn_@189:9>func @189:9</div><div class=info><a href=#s_fn_@189:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/context.go</code>:</div><table class=listing><tr><td>189<td><code><pre>func(o *newOption) {</pre></code><tr><td>190<td><code><pre> o.g = c</pre></code><tr><td>191<td><code><pre> }</pre></code></table><div class=funcname id=fn_GetCronTaskName>func GetCronTaskName</div><div class=info><a href=#s_fn_GetCronTaskName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/candy.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func GetCronTaskName(ctx context.Context, args ...string) (userID string) {</pre></code><tr><td>42<td><code><pre> return utils.GetCtxAny(ctx, KeyCronTaskName, args...)</pre></code><tr><td>43<td><code><pre>}</pre></code></table><div class=funcname id=fn_SetCronTaskName>func SetCronTaskName</div><div class=info><a href=#s_fn_SetCronTaskName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/candy.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func SetCronTaskName(ctx context.Context, val string) context.Context {</pre></code><tr><td>46<td><code><pre> return utils.SetCtxAny(ctx, KeyCronTaskName, val)</pre></code><tr><td>47<td><code><pre>}</pre></code></table><div class=funcname id=fn_Gin>func Gin</div><div class=info><a href=#s_fn_Gin>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/context.go</code>:</div><table class=listing><tr><td>188<td><code><pre>func Gin(c *gin.Context) utils.OptionFunc[newOption] {</pre></code><tr><td>189<td><code><pre> return func(o *newOption) {</pre></code><tr><td>190<td><code><pre> o.g = c</pre></code><tr><td>191<td><code><pre> }</pre></code><tr><td>192<td><code><pre>}</pre></code></table><div class=funcname id=fn_GetTraceID>func GetTraceID</div><div class=info><a href=#s_fn_GetTraceID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/candy.go</code>:</div><table class=listing><tr><td>17<td><code><pre>func GetTraceID(ctx context.Context, args ...string) (traceID string) {</pre></code><tr><td>18<td><code><pre> return utils.GetCtxAny(ctx, KeyTraceID, args...)</pre></code><tr><td>19<td><code><pre>}</pre></code></table><div class=funcname id=fn_GetUserID>func GetUserID</div><div class=info><a href=#s_fn_GetUserID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/candy.go</code>:</div><table class=listing><tr><td>9<td><code><pre>func GetUserID(ctx context.Context, args ...string) (userID string) {</pre></code><tr><td>10<td><code><pre> return utils.GetCtxAny(ctx, KeyUserID, args...)</pre></code><tr><td>11<td><code><pre>}</pre></code></table><div class=funcname id=fn_@195:9>func @195:9</div><div class=info><a href=#s_fn_@195:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/context.go</code>:</div><table class=listing><tr><td>195<td><code><pre>func(o *newOption) {</pre></code><tr><td>196<td><code><pre> o.m = m</pre></code><tr><td>197<td><code><pre> }</pre></code></table><div class=funcname id=fn_Context>func Context</div><div class=info><a href=#s_fn_Context>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/context.go</code>:</div><table class=listing><tr><td>181<td><code><pre>func Context(c []byte) utils.OptionFunc[newOption] {</pre></code><tr><td>182<td><code><pre> return func(o *newOption) {</pre></code><tr><td>183<td><code><pre> o.c = new(_context)</pre></code><tr><td>184<td><code><pre> utils.MustSuccess(utils.Unmarshal(c, o.c, ""))</pre></code><tr><td>185<td><code><pre> }</pre></code><tr><td>186<td><code><pre>}</pre></code></table><div class=funcname id=fn_newOption.messageUnmarshal>func newOption.messageUnmarshal</div><div class=info><a href=#s_fn_newOption.messageUnmarshal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/context.go</code>:</div><table class=listing><tr><td>144<td><code><pre>func (o *newOption) messageUnmarshal() (ctx context.Context) {</pre></code><tr><td>145<td><code><pre> ctx = context.Background()</pre></code><tr><td>146<td><code><pre> mapGetFn := func(k string) string { return o.m[k] }</pre></code><tr><td>147<td><code><pre> if userID := utils.LookupByFuzzyKeyword[string](mapGetFn, "user_id"); utils.IsStrNotBlank(userID) {</pre></code><tr class=miss><td>148<td><code><pre> ctx = SetUserID(ctx, userID)</pre></code><tr><td>149<td><code><pre> }</pre></code><tr><td>150<td><code><pre> if traceID := utils.LookupByFuzzyKeyword[string](mapGetFn, "trace_id"); utils.IsStrNotBlank(traceID) {</pre></code><tr><td>151<td><code><pre> ctx = SetTraceID(ctx, traceID)</pre></code><tr><td>152<td><code><pre> }</pre></code><tr><td>153<td><code><pre> if langstr := utils.LookupByFuzzyKeyword[string](mapGetFn, "langs"); utils.IsStrNotBlank(langstr) {</pre></code><tr class=miss><td>154<td><code><pre> var langs []string</pre></code><tr class=miss><td>155<td><code><pre> _ = json.Unmarshal([]byte(langstr), &langs)</pre></code><tr class=miss><td>156<td><code><pre> ctx = SetLangs(ctx, langs)</pre></code><tr><td>157<td><code><pre> }</pre></code><tr><td>158<td><code><pre> if taskID := utils.LookupByFuzzyKeyword[string](mapGetFn, "cron_task_id"); utils.IsStrNotBlank(taskID) {</pre></code><tr class=miss><td>159<td><code><pre> ctx = SetCronTaskID(ctx, taskID)</pre></code><tr><td>160<td><code><pre> }</pre></code><tr><td>161<td><code><pre> if name := utils.LookupByFuzzyKeyword[string](mapGetFn, "cron_task_name"); utils.IsStrNotBlank(name) {</pre></code><tr class=miss><td>162<td><code><pre> ctx = SetCronTaskName(ctx, name)</pre></code><tr><td>163<td><code><pre> }</pre></code><tr><td>164<td><code><pre> if messageUUID := o.m[watermill.ContextKeyMessageUUID]; utils.IsStrNotBlank(messageUUID) {</pre></code><tr><td>165<td><code><pre> ctx = utils.SetCtxAny(ctx, watermill.ContextKeyMessageUUID, messageUUID)</pre></code><tr><td>166<td><code><pre> }</pre></code><tr><td>167<td><code><pre> if messageRawID := o.m[watermill.ContextKeyRawMessageID]; utils.IsStrNotBlank(messageRawID) {</pre></code><tr><td>168<td><code><pre> ctx = utils.SetCtxAny(ctx, watermill.ContextKeyRawMessageID, messageRawID)</pre></code><tr><td>169<td><code><pre> }</pre></code><tr><td>170<td><code><pre></pre></code><tr><td>171<td><code><pre> deadline := utils.LookupByFuzzyKeyword[string](mapGetFn, "deadline")</pre></code><tr><td>172<td><code><pre> deadlineLoc := utils.LookupByFuzzyKeyword[string](mapGetFn, "deadline_location")</pre></code><tr><td>173<td><code><pre> if utils.IsStrNotBlank(deadline) {</pre></code><tr><td>174<td><code><pre> location := utils.Must(time.LoadLocation(deadlineLoc))</pre></code><tr><td>175<td><code><pre> // FIXME: it may result context leak issue</pre></code><tr><td>176<td><code><pre> ctx, _ = context.WithDeadline(ctx, utils.Must(time.ParseInLocation(time.RFC3339Nano, deadline, location)))</pre></code><tr><td>177<td><code><pre> }</pre></code><tr><td>178<td><code><pre> return</pre></code><tr><td>179<td><code><pre>}</pre></code></table><div class=funcname id=fn_Flatten>func Flatten</div><div class=info><a href=#s_fn_Flatten>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/context.go</code>:</div><table class=listing><tr><td>68<td><code><pre>func Flatten(ctx context.Context) (c *_context) {</pre></code><tr><td>69<td><code><pre> c = new(_context)</pre></code><tr><td>70<td><code><pre> if langs := GetLangs(ctx); langs != nil {</pre></code><tr class=miss><td>71<td><code><pre> c.Langs = langs</pre></code><tr><td>72<td><code><pre> }</pre></code><tr><td>73<td><code><pre> if userID := GetUserID(ctx); utils.IsStrNotBlank(userID) {</pre></code><tr class=miss><td>74<td><code><pre> c.UserID = utils.AnyPtr(userID)</pre></code><tr><td>75<td><code><pre> }</pre></code><tr><td>76<td><code><pre> if traceID := GetTraceID(ctx); utils.IsStrNotBlank(traceID) {</pre></code><tr><td>77<td><code><pre> c.TraceID = utils.AnyPtr(traceID)</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre> if taskID := GetCronTaskID(ctx); utils.IsStrNotBlank(taskID) {</pre></code><tr class=miss><td>80<td><code><pre> c.CronTaskID = utils.AnyPtr(taskID)</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre> if taskName := GetCronTaskName(ctx); utils.IsStrNotBlank(taskName) {</pre></code><tr class=miss><td>83<td><code><pre> c.CronTaskName = utils.AnyPtr(taskName)</pre></code><tr><td>84<td><code><pre> }</pre></code><tr><td>85<td><code><pre> if deadline, ok := ctx.Deadline(); ok {</pre></code><tr><td>86<td><code><pre> c.Deadline = utils.AnyPtr(deadline.Format(time.RFC3339Nano))</pre></code><tr><td>87<td><code><pre> c.DeadlineLocation = utils.AnyPtr(deadline.Location().String())</pre></code><tr><td>88<td><code><pre> }</pre></code><tr><td>89<td><code><pre> return</pre></code><tr><td>90<td><code><pre>}</pre></code></table><div class=funcname id=fn_New>func New</div><div class=info><a href=#s_fn_New>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/context.go</code>:</div><table class=listing><tr><td>200<td><code><pre>func New(opts ...utils.OptionExtender) (ctx context.Context) {</pre></code><tr><td>201<td><code><pre> o := utils.ApplyOptions[newOption](opts...)</pre></code><tr><td>202<td><code><pre></pre></code><tr><td>203<td><code><pre> // alternative</pre></code><tr><td>204<td><code><pre> switch {</pre></code><tr><td>205<td><code><pre> case o.g != nil:</pre></code><tr><td>206<td><code><pre> return o.ginUnmarshal()</pre></code><tr><td>207<td><code><pre> case o.c != nil:</pre></code><tr><td>208<td><code><pre> return o.c.unmarshal()</pre></code><tr><td>209<td><code><pre> case o.m != nil:</pre></code><tr><td>210<td><code><pre> return o.messageUnmarshal()</pre></code><tr><td>211<td><code><pre> default:</pre></code><tr class=miss><td>212<td><code><pre> panic(ErrUnknownInstantiationMethod)</pre></code><tr><td>213<td><code><pre> }</pre></code><tr><td>214<td><code><pre></pre></code><tr class=miss><td>215<td><code><pre> return</pre></code><tr><td>216<td><code><pre>}</pre></code></table><div class=funcname id=fn__context.unmarshal>func _context.unmarshal</div><div class=info><a href=#s_fn__context.unmarshal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/context.go</code>:</div><table class=listing><tr><td>28<td><code><pre>func (c *_context) unmarshal() (ctx context.Context) {</pre></code><tr><td>29<td><code><pre> ctx = context.Background()</pre></code><tr><td>30<td><code><pre> if c == nil {</pre></code><tr class=miss><td>31<td><code><pre> return</pre></code><tr><td>32<td><code><pre> }</pre></code><tr><td>33<td><code><pre></pre></code><tr><td>34<td><code><pre> if c.Langs != nil {</pre></code><tr class=miss><td>35<td><code><pre> ctx = SetLangs(ctx, c.Langs)</pre></code><tr><td>36<td><code><pre> }</pre></code><tr><td>37<td><code><pre> if c.UserID != nil {</pre></code><tr class=miss><td>38<td><code><pre> ctx = SetUserID(ctx, *c.UserID)</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre> if c.TraceID != nil {</pre></code><tr><td>41<td><code><pre> ctx = SetTraceID(ctx, *c.TraceID)</pre></code><tr><td>42<td><code><pre> }</pre></code><tr><td>43<td><code><pre> if c.CronTaskID != nil {</pre></code><tr class=miss><td>44<td><code><pre> ctx = SetCronTaskID(ctx, *c.CronTaskID)</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre> if c.CronTaskName != nil {</pre></code><tr class=miss><td>47<td><code><pre> ctx = SetCronTaskName(ctx, *c.CronTaskName)</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre> if c.Deadline != nil {</pre></code><tr><td>50<td><code><pre> location := utils.Must(time.LoadLocation(*c.DeadlineLocation))</pre></code><tr><td>51<td><code><pre> // FIXME: it may result context leak issue</pre></code><tr><td>52<td><code><pre> ctx, _ = context.WithDeadline(ctx, utils.Must(time.ParseInLocation(time.RFC3339Nano, *c.Deadline, location)))</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre></pre></code><tr><td>55<td><code><pre> return</pre></code><tr><td>56<td><code><pre>}</pre></code></table><div class=funcname id=fn_newOption.ginUnmarshal>func newOption.ginUnmarshal</div><div class=info><a href=#s_fn_newOption.ginUnmarshal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/context.go</code>:</div><table class=listing><tr><td>123<td><code><pre>func (o *newOption) ginUnmarshal() (ctx context.Context) {</pre></code><tr><td>124<td><code><pre> ctx = context.Background()</pre></code><tr><td>125<td><code><pre> if userID := o.g.GetString(KeyUserID); utils.IsStrNotBlank(userID) {</pre></code><tr class=miss><td>126<td><code><pre> ctx = SetUserID(ctx, userID)</pre></code><tr><td>127<td><code><pre> }</pre></code><tr><td>128<td><code><pre> if traceID := o.g.GetString(KeyTraceID); utils.IsStrNotBlank(traceID) {</pre></code><tr><td>129<td><code><pre> ctx = SetTraceID(ctx, traceID)</pre></code><tr><td>130<td><code><pre> }</pre></code><tr><td>131<td><code><pre> langs := o.g.Request.Header.Values("Accept-Language")</pre></code><tr><td>132<td><code><pre> if lang := o.g.GetString("lang"); utils.IsStrNotBlank(lang) {</pre></code><tr class=miss><td>133<td><code><pre> langs = append(langs, lang)</pre></code><tr><td>134<td><code><pre> }</pre></code><tr><td>135<td><code><pre> if lang := o.g.GetString(KeyLangs); utils.IsStrNotBlank(lang) {</pre></code><tr class=miss><td>136<td><code><pre> langs = append(langs, lang)</pre></code><tr><td>137<td><code><pre> }</pre></code><tr><td>138<td><code><pre> if len(langs) > 0 {</pre></code><tr class=miss><td>139<td><code><pre> ctx = SetLangs(ctx, langs)</pre></code><tr><td>140<td><code><pre> }</pre></code><tr><td>141<td><code><pre> return</pre></code><tr><td>142<td><code><pre>}</pre></code></table><div class=funcname id=fn_WatermillMetadata>func WatermillMetadata</div><div class=info><a href=#s_fn_WatermillMetadata>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/context.go</code>:</div><table class=listing><tr><td>92<td><code><pre>func WatermillMetadata(ctx context.Context) (metadata message.Metadata) {</pre></code><tr><td>93<td><code><pre> metadata = make(message.Metadata)</pre></code><tr><td>94<td><code><pre> if langs := GetLangs(ctx); langs != nil {</pre></code><tr class=miss><td>95<td><code><pre> marshaled, _ := json.Marshal(langs)</pre></code><tr class=miss><td>96<td><code><pre> metadata["langs"] = string(marshaled)</pre></code><tr><td>97<td><code><pre> }</pre></code><tr><td>98<td><code><pre> if userID := GetUserID(ctx); utils.IsStrNotBlank(userID) {</pre></code><tr class=miss><td>99<td><code><pre> metadata["user_id"] = userID</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre> if traceID := GetTraceID(ctx); utils.IsStrNotBlank(traceID) {</pre></code><tr><td>102<td><code><pre> metadata["trace_id"] = traceID</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre> if taskID := GetCronTaskID(ctx); utils.IsStrNotBlank(taskID) {</pre></code><tr class=miss><td>105<td><code><pre> metadata["cron_task_id"] = taskID</pre></code><tr><td>106<td><code><pre> }</pre></code><tr><td>107<td><code><pre> if taskName := GetCronTaskName(ctx); utils.IsStrNotBlank(taskName) {</pre></code><tr class=miss><td>108<td><code><pre> metadata["cron_task_name"] = taskName</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre> if deadline, ok := ctx.Deadline(); ok {</pre></code><tr><td>111<td><code><pre> metadata["deadline"] = deadline.Format(time.RFC3339Nano)</pre></code><tr><td>112<td><code><pre> metadata["deadline_location"] = deadline.Location().String()</pre></code><tr><td>113<td><code><pre> }</pre></code><tr><td>114<td><code><pre> return</pre></code><tr><td>115<td><code><pre>}</pre></code></table><div class=funcname id=fn_SetCronTaskID>func SetCronTaskID</div><div class=info><a href=#s_fn_SetCronTaskID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/candy.go</code>:</div><table class=listing><tr><td>37<td><code><pre>func SetCronTaskID(ctx context.Context, val string) context.Context {</pre></code><tr class=miss><td>38<td><code><pre> return utils.SetCtxAny(ctx, KeyCronTaskID, val)</pre></code><tr><td>39<td><code><pre>}</pre></code></table><div class=funcname id=fn_SetLangs>func SetLangs</div><div class=info><a href=#s_fn_SetLangs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/candy.go</code>:</div><table class=listing><tr><td>29<td><code><pre>func SetLangs(ctx context.Context, val []string) context.Context {</pre></code><tr class=miss><td>30<td><code><pre> return utils.SetCtxAny(ctx, KeyLangs, val)</pre></code><tr><td>31<td><code><pre>}</pre></code></table><div class=funcname id=fn_SetUserID>func SetUserID</div><div class=info><a href=#s_fn_SetUserID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/context/candy.go</code>:</div><table class=listing><tr><td>13<td><code><pre>func SetUserID(ctx context.Context, val string) context.Context {</pre></code><tr class=miss><td>14<td><code><pre> return utils.SetCtxAny(ctx, KeyUserID, val)</pre></code><tr><td>15<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/cron class=funcname>Package Overview: github.com/wfusion/gofusion/cron 22 <span class=packageTotal>74.1%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_asynqRouter.adaptAsynqHandlerFunc><td><code><a href=#fn_asynqRouter.adaptAsynqHandlerFunc>asynqRouter.adaptAsynqHandlerFunc(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>13/13</code><tr id=s_fn_asynqRouter.initServer><td><code><a href=#fn_asynqRouter.initServer>asynqRouter.initServer(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>10/10</code><tr id=s_fn_Construct><td><code><a href=#fn_Construct>Construct(...)</a></code><td><code>github.com/wfusion/gofusion/cron/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_@377:27><td><code><a href=#fn_@377:27>@377:27(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_asynqRouter.shutdown><td><code><a href=#fn_asynqRouter.shutdown>asynqRouter.shutdown(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_@344:8><td><code><a href=#fn_@344:8>@344:8(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_asynqRouter.initTrigger><td><code><a href=#fn_asynqRouter.initTrigger>asynqRouter.initTrigger(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_asynqRouter.unformatTaskName><td><code><a href=#fn_asynqRouter.unformatTaskName>asynqRouter.unformatTaskName(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_asynqRouter.postEnqueueFunc><td><code><a href=#fn_asynqRouter.postEnqueueFunc>asynqRouter.postEnqueueFunc(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_asynqWrapper.MakeRedisClient><td><code><a href=#fn_asynqWrapper.MakeRedisClient>asynqWrapper.MakeRedisClient(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/cron/flag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/cron/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_asynqRouter.preEnqueueFunc><td><code><a href=#fn_asynqRouter.preEnqueueFunc>asynqRouter.preEnqueueFunc(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@89:9><td><code><a href=#fn_@89:9>@89:9(...)</a></code><td><code>github.com/wfusion/gofusion/cron/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_AppName><td><code><a href=#fn_AppName>AppName(...)</a></code><td><code>github.com/wfusion/gofusion/cron/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@404:10><td><code><a href=#fn_@404:10>@404:10(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_asynqRouter.formatLockKey><td><code><a href=#fn_asynqRouter.formatLockKey>asynqRouter.formatLockKey(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_asynqRouter.gatewayMiddleware><td><code><a href=#fn_asynqRouter.gatewayMiddleware>asynqRouter.gatewayMiddleware(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_asynqRouter.formatTaskName><td><code><a href=#fn_asynqRouter.formatTaskName>asynqRouter.formatTaskName(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_asynqRouter.format><td><code><a href=#fn_asynqRouter.format>asynqRouter.format(...)</a></code><td><code>github.com/wfusion/gofusion/cron/log.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_asynqRouter.defaultQueue><td><code><a href=#fn_asynqRouter.defaultQueue>asynqRouter.defaultQueue(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_task.Name><td><code><a href=#fn_task.Name>task.Name(...)</a></code><td><code>github.com/wfusion/gofusion/cron/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_asynqRouter.newTask><td><code><a href=#fn_asynqRouter.newTask>asynqRouter.newTask(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@409:10><td><code><a href=#fn_@409:10>@409:10(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@33:9><td><code><a href=#fn_@33:9>@33:9(...)</a></code><td><code>github.com/wfusion/gofusion/cron/construct.go</code><td class=percent><code>90.9%</code><td class=linecount><code>10/11</code><tr id=s_fn_addInstance><td><code><a href=#fn_addInstance>addInstance(...)</a></code><td><code>github.com/wfusion/gofusion/cron/construct.go</code><td class=percent><code>86.7%</code><td class=linecount><code>13/15</code><tr id=s_fn_asynqWrapper.getTaskExecuteInterval><td><code><a href=#fn_asynqWrapper.getTaskExecuteInterval>asynqWrapper.getTaskExecuteInterval(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_asynqRouter.debug><td><code><a href=#fn_asynqRouter.debug>asynqRouter.debug(...)</a></code><td><code>github.com/wfusion/gofusion/cron/log.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_asynqRouter.info><td><code><a href=#fn_asynqRouter.info>asynqRouter.info(...)</a></code><td><code>github.com/wfusion/gofusion/cron/log.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_asynqRouter.warn><td><code><a href=#fn_asynqRouter.warn>asynqRouter.warn(...)</a></code><td><code>github.com/wfusion/gofusion/cron/log.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_@277:9><td><code><a href=#fn_@277:9>@277:9(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>84.6%</code><td class=linecount><code>11/13</code><tr id=s_fn_asynqWrapper.GetConfigs><td><code><a href=#fn_asynqWrapper.GetConfigs>asynqWrapper.GetConfigs(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>84.6%</code><td class=linecount><code>11/13</code><tr id=s_fn_asynqRouter.releaseCronTaskLock><td><code><a href=#fn_asynqRouter.releaseCronTaskLock>asynqRouter.releaseCronTaskLock(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>83.9%</code><td class=linecount><code>26/31</code><tr id=s_fn_asynqRouter.Start><td><code><a href=#fn_asynqRouter.Start>asynqRouter.Start(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_Use><td><code><a href=#fn_Use>Use(...)</a></code><td><code>github.com/wfusion/gofusion/cron/construct.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_newAsynq><td><code><a href=#fn_newAsynq>newAsynq(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>78.8%</code><td class=linecount><code>26/33</code><tr id=s_fn_@429:9><td><code><a href=#fn_@429:9>@429:9(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>75.0%</code><td class=linecount><code>9/12</code><tr id=s_fn_@302:9><td><code><a href=#fn_@302:9>@302:9(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>63.6%</code><td class=linecount><code>7/11</code><tr id=s_fn_@208:26><td><code><a href=#fn_@208:26>@208:26(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>55.6%</code><td class=linecount><code>5/9</code><tr id=s_fn_asynqWrapper.getConfigs><td><code><a href=#fn_asynqWrapper.getConfigs>asynqWrapper.getConfigs(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>54.8%</code><td class=linecount><code>17/31</code><tr id=s_fn_asynqRouter.Handle><td><code><a href=#fn_asynqRouter.Handle>asynqRouter.Handle(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>50.0%</code><td class=linecount><code>2/4</code><tr id=s_fn_asynqRouter.Serve><td><code><a href=#fn_asynqRouter.Serve>asynqRouter.Serve(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/12</code><tr id=s_fn_@246:40><td><code><a href=#fn_@246:40>@246:40(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_asynqRouter.Use><td><code><a href=#fn_asynqRouter.Use>asynqRouter.Use(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@391:9><td><code><a href=#fn_@391:9>@391:9(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@256:20><td><code><a href=#fn_@256:20>@256:20(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_asynqRouter.adaptMiddleware><td><code><a href=#fn_asynqRouter.adaptMiddleware>asynqRouter.adaptMiddleware(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@243:19><td><code><a href=#fn_@243:19>@243:19(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@451:9><td><code><a href=#fn_@451:9>@451:9(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_asynqRouter.adaptRouterHandlerFunc><td><code><a href=#fn_asynqRouter.adaptRouterHandlerFunc>asynqRouter.adaptRouterHandlerFunc(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@78:4><td><code><a href=#fn_@78:4>@78:4(...)</a></code><td><code>github.com/wfusion/gofusion/cron/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_task.ID><td><code><a href=#fn_task.ID>task.ID(...)</a></code><td><code>github.com/wfusion/gofusion/cron/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_task.RawMessage><td><code><a href=#fn_task.RawMessage>task.RawMessage(...)</a></code><td><code>github.com/wfusion/gofusion/cron/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_task.Payload><td><code><a href=#fn_task.Payload>task.Payload(...)</a></code><td><code>github.com/wfusion/gofusion/cron/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_asynqRouter.newAsynqTask><td><code><a href=#fn_asynqRouter.newAsynqTask>asynqRouter.newAsynqTask(...)</a></code><td><code>github.com/wfusion/gofusion/cron/asynq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_asynqRouter.adaptAsynqHandlerFunc>func asynqRouter.adaptAsynqHandlerFunc</div><div class=info><a href=#s_fn_asynqRouter.adaptAsynqHandlerFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>402<td><code><pre>func (a *asynqRouter) adaptAsynqHandlerFunc(h any) asynq.HandlerFunc {</pre></code><tr><td>403<td><code><pre> if fn, ok := h.(routerHandleFunc); ok {</pre></code><tr><td>404<td><code><pre> return func(ctx context.Context, raw *asynq.Task) (err error) {</pre></code><tr><td>405<td><code><pre> return fn(ctx, a.newTask(raw))</pre></code><tr><td>406<td><code><pre> }</pre></code><tr><td>407<td><code><pre> }</pre></code><tr><td>408<td><code><pre> if fn, ok := h.(func(ctx context.Context, task Task) (err error)); ok {</pre></code><tr><td>409<td><code><pre> return func(ctx context.Context, raw *asynq.Task) (err error) {</pre></code><tr><td>410<td><code><pre> return fn(ctx, a.newTask(raw))</pre></code><tr><td>411<td><code><pre> }</pre></code><tr><td>412<td><code><pre> }</pre></code><tr><td>413<td><code><pre></pre></code><tr><td>414<td><code><pre> var (</pre></code><tr><td>415<td><code><pre> hasArg bool</pre></code><tr><td>416<td><code><pre> argType reflect.Type</pre></code><tr><td>417<td><code><pre> argTypePtrDepth int</pre></code><tr><td>418<td><code><pre> )</pre></code><tr><td>419<td><code><pre> if reflect.TypeOf(h).NumIn() > 1 {</pre></code><tr><td>420<td><code><pre> argType = reflect.TypeOf(h).In(1)</pre></code><tr><td>421<td><code><pre> for argType.Kind() == reflect.Ptr {</pre></code><tr><td>422<td><code><pre> argType = argType.Elem()</pre></code><tr><td>423<td><code><pre> argTypePtrDepth++</pre></code><tr><td>424<td><code><pre> }</pre></code><tr><td>425<td><code><pre> hasArg = true</pre></code><tr><td>426<td><code><pre> }</pre></code><tr><td>427<td><code><pre></pre></code><tr><td>428<td><code><pre> fn := utils.WrapFunc1[error](h)</pre></code><tr><td>429<td><code><pre> return func(ctx context.Context, raw *asynq.Task) (err error) {</pre></code><tr><td>430<td><code><pre> if !hasArg {</pre></code><tr><td>431<td><code><pre> return fn(ctx)</pre></code><tr><td>432<td><code><pre> }</pre></code><tr><td>433<td><code><pre> arg := reflect.New(argType)</pre></code><tr><td>434<td><code><pre> payload := raw.Payload()</pre></code><tr><td>435<td><code><pre> if len(payload) == 0 {</pre></code><tr><td>436<td><code><pre> payload = []byte("null")</pre></code><tr><td>437<td><code><pre> }</pre></code><tr><td>438<td><code><pre> if err = json.Unmarshal(payload, arg.Interface()); err != nil {</pre></code><tr><td>439<td><code><pre> return</pre></code><tr><td>440<td><code><pre> }</pre></code><tr><td>441<td><code><pre> arg = arg.Elem()</pre></code><tr><td>442<td><code><pre> for i := 0; i < argTypePtrDepth; i++ {</pre></code><tr><td>443<td><code><pre> arg = arg.Addr()</pre></code><tr><td>444<td><code><pre> }</pre></code><tr><td>445<td><code><pre></pre></code><tr><td>446<td><code><pre> return fn(ctx, arg.Interface())</pre></code><tr><td>447<td><code><pre> }</pre></code><tr><td>448<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.initServer>func asynqRouter.initServer</div><div class=info><a href=#s_fn_asynqRouter.initServer>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>229<td><code><pre>func (a *asynqRouter) initServer(ctx context.Context, wrapper *asynqWrapper, logLevel asynq.LogLevel) {</pre></code><tr><td>230<td><code><pre> a.ServeMux = asynq.NewServeMux()</pre></code><tr><td>231<td><code><pre> for pattern, taskCfg := range a.c.Tasks {</pre></code><tr><td>232<td><code><pre> if utils.IsStrBlank(taskCfg.Callback) {</pre></code><tr><td>233<td><code><pre> continue</pre></code><tr><td>234<td><code><pre> }</pre></code><tr><td>235<td><code><pre> handler := *(*routerHandleFunc)(inspect.FuncOf(taskCfg.Callback))</pre></code><tr><td>236<td><code><pre> a.ServeMux.Handle(a.formatTaskName(pattern), a.adaptAsynqHandlerFunc(handler))</pre></code><tr><td>237<td><code><pre> }</pre></code><tr><td>238<td><code><pre></pre></code><tr><td>239<td><code><pre> asynqCfg := asynq.Config{</pre></code><tr><td>240<td><code><pre> Concurrency: a.c.ServerConcurrency,</pre></code><tr><td>241<td><code><pre> BaseContext: context.Background,</pre></code><tr><td>242<td><code><pre> RetryDelayFunc: asynq.DefaultRetryDelayFunc,</pre></code><tr><td>243<td><code><pre> IsFailure: func(err error) bool { return !errors.Is(err, errDiscardMessage) },</pre></code><tr><td>244<td><code><pre> Queues: nil,</pre></code><tr><td>245<td><code><pre> StrictPriority: false,</pre></code><tr><td>246<td><code><pre> ErrorHandler: asynq.ErrorHandlerFunc(func(ctx context.Context, task *asynq.Task, err error) {</pre></code><tr><td>247<td><code><pre> taskName := "unknown"</pre></code><tr><td>248<td><code><pre> if task != nil {</pre></code><tr><td>249<td><code><pre> taskName = a.unformatTaskName(task.Type())</pre></code><tr><td>250<td><code><pre> }</pre></code><tr><td>251<td><code><pre> a.info(ctx, "handle task %s message error %s", taskName, err)</pre></code><tr><td>252<td><code><pre> }),</pre></code><tr><td>253<td><code><pre> Logger: a.logger,</pre></code><tr><td>254<td><code><pre> LogLevel: logLevel,</pre></code><tr><td>255<td><code><pre> ShutdownTimeout: 8 * time.Second,</pre></code><tr><td>256<td><code><pre> HealthCheckFunc: func(err error) {</pre></code><tr><td>257<td><code><pre> if err != nil {</pre></code><tr><td>258<td><code><pre> a.warn(ctx, "health check check failed: %s", err)</pre></code><tr><td>259<td><code><pre> }</pre></code><tr><td>260<td><code><pre> },</pre></code><tr><td>261<td><code><pre> HealthCheckInterval: 15 * time.Second,</pre></code><tr><td>262<td><code><pre> DelayedTaskCheckInterval: 5 * time.Second,</pre></code><tr><td>263<td><code><pre> GroupGracePeriod: 1 * time.Minute,</pre></code><tr><td>264<td><code><pre> GroupMaxDelay: 0,</pre></code><tr><td>265<td><code><pre> GroupMaxSize: 0,</pre></code><tr><td>266<td><code><pre> GroupAggregator: nil,</pre></code><tr><td>267<td><code><pre> DisableRedisConnClose: true,</pre></code><tr><td>268<td><code><pre> }</pre></code><tr><td>269<td><code><pre> if utils.IsStrNotBlank(a.c.Queue) {</pre></code><tr><td>270<td><code><pre> asynqCfg.Queues = map[string]int{a.c.Queue: 3}</pre></code><tr><td>271<td><code><pre> }</pre></code><tr><td>272<td><code><pre></pre></code><tr><td>273<td><code><pre> a.server = asynq.NewServer(wrapper, asynqCfg)</pre></code><tr><td>274<td><code><pre>}</pre></code></table><div class=funcname id=fn_Construct>func Construct</div><div class=info><a href=#s_fn_Construct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/construct.go</code>:</div><table class=listing><tr><td>23<td><code><pre>func Construct(ctx context.Context, confs map[string]*Conf, opts ...utils.OptionExtender) func() {</pre></code><tr><td>24<td><code><pre> opt := utils.ApplyOptions[config.InitOption](opts...)</pre></code><tr><td>25<td><code><pre> optU := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>26<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>27<td><code><pre> opt.AppName = optU.appName</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre></pre></code><tr><td>30<td><code><pre> for name, conf := range confs {</pre></code><tr><td>31<td><code><pre> addInstance(ctx, name, conf, opt)</pre></code><tr><td>32<td><code><pre> }</pre></code><tr><td>33<td><code><pre> return func() {</pre></code><tr><td>34<td><code><pre> locker.Lock()</pre></code><tr><td>35<td><code><pre> defer locker.Unlock()</pre></code><tr><td>36<td><code><pre></pre></code><tr><td>37<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>38<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>39<td><code><pre> if routers != nil {</pre></code><tr><td>40<td><code><pre> for name, router := range routers[opt.AppName] {</pre></code><tr><td>41<td><code><pre> log.Printf("%v [Gofusion] %s %s %s exiting...", pid, app, config.ComponentCron, name)</pre></code><tr><td>42<td><code><pre> if err := router.shutdown(); err == nil {</pre></code><tr><td>43<td><code><pre> log.Printf("%v [Gofusion] %s %s %s exited", pid, app, config.ComponentCron, name)</pre></code><tr><td>44<td><code><pre> } else {</pre></code><tr><td>45<td><code><pre> log.Printf("%v [Gofusion] %s %s %s exit failed: %s", pid, app, config.ComponentCron, name, err)</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> delete(routers, opt.AppName)</pre></code><tr><td>49<td><code><pre> }</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre>}</pre></code></table><div class=funcname id=fn_@377:27>func @377:27</div><div class=info><a href=#s_fn_@377:27>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>377<td><code><pre>func(ctx context.Context, raw *asynq.Task) (err error) {</pre></code><tr><td>378<td><code><pre> taskName := a.unformatTaskName(raw.Type())</pre></code><tr><td>379<td><code><pre> inspect.SetField(raw, asyncqTaskTypenameField, taskName)</pre></code><tr><td>380<td><code><pre> if utils.IsStrBlank(fusCtx.GetTraceID(ctx)) {</pre></code><tr><td>381<td><code><pre> ctx = fusCtx.SetTraceID(ctx, utils.NginxID())</pre></code><tr><td>382<td><code><pre> }</pre></code><tr><td>383<td><code><pre> if utils.IsStrBlank(fusCtx.GetCronTaskName(ctx)) {</pre></code><tr><td>384<td><code><pre> ctx = fusCtx.SetCronTaskName(ctx, taskName)</pre></code><tr><td>385<td><code><pre> }</pre></code><tr><td>386<td><code><pre> return next.ProcessTask(ctx, raw)</pre></code><tr><td>387<td><code><pre> }</pre></code></table><div class=funcname id=fn_asynqRouter.shutdown>func asynqRouter.shutdown</div><div class=info><a href=#s_fn_asynqRouter.shutdown>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>184<td><code><pre>func (a *asynqRouter) shutdown() (err error) {</pre></code><tr><td>185<td><code><pre> if a.c.Trigger {</pre></code><tr><td>186<td><code><pre> _, catchErr := utils.Catch(a.trigger.Shutdown)</pre></code><tr><td>187<td><code><pre> err = multierr.Append(err, errors.Cause(catchErr))</pre></code><tr><td>188<td><code><pre> }</pre></code><tr><td>189<td><code><pre> if a.c.Server {</pre></code><tr><td>190<td><code><pre> _, catchErr := utils.Catch(a.server.Shutdown)</pre></code><tr><td>191<td><code><pre> err = multierr.Append(err, errors.Cause(catchErr))</pre></code><tr><td>192<td><code><pre> }</pre></code><tr><td>193<td><code><pre> return</pre></code><tr><td>194<td><code><pre>}</pre></code></table><div class=funcname id=fn_@344:8>func @344:8</div><div class=info><a href=#s_fn_@344:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>344<td><code><pre>func() {</pre></code><tr><td>345<td><code><pre> if e != nil {</pre></code><tr><td>346<td><code><pre> a.warn(ctx, "post enqueue task %s release lock failed: %s", taskName, e)</pre></code><tr><td>347<td><code><pre> }</pre></code><tr><td>348<td><code><pre> }</pre></code></table><div class=funcname id=fn_asynqRouter.initTrigger>func asynqRouter.initTrigger</div><div class=info><a href=#s_fn_asynqRouter.initTrigger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>196<td><code><pre>func (a *asynqRouter) initTrigger(ctx context.Context, wrapper *asynqWrapper, logLevel asynq.LogLevel) {</pre></code><tr><td>197<td><code><pre> a.trigger = utils.Must(</pre></code><tr><td>198<td><code><pre> asynq.NewPeriodicTaskManager(asynq.PeriodicTaskManagerOpts{</pre></code><tr><td>199<td><code><pre> PeriodicTaskConfigProvider: wrapper,</pre></code><tr><td>200<td><code><pre> RedisConnOpt: wrapper,</pre></code><tr><td>201<td><code><pre> SchedulerOpts: &asynq.SchedulerOpts{</pre></code><tr><td>202<td><code><pre> Logger: a.logger,</pre></code><tr><td>203<td><code><pre> LogLevel: logLevel,</pre></code><tr><td>204<td><code><pre> Location: utils.Must(time.LoadLocation(a.c.Timezone)),</pre></code><tr><td>205<td><code><pre> DisableRedisConnClose: true,</pre></code><tr><td>206<td><code><pre> PreEnqueueFunc: a.preEnqueueFunc(ctx),</pre></code><tr><td>207<td><code><pre> PostEnqueueFunc: a.postEnqueueFunc(ctx),</pre></code><tr><td>208<td><code><pre> EnqueueErrorHandler: func(task *asynq.Task, opts []asynq.Option, err error) {</pre></code><tr><td>209<td><code><pre> ignored := []error{errDiscardMessage}</pre></code><tr><td>210<td><code><pre> if a.locker == nil {</pre></code><tr><td>211<td><code><pre> ignored = append(ignored, asynq.ErrDuplicateTask, asynq.ErrTaskIDConflict)</pre></code><tr><td>212<td><code><pre> }</pre></code><tr><td>213<td><code><pre> if err = utils.ErrIgnore(err, ignored...); err == nil {</pre></code><tr><td>214<td><code><pre> return</pre></code><tr><td>215<td><code><pre> }</pre></code><tr><td>216<td><code><pre> taskName := "unknown"</pre></code><tr><td>217<td><code><pre> if task != nil {</pre></code><tr><td>218<td><code><pre> taskName = a.unformatTaskName(task.Type())</pre></code><tr><td>219<td><code><pre> }</pre></code><tr><td>220<td><code><pre> a.warn(ctx, "enqueue task %s failed: %s", taskName, err)</pre></code><tr><td>221<td><code><pre> },</pre></code><tr><td>222<td><code><pre> },</pre></code><tr><td>223<td><code><pre> SyncInterval: utils.Must(time.ParseDuration(a.c.RefreshTasksInterval)),</pre></code><tr><td>224<td><code><pre> }),</pre></code><tr><td>225<td><code><pre> )</pre></code><tr><td>226<td><code><pre> a.id = a.trigger.ID()</pre></code><tr><td>227<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.unformatTaskName>func asynqRouter.unformatTaskName</div><div class=info><a href=#s_fn_asynqRouter.unformatTaskName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>465<td><code><pre>func (a *asynqRouter) unformatTaskName(taskName string) (result string) {</pre></code><tr><td>466<td><code><pre> return strings.TrimPrefix(taskName, fmt.Sprintf("%s:cron:", config.Use(a.appName).AppName()))</pre></code><tr><td>467<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.postEnqueueFunc>func asynqRouter.postEnqueueFunc</div><div class=info><a href=#s_fn_asynqRouter.postEnqueueFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>301<td><code><pre>func (a *asynqRouter) postEnqueueFunc(ctx context.Context) func(info *asynq.TaskInfo, err error) {</pre></code><tr><td>302<td><code><pre> return func(info *asynq.TaskInfo, err error) {</pre></code><tr><td>303<td><code><pre> // release lock</pre></code><tr><td>304<td><code><pre> if a.locker != nil {</pre></code><tr><td>305<td><code><pre> defer routine.Go(a.releaseCronTaskLock, routine.Args(ctx, info), routine.AppName(a.appName))</pre></code><tr><td>306<td><code><pre> }</pre></code><tr><td>307<td><code><pre></pre></code><tr><td>308<td><code><pre> ignored := []error{errDiscardMessage}</pre></code><tr><td>309<td><code><pre> if a.locker == nil {</pre></code><tr><td>310<td><code><pre> ignored = append(ignored, asynq.ErrDuplicateTask, asynq.ErrTaskIDConflict)</pre></code><tr><td>311<td><code><pre> }</pre></code><tr><td>312<td><code><pre></pre></code><tr><td>313<td><code><pre> if err = utils.ErrIgnore(err, ignored...); err == nil {</pre></code><tr><td>314<td><code><pre> return</pre></code><tr><td>315<td><code><pre> }</pre></code><tr><td>316<td><code><pre> taskName := "unknown"</pre></code><tr><td>317<td><code><pre> if info != nil {</pre></code><tr><td>318<td><code><pre> taskName = a.unformatTaskName(info.Type)</pre></code><tr><td>319<td><code><pre> }</pre></code><tr><td>320<td><code><pre> a.debug(ctx, "post enqueue task %s failed: %s", taskName, err)</pre></code><tr><td>321<td><code><pre> }</pre></code><tr><td>322<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqWrapper.MakeRedisClient>func asynqWrapper.MakeRedisClient</div><div class=info><a href=#s_fn_asynqWrapper.MakeRedisClient>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>491<td><code><pre>func (a *asynqWrapper) MakeRedisClient() any {</pre></code><tr><td>492<td><code><pre> return a.cli</pre></code><tr><td>493<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/flag.go</code>:</div><table class=listing><tr><td>7<td><code><pre>func init() {</pre></code><tr><td>8<td><code><pre> pflag.StringVarP(&flagString, "cron-config", "", "", "json string for cron config")</pre></code><tr><td>9<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/construct.go</code>:</div><table class=listing><tr><td>111<td><code><pre>func init() {</pre></code><tr><td>112<td><code><pre> config.AddComponent(config.ComponentCron, Construct, config.WithFlag(&flagString))</pre></code><tr><td>113<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.preEnqueueFunc>func asynqRouter.preEnqueueFunc</div><div class=info><a href=#s_fn_asynqRouter.preEnqueueFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>276<td><code><pre>func (a *asynqRouter) preEnqueueFunc(ctx context.Context) func(*asynq.Task, []asynq.Option) error {</pre></code><tr><td>277<td><code><pre> return func(task *asynq.Task, opts []asynq.Option) (err error) {</pre></code><tr><td>278<td><code><pre> // when locker is disabled, we cannot determine which message should be discarded</pre></code><tr><td>279<td><code><pre> if a.locker == nil {</pre></code><tr><td>280<td><code><pre> return</pre></code><tr><td>281<td><code><pre> }</pre></code><tr><td>282<td><code><pre></pre></code><tr><td>283<td><code><pre> taskName := a.unformatTaskName(task.Type())</pre></code><tr><td>284<td><code><pre> lockKey := a.formatLockKey(taskName)</pre></code><tr><td>285<td><code><pre> if err = a.locker.Lock(ctx, lockKey, lock.Expire(tolerantOfTimeNotSync), lock.ReentrantKey(a.id)); err == nil {</pre></code><tr><td>286<td><code><pre> a.info(ctx, "pre enqueue task %s success", taskName)</pre></code><tr><td>287<td><code><pre> return</pre></code><tr><td>288<td><code><pre> }</pre></code><tr><td>289<td><code><pre></pre></code><tr><td>290<td><code><pre> err = utils.ErrIgnore(err, lock.ErrTimeout, lock.ErrContextDone)</pre></code><tr><td>291<td><code><pre> if err == nil {</pre></code><tr><td>292<td><code><pre> a.debug(ctx, "pre enqueue discard task %s", taskName)</pre></code><tr><td>293<td><code><pre> return errDiscardMessage</pre></code><tr><td>294<td><code><pre> }</pre></code><tr><td>295<td><code><pre></pre></code><tr><td>296<td><code><pre> a.warn(ctx, "pre enqueue task %s failed: %s", taskName, err)</pre></code><tr><td>297<td><code><pre> return</pre></code><tr><td>298<td><code><pre> }</pre></code><tr><td>299<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>593<td><code><pre>func init() {</pre></code><tr><td>594<td><code><pre> rand.Seed(time.Now().UnixMicro())</pre></code><tr><td>595<td><code><pre>}</pre></code></table><div class=funcname id=fn_@89:9>func @89:9</div><div class=info><a href=#s_fn_@89:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/construct.go</code>:</div><table class=listing><tr><td>89<td><code><pre>func(o *useOption) {</pre></code><tr><td>90<td><code><pre> o.appName = name</pre></code><tr><td>91<td><code><pre> }</pre></code></table><div class=funcname id=fn_AppName>func AppName</div><div class=info><a href=#s_fn_AppName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/construct.go</code>:</div><table class=listing><tr><td>88<td><code><pre>func AppName(name string) utils.OptionFunc[useOption] {</pre></code><tr><td>89<td><code><pre> return func(o *useOption) {</pre></code><tr><td>90<td><code><pre> o.appName = name</pre></code><tr><td>91<td><code><pre> }</pre></code><tr><td>92<td><code><pre>}</pre></code></table><div class=funcname id=fn_@404:10>func @404:10</div><div class=info><a href=#s_fn_@404:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>404<td><code><pre>func(ctx context.Context, raw *asynq.Task) (err error) {</pre></code><tr><td>405<td><code><pre> return fn(ctx, a.newTask(raw))</pre></code><tr><td>406<td><code><pre> }</pre></code></table><div class=funcname id=fn_asynqRouter.formatLockKey>func asynqRouter.formatLockKey</div><div class=info><a href=#s_fn_asynqRouter.formatLockKey>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>459<td><code><pre>func (a *asynqRouter) formatLockKey(taskName string) string {</pre></code><tr><td>460<td><code><pre> return fmt.Sprintf("cron_%s", taskName)</pre></code><tr><td>461<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.gatewayMiddleware>func asynqRouter.gatewayMiddleware</div><div class=info><a href=#s_fn_asynqRouter.gatewayMiddleware>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>376<td><code><pre>func (a *asynqRouter) gatewayMiddleware(next asynq.Handler) asynq.Handler {</pre></code><tr><td>377<td><code><pre> return asynq.HandlerFunc(func(ctx context.Context, raw *asynq.Task) (err error) {</pre></code><tr><td>378<td><code><pre> taskName := a.unformatTaskName(raw.Type())</pre></code><tr><td>379<td><code><pre> inspect.SetField(raw, asyncqTaskTypenameField, taskName)</pre></code><tr><td>380<td><code><pre> if utils.IsStrBlank(fusCtx.GetTraceID(ctx)) {</pre></code><tr><td>381<td><code><pre> ctx = fusCtx.SetTraceID(ctx, utils.NginxID())</pre></code><tr><td>382<td><code><pre> }</pre></code><tr><td>383<td><code><pre> if utils.IsStrBlank(fusCtx.GetCronTaskName(ctx)) {</pre></code><tr><td>384<td><code><pre> ctx = fusCtx.SetCronTaskName(ctx, taskName)</pre></code><tr><td>385<td><code><pre> }</pre></code><tr><td>386<td><code><pre> return next.ProcessTask(ctx, raw)</pre></code><tr><td>387<td><code><pre> })</pre></code><tr><td>388<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.formatTaskName>func asynqRouter.formatTaskName</div><div class=info><a href=#s_fn_asynqRouter.formatTaskName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>462<td><code><pre>func (a *asynqRouter) formatTaskName(taskName string) (result string) {</pre></code><tr><td>463<td><code><pre> return fmt.Sprintf("%s:cron:%s", config.Use(a.appName).AppName(), taskName)</pre></code><tr><td>464<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.format>func asynqRouter.format</div><div class=info><a href=#s_fn_asynqRouter.format>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/log.go</code>:</div><table class=listing><tr><td>48<td><code><pre>func (a *asynqRouter) format(src string) (dst string) {</pre></code><tr><td>49<td><code><pre> return fmt.Sprintf("%v [Gofusion] %s %s asynq(%s) %s",</pre></code><tr><td>50<td><code><pre> syscall.Getpid(), config.ComponentCron, a.n, a.id, src)</pre></code><tr><td>51<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.defaultQueue>func asynqRouter.defaultQueue</div><div class=info><a href=#s_fn_asynqRouter.defaultQueue>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>456<td><code><pre>func (a *asynqRouter) defaultQueue() (result string) {</pre></code><tr><td>457<td><code><pre> return fmt.Sprintf("%s:cron", config.Use(a.appName).AppName())</pre></code><tr><td>458<td><code><pre>}</pre></code></table><div class=funcname id=fn_task.Name>func task.Name</div><div class=info><a href=#s_fn_task.Name>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/types.go</code>:</div><table class=listing><tr><td>97<td><code><pre>func (t *task) Name() string {</pre></code><tr><td>98<td><code><pre> return t.name</pre></code><tr><td>99<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.newTask>func asynqRouter.newTask</div><div class=info><a href=#s_fn_asynqRouter.newTask>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>469<td><code><pre>func (a *asynqRouter) newTask(raw *asynq.Task) (t Task) {</pre></code><tr><td>470<td><code><pre> return &task{</pre></code><tr><td>471<td><code><pre> id: raw.Type(),</pre></code><tr><td>472<td><code><pre> name: raw.Type(),</pre></code><tr><td>473<td><code><pre> payload: raw.Payload(),</pre></code><tr><td>474<td><code><pre> rawMessage: raw,</pre></code><tr><td>475<td><code><pre> }</pre></code><tr><td>476<td><code><pre>}</pre></code></table><div class=funcname id=fn_@409:10>func @409:10</div><div class=info><a href=#s_fn_@409:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>409<td><code><pre>func(ctx context.Context, raw *asynq.Task) (err error) {</pre></code><tr><td>410<td><code><pre> return fn(ctx, a.newTask(raw))</pre></code><tr><td>411<td><code><pre> }</pre></code></table><div class=funcname id=fn_@33:9>func @33:9</div><div class=info><a href=#s_fn_@33:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/construct.go</code>:</div><table class=listing><tr><td>33<td><code><pre>func() {</pre></code><tr><td>34<td><code><pre> locker.Lock()</pre></code><tr><td>35<td><code><pre> defer locker.Unlock()</pre></code><tr><td>36<td><code><pre></pre></code><tr><td>37<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>38<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>39<td><code><pre> if routers != nil {</pre></code><tr><td>40<td><code><pre> for name, router := range routers[opt.AppName] {</pre></code><tr><td>41<td><code><pre> log.Printf("%v [Gofusion] %s %s %s exiting...", pid, app, config.ComponentCron, name)</pre></code><tr><td>42<td><code><pre> if err := router.shutdown(); err == nil {</pre></code><tr><td>43<td><code><pre> log.Printf("%v [Gofusion] %s %s %s exited", pid, app, config.ComponentCron, name)</pre></code><tr><td>44<td><code><pre> } else {</pre></code><tr class=miss><td>45<td><code><pre> log.Printf("%v [Gofusion] %s %s %s exit failed: %s", pid, app, config.ComponentCron, name, err)</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> delete(routers, opt.AppName)</pre></code><tr><td>49<td><code><pre> }</pre></code><tr><td>50<td><code><pre> }</pre></code></table><div class=funcname id=fn_addInstance>func addInstance</div><div class=info><a href=#s_fn_addInstance>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/construct.go</code>:</div><table class=listing><tr><td>53<td><code><pre>func addInstance(ctx context.Context, name string, conf *Conf, opt *config.InitOption) {</pre></code><tr><td>54<td><code><pre> var r IRouter</pre></code><tr><td>55<td><code><pre> switch conf.Type {</pre></code><tr><td>56<td><code><pre> case schedulerTypeAsynq:</pre></code><tr><td>57<td><code><pre> r = newAsynq(ctx, opt.AppName, name, conf)</pre></code><tr><td>58<td><code><pre> default:</pre></code><tr class=miss><td>59<td><code><pre> panic(ErrUnsupportedSchedulerType)</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre></pre></code><tr><td>62<td><code><pre> locker.Lock()</pre></code><tr><td>63<td><code><pre> defer locker.Unlock()</pre></code><tr><td>64<td><code><pre> if routers == nil {</pre></code><tr><td>65<td><code><pre> routers = make(map[string]map[string]IRouter)</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre> if routers[opt.AppName] == nil {</pre></code><tr><td>68<td><code><pre> routers[opt.AppName] = make(map[string]IRouter)</pre></code><tr><td>69<td><code><pre> }</pre></code><tr><td>70<td><code><pre> if _, ok := routers[opt.AppName][name]; ok {</pre></code><tr class=miss><td>71<td><code><pre> panic(errors.Errorf("duplicated cron name: %s", name))</pre></code><tr><td>72<td><code><pre> }</pre></code><tr><td>73<td><code><pre> routers[opt.AppName][name] = r</pre></code><tr><td>74<td><code><pre></pre></code><tr><td>75<td><code><pre> // ioc</pre></code><tr><td>76<td><code><pre> if opt.DI != nil {</pre></code><tr><td>77<td><code><pre> opt.DI.MustProvide(</pre></code><tr><td>78<td><code><pre> func() IRouter { return Use(name, AppName(opt.AppName)) },</pre></code><tr><td>79<td><code><pre> di.Name(name),</pre></code><tr><td>80<td><code><pre> )</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqWrapper.getTaskExecuteInterval>func asynqWrapper.getTaskExecuteInterval</div><div class=info><a href=#s_fn_asynqWrapper.getTaskExecuteInterval>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>582<td><code><pre>func (a *asynqWrapper) getTaskExecuteInterval(spec string) (interval time.Duration, err error) {</pre></code><tr><td>583<td><code><pre> now := time.Now()</pre></code><tr><td>584<td><code><pre> scheduler, err := cron.ParseStandard(spec)</pre></code><tr><td>585<td><code><pre> if err != nil {</pre></code><tr class=miss><td>586<td><code><pre> return 0, err</pre></code><tr><td>587<td><code><pre> }</pre></code><tr><td>588<td><code><pre> next := scheduler.Next(now)</pre></code><tr><td>589<td><code><pre> interval = scheduler.Next(next).Sub(next)</pre></code><tr><td>590<td><code><pre> return</pre></code><tr><td>591<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.debug>func asynqRouter.debug</div><div class=info><a href=#s_fn_asynqRouter.debug>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/log.go</code>:</div><table class=listing><tr><td>12<td><code><pre>func (a *asynqRouter) debug(ctx context.Context, msg string, args ...any) {</pre></code><tr><td>13<td><code><pre> msg = a.format(msg)</pre></code><tr><td>14<td><code><pre> if a.logger == nil {</pre></code><tr class=miss><td>15<td><code><pre> log.Printf(msg, args...)</pre></code><tr><td>16<td><code><pre> } else {</pre></code><tr><td>17<td><code><pre> logArgs := make([]any, 0, len(args)+2)</pre></code><tr><td>18<td><code><pre> logArgs = append(logArgs, ctx, msg)</pre></code><tr><td>19<td><code><pre> logArgs = append(logArgs, args...)</pre></code><tr><td>20<td><code><pre> a.logger.Debug(logArgs...)</pre></code><tr><td>21<td><code><pre> }</pre></code><tr><td>22<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.info>func asynqRouter.info</div><div class=info><a href=#s_fn_asynqRouter.info>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/log.go</code>:</div><table class=listing><tr><td>24<td><code><pre>func (a *asynqRouter) info(ctx context.Context, msg string, args ...any) {</pre></code><tr><td>25<td><code><pre> msg = a.format(msg)</pre></code><tr><td>26<td><code><pre> if a.logger == nil {</pre></code><tr class=miss><td>27<td><code><pre> log.Printf(msg, args...)</pre></code><tr><td>28<td><code><pre> } else {</pre></code><tr><td>29<td><code><pre> logArgs := make([]any, 0, len(args)+2)</pre></code><tr><td>30<td><code><pre> logArgs = append(logArgs, ctx, msg)</pre></code><tr><td>31<td><code><pre> logArgs = append(logArgs, args...)</pre></code><tr><td>32<td><code><pre> a.logger.Info(logArgs...)</pre></code><tr><td>33<td><code><pre> }</pre></code><tr><td>34<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.warn>func asynqRouter.warn</div><div class=info><a href=#s_fn_asynqRouter.warn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/log.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func (a *asynqRouter) warn(ctx context.Context, msg string, args ...any) {</pre></code><tr><td>37<td><code><pre> msg = a.format(msg)</pre></code><tr><td>38<td><code><pre> if a.logger == nil {</pre></code><tr class=miss><td>39<td><code><pre> log.Printf(msg, args...)</pre></code><tr><td>40<td><code><pre> } else {</pre></code><tr><td>41<td><code><pre> logArgs := make([]any, 0, len(args)+2)</pre></code><tr><td>42<td><code><pre> logArgs = append(logArgs, ctx, msg)</pre></code><tr><td>43<td><code><pre> logArgs = append(logArgs, args...)</pre></code><tr><td>44<td><code><pre> a.logger.Warn(logArgs...)</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre>}</pre></code></table><div class=funcname id=fn_@277:9>func @277:9</div><div class=info><a href=#s_fn_@277:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>277<td><code><pre>func(task *asynq.Task, opts []asynq.Option) (err error) {</pre></code><tr><td>278<td><code><pre> // when locker is disabled, we cannot determine which message should be discarded</pre></code><tr><td>279<td><code><pre> if a.locker == nil {</pre></code><tr><td>280<td><code><pre> return</pre></code><tr><td>281<td><code><pre> }</pre></code><tr><td>282<td><code><pre></pre></code><tr><td>283<td><code><pre> taskName := a.unformatTaskName(task.Type())</pre></code><tr><td>284<td><code><pre> lockKey := a.formatLockKey(taskName)</pre></code><tr><td>285<td><code><pre> if err = a.locker.Lock(ctx, lockKey, lock.Expire(tolerantOfTimeNotSync), lock.ReentrantKey(a.id)); err == nil {</pre></code><tr><td>286<td><code><pre> a.info(ctx, "pre enqueue task %s success", taskName)</pre></code><tr><td>287<td><code><pre> return</pre></code><tr><td>288<td><code><pre> }</pre></code><tr><td>289<td><code><pre></pre></code><tr><td>290<td><code><pre> err = utils.ErrIgnore(err, lock.ErrTimeout, lock.ErrContextDone)</pre></code><tr><td>291<td><code><pre> if err == nil {</pre></code><tr><td>292<td><code><pre> a.debug(ctx, "pre enqueue discard task %s", taskName)</pre></code><tr><td>293<td><code><pre> return errDiscardMessage</pre></code><tr><td>294<td><code><pre> }</pre></code><tr><td>295<td><code><pre></pre></code><tr class=miss><td>296<td><code><pre> a.warn(ctx, "pre enqueue task %s failed: %s", taskName, err)</pre></code><tr class=miss><td>297<td><code><pre> return</pre></code><tr><td>298<td><code><pre> }</pre></code></table><div class=funcname id=fn_asynqWrapper.GetConfigs>func asynqWrapper.GetConfigs</div><div class=info><a href=#s_fn_asynqWrapper.GetConfigs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>495<td><code><pre>func (a *asynqWrapper) GetConfigs() (result []*asynq.PeriodicTaskConfig, err error) {</pre></code><tr><td>496<td><code><pre> result, err = a.getConfigs()</pre></code><tr><td>497<td><code><pre> if err != nil {</pre></code><tr class=miss><td>498<td><code><pre> return</pre></code><tr><td>499<td><code><pre> }</pre></code><tr><td>500<td><code><pre></pre></code><tr><td>501<td><code><pre> a.r.l.Lock()</pre></code><tr><td>502<td><code><pre> defer a.r.l.Unlock()</pre></code><tr><td>503<td><code><pre> for _, cfg := range result {</pre></code><tr><td>504<td><code><pre> // renaming</pre></code><tr><td>505<td><code><pre> taskName := inspect.GetField[string](cfg.Task, asyncqTaskTypenameField)</pre></code><tr><td>506<td><code><pre> inspect.SetField(cfg.Task, asyncqTaskTypenameField, a.r.formatTaskName(taskName))</pre></code><tr><td>507<td><code><pre></pre></code><tr><td>508<td><code><pre> name := cfg.Task.Type()</pre></code><tr><td>509<td><code><pre> a.r.lockDurations[name], err = a.getTaskExecuteInterval(cfg.Cronspec)</pre></code><tr><td>510<td><code><pre> if err != nil {</pre></code><tr class=miss><td>511<td><code><pre> return</pre></code><tr><td>512<td><code><pre> }</pre></code><tr><td>513<td><code><pre> }</pre></code><tr><td>514<td><code><pre></pre></code><tr><td>515<td><code><pre> return</pre></code><tr><td>516<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.releaseCronTaskLock>func asynqRouter.releaseCronTaskLock</div><div class=info><a href=#s_fn_asynqRouter.releaseCronTaskLock>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>324<td><code><pre>func (a *asynqRouter) releaseCronTaskLock(ctx context.Context, info *asynq.TaskInfo) {</pre></code><tr><td>325<td><code><pre> if info == nil {</pre></code><tr><td>326<td><code><pre> return</pre></code><tr><td>327<td><code><pre> }</pre></code><tr><td>328<td><code><pre> taskName := a.unformatTaskName(info.Type)</pre></code><tr><td>329<td><code><pre></pre></code><tr><td>330<td><code><pre> // 90 ~ 100ms jitter</pre></code><tr><td>331<td><code><pre> jitter := 90*time.Millisecond + time.Duration(float64(10*time.Millisecond)*rand.Float64())</pre></code><tr><td>332<td><code><pre></pre></code><tr><td>333<td><code><pre> a.l.RLock()</pre></code><tr><td>334<td><code><pre> lockTime := a.lockDurations[info.Type]</pre></code><tr><td>335<td><code><pre> a.l.RUnlock()</pre></code><tr><td>336<td><code><pre></pre></code><tr><td>337<td><code><pre> // prevent a negative tolerant</pre></code><tr><td>338<td><code><pre> tolerant := utils.Min(tolerantOfTimeNotSync, lockTime) - jitter</pre></code><tr><td>339<td><code><pre> tolerant = utils.Max(tolerant, 500*time.Millisecond)</pre></code><tr><td>340<td><code><pre> timer := time.NewTimer(tolerant)</pre></code><tr><td>341<td><code><pre> defer timer.Stop()</pre></code><tr><td>342<td><code><pre></pre></code><tr><td>343<td><code><pre> var e error</pre></code><tr><td>344<td><code><pre> defer func() {</pre></code><tr><td>345<td><code><pre> if e != nil {</pre></code><tr><td>346<td><code><pre> a.warn(ctx, "post enqueue task %s release lock failed: %s", taskName, e)</pre></code><tr><td>347<td><code><pre> }</pre></code><tr><td>348<td><code><pre> }()</pre></code><tr><td>349<td><code><pre></pre></code><tr><td>350<td><code><pre> now := time.Now()</pre></code><tr><td>351<td><code><pre> unlockKey := a.formatLockKey(taskName)</pre></code><tr><td>352<td><code><pre> for {</pre></code><tr><td>353<td><code><pre> select {</pre></code><tr><td>354<td><code><pre> case <-ctx.Done():</pre></code><tr><td>355<td><code><pre> a.debug(ctx, "post enqueue task %s release lock: context done", taskName)</pre></code><tr><td>356<td><code><pre> e = a.locker.Unlock(ctx, unlockKey, lock.ReentrantKey(a.id))</pre></code><tr><td>357<td><code><pre> return</pre></code><tr><td>358<td><code><pre> case <-timer.C:</pre></code><tr><td>359<td><code><pre> e = a.locker.Unlock(ctx, unlockKey, lock.ReentrantKey(a.id))</pre></code><tr><td>360<td><code><pre> return</pre></code><tr><td>361<td><code><pre> default:</pre></code><tr><td>362<td><code><pre> a.l.RLock()</pre></code><tr><td>363<td><code><pre> newLockTime := a.lockDurations[info.Type]</pre></code><tr><td>364<td><code><pre> a.l.RUnlock()</pre></code><tr><td>365<td><code><pre> if newLockTime != lockTime {</pre></code><tr class=miss><td>366<td><code><pre> lockTime = newLockTime</pre></code><tr class=miss><td>367<td><code><pre> tolerant = utils.Min(tolerantOfTimeNotSync, lockTime) - jitter</pre></code><tr class=miss><td>368<td><code><pre> tolerant = utils.Max(tolerant, 500*time.Millisecond)</pre></code><tr class=miss><td>369<td><code><pre> tolerant = utils.Max(0, tolerant-time.Since(now))</pre></code><tr class=miss><td>370<td><code><pre> timer.Reset(tolerant)</pre></code><tr><td>371<td><code><pre> }</pre></code><tr><td>372<td><code><pre> }</pre></code><tr><td>373<td><code><pre> }</pre></code><tr><td>374<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.Start>func asynqRouter.Start</div><div class=info><a href=#s_fn_asynqRouter.Start>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>164<td><code><pre>func (a *asynqRouter) Start() (err error) {</pre></code><tr><td>165<td><code><pre> defer a.info(context.Background(), "scheduler started")</pre></code><tr><td>166<td><code><pre></pre></code><tr><td>167<td><code><pre> if a.c.Trigger {</pre></code><tr><td>168<td><code><pre> if err = a.trigger.Start(); err != nil {</pre></code><tr class=miss><td>169<td><code><pre> return</pre></code><tr><td>170<td><code><pre> }</pre></code><tr><td>171<td><code><pre> }</pre></code><tr><td>172<td><code><pre></pre></code><tr><td>173<td><code><pre> if a.c.Server {</pre></code><tr><td>174<td><code><pre> a.ServeMux.Use(a.gatewayMiddleware)</pre></code><tr><td>175<td><code><pre> a.ServeMux.Use(a.mws...)</pre></code><tr><td>176<td><code><pre> if err = a.server.Start(a.ServeMux); err != nil {</pre></code><tr class=miss><td>177<td><code><pre> return</pre></code><tr><td>178<td><code><pre> }</pre></code><tr><td>179<td><code><pre> }</pre></code><tr><td>180<td><code><pre></pre></code><tr><td>181<td><code><pre> return</pre></code><tr><td>182<td><code><pre>}</pre></code></table><div class=funcname id=fn_Use>func Use</div><div class=info><a href=#s_fn_Use>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/construct.go</code>:</div><table class=listing><tr><td>94<td><code><pre>func Use(name string, opts ...utils.OptionExtender) IRouter {</pre></code><tr><td>95<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>96<td><code><pre></pre></code><tr><td>97<td><code><pre> locker.RLock()</pre></code><tr><td>98<td><code><pre> defer locker.RUnlock()</pre></code><tr><td>99<td><code><pre> routers, ok := routers[opt.appName]</pre></code><tr><td>100<td><code><pre> if !ok {</pre></code><tr class=miss><td>101<td><code><pre> panic(errors.Errorf("cron router instance not found for app: %s", opt.appName))</pre></code><tr><td>102<td><code><pre> }</pre></code><tr><td>103<td><code><pre></pre></code><tr><td>104<td><code><pre> router, ok := routers[name]</pre></code><tr><td>105<td><code><pre> if !ok {</pre></code><tr class=miss><td>106<td><code><pre> panic(errors.Errorf("cron router instance not found for name: %s", name))</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre> return router</pre></code><tr><td>109<td><code><pre>}</pre></code></table><div class=funcname id=fn_newAsynq>func newAsynq</div><div class=info><a href=#s_fn_newAsynq>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>63<td><code><pre>func newAsynq(ctx context.Context, appName, name string, conf *Conf) IRouter {</pre></code><tr><td>64<td><code><pre> r := &asynqRouter{</pre></code><tr><td>65<td><code><pre> appName: appName,</pre></code><tr><td>66<td><code><pre> n: name,</pre></code><tr><td>67<td><code><pre> c: conf,</pre></code><tr><td>68<td><code><pre> lockDurations: make(map[string]time.Duration, len(conf.Tasks)),</pre></code><tr><td>69<td><code><pre> shouldShutdownServer: true,</pre></code><tr><td>70<td><code><pre> shouldShutdownTrigger: true,</pre></code><tr><td>71<td><code><pre> }</pre></code><tr><td>72<td><code><pre> if utils.IsStrBlank(r.c.Queue) {</pre></code><tr><td>73<td><code><pre> r.c.Queue = r.defaultQueue()</pre></code><tr><td>74<td><code><pre> }</pre></code><tr><td>75<td><code><pre></pre></code><tr><td>76<td><code><pre> var rdsCli rdsDrv.UniversalClient</pre></code><tr><td>77<td><code><pre> switch conf.InstanceType {</pre></code><tr><td>78<td><code><pre> case instanceTypeRedis:</pre></code><tr><td>79<td><code><pre> rdsCli = redis.Use(ctx, conf.Instance, redis.AppName(appName))</pre></code><tr><td>80<td><code><pre> case instanceTypeMysql:</pre></code><tr class=miss><td>81<td><code><pre> fallthrough</pre></code><tr><td>82<td><code><pre> default:</pre></code><tr class=miss><td>83<td><code><pre> panic(errors.Errorf("unknown instance type: %s", conf.InstanceType))</pre></code><tr><td>84<td><code><pre> }</pre></code><tr><td>85<td><code><pre></pre></code><tr><td>86<td><code><pre> if r.logger == nil && utils.IsStrNotBlank(conf.Logger) {</pre></code><tr><td>87<td><code><pre> loggerType := inspect.TypeOf(conf.Logger)</pre></code><tr><td>88<td><code><pre> loggerValue := reflect.New(loggerType)</pre></code><tr><td>89<td><code><pre> if loggerValue.Type().Implements(customLoggerType) {</pre></code><tr><td>90<td><code><pre> logger := log.Use(conf.LogInstance, log.AppName(appName))</pre></code><tr><td>91<td><code><pre> loggerValue.Interface().(customLogger).Init(logger, appName, name)</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre> r.logger = loggerValue.Convert(asynqLoggerType).Interface().(asynq.Logger)</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre> if r.locker == nil && utils.IsStrNotBlank(conf.LockInstance) {</pre></code><tr><td>96<td><code><pre> r.locker = lock.Use(conf.LockInstance, lock.AppName(appName))</pre></code><tr><td>97<td><code><pre> if r.locker == nil {</pre></code><tr class=miss><td>98<td><code><pre> panic(errors.Errorf("locker instance not found: %s", conf.LockInstance))</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre></pre></code><tr><td>102<td><code><pre> var provider asynq.PeriodicTaskConfigProvider</pre></code><tr><td>103<td><code><pre> if utils.IsStrNotBlank(conf.TaskLoader) {</pre></code><tr class=miss><td>104<td><code><pre> loaderType := inspect.TypeOf(conf.TaskLoader)</pre></code><tr class=miss><td>105<td><code><pre> if loaderType == nil {</pre></code><tr class=miss><td>106<td><code><pre> panic(errors.Errorf("%s not found", conf.TaskLoader))</pre></code><tr><td>107<td><code><pre> }</pre></code><tr class=miss><td>108<td><code><pre> provider = reflect.New(loaderType).</pre></code><tr><td>109<td><code><pre> Convert(asynqPeriodicTaskConfigProviderType).Interface().(asynq.PeriodicTaskConfigProvider)</pre></code><tr><td>110<td><code><pre> }</pre></code><tr><td>111<td><code><pre></pre></code><tr><td>112<td><code><pre> logLevel := asynq.LogLevel(0)</pre></code><tr><td>113<td><code><pre> utils.MustSuccess(logLevel.Set(conf.LogLevel))</pre></code><tr><td>114<td><code><pre></pre></code><tr><td>115<td><code><pre> wrapper := &asynqWrapper{r: r, n: r.n, appName: appName, cli: rdsCli, provider: provider}</pre></code><tr><td>116<td><code><pre> if conf.Trigger {</pre></code><tr><td>117<td><code><pre> r.initTrigger(ctx, wrapper, logLevel)</pre></code><tr><td>118<td><code><pre> }</pre></code><tr><td>119<td><code><pre> if conf.Server {</pre></code><tr><td>120<td><code><pre> r.initServer(ctx, wrapper, logLevel)</pre></code><tr><td>121<td><code><pre> }</pre></code><tr><td>122<td><code><pre></pre></code><tr><td>123<td><code><pre> return r</pre></code><tr><td>124<td><code><pre>}</pre></code></table><div class=funcname id=fn_@429:9>func @429:9</div><div class=info><a href=#s_fn_@429:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>429<td><code><pre>func(ctx context.Context, raw *asynq.Task) (err error) {</pre></code><tr><td>430<td><code><pre> if !hasArg {</pre></code><tr class=miss><td>431<td><code><pre> return fn(ctx)</pre></code><tr><td>432<td><code><pre> }</pre></code><tr><td>433<td><code><pre> arg := reflect.New(argType)</pre></code><tr><td>434<td><code><pre> payload := raw.Payload()</pre></code><tr><td>435<td><code><pre> if len(payload) == 0 {</pre></code><tr class=miss><td>436<td><code><pre> payload = []byte("null")</pre></code><tr><td>437<td><code><pre> }</pre></code><tr><td>438<td><code><pre> if err = json.Unmarshal(payload, arg.Interface()); err != nil {</pre></code><tr class=miss><td>439<td><code><pre> return</pre></code><tr><td>440<td><code><pre> }</pre></code><tr><td>441<td><code><pre> arg = arg.Elem()</pre></code><tr><td>442<td><code><pre> for i := 0; i < argTypePtrDepth; i++ {</pre></code><tr><td>443<td><code><pre> arg = arg.Addr()</pre></code><tr><td>444<td><code><pre> }</pre></code><tr><td>445<td><code><pre></pre></code><tr><td>446<td><code><pre> return fn(ctx, arg.Interface())</pre></code><tr><td>447<td><code><pre> }</pre></code></table><div class=funcname id=fn_@302:9>func @302:9</div><div class=info><a href=#s_fn_@302:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>302<td><code><pre>func(info *asynq.TaskInfo, err error) {</pre></code><tr><td>303<td><code><pre> // release lock</pre></code><tr><td>304<td><code><pre> if a.locker != nil {</pre></code><tr><td>305<td><code><pre> defer routine.Go(a.releaseCronTaskLock, routine.Args(ctx, info), routine.AppName(a.appName))</pre></code><tr><td>306<td><code><pre> }</pre></code><tr><td>307<td><code><pre></pre></code><tr><td>308<td><code><pre> ignored := []error{errDiscardMessage}</pre></code><tr><td>309<td><code><pre> if a.locker == nil {</pre></code><tr><td>310<td><code><pre> ignored = append(ignored, asynq.ErrDuplicateTask, asynq.ErrTaskIDConflict)</pre></code><tr><td>311<td><code><pre> }</pre></code><tr><td>312<td><code><pre></pre></code><tr><td>313<td><code><pre> if err = utils.ErrIgnore(err, ignored...); err == nil {</pre></code><tr><td>314<td><code><pre> return</pre></code><tr><td>315<td><code><pre> }</pre></code><tr class=miss><td>316<td><code><pre> taskName := "unknown"</pre></code><tr class=miss><td>317<td><code><pre> if info != nil {</pre></code><tr class=miss><td>318<td><code><pre> taskName = a.unformatTaskName(info.Type)</pre></code><tr><td>319<td><code><pre> }</pre></code><tr class=miss><td>320<td><code><pre> a.debug(ctx, "post enqueue task %s failed: %s", taskName, err)</pre></code><tr><td>321<td><code><pre> }</pre></code></table><div class=funcname id=fn_@208:26>func @208:26</div><div class=info><a href=#s_fn_@208:26>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>208<td><code><pre>func(task *asynq.Task, opts []asynq.Option, err error) {</pre></code><tr><td>209<td><code><pre> ignored := []error{errDiscardMessage}</pre></code><tr><td>210<td><code><pre> if a.locker == nil {</pre></code><tr><td>211<td><code><pre> ignored = append(ignored, asynq.ErrDuplicateTask, asynq.ErrTaskIDConflict)</pre></code><tr><td>212<td><code><pre> }</pre></code><tr><td>213<td><code><pre> if err = utils.ErrIgnore(err, ignored...); err == nil {</pre></code><tr><td>214<td><code><pre> return</pre></code><tr><td>215<td><code><pre> }</pre></code><tr class=miss><td>216<td><code><pre> taskName := "unknown"</pre></code><tr class=miss><td>217<td><code><pre> if task != nil {</pre></code><tr class=miss><td>218<td><code><pre> taskName = a.unformatTaskName(task.Type())</pre></code><tr><td>219<td><code><pre> }</pre></code><tr class=miss><td>220<td><code><pre> a.warn(ctx, "enqueue task %s failed: %s", taskName, err)</pre></code><tr><td>221<td><code><pre> }</pre></code></table><div class=funcname id=fn_asynqWrapper.getConfigs>func asynqWrapper.getConfigs</div><div class=info><a href=#s_fn_asynqWrapper.getConfigs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>518<td><code><pre>func (a *asynqWrapper) getConfigs() (result []*asynq.PeriodicTaskConfig, err error) {</pre></code><tr><td>519<td><code><pre> if a.provider != nil {</pre></code><tr class=miss><td>520<td><code><pre> result, err = a.provider.GetConfigs()</pre></code><tr class=miss><td>521<td><code><pre> if err != nil {</pre></code><tr class=miss><td>522<td><code><pre> return</pre></code><tr><td>523<td><code><pre> }</pre></code><tr><td>524<td><code><pre> }</pre></code><tr><td>525<td><code><pre></pre></code><tr><td>526<td><code><pre> var confs map[string]*Conf</pre></code><tr><td>527<td><code><pre> if err = config.Use(a.appName).LoadComponentConfig(config.ComponentCron, &confs); err != nil {</pre></code><tr class=miss><td>528<td><code><pre> return</pre></code><tr><td>529<td><code><pre> }</pre></code><tr><td>530<td><code><pre> conf, ok := confs[a.n]</pre></code><tr><td>531<td><code><pre> if !ok {</pre></code><tr class=miss><td>532<td><code><pre> return nil, errors.Errorf("%s cron config not found", a.n)</pre></code><tr><td>533<td><code><pre> }</pre></code><tr><td>534<td><code><pre></pre></code><tr><td>535<td><code><pre> loc, _ := time.LoadLocation(a.r.c.Timezone)</pre></code><tr><td>536<td><code><pre> if loc == nil {</pre></code><tr class=miss><td>537<td><code><pre> loc = constant.DefaultLocation()</pre></code><tr><td>538<td><code><pre> }</pre></code><tr><td>539<td><code><pre></pre></code><tr><td>540<td><code><pre> queue := conf.Queue</pre></code><tr><td>541<td><code><pre> if utils.IsStrBlank(queue) {</pre></code><tr class=miss><td>542<td><code><pre> queue = a.r.c.Queue</pre></code><tr><td>543<td><code><pre> }</pre></code><tr><td>544<td><code><pre> for name, cfg := range conf.Tasks {</pre></code><tr><td>545<td><code><pre> var (</pre></code><tr><td>546<td><code><pre> deadline time.Time</pre></code><tr><td>547<td><code><pre> interval, timeout time.Duration</pre></code><tr><td>548<td><code><pre> opts []asynq.Option</pre></code><tr><td>549<td><code><pre> )</pre></code><tr><td>550<td><code><pre> if interval, err = a.getTaskExecuteInterval(cfg.Crontab); err != nil {</pre></code><tr class=miss><td>551<td><code><pre> return</pre></code><tr><td>552<td><code><pre> }</pre></code><tr><td>553<td><code><pre> if utils.IsStrNotBlank(cfg.Timeout) {</pre></code><tr class=miss><td>554<td><code><pre> if timeout, err = time.ParseDuration(cfg.Timeout); err != nil {</pre></code><tr class=miss><td>555<td><code><pre> return</pre></code><tr><td>556<td><code><pre> }</pre></code><tr class=miss><td>557<td><code><pre> opts = append(opts, asynq.Timeout(timeout))</pre></code><tr><td>558<td><code><pre> } else {</pre></code><tr><td>559<td><code><pre> opts = append(opts, asynq.Timeout(interval))</pre></code><tr><td>560<td><code><pre> }</pre></code><tr><td>561<td><code><pre> if utils.IsStrNotBlank(cfg.Deadline) {</pre></code><tr class=miss><td>562<td><code><pre> if deadline, err = time.ParseInLocation(constant.StdTimeLayout, cfg.Deadline, loc); err != nil {</pre></code><tr class=miss><td>563<td><code><pre> return</pre></code><tr><td>564<td><code><pre> }</pre></code><tr class=miss><td>565<td><code><pre> opts = append(opts, asynq.Deadline(deadline))</pre></code><tr><td>566<td><code><pre> }</pre></code><tr><td>567<td><code><pre></pre></code><tr><td>568<td><code><pre> result = append(result, &asynq.PeriodicTaskConfig{</pre></code><tr><td>569<td><code><pre> Cronspec: cfg.Crontab,</pre></code><tr><td>570<td><code><pre> Task: asynq.NewTask(name, []byte(cfg.Payload)),</pre></code><tr><td>571<td><code><pre> Opts: append(opts, []asynq.Option{</pre></code><tr><td>572<td><code><pre> asynq.TaskID(name),</pre></code><tr><td>573<td><code><pre> asynq.Unique(utils.Min(interval, tolerantOfTimeNotSync)),</pre></code><tr><td>574<td><code><pre> asynq.Queue(queue),</pre></code><tr><td>575<td><code><pre> asynq.MaxRetry(utils.Max(0, cfg.Retry)),</pre></code><tr><td>576<td><code><pre> }...),</pre></code><tr><td>577<td><code><pre> })</pre></code><tr><td>578<td><code><pre> }</pre></code><tr><td>579<td><code><pre> return</pre></code><tr><td>580<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.Handle>func asynqRouter.Handle</div><div class=info><a href=#s_fn_asynqRouter.Handle>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>132<td><code><pre>func (a *asynqRouter) Handle(pattern string, fn any, _ ...utils.OptionExtender) {</pre></code><tr><td>133<td><code><pre> if !a.c.Server {</pre></code><tr class=miss><td>134<td><code><pre> a.debug(context.Background(), "cannot handle task %s: client is not enabled", a.n)</pre></code><tr class=miss><td>135<td><code><pre> return</pre></code><tr><td>136<td><code><pre> }</pre></code><tr><td>137<td><code><pre></pre></code><tr><td>138<td><code><pre> a.ServeMux.Handle(a.formatTaskName(pattern), a.adaptAsynqHandlerFunc(fn))</pre></code><tr><td>139<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.Serve>func asynqRouter.Serve</div><div class=info><a href=#s_fn_asynqRouter.Serve>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>141<td><code><pre>func (a *asynqRouter) Serve() (err error) {</pre></code><tr class=miss><td>142<td><code><pre> defer a.info(context.Background(), "scheduler is running")</pre></code><tr><td>143<td><code><pre></pre></code><tr class=miss><td>144<td><code><pre> if a.c.Server {</pre></code><tr class=miss><td>145<td><code><pre> a.ServeMux.Use(a.gatewayMiddleware)</pre></code><tr class=miss><td>146<td><code><pre> a.ServeMux.Use(a.mws...)</pre></code><tr><td>147<td><code><pre> }</pre></code><tr><td>148<td><code><pre></pre></code><tr class=miss><td>149<td><code><pre> if a.c.Trigger && !a.c.Server {</pre></code><tr class=miss><td>150<td><code><pre> return a.trigger.Run()</pre></code><tr><td>151<td><code><pre> }</pre></code><tr class=miss><td>152<td><code><pre> if !a.c.Trigger && a.c.Server {</pre></code><tr class=miss><td>153<td><code><pre> return a.server.Run(a.ServeMux)</pre></code><tr><td>154<td><code><pre> }</pre></code><tr><td>155<td><code><pre></pre></code><tr class=miss><td>156<td><code><pre> a.shouldShutdownServer = false</pre></code><tr class=miss><td>157<td><code><pre> if err = a.trigger.Start(); err != nil {</pre></code><tr class=miss><td>158<td><code><pre> return</pre></code><tr><td>159<td><code><pre> }</pre></code><tr><td>160<td><code><pre></pre></code><tr class=miss><td>161<td><code><pre> return a.server.Run(a.ServeMux)</pre></code><tr><td>162<td><code><pre>}</pre></code></table><div class=funcname id=fn_@246:40>func @246:40</div><div class=info><a href=#s_fn_@246:40>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>246<td><code><pre>func(ctx context.Context, task *asynq.Task, err error) {</pre></code><tr class=miss><td>247<td><code><pre> taskName := "unknown"</pre></code><tr class=miss><td>248<td><code><pre> if task != nil {</pre></code><tr class=miss><td>249<td><code><pre> taskName = a.unformatTaskName(task.Type())</pre></code><tr><td>250<td><code><pre> }</pre></code><tr class=miss><td>251<td><code><pre> a.info(ctx, "handle task %s message error %s", taskName, err)</pre></code><tr><td>252<td><code><pre> }</pre></code></table><div class=funcname id=fn_asynqRouter.Use>func asynqRouter.Use</div><div class=info><a href=#s_fn_asynqRouter.Use>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>126<td><code><pre>func (a *asynqRouter) Use(mws ...routerMiddleware) {</pre></code><tr class=miss><td>127<td><code><pre> for _, mw := range mws {</pre></code><tr class=miss><td>128<td><code><pre> a.mws = append(a.mws, a.adaptMiddleware(mw))</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre>}</pre></code></table><div class=funcname id=fn_@391:9>func @391:9</div><div class=info><a href=#s_fn_@391:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>391<td><code><pre>func(asynqNext asynq.Handler) asynq.Handler {</pre></code><tr class=miss><td>392<td><code><pre> next := mw(a.adaptRouterHandlerFunc(asynqNext))</pre></code><tr class=miss><td>393<td><code><pre> return a.adaptAsynqHandlerFunc(next)</pre></code><tr><td>394<td><code><pre> }</pre></code></table><div class=funcname id=fn_@256:20>func @256:20</div><div class=info><a href=#s_fn_@256:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>256<td><code><pre>func(err error) {</pre></code><tr class=miss><td>257<td><code><pre> if err != nil {</pre></code><tr class=miss><td>258<td><code><pre> a.warn(ctx, "health check check failed: %s", err)</pre></code><tr><td>259<td><code><pre> }</pre></code><tr><td>260<td><code><pre> }</pre></code></table><div class=funcname id=fn_asynqRouter.adaptMiddleware>func asynqRouter.adaptMiddleware</div><div class=info><a href=#s_fn_asynqRouter.adaptMiddleware>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>390<td><code><pre>func (a *asynqRouter) adaptMiddleware(mw routerMiddleware) asynq.MiddlewareFunc {</pre></code><tr class=miss><td>391<td><code><pre> return func(asynqNext asynq.Handler) asynq.Handler {</pre></code><tr><td>392<td><code><pre> next := mw(a.adaptRouterHandlerFunc(asynqNext))</pre></code><tr><td>393<td><code><pre> return a.adaptAsynqHandlerFunc(next)</pre></code><tr><td>394<td><code><pre> }</pre></code><tr><td>395<td><code><pre>}</pre></code></table><div class=funcname id=fn_@243:19>func @243:19</div><div class=info><a href=#s_fn_@243:19>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr class=miss><td>243<td><code><pre>func(err error) bool { return !errors.Is(err, errDiscardMessage) }</pre></code></table><div class=funcname id=fn_@451:9>func @451:9</div><div class=info><a href=#s_fn_@451:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>451<td><code><pre>func(ctx context.Context, raw Task) (err error) {</pre></code><tr class=miss><td>452<td><code><pre> return h.ProcessTask(ctx, a.newAsynqTask(raw))</pre></code><tr><td>453<td><code><pre> }</pre></code></table><div class=funcname id=fn_asynqRouter.adaptRouterHandlerFunc>func asynqRouter.adaptRouterHandlerFunc</div><div class=info><a href=#s_fn_asynqRouter.adaptRouterHandlerFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>450<td><code><pre>func (a *asynqRouter) adaptRouterHandlerFunc(h asynq.Handler) routerHandleFunc {</pre></code><tr class=miss><td>451<td><code><pre> return func(ctx context.Context, raw Task) (err error) {</pre></code><tr><td>452<td><code><pre> return h.ProcessTask(ctx, a.newAsynqTask(raw))</pre></code><tr><td>453<td><code><pre> }</pre></code><tr><td>454<td><code><pre>}</pre></code></table><div class=funcname id=fn_@78:4>func @78:4</div><div class=info><a href=#s_fn_@78:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/construct.go</code>:</div><table class=listing><tr class=miss><td>78<td><code><pre>func() IRouter { return Use(name, AppName(opt.AppName)) }</pre></code></table><div class=funcname id=fn_task.ID>func task.ID</div><div class=info><a href=#s_fn_task.ID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/types.go</code>:</div><table class=listing><tr><td>93<td><code><pre>func (t *task) ID() string {</pre></code><tr class=miss><td>94<td><code><pre> return t.id</pre></code><tr><td>95<td><code><pre>}</pre></code></table><div class=funcname id=fn_task.RawMessage>func task.RawMessage</div><div class=info><a href=#s_fn_task.RawMessage>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/types.go</code>:</div><table class=listing><tr><td>105<td><code><pre>func (t *task) RawMessage() any {</pre></code><tr class=miss><td>106<td><code><pre> return t.rawMessage</pre></code><tr><td>107<td><code><pre>}</pre></code></table><div class=funcname id=fn_task.Payload>func task.Payload</div><div class=info><a href=#s_fn_task.Payload>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/types.go</code>:</div><table class=listing><tr><td>101<td><code><pre>func (t *task) Payload() []byte {</pre></code><tr class=miss><td>102<td><code><pre> return t.payload</pre></code><tr><td>103<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRouter.newAsynqTask>func asynqRouter.newAsynqTask</div><div class=info><a href=#s_fn_asynqRouter.newAsynqTask>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/cron/asynq.go</code>:</div><table class=listing><tr><td>478<td><code><pre>func (a *asynqRouter) newAsynqTask(raw Task) (t *asynq.Task) {</pre></code><tr class=miss><td>479<td><code><pre> return raw.RawMessage().(*asynq.Task)</pre></code><tr><td>480<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/db class=funcname>Package Overview: github.com/wfusion/gofusion/db 23 <span class=packageTotal>51.3%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_startDaemonRoutines><td><code><a href=#fn_startDaemonRoutines>startDaemonRoutines(...)</a></code><td><code>github.com/wfusion/gofusion/db/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>10/10</code><tr id=s_fn_Construct><td><code><a href=#fn_Construct>Construct(...)</a></code><td><code>github.com/wfusion/gofusion/db/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>9/9</code><tr id=s_fn_.QueryFirst><td><code><a href=#fn_.QueryFirst>.QueryFirst(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_.InsertOne><td><code><a href=#fn_.InsertOne>.InsertOne(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@60:9><td><code><a href=#fn_@60:9>@60:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_.unscopedGormDB><td><code><a href=#fn_.unscopedGormDB>.unscopedGormDB(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@32:4><td><code><a href=#fn_@32:4>@32:4(...)</a></code><td><code>github.com/wfusion/gofusion/db/tx.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@16:23><td><code><a href=#fn_@16:23>@16:23(...)</a></code><td><code>github.com/wfusion/gofusion/db/ctx.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_GetCtxGormDBByName><td><code><a href=#fn_GetCtxGormDBByName>GetCtxGormDBByName(...)</a></code><td><code>github.com/wfusion/gofusion/db/ctx.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_SetCtxGormDB><td><code><a href=#fn_SetCtxGormDB>SetCtxGormDB(...)</a></code><td><code>github.com/wfusion/gofusion/db/ctx.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_ScanBatch><td><code><a href=#fn_ScanBatch>ScanBatch(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@74:9><td><code><a href=#fn_@74:9>@74:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@17:9><td><code><a href=#fn_@17:9>@17:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/tx.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_TxUse><td><code><a href=#fn_TxUse>TxUse(...)</a></code><td><code>github.com/wfusion/gofusion/db/tx.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_.Model><td><code><a href=#fn_.Model>.Model(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_ScanDAL><td><code><a href=#fn_ScanDAL>ScanDAL(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@458:9><td><code><a href=#fn_@458:9>@458:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@405:46><td><code><a href=#fn_@405:46>@405:46(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@173:41><td><code><a href=#fn_@173:41>@173:41(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@68:9><td><code><a href=#fn_@68:9>@68:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Instance.GetProxy><td><code><a href=#fn_Instance.GetProxy>Instance.GetProxy(...)</a></code><td><code>github.com/wfusion/gofusion/db/db.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_AppName><td><code><a href=#fn_AppName>AppName(...)</a></code><td><code>github.com/wfusion/gofusion/db/db.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@46:9><td><code><a href=#fn_@46:9>@46:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/db.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_ScanOrder><td><code><a href=#fn_ScanOrder>ScanOrder(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_mysqlSoftDelete><td><code><a href=#fn_mysqlSoftDelete>mysqlSoftDelete(...)</a></code><td><code>github.com/wfusion/gofusion/db/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_ScanCursor><td><code><a href=#fn_ScanCursor>ScanCursor(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/db/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Unscoped><td><code><a href=#fn_Unscoped>Unscoped(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_.CanIgnore><td><code><a href=#fn_.CanIgnore>.CanIgnore(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@41:9><td><code><a href=#fn_@41:9>@41:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/db/flag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@400:82><td><code><a href=#fn_@400:82>@400:82(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@40:41><td><code><a href=#fn_@40:41>@40:41(...)</a></code><td><code>github.com/wfusion/gofusion/db/tx.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_addInstance><td><code><a href=#fn_addInstance>addInstance(...)</a></code><td><code>github.com/wfusion/gofusion/db/construct.go</code><td class=percent><code>94.7%</code><td class=linecount><code>36/38</code><tr id=s_fn_adaptMysqlAutoIncrementIncrement><td><code><a href=#fn_adaptMysqlAutoIncrementIncrement>adaptMysqlAutoIncrementIncrement(...)</a></code><td><code>github.com/wfusion/gofusion/db/construct.go</code><td class=percent><code>88.9%</code><td class=linecount><code>8/9</code><tr id=s_fn_.Delete><td><code><a href=#fn_.Delete>.Delete(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>87.5%</code><td class=linecount><code>14/16</code><tr id=s_fn_@45:9><td><code><a href=#fn_@45:9>@45:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/construct.go</code><td class=percent><code>86.7%</code><td class=linecount><code>13/15</code><tr id=s_fn_.ShardingIDGen><td><code><a href=#fn_.ShardingIDGen>.ShardingIDGen(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_Use><td><code><a href=#fn_Use>Use(...)</a></code><td><code>github.com/wfusion/gofusion/db/db.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_.parseOptionFromArgs><td><code><a href=#fn_.parseOptionFromArgs>.parseOptionFromArgs(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_NewDAL><td><code><a href=#fn_NewDAL>NewDAL(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_.tableName><td><code><a href=#fn_.tableName>.tableName(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>77.8%</code><td class=linecount><code>7/9</code><tr id=s_fn_.InsertInBatches><td><code><a href=#fn_.InsertInBatches>.InsertInBatches(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>77.8%</code><td class=linecount><code>7/9</code><tr id=s_fn_WithinTx><td><code><a href=#fn_WithinTx>WithinTx(...)</a></code><td><code>github.com/wfusion/gofusion/db/tx.go</code><td class=percent><code>77.8%</code><td class=linecount><code>7/9</code><tr id=s_fn_.writeWithTableSharding><td><code><a href=#fn_.writeWithTableSharding>.writeWithTableSharding(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>75.0%</code><td class=linecount><code>9/12</code><tr id=s_fn_.WriteDB><td><code><a href=#fn_.WriteDB>.WriteDB(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_@114:21><td><code><a href=#fn_@114:21>@114:21(...)</a></code><td><code>github.com/wfusion/gofusion/db/metrics.go</code><td class=percent><code>73.9%</code><td class=linecount><code>17/23</code><tr id=s_fn_@57:21><td><code><a href=#fn_@57:21>@57:21(...)</a></code><td><code>github.com/wfusion/gofusion/db/metrics.go</code><td class=percent><code>73.5%</code><td class=linecount><code>25/34</code><tr id=s_fn_.Save><td><code><a href=#fn_.Save>.Save(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>71.4%</code><td class=linecount><code>10/14</code><tr id=s_fn_.ReadDB><td><code><a href=#fn_.ReadDB>.ReadDB(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>71.4%</code><td class=linecount><code>5/7</code><tr id=s_fn_Business.BeforeCreate><td><code><a href=#fn_Business.BeforeCreate>Business.BeforeCreate(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>66.7%</code><td class=linecount><code>4/6</code><tr id=s_fn_.writeDB><td><code><a href=#fn_.writeDB>.writeDB(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_.IgnoreErr><td><code><a href=#fn_.IgnoreErr>.IgnoreErr(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_metricDBStats><td><code><a href=#fn_metricDBStats>metricDBStats(...)</a></code><td><code>github.com/wfusion/gofusion/db/metrics.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_metricDBLatency><td><code><a href=#fn_metricDBLatency>metricDBLatency(...)</a></code><td><code>github.com/wfusion/gofusion/db/metrics.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_Scan><td><code><a href=#fn_Scan>Scan(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>58.6%</code><td class=linecount><code>34/58</code><tr id=s_fn_BusinessSoftDeleted.BeforeCreate><td><code><a href=#fn_BusinessSoftDeleted.BeforeCreate>BusinessSoftDeleted.BeforeCreate(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>57.1%</code><td class=linecount><code>4/7</code><tr id=s_fn_.convertAnyToTS><td><code><a href=#fn_.convertAnyToTS>.convertAnyToTS(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>50.0%</code><td class=linecount><code>6/12</code><tr id=s_fn_@206:9><td><code><a href=#fn_@206:9>@206:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/16</code><tr id=s_fn_.ShardingByModelList><td><code><a href=#fn_.ShardingByModelList>.ShardingByModelList(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/15</code><tr id=s_fn_@239:9><td><code><a href=#fn_@239:9>@239:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/15</code><tr id=s_fn_.ShardingIDListGen><td><code><a href=#fn_.ShardingIDListGen>.ShardingIDListGen(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/12</code><tr id=s_fn_.QueryInBatches><td><code><a href=#fn_.QueryInBatches>.QueryInBatches(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/8</code><tr id=s_fn_.Transaction><td><code><a href=#fn_.Transaction>.Transaction(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_.Count><td><code><a href=#fn_.Count>.Count(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_.Query><td><code><a href=#fn_.Query>.Query(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_.QueryLast><td><code><a href=#fn_.QueryLast>.QueryLast(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_.ShardingByValues><td><code><a href=#fn_.ShardingByValues>.ShardingByValues(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_Data.Equals><td><code><a href=#fn_Data.Equals>Data.Equals(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_Business.Equals><td><code><a href=#fn_Business.Equals>Business.Equals(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_BusinessSoftDeleted.Equals><td><code><a href=#fn_BusinessSoftDeleted.Equals>BusinessSoftDeleted.Equals(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_DataSoftDeleted.Equals><td><code><a href=#fn_DataSoftDeleted.Equals>DataSoftDeleted.Equals(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_.Pluck><td><code><a href=#fn_.Pluck>.Pluck(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_.Update><td><code><a href=#fn_.Update>.Update(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_.Take><td><code><a href=#fn_.Take>.Take(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_.FirstOrCreate><td><code><a href=#fn_.FirstOrCreate>.FirstOrCreate(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_.Updates><td><code><a href=#fn_.Updates>.Updates(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_GetCtxGormDBByNameList><td><code><a href=#fn_GetCtxGormDBByNameList>GetCtxGormDBByNameList(...)</a></code><td><code>github.com/wfusion/gofusion/db/ctx.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_DataSoftDeleted.Clone><td><code><a href=#fn_DataSoftDeleted.Clone>DataSoftDeleted.Clone(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_.SetCtxReadDB><td><code><a href=#fn_.SetCtxReadDB>.SetCtxReadDB(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_.SetCtxWriteDB><td><code><a href=#fn_.SetCtxWriteDB>.SetCtxWriteDB(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_Business.Clone><td><code><a href=#fn_Business.Clone>Business.Clone(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@141:4><td><code><a href=#fn_@141:4>@141:4(...)</a></code><td><code>github.com/wfusion/gofusion/db/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_BusinessSoftDeleted.Clone><td><code><a href=#fn_BusinessSoftDeleted.Clone>BusinessSoftDeleted.Clone(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_DataSoftDeleted.DeleteTime><td><code><a href=#fn_DataSoftDeleted.DeleteTime>DataSoftDeleted.DeleteTime(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_Data.Clone><td><code><a href=#fn_Data.Clone>Data.Clone(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@25:23><td><code><a href=#fn_@25:23>@25:23(...)</a></code><td><code>github.com/wfusion/gofusion/db/ctx.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@116:3><td><code><a href=#fn_@116:3>@116:3(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@53:9><td><code><a href=#fn_@53:9>@53:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@33:4><td><code><a href=#fn_@33:4>@33:4(...)</a></code><td><code>github.com/wfusion/gofusion/db/tx.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@371:82><td><code><a href=#fn_@371:82>@371:82(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Data.ModifyTime><td><code><a href=#fn_Data.ModifyTime>Data.ModifyTime(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Data.CreateTime><td><code><a href=#fn_Data.CreateTime>Data.CreateTime(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_DataSoftDeleted.CreateTime><td><code><a href=#fn_DataSoftDeleted.CreateTime>DataSoftDeleted.CreateTime(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_DataSoftDeleted.ModifyTime><td><code><a href=#fn_DataSoftDeleted.ModifyTime>DataSoftDeleted.ModifyTime(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@470:9><td><code><a href=#fn_@470:9>@470:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_WriteDB><td><code><a href=#fn_WriteDB>WriteDB(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@464:9><td><code><a href=#fn_@464:9>@464:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Clauses><td><code><a href=#fn_Clauses>Clauses(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Business.BeforeCreateFn><td><code><a href=#fn_Business.BeforeCreateFn>Business.BeforeCreateFn(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@116:9><td><code><a href=#fn_@116:9>@116:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Business.BizCreateTime><td><code><a href=#fn_Business.BizCreateTime>Business.BizCreateTime(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Business.BizModifyTime><td><code><a href=#fn_Business.BizModifyTime>Business.BizModifyTime(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@434:36><td><code><a href=#fn_@434:36>@434:36(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@378:56><td><code><a href=#fn_@378:56>@378:56(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_.ModelSlice><td><code><a href=#fn_.ModelSlice>.ModelSlice(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_BusinessSoftDeleted.BeforeCreateFn><td><code><a href=#fn_BusinessSoftDeleted.BeforeCreateFn>BusinessSoftDeleted.BeforeCreateFn(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@170:9><td><code><a href=#fn_@170:9>@170:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@273:74><td><code><a href=#fn_@273:74>@273:74(...)</a></code><td><code>github.com/wfusion/gofusion/db/dal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_BusinessSoftDeleted.BizModifyTime><td><code><a href=#fn_BusinessSoftDeleted.BizModifyTime>BusinessSoftDeleted.BizModifyTime(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@86:9><td><code><a href=#fn_@86:9>@86:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_GetCtxGormDB><td><code><a href=#fn_GetCtxGormDB>GetCtxGormDB(...)</a></code><td><code>github.com/wfusion/gofusion/db/ctx.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_CheckGormErrorFn><td><code><a href=#fn_CheckGormErrorFn>CheckGormErrorFn(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@204:58><td><code><a href=#fn_@204:58>@204:58(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_JsonUnmarshalFn><td><code><a href=#fn_JsonUnmarshalFn>JsonUnmarshalFn(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@137:9><td><code><a href=#fn_@137:9>@137:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_JsonMarshalFn><td><code><a href=#fn_JsonMarshalFn>JsonMarshalFn(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_ScanLog><td><code><a href=#fn_ScanLog>ScanLog(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@80:9><td><code><a href=#fn_@80:9>@80:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_ScanLimit><td><code><a href=#fn_ScanLimit>ScanLimit(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_ScanWhere><td><code><a href=#fn_ScanWhere>ScanWhere(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@47:9><td><code><a href=#fn_@47:9>@47:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_ScanUse><td><code><a href=#fn_ScanUse>ScanUse(...)</a></code><td><code>github.com/wfusion/gofusion/db/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_BusinessSoftDeleted.BizCreateTime><td><code><a href=#fn_BusinessSoftDeleted.BizCreateTime>BusinessSoftDeleted.BizCreateTime(...)</a></code><td><code>github.com/wfusion/gofusion/db/model.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_startDaemonRoutines>func startDaemonRoutines</div><div class=info><a href=#s_fn_startDaemonRoutines>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/metrics.go</code>:</div><table class=listing><tr><td>28<td><code><pre>func startDaemonRoutines(ctx context.Context, appName, name string, conf *Conf) {</pre></code><tr><td>29<td><code><pre> ticker := time.Tick(time.Second * 5)</pre></code><tr><td>30<td><code><pre> app := config.Use(appName).AppName()</pre></code><tr><td>31<td><code><pre> labels := []metrics.Label{</pre></code><tr><td>32<td><code><pre> {Key: "config", Value: name},</pre></code><tr><td>33<td><code><pre> {Key: "database", Value: conf.DB},</pre></code><tr><td>34<td><code><pre> }</pre></code><tr><td>35<td><code><pre></pre></code><tr><td>36<td><code><pre> log.Printf("%v [Gofusion] %s %s %s metrics start", syscall.Getpid(), app, config.ComponentDB, name)</pre></code><tr><td>37<td><code><pre> for {</pre></code><tr><td>38<td><code><pre> select {</pre></code><tr><td>39<td><code><pre> case <-ctx.Done():</pre></code><tr><td>40<td><code><pre> log.Printf("%v [Gofusion] %s %s %s metrics exited",</pre></code><tr><td>41<td><code><pre> syscall.Getpid(), app, config.ComponentDB, name)</pre></code><tr><td>42<td><code><pre> return</pre></code><tr><td>43<td><code><pre> case <-ticker:</pre></code><tr><td>44<td><code><pre> go metricDBStats(ctx, appName, name, labels)</pre></code><tr><td>45<td><code><pre> go metricDBLatency(ctx, appName, name, labels)</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre>}</pre></code></table><div class=funcname id=fn_Construct>func Construct</div><div class=info><a href=#s_fn_Construct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/construct.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func Construct(ctx context.Context, confs map[string]*Conf, opts ...utils.OptionExtender) func() {</pre></code><tr><td>32<td><code><pre> opt := utils.ApplyOptions[config.InitOption](opts...)</pre></code><tr><td>33<td><code><pre> optU := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>34<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>35<td><code><pre> opt.AppName = optU.appName</pre></code><tr><td>36<td><code><pre> }</pre></code><tr><td>37<td><code><pre></pre></code><tr><td>38<td><code><pre> for name, conf := range confs {</pre></code><tr><td>39<td><code><pre> addInstance(ctx, name, conf, opt)</pre></code><tr><td>40<td><code><pre> }</pre></code><tr><td>41<td><code><pre> // patch delete at</pre></code><tr><td>42<td><code><pre> patches := make([]*gomonkey.Patches, 0, len(confs))</pre></code><tr><td>43<td><code><pre> patches = append(patches, softdelete.PatchGormDeleteAt())</pre></code><tr><td>44<td><code><pre></pre></code><tr><td>45<td><code><pre> return func() {</pre></code><tr><td>46<td><code><pre> rwlock.Lock()</pre></code><tr><td>47<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>48<td><code><pre></pre></code><tr><td>49<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>50<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>51<td><code><pre> if appInstances != nil {</pre></code><tr><td>52<td><code><pre> for _, instance := range appInstances[opt.AppName] {</pre></code><tr><td>53<td><code><pre> if sqlDB, err := instance.GetProxy().DB(); err == nil {</pre></code><tr><td>54<td><code><pre> if err := sqlDB.Close(); err != nil {</pre></code><tr><td>55<td><code><pre> log.Printf("%v [Gofusion] %s %s close error: %s", pid, app, config.ComponentDB, err)</pre></code><tr><td>56<td><code><pre> }</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre> delete(appInstances, opt.AppName)</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre> if len(appInstances) == 0 {</pre></code><tr><td>62<td><code><pre> for _, patch := range patches {</pre></code><tr><td>63<td><code><pre> if patch != nil {</pre></code><tr><td>64<td><code><pre> patch.Reset()</pre></code><tr><td>65<td><code><pre> }</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre> softdelete.PatchGormDeleteAtOnce = new(sync.Once)</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre> }</pre></code><tr><td>70<td><code><pre>}</pre></code></table><div class=funcname id=fn_.QueryFirst>func .QueryFirst</div><div class=info><a href=#s_fn_.QueryFirst>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>96<td><code><pre>func (d *dal[T, TS]) QueryFirst(ctx context.Context, query any, args ...any) (*T, error) {</pre></code><tr><td>97<td><code><pre> o, args := d.parseOptionFromArgs(args...)</pre></code><tr><td>98<td><code><pre> ctx = context.WithValue(ctx, fusCtx.KeyDALOption, o)</pre></code><tr><td>99<td><code><pre></pre></code><tr><td>100<td><code><pre> found := d.Model()</pre></code><tr><td>101<td><code><pre> result := d.ReadDB(ctx).Clauses(o.clauses...).Where(query, args...).First(found)</pre></code><tr><td>102<td><code><pre> if d.CanIgnore(result.Error) {</pre></code><tr><td>103<td><code><pre> return nil, nil</pre></code><tr><td>104<td><code><pre> }</pre></code><tr><td>105<td><code><pre> return found, d.IgnoreErr(result.Error)</pre></code><tr><td>106<td><code><pre>}</pre></code></table><div class=funcname id=fn_.InsertOne>func .InsertOne</div><div class=info><a href=#s_fn_.InsertOne>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>161<td><code><pre>func (d *dal[T, TS]) InsertOne(ctx context.Context, mod *T, opts ...utils.OptionExtender) error {</pre></code><tr><td>162<td><code><pre> o := utils.ApplyOptions[mysqlDALOption](opts...)</pre></code><tr><td>163<td><code><pre> ctx = context.WithValue(ctx, fusCtx.KeyDALOption, o)</pre></code><tr><td>164<td><code><pre> return d.WriteDB(ctx).Clauses(o.clauses...).Create(mod).Error</pre></code><tr><td>165<td><code><pre>}</pre></code></table><div class=funcname id=fn_@60:9>func @60:9</div><div class=info><a href=#s_fn_@60:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>60<td><code><pre>func(o *scanOption) {</pre></code><tr><td>61<td><code><pre> o.cursors = cursors</pre></code><tr><td>62<td><code><pre> o.cursorWhere = cursorWhere</pre></code><tr><td>63<td><code><pre> o.cursorColumns = cursorColumns</pre></code><tr><td>64<td><code><pre> }</pre></code></table><div class=funcname id=fn_.unscopedGormDB>func .unscopedGormDB</div><div class=info><a href=#s_fn_.unscopedGormDB>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>444<td><code><pre>func (d *dal[T, TS]) unscopedGormDB(src *gorm.DB, o *mysqlDALOption) (dst *gorm.DB) {</pre></code><tr><td>445<td><code><pre> if o != nil && o.unscoped {</pre></code><tr><td>446<td><code><pre> return src.Unscoped()</pre></code><tr><td>447<td><code><pre> }</pre></code><tr><td>448<td><code><pre> return src</pre></code><tr><td>449<td><code><pre>}</pre></code></table><div class=funcname id=fn_@32:4>func @32:4</div><div class=info><a href=#s_fn_@32:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/tx.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func() bool { db = GetCtxGormDBByName(ctx, opt.dbName); return db != nil }</pre></code></table><div class=funcname id=fn_@16:23>func @16:23</div><div class=info><a href=#s_fn_@16:23>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/ctx.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func(ctx context.Context) bool {</pre></code><tr><td>17<td><code><pre> db = utils.GetCtxAny(ctx, fusCtx.KeyGormDB, (*DB)(nil))</pre></code><tr><td>18<td><code><pre> return db != nil && db.Name == name</pre></code><tr><td>19<td><code><pre> }</pre></code></table><div class=funcname id=fn_GetCtxGormDBByName>func GetCtxGormDBByName</div><div class=info><a href=#s_fn_GetCtxGormDBByName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/ctx.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func GetCtxGormDBByName(ctx context.Context, name string) (db *DB) {</pre></code><tr><td>16<td><code><pre> utils.TravelCtx(ctx, func(ctx context.Context) bool {</pre></code><tr><td>17<td><code><pre> db = utils.GetCtxAny(ctx, fusCtx.KeyGormDB, (*DB)(nil))</pre></code><tr><td>18<td><code><pre> return db != nil && db.Name == name</pre></code><tr><td>19<td><code><pre> })</pre></code><tr><td>20<td><code><pre> return</pre></code><tr><td>21<td><code><pre>}</pre></code></table><div class=funcname id=fn_SetCtxGormDB>func SetCtxGormDB</div><div class=info><a href=#s_fn_SetCtxGormDB>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/ctx.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func SetCtxGormDB(ctx context.Context, db *DB) context.Context {</pre></code><tr><td>33<td><code><pre> return utils.SetCtxAny(ctx, fusCtx.KeyGormDB, db)</pre></code><tr><td>34<td><code><pre>}</pre></code></table><div class=funcname id=fn_ScanBatch>func ScanBatch</div><div class=info><a href=#s_fn_ScanBatch>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>73<td><code><pre>func ScanBatch(batch int) utils.OptionFunc[scanOption] {</pre></code><tr><td>74<td><code><pre> return func(o *scanOption) {</pre></code><tr><td>75<td><code><pre> o.batch = batch</pre></code><tr><td>76<td><code><pre> }</pre></code><tr><td>77<td><code><pre>}</pre></code></table><div class=funcname id=fn_@74:9>func @74:9</div><div class=info><a href=#s_fn_@74:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>74<td><code><pre>func(o *scanOption) {</pre></code><tr><td>75<td><code><pre> o.batch = batch</pre></code><tr><td>76<td><code><pre> }</pre></code></table><div class=funcname id=fn_@17:9>func @17:9</div><div class=info><a href=#s_fn_@17:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/tx.go</code>:</div><table class=listing><tr><td>17<td><code><pre>func(o *txOption) {</pre></code><tr><td>18<td><code><pre> o.dbName = name</pre></code><tr><td>19<td><code><pre> }</pre></code></table><div class=funcname id=fn_TxUse>func TxUse</div><div class=info><a href=#s_fn_TxUse>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/tx.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func TxUse(name string) utils.OptionFunc[txOption] {</pre></code><tr><td>17<td><code><pre> return func(o *txOption) {</pre></code><tr><td>18<td><code><pre> o.dbName = name</pre></code><tr><td>19<td><code><pre> }</pre></code><tr><td>20<td><code><pre>}</pre></code></table><div class=funcname id=fn_.Model>func .Model</div><div class=info><a href=#s_fn_.Model>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>315<td><code><pre>func (d *dal[T, TS]) Model() *T { return new(T) }</pre></code></table><div class=funcname id=fn_ScanDAL>func ScanDAL</div><div class=info><a href=#s_fn_ScanDAL>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>40<td><code><pre>func ScanDAL[T any, TS ~[]*T](dal DalInterface[T, TS]) utils.OptionFunc[scanOptionGeneric[T, TS]] {</pre></code><tr><td>41<td><code><pre> return func(o *scanOptionGeneric[T, TS]) {</pre></code><tr><td>42<td><code><pre> o.dal = dal</pre></code><tr><td>43<td><code><pre> }</pre></code><tr><td>44<td><code><pre>}</pre></code></table><div class=funcname id=fn_@458:9>func @458:9</div><div class=info><a href=#s_fn_@458:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>458<td><code><pre>func(m *mysqlDALOption) {</pre></code><tr><td>459<td><code><pre> m.unscoped = true</pre></code><tr><td>460<td><code><pre> }</pre></code></table><div class=funcname id=fn_@405:46>func @405:46</div><div class=info><a href=#s_fn_@405:46>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>405<td><code><pre>func(t any) *T { return t.(*T) }</pre></code></table><div class=funcname id=fn_@173:41>func @173:41</div><div class=info><a href=#s_fn_@173:41>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>173<td><code><pre>func(s string) bool { return strings.EqualFold(s, col) }</pre></code></table><div class=funcname id=fn_@68:9>func @68:9</div><div class=info><a href=#s_fn_@68:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>68<td><code><pre>func(o *scanOption) {</pre></code><tr><td>69<td><code><pre> o.order = order</pre></code><tr><td>70<td><code><pre> }</pre></code></table><div class=funcname id=fn_Instance.GetProxy>func Instance.GetProxy</div><div class=info><a href=#s_fn_Instance.GetProxy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/db.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func (d *Instance) GetProxy() *gorm.DB {</pre></code><tr><td>32<td><code><pre> return d.db.GetProxy()</pre></code><tr><td>33<td><code><pre>}</pre></code></table><div class=funcname id=fn_AppName>func AppName</div><div class=info><a href=#s_fn_AppName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/db.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func AppName(name string) utils.OptionFunc[useOption] {</pre></code><tr><td>46<td><code><pre> return func(o *useOption) {</pre></code><tr><td>47<td><code><pre> o.appName = name</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre>}</pre></code></table><div class=funcname id=fn_@46:9>func @46:9</div><div class=info><a href=#s_fn_@46:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/db.go</code>:</div><table class=listing><tr><td>46<td><code><pre>func(o *useOption) {</pre></code><tr><td>47<td><code><pre> o.appName = name</pre></code><tr><td>48<td><code><pre> }</pre></code></table><div class=funcname id=fn_ScanOrder>func ScanOrder</div><div class=info><a href=#s_fn_ScanOrder>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>67<td><code><pre>func ScanOrder(order any) utils.OptionFunc[scanOption] {</pre></code><tr><td>68<td><code><pre> return func(o *scanOption) {</pre></code><tr><td>69<td><code><pre> o.order = order</pre></code><tr><td>70<td><code><pre> }</pre></code><tr><td>71<td><code><pre>}</pre></code></table><div class=funcname id=fn_mysqlSoftDelete>func mysqlSoftDelete</div><div class=info><a href=#s_fn_mysqlSoftDelete>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/construct.go</code>:</div><table class=listing><tr><td>178<td><code><pre>func mysqlSoftDelete(db *orm.DB, conf *Conf) {</pre></code><tr><td>179<td><code><pre> callbacks.SoftDelete(db.GetProxy())</pre></code><tr><td>180<td><code><pre>}</pre></code></table><div class=funcname id=fn_ScanCursor>func ScanCursor</div><div class=info><a href=#s_fn_ScanCursor>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>59<td><code><pre>func ScanCursor(cursorWhere any, cursorColumns []string, cursors ...any) utils.OptionFunc[scanOption] {</pre></code><tr><td>60<td><code><pre> return func(o *scanOption) {</pre></code><tr><td>61<td><code><pre> o.cursors = cursors</pre></code><tr><td>62<td><code><pre> o.cursorWhere = cursorWhere</pre></code><tr><td>63<td><code><pre> o.cursorColumns = cursorColumns</pre></code><tr><td>64<td><code><pre> }</pre></code><tr><td>65<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/construct.go</code>:</div><table class=listing><tr><td>182<td><code><pre>func init() {</pre></code><tr><td>183<td><code><pre> config.AddComponent(config.ComponentDB, Construct, config.WithFlag(&flagString))</pre></code><tr><td>184<td><code><pre>}</pre></code></table><div class=funcname id=fn_Unscoped>func Unscoped</div><div class=info><a href=#s_fn_Unscoped>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>457<td><code><pre>func Unscoped() utils.OptionFunc[mysqlDALOption] {</pre></code><tr><td>458<td><code><pre> return func(m *mysqlDALOption) {</pre></code><tr><td>459<td><code><pre> m.unscoped = true</pre></code><tr><td>460<td><code><pre> }</pre></code><tr><td>461<td><code><pre>}</pre></code></table><div class=funcname id=fn_.CanIgnore>func .CanIgnore</div><div class=info><a href=#s_fn_.CanIgnore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>323<td><code><pre>func (d *dal[T, TS]) CanIgnore(err error) bool { return errors.Is(err, gorm.ErrRecordNotFound) }</pre></code></table><div class=funcname id=fn_@41:9>func @41:9</div><div class=info><a href=#s_fn_@41:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func(o *scanOptionGeneric[T, TS]) {</pre></code><tr><td>42<td><code><pre> o.dal = dal</pre></code><tr><td>43<td><code><pre> }</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/flag.go</code>:</div><table class=listing><tr><td>7<td><code><pre>func init() {</pre></code><tr><td>8<td><code><pre> pflag.StringVarP(&flagString, "db-config", "", "", "json string for database config")</pre></code><tr><td>9<td><code><pre>}</pre></code></table><div class=funcname id=fn_@400:82>func @400:82</div><div class=info><a href=#s_fn_@400:82>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>400<td><code><pre>func(t *T) any { return t }</pre></code></table><div class=funcname id=fn_@40:41>func @40:41</div><div class=info><a href=#s_fn_@40:41>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/tx.go</code>:</div><table class=listing><tr><td>40<td><code><pre>func(tx *gorm.DB) error {</pre></code><tr><td>41<td><code><pre> return cb(SetCtxGormDB(ctx, &DB{</pre></code><tr><td>42<td><code><pre> DB: &orm.DB{DB: tx},</pre></code><tr><td>43<td><code><pre> Name: db.Name,</pre></code><tr><td>44<td><code><pre> tableShardingPlugins: db.tableShardingPlugins,</pre></code><tr><td>45<td><code><pre> }))</pre></code><tr><td>46<td><code><pre> }</pre></code></table><div class=funcname id=fn_addInstance>func addInstance</div><div class=info><a href=#s_fn_addInstance>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/construct.go</code>:</div><table class=listing><tr><td>72<td><code><pre>func addInstance(ctx context.Context, name string, conf *Conf, opt *config.InitOption) {</pre></code><tr><td>73<td><code><pre> var logObj logger.Interface</pre></code><tr><td>74<td><code><pre> if !config.Use(opt.AppName).Debug() && utils.IsStrNotBlank(conf.LoggerConfig.Logger) {</pre></code><tr><td>75<td><code><pre> loggerType := inspect.TypeOf(conf.LoggerConfig.Logger)</pre></code><tr><td>76<td><code><pre> loggerValue := reflect.New(loggerType)</pre></code><tr><td>77<td><code><pre> if loggerValue.Type().Implements(customLoggerType) {</pre></code><tr><td>78<td><code><pre> l := fusLog.Use(conf.LoggerConfig.LogInstance, fusLog.AppName(opt.AppName))</pre></code><tr><td>79<td><code><pre> loggerValue.Interface().(customLogger).Init(l, opt.AppName, name)</pre></code><tr><td>80<td><code><pre> }</pre></code><tr><td>81<td><code><pre> logObj = loggerValue.Interface().(logger.Interface)</pre></code><tr><td>82<td><code><pre> }</pre></code><tr><td>83<td><code><pre></pre></code><tr><td>84<td><code><pre> // conf.Option.Password = config.CryptoDecryptFunc()(conf.Option.Password)</pre></code><tr><td>85<td><code><pre> db, err := orm.Gorm.New(ctx, conf.Option, orm.WithLogger(logObj))</pre></code><tr><td>86<td><code><pre> if err != nil {</pre></code><tr class=miss><td>87<td><code><pre> panic(errors.Errorf("initialize gorm db instance error: %+v", err))</pre></code><tr><td>88<td><code><pre> }</pre></code><tr><td>89<td><code><pre></pre></code><tr><td>90<td><code><pre> adaptMysqlAutoIncrementIncrement(db, conf)</pre></code><tr><td>91<td><code><pre> mysqlSoftDelete(db, conf)</pre></code><tr><td>92<td><code><pre> if config.Use(opt.AppName).Debug() {</pre></code><tr><td>93<td><code><pre> db.DB = db.Debug()</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre></pre></code><tr><td>96<td><code><pre> // sharding</pre></code><tr><td>97<td><code><pre> tablePluginMap := make(map[string]plugins.TableSharding, len(conf.Sharding))</pre></code><tr><td>98<td><code><pre> for _, shardConf := range conf.Sharding {</pre></code><tr><td>99<td><code><pre> var generator idgen.Generator</pre></code><tr><td>100<td><code><pre> if utils.IsStrNotBlank(shardConf.IDGen) {</pre></code><tr><td>101<td><code><pre> generator = (*(*func() idgen.Generator)(inspect.FuncOf(shardConf.IDGen)))()</pre></code><tr><td>102<td><code><pre> }</pre></code><tr><td>103<td><code><pre></pre></code><tr><td>104<td><code><pre> var expression gval.Evaluable</pre></code><tr><td>105<td><code><pre> if utils.IsStrNotBlank(shardConf.ShardingKeyExpr) {</pre></code><tr><td>106<td><code><pre> expression = utils.Must(gval.Full().NewEvaluable(shardConf.ShardingKeyExpr))</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre></pre></code><tr><td>109<td><code><pre> tableShardingPlugin := plugins.DefaultTableSharding(plugins.TableShardingConfig{</pre></code><tr><td>110<td><code><pre> Database: name,</pre></code><tr><td>111<td><code><pre> Table: shardConf.Table,</pre></code><tr><td>112<td><code><pre> ShardingKeys: shardConf.Columns,</pre></code><tr><td>113<td><code><pre> ShardingKeyExpr: expression,</pre></code><tr><td>114<td><code><pre> ShardingKeyByRawValue: shardConf.ShardingKeyByRawValue,</pre></code><tr><td>115<td><code><pre> ShardingKeysForMigrating: shardConf.ShardingKeysForMigrating,</pre></code><tr><td>116<td><code><pre> NumberOfShards: shardConf.NumberOfShards,</pre></code><tr><td>117<td><code><pre> CustomSuffix: shardConf.Suffix,</pre></code><tr><td>118<td><code><pre> PrimaryKeyGenerator: generator,</pre></code><tr><td>119<td><code><pre> })</pre></code><tr><td>120<td><code><pre></pre></code><tr><td>121<td><code><pre> utils.MustSuccess(db.Use(tableShardingPlugin))</pre></code><tr><td>122<td><code><pre> tablePluginMap[shardConf.Table] = tableShardingPlugin</pre></code><tr><td>123<td><code><pre> }</pre></code><tr><td>124<td><code><pre></pre></code><tr><td>125<td><code><pre> rwlock.Lock()</pre></code><tr><td>126<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>127<td><code><pre> if appInstances == nil {</pre></code><tr><td>128<td><code><pre> appInstances = make(map[string]map[string]*Instance)</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre> if appInstances[opt.AppName] == nil {</pre></code><tr><td>131<td><code><pre> appInstances[opt.AppName] = make(map[string]*Instance)</pre></code><tr><td>132<td><code><pre> }</pre></code><tr><td>133<td><code><pre> if _, ok := appInstances[opt.AppName][name]; ok {</pre></code><tr class=miss><td>134<td><code><pre> panic(ErrDuplicatedName)</pre></code><tr><td>135<td><code><pre> }</pre></code><tr><td>136<td><code><pre> appInstances[opt.AppName][name] = &Instance{db: db, name: name, tableShardingPlugins: tablePluginMap}</pre></code><tr><td>137<td><code><pre></pre></code><tr><td>138<td><code><pre> // ioc</pre></code><tr><td>139<td><code><pre> if opt.DI != nil {</pre></code><tr><td>140<td><code><pre> opt.DI.MustProvide(</pre></code><tr><td>141<td><code><pre> func() *gorm.DB {</pre></code><tr><td>142<td><code><pre> rwlock.RLock()</pre></code><tr><td>143<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>144<td><code><pre> return appInstances[opt.AppName][name].GetProxy()</pre></code><tr><td>145<td><code><pre> },</pre></code><tr><td>146<td><code><pre> di.Name(name),</pre></code><tr><td>147<td><code><pre> )</pre></code><tr><td>148<td><code><pre> }</pre></code><tr><td>149<td><code><pre></pre></code><tr><td>150<td><code><pre> go startDaemonRoutines(ctx, opt.AppName, name, conf)</pre></code><tr><td>151<td><code><pre>}</pre></code></table><div class=funcname id=fn_adaptMysqlAutoIncrementIncrement>func adaptMysqlAutoIncrementIncrement</div><div class=info><a href=#s_fn_adaptMysqlAutoIncrementIncrement>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/construct.go</code>:</div><table class=listing><tr><td>155<td><code><pre>func adaptMysqlAutoIncrementIncrement(db *orm.DB, conf *Conf) {</pre></code><tr><td>156<td><code><pre> autoIncrIncr := conf.AutoIncrementIncrement</pre></code><tr><td>157<td><code><pre> // unset, query auto increment increment</pre></code><tr><td>158<td><code><pre> if autoIncrIncr == 0 && conf.Driver == orm.DriverMysql {</pre></code><tr><td>159<td><code><pre> type autoConfig struct {</pre></code><tr><td>160<td><code><pre> VariableName string `gorm:"column:Variable_name"`</pre></code><tr><td>161<td><code><pre> Value int64 `gorm:"column:Value"`</pre></code><tr><td>162<td><code><pre> }</pre></code><tr><td>163<td><code><pre></pre></code><tr><td>164<td><code><pre> var cfg *autoConfig</pre></code><tr><td>165<td><code><pre> db.WithContext(context.Background()).</pre></code><tr><td>166<td><code><pre> Raw("show variables like 'auto_increment_increment'").</pre></code><tr><td>167<td><code><pre> Scan(&cfg)</pre></code><tr><td>168<td><code><pre> autoIncrIncr = cfg.Value</pre></code><tr><td>169<td><code><pre> }</pre></code><tr><td>170<td><code><pre> // no need to replace callbacks</pre></code><tr><td>171<td><code><pre> if autoIncrIncr <= 1 {</pre></code><tr><td>172<td><code><pre> return</pre></code><tr><td>173<td><code><pre> }</pre></code><tr><td>174<td><code><pre></pre></code><tr class=miss><td>175<td><code><pre> callbacks.CreateAutoIncr(db.GetProxy(), db.GetDialector(), autoIncrIncr)</pre></code><tr><td>176<td><code><pre>}</pre></code></table><div class=funcname id=fn_.Delete>func .Delete</div><div class=info><a href=#s_fn_.Delete>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>237<td><code><pre>func (d *dal[T, TS]) Delete(ctx context.Context, query any, args ...any) (int64, error) {</pre></code><tr><td>238<td><code><pre> o, args := d.parseOptionFromArgs(args...)</pre></code><tr><td>239<td><code><pre> ctx = context.WithValue(ctx, fusCtx.KeyDALOption, o)</pre></code><tr><td>240<td><code><pre> mList, ok := d.convertAnyToTS(query)</pre></code><tr><td>241<td><code><pre> if !ok || len(mList) == 0 {</pre></code><tr><td>242<td><code><pre> deleted := d.WriteDB(ctx).Clauses(o.clauses...).Where(query, args...).Delete(d.Model())</pre></code><tr><td>243<td><code><pre> return deleted.RowsAffected, deleted.Error</pre></code><tr><td>244<td><code><pre> } else {</pre></code><tr><td>245<td><code><pre> sharded, err := d.writeWithTableSharding(ctx, mList)</pre></code><tr><td>246<td><code><pre> if err != nil {</pre></code><tr class=miss><td>247<td><code><pre> return 0, err</pre></code><tr><td>248<td><code><pre> }</pre></code><tr><td>249<td><code><pre> var rowAffected int64</pre></code><tr><td>250<td><code><pre> for _, mList := range sharded {</pre></code><tr><td>251<td><code><pre> deleted := d.WriteDB(ctx).Clauses(o.clauses...).Delete(mList, args...)</pre></code><tr><td>252<td><code><pre> if deleted.Error != nil {</pre></code><tr class=miss><td>253<td><code><pre> return rowAffected, deleted.Error</pre></code><tr><td>254<td><code><pre> }</pre></code><tr><td>255<td><code><pre> rowAffected += deleted.RowsAffected</pre></code><tr><td>256<td><code><pre> }</pre></code><tr><td>257<td><code><pre> return rowAffected, nil</pre></code><tr><td>258<td><code><pre> }</pre></code><tr><td>259<td><code><pre>}</pre></code></table><div class=funcname id=fn_@45:9>func @45:9</div><div class=info><a href=#s_fn_@45:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/construct.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func() {</pre></code><tr><td>46<td><code><pre> rwlock.Lock()</pre></code><tr><td>47<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>48<td><code><pre></pre></code><tr><td>49<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>50<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>51<td><code><pre> if appInstances != nil {</pre></code><tr><td>52<td><code><pre> for _, instance := range appInstances[opt.AppName] {</pre></code><tr><td>53<td><code><pre> if sqlDB, err := instance.GetProxy().DB(); err == nil {</pre></code><tr><td>54<td><code><pre> if err := sqlDB.Close(); err != nil {</pre></code><tr class=miss><td>55<td><code><pre> log.Printf("%v [Gofusion] %s %s close error: %s", pid, app, config.ComponentDB, err)</pre></code><tr><td>56<td><code><pre> }</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre> delete(appInstances, opt.AppName)</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre> if len(appInstances) == 0 {</pre></code><tr><td>62<td><code><pre> for _, patch := range patches {</pre></code><tr><td>63<td><code><pre> if patch != nil {</pre></code><tr class=miss><td>64<td><code><pre> patch.Reset()</pre></code><tr><td>65<td><code><pre> }</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre> softdelete.PatchGormDeleteAtOnce = new(sync.Once)</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre> }</pre></code></table><div class=funcname id=fn_.ShardingIDGen>func .ShardingIDGen</div><div class=info><a href=#s_fn_.ShardingIDGen>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>335<td><code><pre>func (d *dal[T, TS]) ShardingIDGen(ctx context.Context) (id uint64, err error) {</pre></code><tr><td>336<td><code><pre> writeDB := d.writeDB(ctx)</pre></code><tr><td>337<td><code><pre> tableName := d.tableName(writeDB, new(T))</pre></code><tr><td>338<td><code><pre> tableShardingPlugin, ok := writeDB.tableShardingPlugins[tableName]</pre></code><tr><td>339<td><code><pre> if !ok {</pre></code><tr class=miss><td>340<td><code><pre> return 0, plugins.ErrIDGeneratorNotFound</pre></code><tr><td>341<td><code><pre> }</pre></code><tr><td>342<td><code><pre> return tableShardingPlugin.ShardingIDGen(ctx)</pre></code><tr><td>343<td><code><pre>}</pre></code></table><div class=funcname id=fn_Use>func Use</div><div class=info><a href=#s_fn_Use>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/db.go</code>:</div><table class=listing><tr><td>51<td><code><pre>func Use(ctx context.Context, name string, opts ...utils.OptionExtender) *DB {</pre></code><tr><td>52<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>53<td><code><pre></pre></code><tr><td>54<td><code><pre> rwlock.RLock()</pre></code><tr><td>55<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>56<td><code><pre> instances, ok := appInstances[opt.appName]</pre></code><tr><td>57<td><code><pre> if !ok {</pre></code><tr class=miss><td>58<td><code><pre> panic(errors.Errorf("db instance not found for app: %s", opt.appName))</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre> instance, ok := instances[name]</pre></code><tr><td>61<td><code><pre> if !ok {</pre></code><tr class=miss><td>62<td><code><pre> panic(errors.Errorf("db instance not found for name: %s", name))</pre></code><tr><td>63<td><code><pre> }</pre></code><tr><td>64<td><code><pre></pre></code><tr><td>65<td><code><pre> return &DB{DB: instance.db.WithContext(ctx), Name: name, tableShardingPlugins: instance.tableShardingPlugins}</pre></code><tr><td>66<td><code><pre>}</pre></code></table><div class=funcname id=fn_.parseOptionFromArgs>func .parseOptionFromArgs</div><div class=info><a href=#s_fn_.parseOptionFromArgs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>475<td><code><pre>func (d *dal[T, TS]) parseOptionFromArgs(args ...any) (o *mysqlDALOption, r []any) {</pre></code><tr><td>476<td><code><pre> o = new(mysqlDALOption)</pre></code><tr><td>477<td><code><pre> r = make([]any, 0, len(args))</pre></code><tr><td>478<td><code><pre> for _, arg := range args {</pre></code><tr><td>479<td><code><pre> if reflect.TypeOf(arg).Implements(gormClauseExpressionType) {</pre></code><tr class=miss><td>480<td><code><pre> o.clauses = append(o.clauses, arg.(clause.Expression))</pre></code><tr class=miss><td>481<td><code><pre> continue</pre></code><tr><td>482<td><code><pre> }</pre></code><tr><td>483<td><code><pre></pre></code><tr><td>484<td><code><pre> switch v := arg.(type) {</pre></code><tr><td>485<td><code><pre> case utils.OptionFunc[mysqlDALOption]:</pre></code><tr><td>486<td><code><pre> v(o)</pre></code><tr><td>487<td><code><pre> default:</pre></code><tr><td>488<td><code><pre> r = append(r, arg)</pre></code><tr><td>489<td><code><pre> }</pre></code><tr><td>490<td><code><pre> }</pre></code><tr><td>491<td><code><pre> return</pre></code><tr><td>492<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewDAL>func NewDAL</div><div class=info><a href=#s_fn_NewDAL>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>58<td><code><pre>func NewDAL[T any, TS ~[]*T](readDBName, writeDBName string, opts ...utils.OptionExtender) DalInterface[T, TS] {</pre></code><tr><td>59<td><code><pre> instance := new(T)</pre></code><tr><td>60<td><code><pre> if _, ok := any(instance).(schema.Tabler); !ok {</pre></code><tr class=miss><td>61<td><code><pre> panic(errors.Errorf("model unimplement schema.Tabler [model[%T] read_db[%s] write_db[%s]]",</pre></code><tr><td>62<td><code><pre> instance, readDBName, writeDBName))</pre></code><tr><td>63<td><code><pre> }</pre></code><tr><td>64<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>65<td><code><pre> return &dal[T, TS]{</pre></code><tr><td>66<td><code><pre> appName: opt.appName,</pre></code><tr><td>67<td><code><pre> readDBName: readDBName,</pre></code><tr><td>68<td><code><pre> writeDBName: writeDBName,</pre></code><tr><td>69<td><code><pre> }</pre></code><tr><td>70<td><code><pre>}</pre></code></table><div class=funcname id=fn_.tableName>func .tableName</div><div class=info><a href=#s_fn_.tableName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>409<td><code><pre>func (d *dal[T, TS]) tableName(db *DB, mod *T) (name string) {</pre></code><tr><td>410<td><code><pre> if tabler, ok := any(mod).(schema.Tabler); ok {</pre></code><tr><td>411<td><code><pre> name = tabler.TableName()</pre></code><tr><td>412<td><code><pre> }</pre></code><tr><td>413<td><code><pre> if tabler, ok := any(mod).(schema.TablerWithNamer); ok {</pre></code><tr class=miss><td>414<td><code><pre> name = tabler.TableName(db.NamingStrategy)</pre></code><tr><td>415<td><code><pre> }</pre></code><tr><td>416<td><code><pre> // TODO: check if embeddedNamer valid</pre></code><tr><td>417<td><code><pre> embeddedNamer := inspect.TypeOf("gorm.io/gorm/schema.embeddedNamer")</pre></code><tr><td>418<td><code><pre> namingStrategy := reflect.ValueOf(db.NamingStrategy)</pre></code><tr><td>419<td><code><pre> if namingStrategy.CanConvert(embeddedNamer) {</pre></code><tr class=miss><td>420<td><code><pre> name = namingStrategy.Convert(embeddedNamer).FieldByName("Table").String()</pre></code><tr><td>421<td><code><pre> }</pre></code><tr><td>422<td><code><pre> return</pre></code><tr><td>423<td><code><pre>}</pre></code></table><div class=funcname id=fn_.InsertInBatches>func .InsertInBatches</div><div class=info><a href=#s_fn_.InsertInBatches>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>167<td><code><pre>func (d *dal[T, TS]) InsertInBatches(ctx context.Context,</pre></code><tr><td>168<td><code><pre> modList TS, batchSize int, opts ...utils.OptionExtender) error {</pre></code><tr><td>169<td><code><pre> o := utils.ApplyOptions[mysqlDALOption](opts...)</pre></code><tr><td>170<td><code><pre> ctx = context.WithValue(ctx, fusCtx.KeyDALOption, o)</pre></code><tr><td>171<td><code><pre> sharded, err := d.writeWithTableSharding(ctx, modList)</pre></code><tr><td>172<td><code><pre> if err != nil {</pre></code><tr class=miss><td>173<td><code><pre> return err</pre></code><tr><td>174<td><code><pre> }</pre></code><tr><td>175<td><code><pre> for _, mList := range sharded {</pre></code><tr><td>176<td><code><pre> if err = d.WriteDB(ctx).Clauses(o.clauses...).CreateInBatches(mList, batchSize).Error; err != nil {</pre></code><tr class=miss><td>177<td><code><pre> return err</pre></code><tr><td>178<td><code><pre> }</pre></code><tr><td>179<td><code><pre> }</pre></code><tr><td>180<td><code><pre></pre></code><tr><td>181<td><code><pre> return nil</pre></code><tr><td>182<td><code><pre>}</pre></code></table><div class=funcname id=fn_WithinTx>func WithinTx</div><div class=info><a href=#s_fn_WithinTx>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/tx.go</code>:</div><table class=listing><tr><td>23<td><code><pre>func WithinTx(ctx context.Context, cb func(ctx context.Context) (err error), opts ...utils.OptionExtender) error {</pre></code><tr><td>24<td><code><pre> var db *DB</pre></code><tr><td>25<td><code><pre></pre></code><tr><td>26<td><code><pre> o := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>27<td><code><pre> opt := utils.ApplyOptions[txOption](opts...)</pre></code><tr><td>28<td><code><pre> if opt.dbName == "" {</pre></code><tr class=miss><td>29<td><code><pre> db = GetCtxGormDB(ctx)</pre></code><tr><td>30<td><code><pre> } else {</pre></code><tr><td>31<td><code><pre> utils.IfAny(</pre></code><tr><td>32<td><code><pre> func() bool { db = GetCtxGormDBByName(ctx, opt.dbName); return db != nil },</pre></code><tr><td>33<td><code><pre> func() bool { db = Use(ctx, opt.dbName, AppName(o.appName)); return db != nil },</pre></code><tr><td>34<td><code><pre> )</pre></code><tr><td>35<td><code><pre> }</pre></code><tr><td>36<td><code><pre> if db == nil {</pre></code><tr class=miss><td>37<td><code><pre> panic(ErrDatabaseNotFound)</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre></pre></code><tr><td>40<td><code><pre> return db.WithContext(ctx).Transaction(func(tx *gorm.DB) error {</pre></code><tr><td>41<td><code><pre> return cb(SetCtxGormDB(ctx, &DB{</pre></code><tr><td>42<td><code><pre> DB: &orm.DB{DB: tx},</pre></code><tr><td>43<td><code><pre> Name: db.Name,</pre></code><tr><td>44<td><code><pre> tableShardingPlugins: db.tableShardingPlugins,</pre></code><tr><td>45<td><code><pre> }))</pre></code><tr><td>46<td><code><pre> })</pre></code><tr><td>47<td><code><pre>}</pre></code></table><div class=funcname id=fn_.writeWithTableSharding>func .writeWithTableSharding</div><div class=info><a href=#s_fn_.writeWithTableSharding>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>390<td><code><pre>func (d *dal[T, TS]) writeWithTableSharding(ctx context.Context, src TS) (dst []TS, err error) {</pre></code><tr><td>391<td><code><pre> if len(src) == 0 {</pre></code><tr class=miss><td>392<td><code><pre> return</pre></code><tr><td>393<td><code><pre> }</pre></code><tr><td>394<td><code><pre> writeDB := d.writeDB(ctx)</pre></code><tr><td>395<td><code><pre> shardingPlugin, ok := writeDB.tableShardingPlugins[d.tableName(writeDB, src[0])]</pre></code><tr><td>396<td><code><pre> if !ok {</pre></code><tr class=miss><td>397<td><code><pre> return []TS{src}, nil</pre></code><tr><td>398<td><code><pre> }</pre></code><tr><td>399<td><code><pre></pre></code><tr><td>400<td><code><pre> sharded, err := shardingPlugin.ShardingByModelList(ctx, utils.SliceMapping(src, func(t *T) any { return t })...)</pre></code><tr><td>401<td><code><pre> if err != nil {</pre></code><tr class=miss><td>402<td><code><pre> return</pre></code><tr><td>403<td><code><pre> }</pre></code><tr><td>404<td><code><pre> for _, item := range sharded {</pre></code><tr><td>405<td><code><pre> dst = append(dst, utils.SliceMapping(item, func(t any) *T { return t.(*T) }))</pre></code><tr><td>406<td><code><pre> }</pre></code><tr><td>407<td><code><pre> return</pre></code><tr><td>408<td><code><pre>}</pre></code></table><div class=funcname id=fn_.WriteDB>func .WriteDB</div><div class=info><a href=#s_fn_.WriteDB>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>293<td><code><pre>func (d *dal[T, TS]) WriteDB(ctx context.Context) *gorm.DB {</pre></code><tr><td>294<td><code><pre> o, _ := ctx.Value(fusCtx.KeyDALOption).(*mysqlDALOption)</pre></code><tr><td>295<td><code><pre> if orm := GetCtxGormDBByName(ctx, d.writeDBName); orm != nil {</pre></code><tr class=miss><td>296<td><code><pre> return d.unscopedGormDB(orm.Model(d.Model()), o).WithContext(ctx)</pre></code><tr><td>297<td><code><pre> }</pre></code><tr><td>298<td><code><pre></pre></code><tr><td>299<td><code><pre> return d.unscopedGormDB(Use(ctx, d.writeDBName, AppName(d.appName)).WithContext(ctx).Model(d.Model()), o)</pre></code><tr><td>300<td><code><pre>}</pre></code></table><div class=funcname id=fn_@114:21>func @114:21</div><div class=info><a href=#s_fn_@114:21>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/metrics.go</code>:</div><table class=listing><tr><td>114<td><code><pre>func() {</pre></code><tr><td>115<td><code><pre> rwlock.RLock()</pre></code><tr><td>116<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>117<td><code><pre> instances, ok := appInstances[appName]</pre></code><tr><td>118<td><code><pre> if !ok {</pre></code><tr class=miss><td>119<td><code><pre> return</pre></code><tr><td>120<td><code><pre> }</pre></code><tr><td>121<td><code><pre> instance, ok := instances[name]</pre></code><tr><td>122<td><code><pre> if !ok {</pre></code><tr class=miss><td>123<td><code><pre> return</pre></code><tr><td>124<td><code><pre> }</pre></code><tr><td>125<td><code><pre> db := instance.GetProxy()</pre></code><tr><td>126<td><code><pre> sqlDB, err := db.DB()</pre></code><tr><td>127<td><code><pre> if err != nil {</pre></code><tr class=miss><td>128<td><code><pre> return</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre></pre></code><tr><td>131<td><code><pre> begin := time.Now()</pre></code><tr><td>132<td><code><pre> if err := sqlDB.Ping(); err != nil {</pre></code><tr class=miss><td>133<td><code><pre> return</pre></code><tr><td>134<td><code><pre> }</pre></code><tr><td>135<td><code><pre> latency := float64(time.Since(begin)) / float64(time.Millisecond)</pre></code><tr><td>136<td><code><pre> latencyKey := append([]string{config.Use(appName).AppName()}, metricsLatencyKey...)</pre></code><tr><td>137<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr><td>138<td><code><pre> select {</pre></code><tr><td>139<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>140<td><code><pre> return</pre></code><tr><td>141<td><code><pre> default:</pre></code><tr><td>142<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr><td>143<td><code><pre> m.AddSample(ctx, latencyKey, latency,</pre></code><tr><td>144<td><code><pre> metrics.Labels(labels),</pre></code><tr><td>145<td><code><pre> metrics.PrometheusBuckets(metricsLatencyBuckets),</pre></code><tr><td>146<td><code><pre> )</pre></code><tr><td>147<td><code><pre> } else {</pre></code><tr class=miss><td>148<td><code><pre> m.AddSample(ctx, metricsLatencyKey, latency,</pre></code><tr><td>149<td><code><pre> metrics.Labels(labels),</pre></code><tr><td>150<td><code><pre> metrics.PrometheusBuckets(metricsLatencyBuckets),</pre></code><tr><td>151<td><code><pre> )</pre></code><tr><td>152<td><code><pre> }</pre></code><tr><td>153<td><code><pre> }</pre></code><tr><td>154<td><code><pre> }</pre></code><tr><td>155<td><code><pre> }</pre></code></table><div class=funcname id=fn_@57:21>func @57:21</div><div class=info><a href=#s_fn_@57:21>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/metrics.go</code>:</div><table class=listing><tr><td>57<td><code><pre>func() {</pre></code><tr><td>58<td><code><pre> rwlock.RLock()</pre></code><tr><td>59<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>60<td><code><pre></pre></code><tr><td>61<td><code><pre> instances, ok := appInstances[appName]</pre></code><tr><td>62<td><code><pre> if !ok {</pre></code><tr class=miss><td>63<td><code><pre> return</pre></code><tr><td>64<td><code><pre> }</pre></code><tr><td>65<td><code><pre> instance, ok := instances[name]</pre></code><tr><td>66<td><code><pre> if !ok {</pre></code><tr class=miss><td>67<td><code><pre> return</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre> db := instance.GetProxy()</pre></code><tr><td>70<td><code><pre> sqlDB, err := db.DB()</pre></code><tr><td>71<td><code><pre> if err != nil {</pre></code><tr class=miss><td>72<td><code><pre> return</pre></code><tr><td>73<td><code><pre> }</pre></code><tr><td>74<td><code><pre></pre></code><tr><td>75<td><code><pre> app := config.Use(appName).AppName()</pre></code><tr><td>76<td><code><pre> idleKey := append([]string{app}, metricsPoolIdleKey...)</pre></code><tr><td>77<td><code><pre> inuseKey := append([]string{app}, metricsPoolInUseKey...)</pre></code><tr><td>78<td><code><pre> totalKey := append([]string{app}, metricsPoolTotalKey...)</pre></code><tr><td>79<td><code><pre> waitCountKey := append([]string{app}, metricsPoolWaitCountKey...)</pre></code><tr><td>80<td><code><pre> waitDurationKey := append([]string{app}, metricsPoolWaitDurationKey...)</pre></code><tr><td>81<td><code><pre></pre></code><tr><td>82<td><code><pre> stats := sqlDB.Stats()</pre></code><tr><td>83<td><code><pre> waitDuration := float64(stats.WaitDuration) / float64(time.Millisecond)</pre></code><tr><td>84<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr><td>85<td><code><pre> select {</pre></code><tr><td>86<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>87<td><code><pre> return</pre></code><tr><td>88<td><code><pre> default:</pre></code><tr><td>89<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr><td>90<td><code><pre> m.SetGauge(ctx, idleKey, float64(stats.Idle), metrics.Labels(labels))</pre></code><tr><td>91<td><code><pre> m.SetGauge(ctx, inuseKey, float64(stats.InUse), metrics.Labels(labels))</pre></code><tr><td>92<td><code><pre> m.SetGauge(ctx, totalKey, float64(stats.OpenConnections), metrics.Labels(labels))</pre></code><tr><td>93<td><code><pre> m.SetGauge(ctx, waitCountKey, float64(stats.WaitCount), metrics.Labels(labels))</pre></code><tr><td>94<td><code><pre> m.SetGauge(ctx, waitDurationKey, waitDuration, metrics.Labels(labels))</pre></code><tr><td>95<td><code><pre> } else {</pre></code><tr class=miss><td>96<td><code><pre> m.SetGauge(ctx, metricsPoolIdleKey, float64(stats.Idle), metrics.Labels(labels))</pre></code><tr class=miss><td>97<td><code><pre> m.SetGauge(ctx, metricsPoolInUseKey, float64(stats.InUse), metrics.Labels(labels))</pre></code><tr class=miss><td>98<td><code><pre> m.SetGauge(ctx, metricsPoolTotalKey, float64(stats.OpenConnections), metrics.Labels(labels))</pre></code><tr class=miss><td>99<td><code><pre> m.SetGauge(ctx, metricsPoolWaitCountKey, float64(stats.WaitCount), metrics.Labels(labels))</pre></code><tr class=miss><td>100<td><code><pre> m.SetGauge(ctx, metricsPoolWaitDurationKey, waitDuration, metrics.Labels(labels))</pre></code><tr><td>101<td><code><pre> }</pre></code><tr><td>102<td><code><pre> }</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre> }</pre></code></table><div class=funcname id=fn_.Save>func .Save</div><div class=info><a href=#s_fn_.Save>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>197<td><code><pre>func (d *dal[T, TS]) Save(ctx context.Context, mod any, opts ...utils.OptionExtender) error {</pre></code><tr><td>198<td><code><pre> // Translate the struct to slice to follow the insert into with ON DUPLICATE KEY UPDATE</pre></code><tr><td>199<td><code><pre> mList, ok := d.convertAnyToTS(mod)</pre></code><tr><td>200<td><code><pre> if !ok {</pre></code><tr class=miss><td>201<td><code><pre> mList = utils.SliceConvert(mod, reflect.TypeOf(TS{})).(TS)</pre></code><tr><td>202<td><code><pre> }</pre></code><tr><td>203<td><code><pre> if len(mList) == 0 {</pre></code><tr class=miss><td>204<td><code><pre> return nil</pre></code><tr><td>205<td><code><pre> }</pre></code><tr><td>206<td><code><pre> o := utils.ApplyOptions[mysqlDALOption](opts...)</pre></code><tr><td>207<td><code><pre> ctx = context.WithValue(ctx, fusCtx.KeyDALOption, o)</pre></code><tr><td>208<td><code><pre> sharded, err := d.writeWithTableSharding(ctx, mList)</pre></code><tr><td>209<td><code><pre> if err != nil {</pre></code><tr class=miss><td>210<td><code><pre> return err</pre></code><tr><td>211<td><code><pre> }</pre></code><tr><td>212<td><code><pre> for _, mList := range sharded {</pre></code><tr><td>213<td><code><pre> if err = d.WriteDB(ctx).Clauses(o.clauses...).Save(mList).Error; err != nil {</pre></code><tr class=miss><td>214<td><code><pre> return err</pre></code><tr><td>215<td><code><pre> }</pre></code><tr><td>216<td><code><pre> }</pre></code><tr><td>217<td><code><pre></pre></code><tr><td>218<td><code><pre> return nil</pre></code><tr><td>219<td><code><pre>}</pre></code></table><div class=funcname id=fn_.ReadDB>func .ReadDB</div><div class=info><a href=#s_fn_.ReadDB>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>282<td><code><pre>func (d *dal[T, TS]) ReadDB(ctx context.Context) *gorm.DB {</pre></code><tr><td>283<td><code><pre> o, _ := ctx.Value(fusCtx.KeyDALOption).(*mysqlDALOption)</pre></code><tr><td>284<td><code><pre> dbName := d.readDBName</pre></code><tr><td>285<td><code><pre> if o != nil && o.useWriteDB {</pre></code><tr class=miss><td>286<td><code><pre> dbName = d.writeDBName</pre></code><tr><td>287<td><code><pre> }</pre></code><tr><td>288<td><code><pre> if orm := GetCtxGormDBByName(ctx, dbName); orm != nil {</pre></code><tr class=miss><td>289<td><code><pre> return d.unscopedGormDB(orm.Model(d.Model()), o).WithContext(ctx)</pre></code><tr><td>290<td><code><pre> }</pre></code><tr><td>291<td><code><pre> return d.unscopedGormDB(Use(ctx, dbName, AppName(d.appName)).WithContext(ctx).Model(d.Model()), o)</pre></code><tr><td>292<td><code><pre>}</pre></code></table><div class=funcname id=fn_Business.BeforeCreate>func Business.BeforeCreate</div><div class=info><a href=#s_fn_Business.BeforeCreate>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>105<td><code><pre>func (b *Business) BeforeCreate(tx *gorm.DB) (err error) {</pre></code><tr><td>106<td><code><pre> if b == nil {</pre></code><tr class=miss><td>107<td><code><pre> tx.Statement.SetColumn("uuid", utils.UUID())</pre></code><tr class=miss><td>108<td><code><pre> return</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre> if b.UUID == [16]byte{0} {</pre></code><tr><td>111<td><code><pre> b.UUID = uuid.New()</pre></code><tr><td>112<td><code><pre> }</pre></code><tr><td>113<td><code><pre> return</pre></code><tr><td>114<td><code><pre>}</pre></code></table><div class=funcname id=fn_.writeDB>func .writeDB</div><div class=info><a href=#s_fn_.writeDB>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>383<td><code><pre>func (d *dal[T, TS]) writeDB(ctx context.Context) *DB {</pre></code><tr><td>384<td><code><pre> if orm := GetCtxGormDBByName(ctx, d.writeDBName); orm != nil {</pre></code><tr class=miss><td>385<td><code><pre> return orm</pre></code><tr><td>386<td><code><pre> }</pre></code><tr><td>387<td><code><pre></pre></code><tr><td>388<td><code><pre> return Use(ctx, d.writeDBName, AppName(d.appName))</pre></code><tr><td>389<td><code><pre>}</pre></code></table><div class=funcname id=fn_.IgnoreErr>func .IgnoreErr</div><div class=info><a href=#s_fn_.IgnoreErr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>317<td><code><pre>func (d *dal[T, TS]) IgnoreErr(err error) error {</pre></code><tr><td>318<td><code><pre> if errors.Is(err, gorm.ErrRecordNotFound) {</pre></code><tr class=miss><td>319<td><code><pre> return nil</pre></code><tr><td>320<td><code><pre> }</pre></code><tr><td>321<td><code><pre> return err</pre></code><tr><td>322<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricDBStats>func metricDBStats</div><div class=info><a href=#s_fn_metricDBStats>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/metrics.go</code>:</div><table class=listing><tr><td>50<td><code><pre>func metricDBStats(ctx context.Context, appName, name string, labels []metrics.Label) {</pre></code><tr><td>51<td><code><pre> select {</pre></code><tr><td>52<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>53<td><code><pre> return</pre></code><tr><td>54<td><code><pre> default:</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre></pre></code><tr><td>57<td><code><pre> _, _ = utils.Catch(func() {</pre></code><tr><td>58<td><code><pre> rwlock.RLock()</pre></code><tr><td>59<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>60<td><code><pre></pre></code><tr><td>61<td><code><pre> instances, ok := appInstances[appName]</pre></code><tr><td>62<td><code><pre> if !ok {</pre></code><tr><td>63<td><code><pre> return</pre></code><tr><td>64<td><code><pre> }</pre></code><tr><td>65<td><code><pre> instance, ok := instances[name]</pre></code><tr><td>66<td><code><pre> if !ok {</pre></code><tr><td>67<td><code><pre> return</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre> db := instance.GetProxy()</pre></code><tr><td>70<td><code><pre> sqlDB, err := db.DB()</pre></code><tr><td>71<td><code><pre> if err != nil {</pre></code><tr><td>72<td><code><pre> return</pre></code><tr><td>73<td><code><pre> }</pre></code><tr><td>74<td><code><pre></pre></code><tr><td>75<td><code><pre> app := config.Use(appName).AppName()</pre></code><tr><td>76<td><code><pre> idleKey := append([]string{app}, metricsPoolIdleKey...)</pre></code><tr><td>77<td><code><pre> inuseKey := append([]string{app}, metricsPoolInUseKey...)</pre></code><tr><td>78<td><code><pre> totalKey := append([]string{app}, metricsPoolTotalKey...)</pre></code><tr><td>79<td><code><pre> waitCountKey := append([]string{app}, metricsPoolWaitCountKey...)</pre></code><tr><td>80<td><code><pre> waitDurationKey := append([]string{app}, metricsPoolWaitDurationKey...)</pre></code><tr><td>81<td><code><pre></pre></code><tr><td>82<td><code><pre> stats := sqlDB.Stats()</pre></code><tr><td>83<td><code><pre> waitDuration := float64(stats.WaitDuration) / float64(time.Millisecond)</pre></code><tr><td>84<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr><td>85<td><code><pre> select {</pre></code><tr><td>86<td><code><pre> case <-ctx.Done():</pre></code><tr><td>87<td><code><pre> return</pre></code><tr><td>88<td><code><pre> default:</pre></code><tr><td>89<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr><td>90<td><code><pre> m.SetGauge(ctx, idleKey, float64(stats.Idle), metrics.Labels(labels))</pre></code><tr><td>91<td><code><pre> m.SetGauge(ctx, inuseKey, float64(stats.InUse), metrics.Labels(labels))</pre></code><tr><td>92<td><code><pre> m.SetGauge(ctx, totalKey, float64(stats.OpenConnections), metrics.Labels(labels))</pre></code><tr><td>93<td><code><pre> m.SetGauge(ctx, waitCountKey, float64(stats.WaitCount), metrics.Labels(labels))</pre></code><tr><td>94<td><code><pre> m.SetGauge(ctx, waitDurationKey, waitDuration, metrics.Labels(labels))</pre></code><tr><td>95<td><code><pre> } else {</pre></code><tr><td>96<td><code><pre> m.SetGauge(ctx, metricsPoolIdleKey, float64(stats.Idle), metrics.Labels(labels))</pre></code><tr><td>97<td><code><pre> m.SetGauge(ctx, metricsPoolInUseKey, float64(stats.InUse), metrics.Labels(labels))</pre></code><tr><td>98<td><code><pre> m.SetGauge(ctx, metricsPoolTotalKey, float64(stats.OpenConnections), metrics.Labels(labels))</pre></code><tr><td>99<td><code><pre> m.SetGauge(ctx, metricsPoolWaitCountKey, float64(stats.WaitCount), metrics.Labels(labels))</pre></code><tr><td>100<td><code><pre> m.SetGauge(ctx, metricsPoolWaitDurationKey, waitDuration, metrics.Labels(labels))</pre></code><tr><td>101<td><code><pre> }</pre></code><tr><td>102<td><code><pre> }</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre> })</pre></code><tr><td>105<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricDBLatency>func metricDBLatency</div><div class=info><a href=#s_fn_metricDBLatency>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/metrics.go</code>:</div><table class=listing><tr><td>107<td><code><pre>func metricDBLatency(ctx context.Context, appName, name string, labels []metrics.Label) {</pre></code><tr><td>108<td><code><pre> select {</pre></code><tr><td>109<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>110<td><code><pre> return</pre></code><tr><td>111<td><code><pre> default:</pre></code><tr><td>112<td><code><pre> }</pre></code><tr><td>113<td><code><pre></pre></code><tr><td>114<td><code><pre> _, _ = utils.Catch(func() {</pre></code><tr><td>115<td><code><pre> rwlock.RLock()</pre></code><tr><td>116<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>117<td><code><pre> instances, ok := appInstances[appName]</pre></code><tr><td>118<td><code><pre> if !ok {</pre></code><tr><td>119<td><code><pre> return</pre></code><tr><td>120<td><code><pre> }</pre></code><tr><td>121<td><code><pre> instance, ok := instances[name]</pre></code><tr><td>122<td><code><pre> if !ok {</pre></code><tr><td>123<td><code><pre> return</pre></code><tr><td>124<td><code><pre> }</pre></code><tr><td>125<td><code><pre> db := instance.GetProxy()</pre></code><tr><td>126<td><code><pre> sqlDB, err := db.DB()</pre></code><tr><td>127<td><code><pre> if err != nil {</pre></code><tr><td>128<td><code><pre> return</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre></pre></code><tr><td>131<td><code><pre> begin := time.Now()</pre></code><tr><td>132<td><code><pre> if err := sqlDB.Ping(); err != nil {</pre></code><tr><td>133<td><code><pre> return</pre></code><tr><td>134<td><code><pre> }</pre></code><tr><td>135<td><code><pre> latency := float64(time.Since(begin)) / float64(time.Millisecond)</pre></code><tr><td>136<td><code><pre> latencyKey := append([]string{config.Use(appName).AppName()}, metricsLatencyKey...)</pre></code><tr><td>137<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr><td>138<td><code><pre> select {</pre></code><tr><td>139<td><code><pre> case <-ctx.Done():</pre></code><tr><td>140<td><code><pre> return</pre></code><tr><td>141<td><code><pre> default:</pre></code><tr><td>142<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr><td>143<td><code><pre> m.AddSample(ctx, latencyKey, latency,</pre></code><tr><td>144<td><code><pre> metrics.Labels(labels),</pre></code><tr><td>145<td><code><pre> metrics.PrometheusBuckets(metricsLatencyBuckets),</pre></code><tr><td>146<td><code><pre> )</pre></code><tr><td>147<td><code><pre> } else {</pre></code><tr><td>148<td><code><pre> m.AddSample(ctx, metricsLatencyKey, latency,</pre></code><tr><td>149<td><code><pre> metrics.Labels(labels),</pre></code><tr><td>150<td><code><pre> metrics.PrometheusBuckets(metricsLatencyBuckets),</pre></code><tr><td>151<td><code><pre> )</pre></code><tr><td>152<td><code><pre> }</pre></code><tr><td>153<td><code><pre> }</pre></code><tr><td>154<td><code><pre> }</pre></code><tr><td>155<td><code><pre> })</pre></code><tr><td>156<td><code><pre>}</pre></code></table><div class=funcname id=fn_Scan>func Scan</div><div class=info><a href=#s_fn_Scan>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>91<td><code><pre>func Scan[T any, TS ~[]*T](ctx context.Context, cb func(TS) bool, opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>92<td><code><pre> var (</pre></code><tr><td>93<td><code><pre> tx *gorm.DB</pre></code><tr><td>94<td><code><pre> mList TS</pre></code><tr><td>95<td><code><pre> )</pre></code><tr><td>96<td><code><pre></pre></code><tr><td>97<td><code><pre> o := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>98<td><code><pre> opt := utils.ApplyOptions[scanOption](opts...)</pre></code><tr><td>99<td><code><pre> optG := utils.ApplyOptions[scanOptionGeneric[T, TS]](opts...)</pre></code><tr><td>100<td><code><pre></pre></code><tr><td>101<td><code><pre> // get db instance</pre></code><tr><td>102<td><code><pre> switch {</pre></code><tr><td>103<td><code><pre> case optG.dal != nil:</pre></code><tr><td>104<td><code><pre> tx = optG.dal.ReadDB(ctx)</pre></code><tr><td>105<td><code><pre> case opt.dbName != "":</pre></code><tr class=miss><td>106<td><code><pre> tx = Use(ctx, opt.dbName, AppName(o.appName)).GetProxy()</pre></code><tr><td>107<td><code><pre> default:</pre></code><tr class=miss><td>108<td><code><pre> panic(errors.New("unknown which table to scan"))</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre></pre></code><tr><td>111<td><code><pre> // default values</pre></code><tr><td>112<td><code><pre> if opt.cursors == nil {</pre></code><tr class=miss><td>113<td><code><pre> opt.cursors = []any{0}</pre></code><tr><td>114<td><code><pre> }</pre></code><tr><td>115<td><code><pre> if opt.cursorWhere == nil {</pre></code><tr class=miss><td>116<td><code><pre> opt.cursorWhere = "id > ?"</pre></code><tr><td>117<td><code><pre> }</pre></code><tr><td>118<td><code><pre> if len(opt.cursorColumns) == 0 {</pre></code><tr class=miss><td>119<td><code><pre> opt.cursorColumns = []string{"id"}</pre></code><tr><td>120<td><code><pre> }</pre></code><tr><td>121<td><code><pre> if opt.order == nil {</pre></code><tr class=miss><td>122<td><code><pre> opt.order = fmt.Sprintf("%s ASC", strings.Join(opt.cursorColumns, constant.Comma))</pre></code><tr><td>123<td><code><pre> }</pre></code><tr><td>124<td><code><pre> if opt.batch == 0 {</pre></code><tr class=miss><td>125<td><code><pre> opt.batch = 100</pre></code><tr><td>126<td><code><pre> }</pre></code><tr><td>127<td><code><pre> if opt.limit == 0 {</pre></code><tr><td>128<td><code><pre> opt.limit = math.MaxInt</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre></pre></code><tr><td>131<td><code><pre> count := 0</pre></code><tr><td>132<td><code><pre> tx = tx.WithContext(ctx)</pre></code><tr><td>133<td><code><pre> if opt.log != nil {</pre></code><tr class=miss><td>134<td><code><pre> opt.log.Info(ctx, "scan begin [where[%s][%+v] cursor[%s][%+v] order[%s] limit[%v] batch[%v]]",</pre></code><tr><td>135<td><code><pre> opt.where, opt.sqlAndArguments, opt.cursorWhere, opt.cursors, opt.order, opt.limit, opt.batch)</pre></code><tr><td>136<td><code><pre></pre></code><tr class=miss><td>137<td><code><pre> defer func() { opt.log.Info(ctx, "scan end [count[%v]]", count) }()</pre></code><tr><td>138<td><code><pre> }</pre></code><tr><td>139<td><code><pre></pre></code><tr><td>140<td><code><pre> // scan</pre></code><tr><td>141<td><code><pre> for hasMore := true; hasMore; hasMore = len(mList) >= opt.batch {</pre></code><tr><td>142<td><code><pre> // init model slice</pre></code><tr><td>143<td><code><pre> mList = make(TS, 0, opt.batch)</pre></code><tr><td>144<td><code><pre></pre></code><tr><td>145<td><code><pre> // db query</pre></code><tr><td>146<td><code><pre> q := tx.Where(opt.cursorWhere, opt.cursors...)</pre></code><tr><td>147<td><code><pre> if opt.where != nil {</pre></code><tr class=miss><td>148<td><code><pre> q = q.Where(opt.where, opt.sqlAndArguments...)</pre></code><tr><td>149<td><code><pre> }</pre></code><tr><td>150<td><code><pre> if opt.order != nil {</pre></code><tr><td>151<td><code><pre> q = q.Order(opt.order)</pre></code><tr><td>152<td><code><pre> }</pre></code><tr><td>153<td><code><pre> if err = q.Limit(opt.batch).Find(&mList).Error; err != nil {</pre></code><tr class=miss><td>154<td><code><pre> if opt.log != nil {</pre></code><tr class=miss><td>155<td><code><pre> opt.log.Warn(ctx, "scan quit because meet with error [err[%s]]", err)</pre></code><tr><td>156<td><code><pre> }</pre></code><tr class=miss><td>157<td><code><pre> break</pre></code><tr><td>158<td><code><pre> }</pre></code><tr><td>159<td><code><pre></pre></code><tr><td>160<td><code><pre> if len(mList) > 0 {</pre></code><tr><td>161<td><code><pre> // callback</pre></code><tr><td>162<td><code><pre> if !cb(mList) {</pre></code><tr class=miss><td>163<td><code><pre> if opt.log != nil {</pre></code><tr class=miss><td>164<td><code><pre> opt.log.Info(ctx, "scan quit because callback return false")</pre></code><tr><td>165<td><code><pre> }</pre></code><tr class=miss><td>166<td><code><pre> break</pre></code><tr><td>167<td><code><pre> }</pre></code><tr><td>168<td><code><pre></pre></code><tr><td>169<td><code><pre> // get next cursor</pre></code><tr><td>170<td><code><pre> next := mList[len(mList)-1]</pre></code><tr><td>171<td><code><pre> nextVal := reflect.Indirect(reflect.ValueOf(next))</pre></code><tr><td>172<td><code><pre> for idx, col := range opt.cursorColumns {</pre></code><tr><td>173<td><code><pre> fieldVal := nextVal.FieldByNameFunc(func(s string) bool { return strings.EqualFold(s, col) })</pre></code><tr><td>174<td><code><pre> if !fieldVal.IsValid() {</pre></code><tr class=miss><td>175<td><code><pre> fieldVal, _ = utils.GetGormColumnValue(next, col)</pre></code><tr><td>176<td><code><pre> }</pre></code><tr><td>177<td><code><pre> if !fieldVal.IsValid() {</pre></code><tr class=miss><td>178<td><code><pre> err = errors.Errorf("scan cursor column value is not found [col[%s]]", col)</pre></code><tr class=miss><td>179<td><code><pre> if opt.log != nil {</pre></code><tr class=miss><td>180<td><code><pre> opt.log.Error(ctx, "%s", err)</pre></code><tr><td>181<td><code><pre> }</pre></code><tr class=miss><td>182<td><code><pre> return</pre></code><tr><td>183<td><code><pre> }</pre></code><tr><td>184<td><code><pre> opt.cursors[idx] = fieldVal.Interface()</pre></code><tr><td>185<td><code><pre> }</pre></code><tr><td>186<td><code><pre> }</pre></code><tr><td>187<td><code><pre></pre></code><tr><td>188<td><code><pre> // check if exceed max</pre></code><tr><td>189<td><code><pre> if count += len(mList); count >= opt.limit {</pre></code><tr class=miss><td>190<td><code><pre> if opt.log != nil {</pre></code><tr class=miss><td>191<td><code><pre> opt.log.Info(ctx, "scan quit because reach max [count[%v] max[%v]]", count, opt.limit)</pre></code><tr><td>192<td><code><pre> }</pre></code><tr class=miss><td>193<td><code><pre> break</pre></code><tr><td>194<td><code><pre> }</pre></code><tr><td>195<td><code><pre> }</pre></code><tr><td>196<td><code><pre></pre></code><tr><td>197<td><code><pre> return</pre></code><tr><td>198<td><code><pre>}</pre></code></table><div class=funcname id=fn_BusinessSoftDeleted.BeforeCreate>func BusinessSoftDeleted.BeforeCreate</div><div class=info><a href=#s_fn_BusinessSoftDeleted.BeforeCreate>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>158<td><code><pre>func (b *BusinessSoftDeleted) BeforeCreate(tx *gorm.DB) (err error) {</pre></code><tr><td>159<td><code><pre> if b == nil {</pre></code><tr class=miss><td>160<td><code><pre> tx.Statement.SetColumn("uuid", utils.UUID())</pre></code><tr class=miss><td>161<td><code><pre> tx.Statement.SetColumn("delete_time", nil)</pre></code><tr class=miss><td>162<td><code><pre> return</pre></code><tr><td>163<td><code><pre> }</pre></code><tr><td>164<td><code><pre> if b.UUID == [16]byte{0} {</pre></code><tr><td>165<td><code><pre> b.UUID = uuid.New()</pre></code><tr><td>166<td><code><pre> }</pre></code><tr><td>167<td><code><pre> return</pre></code><tr><td>168<td><code><pre>}</pre></code></table><div class=funcname id=fn_.convertAnyToTS>func .convertAnyToTS</div><div class=info><a href=#s_fn_.convertAnyToTS>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>424<td><code><pre>func (d *dal[T, TS]) convertAnyToTS(query any) (mList TS, ok bool) {</pre></code><tr><td>425<td><code><pre> switch q := query.(type) {</pre></code><tr><td>426<td><code><pre> case TS:</pre></code><tr><td>427<td><code><pre> ok = true</pre></code><tr><td>428<td><code><pre> mList = q</pre></code><tr><td>429<td><code><pre> case []*T:</pre></code><tr class=miss><td>430<td><code><pre> ok = true</pre></code><tr class=miss><td>431<td><code><pre> mList = TS(q)</pre></code><tr><td>432<td><code><pre> case []T:</pre></code><tr class=miss><td>433<td><code><pre> ok = true</pre></code><tr class=miss><td>434<td><code><pre> mList = TS(utils.SliceMapping(q, func(t T) *T { return &t }))</pre></code><tr><td>435<td><code><pre> case T:</pre></code><tr class=miss><td>436<td><code><pre> ok = true</pre></code><tr class=miss><td>437<td><code><pre> mList = TS{&q}</pre></code><tr><td>438<td><code><pre> case *T:</pre></code><tr><td>439<td><code><pre> ok = true</pre></code><tr><td>440<td><code><pre> mList = TS{q}</pre></code><tr><td>441<td><code><pre> }</pre></code><tr><td>442<td><code><pre> return</pre></code><tr><td>443<td><code><pre>}</pre></code></table><div class=funcname id=fn_@206:9>func @206:9</div><div class=info><a href=#s_fn_@206:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>206<td><code><pre>func() (err error) {</pre></code><tr class=miss><td>207<td><code><pre> if tx.Error != nil {</pre></code><tr class=miss><td>208<td><code><pre> return</pre></code><tr><td>209<td><code><pre> }</pre></code><tr><td>210<td><code><pre></pre></code><tr class=miss><td>211<td><code><pre> var bs []byte</pre></code><tr class=miss><td>212<td><code><pre> switch v := field.(type) {</pre></code><tr><td>213<td><code><pre> case string:</pre></code><tr class=miss><td>214<td><code><pre> bs = []byte(v)</pre></code><tr><td>215<td><code><pre> case *string:</pre></code><tr class=miss><td>216<td><code><pre> if v == nil {</pre></code><tr class=miss><td>217<td><code><pre> return</pre></code><tr><td>218<td><code><pre> }</pre></code><tr class=miss><td>219<td><code><pre> bs = []byte(*v)</pre></code><tr><td>220<td><code><pre> case []byte:</pre></code><tr class=miss><td>221<td><code><pre> bs = v</pre></code><tr><td>222<td><code><pre> case *[]byte:</pre></code><tr class=miss><td>223<td><code><pre> if v == nil {</pre></code><tr class=miss><td>224<td><code><pre> return</pre></code><tr><td>225<td><code><pre> }</pre></code><tr class=miss><td>226<td><code><pre> bs = *v</pre></code><tr><td>227<td><code><pre> default:</pre></code><tr class=miss><td>228<td><code><pre> return tx.AddError(errors.New("unsupported unmarshal field type"))</pre></code><tr><td>229<td><code><pre> }</pre></code><tr><td>230<td><code><pre> // be compatible with empty value</pre></code><tr class=miss><td>231<td><code><pre> if len(bs) == 0 {</pre></code><tr class=miss><td>232<td><code><pre> bs = []byte("null")</pre></code><tr><td>233<td><code><pre> }</pre></code><tr><td>234<td><code><pre></pre></code><tr class=miss><td>235<td><code><pre> return tx.AddError(json.Unmarshal(bs, &obj))</pre></code><tr><td>236<td><code><pre> }</pre></code></table><div class=funcname id=fn_.ShardingByModelList>func .ShardingByModelList</div><div class=info><a href=#s_fn_.ShardingByModelList>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>361<td><code><pre>func (d *dal[T, TS]) ShardingByModelList(ctx context.Context, src TS) (dst map[string]TS, err error) {</pre></code><tr class=miss><td>362<td><code><pre> if len(src) == 0 {</pre></code><tr class=miss><td>363<td><code><pre> return make(map[string]TS), nil</pre></code><tr><td>364<td><code><pre> }</pre></code><tr class=miss><td>365<td><code><pre> writeDB := d.writeDB(ctx)</pre></code><tr class=miss><td>366<td><code><pre> tableName := d.tableName(writeDB, src[0])</pre></code><tr class=miss><td>367<td><code><pre> shardingPlugin, ok := writeDB.tableShardingPlugins[tableName]</pre></code><tr class=miss><td>368<td><code><pre> if !ok {</pre></code><tr class=miss><td>369<td><code><pre> return map[string]TS{tableName: src}, nil</pre></code><tr><td>370<td><code><pre> }</pre></code><tr class=miss><td>371<td><code><pre> sharded, err := shardingPlugin.ShardingByModelList(ctx, utils.SliceMapping(src, func(t *T) any { return t })...)</pre></code><tr class=miss><td>372<td><code><pre> if err != nil {</pre></code><tr class=miss><td>373<td><code><pre> return</pre></code><tr><td>374<td><code><pre> }</pre></code><tr class=miss><td>375<td><code><pre> dst = make(map[string]TS, len(sharded))</pre></code><tr class=miss><td>376<td><code><pre> for suffix, item := range sharded {</pre></code><tr class=miss><td>377<td><code><pre> shardingTableName := tableName + suffix</pre></code><tr class=miss><td>378<td><code><pre> dst[shardingTableName] = TS(utils.SliceMapping(item, func(t any) *T { return t.(*T) }))</pre></code><tr><td>379<td><code><pre> }</pre></code><tr class=miss><td>380<td><code><pre> return</pre></code><tr><td>381<td><code><pre>}</pre></code></table><div class=funcname id=fn_@239:9>func @239:9</div><div class=info><a href=#s_fn_@239:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>239<td><code><pre>func() (err error) {</pre></code><tr class=miss><td>240<td><code><pre> if tx.Error != nil {</pre></code><tr class=miss><td>241<td><code><pre> return</pre></code><tr><td>242<td><code><pre> }</pre></code><tr><td>243<td><code><pre></pre></code><tr class=miss><td>244<td><code><pre> switch v := field.(type) {</pre></code><tr><td>245<td><code><pre> case **string, **[]byte, *string, *[]byte:</pre></code><tr class=miss><td>246<td><code><pre> if v == nil {</pre></code><tr class=miss><td>247<td><code><pre> return</pre></code><tr><td>248<td><code><pre> }</pre></code><tr class=miss><td>249<td><code><pre> bs, err := json.Marshal(obj)</pre></code><tr class=miss><td>250<td><code><pre> if err != nil {</pre></code><tr class=miss><td>251<td><code><pre> return tx.AddError(errors.Wrap(err, "gorm json marshal error"))</pre></code><tr><td>252<td><code><pre> }</pre></code><tr class=miss><td>253<td><code><pre> switch f := field.(type) {</pre></code><tr><td>254<td><code><pre> case *string:</pre></code><tr class=miss><td>255<td><code><pre> *f = string(bs)</pre></code><tr><td>256<td><code><pre> case **string:</pre></code><tr class=miss><td>257<td><code><pre> *f = utils.AnyPtr(string(bs))</pre></code><tr><td>258<td><code><pre> case *[]byte:</pre></code><tr class=miss><td>259<td><code><pre> *f = bs</pre></code><tr><td>260<td><code><pre> case **[]byte:</pre></code><tr class=miss><td>261<td><code><pre> *f = utils.AnyPtr(bs)</pre></code><tr><td>262<td><code><pre> }</pre></code><tr><td>263<td><code><pre> default:</pre></code><tr class=miss><td>264<td><code><pre> return tx.AddError(errors.New("unsupported marshal field type"))</pre></code><tr><td>265<td><code><pre> }</pre></code><tr class=miss><td>266<td><code><pre> return</pre></code><tr><td>267<td><code><pre> }</pre></code></table><div class=funcname id=fn_.ShardingIDListGen>func .ShardingIDListGen</div><div class=info><a href=#s_fn_.ShardingIDListGen>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>344<td><code><pre>func (d *dal[T, TS]) ShardingIDListGen(ctx context.Context, amount int) (idList []uint64, err error) {</pre></code><tr class=miss><td>345<td><code><pre> writeDB := d.writeDB(ctx)</pre></code><tr class=miss><td>346<td><code><pre> tableName := d.tableName(writeDB, new(T))</pre></code><tr class=miss><td>347<td><code><pre> tableShardingPlugin, ok := writeDB.tableShardingPlugins[tableName]</pre></code><tr class=miss><td>348<td><code><pre> if !ok {</pre></code><tr class=miss><td>349<td><code><pre> return nil, plugins.ErrIDGeneratorNotFound</pre></code><tr><td>350<td><code><pre> }</pre></code><tr class=miss><td>351<td><code><pre> idList = make([]uint64, 0, amount)</pre></code><tr class=miss><td>352<td><code><pre> for i := 0; i < amount; i++ {</pre></code><tr class=miss><td>353<td><code><pre> id, err := tableShardingPlugin.ShardingIDGen(ctx)</pre></code><tr class=miss><td>354<td><code><pre> if err != nil {</pre></code><tr class=miss><td>355<td><code><pre> return nil, err</pre></code><tr><td>356<td><code><pre> }</pre></code><tr class=miss><td>357<td><code><pre> idList = append(idList, id)</pre></code><tr><td>358<td><code><pre> }</pre></code><tr class=miss><td>359<td><code><pre> return</pre></code><tr><td>360<td><code><pre>}</pre></code></table><div class=funcname id=fn_.QueryInBatches>func .QueryInBatches</div><div class=info><a href=#s_fn_.QueryInBatches>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>108<td><code><pre>func (d *dal[T, TS]) QueryInBatches(ctx context.Context, batchSize int,</pre></code><tr><td>109<td><code><pre> fc func(tx *DB, batch int, found TS) error, query any, args ...any) (err error) {</pre></code><tr class=miss><td>110<td><code><pre> o, args := d.parseOptionFromArgs(args...)</pre></code><tr class=miss><td>111<td><code><pre> ctx = context.WithValue(ctx, fusCtx.KeyDALOption, o)</pre></code><tr><td>112<td><code><pre></pre></code><tr class=miss><td>113<td><code><pre> orm := Use(ctx, d.readDBName, AppName(d.appName))</pre></code><tr class=miss><td>114<td><code><pre> found := make(TS, 0, batchSize)</pre></code><tr class=miss><td>115<td><code><pre> result := d.ReadDB(ctx).Clauses(o.clauses...).Where(query, args...).FindInBatches(&found, batchSize,</pre></code><tr><td>116<td><code><pre> func(tx *gorm.DB, batch int) error {</pre></code><tr><td>117<td><code><pre> wrapper := &DB{</pre></code><tr><td>118<td><code><pre> DB: &ormDrv.DB{DB: tx},</pre></code><tr><td>119<td><code><pre> Name: orm.Name,</pre></code><tr><td>120<td><code><pre> tableShardingPlugins: orm.tableShardingPlugins,</pre></code><tr><td>121<td><code><pre> }</pre></code><tr><td>122<td><code><pre> return fc(wrapper, batch, found)</pre></code><tr><td>123<td><code><pre> },</pre></code><tr><td>124<td><code><pre> )</pre></code><tr class=miss><td>125<td><code><pre> if d.CanIgnore(result.Error) {</pre></code><tr class=miss><td>126<td><code><pre> return</pre></code><tr><td>127<td><code><pre> }</pre></code><tr class=miss><td>128<td><code><pre> return d.IgnoreErr(result.Error)</pre></code><tr><td>129<td><code><pre>}</pre></code></table><div class=funcname id=fn_.Transaction>func .Transaction</div><div class=info><a href=#s_fn_.Transaction>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>261<td><code><pre>func (d *dal[T, TS]) Transaction(ctx context.Context, fc func(context.Context) error,</pre></code><tr><td>262<td><code><pre> opts ...utils.OptionExtender) error {</pre></code><tr class=miss><td>263<td><code><pre> orm := GetCtxGormDBByNameList(ctx, []string{d.writeDBName, d.readDBName})</pre></code><tr class=miss><td>264<td><code><pre> o := utils.ApplyOptions[mysqlDALOption](opts...)</pre></code><tr class=miss><td>265<td><code><pre> if orm == nil {</pre></code><tr class=miss><td>266<td><code><pre> if o.useWriteDB {</pre></code><tr class=miss><td>267<td><code><pre> orm = Use(ctx, d.writeDBName, AppName(d.appName))</pre></code><tr><td>268<td><code><pre> } else {</pre></code><tr class=miss><td>269<td><code><pre> orm = Use(ctx, d.readDBName, AppName(d.appName))</pre></code><tr><td>270<td><code><pre> }</pre></code><tr><td>271<td><code><pre> }</pre></code><tr><td>272<td><code><pre></pre></code><tr class=miss><td>273<td><code><pre> return d.unscopedGormDB(orm.GetProxy().WithContext(ctx), o).Transaction(func(tx *gorm.DB) error {</pre></code><tr><td>274<td><code><pre> return fc(SetCtxGormDB(ctx, &DB{</pre></code><tr><td>275<td><code><pre> DB: &ormDrv.DB{DB: tx},</pre></code><tr><td>276<td><code><pre> Name: orm.Name,</pre></code><tr><td>277<td><code><pre> tableShardingPlugins: orm.tableShardingPlugins,</pre></code><tr><td>278<td><code><pre> }))</pre></code><tr><td>279<td><code><pre> })</pre></code><tr><td>280<td><code><pre>}</pre></code></table><div class=funcname id=fn_.Count>func .Count</div><div class=info><a href=#s_fn_.Count>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>131<td><code><pre>func (d *dal[T, TS]) Count(ctx context.Context, query any, args ...any) (int64, error) {</pre></code><tr class=miss><td>132<td><code><pre> var count int64</pre></code><tr><td>133<td><code><pre></pre></code><tr class=miss><td>134<td><code><pre> o, args := d.parseOptionFromArgs(args...)</pre></code><tr class=miss><td>135<td><code><pre> ctx = context.WithValue(ctx, fusCtx.KeyDALOption, o)</pre></code><tr><td>136<td><code><pre></pre></code><tr class=miss><td>137<td><code><pre> result := d.ReadDB(ctx).Clauses(o.clauses...).Where(query, args...).Count(&count)</pre></code><tr class=miss><td>138<td><code><pre> if d.CanIgnore(result.Error) {</pre></code><tr class=miss><td>139<td><code><pre> return 0, nil</pre></code><tr><td>140<td><code><pre> }</pre></code><tr class=miss><td>141<td><code><pre> return count, d.IgnoreErr(result.Error)</pre></code><tr><td>142<td><code><pre>}</pre></code></table><div class=funcname id=fn_.Query>func .Query</div><div class=info><a href=#s_fn_.Query>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>72<td><code><pre>func (d *dal[T, TS]) Query(ctx context.Context, query any, args ...any) (TS, error) {</pre></code><tr class=miss><td>73<td><code><pre> o, args := d.parseOptionFromArgs(args...)</pre></code><tr class=miss><td>74<td><code><pre> ctx = context.WithValue(ctx, fusCtx.KeyDALOption, o)</pre></code><tr><td>75<td><code><pre></pre></code><tr class=miss><td>76<td><code><pre> found := d.ModelSlice()</pre></code><tr class=miss><td>77<td><code><pre> result := d.ReadDB(ctx).Clauses(o.clauses...).Where(query, args...).Find(&found)</pre></code><tr class=miss><td>78<td><code><pre> if d.CanIgnore(result.Error) {</pre></code><tr class=miss><td>79<td><code><pre> return nil, nil</pre></code><tr><td>80<td><code><pre> }</pre></code><tr class=miss><td>81<td><code><pre> return found, d.IgnoreErr(result.Error)</pre></code><tr><td>82<td><code><pre>}</pre></code></table><div class=funcname id=fn_.QueryLast>func .QueryLast</div><div class=info><a href=#s_fn_.QueryLast>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>84<td><code><pre>func (d *dal[T, TS]) QueryLast(ctx context.Context, query any, args ...any) (*T, error) {</pre></code><tr class=miss><td>85<td><code><pre> o, args := d.parseOptionFromArgs(args...)</pre></code><tr class=miss><td>86<td><code><pre> ctx = context.WithValue(ctx, fusCtx.KeyDALOption, o)</pre></code><tr><td>87<td><code><pre></pre></code><tr class=miss><td>88<td><code><pre> found := d.Model()</pre></code><tr class=miss><td>89<td><code><pre> result := d.ReadDB(ctx).Clauses(o.clauses...).Where(query, args...).Last(found)</pre></code><tr class=miss><td>90<td><code><pre> if d.CanIgnore(result.Error) {</pre></code><tr class=miss><td>91<td><code><pre> return nil, nil</pre></code><tr><td>92<td><code><pre> }</pre></code><tr class=miss><td>93<td><code><pre> return found, d.IgnoreErr(result.Error)</pre></code><tr><td>94<td><code><pre>}</pre></code></table><div class=funcname id=fn_.ShardingByValues>func .ShardingByValues</div><div class=info><a href=#s_fn_.ShardingByValues>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>325<td><code><pre>func (d *dal[T, TS]) ShardingByValues(ctx context.Context, src []map[string]any) (</pre></code><tr><td>326<td><code><pre> dst map[string][]map[string]any, err error) {</pre></code><tr class=miss><td>327<td><code><pre> writeDB := d.writeDB(ctx)</pre></code><tr class=miss><td>328<td><code><pre> tableName := d.tableName(writeDB, new(T))</pre></code><tr class=miss><td>329<td><code><pre> tableShardingPlugin, ok := writeDB.tableShardingPlugins[tableName]</pre></code><tr class=miss><td>330<td><code><pre> if !ok {</pre></code><tr class=miss><td>331<td><code><pre> return map[string][]map[string]any{tableName: src}, nil</pre></code><tr><td>332<td><code><pre> }</pre></code><tr class=miss><td>333<td><code><pre> return tableShardingPlugin.ShardingByValues(ctx, src)</pre></code><tr><td>334<td><code><pre>}</pre></code></table><div class=funcname id=fn_Data.Equals>func Data.Equals</div><div class=info><a href=#s_fn_Data.Equals>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>37<td><code><pre>func (d *Data) Equals(o *Data) bool {</pre></code><tr class=miss><td>38<td><code><pre> if d == nil && o == nil {</pre></code><tr class=miss><td>39<td><code><pre> return true</pre></code><tr><td>40<td><code><pre> }</pre></code><tr class=miss><td>41<td><code><pre> if d == nil || o == nil {</pre></code><tr class=miss><td>42<td><code><pre> return false</pre></code><tr><td>43<td><code><pre> }</pre></code><tr class=miss><td>44<td><code><pre> return d.ID == o.ID &&</pre></code><tr><td>45<td><code><pre> d.CreateTimeMs == o.CreateTimeMs &&</pre></code><tr><td>46<td><code><pre> d.ModifyTimeMs == o.ModifyTimeMs</pre></code><tr><td>47<td><code><pre>}</pre></code></table><div class=funcname id=fn_Business.Equals>func Business.Equals</div><div class=info><a href=#s_fn_Business.Equals>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>137<td><code><pre>func (b *Business) Equals(o *Business) bool {</pre></code><tr class=miss><td>138<td><code><pre> if b == nil && o == nil {</pre></code><tr class=miss><td>139<td><code><pre> return true</pre></code><tr><td>140<td><code><pre> }</pre></code><tr class=miss><td>141<td><code><pre> if b == nil || o == nil {</pre></code><tr class=miss><td>142<td><code><pre> return false</pre></code><tr><td>143<td><code><pre> }</pre></code><tr class=miss><td>144<td><code><pre> return b.Data.Equals(&o.Data) &&</pre></code><tr><td>145<td><code><pre> b.UUID == o.UUID &&</pre></code><tr><td>146<td><code><pre> b.BizCreateTimeMs == o.BizCreateTimeMs &&</pre></code><tr><td>147<td><code><pre> b.BizModifyTimeMs == o.BizModifyTimeMs</pre></code><tr><td>148<td><code><pre>}</pre></code></table><div class=funcname id=fn_BusinessSoftDeleted.Equals>func BusinessSoftDeleted.Equals</div><div class=info><a href=#s_fn_BusinessSoftDeleted.Equals>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>191<td><code><pre>func (b *BusinessSoftDeleted) Equals(o *BusinessSoftDeleted) bool {</pre></code><tr class=miss><td>192<td><code><pre> if b == nil && o == nil {</pre></code><tr class=miss><td>193<td><code><pre> return true</pre></code><tr><td>194<td><code><pre> }</pre></code><tr class=miss><td>195<td><code><pre> if b == nil || o == nil {</pre></code><tr class=miss><td>196<td><code><pre> return false</pre></code><tr><td>197<td><code><pre> }</pre></code><tr class=miss><td>198<td><code><pre> return b.DataSoftDeleted.Equals(&o.DataSoftDeleted) &&</pre></code><tr><td>199<td><code><pre> b.UUID == o.UUID &&</pre></code><tr><td>200<td><code><pre> b.BizCreateTimeMs == o.BizCreateTimeMs &&</pre></code><tr><td>201<td><code><pre> b.BizModifyTimeMs == o.BizModifyTimeMs</pre></code><tr><td>202<td><code><pre>}</pre></code></table><div class=funcname id=fn_DataSoftDeleted.Equals>func DataSoftDeleted.Equals</div><div class=info><a href=#s_fn_DataSoftDeleted.Equals>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>83<td><code><pre>func (d *DataSoftDeleted) Equals(o *DataSoftDeleted) bool {</pre></code><tr class=miss><td>84<td><code><pre> if d == nil && o == nil {</pre></code><tr class=miss><td>85<td><code><pre> return true</pre></code><tr><td>86<td><code><pre> }</pre></code><tr class=miss><td>87<td><code><pre> if d == nil || o == nil {</pre></code><tr class=miss><td>88<td><code><pre> return false</pre></code><tr><td>89<td><code><pre> }</pre></code><tr class=miss><td>90<td><code><pre> return d.ID == o.ID &&</pre></code><tr><td>91<td><code><pre> d.CreateTimeMs == o.CreateTimeMs &&</pre></code><tr><td>92<td><code><pre> d.ModifyTimeMs == o.ModifyTimeMs &&</pre></code><tr><td>93<td><code><pre> d.DeleteTimeMs == o.DeleteTimeMs &&</pre></code><tr><td>94<td><code><pre> d.Deleted == o.Deleted</pre></code><tr><td>95<td><code><pre>}</pre></code></table><div class=funcname id=fn_.Pluck>func .Pluck</div><div class=info><a href=#s_fn_.Pluck>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>144<td><code><pre>func (d *dal[T, TS]) Pluck(ctx context.Context, column string, dest any,</pre></code><tr><td>145<td><code><pre> query any, args ...any) error {</pre></code><tr class=miss><td>146<td><code><pre> o, args := d.parseOptionFromArgs(args...)</pre></code><tr class=miss><td>147<td><code><pre> ctx = context.WithValue(ctx, fusCtx.KeyDALOption, o)</pre></code><tr><td>148<td><code><pre></pre></code><tr class=miss><td>149<td><code><pre> result := d.ReadDB(ctx).Clauses(o.clauses...).Where(query, args...).Pluck(column, dest)</pre></code><tr class=miss><td>150<td><code><pre> return d.IgnoreErr(result.Error)</pre></code><tr><td>151<td><code><pre>}</pre></code></table><div class=funcname id=fn_.Update>func .Update</div><div class=info><a href=#s_fn_.Update>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>221<td><code><pre>func (d *dal[T, TS]) Update(ctx context.Context, column string, value any,</pre></code><tr><td>222<td><code><pre> query any, args ...any) (int64, error) {</pre></code><tr class=miss><td>223<td><code><pre> o, args := d.parseOptionFromArgs(args...)</pre></code><tr class=miss><td>224<td><code><pre> ctx = context.WithValue(ctx, fusCtx.KeyDALOption, o)</pre></code><tr class=miss><td>225<td><code><pre> u := d.WriteDB(ctx).Clauses(o.clauses...).Where(query, args...).Update(column, value)</pre></code><tr class=miss><td>226<td><code><pre> return u.RowsAffected, u.Error</pre></code><tr><td>227<td><code><pre>}</pre></code></table><div class=funcname id=fn_.Take>func .Take</div><div class=info><a href=#s_fn_.Take>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>153<td><code><pre>func (d *dal[T, TS]) Take(ctx context.Context, dest any, conds ...any) error {</pre></code><tr class=miss><td>154<td><code><pre> o, args := d.parseOptionFromArgs(conds...)</pre></code><tr class=miss><td>155<td><code><pre> ctx = context.WithValue(ctx, fusCtx.KeyDALOption, o)</pre></code><tr><td>156<td><code><pre></pre></code><tr class=miss><td>157<td><code><pre> result := d.ReadDB(ctx).Clauses(o.clauses...).Take(dest, args...)</pre></code><tr class=miss><td>158<td><code><pre> return d.IgnoreErr(result.Error)</pre></code><tr><td>159<td><code><pre>}</pre></code></table><div class=funcname id=fn_.FirstOrCreate>func .FirstOrCreate</div><div class=info><a href=#s_fn_.FirstOrCreate>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>184<td><code><pre>func (d *dal[T, TS]) FirstOrCreate(ctx context.Context, mod *T, conds ...any) (int64, error) {</pre></code><tr class=miss><td>185<td><code><pre> o, conds := d.parseOptionFromArgs(conds...)</pre></code><tr class=miss><td>186<td><code><pre> ctx = context.WithValue(ctx, fusCtx.KeyDALOption, o)</pre></code><tr class=miss><td>187<td><code><pre> result := d.WriteDB(ctx).Clauses(o.clauses...).FirstOrCreate(mod, conds...)</pre></code><tr class=miss><td>188<td><code><pre> return result.RowsAffected, result.Error</pre></code><tr><td>189<td><code><pre>}</pre></code></table><div class=funcname id=fn_.Updates>func .Updates</div><div class=info><a href=#s_fn_.Updates>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>229<td><code><pre>func (d *dal[T, TS]) Updates(ctx context.Context, columns map[string]any,</pre></code><tr><td>230<td><code><pre> query any, args ...any) (int64, error) {</pre></code><tr class=miss><td>231<td><code><pre> o, args := d.parseOptionFromArgs(args...)</pre></code><tr class=miss><td>232<td><code><pre> ctx = context.WithValue(ctx, fusCtx.KeyDALOption, o)</pre></code><tr class=miss><td>233<td><code><pre> u := d.WriteDB(ctx).Clauses(o.clauses...).Where(query, args...).Updates(columns)</pre></code><tr class=miss><td>234<td><code><pre> return u.RowsAffected, u.Error</pre></code><tr><td>235<td><code><pre>}</pre></code></table><div class=funcname id=fn_GetCtxGormDBByNameList>func GetCtxGormDBByNameList</div><div class=info><a href=#s_fn_GetCtxGormDBByNameList>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/ctx.go</code>:</div><table class=listing><tr><td>23<td><code><pre>func GetCtxGormDBByNameList(ctx context.Context, nameList []string) (db *DB) {</pre></code><tr class=miss><td>24<td><code><pre> names := utils.NewSet(nameList...)</pre></code><tr class=miss><td>25<td><code><pre> utils.TravelCtx(ctx, func(ctx context.Context) bool {</pre></code><tr><td>26<td><code><pre> db = utils.GetCtxAny(ctx, fusCtx.KeyGormDB, (*DB)(nil))</pre></code><tr><td>27<td><code><pre> return db != nil && names.Contains(db.Name)</pre></code><tr><td>28<td><code><pre> })</pre></code><tr class=miss><td>29<td><code><pre> return</pre></code><tr><td>30<td><code><pre>}</pre></code></table><div class=funcname id=fn_DataSoftDeleted.Clone>func DataSoftDeleted.Clone</div><div class=info><a href=#s_fn_DataSoftDeleted.Clone>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>71<td><code><pre>func (d *DataSoftDeleted) Clone() *DataSoftDeleted {</pre></code><tr class=miss><td>72<td><code><pre> if d == nil {</pre></code><tr class=miss><td>73<td><code><pre> return nil</pre></code><tr><td>74<td><code><pre> }</pre></code><tr class=miss><td>75<td><code><pre> return &DataSoftDeleted{</pre></code><tr><td>76<td><code><pre> ID: d.ID,</pre></code><tr><td>77<td><code><pre> Deleted: d.Deleted,</pre></code><tr><td>78<td><code><pre> CreateTimeMs: d.CreateTimeMs,</pre></code><tr><td>79<td><code><pre> ModifyTimeMs: d.ModifyTimeMs,</pre></code><tr><td>80<td><code><pre> DeleteTimeMs: d.DeleteTimeMs,</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre>}</pre></code></table><div class=funcname id=fn_.SetCtxReadDB>func .SetCtxReadDB</div><div class=info><a href=#s_fn_.SetCtxReadDB>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>301<td><code><pre>func (d *dal[T, TS]) SetCtxReadDB(src context.Context) (dst context.Context) {</pre></code><tr class=miss><td>302<td><code><pre> if orm := GetCtxGormDBByName(src, d.readDBName); orm != nil {</pre></code><tr class=miss><td>303<td><code><pre> return src</pre></code><tr><td>304<td><code><pre> }</pre></code><tr><td>305<td><code><pre></pre></code><tr class=miss><td>306<td><code><pre> return SetCtxGormDB(src, Use(src, d.readDBName, AppName(d.appName)))</pre></code><tr><td>307<td><code><pre>}</pre></code></table><div class=funcname id=fn_.SetCtxWriteDB>func .SetCtxWriteDB</div><div class=info><a href=#s_fn_.SetCtxWriteDB>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>308<td><code><pre>func (d *dal[T, TS]) SetCtxWriteDB(src context.Context) (dst context.Context) {</pre></code><tr class=miss><td>309<td><code><pre> if orm := GetCtxGormDBByName(src, d.writeDBName); orm != nil {</pre></code><tr class=miss><td>310<td><code><pre> return src</pre></code><tr><td>311<td><code><pre> }</pre></code><tr class=miss><td>312<td><code><pre> return SetCtxGormDB(src, Use(src, d.writeDBName, AppName(d.appName)))</pre></code><tr><td>313<td><code><pre>}</pre></code></table><div class=funcname id=fn_Business.Clone>func Business.Clone</div><div class=info><a href=#s_fn_Business.Clone>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>126<td><code><pre>func (b *Business) Clone() *Business {</pre></code><tr class=miss><td>127<td><code><pre> if b == nil {</pre></code><tr class=miss><td>128<td><code><pre> return nil</pre></code><tr><td>129<td><code><pre> }</pre></code><tr class=miss><td>130<td><code><pre> return &Business{</pre></code><tr><td>131<td><code><pre> Data: *b.Data.Clone(),</pre></code><tr><td>132<td><code><pre> UUID: b.UUID,</pre></code><tr><td>133<td><code><pre> BizCreateTimeMs: b.BizCreateTimeMs,</pre></code><tr><td>134<td><code><pre> BizModifyTimeMs: b.BizModifyTimeMs,</pre></code><tr><td>135<td><code><pre> }</pre></code><tr><td>136<td><code><pre>}</pre></code></table><div class=funcname id=fn_@141:4>func @141:4</div><div class=info><a href=#s_fn_@141:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/construct.go</code>:</div><table class=listing><tr><td>141<td><code><pre>func() *gorm.DB {</pre></code><tr class=miss><td>142<td><code><pre> rwlock.RLock()</pre></code><tr class=miss><td>143<td><code><pre> defer rwlock.RUnlock()</pre></code><tr class=miss><td>144<td><code><pre> return appInstances[opt.AppName][name].GetProxy()</pre></code><tr><td>145<td><code><pre> }</pre></code></table><div class=funcname id=fn_BusinessSoftDeleted.Clone>func BusinessSoftDeleted.Clone</div><div class=info><a href=#s_fn_BusinessSoftDeleted.Clone>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>180<td><code><pre>func (b *BusinessSoftDeleted) Clone() *BusinessSoftDeleted {</pre></code><tr class=miss><td>181<td><code><pre> if b == nil {</pre></code><tr class=miss><td>182<td><code><pre> return nil</pre></code><tr><td>183<td><code><pre> }</pre></code><tr class=miss><td>184<td><code><pre> return &BusinessSoftDeleted{</pre></code><tr><td>185<td><code><pre> DataSoftDeleted: *b.DataSoftDeleted.Clone(),</pre></code><tr><td>186<td><code><pre> UUID: b.UUID,</pre></code><tr><td>187<td><code><pre> BizCreateTimeMs: b.BizCreateTimeMs,</pre></code><tr><td>188<td><code><pre> BizModifyTimeMs: b.BizModifyTimeMs,</pre></code><tr><td>189<td><code><pre> }</pre></code><tr><td>190<td><code><pre>}</pre></code></table><div class=funcname id=fn_DataSoftDeleted.DeleteTime>func DataSoftDeleted.DeleteTime</div><div class=info><a href=#s_fn_DataSoftDeleted.DeleteTime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>65<td><code><pre>func (d *DataSoftDeleted) DeleteTime() *time.Time {</pre></code><tr class=miss><td>66<td><code><pre> if !d.DeleteTimeMs.Valid {</pre></code><tr class=miss><td>67<td><code><pre> return nil</pre></code><tr><td>68<td><code><pre> }</pre></code><tr class=miss><td>69<td><code><pre> return utils.AnyPtr(utils.GetTime(d.DeleteTimeMs.Int64))</pre></code><tr><td>70<td><code><pre>}</pre></code></table><div class=funcname id=fn_Data.Clone>func Data.Clone</div><div class=info><a href=#s_fn_Data.Clone>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>27<td><code><pre>func (d *Data) Clone() *Data {</pre></code><tr class=miss><td>28<td><code><pre> if d == nil {</pre></code><tr class=miss><td>29<td><code><pre> return nil</pre></code><tr><td>30<td><code><pre> }</pre></code><tr class=miss><td>31<td><code><pre> return &Data{</pre></code><tr><td>32<td><code><pre> ID: d.ID,</pre></code><tr><td>33<td><code><pre> CreateTimeMs: d.CreateTimeMs,</pre></code><tr><td>34<td><code><pre> ModifyTimeMs: d.ModifyTimeMs,</pre></code><tr><td>35<td><code><pre> }</pre></code><tr><td>36<td><code><pre>}</pre></code></table><div class=funcname id=fn_@25:23>func @25:23</div><div class=info><a href=#s_fn_@25:23>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/ctx.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func(ctx context.Context) bool {</pre></code><tr class=miss><td>26<td><code><pre> db = utils.GetCtxAny(ctx, fusCtx.KeyGormDB, (*DB)(nil))</pre></code><tr class=miss><td>27<td><code><pre> return db != nil && names.Contains(db.Name)</pre></code><tr><td>28<td><code><pre> }</pre></code></table><div class=funcname id=fn_@116:3>func @116:3</div><div class=info><a href=#s_fn_@116:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>116<td><code><pre>func(tx *gorm.DB, batch int) error {</pre></code><tr class=miss><td>117<td><code><pre> wrapper := &DB{</pre></code><tr><td>118<td><code><pre> DB: &ormDrv.DB{DB: tx},</pre></code><tr><td>119<td><code><pre> Name: orm.Name,</pre></code><tr><td>120<td><code><pre> tableShardingPlugins: orm.tableShardingPlugins,</pre></code><tr><td>121<td><code><pre> }</pre></code><tr class=miss><td>122<td><code><pre> return fc(wrapper, batch, found)</pre></code><tr><td>123<td><code><pre> }</pre></code></table><div class=funcname id=fn_@53:9>func @53:9</div><div class=info><a href=#s_fn_@53:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>53<td><code><pre>func(o *scanOption) {</pre></code><tr class=miss><td>54<td><code><pre> o.where = where</pre></code><tr class=miss><td>55<td><code><pre> o.sqlAndArguments = sqlAndArguments</pre></code><tr><td>56<td><code><pre> }</pre></code></table><div class=funcname id=fn_@33:4>func @33:4</div><div class=info><a href=#s_fn_@33:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/tx.go</code>:</div><table class=listing><tr class=miss><td>33<td><code><pre>func() bool { db = Use(ctx, opt.dbName, AppName(o.appName)); return db != nil }</pre></code></table><div class=funcname id=fn_@371:82>func @371:82</div><div class=info><a href=#s_fn_@371:82>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr class=miss><td>371<td><code><pre>func(t *T) any { return t }</pre></code></table><div class=funcname id=fn_Data.ModifyTime>func Data.ModifyTime</div><div class=info><a href=#s_fn_Data.ModifyTime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>24<td><code><pre>func (d *Data) ModifyTime() time.Time {</pre></code><tr class=miss><td>25<td><code><pre> return utils.GetTime(d.ModifyTimeMs)</pre></code><tr><td>26<td><code><pre>}</pre></code></table><div class=funcname id=fn_Data.CreateTime>func Data.CreateTime</div><div class=info><a href=#s_fn_Data.CreateTime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>21<td><code><pre>func (d *Data) CreateTime() time.Time {</pre></code><tr class=miss><td>22<td><code><pre> return utils.GetTime(d.CreateTimeMs)</pre></code><tr><td>23<td><code><pre>}</pre></code></table><div class=funcname id=fn_DataSoftDeleted.CreateTime>func DataSoftDeleted.CreateTime</div><div class=info><a href=#s_fn_DataSoftDeleted.CreateTime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>59<td><code><pre>func (d *DataSoftDeleted) CreateTime() time.Time {</pre></code><tr class=miss><td>60<td><code><pre> return utils.GetTime(d.CreateTimeMs)</pre></code><tr><td>61<td><code><pre>}</pre></code></table><div class=funcname id=fn_DataSoftDeleted.ModifyTime>func DataSoftDeleted.ModifyTime</div><div class=info><a href=#s_fn_DataSoftDeleted.ModifyTime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>62<td><code><pre>func (d *DataSoftDeleted) ModifyTime() time.Time {</pre></code><tr class=miss><td>63<td><code><pre> return utils.GetTime(d.ModifyTimeMs)</pre></code><tr><td>64<td><code><pre>}</pre></code></table><div class=funcname id=fn_@470:9>func @470:9</div><div class=info><a href=#s_fn_@470:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>470<td><code><pre>func(m *mysqlDALOption) {</pre></code><tr class=miss><td>471<td><code><pre> m.useWriteDB = true</pre></code><tr><td>472<td><code><pre> }</pre></code></table><div class=funcname id=fn_WriteDB>func WriteDB</div><div class=info><a href=#s_fn_WriteDB>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>469<td><code><pre>func WriteDB() utils.OptionFunc[mysqlDALOption] {</pre></code><tr class=miss><td>470<td><code><pre> return func(m *mysqlDALOption) {</pre></code><tr><td>471<td><code><pre> m.useWriteDB = true</pre></code><tr><td>472<td><code><pre> }</pre></code><tr><td>473<td><code><pre>}</pre></code></table><div class=funcname id=fn_@464:9>func @464:9</div><div class=info><a href=#s_fn_@464:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>464<td><code><pre>func(m *mysqlDALOption) {</pre></code><tr class=miss><td>465<td><code><pre> m.clauses = append(m.clauses, clauses...)</pre></code><tr><td>466<td><code><pre> }</pre></code></table><div class=funcname id=fn_Clauses>func Clauses</div><div class=info><a href=#s_fn_Clauses>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>463<td><code><pre>func Clauses(clauses ...clause.Expression) utils.OptionFunc[mysqlDALOption] {</pre></code><tr class=miss><td>464<td><code><pre> return func(m *mysqlDALOption) {</pre></code><tr><td>465<td><code><pre> m.clauses = append(m.clauses, clauses...)</pre></code><tr><td>466<td><code><pre> }</pre></code><tr><td>467<td><code><pre>}</pre></code></table><div class=funcname id=fn_Business.BeforeCreateFn>func Business.BeforeCreateFn</div><div class=info><a href=#s_fn_Business.BeforeCreateFn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>115<td><code><pre>func (b *Business) BeforeCreateFn(tx *gorm.DB) func() error {</pre></code><tr class=miss><td>116<td><code><pre> return func() (err error) {</pre></code><tr><td>117<td><code><pre> return b.BeforeCreate(tx)</pre></code><tr><td>118<td><code><pre> }</pre></code><tr><td>119<td><code><pre>}</pre></code></table><div class=funcname id=fn_@116:9>func @116:9</div><div class=info><a href=#s_fn_@116:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>116<td><code><pre>func() (err error) {</pre></code><tr class=miss><td>117<td><code><pre> return b.BeforeCreate(tx)</pre></code><tr><td>118<td><code><pre> }</pre></code></table><div class=funcname id=fn_Business.BizCreateTime>func Business.BizCreateTime</div><div class=info><a href=#s_fn_Business.BizCreateTime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>120<td><code><pre>func (b *Business) BizCreateTime() time.Time {</pre></code><tr class=miss><td>121<td><code><pre> return utils.GetTime(b.BizCreateTimeMs)</pre></code><tr><td>122<td><code><pre>}</pre></code></table><div class=funcname id=fn_Business.BizModifyTime>func Business.BizModifyTime</div><div class=info><a href=#s_fn_Business.BizModifyTime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>123<td><code><pre>func (b *Business) BizModifyTime() time.Time {</pre></code><tr class=miss><td>124<td><code><pre> return utils.GetTime(b.BizModifyTimeMs)</pre></code><tr><td>125<td><code><pre>}</pre></code></table><div class=funcname id=fn_@434:36>func @434:36</div><div class=info><a href=#s_fn_@434:36>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr class=miss><td>434<td><code><pre>func(t T) *T { return &t }</pre></code></table><div class=funcname id=fn_@378:56>func @378:56</div><div class=info><a href=#s_fn_@378:56>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr class=miss><td>378<td><code><pre>func(t any) *T { return t.(*T) }</pre></code></table><div class=funcname id=fn_.ModelSlice>func .ModelSlice</div><div class=info><a href=#s_fn_.ModelSlice>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr class=miss><td>316<td><code><pre>func (d *dal[T, TS]) ModelSlice() TS { return make(TS, 0) }</pre></code></table><div class=funcname id=fn_BusinessSoftDeleted.BeforeCreateFn>func BusinessSoftDeleted.BeforeCreateFn</div><div class=info><a href=#s_fn_BusinessSoftDeleted.BeforeCreateFn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>169<td><code><pre>func (b *BusinessSoftDeleted) BeforeCreateFn(tx *gorm.DB) func() error {</pre></code><tr class=miss><td>170<td><code><pre> return func() (err error) {</pre></code><tr><td>171<td><code><pre> return b.BeforeCreate(tx)</pre></code><tr><td>172<td><code><pre> }</pre></code><tr><td>173<td><code><pre>}</pre></code></table><div class=funcname id=fn_@170:9>func @170:9</div><div class=info><a href=#s_fn_@170:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>170<td><code><pre>func() (err error) {</pre></code><tr class=miss><td>171<td><code><pre> return b.BeforeCreate(tx)</pre></code><tr><td>172<td><code><pre> }</pre></code></table><div class=funcname id=fn_@273:74>func @273:74</div><div class=info><a href=#s_fn_@273:74>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/dal.go</code>:</div><table class=listing><tr><td>273<td><code><pre>func(tx *gorm.DB) error {</pre></code><tr class=miss><td>274<td><code><pre> return fc(SetCtxGormDB(ctx, &DB{</pre></code><tr><td>275<td><code><pre> DB: &ormDrv.DB{DB: tx},</pre></code><tr><td>276<td><code><pre> Name: orm.Name,</pre></code><tr><td>277<td><code><pre> tableShardingPlugins: orm.tableShardingPlugins,</pre></code><tr><td>278<td><code><pre> }))</pre></code><tr><td>279<td><code><pre> }</pre></code></table><div class=funcname id=fn_BusinessSoftDeleted.BizModifyTime>func BusinessSoftDeleted.BizModifyTime</div><div class=info><a href=#s_fn_BusinessSoftDeleted.BizModifyTime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>177<td><code><pre>func (b *BusinessSoftDeleted) BizModifyTime() time.Time {</pre></code><tr class=miss><td>178<td><code><pre> return utils.GetTime(b.BizModifyTimeMs)</pre></code><tr><td>179<td><code><pre>}</pre></code></table><div class=funcname id=fn_@86:9>func @86:9</div><div class=info><a href=#s_fn_@86:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>86<td><code><pre>func(o *scanOption) {</pre></code><tr class=miss><td>87<td><code><pre> o.log = log</pre></code><tr><td>88<td><code><pre> }</pre></code></table><div class=funcname id=fn_GetCtxGormDB>func GetCtxGormDB</div><div class=info><a href=#s_fn_GetCtxGormDB>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/ctx.go</code>:</div><table class=listing><tr><td>11<td><code><pre>func GetCtxGormDB(ctx context.Context) *DB {</pre></code><tr class=miss><td>12<td><code><pre> return utils.GetCtxAny(ctx, fusCtx.KeyGormDB, (*DB)(nil))</pre></code><tr><td>13<td><code><pre>}</pre></code></table><div class=funcname id=fn_CheckGormErrorFn>func CheckGormErrorFn</div><div class=info><a href=#s_fn_CheckGormErrorFn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr class=miss><td>204<td><code><pre>func CheckGormErrorFn(tx *gorm.DB) func() error { return func() error { return tx.Error } }</pre></code></table><div class=funcname id=fn_@204:58>func @204:58</div><div class=info><a href=#s_fn_@204:58>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr class=miss><td>204<td><code><pre>func() error { return tx.Error }</pre></code></table><div class=funcname id=fn_JsonUnmarshalFn>func JsonUnmarshalFn</div><div class=info><a href=#s_fn_JsonUnmarshalFn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>205<td><code><pre>func JsonUnmarshalFn(tx *gorm.DB, obj, field any) func() error {</pre></code><tr class=miss><td>206<td><code><pre> return func() (err error) {</pre></code><tr><td>207<td><code><pre> if tx.Error != nil {</pre></code><tr><td>208<td><code><pre> return</pre></code><tr><td>209<td><code><pre> }</pre></code><tr><td>210<td><code><pre></pre></code><tr><td>211<td><code><pre> var bs []byte</pre></code><tr><td>212<td><code><pre> switch v := field.(type) {</pre></code><tr><td>213<td><code><pre> case string:</pre></code><tr><td>214<td><code><pre> bs = []byte(v)</pre></code><tr><td>215<td><code><pre> case *string:</pre></code><tr><td>216<td><code><pre> if v == nil {</pre></code><tr><td>217<td><code><pre> return</pre></code><tr><td>218<td><code><pre> }</pre></code><tr><td>219<td><code><pre> bs = []byte(*v)</pre></code><tr><td>220<td><code><pre> case []byte:</pre></code><tr><td>221<td><code><pre> bs = v</pre></code><tr><td>222<td><code><pre> case *[]byte:</pre></code><tr><td>223<td><code><pre> if v == nil {</pre></code><tr><td>224<td><code><pre> return</pre></code><tr><td>225<td><code><pre> }</pre></code><tr><td>226<td><code><pre> bs = *v</pre></code><tr><td>227<td><code><pre> default:</pre></code><tr><td>228<td><code><pre> return tx.AddError(errors.New("unsupported unmarshal field type"))</pre></code><tr><td>229<td><code><pre> }</pre></code><tr><td>230<td><code><pre> // be compatible with empty value</pre></code><tr><td>231<td><code><pre> if len(bs) == 0 {</pre></code><tr><td>232<td><code><pre> bs = []byte("null")</pre></code><tr><td>233<td><code><pre> }</pre></code><tr><td>234<td><code><pre></pre></code><tr><td>235<td><code><pre> return tx.AddError(json.Unmarshal(bs, &obj))</pre></code><tr><td>236<td><code><pre> }</pre></code><tr><td>237<td><code><pre>}</pre></code></table><div class=funcname id=fn_@137:9>func @137:9</div><div class=info><a href=#s_fn_@137:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr class=miss><td>137<td><code><pre>func() { opt.log.Info(ctx, "scan end [count[%v]]", count) }</pre></code></table><div class=funcname id=fn_JsonMarshalFn>func JsonMarshalFn</div><div class=info><a href=#s_fn_JsonMarshalFn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>238<td><code><pre>func JsonMarshalFn(tx *gorm.DB, obj, field any) func() error {</pre></code><tr class=miss><td>239<td><code><pre> return func() (err error) {</pre></code><tr><td>240<td><code><pre> if tx.Error != nil {</pre></code><tr><td>241<td><code><pre> return</pre></code><tr><td>242<td><code><pre> }</pre></code><tr><td>243<td><code><pre></pre></code><tr><td>244<td><code><pre> switch v := field.(type) {</pre></code><tr><td>245<td><code><pre> case **string, **[]byte, *string, *[]byte:</pre></code><tr><td>246<td><code><pre> if v == nil {</pre></code><tr><td>247<td><code><pre> return</pre></code><tr><td>248<td><code><pre> }</pre></code><tr><td>249<td><code><pre> bs, err := json.Marshal(obj)</pre></code><tr><td>250<td><code><pre> if err != nil {</pre></code><tr><td>251<td><code><pre> return tx.AddError(errors.Wrap(err, "gorm json marshal error"))</pre></code><tr><td>252<td><code><pre> }</pre></code><tr><td>253<td><code><pre> switch f := field.(type) {</pre></code><tr><td>254<td><code><pre> case *string:</pre></code><tr><td>255<td><code><pre> *f = string(bs)</pre></code><tr><td>256<td><code><pre> case **string:</pre></code><tr><td>257<td><code><pre> *f = utils.AnyPtr(string(bs))</pre></code><tr><td>258<td><code><pre> case *[]byte:</pre></code><tr><td>259<td><code><pre> *f = bs</pre></code><tr><td>260<td><code><pre> case **[]byte:</pre></code><tr><td>261<td><code><pre> *f = utils.AnyPtr(bs)</pre></code><tr><td>262<td><code><pre> }</pre></code><tr><td>263<td><code><pre> default:</pre></code><tr><td>264<td><code><pre> return tx.AddError(errors.New("unsupported marshal field type"))</pre></code><tr><td>265<td><code><pre> }</pre></code><tr><td>266<td><code><pre> return</pre></code><tr><td>267<td><code><pre> }</pre></code><tr><td>268<td><code><pre></pre></code><tr><td>269<td><code><pre>}</pre></code></table><div class=funcname id=fn_ScanLog>func ScanLog</div><div class=info><a href=#s_fn_ScanLog>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>85<td><code><pre>func ScanLog(log log.Loggable) utils.OptionFunc[scanOption] {</pre></code><tr class=miss><td>86<td><code><pre> return func(o *scanOption) {</pre></code><tr><td>87<td><code><pre> o.log = log</pre></code><tr><td>88<td><code><pre> }</pre></code><tr><td>89<td><code><pre>}</pre></code></table><div class=funcname id=fn_@80:9>func @80:9</div><div class=info><a href=#s_fn_@80:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>80<td><code><pre>func(o *scanOption) {</pre></code><tr class=miss><td>81<td><code><pre> o.limit = limit</pre></code><tr><td>82<td><code><pre> }</pre></code></table><div class=funcname id=fn_ScanLimit>func ScanLimit</div><div class=info><a href=#s_fn_ScanLimit>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>79<td><code><pre>func ScanLimit(limit int) utils.OptionFunc[scanOption] {</pre></code><tr class=miss><td>80<td><code><pre> return func(o *scanOption) {</pre></code><tr><td>81<td><code><pre> o.limit = limit</pre></code><tr><td>82<td><code><pre> }</pre></code><tr><td>83<td><code><pre>}</pre></code></table><div class=funcname id=fn_ScanWhere>func ScanWhere</div><div class=info><a href=#s_fn_ScanWhere>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func ScanWhere(where any, sqlAndArguments ...any) utils.OptionFunc[scanOption] {</pre></code><tr class=miss><td>53<td><code><pre> return func(o *scanOption) {</pre></code><tr><td>54<td><code><pre> o.where = where</pre></code><tr><td>55<td><code><pre> o.sqlAndArguments = sqlAndArguments</pre></code><tr><td>56<td><code><pre> }</pre></code><tr><td>57<td><code><pre>}</pre></code></table><div class=funcname id=fn_@47:9>func @47:9</div><div class=info><a href=#s_fn_@47:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>47<td><code><pre>func(o *scanOption) {</pre></code><tr class=miss><td>48<td><code><pre> o.dbName = dbName</pre></code><tr><td>49<td><code><pre> }</pre></code></table><div class=funcname id=fn_ScanUse>func ScanUse</div><div class=info><a href=#s_fn_ScanUse>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/candy.go</code>:</div><table class=listing><tr><td>46<td><code><pre>func ScanUse(dbName string) utils.OptionFunc[scanOption] {</pre></code><tr class=miss><td>47<td><code><pre> return func(o *scanOption) {</pre></code><tr><td>48<td><code><pre> o.dbName = dbName</pre></code><tr><td>49<td><code><pre> }</pre></code><tr><td>50<td><code><pre>}</pre></code></table><div class=funcname id=fn_BusinessSoftDeleted.BizCreateTime>func BusinessSoftDeleted.BizCreateTime</div><div class=info><a href=#s_fn_BusinessSoftDeleted.BizCreateTime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/model.go</code>:</div><table class=listing><tr><td>174<td><code><pre>func (b *BusinessSoftDeleted) BizCreateTime() time.Time {</pre></code><tr class=miss><td>175<td><code><pre> return utils.GetTime(b.BizCreateTimeMs)</pre></code><tr><td>176<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/db/callbacks class=funcname>Package Overview: github.com/wfusion/gofusion/db/callbacks 24 <span class=packageTotal>43.0%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_SoftDelete><td><code><a href=#fn_SoftDelete>SoftDelete(...)</a></code><td><code>github.com/wfusion/gofusion/db/callbacks/soft_delete.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_BuildQuerySQL><td><code><a href=#fn_BuildQuerySQL>BuildQuerySQL(...)</a></code><td><code>github.com/wfusion/gofusion/db/callbacks/build_sql.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_BuildDeleteSQL><td><code><a href=#fn_BuildDeleteSQL>BuildDeleteSQL(...)</a></code><td><code>github.com/wfusion/gofusion/db/callbacks/build_sql.go</code><td class=percent><code>95.8%</code><td class=linecount><code>23/24</code><tr id=s_fn_BuildUpdateSQL><td><code><a href=#fn_BuildUpdateSQL>BuildUpdateSQL(...)</a></code><td><code>github.com/wfusion/gofusion/db/callbacks/build_sql.go</code><td class=percent><code>91.7%</code><td class=linecount><code>11/12</code><tr id=s_fn_checkMissingWhereConditions><td><code><a href=#fn_checkMissingWhereConditions>checkMissingWhereConditions(...)</a></code><td><code>github.com/wfusion/gofusion/db/callbacks/soft_delete.go</code><td class=percent><code>88.9%</code><td class=linecount><code>8/9</code><tr id=s_fn_@43:67><td><code><a href=#fn_@43:67>@43:67(...)</a></code><td><code>github.com/wfusion/gofusion/db/callbacks/soft_delete.go</code><td class=percent><code>78.6%</code><td class=linecount><code>11/14</code><tr id=s_fn_@15:67><td><code><a href=#fn_@15:67>@15:67(...)</a></code><td><code>github.com/wfusion/gofusion/db/callbacks/soft_delete.go</code><td class=percent><code>53.3%</code><td class=linecount><code>8/15</code><tr id=s_fn_@29:49><td><code><a href=#fn_@29:49>@29:49(...)</a></code><td><code>github.com/wfusion/gofusion/db/callbacks/auto_incr.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/47</code><tr id=s_fn_BuildCreateSQL><td><code><a href=#fn_BuildCreateSQL>BuildCreateSQL(...)</a></code><td><code>github.com/wfusion/gofusion/db/callbacks/build_sql.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/17</code><tr id=s_fn_CreateAutoIncr><td><code><a href=#fn_CreateAutoIncr>CreateAutoIncr(...)</a></code><td><code>github.com/wfusion/gofusion/db/callbacks/auto_incr.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/8</code><tr id=s_fn_@53:12><td><code><a href=#fn_@53:12>@53:12(...)</a></code><td><code>github.com/wfusion/gofusion/db/callbacks/auto_incr.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_SoftDelete>func SoftDelete</div><div class=info><a href=#s_fn_SoftDelete>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/callbacks/soft_delete.go</code>:</div><table class=listing><tr><td>13<td><code><pre>func SoftDelete(db *gorm.DB) {</pre></code><tr><td>14<td><code><pre> // update callback</pre></code><tr><td>15<td><code><pre> comUtl.MustSuccess(db.Callback().Update().Replace("gorm:update", func(db *gorm.DB) {</pre></code><tr><td>16<td><code><pre> if db.Error != nil {</pre></code><tr><td>17<td><code><pre> return</pre></code><tr><td>18<td><code><pre> }</pre></code><tr><td>19<td><code><pre></pre></code><tr><td>20<td><code><pre> BuildUpdateSQL(db)</pre></code><tr><td>21<td><code><pre> checkMissingWhereConditions(db)</pre></code><tr><td>22<td><code><pre></pre></code><tr><td>23<td><code><pre> if !db.DryRun && db.Error == nil {</pre></code><tr><td>24<td><code><pre> if ok, mode := hasReturning(db, utils.Contains(db.Callback().Update().Clauses, "RETURNING")); ok {</pre></code><tr><td>25<td><code><pre> if rows, err := db.Statement.ConnPool.QueryContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...); db.AddError(err) == nil {</pre></code><tr><td>26<td><code><pre> dest := db.Statement.Dest</pre></code><tr><td>27<td><code><pre> db.Statement.Dest = db.Statement.ReflectValue.Addr().Interface()</pre></code><tr><td>28<td><code><pre> gorm.Scan(rows, db, mode)</pre></code><tr><td>29<td><code><pre> db.Statement.Dest = dest</pre></code><tr><td>30<td><code><pre> _ = db.AddError(rows.Close())</pre></code><tr><td>31<td><code><pre> }</pre></code><tr><td>32<td><code><pre> } else {</pre></code><tr><td>33<td><code><pre> result, err := db.Statement.ConnPool.ExecContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...)</pre></code><tr><td>34<td><code><pre></pre></code><tr><td>35<td><code><pre> if db.AddError(err) == nil {</pre></code><tr><td>36<td><code><pre> db.RowsAffected, _ = result.RowsAffected()</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre> }))</pre></code><tr><td>41<td><code><pre></pre></code><tr><td>42<td><code><pre> // delete callback</pre></code><tr><td>43<td><code><pre> comUtl.MustSuccess(db.Callback().Delete().Replace("gorm:delete", func(db *gorm.DB) {</pre></code><tr><td>44<td><code><pre> if db.Error != nil {</pre></code><tr><td>45<td><code><pre> return</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre></pre></code><tr><td>48<td><code><pre> BuildDeleteSQL(db)</pre></code><tr><td>49<td><code><pre> checkMissingWhereConditions(db)</pre></code><tr><td>50<td><code><pre></pre></code><tr><td>51<td><code><pre> if !db.DryRun && db.Error == nil {</pre></code><tr><td>52<td><code><pre> ok, mode := hasReturning(db, utils.Contains(db.Callback().Delete().Clauses, "RETURNING"))</pre></code><tr><td>53<td><code><pre> if !ok {</pre></code><tr><td>54<td><code><pre> result, err := db.Statement.ConnPool.ExecContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...)</pre></code><tr><td>55<td><code><pre> if db.AddError(err) == nil {</pre></code><tr><td>56<td><code><pre> db.RowsAffected, _ = result.RowsAffected()</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre></pre></code><tr><td>59<td><code><pre> return</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre></pre></code><tr><td>62<td><code><pre> if rows, err := db.Statement.ConnPool.QueryContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...); db.AddError(err) == nil {</pre></code><tr><td>63<td><code><pre> gorm.Scan(rows, db, mode)</pre></code><tr><td>64<td><code><pre> _ = db.AddError(rows.Close())</pre></code><tr><td>65<td><code><pre> }</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre> }))</pre></code><tr><td>68<td><code><pre></pre></code><tr><td>69<td><code><pre> return</pre></code><tr><td>70<td><code><pre>}</pre></code></table><div class=funcname id=fn_BuildQuerySQL>func BuildQuerySQL</div><div class=info><a href=#s_fn_BuildQuerySQL>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/callbacks/build_sql.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func BuildQuerySQL(db *gorm.DB) {</pre></code><tr><td>16<td><code><pre> callbacks.BuildQuerySQL(db)</pre></code><tr><td>17<td><code><pre>}</pre></code></table><div class=funcname id=fn_BuildDeleteSQL>func BuildDeleteSQL</div><div class=info><a href=#s_fn_BuildDeleteSQL>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/callbacks/build_sql.go</code>:</div><table class=listing><tr><td>73<td><code><pre>func BuildDeleteSQL(db *gorm.DB) {</pre></code><tr><td>74<td><code><pre> if db.Statement.Schema != nil {</pre></code><tr><td>75<td><code><pre> for _, c := range db.Statement.Schema.DeleteClauses {</pre></code><tr><td>76<td><code><pre> db.Statement.AddClause(c)</pre></code><tr><td>77<td><code><pre> }</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre></pre></code><tr><td>80<td><code><pre> if db.Statement.SQL.Len() > 0 {</pre></code><tr><td>81<td><code><pre> return</pre></code><tr><td>82<td><code><pre> }</pre></code><tr><td>83<td><code><pre></pre></code><tr><td>84<td><code><pre> stmt := db.Statement</pre></code><tr><td>85<td><code><pre> stmt.SQL.Grow(180)</pre></code><tr><td>86<td><code><pre> if stmt.Schema != nil {</pre></code><tr><td>87<td><code><pre> _, queryValues := schema.GetIdentityFieldValuesMap(stmt.Context, stmt.ReflectValue, stmt.Schema.PrimaryFields)</pre></code><tr><td>88<td><code><pre> column, values := schema.ToQueryValues(stmt.Table, stmt.Schema.PrimaryFieldDBNames, queryValues)</pre></code><tr><td>89<td><code><pre></pre></code><tr><td>90<td><code><pre> if len(values) > 0 {</pre></code><tr><td>91<td><code><pre> stmt.AddClause(clause.Where{Exprs: []clause.Expression{clause.IN{Column: column, Values: values}}})</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre></pre></code><tr><td>94<td><code><pre> if stmt.ReflectValue.CanAddr() && stmt.Dest != stmt.Model && stmt.Model != nil {</pre></code><tr><td>95<td><code><pre> _, queryValues = schema.GetIdentityFieldValuesMap(stmt.Context, reflect.ValueOf(stmt.Model), stmt.Schema.PrimaryFields)</pre></code><tr><td>96<td><code><pre> column, values = schema.ToQueryValues(stmt.Table, stmt.Schema.PrimaryFieldDBNames, queryValues)</pre></code><tr><td>97<td><code><pre></pre></code><tr><td>98<td><code><pre> if len(values) > 0 {</pre></code><tr class=miss><td>99<td><code><pre> stmt.AddClause(clause.Where{Exprs: []clause.Expression{clause.IN{Column: column, Values: values}}})</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre> }</pre></code><tr><td>102<td><code><pre> }</pre></code><tr><td>103<td><code><pre></pre></code><tr><td>104<td><code><pre> if softdelete.IsClausesWithSoftDelete(db.Statement.Clauses) {</pre></code><tr><td>105<td><code><pre> stmt.AddClauseIfNotExists(clause.Update{})</pre></code><tr><td>106<td><code><pre> delete(stmt.Clauses, clause.From{}.Name())</pre></code><tr><td>107<td><code><pre> stmt.Build(stmt.DB.Callback().Update().Clauses...)</pre></code><tr><td>108<td><code><pre> } else {</pre></code><tr><td>109<td><code><pre> stmt.AddClauseIfNotExists(clause.Delete{})</pre></code><tr><td>110<td><code><pre> stmt.AddClauseIfNotExists(clause.From{})</pre></code><tr><td>111<td><code><pre> stmt.Build(stmt.BuildClauses...)</pre></code><tr><td>112<td><code><pre> }</pre></code><tr><td>113<td><code><pre>}</pre></code></table><div class=funcname id=fn_BuildUpdateSQL>func BuildUpdateSQL</div><div class=info><a href=#s_fn_BuildUpdateSQL>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/callbacks/build_sql.go</code>:</div><table class=listing><tr><td>50<td><code><pre>func BuildUpdateSQL(db *gorm.DB) {</pre></code><tr><td>51<td><code><pre> if db.Statement.Schema != nil {</pre></code><tr><td>52<td><code><pre> for _, c := range db.Statement.Schema.UpdateClauses {</pre></code><tr><td>53<td><code><pre> db.Statement.AddClause(c)</pre></code><tr><td>54<td><code><pre> }</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre></pre></code><tr><td>57<td><code><pre> if db.Statement.SQL.Len() == 0 {</pre></code><tr><td>58<td><code><pre> db.Statement.SQL.Grow(180)</pre></code><tr><td>59<td><code><pre> db.Statement.AddClauseIfNotExists(clause.Update{})</pre></code><tr><td>60<td><code><pre> delete(db.Statement.Clauses, clause.From{}.Name())</pre></code><tr><td>61<td><code><pre> if _, ok := db.Statement.Clauses["SET"]; !ok {</pre></code><tr><td>62<td><code><pre> if set := callbacks.ConvertToAssignments(db.Statement); len(set) != 0 {</pre></code><tr><td>63<td><code><pre> db.Statement.AddClause(set)</pre></code><tr><td>64<td><code><pre> } else {</pre></code><tr class=miss><td>65<td><code><pre> return</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre></pre></code><tr><td>69<td><code><pre> db.Statement.Build(db.Statement.BuildClauses...)</pre></code><tr><td>70<td><code><pre> }</pre></code><tr><td>71<td><code><pre>}</pre></code></table><div class=funcname id=fn_checkMissingWhereConditions>func checkMissingWhereConditions</div><div class=info><a href=#s_fn_checkMissingWhereConditions>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/callbacks/soft_delete.go</code>:</div><table class=listing><tr><td>72<td><code><pre>func checkMissingWhereConditions(db *gorm.DB) {</pre></code><tr><td>73<td><code><pre> if !db.AllowGlobalUpdate && db.Error == nil {</pre></code><tr><td>74<td><code><pre> where, withCondition := db.Statement.Clauses["WHERE"]</pre></code><tr><td>75<td><code><pre> if withCondition {</pre></code><tr><td>76<td><code><pre> if softdelete.IsClausesWithSoftDelete(db.Statement.Clauses) {</pre></code><tr><td>77<td><code><pre> whereClause, _ := where.Expression.(clause.Where)</pre></code><tr><td>78<td><code><pre> withCondition = len(whereClause.Exprs) > 1</pre></code><tr><td>79<td><code><pre> }</pre></code><tr><td>80<td><code><pre> }</pre></code><tr><td>81<td><code><pre> if !withCondition {</pre></code><tr class=miss><td>82<td><code><pre> _ = db.AddError(gorm.ErrMissingWhereClause)</pre></code><tr><td>83<td><code><pre> }</pre></code><tr><td>84<td><code><pre> return</pre></code><tr><td>85<td><code><pre> }</pre></code><tr><td>86<td><code><pre>}</pre></code></table><div class=funcname id=fn_@43:67>func @43:67</div><div class=info><a href=#s_fn_@43:67>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/callbacks/soft_delete.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func(db *gorm.DB) {</pre></code><tr><td>44<td><code><pre> if db.Error != nil {</pre></code><tr><td>45<td><code><pre> return</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre></pre></code><tr><td>48<td><code><pre> BuildDeleteSQL(db)</pre></code><tr><td>49<td><code><pre> checkMissingWhereConditions(db)</pre></code><tr><td>50<td><code><pre></pre></code><tr><td>51<td><code><pre> if !db.DryRun && db.Error == nil {</pre></code><tr><td>52<td><code><pre> ok, mode := hasReturning(db, utils.Contains(db.Callback().Delete().Clauses, "RETURNING"))</pre></code><tr><td>53<td><code><pre> if !ok {</pre></code><tr><td>54<td><code><pre> result, err := db.Statement.ConnPool.ExecContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...)</pre></code><tr><td>55<td><code><pre> if db.AddError(err) == nil {</pre></code><tr><td>56<td><code><pre> db.RowsAffected, _ = result.RowsAffected()</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre></pre></code><tr><td>59<td><code><pre> return</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre></pre></code><tr class=miss><td>62<td><code><pre> if rows, err := db.Statement.ConnPool.QueryContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...); db.AddError(err) == nil {</pre></code><tr class=miss><td>63<td><code><pre> gorm.Scan(rows, db, mode)</pre></code><tr class=miss><td>64<td><code><pre> _ = db.AddError(rows.Close())</pre></code><tr><td>65<td><code><pre> }</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre> }</pre></code></table><div class=funcname id=fn_@15:67>func @15:67</div><div class=info><a href=#s_fn_@15:67>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/callbacks/soft_delete.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func(db *gorm.DB) {</pre></code><tr><td>16<td><code><pre> if db.Error != nil {</pre></code><tr class=miss><td>17<td><code><pre> return</pre></code><tr><td>18<td><code><pre> }</pre></code><tr><td>19<td><code><pre></pre></code><tr><td>20<td><code><pre> BuildUpdateSQL(db)</pre></code><tr><td>21<td><code><pre> checkMissingWhereConditions(db)</pre></code><tr><td>22<td><code><pre></pre></code><tr><td>23<td><code><pre> if !db.DryRun && db.Error == nil {</pre></code><tr><td>24<td><code><pre> if ok, mode := hasReturning(db, utils.Contains(db.Callback().Update().Clauses, "RETURNING")); ok {</pre></code><tr class=miss><td>25<td><code><pre> if rows, err := db.Statement.ConnPool.QueryContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...); db.AddError(err) == nil {</pre></code><tr class=miss><td>26<td><code><pre> dest := db.Statement.Dest</pre></code><tr class=miss><td>27<td><code><pre> db.Statement.Dest = db.Statement.ReflectValue.Addr().Interface()</pre></code><tr class=miss><td>28<td><code><pre> gorm.Scan(rows, db, mode)</pre></code><tr class=miss><td>29<td><code><pre> db.Statement.Dest = dest</pre></code><tr class=miss><td>30<td><code><pre> _ = db.AddError(rows.Close())</pre></code><tr><td>31<td><code><pre> }</pre></code><tr><td>32<td><code><pre> } else {</pre></code><tr><td>33<td><code><pre> result, err := db.Statement.ConnPool.ExecContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...)</pre></code><tr><td>34<td><code><pre></pre></code><tr><td>35<td><code><pre> if db.AddError(err) == nil {</pre></code><tr><td>36<td><code><pre> db.RowsAffected, _ = result.RowsAffected()</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre> }</pre></code></table><div class=funcname id=fn_@29:49>func @29:49</div><div class=info><a href=#s_fn_@29:49>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/callbacks/auto_incr.go</code>:</div><table class=listing><tr><td>29<td><code><pre>func(db *gorm.DB) {</pre></code><tr class=miss><td>30<td><code><pre> if db.Error != nil {</pre></code><tr class=miss><td>31<td><code><pre> return</pre></code><tr><td>32<td><code><pre> }</pre></code><tr><td>33<td><code><pre></pre></code><tr class=miss><td>34<td><code><pre> BuildCreateSQL(db)</pre></code><tr><td>35<td><code><pre></pre></code><tr class=miss><td>36<td><code><pre> isDryRun := !db.DryRun && db.Error == nil</pre></code><tr class=miss><td>37<td><code><pre> if !isDryRun {</pre></code><tr class=miss><td>38<td><code><pre> return</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre></pre></code><tr class=miss><td>41<td><code><pre> ok, mode := hasReturning(db, utils.Contains(db.Callback().Create().Clauses, "RETURNING"))</pre></code><tr class=miss><td>42<td><code><pre> if ok {</pre></code><tr class=miss><td>43<td><code><pre> if c, ok := db.Statement.Clauses["ON CONFLICT"]; ok {</pre></code><tr class=miss><td>44<td><code><pre> if onConflict, _ := c.Expression.(clause.OnConflict); onConflict.DoNothing {</pre></code><tr class=miss><td>45<td><code><pre> mode |= gorm.ScanOnConflictDoNothing</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre></pre></code><tr class=miss><td>49<td><code><pre> rows, err := db.Statement.ConnPool.QueryContext(</pre></code><tr><td>50<td><code><pre> db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...,</pre></code><tr><td>51<td><code><pre> )</pre></code><tr class=miss><td>52<td><code><pre> if db.AddError(err) == nil {</pre></code><tr class=miss><td>53<td><code><pre> defer func() { _ = db.AddError(rows.Close()) }()</pre></code><tr class=miss><td>54<td><code><pre> gorm.Scan(rows, db, mode)</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre></pre></code><tr class=miss><td>57<td><code><pre> return</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre></pre></code><tr class=miss><td>60<td><code><pre> result, err := db.Statement.ConnPool.ExecContext(</pre></code><tr><td>61<td><code><pre> db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...,</pre></code><tr><td>62<td><code><pre> )</pre></code><tr class=miss><td>63<td><code><pre> if err != nil {</pre></code><tr class=miss><td>64<td><code><pre> _ = db.AddError(err)</pre></code><tr class=miss><td>65<td><code><pre> return</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre></pre></code><tr class=miss><td>68<td><code><pre> db.RowsAffected, _ = result.RowsAffected()</pre></code><tr class=miss><td>69<td><code><pre> if db.RowsAffected != 0 && db.Statement.Schema != nil &&</pre></code><tr><td>70<td><code><pre> db.Statement.Schema.PrioritizedPrimaryField != nil &&</pre></code><tr><td>71<td><code><pre> db.Statement.Schema.PrioritizedPrimaryField.HasDefaultValue {</pre></code><tr class=miss><td>72<td><code><pre> insertID, err := result.LastInsertId()</pre></code><tr class=miss><td>73<td><code><pre> insertOk := err == nil && insertID > 0</pre></code><tr class=miss><td>74<td><code><pre> if !insertOk {</pre></code><tr class=miss><td>75<td><code><pre> _ = db.AddError(err)</pre></code><tr class=miss><td>76<td><code><pre> return</pre></code><tr><td>77<td><code><pre> }</pre></code><tr><td>78<td><code><pre></pre></code><tr class=miss><td>79<td><code><pre> switch db.Statement.ReflectValue.Kind() {</pre></code><tr><td>80<td><code><pre> case reflect.Slice, reflect.Array:</pre></code><tr class=miss><td>81<td><code><pre> if lastInsertIDReversed {</pre></code><tr class=miss><td>82<td><code><pre> for i := db.Statement.ReflectValue.Len() - 1; i >= 0; i-- {</pre></code><tr class=miss><td>83<td><code><pre> rv := db.Statement.ReflectValue.Index(i)</pre></code><tr class=miss><td>84<td><code><pre> if reflect.Indirect(rv).Kind() != reflect.Struct {</pre></code><tr class=miss><td>85<td><code><pre> break</pre></code><tr><td>86<td><code><pre> }</pre></code><tr><td>87<td><code><pre></pre></code><tr class=miss><td>88<td><code><pre> _, isZero := db.Statement.Schema.PrioritizedPrimaryField.ValueOf(db.Statement.Context, rv)</pre></code><tr class=miss><td>89<td><code><pre> if isZero {</pre></code><tr class=miss><td>90<td><code><pre> _ = db.AddError(db.Statement.Schema.PrioritizedPrimaryField.Set(db.Statement.Context, rv, insertID))</pre></code><tr><td>91<td><code><pre> //insertID -= db.Statement.Schema.PrioritizedPrimaryField.AutoIncrementIncrement</pre></code><tr class=miss><td>92<td><code><pre> insertID -= autoIncrIncr</pre></code><tr><td>93<td><code><pre> }</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre> } else {</pre></code><tr class=miss><td>96<td><code><pre> for i := 0; i < db.Statement.ReflectValue.Len(); i++ {</pre></code><tr class=miss><td>97<td><code><pre> rv := db.Statement.ReflectValue.Index(i)</pre></code><tr class=miss><td>98<td><code><pre> if reflect.Indirect(rv).Kind() != reflect.Struct {</pre></code><tr class=miss><td>99<td><code><pre> break</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre></pre></code><tr class=miss><td>102<td><code><pre> if _, isZero := db.Statement.Schema.PrioritizedPrimaryField.ValueOf(db.Statement.Context, rv); isZero {</pre></code><tr class=miss><td>103<td><code><pre> _ = db.AddError(db.Statement.Schema.PrioritizedPrimaryField.Set(db.Statement.Context, rv, insertID))</pre></code><tr><td>104<td><code><pre> //insertID += db.Statement.Schema.PrioritizedPrimaryField.AutoIncrementIncrement</pre></code><tr class=miss><td>105<td><code><pre> insertID += autoIncrIncr</pre></code><tr><td>106<td><code><pre> }</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre> }</pre></code><tr><td>109<td><code><pre> case reflect.Struct:</pre></code><tr class=miss><td>110<td><code><pre> _, isZero := db.Statement.Schema.PrioritizedPrimaryField.ValueOf(db.Statement.Context, db.Statement.ReflectValue)</pre></code><tr class=miss><td>111<td><code><pre> if isZero {</pre></code><tr class=miss><td>112<td><code><pre> _ = db.AddError(db.Statement.Schema.PrioritizedPrimaryField.Set(db.Statement.Context, db.Statement.ReflectValue, insertID))</pre></code><tr><td>113<td><code><pre> }</pre></code><tr><td>114<td><code><pre> }</pre></code><tr><td>115<td><code><pre> }</pre></code><tr><td>116<td><code><pre> }</pre></code></table><div class=funcname id=fn_BuildCreateSQL>func BuildCreateSQL</div><div class=info><a href=#s_fn_BuildCreateSQL>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/callbacks/build_sql.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func BuildCreateSQL(db *gorm.DB) {</pre></code><tr class=miss><td>20<td><code><pre> supportReturning := utils.Contains(db.Callback().Create().Clauses, "RETURNING")</pre></code><tr class=miss><td>21<td><code><pre> if db.Statement.Schema != nil {</pre></code><tr class=miss><td>22<td><code><pre> if !db.Statement.Unscoped {</pre></code><tr class=miss><td>23<td><code><pre> for _, c := range db.Statement.Schema.CreateClauses {</pre></code><tr class=miss><td>24<td><code><pre> db.Statement.AddClause(c)</pre></code><tr><td>25<td><code><pre> }</pre></code><tr><td>26<td><code><pre> }</pre></code><tr><td>27<td><code><pre></pre></code><tr class=miss><td>28<td><code><pre> if supportReturning && len(db.Statement.Schema.FieldsWithDefaultDBValue) > 0 {</pre></code><tr class=miss><td>29<td><code><pre> if _, ok := db.Statement.Clauses["RETURNING"]; !ok {</pre></code><tr class=miss><td>30<td><code><pre> fromColumns := make([]clause.Column, 0, len(db.Statement.Schema.FieldsWithDefaultDBValue))</pre></code><tr class=miss><td>31<td><code><pre> for _, field := range db.Statement.Schema.FieldsWithDefaultDBValue {</pre></code><tr class=miss><td>32<td><code><pre> fromColumns = append(fromColumns, clause.Column{Name: field.DBName})</pre></code><tr><td>33<td><code><pre> }</pre></code><tr class=miss><td>34<td><code><pre> db.Statement.AddClause(clause.Returning{Columns: fromColumns})</pre></code><tr><td>35<td><code><pre> }</pre></code><tr><td>36<td><code><pre> }</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre></pre></code><tr class=miss><td>39<td><code><pre> if db.Statement.SQL.Len() == 0 {</pre></code><tr class=miss><td>40<td><code><pre> db.Statement.SQL.Grow(180)</pre></code><tr><td>41<td><code><pre></pre></code><tr class=miss><td>42<td><code><pre> db.Statement.AddClauseIfNotExists(clause.Insert{})</pre></code><tr class=miss><td>43<td><code><pre> db.Statement.AddClause(callbacks.ConvertToCreateValues(db.Statement))</pre></code><tr class=miss><td>44<td><code><pre> delete(db.Statement.Clauses, clause.From{}.Name())</pre></code><tr><td>45<td><code><pre></pre></code><tr class=miss><td>46<td><code><pre> db.Statement.Build(db.Statement.BuildClauses...)</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre>}</pre></code></table><div class=funcname id=fn_CreateAutoIncr>func CreateAutoIncr</div><div class=info><a href=#s_fn_CreateAutoIncr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/callbacks/auto_incr.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func CreateAutoIncr(db *gorm.DB, gormDialector gorm.Dialector, autoIncrIncr int64) {</pre></code><tr class=miss><td>17<td><code><pre> withReturning := false</pre></code><tr class=miss><td>18<td><code><pre> dialector := gormDialector.(*Dialector)</pre></code><tr class=miss><td>19<td><code><pre> if !dialector.Config.SkipInitializeWithVersion && strings.Contains(dialector.ServerVersion, "MariaDB") {</pre></code><tr class=miss><td>20<td><code><pre> withReturning = checkVersion(dialector.ServerVersion, "10.5")</pre></code><tr><td>21<td><code><pre> }</pre></code><tr><td>22<td><code><pre></pre></code><tr class=miss><td>23<td><code><pre> lastInsertIDReversed := false</pre></code><tr class=miss><td>24<td><code><pre> if !dialector.Config.DisableWithReturning && withReturning {</pre></code><tr class=miss><td>25<td><code><pre> lastInsertIDReversed = true</pre></code><tr><td>26<td><code><pre> }</pre></code><tr><td>27<td><code><pre></pre></code><tr class=miss><td>28<td><code><pre> comUtl.MustSuccess(</pre></code><tr><td>29<td><code><pre> db.Callback().Create().Replace("gorm:create", func(db *gorm.DB) {</pre></code><tr><td>30<td><code><pre> if db.Error != nil {</pre></code><tr><td>31<td><code><pre> return</pre></code><tr><td>32<td><code><pre> }</pre></code><tr><td>33<td><code><pre></pre></code><tr><td>34<td><code><pre> BuildCreateSQL(db)</pre></code><tr><td>35<td><code><pre></pre></code><tr><td>36<td><code><pre> isDryRun := !db.DryRun && db.Error == nil</pre></code><tr><td>37<td><code><pre> if !isDryRun {</pre></code><tr><td>38<td><code><pre> return</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre></pre></code><tr><td>41<td><code><pre> ok, mode := hasReturning(db, utils.Contains(db.Callback().Create().Clauses, "RETURNING"))</pre></code><tr><td>42<td><code><pre> if ok {</pre></code><tr><td>43<td><code><pre> if c, ok := db.Statement.Clauses["ON CONFLICT"]; ok {</pre></code><tr><td>44<td><code><pre> if onConflict, _ := c.Expression.(clause.OnConflict); onConflict.DoNothing {</pre></code><tr><td>45<td><code><pre> mode |= gorm.ScanOnConflictDoNothing</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre></pre></code><tr><td>49<td><code><pre> rows, err := db.Statement.ConnPool.QueryContext(</pre></code><tr><td>50<td><code><pre> db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...,</pre></code><tr><td>51<td><code><pre> )</pre></code><tr><td>52<td><code><pre> if db.AddError(err) == nil {</pre></code><tr><td>53<td><code><pre> defer func() { _ = db.AddError(rows.Close()) }()</pre></code><tr><td>54<td><code><pre> gorm.Scan(rows, db, mode)</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre></pre></code><tr><td>57<td><code><pre> return</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre></pre></code><tr><td>60<td><code><pre> result, err := db.Statement.ConnPool.ExecContext(</pre></code><tr><td>61<td><code><pre> db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...,</pre></code><tr><td>62<td><code><pre> )</pre></code><tr><td>63<td><code><pre> if err != nil {</pre></code><tr><td>64<td><code><pre> _ = db.AddError(err)</pre></code><tr><td>65<td><code><pre> return</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre></pre></code><tr><td>68<td><code><pre> db.RowsAffected, _ = result.RowsAffected()</pre></code><tr><td>69<td><code><pre> if db.RowsAffected != 0 && db.Statement.Schema != nil &&</pre></code><tr><td>70<td><code><pre> db.Statement.Schema.PrioritizedPrimaryField != nil &&</pre></code><tr><td>71<td><code><pre> db.Statement.Schema.PrioritizedPrimaryField.HasDefaultValue {</pre></code><tr><td>72<td><code><pre> insertID, err := result.LastInsertId()</pre></code><tr><td>73<td><code><pre> insertOk := err == nil && insertID > 0</pre></code><tr><td>74<td><code><pre> if !insertOk {</pre></code><tr><td>75<td><code><pre> _ = db.AddError(err)</pre></code><tr><td>76<td><code><pre> return</pre></code><tr><td>77<td><code><pre> }</pre></code><tr><td>78<td><code><pre></pre></code><tr><td>79<td><code><pre> switch db.Statement.ReflectValue.Kind() {</pre></code><tr><td>80<td><code><pre> case reflect.Slice, reflect.Array:</pre></code><tr><td>81<td><code><pre> if lastInsertIDReversed {</pre></code><tr><td>82<td><code><pre> for i := db.Statement.ReflectValue.Len() - 1; i >= 0; i-- {</pre></code><tr><td>83<td><code><pre> rv := db.Statement.ReflectValue.Index(i)</pre></code><tr><td>84<td><code><pre> if reflect.Indirect(rv).Kind() != reflect.Struct {</pre></code><tr><td>85<td><code><pre> break</pre></code><tr><td>86<td><code><pre> }</pre></code><tr><td>87<td><code><pre></pre></code><tr><td>88<td><code><pre> _, isZero := db.Statement.Schema.PrioritizedPrimaryField.ValueOf(db.Statement.Context, rv)</pre></code><tr><td>89<td><code><pre> if isZero {</pre></code><tr><td>90<td><code><pre> _ = db.AddError(db.Statement.Schema.PrioritizedPrimaryField.Set(db.Statement.Context, rv, insertID))</pre></code><tr><td>91<td><code><pre> //insertID -= db.Statement.Schema.PrioritizedPrimaryField.AutoIncrementIncrement</pre></code><tr><td>92<td><code><pre> insertID -= autoIncrIncr</pre></code><tr><td>93<td><code><pre> }</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre> } else {</pre></code><tr><td>96<td><code><pre> for i := 0; i < db.Statement.ReflectValue.Len(); i++ {</pre></code><tr><td>97<td><code><pre> rv := db.Statement.ReflectValue.Index(i)</pre></code><tr><td>98<td><code><pre> if reflect.Indirect(rv).Kind() != reflect.Struct {</pre></code><tr><td>99<td><code><pre> break</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre></pre></code><tr><td>102<td><code><pre> if _, isZero := db.Statement.Schema.PrioritizedPrimaryField.ValueOf(db.Statement.Context, rv); isZero {</pre></code><tr><td>103<td><code><pre> _ = db.AddError(db.Statement.Schema.PrioritizedPrimaryField.Set(db.Statement.Context, rv, insertID))</pre></code><tr><td>104<td><code><pre> //insertID += db.Statement.Schema.PrioritizedPrimaryField.AutoIncrementIncrement</pre></code><tr><td>105<td><code><pre> insertID += autoIncrIncr</pre></code><tr><td>106<td><code><pre> }</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre> }</pre></code><tr><td>109<td><code><pre> case reflect.Struct:</pre></code><tr><td>110<td><code><pre> _, isZero := db.Statement.Schema.PrioritizedPrimaryField.ValueOf(db.Statement.Context, db.Statement.ReflectValue)</pre></code><tr><td>111<td><code><pre> if isZero {</pre></code><tr><td>112<td><code><pre> _ = db.AddError(db.Statement.Schema.PrioritizedPrimaryField.Set(db.Statement.Context, db.Statement.ReflectValue, insertID))</pre></code><tr><td>113<td><code><pre> }</pre></code><tr><td>114<td><code><pre> }</pre></code><tr><td>115<td><code><pre> }</pre></code><tr><td>116<td><code><pre> }),</pre></code><tr><td>117<td><code><pre> )</pre></code><tr><td>118<td><code><pre>}</pre></code></table><div class=funcname id=fn_@53:12>func @53:12</div><div class=info><a href=#s_fn_@53:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/callbacks/auto_incr.go</code>:</div><table class=listing><tr class=miss><td>53<td><code><pre>func() { _ = db.AddError(rows.Close()) }</pre></code></table><div id=pkg_github.com/wfusion/gofusion/db/plugins class=funcname>Package Overview: github.com/wfusion/gofusion/db/plugins 25 <span class=packageTotal>61.0%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_tableSharding.replaceStatementClauseAndSchema><td><code><a href=#fn_tableSharding.replaceStatementClauseAndSchema>tableSharding.replaceStatementClauseAndSchema(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>8/8</code><tr id=s_fn_@697:23><td><code><a href=#fn_@697:23>@697:23(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>8/8</code><tr id=s_fn_tableSharding.registerCallbacks><td><code><a href=#fn_tableSharding.registerCallbacks>tableSharding.registerCallbacks(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_tableSharding.replaceOrderByTableName><td><code><a href=#fn_tableSharding.replaceOrderByTableName>tableSharding.replaceOrderByTableName(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_tableSharding.Initialize><td><code><a href=#fn_tableSharding.Initialize>tableSharding.Initialize(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_@718:23><td><code><a href=#fn_@718:23>@718:23(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_newShardingDialector><td><code><a href=#fn_newShardingDialector>newShardingDialector(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_shardingDialector.Migrator><td><code><a href=#fn_shardingDialector.Migrator>shardingDialector.Migrator(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_@252:3><td><code><a href=#fn_@252:3>@252:3(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@274:3><td><code><a href=#fn_@274:3>@274:3(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@1102:5><td><code><a href=#fn_@1102:5>@1102:5(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@240:3><td><code><a href=#fn_@240:3>@240:3(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@1077:28><td><code><a href=#fn_@1077:28>@1077:28(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_tableSharding.replaceCondition><td><code><a href=#fn_tableSharding.replaceCondition>tableSharding.replaceCondition(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@251:3><td><code><a href=#fn_@251:3>@251:3(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@1011:9><td><code><a href=#fn_@1011:9>@1011:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@262:3><td><code><a href=#fn_@262:3>@262:3(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@273:3><td><code><a href=#fn_@273:3>@273:3(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@294:9><td><code><a href=#fn_@294:9>@294:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_tableSharding.updateCallback><td><code><a href=#fn_tableSharding.updateCallback>tableSharding.updateCallback(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_tableSharding.rawCallback><td><code><a href=#fn_tableSharding.rawCallback>tableSharding.rawCallback(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_tableSharding.queryCallback><td><code><a href=#fn_tableSharding.queryCallback>tableSharding.queryCallback(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@917:42><td><code><a href=#fn_@917:42>@917:42(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_tableShardingIsInsert><td><code><a href=#fn_tableShardingIsInsert>tableShardingIsInsert(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_tableSharding.isIgnored><td><code><a href=#fn_tableSharding.isIgnored>tableSharding.isIgnored(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_tableSharding.createCallback><td><code><a href=#fn_tableSharding.createCallback>tableSharding.createCallback(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@332:37><td><code><a href=#fn_@332:37>@332:37(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_tableSharding.replaceConstraint><td><code><a href=#fn_tableSharding.replaceConstraint>tableSharding.replaceConstraint(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@151:33><td><code><a href=#fn_@151:33>@151:33(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_tableSharding.Name><td><code><a href=#fn_tableSharding.Name>tableSharding.Name(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_tableSharding.deleteCallback><td><code><a href=#fn_tableSharding.deleteCallback>tableSharding.deleteCallback(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@1006:9><td><code><a href=#fn_@1006:9>@1006:9(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_tableSharding.checkDiffSuffixesByModel><td><code><a href=#fn_tableSharding.checkDiffSuffixesByModel>tableSharding.checkDiffSuffixesByModel(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>90.5%</code><td class=linecount><code>19/21</code><tr id=s_fn_@804:23><td><code><a href=#fn_@804:23>@804:23(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>88.2%</code><td class=linecount><code>15/17</code><tr id=s_fn_tableSharding.suffixes><td><code><a href=#fn_tableSharding.suffixes>tableSharding.suffixes(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>87.5%</code><td class=linecount><code>7/8</code><tr id=s_fn_@1049:10><td><code><a href=#fn_@1049:10>@1049:10(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>87.5%</code><td class=linecount><code>7/8</code><tr id=s_fn_@1063:10><td><code><a href=#fn_@1063:10>@1063:10(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>87.5%</code><td class=linecount><code>7/8</code><tr id=s_fn_tableSharding.ShardingByModelList><td><code><a href=#fn_tableSharding.ShardingByModelList>tableSharding.ShardingByModelList(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>83.3%</code><td class=linecount><code>15/18</code><tr id=s_fn_@646:12><td><code><a href=#fn_@646:12>@646:12(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_shardingMigrator.AutoMigrate><td><code><a href=#fn_shardingMigrator.AutoMigrate>shardingMigrator.AutoMigrate(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>81.2%</code><td class=linecount><code>13/16</code><tr id=s_fn_shardingMigrator.DropTable><td><code><a href=#fn_shardingMigrator.DropTable>shardingMigrator.DropTable(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>81.2%</code><td class=linecount><code>13/16</code><tr id=s_fn_@371:15><td><code><a href=#fn_@371:15>@371:15(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_DefaultTableSharding><td><code><a href=#fn_DefaultTableSharding>DefaultTableSharding(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>77.8%</code><td class=linecount><code>14/18</code><tr id=s_fn_@854:23><td><code><a href=#fn_@854:23>@854:23(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>77.8%</code><td class=linecount><code>7/9</code><tr id=s_fn_tableSharding.setPrimaryKeyByModel><td><code><a href=#fn_tableSharding.setPrimaryKeyByModel>tableSharding.setPrimaryKeyByModel(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>76.9%</code><td class=linecount><code>10/13</code><tr id=s_fn_@438:31><td><code><a href=#fn_@438:31>@438:31(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>76.6%</code><td class=linecount><code>36/47</code><tr id=s_fn_tableSharding.dispatchTableByModel><td><code><a href=#fn_tableSharding.dispatchTableByModel>tableSharding.dispatchTableByModel(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>75.6%</code><td class=linecount><code>31/41</code><tr id=s_fn_shardingMigrator.getShardingDst><td><code><a href=#fn_shardingMigrator.getShardingDst>shardingMigrator.getShardingDst(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>75.0%</code><td class=linecount><code>9/12</code><tr id=s_fn_tableSharding.getModelReflectValue><td><code><a href=#fn_tableSharding.getModelReflectValue>tableSharding.getModelReflectValue(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>75.0%</code><td class=linecount><code>6/8</code><tr id=s_fn_shardingMigrator.tableName><td><code><a href=#fn_shardingMigrator.tableName>shardingMigrator.tableName(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>75.0%</code><td class=linecount><code>6/8</code><tr id=s_fn_tableSharding.wrapDispatchTableBySQL><td><code><a href=#fn_tableSharding.wrapDispatchTableBySQL>tableSharding.wrapDispatchTableBySQL(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_tableSharding.ignore><td><code><a href=#fn_tableSharding.ignore>tableSharding.ignore(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_tableSharding.nonInsertValue><td><code><a href=#fn_tableSharding.nonInsertValue>tableSharding.nonInsertValue(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>71.4%</code><td class=linecount><code>5/7</code><tr id=s_fn_tableSharding.defaultShardingFunc><td><code><a href=#fn_tableSharding.defaultShardingFunc>tableSharding.defaultShardingFunc(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>68.0%</code><td class=linecount><code>17/25</code><tr id=s_fn_tableSharding.ShardingIDGen><td><code><a href=#fn_tableSharding.ShardingIDGen>tableSharding.ShardingIDGen(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_@1093:5><td><code><a href=#fn_@1093:5>@1093:5(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>60.0%</code><td class=linecount><code>3/5</code><tr id=s_fn_@1106:10><td><code><a href=#fn_@1106:10>@1106:10(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>58.6%</code><td class=linecount><code>17/29</code><tr id=s_fn_tableSharding.createTableIfNotExists><td><code><a href=#fn_tableSharding.createTableIfNotExists>tableSharding.createTableIfNotExists(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>54.5%</code><td class=linecount><code>12/22</code><tr id=s_fn_@1080:5><td><code><a href=#fn_@1080:5>@1080:5(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>37.5%</code><td class=linecount><code>3/8</code><tr id=s_fn_tableSharding.dispatchTableBySQL><td><code><a href=#fn_tableSharding.dispatchTableBySQL>tableSharding.dispatchTableBySQL(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>34.7%</code><td class=linecount><code>26/75</code><tr id=s_fn_@580:20><td><code><a href=#fn_@580:20>@580:20(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>20.0%</code><td class=linecount><code>6/30</code><tr id=s_fn_tableSharding.insertValue><td><code><a href=#fn_tableSharding.insertValue>tableSharding.insertValue(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/35</code><tr id=s_fn_tableSharding.ShardingByValues><td><code><a href=#fn_tableSharding.ShardingByValues>tableSharding.ShardingByValues(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/15</code><tr id=s_fn_@655:11><td><code><a href=#fn_@655:11>@655:11(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/12</code><tr id=s_fn_@581:22><td><code><a href=#fn_@581:22>@581:22(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/8</code><tr id=s_fn_@241:3><td><code><a href=#fn_@241:3>@241:3(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@263:3><td><code><a href=#fn_@263:3>@263:3(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_shardingDialector.SavePoint><td><code><a href=#fn_shardingDialector.SavePoint>shardingDialector.SavePoint(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_shardingDialector.RollbackTo><td><code><a href=#fn_shardingDialector.RollbackTo>shardingDialector.RollbackTo(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@674:15><td><code><a href=#fn_@674:15>@674:15(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@284:3><td><code><a href=#fn_@284:3>@284:3(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@285:3><td><code><a href=#fn_@285:3>@285:3(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@1003:10><td><code><a href=#fn_@1003:10>@1003:10(...)</a></code><td><code>github.com/wfusion/gofusion/db/plugins/table_sharding.go</code><td class=percent><code>100.0%</code><td class=linecount><code>0/0</code></table><div class=funcname id=fn_tableSharding.replaceStatementClauseAndSchema>func tableSharding.replaceStatementClauseAndSchema</div><div class=info><a href=#s_fn_tableSharding.replaceStatementClauseAndSchema>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>579<td><code><pre>func (t *tableSharding) replaceStatementClauseAndSchema(db *gorm.DB, opt *tableShardingDispatchOption) {</pre></code><tr><td>580<td><code><pre> changeExprFunc := func(src []clause.Expression) (dst []clause.Expression) {</pre></code><tr><td>581<td><code><pre> changeTableFunc := func(src any) (dst any, ok bool) {</pre></code><tr><td>582<td><code><pre> switch col := src.(type) {</pre></code><tr><td>583<td><code><pre> case clause.Column:</pre></code><tr><td>584<td><code><pre> if col.Table == t.config.Table {</pre></code><tr><td>585<td><code><pre> col.Table = db.Statement.Table</pre></code><tr><td>586<td><code><pre> return col, true</pre></code><tr><td>587<td><code><pre> }</pre></code><tr><td>588<td><code><pre> case clause.Table:</pre></code><tr><td>589<td><code><pre> if col.Name == t.config.Table {</pre></code><tr><td>590<td><code><pre> col.Name = db.Statement.Table</pre></code><tr><td>591<td><code><pre> return col, true</pre></code><tr><td>592<td><code><pre> }</pre></code><tr><td>593<td><code><pre> }</pre></code><tr><td>594<td><code><pre> return</pre></code><tr><td>595<td><code><pre> }</pre></code><tr><td>596<td><code><pre> dst = make([]clause.Expression, 0, len(src))</pre></code><tr><td>597<td><code><pre> for _, srcExpr := range src {</pre></code><tr><td>598<td><code><pre> switch expr := srcExpr.(type) {</pre></code><tr><td>599<td><code><pre> case clause.IN:</pre></code><tr><td>600<td><code><pre> if col, ok := changeTableFunc(expr.Column); ok {</pre></code><tr><td>601<td><code><pre> expr.Column = col</pre></code><tr><td>602<td><code><pre> }</pre></code><tr><td>603<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>604<td><code><pre> case clause.Eq:</pre></code><tr><td>605<td><code><pre> if col, ok := changeTableFunc(expr.Column); ok {</pre></code><tr><td>606<td><code><pre> expr.Column = col</pre></code><tr><td>607<td><code><pre> }</pre></code><tr><td>608<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>609<td><code><pre> case clause.Neq:</pre></code><tr><td>610<td><code><pre> if col, ok := changeTableFunc(expr.Column); ok {</pre></code><tr><td>611<td><code><pre> expr.Column = col</pre></code><tr><td>612<td><code><pre> }</pre></code><tr><td>613<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>614<td><code><pre> case clause.Gt:</pre></code><tr><td>615<td><code><pre> if col, ok := changeTableFunc(expr.Column); ok {</pre></code><tr><td>616<td><code><pre> expr.Column = col</pre></code><tr><td>617<td><code><pre> }</pre></code><tr><td>618<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>619<td><code><pre> case clause.Gte:</pre></code><tr><td>620<td><code><pre> if col, ok := changeTableFunc(expr.Column); ok {</pre></code><tr><td>621<td><code><pre> expr.Column = col</pre></code><tr><td>622<td><code><pre> }</pre></code><tr><td>623<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>624<td><code><pre> case clause.Lt:</pre></code><tr><td>625<td><code><pre> if col, ok := changeTableFunc(expr.Column); ok {</pre></code><tr><td>626<td><code><pre> expr.Column = col</pre></code><tr><td>627<td><code><pre> }</pre></code><tr><td>628<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>629<td><code><pre> case clause.Lte:</pre></code><tr><td>630<td><code><pre> if col, ok := changeTableFunc(expr.Column); ok {</pre></code><tr><td>631<td><code><pre> expr.Column = col</pre></code><tr><td>632<td><code><pre> }</pre></code><tr><td>633<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>634<td><code><pre> case clause.Like:</pre></code><tr><td>635<td><code><pre> if col, ok := changeTableFunc(expr.Column); ok {</pre></code><tr><td>636<td><code><pre> expr.Column = col</pre></code><tr><td>637<td><code><pre> }</pre></code><tr><td>638<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>639<td><code><pre> default:</pre></code><tr><td>640<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>641<td><code><pre> }</pre></code><tr><td>642<td><code><pre> }</pre></code><tr><td>643<td><code><pre> return</pre></code><tr><td>644<td><code><pre> }</pre></code><tr><td>645<td><code><pre> changeClausesMapping := map[string]func(cls clause.Clause){</pre></code><tr><td>646<td><code><pre> "WHERE": func(cls clause.Clause) {</pre></code><tr><td>647<td><code><pre> whereClause, ok := cls.Expression.(clause.Where)</pre></code><tr><td>648<td><code><pre> if !ok {</pre></code><tr><td>649<td><code><pre> return</pre></code><tr><td>650<td><code><pre> }</pre></code><tr><td>651<td><code><pre> whereClause.Exprs = changeExprFunc(whereClause.Exprs)</pre></code><tr><td>652<td><code><pre> cls.Expression = whereClause</pre></code><tr><td>653<td><code><pre> db.Statement.Clauses["WHERE"] = cls</pre></code><tr><td>654<td><code><pre> },</pre></code><tr><td>655<td><code><pre> "FROM": func(cls clause.Clause) {</pre></code><tr><td>656<td><code><pre> fromClause, ok := cls.Expression.(clause.From)</pre></code><tr><td>657<td><code><pre> if !ok {</pre></code><tr><td>658<td><code><pre> return</pre></code><tr><td>659<td><code><pre> }</pre></code><tr><td>660<td><code><pre> tables := make([]clause.Table, 0, len(fromClause.Tables))</pre></code><tr><td>661<td><code><pre> for _, table := range fromClause.Tables {</pre></code><tr><td>662<td><code><pre> if table.Name == t.config.Table {</pre></code><tr><td>663<td><code><pre> table.Name = db.Statement.Table</pre></code><tr><td>664<td><code><pre> tables = append(tables, table)</pre></code><tr><td>665<td><code><pre> } else {</pre></code><tr><td>666<td><code><pre> tables = append(tables, table)</pre></code><tr><td>667<td><code><pre> }</pre></code><tr><td>668<td><code><pre> }</pre></code><tr><td>669<td><code><pre> fromClause.Tables = tables</pre></code><tr><td>670<td><code><pre> cls.Expression = fromClause</pre></code><tr><td>671<td><code><pre> db.Statement.Clauses["FROM"] = cls</pre></code><tr><td>672<td><code><pre> },</pre></code><tr><td>673<td><code><pre> // TODO: check if order by contains table name</pre></code><tr><td>674<td><code><pre> "ORDER BY": func(cls clause.Clause) {</pre></code><tr><td>675<td><code><pre> _, ok := cls.Expression.(clause.OrderBy)</pre></code><tr><td>676<td><code><pre> if !ok {</pre></code><tr><td>677<td><code><pre> return</pre></code><tr><td>678<td><code><pre> }</pre></code><tr><td>679<td><code><pre> },</pre></code><tr><td>680<td><code><pre> }</pre></code><tr><td>681<td><code><pre></pre></code><tr><td>682<td><code><pre> for name, cls := range db.Statement.Clauses {</pre></code><tr><td>683<td><code><pre> if mappingFunc, ok := changeClausesMapping[name]; ok {</pre></code><tr><td>684<td><code><pre> mappingFunc(cls)</pre></code><tr><td>685<td><code><pre> }</pre></code><tr><td>686<td><code><pre> }</pre></code><tr><td>687<td><code><pre></pre></code><tr><td>688<td><code><pre> if opt.isInsert {</pre></code><tr><td>689<td><code><pre> db.Clauses(clause.Insert{Table: clause.Table{Name: db.Statement.Table}})</pre></code><tr><td>690<td><code><pre> } else {</pre></code><tr><td>691<td><code><pre> db.Clauses(clause.From{Tables: []clause.Table{{Name: db.Statement.Table}}})</pre></code><tr><td>692<td><code><pre> }</pre></code><tr><td>693<td><code><pre>}</pre></code></table><div class=funcname id=fn_@697:23>func @697:23</div><div class=info><a href=#s_fn_@697:23>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>697<td><code><pre>func(node sqlparser.Node) (err error) {</pre></code><tr><td>698<td><code><pre> n, ok := node.(*sqlparser.BinaryExpr)</pre></code><tr><td>699<td><code><pre> if !ok {</pre></code><tr><td>700<td><code><pre> return</pre></code><tr><td>701<td><code><pre> }</pre></code><tr><td>702<td><code><pre></pre></code><tr><td>703<td><code><pre> x, ok := n.X.(*sqlparser.QualifiedRef)</pre></code><tr><td>704<td><code><pre> if !ok || x.Table == nil || x.Table.Name != oldTableName {</pre></code><tr><td>705<td><code><pre> return</pre></code><tr><td>706<td><code><pre> }</pre></code><tr><td>707<td><code><pre></pre></code><tr><td>708<td><code><pre> x.Table.Name = newTableName</pre></code><tr><td>709<td><code><pre> return</pre></code><tr><td>710<td><code><pre> }</pre></code></table><div class=funcname id=fn_tableSharding.registerCallbacks>func tableSharding.registerCallbacks</div><div class=info><a href=#s_fn_tableSharding.registerCallbacks>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>203<td><code><pre>func (t *tableSharding) registerCallbacks(db *gorm.DB) {</pre></code><tr><td>204<td><code><pre> utils.MustSuccess(db.Callback().</pre></code><tr><td>205<td><code><pre> Create().</pre></code><tr><td>206<td><code><pre> After("gorm:before_create").</pre></code><tr><td>207<td><code><pre> Before("gorm:save_before_associations").</pre></code><tr><td>208<td><code><pre> Register(t.Name(), t.createCallback))</pre></code><tr><td>209<td><code><pre></pre></code><tr><td>210<td><code><pre> utils.MustSuccess(db.Callback().</pre></code><tr><td>211<td><code><pre> Query().</pre></code><tr><td>212<td><code><pre> Before("gorm:query").</pre></code><tr><td>213<td><code><pre> Register(t.Name(), t.queryCallback))</pre></code><tr><td>214<td><code><pre></pre></code><tr><td>215<td><code><pre> utils.MustSuccess(db.Callback().</pre></code><tr><td>216<td><code><pre> Update().</pre></code><tr><td>217<td><code><pre> After("gorm:before_update").</pre></code><tr><td>218<td><code><pre> Before("gorm:save_before_associations").</pre></code><tr><td>219<td><code><pre> Register(t.Name(), t.updateCallback))</pre></code><tr><td>220<td><code><pre></pre></code><tr><td>221<td><code><pre> utils.MustSuccess(db.Callback().</pre></code><tr><td>222<td><code><pre> Delete().</pre></code><tr><td>223<td><code><pre> After("gorm:before_delete").</pre></code><tr><td>224<td><code><pre> Before("gorm:delete_before_associations").</pre></code><tr><td>225<td><code><pre> Register(t.Name(), t.deleteCallback))</pre></code><tr><td>226<td><code><pre></pre></code><tr><td>227<td><code><pre> utils.MustSuccess(db.Callback().</pre></code><tr><td>228<td><code><pre> Row().</pre></code><tr><td>229<td><code><pre> Before("gorm:row").</pre></code><tr><td>230<td><code><pre> Register(t.Name(), t.queryCallback))</pre></code><tr><td>231<td><code><pre></pre></code><tr><td>232<td><code><pre> utils.MustSuccess(db.Callback().</pre></code><tr><td>233<td><code><pre> Raw().</pre></code><tr><td>234<td><code><pre> Before("gorm:raw").</pre></code><tr><td>235<td><code><pre> Register(t.Name(), t.rawCallback))</pre></code><tr><td>236<td><code><pre>}</pre></code></table><div class=funcname id=fn_tableSharding.replaceOrderByTableName>func tableSharding.replaceOrderByTableName</div><div class=info><a href=#s_fn_tableSharding.replaceOrderByTableName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>938<td><code><pre>func (t *tableSharding) replaceOrderByTableName(</pre></code><tr><td>939<td><code><pre> orderBy []*sqlparser.OrderingTerm, oldName, newName string) []*sqlparser.OrderingTerm {</pre></code><tr><td>940<td><code><pre> for i, term := range orderBy {</pre></code><tr><td>941<td><code><pre> if x, ok := term.X.(*sqlparser.QualifiedRef); ok {</pre></code><tr><td>942<td><code><pre> if x.Table.Name == oldName {</pre></code><tr><td>943<td><code><pre> x.Table.Name = newName</pre></code><tr><td>944<td><code><pre> orderBy[i].X = x</pre></code><tr><td>945<td><code><pre> }</pre></code><tr><td>946<td><code><pre> }</pre></code><tr><td>947<td><code><pre> }</pre></code><tr><td>948<td><code><pre> return orderBy</pre></code><tr><td>949<td><code><pre>}</pre></code></table><div class=funcname id=fn_tableSharding.Initialize>func tableSharding.Initialize</div><div class=info><a href=#s_fn_tableSharding.Initialize>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>136<td><code><pre>func (t *tableSharding) Initialize(db *gorm.DB) (err error) {</pre></code><tr><td>137<td><code><pre> db.Dialector = newShardingDialector(db.Dialector, t)</pre></code><tr><td>138<td><code><pre></pre></code><tr><td>139<td><code><pre> t.DB = db</pre></code><tr><td>140<td><code><pre> t.shardingFunc = t.defaultShardingFunc()</pre></code><tr><td>141<td><code><pre> t.registerCallbacks(db)</pre></code><tr><td>142<td><code><pre> return</pre></code><tr><td>143<td><code><pre>}</pre></code></table><div class=funcname id=fn_@718:23>func @718:23</div><div class=info><a href=#s_fn_@718:23>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>718<td><code><pre>func(node sqlparser.Node) (err error) {</pre></code><tr><td>719<td><code><pre> n, ok := node.(*sqlparser.QualifiedRef)</pre></code><tr><td>720<td><code><pre> if !ok || n.Table == nil || n.Table.Name != oldTableName {</pre></code><tr><td>721<td><code><pre> return</pre></code><tr><td>722<td><code><pre> }</pre></code><tr><td>723<td><code><pre></pre></code><tr><td>724<td><code><pre> n.Table.Name = newTableName</pre></code><tr><td>725<td><code><pre> return</pre></code><tr><td>726<td><code><pre> }</pre></code></table><div class=funcname id=fn_newShardingDialector>func newShardingDialector</div><div class=info><a href=#s_fn_newShardingDialector>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1163<td><code><pre>func newShardingDialector(d gorm.Dialector, s *tableSharding) shardingDialector {</pre></code><tr><td>1164<td><code><pre> if sd, ok := d.(shardingDialector); ok {</pre></code><tr><td>1165<td><code><pre> sd.shardingMap[s.config.Table] = s</pre></code><tr><td>1166<td><code><pre> return sd</pre></code><tr><td>1167<td><code><pre> }</pre></code><tr><td>1168<td><code><pre></pre></code><tr><td>1169<td><code><pre> return shardingDialector{</pre></code><tr><td>1170<td><code><pre> Dialector: d,</pre></code><tr><td>1171<td><code><pre> shardingMap: map[string]*tableSharding{s.config.Table: s},</pre></code><tr><td>1172<td><code><pre> }</pre></code><tr><td>1173<td><code><pre>}</pre></code></table><div class=funcname id=fn_shardingDialector.Migrator>func shardingDialector.Migrator</div><div class=info><a href=#s_fn_shardingDialector.Migrator>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1175<td><code><pre>func (s shardingDialector) Migrator(db *gorm.DB) gorm.Migrator {</pre></code><tr><td>1176<td><code><pre> m := s.Dialector.Migrator(db)</pre></code><tr><td>1177<td><code><pre> if (*tableSharding)(nil).isIgnored(db)() {</pre></code><tr><td>1178<td><code><pre> return m</pre></code><tr><td>1179<td><code><pre> }</pre></code><tr><td>1180<td><code><pre> return &shardingMigrator{</pre></code><tr><td>1181<td><code><pre> Migrator: m,</pre></code><tr><td>1182<td><code><pre> db: db,</pre></code><tr><td>1183<td><code><pre> shardingMap: s.shardingMap,</pre></code><tr><td>1184<td><code><pre> dialector: s.Dialector,</pre></code><tr><td>1185<td><code><pre> }</pre></code><tr><td>1186<td><code><pre>}</pre></code></table><div class=funcname id=fn_@252:3>func @252:3</div><div class=info><a href=#s_fn_@252:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>252<td><code><pre>func() bool {</pre></code><tr><td>253<td><code><pre> callbacks.BuildQuerySQL(db)</pre></code><tr><td>254<td><code><pre> t.wrapDispatchTableBySQL(db)</pre></code><tr><td>255<td><code><pre> return true</pre></code><tr><td>256<td><code><pre> }</pre></code></table><div class=funcname id=fn_@274:3>func @274:3</div><div class=info><a href=#s_fn_@274:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>274<td><code><pre>func() bool {</pre></code><tr><td>275<td><code><pre> callbacks.BuildDeleteSQL(db)</pre></code><tr><td>276<td><code><pre> t.wrapDispatchTableBySQL(db)</pre></code><tr><td>277<td><code><pre> return true</pre></code><tr><td>278<td><code><pre> }</pre></code></table><div class=funcname id=fn_@1102:5>func @1102:5</div><div class=info><a href=#s_fn_@1102:5>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1102<td><code><pre>func() bool { data = []byte(v); return true }</pre></code></table><div class=funcname id=fn_@240:3>func @240:3</div><div class=info><a href=#s_fn_@240:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>240<td><code><pre>func() bool { ok1, ok2 := t.dispatchTableByModel(db, tableShardingIsInsert()); return ok1 || ok2 }</pre></code></table><div class=funcname id=fn_@1077:28>func @1077:28</div><div class=info><a href=#s_fn_@1077:28>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1077<td><code><pre>func(v string) (data []byte) {</pre></code><tr><td>1078<td><code><pre> utils.IfAny(</pre></code><tr><td>1079<td><code><pre> // number</pre></code><tr><td>1080<td><code><pre> func() (ok bool) {</pre></code><tr><td>1081<td><code><pre> num := new(big.Float)</pre></code><tr><td>1082<td><code><pre> if _, ok = num.SetString(v); !ok {</pre></code><tr><td>1083<td><code><pre> return</pre></code><tr><td>1084<td><code><pre> }</pre></code><tr><td>1085<td><code><pre> gobEncoded, err := num.GobEncode()</pre></code><tr><td>1086<td><code><pre> if err != nil {</pre></code><tr><td>1087<td><code><pre> return false</pre></code><tr><td>1088<td><code><pre> }</pre></code><tr><td>1089<td><code><pre> data = gobEncoded</pre></code><tr><td>1090<td><code><pre> return</pre></code><tr><td>1091<td><code><pre> },</pre></code><tr><td>1092<td><code><pre> // uuid</pre></code><tr><td>1093<td><code><pre> func() bool {</pre></code><tr><td>1094<td><code><pre> uid, err := uuid.Parse(v)</pre></code><tr><td>1095<td><code><pre> if err != nil {</pre></code><tr><td>1096<td><code><pre> return false</pre></code><tr><td>1097<td><code><pre> }</pre></code><tr><td>1098<td><code><pre> data = uid[:]</pre></code><tr><td>1099<td><code><pre> return true</pre></code><tr><td>1100<td><code><pre> },</pre></code><tr><td>1101<td><code><pre> // bytes</pre></code><tr><td>1102<td><code><pre> func() bool { data = []byte(v); return true },</pre></code><tr><td>1103<td><code><pre> )</pre></code><tr><td>1104<td><code><pre> return</pre></code><tr><td>1105<td><code><pre> }</pre></code></table><div class=funcname id=fn_tableSharding.replaceCondition>func tableSharding.replaceCondition</div><div class=info><a href=#s_fn_tableSharding.replaceCondition>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>695<td><code><pre>func (t *tableSharding) replaceCondition(conditions sqlparser.Expr, oldTableName, newTableName string) (err error) {</pre></code><tr><td>696<td><code><pre> err = sqlparser.Walk(</pre></code><tr><td>697<td><code><pre> sqlparser.VisitFunc(func(node sqlparser.Node) (err error) {</pre></code><tr><td>698<td><code><pre> n, ok := node.(*sqlparser.BinaryExpr)</pre></code><tr><td>699<td><code><pre> if !ok {</pre></code><tr><td>700<td><code><pre> return</pre></code><tr><td>701<td><code><pre> }</pre></code><tr><td>702<td><code><pre></pre></code><tr><td>703<td><code><pre> x, ok := n.X.(*sqlparser.QualifiedRef)</pre></code><tr><td>704<td><code><pre> if !ok || x.Table == nil || x.Table.Name != oldTableName {</pre></code><tr><td>705<td><code><pre> return</pre></code><tr><td>706<td><code><pre> }</pre></code><tr><td>707<td><code><pre></pre></code><tr><td>708<td><code><pre> x.Table.Name = newTableName</pre></code><tr><td>709<td><code><pre> return</pre></code><tr><td>710<td><code><pre> }),</pre></code><tr><td>711<td><code><pre> conditions,</pre></code><tr><td>712<td><code><pre> )</pre></code><tr><td>713<td><code><pre> return</pre></code><tr><td>714<td><code><pre>}</pre></code></table><div class=funcname id=fn_@251:3>func @251:3</div><div class=info><a href=#s_fn_@251:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>251<td><code><pre>func() bool { ok1, ok2 := t.dispatchTableByModel(db); return ok1 || ok2 }</pre></code></table><div class=funcname id=fn_@1011:9>func @1011:9</div><div class=info><a href=#s_fn_@1011:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1011<td><code><pre>func() bool {</pre></code><tr><td>1012<td><code><pre> _, ok := db.Statement.Settings.Load(shardingIgnoreStoreKey)</pre></code><tr><td>1013<td><code><pre> return ok</pre></code><tr><td>1014<td><code><pre> }</pre></code></table><div class=funcname id=fn_@262:3>func @262:3</div><div class=info><a href=#s_fn_@262:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>262<td><code><pre>func() bool { ok1, ok2 := t.dispatchTableByModel(db); return ok1 || ok2 }</pre></code></table><div class=funcname id=fn_@273:3>func @273:3</div><div class=info><a href=#s_fn_@273:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>273<td><code><pre>func() bool { ok1, ok2 := t.dispatchTableByModel(db); return ok1 || ok2 }</pre></code></table><div class=funcname id=fn_@294:9>func @294:9</div><div class=info><a href=#s_fn_@294:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>294<td><code><pre>func(t *tableShardingDispatchOption) {</pre></code><tr><td>295<td><code><pre> t.isInsert = true</pre></code><tr><td>296<td><code><pre> }</pre></code></table><div class=funcname id=fn_tableSharding.updateCallback>func tableSharding.updateCallback</div><div class=info><a href=#s_fn_tableSharding.updateCallback>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>259<td><code><pre>func (t *tableSharding) updateCallback(db *gorm.DB) {</pre></code><tr><td>260<td><code><pre> utils.IfAny(</pre></code><tr><td>261<td><code><pre> t.isIgnored(db),</pre></code><tr><td>262<td><code><pre> func() bool { ok1, ok2 := t.dispatchTableByModel(db); return ok1 || ok2 },</pre></code><tr><td>263<td><code><pre> func() bool {</pre></code><tr><td>264<td><code><pre> callbacks.BuildUpdateSQL(db)</pre></code><tr><td>265<td><code><pre> t.wrapDispatchTableBySQL(db)</pre></code><tr><td>266<td><code><pre> return true</pre></code><tr><td>267<td><code><pre> },</pre></code><tr><td>268<td><code><pre> )</pre></code><tr><td>269<td><code><pre>}</pre></code></table><div class=funcname id=fn_tableSharding.rawCallback>func tableSharding.rawCallback</div><div class=info><a href=#s_fn_tableSharding.rawCallback>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>281<td><code><pre>func (t *tableSharding) rawCallback(db *gorm.DB) {</pre></code><tr><td>282<td><code><pre> utils.IfAny(</pre></code><tr><td>283<td><code><pre> t.isIgnored(db),</pre></code><tr><td>284<td><code><pre> func() bool { ok1, ok2 := t.dispatchTableByModel(db); return ok1 || ok2 },</pre></code><tr><td>285<td><code><pre> func() bool { t.wrapDispatchTableBySQL(db); return true },</pre></code><tr><td>286<td><code><pre> )</pre></code><tr><td>287<td><code><pre>}</pre></code></table><div class=funcname id=fn_tableSharding.queryCallback>func tableSharding.queryCallback</div><div class=info><a href=#s_fn_tableSharding.queryCallback>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>248<td><code><pre>func (t *tableSharding) queryCallback(db *gorm.DB) {</pre></code><tr><td>249<td><code><pre> utils.IfAny(</pre></code><tr><td>250<td><code><pre> t.isIgnored(db),</pre></code><tr><td>251<td><code><pre> func() bool { ok1, ok2 := t.dispatchTableByModel(db); return ok1 || ok2 },</pre></code><tr><td>252<td><code><pre> func() bool {</pre></code><tr><td>253<td><code><pre> callbacks.BuildQuerySQL(db)</pre></code><tr><td>254<td><code><pre> t.wrapDispatchTableBySQL(db)</pre></code><tr><td>255<td><code><pre> return true</pre></code><tr><td>256<td><code><pre> },</pre></code><tr><td>257<td><code><pre> )</pre></code><tr><td>258<td><code><pre>}</pre></code></table><div class=funcname id=fn_@917:42>func @917:42</div><div class=info><a href=#s_fn_@917:42>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>917<td><code><pre>func(v string) bool { return strings.EqualFold(v, key) }</pre></code></table><div class=funcname id=fn_tableShardingIsInsert>func tableShardingIsInsert</div><div class=info><a href=#s_fn_tableShardingIsInsert>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>293<td><code><pre>func tableShardingIsInsert() utils.OptionFunc[tableShardingDispatchOption] {</pre></code><tr><td>294<td><code><pre> return func(t *tableShardingDispatchOption) {</pre></code><tr><td>295<td><code><pre> t.isInsert = true</pre></code><tr><td>296<td><code><pre> }</pre></code><tr><td>297<td><code><pre>}</pre></code></table><div class=funcname id=fn_tableSharding.isIgnored>func tableSharding.isIgnored</div><div class=info><a href=#s_fn_tableSharding.isIgnored>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1010<td><code><pre>func (t *tableSharding) isIgnored(db *gorm.DB) func() bool {</pre></code><tr><td>1011<td><code><pre> return func() bool {</pre></code><tr><td>1012<td><code><pre> _, ok := db.Statement.Settings.Load(shardingIgnoreStoreKey)</pre></code><tr><td>1013<td><code><pre> return ok</pre></code><tr><td>1014<td><code><pre> }</pre></code><tr><td>1015<td><code><pre>}</pre></code></table><div class=funcname id=fn_tableSharding.createCallback>func tableSharding.createCallback</div><div class=info><a href=#s_fn_tableSharding.createCallback>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>237<td><code><pre>func (t *tableSharding) createCallback(db *gorm.DB) {</pre></code><tr><td>238<td><code><pre> utils.IfAny(</pre></code><tr><td>239<td><code><pre> t.isIgnored(db),</pre></code><tr><td>240<td><code><pre> func() bool { ok1, ok2 := t.dispatchTableByModel(db, tableShardingIsInsert()); return ok1 || ok2 },</pre></code><tr><td>241<td><code><pre> func() bool {</pre></code><tr><td>242<td><code><pre> callbacks.BuildCreateSQL(db)</pre></code><tr><td>243<td><code><pre> t.wrapDispatchTableBySQL(db, tableShardingIsInsert())</pre></code><tr><td>244<td><code><pre> return true</pre></code><tr><td>245<td><code><pre> },</pre></code><tr><td>246<td><code><pre> )</pre></code><tr><td>247<td><code><pre>}</pre></code></table><div class=funcname id=fn_@332:37>func @332:37</div><div class=info><a href=#s_fn_@332:37>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>332<td><code><pre>func(v string) bool { return strings.EqualFold(v, key) }</pre></code></table><div class=funcname id=fn_tableSharding.replaceConstraint>func tableSharding.replaceConstraint</div><div class=info><a href=#s_fn_tableSharding.replaceConstraint>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>716<td><code><pre>func (t *tableSharding) replaceConstraint(constraints sqlparser.Node, oldTableName, newTableName string) (err error) {</pre></code><tr><td>717<td><code><pre> return sqlparser.Walk(</pre></code><tr><td>718<td><code><pre> sqlparser.VisitFunc(func(node sqlparser.Node) (err error) {</pre></code><tr><td>719<td><code><pre> n, ok := node.(*sqlparser.QualifiedRef)</pre></code><tr><td>720<td><code><pre> if !ok || n.Table == nil || n.Table.Name != oldTableName {</pre></code><tr><td>721<td><code><pre> return</pre></code><tr><td>722<td><code><pre> }</pre></code><tr><td>723<td><code><pre></pre></code><tr><td>724<td><code><pre> n.Table.Name = newTableName</pre></code><tr><td>725<td><code><pre> return</pre></code><tr><td>726<td><code><pre> }),</pre></code><tr><td>727<td><code><pre> constraints,</pre></code><tr><td>728<td><code><pre> )</pre></code><tr><td>729<td><code><pre>}</pre></code></table><div class=funcname id=fn_@151:33>func @151:33</div><div class=info><a href=#s_fn_@151:33>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>151<td><code><pre>func(v string) bool { return strings.EqualFold(v, key) }</pre></code></table><div class=funcname id=fn_tableSharding.Name>func tableSharding.Name</div><div class=info><a href=#s_fn_tableSharding.Name>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>132<td><code><pre>func (t *tableSharding) Name() string {</pre></code><tr><td>133<td><code><pre> return fmt.Sprintf("gorm:sharding:%s:%s", t.config.Database, t.config.Table)</pre></code><tr><td>134<td><code><pre>}</pre></code></table><div class=funcname id=fn_tableSharding.deleteCallback>func tableSharding.deleteCallback</div><div class=info><a href=#s_fn_tableSharding.deleteCallback>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>270<td><code><pre>func (t *tableSharding) deleteCallback(db *gorm.DB) {</pre></code><tr><td>271<td><code><pre> utils.IfAny(</pre></code><tr><td>272<td><code><pre> t.isIgnored(db),</pre></code><tr><td>273<td><code><pre> func() bool { ok1, ok2 := t.dispatchTableByModel(db); return ok1 || ok2 },</pre></code><tr><td>274<td><code><pre> func() bool {</pre></code><tr><td>275<td><code><pre> callbacks.BuildDeleteSQL(db)</pre></code><tr><td>276<td><code><pre> t.wrapDispatchTableBySQL(db)</pre></code><tr><td>277<td><code><pre> return true</pre></code><tr><td>278<td><code><pre> },</pre></code><tr><td>279<td><code><pre> )</pre></code><tr><td>280<td><code><pre>}</pre></code></table><div class=funcname id=fn_@1006:9>func @1006:9</div><div class=info><a href=#s_fn_@1006:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1006<td><code><pre>func() {</pre></code><tr><td>1007<td><code><pre> db.Statement.Settings.Delete(shardingIgnoreStoreKey)</pre></code><tr><td>1008<td><code><pre> }</pre></code></table><div class=funcname id=fn_tableSharding.checkDiffSuffixesByModel>func tableSharding.checkDiffSuffixesByModel</div><div class=info><a href=#s_fn_tableSharding.checkDiffSuffixesByModel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>906<td><code><pre>func (t *tableSharding) checkDiffSuffixesByModel(db *gorm.DB) (err error) {</pre></code><tr><td>907<td><code><pre> reflectVal := utils.IndirectValue(db.Statement.ReflectValue)</pre></code><tr><td>908<td><code><pre> if reflectVal.Kind() != reflect.Array && reflectVal.Kind() != reflect.Slice {</pre></code><tr><td>909<td><code><pre> return</pre></code><tr><td>910<td><code><pre> }</pre></code><tr><td>911<td><code><pre></pre></code><tr><td>912<td><code><pre> suffix := ""</pre></code><tr><td>913<td><code><pre> for i := 0; i < reflectVal.Len(); i++ {</pre></code><tr><td>914<td><code><pre> reflectItemVal := reflect.Indirect(reflectVal.Index(i))</pre></code><tr><td>915<td><code><pre> values := make([]any, 0, len(t.config.ShardingKeys))</pre></code><tr><td>916<td><code><pre> for _, key := range t.config.ShardingKeys {</pre></code><tr><td>917<td><code><pre> val := reflectItemVal.FieldByNameFunc(func(v string) bool { return strings.EqualFold(v, key) })</pre></code><tr><td>918<td><code><pre> if !val.IsValid() {</pre></code><tr><td>919<td><code><pre> val, _ = utils.GetGormColumnValue(reflectItemVal, key)</pre></code><tr><td>920<td><code><pre> }</pre></code><tr><td>921<td><code><pre> if !val.IsValid() {</pre></code><tr class=miss><td>922<td><code><pre> return db.AddError(ErrMissingShardingKey)</pre></code><tr><td>923<td><code><pre> }</pre></code><tr><td>924<td><code><pre> values = append(values, val.Interface())</pre></code><tr><td>925<td><code><pre> }</pre></code><tr><td>926<td><code><pre> subSuffix, err := t.shardingFunc(db.Statement.Context, values...)</pre></code><tr><td>927<td><code><pre> if err != nil {</pre></code><tr class=miss><td>928<td><code><pre> return db.AddError(err)</pre></code><tr><td>929<td><code><pre> }</pre></code><tr><td>930<td><code><pre> if suffix != "" && suffix != subSuffix {</pre></code><tr><td>931<td><code><pre> return db.AddError(ErrDiffSuffixDML)</pre></code><tr><td>932<td><code><pre> }</pre></code><tr><td>933<td><code><pre> suffix = subSuffix</pre></code><tr><td>934<td><code><pre> }</pre></code><tr><td>935<td><code><pre> return</pre></code><tr><td>936<td><code><pre>}</pre></code></table><div class=funcname id=fn_@804:23>func @804:23</div><div class=info><a href=#s_fn_@804:23>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>804<td><code><pre>func(node sqlparser.Node) (err error) {</pre></code><tr><td>805<td><code><pre> n, ok := node.(*sqlparser.BinaryExpr)</pre></code><tr><td>806<td><code><pre> if !ok {</pre></code><tr><td>807<td><code><pre> return</pre></code><tr><td>808<td><code><pre> }</pre></code><tr><td>809<td><code><pre> if n.Op != sqlparser.EQ {</pre></code><tr><td>810<td><code><pre> return</pre></code><tr><td>811<td><code><pre> }</pre></code><tr><td>812<td><code><pre></pre></code><tr><td>813<td><code><pre> switch x := n.X.(type) {</pre></code><tr><td>814<td><code><pre> case *sqlparser.Ident:</pre></code><tr><td>815<td><code><pre> if x.Name != key {</pre></code><tr><td>816<td><code><pre> return</pre></code><tr><td>817<td><code><pre> }</pre></code><tr><td>818<td><code><pre> case *sqlparser.QualifiedRef:</pre></code><tr><td>819<td><code><pre> if !ok || x.Table.Name != tableName || x.Column.Name != key {</pre></code><tr><td>820<td><code><pre> return</pre></code><tr><td>821<td><code><pre> }</pre></code><tr><td>822<td><code><pre> }</pre></code><tr><td>823<td><code><pre></pre></code><tr><td>824<td><code><pre> found = true</pre></code><tr><td>825<td><code><pre> switch expr := n.Y.(type) {</pre></code><tr><td>826<td><code><pre> case *sqlparser.BindExpr:</pre></code><tr><td>827<td><code><pre> value = args[expr.Pos]</pre></code><tr><td>828<td><code><pre> case *sqlparser.StringLit:</pre></code><tr><td>829<td><code><pre> value = expr.Value</pre></code><tr><td>830<td><code><pre> case *sqlparser.NumberLit:</pre></code><tr class=miss><td>831<td><code><pre> value = expr.Value</pre></code><tr><td>832<td><code><pre> default:</pre></code><tr class=miss><td>833<td><code><pre> return sqlparser.ErrNotImplemented</pre></code><tr><td>834<td><code><pre> }</pre></code><tr><td>835<td><code><pre></pre></code><tr><td>836<td><code><pre> return</pre></code><tr><td>837<td><code><pre> }</pre></code></table><div class=funcname id=fn_tableSharding.suffixes>func tableSharding.suffixes</div><div class=info><a href=#s_fn_tableSharding.suffixes>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>983<td><code><pre>func (t *tableSharding) suffixes() (suffixes []string, err error) {</pre></code><tr><td>984<td><code><pre> switch {</pre></code><tr><td>985<td><code><pre> case t.config.ShardingKeyByRawValue:</pre></code><tr><td>986<td><code><pre> if len(t.config.ShardingKeysForMigrating) == 0 {</pre></code><tr class=miss><td>987<td><code><pre> return nil, errors.New("sharding key by raw value but do not configure keys for migrating")</pre></code><tr><td>988<td><code><pre> }</pre></code><tr><td>989<td><code><pre></pre></code><tr><td>990<td><code><pre> for _, shardingKey := range t.config.ShardingKeysForMigrating {</pre></code><tr><td>991<td><code><pre> suffixes = append(suffixes, fmt.Sprintf(t.suffixFormat, shardingKey))</pre></code><tr><td>992<td><code><pre> }</pre></code><tr><td>993<td><code><pre> default:</pre></code><tr><td>994<td><code><pre> for i := 0; i < int(t.config.NumberOfShards); i++ {</pre></code><tr><td>995<td><code><pre> suffixes = append(suffixes, fmt.Sprintf(t.suffixFormat, i))</pre></code><tr><td>996<td><code><pre> }</pre></code><tr><td>997<td><code><pre> }</pre></code><tr><td>998<td><code><pre> return</pre></code><tr><td>999<td><code><pre>}</pre></code></table><div class=funcname id=fn_@1049:10>func @1049:10</div><div class=info><a href=#s_fn_@1049:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1049<td><code><pre>func(ctx context.Context, values ...any) (suffix string, err error) {</pre></code><tr><td>1050<td><code><pre> data := make([]string, 0, len(values))</pre></code><tr><td>1051<td><code><pre> for _, value := range values {</pre></code><tr><td>1052<td><code><pre> v, err := cast.ToStringE(value)</pre></code><tr><td>1053<td><code><pre> if err != nil {</pre></code><tr class=miss><td>1054<td><code><pre> return "", err</pre></code><tr><td>1055<td><code><pre> }</pre></code><tr><td>1056<td><code><pre> data = append(data, v)</pre></code><tr><td>1057<td><code><pre> }</pre></code><tr><td>1058<td><code><pre> shardingKey := strings.Join(data, constant.Underline)</pre></code><tr><td>1059<td><code><pre> return fmt.Sprintf("_%s", shardingKey), nil</pre></code><tr><td>1060<td><code><pre> }</pre></code></table><div class=funcname id=fn_@1063:10>func @1063:10</div><div class=info><a href=#s_fn_@1063:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1063<td><code><pre>func(ctx context.Context, values ...any) (suffix string, err error) {</pre></code><tr><td>1064<td><code><pre> params := make(map[string]any, len(t.config.ShardingKeys))</pre></code><tr><td>1065<td><code><pre> for idx, column := range t.config.ShardingKeys {</pre></code><tr><td>1066<td><code><pre> params[column] = values[idx]</pre></code><tr><td>1067<td><code><pre> }</pre></code><tr><td>1068<td><code><pre></pre></code><tr><td>1069<td><code><pre> result, err := t.config.ShardingKeyExpr(ctx, params)</pre></code><tr><td>1070<td><code><pre> if err != nil {</pre></code><tr class=miss><td>1071<td><code><pre> return</pre></code><tr><td>1072<td><code><pre> }</pre></code><tr><td>1073<td><code><pre> shardingKey := int64(math.Mod(cast.ToFloat64(result), numberOfShardsFloat64))</pre></code><tr><td>1074<td><code><pre> return fmt.Sprintf(t.suffixFormat, shardingKey), nil</pre></code><tr><td>1075<td><code><pre> }</pre></code></table><div class=funcname id=fn_tableSharding.ShardingByModelList>func tableSharding.ShardingByModelList</div><div class=info><a href=#s_fn_tableSharding.ShardingByModelList>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>145<td><code><pre>func (t *tableSharding) ShardingByModelList(ctx context.Context, src ...any) (dst map[string][]any, err error) {</pre></code><tr><td>146<td><code><pre> dst = make(map[string][]any, len(t.config.ShardingKeys))</pre></code><tr><td>147<td><code><pre> for _, m := range src {</pre></code><tr><td>148<td><code><pre> val := reflect.Indirect(reflect.ValueOf(m))</pre></code><tr><td>149<td><code><pre> shardingValues := make([]any, 0, len(t.config.ShardingKeys))</pre></code><tr><td>150<td><code><pre> for _, key := range t.config.ShardingKeys {</pre></code><tr><td>151<td><code><pre> field := val.FieldByNameFunc(func(v string) bool { return strings.EqualFold(v, key) })</pre></code><tr><td>152<td><code><pre> if !field.IsValid() {</pre></code><tr><td>153<td><code><pre> field, _ = utils.GetGormColumnValue(val, key)</pre></code><tr><td>154<td><code><pre> }</pre></code><tr><td>155<td><code><pre> if !field.IsValid() {</pre></code><tr class=miss><td>156<td><code><pre> return dst, ErrMissingShardingKey</pre></code><tr><td>157<td><code><pre> }</pre></code><tr><td>158<td><code><pre> if key == t.shardingPrimaryKey && field.IsZero() {</pre></code><tr class=miss><td>159<td><code><pre> return dst, ErrInvalidID</pre></code><tr><td>160<td><code><pre> }</pre></code><tr><td>161<td><code><pre> shardingValues = append(shardingValues, field.Interface())</pre></code><tr><td>162<td><code><pre> }</pre></code><tr><td>163<td><code><pre> suffix, err := t.shardingFunc(ctx, shardingValues...)</pre></code><tr><td>164<td><code><pre> if err != nil {</pre></code><tr class=miss><td>165<td><code><pre> return dst, err</pre></code><tr><td>166<td><code><pre> }</pre></code><tr><td>167<td><code><pre> dst[suffix] = append(dst[suffix], m)</pre></code><tr><td>168<td><code><pre> }</pre></code><tr><td>169<td><code><pre> return</pre></code><tr><td>170<td><code><pre>}</pre></code></table><div class=funcname id=fn_@646:12>func @646:12</div><div class=info><a href=#s_fn_@646:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>646<td><code><pre>func(cls clause.Clause) {</pre></code><tr><td>647<td><code><pre> whereClause, ok := cls.Expression.(clause.Where)</pre></code><tr><td>648<td><code><pre> if !ok {</pre></code><tr class=miss><td>649<td><code><pre> return</pre></code><tr><td>650<td><code><pre> }</pre></code><tr><td>651<td><code><pre> whereClause.Exprs = changeExprFunc(whereClause.Exprs)</pre></code><tr><td>652<td><code><pre> cls.Expression = whereClause</pre></code><tr><td>653<td><code><pre> db.Statement.Clauses["WHERE"] = cls</pre></code><tr><td>654<td><code><pre> }</pre></code></table><div class=funcname id=fn_shardingMigrator.AutoMigrate>func shardingMigrator.AutoMigrate</div><div class=info><a href=#s_fn_shardingMigrator.AutoMigrate>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1209<td><code><pre>func (s *shardingMigrator) AutoMigrate(dst ...any) (err error) {</pre></code><tr><td>1210<td><code><pre> sharding, ok := s.shardingMap[s.tableName(s.db, dst[0])]</pre></code><tr><td>1211<td><code><pre> if !ok {</pre></code><tr><td>1212<td><code><pre> defer (*tableSharding)(nil).ignore(s.db)() //nolint: revive // partial calling issue</pre></code><tr><td>1213<td><code><pre> return s.Migrator.AutoMigrate(dst...)</pre></code><tr><td>1214<td><code><pre> }</pre></code><tr><td>1215<td><code><pre></pre></code><tr><td>1216<td><code><pre> stmt := &gorm.Statement{DB: sharding.DB}</pre></code><tr><td>1217<td><code><pre> if sharding.isIgnored(sharding.DB)() {</pre></code><tr class=miss><td>1218<td><code><pre> return s.dialector.Migrator(stmt.DB.Session(&gorm.Session{})).AutoMigrate(dst...)</pre></code><tr><td>1219<td><code><pre> }</pre></code><tr><td>1220<td><code><pre></pre></code><tr><td>1221<td><code><pre> shardingDst, err := s.getShardingDst(sharding, dst...)</pre></code><tr><td>1222<td><code><pre> if err != nil {</pre></code><tr class=miss><td>1223<td><code><pre> return err</pre></code><tr><td>1224<td><code><pre> }</pre></code><tr><td>1225<td><code><pre></pre></code><tr><td>1226<td><code><pre> defer sharding.ignore(sharding.DB)() //nolint: revive // partial calling issue</pre></code><tr><td>1227<td><code><pre> for _, sd := range shardingDst {</pre></code><tr><td>1228<td><code><pre> tx := stmt.DB.Session(&gorm.Session{}).Table(sd.table)</pre></code><tr><td>1229<td><code><pre> if err = s.dialector.Migrator(tx).AutoMigrate(sd.dst); err != nil {</pre></code><tr class=miss><td>1230<td><code><pre> return err</pre></code><tr><td>1231<td><code><pre> }</pre></code><tr><td>1232<td><code><pre> }</pre></code><tr><td>1233<td><code><pre></pre></code><tr><td>1234<td><code><pre> return</pre></code><tr><td>1235<td><code><pre>}</pre></code></table><div class=funcname id=fn_shardingMigrator.DropTable>func shardingMigrator.DropTable</div><div class=info><a href=#s_fn_shardingMigrator.DropTable>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1236<td><code><pre>func (s *shardingMigrator) DropTable(dst ...any) (err error) {</pre></code><tr><td>1237<td><code><pre> sharding, ok := s.shardingMap[s.tableName(s.db, dst[0])]</pre></code><tr><td>1238<td><code><pre> if !ok {</pre></code><tr><td>1239<td><code><pre> defer (*tableSharding)(nil).ignore(s.db)() //nolint: revive // partial calling issue</pre></code><tr><td>1240<td><code><pre> return s.Migrator.DropTable(dst...)</pre></code><tr><td>1241<td><code><pre> }</pre></code><tr><td>1242<td><code><pre></pre></code><tr><td>1243<td><code><pre> stmt := &gorm.Statement{DB: sharding.DB}</pre></code><tr><td>1244<td><code><pre> if sharding.isIgnored(sharding.DB)() {</pre></code><tr class=miss><td>1245<td><code><pre> return s.dialector.Migrator(stmt.DB.Session(&gorm.Session{})).DropTable(dst...)</pre></code><tr><td>1246<td><code><pre> }</pre></code><tr><td>1247<td><code><pre> shardingDst, err := s.getShardingDst(sharding, dst...)</pre></code><tr><td>1248<td><code><pre> if err != nil {</pre></code><tr class=miss><td>1249<td><code><pre> return err</pre></code><tr><td>1250<td><code><pre> }</pre></code><tr><td>1251<td><code><pre></pre></code><tr><td>1252<td><code><pre> defer sharding.ignore(sharding.DB)() //nolint: revive // partial calling issue</pre></code><tr><td>1253<td><code><pre> for _, sd := range shardingDst {</pre></code><tr><td>1254<td><code><pre> tx := stmt.DB.Session(&gorm.Session{}).Table(sd.table)</pre></code><tr><td>1255<td><code><pre> if err = s.dialector.Migrator(tx).DropTable(sd.table); err != nil {</pre></code><tr class=miss><td>1256<td><code><pre> return err</pre></code><tr><td>1257<td><code><pre> }</pre></code><tr><td>1258<td><code><pre> }</pre></code><tr><td>1259<td><code><pre></pre></code><tr><td>1260<td><code><pre> return</pre></code><tr><td>1261<td><code><pre>}</pre></code></table><div class=funcname id=fn_@371:15>func @371:15</div><div class=info><a href=#s_fn_@371:15>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>371<td><code><pre>func(condition sqlparser.Node, tableName string, vars ...any) (suffix string, err error) {</pre></code><tr><td>372<td><code><pre> values := make([]any, 0, len(t.config.ShardingKeys))</pre></code><tr><td>373<td><code><pre> for _, key := range t.config.ShardingKeys {</pre></code><tr><td>374<td><code><pre> val, err := t.nonInsertValue(condition, key, tableName, vars...)</pre></code><tr><td>375<td><code><pre> if err != nil {</pre></code><tr class=miss><td>376<td><code><pre> return "", db.AddError(err)</pre></code><tr><td>377<td><code><pre> }</pre></code><tr><td>378<td><code><pre> values = append(values, val)</pre></code><tr><td>379<td><code><pre> }</pre></code><tr><td>380<td><code><pre></pre></code><tr><td>381<td><code><pre> suffix, err = t.shardingFunc(db.Statement.Context, values...)</pre></code><tr><td>382<td><code><pre> if err != nil {</pre></code><tr class=miss><td>383<td><code><pre> return "", db.AddError(err)</pre></code><tr><td>384<td><code><pre> }</pre></code><tr><td>385<td><code><pre> return</pre></code><tr><td>386<td><code><pre> }</pre></code></table><div class=funcname id=fn_DefaultTableSharding>func DefaultTableSharding</div><div class=info><a href=#s_fn_DefaultTableSharding>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>95<td><code><pre>func DefaultTableSharding(config TableShardingConfig) TableSharding {</pre></code><tr><td>96<td><code><pre> if utils.IsStrBlank(config.Table) {</pre></code><tr class=miss><td>97<td><code><pre> panic(errors.New("missing sharding table name"))</pre></code><tr><td>98<td><code><pre> }</pre></code><tr><td>99<td><code><pre> if len(config.ShardingKeys) == 0 {</pre></code><tr class=miss><td>100<td><code><pre> panic(errors.New("missing sharding keys"))</pre></code><tr><td>101<td><code><pre> }</pre></code><tr><td>102<td><code><pre> if !config.ShardingKeyByRawValue && (config.NumberOfShards <= 0 || config.NumberOfShards >= 100000) {</pre></code><tr class=miss><td>103<td><code><pre> panic(errors.New("invalid number of shards"))</pre></code><tr><td>104<td><code><pre> }</pre></code><tr><td>105<td><code><pre></pre></code><tr><td>106<td><code><pre> shardingKeySet := utils.NewSet(config.ShardingKeys...)</pre></code><tr><td>107<td><code><pre> shardingPrimaryKey := ""</pre></code><tr><td>108<td><code><pre> isShardingPrimaryKey := false</pre></code><tr><td>109<td><code><pre> if shardingKeySet.Contains("id") || shardingKeySet.Contains("ID") ||</pre></code><tr><td>110<td><code><pre> shardingKeySet.Contains("iD") || shardingKeySet.Contains("Id") {</pre></code><tr><td>111<td><code><pre> if config.PrimaryKeyGenerator == nil {</pre></code><tr class=miss><td>112<td><code><pre> panic(errors.New("sharding by primary key but primary key generator not found"))</pre></code><tr><td>113<td><code><pre> }</pre></code><tr><td>114<td><code><pre></pre></code><tr><td>115<td><code><pre> isShardingPrimaryKey = true</pre></code><tr><td>116<td><code><pre> for _, key := range config.ShardingKeys {</pre></code><tr><td>117<td><code><pre> if key == "id" || key == "ID" || key == "Id" || key == "iD" {</pre></code><tr><td>118<td><code><pre> shardingPrimaryKey = key</pre></code><tr><td>119<td><code><pre> break</pre></code><tr><td>120<td><code><pre> }</pre></code><tr><td>121<td><code><pre> }</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre></pre></code><tr><td>124<td><code><pre> return &tableSharding{</pre></code><tr><td>125<td><code><pre> config: config,</pre></code><tr><td>126<td><code><pre> isShardingPrimaryKey: isShardingPrimaryKey,</pre></code><tr><td>127<td><code><pre> shardingPrimaryKey: shardingPrimaryKey,</pre></code><tr><td>128<td><code><pre> shardingTableCreated: make(map[string]struct{}, config.NumberOfShards),</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre>}</pre></code></table><div class=funcname id=fn_@854:23>func @854:23</div><div class=info><a href=#s_fn_@854:23>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>854<td><code><pre>func(rv reflect.Value) (err error) {</pre></code><tr><td>855<td><code><pre> _, isZero := db.Statement.Schema.PrioritizedPrimaryField.ValueOf(db.Statement.Context, rv)</pre></code><tr><td>856<td><code><pre> if !isZero {</pre></code><tr><td>857<td><code><pre> return</pre></code><tr><td>858<td><code><pre> }</pre></code><tr><td>859<td><code><pre> if t.config.PrimaryKeyGenerator == nil {</pre></code><tr class=miss><td>860<td><code><pre> return ErrIDGeneratorNotFound</pre></code><tr><td>861<td><code><pre> }</pre></code><tr><td>862<td><code><pre> id, err := t.config.PrimaryKeyGenerator.Next(idgen.GormTx(db))</pre></code><tr><td>863<td><code><pre> if err != nil {</pre></code><tr class=miss><td>864<td><code><pre> return</pre></code><tr><td>865<td><code><pre> }</pre></code><tr><td>866<td><code><pre> return db.Statement.Schema.PrioritizedPrimaryField.Set(db.Statement.Context, rv, id)</pre></code><tr><td>867<td><code><pre> }</pre></code></table><div class=funcname id=fn_tableSharding.setPrimaryKeyByModel>func tableSharding.setPrimaryKeyByModel</div><div class=info><a href=#s_fn_tableSharding.setPrimaryKeyByModel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>849<td><code><pre>func (t *tableSharding) setPrimaryKeyByModel(db *gorm.DB, opt *tableShardingDispatchOption) (err error) {</pre></code><tr><td>850<td><code><pre> if !opt.isInsert || db.Statement.Model == nil ||</pre></code><tr><td>851<td><code><pre> db.Statement.Schema == nil || db.Statement.Schema.PrioritizedPrimaryField == nil {</pre></code><tr><td>852<td><code><pre> return</pre></code><tr><td>853<td><code><pre> }</pre></code><tr><td>854<td><code><pre> setPrimaryKeyFunc := func(rv reflect.Value) (err error) {</pre></code><tr><td>855<td><code><pre> _, isZero := db.Statement.Schema.PrioritizedPrimaryField.ValueOf(db.Statement.Context, rv)</pre></code><tr><td>856<td><code><pre> if !isZero {</pre></code><tr><td>857<td><code><pre> return</pre></code><tr><td>858<td><code><pre> }</pre></code><tr><td>859<td><code><pre> if t.config.PrimaryKeyGenerator == nil {</pre></code><tr><td>860<td><code><pre> return ErrIDGeneratorNotFound</pre></code><tr><td>861<td><code><pre> }</pre></code><tr><td>862<td><code><pre> id, err := t.config.PrimaryKeyGenerator.Next(idgen.GormTx(db))</pre></code><tr><td>863<td><code><pre> if err != nil {</pre></code><tr><td>864<td><code><pre> return</pre></code><tr><td>865<td><code><pre> }</pre></code><tr><td>866<td><code><pre> return db.Statement.Schema.PrioritizedPrimaryField.Set(db.Statement.Context, rv, id)</pre></code><tr><td>867<td><code><pre> }</pre></code><tr><td>868<td><code><pre></pre></code><tr><td>869<td><code><pre> switch db.Statement.ReflectValue.Kind() {</pre></code><tr><td>870<td><code><pre> case reflect.Slice, reflect.Array:</pre></code><tr><td>871<td><code><pre> for i := 0; i < db.Statement.ReflectValue.Len(); i++ {</pre></code><tr><td>872<td><code><pre> rv := db.Statement.ReflectValue.Index(i)</pre></code><tr><td>873<td><code><pre> if reflect.Indirect(rv).Kind() != reflect.Struct {</pre></code><tr class=miss><td>874<td><code><pre> break</pre></code><tr><td>875<td><code><pre> }</pre></code><tr><td>876<td><code><pre></pre></code><tr><td>877<td><code><pre> if err = setPrimaryKeyFunc(rv); err != nil {</pre></code><tr class=miss><td>878<td><code><pre> return</pre></code><tr><td>879<td><code><pre> }</pre></code><tr><td>880<td><code><pre> }</pre></code><tr><td>881<td><code><pre> case reflect.Struct:</pre></code><tr><td>882<td><code><pre> if err = setPrimaryKeyFunc(db.Statement.ReflectValue); err != nil {</pre></code><tr class=miss><td>883<td><code><pre> return</pre></code><tr><td>884<td><code><pre> }</pre></code><tr><td>885<td><code><pre> }</pre></code><tr><td>886<td><code><pre></pre></code><tr><td>887<td><code><pre> return</pre></code><tr><td>888<td><code><pre>}</pre></code></table><div class=funcname id=fn_@438:31>func @438:31</div><div class=info><a href=#s_fn_@438:31>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>438<td><code><pre>func(stmt *sqlparser.SelectStatement) (ok bool, err error) {</pre></code><tr><td>439<td><code><pre> if stmt.Hint != nil && stmt.Hint.Value == "nosharding" {</pre></code><tr class=miss><td>440<td><code><pre> return false, nil</pre></code><tr><td>441<td><code><pre> }</pre></code><tr><td>442<td><code><pre></pre></code><tr><td>443<td><code><pre> switch tbl := stmt.FromItems.(type) {</pre></code><tr><td>444<td><code><pre> case *sqlparser.TableName:</pre></code><tr><td>445<td><code><pre> if tbl.TableName() != t.config.Table {</pre></code><tr><td>446<td><code><pre> return false, nil</pre></code><tr><td>447<td><code><pre> }</pre></code><tr><td>448<td><code><pre> suffix, e := getSuffix(stmt.Condition, t.config.Table, db.Statement.Vars...)</pre></code><tr><td>449<td><code><pre> if e != nil {</pre></code><tr class=miss><td>450<td><code><pre> _ = db.AddError(e)</pre></code><tr class=miss><td>451<td><code><pre> return false, nil</pre></code><tr><td>452<td><code><pre> }</pre></code><tr><td>453<td><code><pre> oldTableName := tbl.TableName()</pre></code><tr><td>454<td><code><pre> newTableName := oldTableName + suffix</pre></code><tr><td>455<td><code><pre> stmt.FromItems = &sqlparser.TableName{Name: &sqlparser.Ident{Name: newTableName}}</pre></code><tr><td>456<td><code><pre> stmt.OrderBy = t.replaceOrderByTableName(stmt.OrderBy, oldTableName, newTableName)</pre></code><tr><td>457<td><code><pre> if e := t.replaceCondition(stmt.Condition, oldTableName, newTableName); err != nil {</pre></code><tr class=miss><td>458<td><code><pre> _ = db.AddError(e)</pre></code><tr class=miss><td>459<td><code><pre> return false, nil</pre></code><tr><td>460<td><code><pre> }</pre></code><tr><td>461<td><code><pre> case *sqlparser.JoinClause:</pre></code><tr><td>462<td><code><pre> tblx, _ := tbl.X.(*sqlparser.TableName)</pre></code><tr><td>463<td><code><pre> tbly, _ := tbl.Y.(*sqlparser.TableName)</pre></code><tr><td>464<td><code><pre> isXSharding := tblx != nil && tblx.TableName() == t.config.Table</pre></code><tr><td>465<td><code><pre> isYSharding := tbly != nil && tbly.TableName() == t.config.Table</pre></code><tr><td>466<td><code><pre> oldTableName := ""</pre></code><tr><td>467<td><code><pre> switch {</pre></code><tr><td>468<td><code><pre> case isXSharding:</pre></code><tr><td>469<td><code><pre> oldTableName = tblx.TableName()</pre></code><tr><td>470<td><code><pre> case isYSharding:</pre></code><tr><td>471<td><code><pre> oldTableName = tbly.TableName()</pre></code><tr><td>472<td><code><pre> default:</pre></code><tr><td>473<td><code><pre> return false, nil</pre></code><tr><td>474<td><code><pre> }</pre></code><tr><td>475<td><code><pre> suffix, e := getSuffix(stmt.Condition, oldTableName, db.Statement.Vars...)</pre></code><tr><td>476<td><code><pre> if e != nil {</pre></code><tr class=miss><td>477<td><code><pre> _ = db.AddError(e)</pre></code><tr class=miss><td>478<td><code><pre> return false, nil</pre></code><tr><td>479<td><code><pre> }</pre></code><tr><td>480<td><code><pre> newTableName := oldTableName + suffix</pre></code><tr><td>481<td><code><pre> stmt.OrderBy = t.replaceOrderByTableName(stmt.OrderBy, oldTableName, newTableName)</pre></code><tr><td>482<td><code><pre> if e := t.replaceCondition(stmt.Condition, oldTableName, newTableName); err != nil {</pre></code><tr class=miss><td>483<td><code><pre> _ = db.AddError(e)</pre></code><tr class=miss><td>484<td><code><pre> return false, nil</pre></code><tr><td>485<td><code><pre> }</pre></code><tr><td>486<td><code><pre> if e := t.replaceConstraint(tbl.Constraint, oldTableName, newTableName); err != nil {</pre></code><tr class=miss><td>487<td><code><pre> _ = db.AddError(e)</pre></code><tr class=miss><td>488<td><code><pre> return false, nil</pre></code><tr><td>489<td><code><pre> }</pre></code><tr><td>490<td><code><pre> if isXSharding {</pre></code><tr><td>491<td><code><pre> tblx.Name.Name = newTableName</pre></code><tr><td>492<td><code><pre> } else {</pre></code><tr><td>493<td><code><pre> tbly.Name.Name = newTableName</pre></code><tr><td>494<td><code><pre> }</pre></code><tr><td>495<td><code><pre> if stmt.Columns != nil {</pre></code><tr><td>496<td><code><pre> for _, column := range *stmt.Columns {</pre></code><tr><td>497<td><code><pre> columnTbl, ok := column.Expr.(*sqlparser.QualifiedRef)</pre></code><tr><td>498<td><code><pre> if !ok || columnTbl.Table.Name != oldTableName {</pre></code><tr><td>499<td><code><pre> continue</pre></code><tr><td>500<td><code><pre> }</pre></code><tr><td>501<td><code><pre> columnTbl.Table.Name = newTableName</pre></code><tr><td>502<td><code><pre> }</pre></code><tr><td>503<td><code><pre> }</pre></code><tr><td>504<td><code><pre> }</pre></code><tr><td>505<td><code><pre> return true, nil</pre></code><tr><td>506<td><code><pre> }</pre></code></table><div class=funcname id=fn_tableSharding.dispatchTableByModel>func tableSharding.dispatchTableByModel</div><div class=info><a href=#s_fn_tableSharding.dispatchTableByModel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>299<td><code><pre>func (t *tableSharding) dispatchTableByModel(db *gorm.DB, opts ...utils.OptionExtender) (otherTable, ok bool) {</pre></code><tr><td>300<td><code><pre> if db.Statement.Model == nil || utils.IsBlank(db.Statement.ReflectValue.Interface()) {</pre></code><tr><td>301<td><code><pre> return</pre></code><tr><td>302<td><code><pre> }</pre></code><tr><td>303<td><code><pre> if db.Statement.Table != t.config.Table {</pre></code><tr><td>304<td><code><pre> otherTable = true</pre></code><tr><td>305<td><code><pre> return</pre></code><tr><td>306<td><code><pre> }</pre></code><tr><td>307<td><code><pre> if t.shardingTableModel == nil {</pre></code><tr><td>308<td><code><pre> if _, ok := db.Statement.Model.(schema.Tabler); ok {</pre></code><tr><td>309<td><code><pre> cloneModel := clone.Clone(db.Statement.Model)</pre></code><tr><td>310<td><code><pre> t.shardingTableModel = cloneModel</pre></code><tr><td>311<td><code><pre> }</pre></code><tr><td>312<td><code><pre> }</pre></code><tr><td>313<td><code><pre></pre></code><tr><td>314<td><code><pre> opt := utils.ApplyOptions[tableShardingDispatchOption](opts...)</pre></code><tr><td>315<td><code><pre> if t.isShardingPrimaryKey {</pre></code><tr><td>316<td><code><pre> if err := t.setPrimaryKeyByModel(db, opt); err != nil {</pre></code><tr class=miss><td>317<td><code><pre> _ = db.AddError(err)</pre></code><tr class=miss><td>318<td><code><pre> return</pre></code><tr><td>319<td><code><pre> }</pre></code><tr><td>320<td><code><pre> }</pre></code><tr><td>321<td><code><pre></pre></code><tr><td>322<td><code><pre> reflectVal, ok := t.getModelReflectValue(db)</pre></code><tr><td>323<td><code><pre> if !ok {</pre></code><tr class=miss><td>324<td><code><pre> return</pre></code><tr><td>325<td><code><pre> }</pre></code><tr><td>326<td><code><pre> if err := t.checkDiffSuffixesByModel(db); err != nil {</pre></code><tr><td>327<td><code><pre> return</pre></code><tr><td>328<td><code><pre> }</pre></code><tr><td>329<td><code><pre></pre></code><tr><td>330<td><code><pre> values := make([]any, 0, len(t.config.ShardingKeys))</pre></code><tr><td>331<td><code><pre> for _, key := range t.config.ShardingKeys {</pre></code><tr><td>332<td><code><pre> val := reflectVal.FieldByNameFunc(func(v string) bool { return strings.EqualFold(v, key) })</pre></code><tr><td>333<td><code><pre> if !val.IsValid() {</pre></code><tr><td>334<td><code><pre> val, _ = utils.GetGormColumnValue(reflectVal, key)</pre></code><tr><td>335<td><code><pre> }</pre></code><tr><td>336<td><code><pre> if !val.IsValid() {</pre></code><tr class=miss><td>337<td><code><pre> _ = db.AddError(ErrMissingShardingKey)</pre></code><tr class=miss><td>338<td><code><pre> return</pre></code><tr><td>339<td><code><pre> }</pre></code><tr><td>340<td><code><pre> values = append(values, val.Interface())</pre></code><tr><td>341<td><code><pre> }</pre></code><tr><td>342<td><code><pre></pre></code><tr><td>343<td><code><pre> suffix, err := t.shardingFunc(db.Statement.Context, values...)</pre></code><tr><td>344<td><code><pre> if err != nil {</pre></code><tr class=miss><td>345<td><code><pre> _ = db.AddError(err)</pre></code><tr class=miss><td>346<td><code><pre> return</pre></code><tr><td>347<td><code><pre> }</pre></code><tr><td>348<td><code><pre> // cannot parse suffix from model</pre></code><tr><td>349<td><code><pre> if utils.IsStrBlank(suffix) || suffix == constant.Underline {</pre></code><tr class=miss><td>350<td><code><pre> return false, false</pre></code><tr><td>351<td><code><pre> }</pre></code><tr><td>352<td><code><pre> if err = t.createTableIfNotExists(db, db.Statement.Table, suffix); err != nil {</pre></code><tr class=miss><td>353<td><code><pre> _ = db.AddError(err)</pre></code><tr class=miss><td>354<td><code><pre> return</pre></code><tr><td>355<td><code><pre> }</pre></code><tr><td>356<td><code><pre></pre></code><tr><td>357<td><code><pre> db.Statement.Table = db.Statement.Table + suffix</pre></code><tr><td>358<td><code><pre> t.replaceStatementClauseAndSchema(db, opt)</pre></code><tr><td>359<td><code><pre> ok = true</pre></code><tr><td>360<td><code><pre> return</pre></code><tr><td>361<td><code><pre>}</pre></code></table><div class=funcname id=fn_shardingMigrator.getShardingDst>func shardingMigrator.getShardingDst</div><div class=info><a href=#s_fn_shardingMigrator.getShardingDst>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1268<td><code><pre>func (s *shardingMigrator) getShardingDst(sharding *tableSharding, src ...any) (dst []shardingDst, err error) {</pre></code><tr><td>1269<td><code><pre> for _, model := range src {</pre></code><tr><td>1270<td><code><pre> stmt := &gorm.Statement{DB: sharding.DB}</pre></code><tr><td>1271<td><code><pre> if err = stmt.Parse(model); err != nil {</pre></code><tr class=miss><td>1272<td><code><pre> return</pre></code><tr><td>1273<td><code><pre> }</pre></code><tr><td>1274<td><code><pre></pre></code><tr><td>1275<td><code><pre> // support sharding table</pre></code><tr><td>1276<td><code><pre> suffixes, err := sharding.suffixes()</pre></code><tr><td>1277<td><code><pre> if err != nil {</pre></code><tr class=miss><td>1278<td><code><pre> return nil, err</pre></code><tr><td>1279<td><code><pre> }</pre></code><tr><td>1280<td><code><pre> if len(suffixes) == 0 {</pre></code><tr class=miss><td>1281<td><code><pre> return nil, fmt.Errorf("sharding table:%s suffixes are empty", stmt.Table)</pre></code><tr><td>1282<td><code><pre> }</pre></code><tr><td>1283<td><code><pre> for _, suffix := range suffixes {</pre></code><tr><td>1284<td><code><pre> dst = append(dst, shardingDst{</pre></code><tr><td>1285<td><code><pre> table: stmt.Table + suffix,</pre></code><tr><td>1286<td><code><pre> dst: model,</pre></code><tr><td>1287<td><code><pre> })</pre></code><tr><td>1288<td><code><pre> }</pre></code><tr><td>1289<td><code><pre> }</pre></code><tr><td>1290<td><code><pre> return</pre></code><tr><td>1291<td><code><pre>}</pre></code></table><div class=funcname id=fn_tableSharding.getModelReflectValue>func tableSharding.getModelReflectValue</div><div class=info><a href=#s_fn_tableSharding.getModelReflectValue>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>890<td><code><pre>func (t *tableSharding) getModelReflectValue(db *gorm.DB) (reflectVal reflect.Value, ok bool) {</pre></code><tr><td>891<td><code><pre> reflectVal = utils.IndirectValue(db.Statement.ReflectValue)</pre></code><tr><td>892<td><code><pre> if reflectVal.Kind() == reflect.Array || reflectVal.Kind() == reflect.Slice {</pre></code><tr><td>893<td><code><pre> if reflectVal.Len() == 0 {</pre></code><tr class=miss><td>894<td><code><pre> return</pre></code><tr><td>895<td><code><pre> }</pre></code><tr><td>896<td><code><pre> reflectVal = utils.IndirectValue(reflectVal.Index(0))</pre></code><tr><td>897<td><code><pre> }</pre></code><tr><td>898<td><code><pre></pre></code><tr><td>899<td><code><pre> if reflectVal.Kind() != reflect.Struct {</pre></code><tr class=miss><td>900<td><code><pre> return</pre></code><tr><td>901<td><code><pre> }</pre></code><tr><td>902<td><code><pre></pre></code><tr><td>903<td><code><pre> return reflectVal, !utils.IsBlank(reflectVal.Interface())</pre></code><tr><td>904<td><code><pre>}</pre></code></table><div class=funcname id=fn_shardingMigrator.tableName>func shardingMigrator.tableName</div><div class=info><a href=#s_fn_shardingMigrator.tableName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1292<td><code><pre>func (s *shardingMigrator) tableName(db *gorm.DB, m any) (name string) {</pre></code><tr><td>1293<td><code><pre> if tabler, ok := m.(schema.Tabler); ok {</pre></code><tr><td>1294<td><code><pre> name = tabler.TableName()</pre></code><tr><td>1295<td><code><pre> }</pre></code><tr><td>1296<td><code><pre> if tabler, ok := m.(schema.TablerWithNamer); ok {</pre></code><tr class=miss><td>1297<td><code><pre> name = tabler.TableName(db.NamingStrategy)</pre></code><tr><td>1298<td><code><pre> }</pre></code><tr><td>1299<td><code><pre> namingStrategy := reflect.ValueOf(db.NamingStrategy)</pre></code><tr><td>1300<td><code><pre> if namingStrategy.CanConvert(gormSchemaEmbeddedNamer) {</pre></code><tr class=miss><td>1301<td><code><pre> name = reflect.Indirect(namingStrategy.Convert(gormSchemaEmbeddedNamer)).FieldByName("Table").String()</pre></code><tr><td>1302<td><code><pre> }</pre></code><tr><td>1303<td><code><pre> return</pre></code><tr><td>1304<td><code><pre>}</pre></code></table><div class=funcname id=fn_tableSharding.wrapDispatchTableBySQL>func tableSharding.wrapDispatchTableBySQL</div><div class=info><a href=#s_fn_tableSharding.wrapDispatchTableBySQL>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>565<td><code><pre>func (t *tableSharding) wrapDispatchTableBySQL(db *gorm.DB, opts ...utils.OptionExtender) {</pre></code><tr><td>566<td><code><pre> if ok, err := t.dispatchTableBySQL(db, opts...); err != nil || !ok {</pre></code><tr><td>567<td><code><pre> // not a dml</pre></code><tr><td>568<td><code><pre> if err != nil {</pre></code><tr class=miss><td>569<td><code><pre> return</pre></code><tr><td>570<td><code><pre> }</pre></code><tr><td>571<td><code><pre> // not a sharding table</pre></code><tr><td>572<td><code><pre> if !ok {</pre></code><tr><td>573<td><code><pre> // FIXME: reset sql parse result will get duplicated sql statement</pre></code><tr><td>574<td><code><pre> // db.Statement.SQL = strings.Builder{}</pre></code><tr><td>575<td><code><pre> // db.Statement.Vars = nil</pre></code><tr><td>576<td><code><pre> }</pre></code><tr><td>577<td><code><pre> }</pre></code><tr><td>578<td><code><pre>}</pre></code></table><div class=funcname id=fn_tableSharding.ignore>func tableSharding.ignore</div><div class=info><a href=#s_fn_tableSharding.ignore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1001<td><code><pre>func (t *tableSharding) ignore(db *gorm.DB) func() {</pre></code><tr><td>1002<td><code><pre> if _, ok := db.Statement.Settings.Load(shardingIgnoreStoreKey); ok {</pre></code><tr class=miss><td>1003<td><code><pre> return func() {}</pre></code><tr><td>1004<td><code><pre> }</pre></code><tr><td>1005<td><code><pre> db.Statement.Settings.Store(shardingIgnoreStoreKey, nil)</pre></code><tr><td>1006<td><code><pre> return func() {</pre></code><tr><td>1007<td><code><pre> db.Statement.Settings.Delete(shardingIgnoreStoreKey)</pre></code><tr><td>1008<td><code><pre> }</pre></code><tr><td>1009<td><code><pre>}</pre></code></table><div class=funcname id=fn_tableSharding.nonInsertValue>func tableSharding.nonInsertValue</div><div class=info><a href=#s_fn_tableSharding.nonInsertValue>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>800<td><code><pre>func (t *tableSharding) nonInsertValue(condition sqlparser.Node, key, tableName string, args ...any) (</pre></code><tr><td>801<td><code><pre> value any, err error) {</pre></code><tr><td>802<td><code><pre> found := false</pre></code><tr><td>803<td><code><pre> err = sqlparser.Walk(</pre></code><tr><td>804<td><code><pre> sqlparser.VisitFunc(func(node sqlparser.Node) (err error) {</pre></code><tr><td>805<td><code><pre> n, ok := node.(*sqlparser.BinaryExpr)</pre></code><tr><td>806<td><code><pre> if !ok {</pre></code><tr><td>807<td><code><pre> return</pre></code><tr><td>808<td><code><pre> }</pre></code><tr><td>809<td><code><pre> if n.Op != sqlparser.EQ {</pre></code><tr><td>810<td><code><pre> return</pre></code><tr><td>811<td><code><pre> }</pre></code><tr><td>812<td><code><pre></pre></code><tr><td>813<td><code><pre> switch x := n.X.(type) {</pre></code><tr><td>814<td><code><pre> case *sqlparser.Ident:</pre></code><tr><td>815<td><code><pre> if x.Name != key {</pre></code><tr><td>816<td><code><pre> return</pre></code><tr><td>817<td><code><pre> }</pre></code><tr><td>818<td><code><pre> case *sqlparser.QualifiedRef:</pre></code><tr><td>819<td><code><pre> if !ok || x.Table.Name != tableName || x.Column.Name != key {</pre></code><tr><td>820<td><code><pre> return</pre></code><tr><td>821<td><code><pre> }</pre></code><tr><td>822<td><code><pre> }</pre></code><tr><td>823<td><code><pre></pre></code><tr><td>824<td><code><pre> found = true</pre></code><tr><td>825<td><code><pre> switch expr := n.Y.(type) {</pre></code><tr><td>826<td><code><pre> case *sqlparser.BindExpr:</pre></code><tr><td>827<td><code><pre> value = args[expr.Pos]</pre></code><tr><td>828<td><code><pre> case *sqlparser.StringLit:</pre></code><tr><td>829<td><code><pre> value = expr.Value</pre></code><tr><td>830<td><code><pre> case *sqlparser.NumberLit:</pre></code><tr><td>831<td><code><pre> value = expr.Value</pre></code><tr><td>832<td><code><pre> default:</pre></code><tr><td>833<td><code><pre> return sqlparser.ErrNotImplemented</pre></code><tr><td>834<td><code><pre> }</pre></code><tr><td>835<td><code><pre></pre></code><tr><td>836<td><code><pre> return</pre></code><tr><td>837<td><code><pre> }),</pre></code><tr><td>838<td><code><pre> condition,</pre></code><tr><td>839<td><code><pre> )</pre></code><tr><td>840<td><code><pre> if err != nil {</pre></code><tr class=miss><td>841<td><code><pre> return</pre></code><tr><td>842<td><code><pre> }</pre></code><tr><td>843<td><code><pre> if !found {</pre></code><tr class=miss><td>844<td><code><pre> return nil, ErrMissingShardingKey</pre></code><tr><td>845<td><code><pre> }</pre></code><tr><td>846<td><code><pre> return</pre></code><tr><td>847<td><code><pre>}</pre></code></table><div class=funcname id=fn_tableSharding.defaultShardingFunc>func tableSharding.defaultShardingFunc</div><div class=info><a href=#s_fn_tableSharding.defaultShardingFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1017<td><code><pre>func (t *tableSharding) defaultShardingFunc() func(ctx context.Context, values ...any) (suffix string, err error) {</pre></code><tr><td>1018<td><code><pre> if !t.config.ShardingKeyByRawValue && t.config.NumberOfShards == 0 {</pre></code><tr class=miss><td>1019<td><code><pre> panic(errors.New("missing number_of_shards config"))</pre></code><tr><td>1020<td><code><pre> }</pre></code><tr><td>1021<td><code><pre> t.suffixFormat = constant.Underline</pre></code><tr><td>1022<td><code><pre></pre></code><tr><td>1023<td><code><pre> switch {</pre></code><tr><td>1024<td><code><pre> case utils.IsStrNotBlank(t.config.CustomSuffix):</pre></code><tr><td>1025<td><code><pre> t.suffixFormat += t.config.CustomSuffix</pre></code><tr><td>1026<td><code><pre> case t.config.ShardingKeyByRawValue:</pre></code><tr><td>1027<td><code><pre> t.suffixFormat += "%s"</pre></code><tr><td>1028<td><code><pre> default:</pre></code><tr><td>1029<td><code><pre> t.suffixFormat += strings.Join(t.config.ShardingKeys, constant.Underline)</pre></code><tr><td>1030<td><code><pre> }</pre></code><tr><td>1031<td><code><pre></pre></code><tr><td>1032<td><code><pre> numberOfShards := t.config.NumberOfShards</pre></code><tr><td>1033<td><code><pre> if !strings.Contains(t.suffixFormat, "%") {</pre></code><tr><td>1034<td><code><pre> if t.config.ShardingKeyByRawValue {</pre></code><tr class=miss><td>1035<td><code><pre> t.suffixFormat += "_%s"</pre></code><tr><td>1036<td><code><pre> } else if numberOfShards < 10 {</pre></code><tr><td>1037<td><code><pre> t.suffixFormat += "_%01d"</pre></code><tr class=miss><td>1038<td><code><pre> } else if numberOfShards < 100 {</pre></code><tr class=miss><td>1039<td><code><pre> t.suffixFormat += "_%02d"</pre></code><tr class=miss><td>1040<td><code><pre> } else if numberOfShards < 1000 {</pre></code><tr class=miss><td>1041<td><code><pre> t.suffixFormat += "_%03d"</pre></code><tr class=miss><td>1042<td><code><pre> } else if numberOfShards < 10000 {</pre></code><tr class=miss><td>1043<td><code><pre> t.suffixFormat += "_%04d"</pre></code><tr><td>1044<td><code><pre> }</pre></code><tr><td>1045<td><code><pre> }</pre></code><tr><td>1046<td><code><pre></pre></code><tr><td>1047<td><code><pre> switch {</pre></code><tr><td>1048<td><code><pre> case t.config.ShardingKeyByRawValue:</pre></code><tr><td>1049<td><code><pre> return func(ctx context.Context, values ...any) (suffix string, err error) {</pre></code><tr><td>1050<td><code><pre> data := make([]string, 0, len(values))</pre></code><tr><td>1051<td><code><pre> for _, value := range values {</pre></code><tr><td>1052<td><code><pre> v, err := cast.ToStringE(value)</pre></code><tr><td>1053<td><code><pre> if err != nil {</pre></code><tr><td>1054<td><code><pre> return "", err</pre></code><tr><td>1055<td><code><pre> }</pre></code><tr><td>1056<td><code><pre> data = append(data, v)</pre></code><tr><td>1057<td><code><pre> }</pre></code><tr><td>1058<td><code><pre> shardingKey := strings.Join(data, constant.Underline)</pre></code><tr><td>1059<td><code><pre> return fmt.Sprintf("_%s", shardingKey), nil</pre></code><tr><td>1060<td><code><pre> }</pre></code><tr><td>1061<td><code><pre> case t.config.ShardingKeyExpr != nil:</pre></code><tr><td>1062<td><code><pre> numberOfShardsFloat64 := float64(numberOfShards)</pre></code><tr><td>1063<td><code><pre> return func(ctx context.Context, values ...any) (suffix string, err error) {</pre></code><tr><td>1064<td><code><pre> params := make(map[string]any, len(t.config.ShardingKeys))</pre></code><tr><td>1065<td><code><pre> for idx, column := range t.config.ShardingKeys {</pre></code><tr><td>1066<td><code><pre> params[column] = values[idx]</pre></code><tr><td>1067<td><code><pre> }</pre></code><tr><td>1068<td><code><pre></pre></code><tr><td>1069<td><code><pre> result, err := t.config.ShardingKeyExpr(ctx, params)</pre></code><tr><td>1070<td><code><pre> if err != nil {</pre></code><tr><td>1071<td><code><pre> return</pre></code><tr><td>1072<td><code><pre> }</pre></code><tr><td>1073<td><code><pre> shardingKey := int64(math.Mod(cast.ToFloat64(result), numberOfShardsFloat64))</pre></code><tr><td>1074<td><code><pre> return fmt.Sprintf(t.suffixFormat, shardingKey), nil</pre></code><tr><td>1075<td><code><pre> }</pre></code><tr><td>1076<td><code><pre> default:</pre></code><tr><td>1077<td><code><pre> stringToByteSliceFunc := func(v string) (data []byte) {</pre></code><tr><td>1078<td><code><pre> utils.IfAny(</pre></code><tr><td>1079<td><code><pre> // number</pre></code><tr><td>1080<td><code><pre> func() (ok bool) {</pre></code><tr><td>1081<td><code><pre> num := new(big.Float)</pre></code><tr><td>1082<td><code><pre> if _, ok = num.SetString(v); !ok {</pre></code><tr><td>1083<td><code><pre> return</pre></code><tr><td>1084<td><code><pre> }</pre></code><tr><td>1085<td><code><pre> gobEncoded, err := num.GobEncode()</pre></code><tr><td>1086<td><code><pre> if err != nil {</pre></code><tr><td>1087<td><code><pre> return false</pre></code><tr><td>1088<td><code><pre> }</pre></code><tr><td>1089<td><code><pre> data = gobEncoded</pre></code><tr><td>1090<td><code><pre> return</pre></code><tr><td>1091<td><code><pre> },</pre></code><tr><td>1092<td><code><pre> // uuid</pre></code><tr><td>1093<td><code><pre> func() bool {</pre></code><tr><td>1094<td><code><pre> uid, err := uuid.Parse(v)</pre></code><tr><td>1095<td><code><pre> if err != nil {</pre></code><tr><td>1096<td><code><pre> return false</pre></code><tr><td>1097<td><code><pre> }</pre></code><tr><td>1098<td><code><pre> data = uid[:]</pre></code><tr><td>1099<td><code><pre> return true</pre></code><tr><td>1100<td><code><pre> },</pre></code><tr><td>1101<td><code><pre> // bytes</pre></code><tr><td>1102<td><code><pre> func() bool { data = []byte(v); return true },</pre></code><tr><td>1103<td><code><pre> )</pre></code><tr><td>1104<td><code><pre> return</pre></code><tr><td>1105<td><code><pre> }</pre></code><tr><td>1106<td><code><pre> return func(ctx context.Context, values ...any) (suffix string, err error) {</pre></code><tr><td>1107<td><code><pre> size := 0</pre></code><tr><td>1108<td><code><pre> for _, value := range values {</pre></code><tr><td>1109<td><code><pre> s := binary.Size(value)</pre></code><tr><td>1110<td><code><pre> if s <= 0 {</pre></code><tr><td>1111<td><code><pre> s = int(unsafe.Sizeof(value))</pre></code><tr><td>1112<td><code><pre> }</pre></code><tr><td>1113<td><code><pre> size += s</pre></code><tr><td>1114<td><code><pre> }</pre></code><tr><td>1115<td><code><pre> w := new(bytes.Buffer)</pre></code><tr><td>1116<td><code><pre> w.Grow(size)</pre></code><tr><td>1117<td><code><pre></pre></code><tr><td>1118<td><code><pre> for _, value := range values {</pre></code><tr><td>1119<td><code><pre> var data any</pre></code><tr><td>1120<td><code><pre> switch v := value.(type) {</pre></code><tr><td>1121<td><code><pre> case int, *int:</pre></code><tr><td>1122<td><code><pre> data = utils.IntNarrow(cast.ToInt(v))</pre></code><tr><td>1123<td><code><pre> case uint, *uint:</pre></code><tr><td>1124<td><code><pre> data = utils.UintNarrow(cast.ToUint(v))</pre></code><tr><td>1125<td><code><pre> case []int:</pre></code><tr><td>1126<td><code><pre> data = make([]any, len(v))</pre></code><tr><td>1127<td><code><pre> for i := 0; i < len(v); i++ {</pre></code><tr><td>1128<td><code><pre> data.([]any)[i] = utils.IntNarrow(cast.ToInt(v))</pre></code><tr><td>1129<td><code><pre> }</pre></code><tr><td>1130<td><code><pre> case []uint:</pre></code><tr><td>1131<td><code><pre> data = make([]any, len(v))</pre></code><tr><td>1132<td><code><pre> for i := 0; i < len(v); i++ {</pre></code><tr><td>1133<td><code><pre> data.([]any)[i] = utils.UintNarrow(cast.ToUint(v))</pre></code><tr><td>1134<td><code><pre> }</pre></code><tr><td>1135<td><code><pre> case string:</pre></code><tr><td>1136<td><code><pre> data = stringToByteSliceFunc(v)</pre></code><tr><td>1137<td><code><pre> case []byte:</pre></code><tr><td>1138<td><code><pre> data = stringToByteSliceFunc(utils.UnsafeBytesToString(v))</pre></code><tr><td>1139<td><code><pre> case uuid.UUID:</pre></code><tr><td>1140<td><code><pre> data = v[:]</pre></code><tr><td>1141<td><code><pre> default:</pre></code><tr><td>1142<td><code><pre> data = v</pre></code><tr><td>1143<td><code><pre> }</pre></code><tr><td>1144<td><code><pre> if err = binary.Write(w, binary.BigEndian, data); err != nil {</pre></code><tr><td>1145<td><code><pre> return</pre></code><tr><td>1146<td><code><pre> }</pre></code><tr><td>1147<td><code><pre> }</pre></code><tr><td>1148<td><code><pre></pre></code><tr><td>1149<td><code><pre> // checksum mod shards</pre></code><tr><td>1150<td><code><pre> checksum := crc32.ChecksumIEEE(w.Bytes())</pre></code><tr><td>1151<td><code><pre> shardingKey := uint64(checksum) % uint64(numberOfShards)</pre></code><tr><td>1152<td><code><pre> suffix = fmt.Sprintf(t.suffixFormat, shardingKey)</pre></code><tr><td>1153<td><code><pre> return</pre></code><tr><td>1154<td><code><pre> }</pre></code><tr><td>1155<td><code><pre> }</pre></code><tr><td>1156<td><code><pre>}</pre></code></table><div class=funcname id=fn_tableSharding.ShardingIDGen>func tableSharding.ShardingIDGen</div><div class=info><a href=#s_fn_tableSharding.ShardingIDGen>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>196<td><code><pre>func (t *tableSharding) ShardingIDGen(ctx context.Context) (id uint64, err error) {</pre></code><tr><td>197<td><code><pre> if t.config.PrimaryKeyGenerator == nil {</pre></code><tr class=miss><td>198<td><code><pre> return 0, ErrIDGeneratorNotFound</pre></code><tr><td>199<td><code><pre> }</pre></code><tr><td>200<td><code><pre> return t.config.PrimaryKeyGenerator.Next()</pre></code><tr><td>201<td><code><pre>}</pre></code></table><div class=funcname id=fn_@1093:5>func @1093:5</div><div class=info><a href=#s_fn_@1093:5>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1093<td><code><pre>func() bool {</pre></code><tr><td>1094<td><code><pre> uid, err := uuid.Parse(v)</pre></code><tr><td>1095<td><code><pre> if err != nil {</pre></code><tr><td>1096<td><code><pre> return false</pre></code><tr><td>1097<td><code><pre> }</pre></code><tr class=miss><td>1098<td><code><pre> data = uid[:]</pre></code><tr class=miss><td>1099<td><code><pre> return true</pre></code><tr><td>1100<td><code><pre> }</pre></code></table><div class=funcname id=fn_@1106:10>func @1106:10</div><div class=info><a href=#s_fn_@1106:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1106<td><code><pre>func(ctx context.Context, values ...any) (suffix string, err error) {</pre></code><tr><td>1107<td><code><pre> size := 0</pre></code><tr><td>1108<td><code><pre> for _, value := range values {</pre></code><tr><td>1109<td><code><pre> s := binary.Size(value)</pre></code><tr><td>1110<td><code><pre> if s <= 0 {</pre></code><tr><td>1111<td><code><pre> s = int(unsafe.Sizeof(value))</pre></code><tr><td>1112<td><code><pre> }</pre></code><tr><td>1113<td><code><pre> size += s</pre></code><tr><td>1114<td><code><pre> }</pre></code><tr><td>1115<td><code><pre> w := new(bytes.Buffer)</pre></code><tr><td>1116<td><code><pre> w.Grow(size)</pre></code><tr><td>1117<td><code><pre></pre></code><tr><td>1118<td><code><pre> for _, value := range values {</pre></code><tr><td>1119<td><code><pre> var data any</pre></code><tr><td>1120<td><code><pre> switch v := value.(type) {</pre></code><tr><td>1121<td><code><pre> case int, *int:</pre></code><tr class=miss><td>1122<td><code><pre> data = utils.IntNarrow(cast.ToInt(v))</pre></code><tr><td>1123<td><code><pre> case uint, *uint:</pre></code><tr class=miss><td>1124<td><code><pre> data = utils.UintNarrow(cast.ToUint(v))</pre></code><tr><td>1125<td><code><pre> case []int:</pre></code><tr class=miss><td>1126<td><code><pre> data = make([]any, len(v))</pre></code><tr class=miss><td>1127<td><code><pre> for i := 0; i < len(v); i++ {</pre></code><tr class=miss><td>1128<td><code><pre> data.([]any)[i] = utils.IntNarrow(cast.ToInt(v))</pre></code><tr><td>1129<td><code><pre> }</pre></code><tr><td>1130<td><code><pre> case []uint:</pre></code><tr class=miss><td>1131<td><code><pre> data = make([]any, len(v))</pre></code><tr class=miss><td>1132<td><code><pre> for i := 0; i < len(v); i++ {</pre></code><tr class=miss><td>1133<td><code><pre> data.([]any)[i] = utils.UintNarrow(cast.ToUint(v))</pre></code><tr><td>1134<td><code><pre> }</pre></code><tr><td>1135<td><code><pre> case string:</pre></code><tr><td>1136<td><code><pre> data = stringToByteSliceFunc(v)</pre></code><tr><td>1137<td><code><pre> case []byte:</pre></code><tr class=miss><td>1138<td><code><pre> data = stringToByteSliceFunc(utils.UnsafeBytesToString(v))</pre></code><tr><td>1139<td><code><pre> case uuid.UUID:</pre></code><tr class=miss><td>1140<td><code><pre> data = v[:]</pre></code><tr><td>1141<td><code><pre> default:</pre></code><tr class=miss><td>1142<td><code><pre> data = v</pre></code><tr><td>1143<td><code><pre> }</pre></code><tr><td>1144<td><code><pre> if err = binary.Write(w, binary.BigEndian, data); err != nil {</pre></code><tr class=miss><td>1145<td><code><pre> return</pre></code><tr><td>1146<td><code><pre> }</pre></code><tr><td>1147<td><code><pre> }</pre></code><tr><td>1148<td><code><pre></pre></code><tr><td>1149<td><code><pre> // checksum mod shards</pre></code><tr><td>1150<td><code><pre> checksum := crc32.ChecksumIEEE(w.Bytes())</pre></code><tr><td>1151<td><code><pre> shardingKey := uint64(checksum) % uint64(numberOfShards)</pre></code><tr><td>1152<td><code><pre> suffix = fmt.Sprintf(t.suffixFormat, shardingKey)</pre></code><tr><td>1153<td><code><pre> return</pre></code><tr><td>1154<td><code><pre> }</pre></code></table><div class=funcname id=fn_tableSharding.createTableIfNotExists>func tableSharding.createTableIfNotExists</div><div class=info><a href=#s_fn_tableSharding.createTableIfNotExists>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>951<td><code><pre>func (t *tableSharding) createTableIfNotExists(db *gorm.DB, tableName, suffix string) (err error) {</pre></code><tr><td>952<td><code><pre> shardingTableName := tableName + suffix</pre></code><tr><td>953<td><code><pre> t.shardingTableCreatedMutex.RLock()</pre></code><tr><td>954<td><code><pre> if _, ok := t.shardingTableCreated[shardingTableName]; ok {</pre></code><tr><td>955<td><code><pre> t.shardingTableCreatedMutex.RUnlock()</pre></code><tr><td>956<td><code><pre> return</pre></code><tr><td>957<td><code><pre> }</pre></code><tr><td>958<td><code><pre> t.shardingTableCreatedMutex.RUnlock()</pre></code><tr><td>959<td><code><pre> t.shardingTableCreatedMutex.Lock()</pre></code><tr><td>960<td><code><pre> defer t.shardingTableCreatedMutex.Unlock()</pre></code><tr><td>961<td><code><pre></pre></code><tr><td>962<td><code><pre> defer t.ignore(t.DB)() //nolint: revive // partial calling issue</pre></code><tr><td>963<td><code><pre> if t.DB.Migrator().HasTable(shardingTableName) {</pre></code><tr><td>964<td><code><pre> t.shardingTableCreated[shardingTableName] = struct{}{}</pre></code><tr><td>965<td><code><pre> return</pre></code><tr><td>966<td><code><pre> }</pre></code><tr><td>967<td><code><pre></pre></code><tr class=miss><td>968<td><code><pre> model := db.Statement.Model</pre></code><tr class=miss><td>969<td><code><pre> if model == nil {</pre></code><tr class=miss><td>970<td><code><pre> model = t.shardingTableModel</pre></code><tr><td>971<td><code><pre> }</pre></code><tr class=miss><td>972<td><code><pre> if model == nil {</pre></code><tr class=miss><td>973<td><code><pre> return ErrShardingModelNotFound</pre></code><tr><td>974<td><code><pre> }</pre></code><tr class=miss><td>975<td><code><pre> tx := t.DB.Session(&gorm.Session{}).Table(shardingTableName)</pre></code><tr class=miss><td>976<td><code><pre> if err = db.Dialector.Migrator(tx).AutoMigrate(db.Statement.Model); err != nil {</pre></code><tr class=miss><td>977<td><code><pre> return err</pre></code><tr><td>978<td><code><pre> }</pre></code><tr class=miss><td>979<td><code><pre> t.shardingTableCreated[shardingTableName] = struct{}{}</pre></code><tr class=miss><td>980<td><code><pre> return</pre></code><tr><td>981<td><code><pre>}</pre></code></table><div class=funcname id=fn_@1080:5>func @1080:5</div><div class=info><a href=#s_fn_@1080:5>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1080<td><code><pre>func() (ok bool) {</pre></code><tr><td>1081<td><code><pre> num := new(big.Float)</pre></code><tr><td>1082<td><code><pre> if _, ok = num.SetString(v); !ok {</pre></code><tr><td>1083<td><code><pre> return</pre></code><tr><td>1084<td><code><pre> }</pre></code><tr class=miss><td>1085<td><code><pre> gobEncoded, err := num.GobEncode()</pre></code><tr class=miss><td>1086<td><code><pre> if err != nil {</pre></code><tr class=miss><td>1087<td><code><pre> return false</pre></code><tr><td>1088<td><code><pre> }</pre></code><tr class=miss><td>1089<td><code><pre> data = gobEncoded</pre></code><tr class=miss><td>1090<td><code><pre> return</pre></code><tr><td>1091<td><code><pre> }</pre></code></table><div class=funcname id=fn_tableSharding.dispatchTableBySQL>func tableSharding.dispatchTableBySQL</div><div class=info><a href=#s_fn_tableSharding.dispatchTableBySQL>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>364<td><code><pre>func (t *tableSharding) dispatchTableBySQL(db *gorm.DB, opts ...utils.OptionExtender) (ok bool, err error) {</pre></code><tr><td>365<td><code><pre> expr, err := sqlparser.NewParser(strings.NewReader(db.Statement.SQL.String())).ParseStatement()</pre></code><tr><td>366<td><code><pre> if err != nil {</pre></code><tr><td>367<td><code><pre> // maybe not a dml, so we ignore this error</pre></code><tr class=miss><td>368<td><code><pre> return</pre></code><tr><td>369<td><code><pre> }</pre></code><tr><td>370<td><code><pre></pre></code><tr><td>371<td><code><pre> getSuffix := func(condition sqlparser.Node, tableName string, vars ...any) (suffix string, err error) {</pre></code><tr><td>372<td><code><pre> values := make([]any, 0, len(t.config.ShardingKeys))</pre></code><tr><td>373<td><code><pre> for _, key := range t.config.ShardingKeys {</pre></code><tr><td>374<td><code><pre> val, err := t.nonInsertValue(condition, key, tableName, vars...)</pre></code><tr><td>375<td><code><pre> if err != nil {</pre></code><tr><td>376<td><code><pre> return "", db.AddError(err)</pre></code><tr><td>377<td><code><pre> }</pre></code><tr><td>378<td><code><pre> values = append(values, val)</pre></code><tr><td>379<td><code><pre> }</pre></code><tr><td>380<td><code><pre></pre></code><tr><td>381<td><code><pre> suffix, err = t.shardingFunc(db.Statement.Context, values...)</pre></code><tr><td>382<td><code><pre> if err != nil {</pre></code><tr><td>383<td><code><pre> return "", db.AddError(err)</pre></code><tr><td>384<td><code><pre> }</pre></code><tr><td>385<td><code><pre> return</pre></code><tr><td>386<td><code><pre> }</pre></code><tr><td>387<td><code><pre></pre></code><tr><td>388<td><code><pre> newSQL := ""</pre></code><tr><td>389<td><code><pre> switch stmt := expr.(type) {</pre></code><tr><td>390<td><code><pre> case *sqlparser.InsertStatement:</pre></code><tr class=miss><td>391<td><code><pre> if stmt.TableName.TableName() != t.config.Table {</pre></code><tr class=miss><td>392<td><code><pre> return</pre></code><tr><td>393<td><code><pre> }</pre></code><tr><td>394<td><code><pre></pre></code><tr class=miss><td>395<td><code><pre> suffix := ""</pre></code><tr class=miss><td>396<td><code><pre> for _, insertExpression := range stmt.Expressions {</pre></code><tr class=miss><td>397<td><code><pre> values, id, e := t.insertValue(t.config.ShardingKeys, stmt.ColumnNames,</pre></code><tr><td>398<td><code><pre> insertExpression.Exprs, db.Statement.Vars...)</pre></code><tr class=miss><td>399<td><code><pre> if e != nil {</pre></code><tr class=miss><td>400<td><code><pre> _ = db.AddError(e)</pre></code><tr class=miss><td>401<td><code><pre> return</pre></code><tr><td>402<td><code><pre> }</pre></code><tr class=miss><td>403<td><code><pre> if t.isShardingPrimaryKey && id == 0 {</pre></code><tr class=miss><td>404<td><code><pre> if t.config.PrimaryKeyGenerator == nil {</pre></code><tr class=miss><td>405<td><code><pre> _ = db.AddError(ErrIDGeneratorNotFound)</pre></code><tr class=miss><td>406<td><code><pre> return</pre></code><tr><td>407<td><code><pre> }</pre></code><tr class=miss><td>408<td><code><pre> if id, e = t.config.PrimaryKeyGenerator.Next(idgen.GormTx(db)); e != nil {</pre></code><tr class=miss><td>409<td><code><pre> _ = db.AddError(e)</pre></code><tr class=miss><td>410<td><code><pre> return</pre></code><tr><td>411<td><code><pre> }</pre></code><tr class=miss><td>412<td><code><pre> stmt.ColumnNames = append(stmt.ColumnNames, &sqlparser.Ident{Name: "id"})</pre></code><tr class=miss><td>413<td><code><pre> insertExpression.Exprs = append(insertExpression.Exprs, &sqlparser.NumberLit{Value: cast.ToString(id)})</pre></code><tr class=miss><td>414<td><code><pre> values, _, _ = t.insertValue(t.config.ShardingKeys, stmt.ColumnNames,</pre></code><tr><td>415<td><code><pre> insertExpression.Exprs, db.Statement.Vars...)</pre></code><tr><td>416<td><code><pre> }</pre></code><tr><td>417<td><code><pre></pre></code><tr class=miss><td>418<td><code><pre> subSuffix, e := t.shardingFunc(db.Statement.Context, values...)</pre></code><tr class=miss><td>419<td><code><pre> if e != nil {</pre></code><tr class=miss><td>420<td><code><pre> _ = db.AddError(e)</pre></code><tr class=miss><td>421<td><code><pre> return</pre></code><tr><td>422<td><code><pre> }</pre></code><tr><td>423<td><code><pre></pre></code><tr class=miss><td>424<td><code><pre> if suffix != "" && suffix != subSuffix {</pre></code><tr class=miss><td>425<td><code><pre> _ = db.AddError(ErrDiffSuffixDML)</pre></code><tr class=miss><td>426<td><code><pre> return</pre></code><tr><td>427<td><code><pre> }</pre></code><tr class=miss><td>428<td><code><pre> suffix = subSuffix</pre></code><tr><td>429<td><code><pre> }</pre></code><tr><td>430<td><code><pre> // FIXME: could not find the table schema to migrate</pre></code><tr class=miss><td>431<td><code><pre> if e := t.createTableIfNotExists(db, db.Statement.Table, suffix); e != nil {</pre></code><tr class=miss><td>432<td><code><pre> _ = db.AddError(e)</pre></code><tr class=miss><td>433<td><code><pre> return</pre></code><tr><td>434<td><code><pre> }</pre></code><tr class=miss><td>435<td><code><pre> stmt.TableName = &sqlparser.TableName{Name: &sqlparser.Ident{Name: stmt.TableName.TableName() + suffix}}</pre></code><tr class=miss><td>436<td><code><pre> newSQL = stmt.String()</pre></code><tr><td>437<td><code><pre> case *sqlparser.SelectStatement:</pre></code><tr><td>438<td><code><pre> parseSelectStatementFunc := func(stmt *sqlparser.SelectStatement) (ok bool, err error) {</pre></code><tr><td>439<td><code><pre> if stmt.Hint != nil && stmt.Hint.Value == "nosharding" {</pre></code><tr><td>440<td><code><pre> return false, nil</pre></code><tr><td>441<td><code><pre> }</pre></code><tr><td>442<td><code><pre></pre></code><tr><td>443<td><code><pre> switch tbl := stmt.FromItems.(type) {</pre></code><tr><td>444<td><code><pre> case *sqlparser.TableName:</pre></code><tr><td>445<td><code><pre> if tbl.TableName() != t.config.Table {</pre></code><tr><td>446<td><code><pre> return false, nil</pre></code><tr><td>447<td><code><pre> }</pre></code><tr><td>448<td><code><pre> suffix, e := getSuffix(stmt.Condition, t.config.Table, db.Statement.Vars...)</pre></code><tr><td>449<td><code><pre> if e != nil {</pre></code><tr><td>450<td><code><pre> _ = db.AddError(e)</pre></code><tr><td>451<td><code><pre> return false, nil</pre></code><tr><td>452<td><code><pre> }</pre></code><tr><td>453<td><code><pre> oldTableName := tbl.TableName()</pre></code><tr><td>454<td><code><pre> newTableName := oldTableName + suffix</pre></code><tr><td>455<td><code><pre> stmt.FromItems = &sqlparser.TableName{Name: &sqlparser.Ident{Name: newTableName}}</pre></code><tr><td>456<td><code><pre> stmt.OrderBy = t.replaceOrderByTableName(stmt.OrderBy, oldTableName, newTableName)</pre></code><tr><td>457<td><code><pre> if e := t.replaceCondition(stmt.Condition, oldTableName, newTableName); err != nil {</pre></code><tr><td>458<td><code><pre> _ = db.AddError(e)</pre></code><tr><td>459<td><code><pre> return false, nil</pre></code><tr><td>460<td><code><pre> }</pre></code><tr><td>461<td><code><pre> case *sqlparser.JoinClause:</pre></code><tr><td>462<td><code><pre> tblx, _ := tbl.X.(*sqlparser.TableName)</pre></code><tr><td>463<td><code><pre> tbly, _ := tbl.Y.(*sqlparser.TableName)</pre></code><tr><td>464<td><code><pre> isXSharding := tblx != nil && tblx.TableName() == t.config.Table</pre></code><tr><td>465<td><code><pre> isYSharding := tbly != nil && tbly.TableName() == t.config.Table</pre></code><tr><td>466<td><code><pre> oldTableName := ""</pre></code><tr><td>467<td><code><pre> switch {</pre></code><tr><td>468<td><code><pre> case isXSharding:</pre></code><tr><td>469<td><code><pre> oldTableName = tblx.TableName()</pre></code><tr><td>470<td><code><pre> case isYSharding:</pre></code><tr><td>471<td><code><pre> oldTableName = tbly.TableName()</pre></code><tr><td>472<td><code><pre> default:</pre></code><tr><td>473<td><code><pre> return false, nil</pre></code><tr><td>474<td><code><pre> }</pre></code><tr><td>475<td><code><pre> suffix, e := getSuffix(stmt.Condition, oldTableName, db.Statement.Vars...)</pre></code><tr><td>476<td><code><pre> if e != nil {</pre></code><tr><td>477<td><code><pre> _ = db.AddError(e)</pre></code><tr><td>478<td><code><pre> return false, nil</pre></code><tr><td>479<td><code><pre> }</pre></code><tr><td>480<td><code><pre> newTableName := oldTableName + suffix</pre></code><tr><td>481<td><code><pre> stmt.OrderBy = t.replaceOrderByTableName(stmt.OrderBy, oldTableName, newTableName)</pre></code><tr><td>482<td><code><pre> if e := t.replaceCondition(stmt.Condition, oldTableName, newTableName); err != nil {</pre></code><tr><td>483<td><code><pre> _ = db.AddError(e)</pre></code><tr><td>484<td><code><pre> return false, nil</pre></code><tr><td>485<td><code><pre> }</pre></code><tr><td>486<td><code><pre> if e := t.replaceConstraint(tbl.Constraint, oldTableName, newTableName); err != nil {</pre></code><tr><td>487<td><code><pre> _ = db.AddError(e)</pre></code><tr><td>488<td><code><pre> return false, nil</pre></code><tr><td>489<td><code><pre> }</pre></code><tr><td>490<td><code><pre> if isXSharding {</pre></code><tr><td>491<td><code><pre> tblx.Name.Name = newTableName</pre></code><tr><td>492<td><code><pre> } else {</pre></code><tr><td>493<td><code><pre> tbly.Name.Name = newTableName</pre></code><tr><td>494<td><code><pre> }</pre></code><tr><td>495<td><code><pre> if stmt.Columns != nil {</pre></code><tr><td>496<td><code><pre> for _, column := range *stmt.Columns {</pre></code><tr><td>497<td><code><pre> columnTbl, ok := column.Expr.(*sqlparser.QualifiedRef)</pre></code><tr><td>498<td><code><pre> if !ok || columnTbl.Table.Name != oldTableName {</pre></code><tr><td>499<td><code><pre> continue</pre></code><tr><td>500<td><code><pre> }</pre></code><tr><td>501<td><code><pre> columnTbl.Table.Name = newTableName</pre></code><tr><td>502<td><code><pre> }</pre></code><tr><td>503<td><code><pre> }</pre></code><tr><td>504<td><code><pre> }</pre></code><tr><td>505<td><code><pre> return true, nil</pre></code><tr><td>506<td><code><pre> }</pre></code><tr><td>507<td><code><pre> for compound := stmt; compound != nil; compound = compound.Compound {</pre></code><tr><td>508<td><code><pre> if ok, err = parseSelectStatementFunc(compound); !ok || err != nil {</pre></code><tr><td>509<td><code><pre> return</pre></code><tr><td>510<td><code><pre> }</pre></code><tr><td>511<td><code><pre> }</pre></code><tr><td>512<td><code><pre></pre></code><tr><td>513<td><code><pre> newSQL = stmt.String()</pre></code><tr><td>514<td><code><pre></pre></code><tr><td>515<td><code><pre> case *sqlparser.UpdateStatement:</pre></code><tr><td>516<td><code><pre> if stmt.TableName.TableName() != t.config.Table {</pre></code><tr><td>517<td><code><pre> return</pre></code><tr><td>518<td><code><pre> }</pre></code><tr><td>519<td><code><pre></pre></code><tr class=miss><td>520<td><code><pre> suffix, e := getSuffix(stmt.Condition, t.config.Table, db.Statement.Vars...)</pre></code><tr class=miss><td>521<td><code><pre> if e != nil {</pre></code><tr class=miss><td>522<td><code><pre> _ = db.AddError(e)</pre></code><tr class=miss><td>523<td><code><pre> return</pre></code><tr><td>524<td><code><pre> }</pre></code><tr><td>525<td><code><pre></pre></code><tr class=miss><td>526<td><code><pre> oldTableName := stmt.TableName.TableName()</pre></code><tr class=miss><td>527<td><code><pre> newTableName := oldTableName + suffix</pre></code><tr class=miss><td>528<td><code><pre> stmt.TableName = &sqlparser.TableName{Name: &sqlparser.Ident{Name: newTableName}}</pre></code><tr class=miss><td>529<td><code><pre> if e := t.replaceCondition(stmt.Condition, oldTableName, newTableName); err != nil {</pre></code><tr class=miss><td>530<td><code><pre> _ = db.AddError(e)</pre></code><tr class=miss><td>531<td><code><pre> return false, nil</pre></code><tr><td>532<td><code><pre> }</pre></code><tr class=miss><td>533<td><code><pre> newSQL = stmt.String()</pre></code><tr><td>534<td><code><pre> case *sqlparser.DeleteStatement:</pre></code><tr><td>535<td><code><pre> if stmt.TableName.TableName() != t.config.Table {</pre></code><tr><td>536<td><code><pre> return</pre></code><tr><td>537<td><code><pre> }</pre></code><tr><td>538<td><code><pre></pre></code><tr><td>539<td><code><pre> suffix, e := getSuffix(stmt.Condition, t.config.Table, db.Statement.Vars...)</pre></code><tr><td>540<td><code><pre> if e != nil {</pre></code><tr class=miss><td>541<td><code><pre> _ = db.AddError(e)</pre></code><tr class=miss><td>542<td><code><pre> return</pre></code><tr><td>543<td><code><pre> }</pre></code><tr><td>544<td><code><pre></pre></code><tr><td>545<td><code><pre> oldTableName := stmt.TableName.TableName()</pre></code><tr><td>546<td><code><pre> newTableName := oldTableName + suffix</pre></code><tr><td>547<td><code><pre> stmt.TableName = &sqlparser.TableName{Name: &sqlparser.Ident{Name: newTableName}}</pre></code><tr><td>548<td><code><pre> if e := t.replaceCondition(stmt.Condition, oldTableName, newTableName); err != nil {</pre></code><tr class=miss><td>549<td><code><pre> _ = db.AddError(e)</pre></code><tr class=miss><td>550<td><code><pre> return false, nil</pre></code><tr><td>551<td><code><pre> }</pre></code><tr><td>552<td><code><pre> newSQL = stmt.String()</pre></code><tr><td>553<td><code><pre> default:</pre></code><tr class=miss><td>554<td><code><pre> _ = db.AddError(sqlparser.ErrNotImplemented)</pre></code><tr class=miss><td>555<td><code><pre> return</pre></code><tr><td>556<td><code><pre> }</pre></code><tr><td>557<td><code><pre></pre></code><tr><td>558<td><code><pre> sb := strings.Builder{}</pre></code><tr><td>559<td><code><pre> sb.Grow(len(newSQL))</pre></code><tr><td>560<td><code><pre> sb.WriteString(newSQL)</pre></code><tr><td>561<td><code><pre> db.Statement.SQL = sb</pre></code><tr><td>562<td><code><pre></pre></code><tr><td>563<td><code><pre> return true, nil</pre></code><tr><td>564<td><code><pre>}</pre></code></table><div class=funcname id=fn_@580:20>func @580:20</div><div class=info><a href=#s_fn_@580:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>580<td><code><pre>func(src []clause.Expression) (dst []clause.Expression) {</pre></code><tr><td>581<td><code><pre> changeTableFunc := func(src any) (dst any, ok bool) {</pre></code><tr><td>582<td><code><pre> switch col := src.(type) {</pre></code><tr><td>583<td><code><pre> case clause.Column:</pre></code><tr><td>584<td><code><pre> if col.Table == t.config.Table {</pre></code><tr><td>585<td><code><pre> col.Table = db.Statement.Table</pre></code><tr><td>586<td><code><pre> return col, true</pre></code><tr><td>587<td><code><pre> }</pre></code><tr><td>588<td><code><pre> case clause.Table:</pre></code><tr><td>589<td><code><pre> if col.Name == t.config.Table {</pre></code><tr><td>590<td><code><pre> col.Name = db.Statement.Table</pre></code><tr><td>591<td><code><pre> return col, true</pre></code><tr><td>592<td><code><pre> }</pre></code><tr><td>593<td><code><pre> }</pre></code><tr><td>594<td><code><pre> return</pre></code><tr><td>595<td><code><pre> }</pre></code><tr><td>596<td><code><pre> dst = make([]clause.Expression, 0, len(src))</pre></code><tr><td>597<td><code><pre> for _, srcExpr := range src {</pre></code><tr><td>598<td><code><pre> switch expr := srcExpr.(type) {</pre></code><tr><td>599<td><code><pre> case clause.IN:</pre></code><tr class=miss><td>600<td><code><pre> if col, ok := changeTableFunc(expr.Column); ok {</pre></code><tr class=miss><td>601<td><code><pre> expr.Column = col</pre></code><tr><td>602<td><code><pre> }</pre></code><tr class=miss><td>603<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>604<td><code><pre> case clause.Eq:</pre></code><tr class=miss><td>605<td><code><pre> if col, ok := changeTableFunc(expr.Column); ok {</pre></code><tr class=miss><td>606<td><code><pre> expr.Column = col</pre></code><tr><td>607<td><code><pre> }</pre></code><tr class=miss><td>608<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>609<td><code><pre> case clause.Neq:</pre></code><tr class=miss><td>610<td><code><pre> if col, ok := changeTableFunc(expr.Column); ok {</pre></code><tr class=miss><td>611<td><code><pre> expr.Column = col</pre></code><tr><td>612<td><code><pre> }</pre></code><tr class=miss><td>613<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>614<td><code><pre> case clause.Gt:</pre></code><tr class=miss><td>615<td><code><pre> if col, ok := changeTableFunc(expr.Column); ok {</pre></code><tr class=miss><td>616<td><code><pre> expr.Column = col</pre></code><tr><td>617<td><code><pre> }</pre></code><tr class=miss><td>618<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>619<td><code><pre> case clause.Gte:</pre></code><tr class=miss><td>620<td><code><pre> if col, ok := changeTableFunc(expr.Column); ok {</pre></code><tr class=miss><td>621<td><code><pre> expr.Column = col</pre></code><tr><td>622<td><code><pre> }</pre></code><tr class=miss><td>623<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>624<td><code><pre> case clause.Lt:</pre></code><tr class=miss><td>625<td><code><pre> if col, ok := changeTableFunc(expr.Column); ok {</pre></code><tr class=miss><td>626<td><code><pre> expr.Column = col</pre></code><tr><td>627<td><code><pre> }</pre></code><tr class=miss><td>628<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>629<td><code><pre> case clause.Lte:</pre></code><tr class=miss><td>630<td><code><pre> if col, ok := changeTableFunc(expr.Column); ok {</pre></code><tr class=miss><td>631<td><code><pre> expr.Column = col</pre></code><tr><td>632<td><code><pre> }</pre></code><tr class=miss><td>633<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>634<td><code><pre> case clause.Like:</pre></code><tr class=miss><td>635<td><code><pre> if col, ok := changeTableFunc(expr.Column); ok {</pre></code><tr class=miss><td>636<td><code><pre> expr.Column = col</pre></code><tr><td>637<td><code><pre> }</pre></code><tr class=miss><td>638<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>639<td><code><pre> default:</pre></code><tr><td>640<td><code><pre> dst = append(dst, expr)</pre></code><tr><td>641<td><code><pre> }</pre></code><tr><td>642<td><code><pre> }</pre></code><tr><td>643<td><code><pre> return</pre></code><tr><td>644<td><code><pre> }</pre></code></table><div class=funcname id=fn_tableSharding.insertValue>func tableSharding.insertValue</div><div class=info><a href=#s_fn_tableSharding.insertValue>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>731<td><code><pre>func (t *tableSharding) insertValue(keys []string, names []*sqlparser.Ident, exprs []sqlparser.Expr, args ...any) (</pre></code><tr><td>732<td><code><pre> values []any, id uint64, err error) {</pre></code><tr class=miss><td>733<td><code><pre> if len(names) != len(exprs) {</pre></code><tr class=miss><td>734<td><code><pre> return nil, 0, ErrColumnAndExprMisMatch</pre></code><tr><td>735<td><code><pre> }</pre></code><tr><td>736<td><code><pre></pre></code><tr class=miss><td>737<td><code><pre> for _, key := range keys {</pre></code><tr class=miss><td>738<td><code><pre> found := false</pre></code><tr class=miss><td>739<td><code><pre> isPrimaryKey := key == t.shardingPrimaryKey</pre></code><tr class=miss><td>740<td><code><pre> for i, name := range names {</pre></code><tr class=miss><td>741<td><code><pre> if name.Name != key {</pre></code><tr class=miss><td>742<td><code><pre> continue</pre></code><tr><td>743<td><code><pre> }</pre></code><tr><td>744<td><code><pre></pre></code><tr class=miss><td>745<td><code><pre> switch expr := exprs[i].(type) {</pre></code><tr><td>746<td><code><pre> case *sqlparser.BindExpr:</pre></code><tr class=miss><td>747<td><code><pre> if !isPrimaryKey {</pre></code><tr class=miss><td>748<td><code><pre> values = append(values, args[expr.Pos])</pre></code><tr><td>749<td><code><pre> } else {</pre></code><tr class=miss><td>750<td><code><pre> switch v := args[expr.Pos].(type) {</pre></code><tr><td>751<td><code><pre> case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64, string:</pre></code><tr class=miss><td>752<td><code><pre> if id, err = cast.ToUint64E(v); err != nil {</pre></code><tr class=miss><td>753<td><code><pre> return nil, 0, errors.Wrapf(err, "parse id as uint64 failed [%v]", v)</pre></code><tr><td>754<td><code><pre> }</pre></code><tr><td>755<td><code><pre> default:</pre></code><tr class=miss><td>756<td><code><pre> return nil, 0, ErrInvalidID</pre></code><tr><td>757<td><code><pre> }</pre></code><tr class=miss><td>758<td><code><pre> if id != 0 {</pre></code><tr class=miss><td>759<td><code><pre> values = append(values, args[expr.Pos])</pre></code><tr><td>760<td><code><pre> }</pre></code><tr><td>761<td><code><pre> }</pre></code><tr><td>762<td><code><pre> case *sqlparser.StringLit:</pre></code><tr class=miss><td>763<td><code><pre> if !isPrimaryKey {</pre></code><tr class=miss><td>764<td><code><pre> values = append(values, expr.Value)</pre></code><tr><td>765<td><code><pre> } else {</pre></code><tr class=miss><td>766<td><code><pre> if id, err = cast.ToUint64E(expr.Value); err != nil {</pre></code><tr class=miss><td>767<td><code><pre> return nil, 0, errors.Wrapf(err, "parse id as uint64 failed [%s]", expr.Value)</pre></code><tr><td>768<td><code><pre> }</pre></code><tr class=miss><td>769<td><code><pre> if id != 0 {</pre></code><tr class=miss><td>770<td><code><pre> values = append(values, expr.Value)</pre></code><tr><td>771<td><code><pre> }</pre></code><tr><td>772<td><code><pre> }</pre></code><tr><td>773<td><code><pre> case *sqlparser.NumberLit:</pre></code><tr class=miss><td>774<td><code><pre> if !isPrimaryKey {</pre></code><tr class=miss><td>775<td><code><pre> values = append(values, expr.Value)</pre></code><tr><td>776<td><code><pre> } else {</pre></code><tr class=miss><td>777<td><code><pre> if id, err = strconv.ParseUint(expr.Value, 10, 64); err != nil {</pre></code><tr class=miss><td>778<td><code><pre> return nil, 0, errors.Wrapf(err,</pre></code><tr><td>779<td><code><pre> "parse id as uint64 failed [%s]", expr.Value)</pre></code><tr><td>780<td><code><pre> }</pre></code><tr class=miss><td>781<td><code><pre> if id != 0 {</pre></code><tr class=miss><td>782<td><code><pre> values = append(values, expr.Value)</pre></code><tr><td>783<td><code><pre> }</pre></code><tr><td>784<td><code><pre> }</pre></code><tr><td>785<td><code><pre> default:</pre></code><tr class=miss><td>786<td><code><pre> return nil, 0, sqlparser.ErrNotImplemented</pre></code><tr><td>787<td><code><pre> }</pre></code><tr><td>788<td><code><pre></pre></code><tr class=miss><td>789<td><code><pre> found = true</pre></code><tr class=miss><td>790<td><code><pre> break</pre></code><tr><td>791<td><code><pre> }</pre></code><tr class=miss><td>792<td><code><pre> if !found && !isPrimaryKey {</pre></code><tr class=miss><td>793<td><code><pre> return nil, 0, ErrMissingShardingKey</pre></code><tr><td>794<td><code><pre> }</pre></code><tr><td>795<td><code><pre> }</pre></code><tr><td>796<td><code><pre></pre></code><tr class=miss><td>797<td><code><pre> return</pre></code><tr><td>798<td><code><pre>}</pre></code></table><div class=funcname id=fn_tableSharding.ShardingByValues>func tableSharding.ShardingByValues</div><div class=info><a href=#s_fn_tableSharding.ShardingByValues>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>172<td><code><pre>func (t *tableSharding) ShardingByValues(ctx context.Context, src []map[string]any) (</pre></code><tr><td>173<td><code><pre> dst map[string][]map[string]any, err error) {</pre></code><tr class=miss><td>174<td><code><pre> dst = make(map[string][]map[string]any, len(t.config.ShardingKeys))</pre></code><tr class=miss><td>175<td><code><pre> for _, col := range src {</pre></code><tr class=miss><td>176<td><code><pre> values := make([]any, 0, len(col))</pre></code><tr class=miss><td>177<td><code><pre> for _, k := range t.config.ShardingKeys {</pre></code><tr class=miss><td>178<td><code><pre> value, ok := col[k]</pre></code><tr class=miss><td>179<td><code><pre> if !ok {</pre></code><tr class=miss><td>180<td><code><pre> return dst, errors.Errorf("sharding key not found [column[%s]]", k)</pre></code><tr><td>181<td><code><pre> }</pre></code><tr class=miss><td>182<td><code><pre> if k == t.shardingPrimaryKey && utils.IsBlank(value) {</pre></code><tr class=miss><td>183<td><code><pre> return dst, ErrInvalidID</pre></code><tr><td>184<td><code><pre> }</pre></code><tr class=miss><td>185<td><code><pre> values = append(values, value)</pre></code><tr><td>186<td><code><pre> }</pre></code><tr class=miss><td>187<td><code><pre> suffix, err := t.shardingFunc(ctx, values...)</pre></code><tr class=miss><td>188<td><code><pre> if err != nil {</pre></code><tr class=miss><td>189<td><code><pre> return dst, err</pre></code><tr><td>190<td><code><pre> }</pre></code><tr class=miss><td>191<td><code><pre> dst[suffix] = append(dst[suffix], col)</pre></code><tr><td>192<td><code><pre> }</pre></code><tr class=miss><td>193<td><code><pre> return</pre></code><tr><td>194<td><code><pre>}</pre></code></table><div class=funcname id=fn_@655:11>func @655:11</div><div class=info><a href=#s_fn_@655:11>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>655<td><code><pre>func(cls clause.Clause) {</pre></code><tr class=miss><td>656<td><code><pre> fromClause, ok := cls.Expression.(clause.From)</pre></code><tr class=miss><td>657<td><code><pre> if !ok {</pre></code><tr class=miss><td>658<td><code><pre> return</pre></code><tr><td>659<td><code><pre> }</pre></code><tr class=miss><td>660<td><code><pre> tables := make([]clause.Table, 0, len(fromClause.Tables))</pre></code><tr class=miss><td>661<td><code><pre> for _, table := range fromClause.Tables {</pre></code><tr class=miss><td>662<td><code><pre> if table.Name == t.config.Table {</pre></code><tr class=miss><td>663<td><code><pre> table.Name = db.Statement.Table</pre></code><tr class=miss><td>664<td><code><pre> tables = append(tables, table)</pre></code><tr><td>665<td><code><pre> } else {</pre></code><tr class=miss><td>666<td><code><pre> tables = append(tables, table)</pre></code><tr><td>667<td><code><pre> }</pre></code><tr><td>668<td><code><pre> }</pre></code><tr class=miss><td>669<td><code><pre> fromClause.Tables = tables</pre></code><tr class=miss><td>670<td><code><pre> cls.Expression = fromClause</pre></code><tr class=miss><td>671<td><code><pre> db.Statement.Clauses["FROM"] = cls</pre></code><tr><td>672<td><code><pre> }</pre></code></table><div class=funcname id=fn_@581:22>func @581:22</div><div class=info><a href=#s_fn_@581:22>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>581<td><code><pre>func(src any) (dst any, ok bool) {</pre></code><tr class=miss><td>582<td><code><pre> switch col := src.(type) {</pre></code><tr><td>583<td><code><pre> case clause.Column:</pre></code><tr class=miss><td>584<td><code><pre> if col.Table == t.config.Table {</pre></code><tr class=miss><td>585<td><code><pre> col.Table = db.Statement.Table</pre></code><tr class=miss><td>586<td><code><pre> return col, true</pre></code><tr><td>587<td><code><pre> }</pre></code><tr><td>588<td><code><pre> case clause.Table:</pre></code><tr class=miss><td>589<td><code><pre> if col.Name == t.config.Table {</pre></code><tr class=miss><td>590<td><code><pre> col.Name = db.Statement.Table</pre></code><tr class=miss><td>591<td><code><pre> return col, true</pre></code><tr><td>592<td><code><pre> }</pre></code><tr><td>593<td><code><pre> }</pre></code><tr class=miss><td>594<td><code><pre> return</pre></code><tr><td>595<td><code><pre> }</pre></code></table><div class=funcname id=fn_@241:3>func @241:3</div><div class=info><a href=#s_fn_@241:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>241<td><code><pre>func() bool {</pre></code><tr class=miss><td>242<td><code><pre> callbacks.BuildCreateSQL(db)</pre></code><tr class=miss><td>243<td><code><pre> t.wrapDispatchTableBySQL(db, tableShardingIsInsert())</pre></code><tr class=miss><td>244<td><code><pre> return true</pre></code><tr><td>245<td><code><pre> }</pre></code></table><div class=funcname id=fn_@263:3>func @263:3</div><div class=info><a href=#s_fn_@263:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>263<td><code><pre>func() bool {</pre></code><tr class=miss><td>264<td><code><pre> callbacks.BuildUpdateSQL(db)</pre></code><tr class=miss><td>265<td><code><pre> t.wrapDispatchTableBySQL(db)</pre></code><tr class=miss><td>266<td><code><pre> return true</pre></code><tr><td>267<td><code><pre> }</pre></code></table><div class=funcname id=fn_shardingDialector.SavePoint>func shardingDialector.SavePoint</div><div class=info><a href=#s_fn_shardingDialector.SavePoint>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1187<td><code><pre>func (s shardingDialector) SavePoint(tx *gorm.DB, name string) error {</pre></code><tr class=miss><td>1188<td><code><pre> if savePointer, ok := s.Dialector.(gorm.SavePointerDialectorInterface); ok {</pre></code><tr class=miss><td>1189<td><code><pre> return savePointer.SavePoint(tx, name)</pre></code><tr><td>1190<td><code><pre> } else {</pre></code><tr class=miss><td>1191<td><code><pre> return gorm.ErrUnsupportedDriver</pre></code><tr><td>1192<td><code><pre> }</pre></code><tr><td>1193<td><code><pre>}</pre></code></table><div class=funcname id=fn_shardingDialector.RollbackTo>func shardingDialector.RollbackTo</div><div class=info><a href=#s_fn_shardingDialector.RollbackTo>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1194<td><code><pre>func (s shardingDialector) RollbackTo(tx *gorm.DB, name string) error {</pre></code><tr class=miss><td>1195<td><code><pre> if savePointer, ok := s.Dialector.(gorm.SavePointerDialectorInterface); ok {</pre></code><tr class=miss><td>1196<td><code><pre> return savePointer.RollbackTo(tx, name)</pre></code><tr><td>1197<td><code><pre> } else {</pre></code><tr class=miss><td>1198<td><code><pre> return gorm.ErrUnsupportedDriver</pre></code><tr><td>1199<td><code><pre> }</pre></code><tr><td>1200<td><code><pre>}</pre></code></table><div class=funcname id=fn_@674:15>func @674:15</div><div class=info><a href=#s_fn_@674:15>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>674<td><code><pre>func(cls clause.Clause) {</pre></code><tr class=miss><td>675<td><code><pre> _, ok := cls.Expression.(clause.OrderBy)</pre></code><tr class=miss><td>676<td><code><pre> if !ok {</pre></code><tr class=miss><td>677<td><code><pre> return</pre></code><tr><td>678<td><code><pre> }</pre></code><tr><td>679<td><code><pre> }</pre></code></table><div class=funcname id=fn_@284:3>func @284:3</div><div class=info><a href=#s_fn_@284:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr class=miss><td>284<td><code><pre>func() bool { ok1, ok2 := t.dispatchTableByModel(db); return ok1 || ok2 }</pre></code></table><div class=funcname id=fn_@285:3>func @285:3</div><div class=info><a href=#s_fn_@285:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr class=miss><td>285<td><code><pre>func() bool { t.wrapDispatchTableBySQL(db); return true }</pre></code></table><div class=funcname id=fn_@1003:10>func @1003:10</div><div class=info><a href=#s_fn_@1003:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/plugins/table_sharding.go</code>:</div><table class=listing><tr><td>1003<td><code><pre>func() {}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/db/softdelete class=funcname>Package Overview: github.com/wfusion/gofusion/db/softdelete 26 <span class=packageTotal>59.0%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_deletedDeleteClause.ModifyStatement><td><code><a href=#fn_deletedDeleteClause.ModifyStatement>deletedDeleteClause.ModifyStatement(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>100.0%</code><td class=linecount><code>8/8</code><tr id=s_fn_@22:27><td><code><a href=#fn_@22:27>@22:27(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deletedat.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_TimestampUpdateClause.ModifyStatement><td><code><a href=#fn_TimestampUpdateClause.ModifyStatement>TimestampUpdateClause.ModifyStatement(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@20:3><td><code><a href=#fn_@20:3>@20:3(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@24:25><td><code><a href=#fn_@24:25>@24:25(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deletedat.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@18:3><td><code><a href=#fn_@18:3>@18:3(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_IsClausesWithSoftDelete><td><code><a href=#fn_IsClausesWithSoftDelete>IsClausesWithSoftDelete(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@21:3><td><code><a href=#fn_@21:3>@21:3(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_deletedUpdateClause.ModifyStatement><td><code><a href=#fn_deletedUpdateClause.ModifyStatement>deletedUpdateClause.ModifyStatement(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@19:3><td><code><a href=#fn_@19:3>@19:3(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_PatchGormDeleteAt><td><code><a href=#fn_PatchGormDeleteAt>PatchGormDeleteAt(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deletedat.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_Timestamp.UpdateClauses><td><code><a href=#fn_Timestamp.UpdateClauses>Timestamp.UpdateClauses(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Timestamp.QueryClauses><td><code><a href=#fn_Timestamp.QueryClauses>Timestamp.QueryClauses(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Timestamp.DeleteClauses><td><code><a href=#fn_Timestamp.DeleteClauses>Timestamp.DeleteClauses(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Deleted.DeleteClauses><td><code><a href=#fn_Deleted.DeleteClauses>Deleted.DeleteClauses(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Timestamp.Scan><td><code><a href=#fn_Timestamp.Scan>Timestamp.Scan(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Deleted.QueryClauses><td><code><a href=#fn_Deleted.QueryClauses>Deleted.QueryClauses(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Deleted.Value><td><code><a href=#fn_Deleted.Value>Deleted.Value(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Deleted.UpdateClauses><td><code><a href=#fn_Deleted.UpdateClauses>Deleted.UpdateClauses(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_TimestampDeleteClause.ModifyStatement><td><code><a href=#fn_TimestampDeleteClause.ModifyStatement>TimestampDeleteClause.ModifyStatement(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_Deleted.Scan><td><code><a href=#fn_Deleted.Scan>Deleted.Scan(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_deletedQueryClause.ModifyStatement><td><code><a href=#fn_deletedQueryClause.ModifyStatement>deletedQueryClause.ModifyStatement(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>66.7%</code><td class=linecount><code>8/12</code><tr id=s_fn_TimestampQueryClause.ModifyStatement><td><code><a href=#fn_TimestampQueryClause.ModifyStatement>TimestampQueryClause.ModifyStatement(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>66.7%</code><td class=linecount><code>8/12</code><tr id=s_fn_Timestamp.Value><td><code><a href=#fn_Timestamp.Value>Timestamp.Value(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_parseStatusZeroValueTag><td><code><a href=#fn_parseStatusZeroValueTag>parseStatusZeroValueTag(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>50.0%</code><td class=linecount><code>2/4</code><tr id=s_fn_parseTimestampZeroValueTag><td><code><a href=#fn_parseTimestampZeroValueTag>parseTimestampZeroValueTag(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>50.0%</code><td class=linecount><code>2/4</code><tr id=s_fn_gormSoftDeleteDeleteClauseModifyStatement><td><code><a href=#fn_gormSoftDeleteDeleteClauseModifyStatement>gormSoftDeleteDeleteClauseModifyStatement(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deletedat.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/10</code><tr id=s_fn_Timestamp.UnmarshalJSON><td><code><a href=#fn_Timestamp.UnmarshalJSON>Timestamp.UnmarshalJSON(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_Deleted.UnmarshalJSON><td><code><a href=#fn_Deleted.UnmarshalJSON>Deleted.UnmarshalJSON(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_Timestamp.MarshalJSON><td><code><a href=#fn_Timestamp.MarshalJSON>Timestamp.MarshalJSON(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_deletedQueryClause.Name><td><code><a href=#fn_deletedQueryClause.Name>deletedQueryClause.Name(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_TimestampQueryClause.Name><td><code><a href=#fn_TimestampQueryClause.Name>TimestampQueryClause.Name(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_deletedDeleteClause.Name><td><code><a href=#fn_deletedDeleteClause.Name>deletedDeleteClause.Name(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_TimestampDeleteClause.Name><td><code><a href=#fn_TimestampDeleteClause.Name>TimestampDeleteClause.Name(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Deleted.MarshalJSON><td><code><a href=#fn_Deleted.MarshalJSON>Deleted.MarshalJSON(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_deletedUpdateClause.Name><td><code><a href=#fn_deletedUpdateClause.Name>deletedUpdateClause.Name(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_TimestampUpdateClause.Name><td><code><a href=#fn_TimestampUpdateClause.Name>TimestampUpdateClause.Name(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_TimestampUpdateClause.MergeClause><td><code><a href=#fn_TimestampUpdateClause.MergeClause>TimestampUpdateClause.MergeClause(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>100.0%</code><td class=linecount><code>0/0</code><tr id=s_fn_TimestampUpdateClause.Build><td><code><a href=#fn_TimestampUpdateClause.Build>TimestampUpdateClause.Build(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>100.0%</code><td class=linecount><code>0/0</code><tr id=s_fn_deletedUpdateClause.Build><td><code><a href=#fn_deletedUpdateClause.Build>deletedUpdateClause.Build(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>100.0%</code><td class=linecount><code>0/0</code><tr id=s_fn_TimestampDeleteClause.Build><td><code><a href=#fn_TimestampDeleteClause.Build>TimestampDeleteClause.Build(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>100.0%</code><td class=linecount><code>0/0</code><tr id=s_fn_TimestampDeleteClause.MergeClause><td><code><a href=#fn_TimestampDeleteClause.MergeClause>TimestampDeleteClause.MergeClause(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>100.0%</code><td class=linecount><code>0/0</code><tr id=s_fn_deletedQueryClause.MergeClause><td><code><a href=#fn_deletedQueryClause.MergeClause>deletedQueryClause.MergeClause(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>100.0%</code><td class=linecount><code>0/0</code><tr id=s_fn_TimestampQueryClause.MergeClause><td><code><a href=#fn_TimestampQueryClause.MergeClause>TimestampQueryClause.MergeClause(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>100.0%</code><td class=linecount><code>0/0</code><tr id=s_fn_TimestampQueryClause.Build><td><code><a href=#fn_TimestampQueryClause.Build>TimestampQueryClause.Build(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/timestamp.go</code><td class=percent><code>100.0%</code><td class=linecount><code>0/0</code><tr id=s_fn_deletedUpdateClause.MergeClause><td><code><a href=#fn_deletedUpdateClause.MergeClause>deletedUpdateClause.MergeClause(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>100.0%</code><td class=linecount><code>0/0</code><tr id=s_fn_deletedDeleteClause.Build><td><code><a href=#fn_deletedDeleteClause.Build>deletedDeleteClause.Build(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>100.0%</code><td class=linecount><code>0/0</code><tr id=s_fn_deletedDeleteClause.MergeClause><td><code><a href=#fn_deletedDeleteClause.MergeClause>deletedDeleteClause.MergeClause(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>100.0%</code><td class=linecount><code>0/0</code><tr id=s_fn_deletedQueryClause.Build><td><code><a href=#fn_deletedQueryClause.Build>deletedQueryClause.Build(...)</a></code><td><code>github.com/wfusion/gofusion/db/softdelete/deleted.go</code><td class=percent><code>100.0%</code><td class=linecount><code>0/0</code></table><div class=funcname id=fn_deletedDeleteClause.ModifyStatement>func deletedDeleteClause.ModifyStatement</div><div class=info><a href=#s_fn_deletedDeleteClause.ModifyStatement>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>125<td><code><pre>func (s deletedDeleteClause) ModifyStatement(stmt *gorm.Statement) {</pre></code><tr><td>126<td><code><pre> deleted := true</pre></code><tr><td>127<td><code><pre> setClauses := clause.Set{{Column: clause.Column{Name: s.Field.DBName}, Value: deleted}}</pre></code><tr><td>128<td><code><pre> if clauses, ok := stmt.Clauses[setClauses.Name()]; ok {</pre></code><tr><td>129<td><code><pre> if exprClauses, ok := clauses.Expression.(clause.Set); ok {</pre></code><tr><td>130<td><code><pre> setClauses = append(setClauses, exprClauses...)</pre></code><tr><td>131<td><code><pre> }</pre></code><tr><td>132<td><code><pre> }</pre></code><tr><td>133<td><code><pre> stmt.AddClause(setClauses)</pre></code><tr><td>134<td><code><pre> stmt.SetColumn(s.Field.DBName, deleted, true)</pre></code><tr><td>135<td><code><pre></pre></code><tr><td>136<td><code><pre> deletedQueryClause(s).ModifyStatement(stmt)</pre></code><tr><td>137<td><code><pre>}</pre></code></table><div class=funcname id=fn_@22:27>func @22:27</div><div class=info><a href=#s_fn_@22:27>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deletedat.go</code>:</div><table class=listing><tr><td>22<td><code><pre>func() {</pre></code><tr><td>23<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>24<td><code><pre> _, err := utils.Catch(func() {</pre></code><tr><td>25<td><code><pre> patches = gomonkey.ApplyMethod(gorm.SoftDeleteDeleteClause{},</pre></code><tr><td>26<td><code><pre> "ModifyStatement", gormSoftDeleteDeleteClauseModifyStatement)</pre></code><tr><td>27<td><code><pre> log.Printf("%v [Gofusion] %s patch gorm.SoftDeleteDeleteClause success", pid, config.ComponentDB)</pre></code><tr><td>28<td><code><pre> })</pre></code><tr><td>29<td><code><pre> if err != nil {</pre></code><tr><td>30<td><code><pre> log.Printf("%v [Gofusion] %s patch gorm.SoftDeleteDeleteClause failed: %s",</pre></code><tr><td>31<td><code><pre> pid, config.ComponentDB, errors.Cause(err))</pre></code><tr><td>32<td><code><pre> }</pre></code><tr><td>33<td><code><pre> }</pre></code></table><div class=funcname id=fn_TimestampUpdateClause.ModifyStatement>func TimestampUpdateClause.ModifyStatement</div><div class=info><a href=#s_fn_TimestampUpdateClause.ModifyStatement>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>104<td><code><pre>func (t TimestampUpdateClause) ModifyStatement(stmt *gorm.Statement) {</pre></code><tr><td>105<td><code><pre> if stmt.SQL.Len() == 0 && !stmt.Statement.Unscoped {</pre></code><tr><td>106<td><code><pre> TimestampQueryClause(t).ModifyStatement(stmt)</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre>}</pre></code></table><div class=funcname id=fn_@20:3>func @20:3</div><div class=info><a href=#s_fn_@20:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/types.go</code>:</div><table class=listing><tr><td>20<td><code><pre>func() (ok bool) { _, withSoftDelete = clauses[timestampEnabledFlag]; return withSoftDelete }</pre></code></table><div class=funcname id=fn_@24:25>func @24:25</div><div class=info><a href=#s_fn_@24:25>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deletedat.go</code>:</div><table class=listing><tr><td>24<td><code><pre>func() {</pre></code><tr><td>25<td><code><pre> patches = gomonkey.ApplyMethod(gorm.SoftDeleteDeleteClause{},</pre></code><tr><td>26<td><code><pre> "ModifyStatement", gormSoftDeleteDeleteClauseModifyStatement)</pre></code><tr><td>27<td><code><pre> log.Printf("%v [Gofusion] %s patch gorm.SoftDeleteDeleteClause success", pid, config.ComponentDB)</pre></code><tr><td>28<td><code><pre> }</pre></code></table><div class=funcname id=fn_@18:3>func @18:3</div><div class=info><a href=#s_fn_@18:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/types.go</code>:</div><table class=listing><tr><td>18<td><code><pre>func() (ok bool) { _, withSoftDelete = clauses[defaultEnabledFlag]; return withSoftDelete }</pre></code></table><div class=funcname id=fn_IsClausesWithSoftDelete>func IsClausesWithSoftDelete</div><div class=info><a href=#s_fn_IsClausesWithSoftDelete>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/types.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func IsClausesWithSoftDelete(clauses map[string]clause.Clause) (withSoftDelete bool) {</pre></code><tr><td>17<td><code><pre> utils.IfAny(</pre></code><tr><td>18<td><code><pre> func() (ok bool) { _, withSoftDelete = clauses[defaultEnabledFlag]; return withSoftDelete },</pre></code><tr><td>19<td><code><pre> func() (ok bool) { _, withSoftDelete = clauses[statusEnabledFlag]; return withSoftDelete },</pre></code><tr><td>20<td><code><pre> func() (ok bool) { _, withSoftDelete = clauses[timestampEnabledFlag]; return withSoftDelete },</pre></code><tr><td>21<td><code><pre> func() (ok bool) { _, withSoftDelete = clauses[deletedAtEnabledFlag]; return withSoftDelete },</pre></code><tr><td>22<td><code><pre> )</pre></code><tr><td>23<td><code><pre> return</pre></code><tr><td>24<td><code><pre>}</pre></code></table><div class=funcname id=fn_@21:3>func @21:3</div><div class=info><a href=#s_fn_@21:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/types.go</code>:</div><table class=listing><tr><td>21<td><code><pre>func() (ok bool) { _, withSoftDelete = clauses[deletedAtEnabledFlag]; return withSoftDelete }</pre></code></table><div class=funcname id=fn_deletedUpdateClause.ModifyStatement>func deletedUpdateClause.ModifyStatement</div><div class=info><a href=#s_fn_deletedUpdateClause.ModifyStatement>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>103<td><code><pre>func (s deletedUpdateClause) ModifyStatement(stmt *gorm.Statement) {</pre></code><tr><td>104<td><code><pre> if stmt.SQL.Len() == 0 && !stmt.Statement.Unscoped {</pre></code><tr><td>105<td><code><pre> deletedQueryClause(s).ModifyStatement(stmt)</pre></code><tr><td>106<td><code><pre> }</pre></code><tr><td>107<td><code><pre>}</pre></code></table><div class=funcname id=fn_@19:3>func @19:3</div><div class=info><a href=#s_fn_@19:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/types.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func() (ok bool) { _, withSoftDelete = clauses[statusEnabledFlag]; return withSoftDelete }</pre></code></table><div class=funcname id=fn_PatchGormDeleteAt>func PatchGormDeleteAt</div><div class=info><a href=#s_fn_PatchGormDeleteAt>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deletedat.go</code>:</div><table class=listing><tr><td>21<td><code><pre>func PatchGormDeleteAt() (patches *gomonkey.Patches) {</pre></code><tr><td>22<td><code><pre> PatchGormDeleteAtOnce.Do(func() {</pre></code><tr><td>23<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>24<td><code><pre> _, err := utils.Catch(func() {</pre></code><tr><td>25<td><code><pre> patches = gomonkey.ApplyMethod(gorm.SoftDeleteDeleteClause{},</pre></code><tr><td>26<td><code><pre> "ModifyStatement", gormSoftDeleteDeleteClauseModifyStatement)</pre></code><tr><td>27<td><code><pre> log.Printf("%v [Gofusion] %s patch gorm.SoftDeleteDeleteClause success", pid, config.ComponentDB)</pre></code><tr><td>28<td><code><pre> })</pre></code><tr><td>29<td><code><pre> if err != nil {</pre></code><tr><td>30<td><code><pre> log.Printf("%v [Gofusion] %s patch gorm.SoftDeleteDeleteClause failed: %s",</pre></code><tr><td>31<td><code><pre> pid, config.ComponentDB, errors.Cause(err))</pre></code><tr><td>32<td><code><pre> }</pre></code><tr><td>33<td><code><pre> })</pre></code><tr><td>34<td><code><pre></pre></code><tr><td>35<td><code><pre> return</pre></code><tr><td>36<td><code><pre>}</pre></code></table><div class=funcname id=fn_Timestamp.UpdateClauses>func Timestamp.UpdateClauses</div><div class=info><a href=#s_fn_Timestamp.UpdateClauses>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>88<td><code><pre>func (Timestamp) UpdateClauses(f *schema.Field) []clause.Interface {</pre></code><tr><td>89<td><code><pre> return []clause.Interface{TimestampUpdateClause{Field: f, ZeroValue: parseTimestampZeroValueTag(f)}}</pre></code><tr><td>90<td><code><pre>}</pre></code></table><div class=funcname id=fn_Timestamp.QueryClauses>func Timestamp.QueryClauses</div><div class=info><a href=#s_fn_Timestamp.QueryClauses>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func (Timestamp) QueryClauses(f *schema.Field) []clause.Interface {</pre></code><tr><td>50<td><code><pre> return []clause.Interface{TimestampQueryClause{Field: f, ZeroValue: parseTimestampZeroValueTag(f)}}</pre></code><tr><td>51<td><code><pre>}</pre></code></table><div class=funcname id=fn_Timestamp.DeleteClauses>func Timestamp.DeleteClauses</div><div class=info><a href=#s_fn_Timestamp.DeleteClauses>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>110<td><code><pre>func (Timestamp) DeleteClauses(f *schema.Field) []clause.Interface {</pre></code><tr><td>111<td><code><pre> return []clause.Interface{TimestampDeleteClause{Field: f, ZeroValue: parseTimestampZeroValueTag(f)}}</pre></code><tr><td>112<td><code><pre>}</pre></code></table><div class=funcname id=fn_Deleted.DeleteClauses>func Deleted.DeleteClauses</div><div class=info><a href=#s_fn_Deleted.DeleteClauses>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>109<td><code><pre>func (Deleted) DeleteClauses(f *schema.Field) []clause.Interface {</pre></code><tr><td>110<td><code><pre> return []clause.Interface{deletedDeleteClause{Field: f, ZeroValue: parseStatusZeroValueTag(f)}}</pre></code><tr><td>111<td><code><pre>}</pre></code></table><div class=funcname id=fn_Timestamp.Scan>func Timestamp.Scan</div><div class=info><a href=#s_fn_Timestamp.Scan>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func (t *Timestamp) Scan(value any) error {</pre></code><tr><td>20<td><code><pre> return (*sql.NullInt64)(t).Scan(value)</pre></code><tr><td>21<td><code><pre>}</pre></code></table><div class=funcname id=fn_Deleted.QueryClauses>func Deleted.QueryClauses</div><div class=info><a href=#s_fn_Deleted.QueryClauses>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>47<td><code><pre>func (Deleted) QueryClauses(f *schema.Field) []clause.Interface {</pre></code><tr><td>48<td><code><pre> return []clause.Interface{deletedQueryClause{Field: f, ZeroValue: parseStatusZeroValueTag(f)}}</pre></code><tr><td>49<td><code><pre>}</pre></code></table><div class=funcname id=fn_Deleted.Value>func Deleted.Value</div><div class=info><a href=#s_fn_Deleted.Value>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>27<td><code><pre>func (s Deleted) Value() (driver.Value, error) {</pre></code><tr><td>28<td><code><pre> return bool(s), nil</pre></code><tr><td>29<td><code><pre>}</pre></code></table><div class=funcname id=fn_Deleted.UpdateClauses>func Deleted.UpdateClauses</div><div class=info><a href=#s_fn_Deleted.UpdateClauses>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>87<td><code><pre>func (Deleted) UpdateClauses(f *schema.Field) []clause.Interface {</pre></code><tr><td>88<td><code><pre> return []clause.Interface{deletedUpdateClause{Field: f, ZeroValue: parseStatusZeroValueTag(f)}}</pre></code><tr><td>89<td><code><pre>}</pre></code></table><div class=funcname id=fn_TimestampDeleteClause.ModifyStatement>func TimestampDeleteClause.ModifyStatement</div><div class=info><a href=#s_fn_TimestampDeleteClause.ModifyStatement>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>126<td><code><pre>func (t TimestampDeleteClause) ModifyStatement(stmt *gorm.Statement) {</pre></code><tr><td>127<td><code><pre> if stmt.Statement.Unscoped || stmt.SQL.Len() > 0 {</pre></code><tr><td>128<td><code><pre> return</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre></pre></code><tr><td>131<td><code><pre> curTimestamp := utils.GetTimeStamp(stmt.DB.NowFunc())</pre></code><tr><td>132<td><code><pre> setClauses := clause.Set{{Column: clause.Column{Name: t.Field.DBName}, Value: curTimestamp}}</pre></code><tr><td>133<td><code><pre> if clauses, ok := stmt.Clauses[setClauses.Name()]; ok {</pre></code><tr class=miss><td>134<td><code><pre> if exprClauses, ok := clauses.Expression.(clause.Set); ok {</pre></code><tr class=miss><td>135<td><code><pre> setClauses = append(setClauses, exprClauses...)</pre></code><tr><td>136<td><code><pre> }</pre></code><tr><td>137<td><code><pre> }</pre></code><tr><td>138<td><code><pre> stmt.AddClause(setClauses)</pre></code><tr><td>139<td><code><pre> stmt.SetColumn(t.Field.DBName, curTimestamp, true)</pre></code><tr><td>140<td><code><pre></pre></code><tr><td>141<td><code><pre> TimestampQueryClause(t).ModifyStatement(stmt)</pre></code><tr><td>142<td><code><pre>}</pre></code></table><div class=funcname id=fn_Deleted.Scan>func Deleted.Scan</div><div class=info><a href=#s_fn_Deleted.Scan>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>17<td><code><pre>func (s *Deleted) Scan(value any) (err error) {</pre></code><tr><td>18<td><code><pre> var b bool</pre></code><tr><td>19<td><code><pre> if err = convertAssignRows(&b, value, nil); err != nil {</pre></code><tr class=miss><td>20<td><code><pre> return</pre></code><tr><td>21<td><code><pre> }</pre></code><tr><td>22<td><code><pre> *s = Deleted(b)</pre></code><tr><td>23<td><code><pre> return</pre></code><tr><td>24<td><code><pre>}</pre></code></table><div class=funcname id=fn_deletedQueryClause.ModifyStatement>func deletedQueryClause.ModifyStatement</div><div class=info><a href=#s_fn_deletedQueryClause.ModifyStatement>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>63<td><code><pre>func (s deletedQueryClause) ModifyStatement(stmt *gorm.Statement) {</pre></code><tr><td>64<td><code><pre> if _, ok := stmt.Clauses[statusEnabledFlag]; ok || stmt.Statement.Unscoped {</pre></code><tr><td>65<td><code><pre> return</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre></pre></code><tr><td>68<td><code><pre> if c, ok := stmt.Clauses["WHERE"]; ok {</pre></code><tr><td>69<td><code><pre> if where, ok := c.Expression.(clause.Where); ok && len(where.Exprs) >= 1 {</pre></code><tr><td>70<td><code><pre> for _, expr := range where.Exprs {</pre></code><tr><td>71<td><code><pre> if orCond, ok := expr.(clause.OrConditions); ok && len(orCond.Exprs) == 1 {</pre></code><tr class=miss><td>72<td><code><pre> where.Exprs = []clause.Expression{clause.And(where.Exprs...)}</pre></code><tr class=miss><td>73<td><code><pre> c.Expression = where</pre></code><tr class=miss><td>74<td><code><pre> stmt.Clauses["WHERE"] = c</pre></code><tr class=miss><td>75<td><code><pre> break</pre></code><tr><td>76<td><code><pre> }</pre></code><tr><td>77<td><code><pre> }</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre> }</pre></code><tr><td>80<td><code><pre></pre></code><tr><td>81<td><code><pre> stmt.AddClause(clause.Where{Exprs: []clause.Expression{</pre></code><tr><td>82<td><code><pre> clause.Eq{Column: clause.Column{Table: clause.CurrentTable, Name: s.Field.DBName}, Value: s.ZeroValue},</pre></code><tr><td>83<td><code><pre> }})</pre></code><tr><td>84<td><code><pre> stmt.Clauses[statusEnabledFlag] = clause.Clause{}</pre></code><tr><td>85<td><code><pre>}</pre></code></table><div class=funcname id=fn_TimestampQueryClause.ModifyStatement>func TimestampQueryClause.ModifyStatement</div><div class=info><a href=#s_fn_TimestampQueryClause.ModifyStatement>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>65<td><code><pre>func (t TimestampQueryClause) ModifyStatement(stmt *gorm.Statement) {</pre></code><tr><td>66<td><code><pre> if _, ok := stmt.Clauses[timestampEnabledFlag]; ok || stmt.Statement.Unscoped {</pre></code><tr><td>67<td><code><pre> return</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre> if c, ok := stmt.Clauses["WHERE"]; ok {</pre></code><tr><td>70<td><code><pre> if where, ok := c.Expression.(clause.Where); ok && len(where.Exprs) >= 1 {</pre></code><tr><td>71<td><code><pre> for _, expr := range where.Exprs {</pre></code><tr><td>72<td><code><pre> if orCond, ok := expr.(clause.OrConditions); ok && len(orCond.Exprs) == 1 {</pre></code><tr class=miss><td>73<td><code><pre> where.Exprs = []clause.Expression{clause.And(where.Exprs...)}</pre></code><tr class=miss><td>74<td><code><pre> c.Expression = where</pre></code><tr class=miss><td>75<td><code><pre> stmt.Clauses["WHERE"] = c</pre></code><tr class=miss><td>76<td><code><pre> break</pre></code><tr><td>77<td><code><pre> }</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre> }</pre></code><tr><td>80<td><code><pre> }</pre></code><tr><td>81<td><code><pre></pre></code><tr><td>82<td><code><pre> stmt.AddClause(clause.Where{Exprs: []clause.Expression{</pre></code><tr><td>83<td><code><pre> clause.Eq{Column: clause.Column{Table: clause.CurrentTable, Name: t.Field.DBName}, Value: t.ZeroValue},</pre></code><tr><td>84<td><code><pre> }})</pre></code><tr><td>85<td><code><pre> stmt.Clauses[timestampEnabledFlag] = clause.Clause{}</pre></code><tr><td>86<td><code><pre>}</pre></code></table><div class=funcname id=fn_Timestamp.Value>func Timestamp.Value</div><div class=info><a href=#s_fn_Timestamp.Value>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>24<td><code><pre>func (t Timestamp) Value() (driver.Value, error) {</pre></code><tr><td>25<td><code><pre> if !t.Valid {</pre></code><tr><td>26<td><code><pre> return nil, nil</pre></code><tr><td>27<td><code><pre> }</pre></code><tr class=miss><td>28<td><code><pre> return t.Int64, nil</pre></code><tr><td>29<td><code><pre>}</pre></code></table><div class=funcname id=fn_parseStatusZeroValueTag>func parseStatusZeroValueTag</div><div class=info><a href=#s_fn_parseStatusZeroValueTag>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>139<td><code><pre>func parseStatusZeroValueTag(f *schema.Field) (s Deleted) {</pre></code><tr><td>140<td><code><pre> if v, ok := f.TagSettings["ZEROVALUE"]; ok {</pre></code><tr class=miss><td>141<td><code><pre> if vv, err := strconv.ParseBool(v); err == nil {</pre></code><tr class=miss><td>142<td><code><pre> return Deleted(vv)</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre> }</pre></code><tr><td>145<td><code><pre> return Deleted(false)</pre></code><tr><td>146<td><code><pre>}</pre></code></table><div class=funcname id=fn_parseTimestampZeroValueTag>func parseTimestampZeroValueTag</div><div class=info><a href=#s_fn_parseTimestampZeroValueTag>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>144<td><code><pre>func parseTimestampZeroValueTag(f *schema.Field) sql.NullInt64 {</pre></code><tr><td>145<td><code><pre> if v, ok := f.TagSettings["ZEROVALUE"]; ok {</pre></code><tr class=miss><td>146<td><code><pre> if vv, err := strconv.ParseInt(v, 10, 64); err == nil {</pre></code><tr class=miss><td>147<td><code><pre> return sql.NullInt64{Int64: vv, Valid: true}</pre></code><tr><td>148<td><code><pre> }</pre></code><tr><td>149<td><code><pre> }</pre></code><tr><td>150<td><code><pre> return sql.NullInt64{Valid: false}</pre></code><tr><td>151<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormSoftDeleteDeleteClauseModifyStatement>func gormSoftDeleteDeleteClauseModifyStatement</div><div class=info><a href=#s_fn_gormSoftDeleteDeleteClauseModifyStatement>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deletedat.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func gormSoftDeleteDeleteClauseModifyStatement(sd gorm.SoftDeleteDeleteClause, stmt *gorm.Statement) {</pre></code><tr class=miss><td>39<td><code><pre> if stmt.Statement.Unscoped || stmt.SQL.Len() > 0 {</pre></code><tr class=miss><td>40<td><code><pre> return</pre></code><tr><td>41<td><code><pre> }</pre></code><tr><td>42<td><code><pre></pre></code><tr class=miss><td>43<td><code><pre> curTime := stmt.DB.NowFunc()</pre></code><tr class=miss><td>44<td><code><pre> setClauses := clause.Set{{Column: clause.Column{Name: sd.Field.DBName}, Value: curTime}}</pre></code><tr class=miss><td>45<td><code><pre> if clauses, ok := stmt.Clauses[setClauses.Name()]; ok {</pre></code><tr class=miss><td>46<td><code><pre> if exprClauses, ok := clauses.Expression.(clause.Set); ok {</pre></code><tr class=miss><td>47<td><code><pre> setClauses = append(setClauses, exprClauses...)</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre> }</pre></code><tr class=miss><td>50<td><code><pre> stmt.AddClause(setClauses)</pre></code><tr class=miss><td>51<td><code><pre> stmt.SetColumn(sd.Field.DBName, curTime, true)</pre></code><tr><td>52<td><code><pre></pre></code><tr class=miss><td>53<td><code><pre> gorm.SoftDeleteQueryClause(sd).ModifyStatement(stmt)</pre></code><tr><td>54<td><code><pre>}</pre></code></table><div class=funcname id=fn_Timestamp.UnmarshalJSON>func Timestamp.UnmarshalJSON</div><div class=info><a href=#s_fn_Timestamp.UnmarshalJSON>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>37<td><code><pre>func (t *Timestamp) UnmarshalJSON(bs []byte) error {</pre></code><tr class=miss><td>38<td><code><pre> if string(bs) == "null" {</pre></code><tr class=miss><td>39<td><code><pre> t.Valid = false</pre></code><tr class=miss><td>40<td><code><pre> return nil</pre></code><tr><td>41<td><code><pre> }</pre></code><tr class=miss><td>42<td><code><pre> err := json.Unmarshal(bs, &t.Int64)</pre></code><tr class=miss><td>43<td><code><pre> if err == nil {</pre></code><tr class=miss><td>44<td><code><pre> t.Valid = true</pre></code><tr><td>45<td><code><pre> }</pre></code><tr class=miss><td>46<td><code><pre> return err</pre></code><tr><td>47<td><code><pre>}</pre></code></table><div class=funcname id=fn_Deleted.UnmarshalJSON>func Deleted.UnmarshalJSON</div><div class=info><a href=#s_fn_Deleted.UnmarshalJSON>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>34<td><code><pre>func (s *Deleted) UnmarshalJSON(bs []byte) error {</pre></code><tr class=miss><td>35<td><code><pre> if string(bs) == "null" {</pre></code><tr class=miss><td>36<td><code><pre> return nil</pre></code><tr><td>37<td><code><pre> }</pre></code><tr class=miss><td>38<td><code><pre> var b bool</pre></code><tr class=miss><td>39<td><code><pre> err := json.Unmarshal(bs, &b)</pre></code><tr class=miss><td>40<td><code><pre> if err == nil {</pre></code><tr class=miss><td>41<td><code><pre> *s = Deleted(b)</pre></code><tr><td>42<td><code><pre> }</pre></code><tr><td>43<td><code><pre></pre></code><tr class=miss><td>44<td><code><pre> return err</pre></code><tr><td>45<td><code><pre>}</pre></code></table><div class=funcname id=fn_Timestamp.MarshalJSON>func Timestamp.MarshalJSON</div><div class=info><a href=#s_fn_Timestamp.MarshalJSON>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func (t Timestamp) MarshalJSON() ([]byte, error) {</pre></code><tr class=miss><td>32<td><code><pre> if t.Valid {</pre></code><tr class=miss><td>33<td><code><pre> return json.Marshal(t.Int64)</pre></code><tr><td>34<td><code><pre> }</pre></code><tr class=miss><td>35<td><code><pre> return json.Marshal(nil)</pre></code><tr><td>36<td><code><pre>}</pre></code></table><div class=funcname id=fn_deletedQueryClause.Name>func deletedQueryClause.Name</div><div class=info><a href=#s_fn_deletedQueryClause.Name>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>56<td><code><pre>func (s deletedQueryClause) Name() string {</pre></code><tr class=miss><td>57<td><code><pre> return ""</pre></code><tr><td>58<td><code><pre>}</pre></code></table><div class=funcname id=fn_TimestampQueryClause.Name>func TimestampQueryClause.Name</div><div class=info><a href=#s_fn_TimestampQueryClause.Name>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>58<td><code><pre>func (t TimestampQueryClause) Name() string {</pre></code><tr class=miss><td>59<td><code><pre> return ""</pre></code><tr><td>60<td><code><pre>}</pre></code></table><div class=funcname id=fn_deletedDeleteClause.Name>func deletedDeleteClause.Name</div><div class=info><a href=#s_fn_deletedDeleteClause.Name>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>118<td><code><pre>func (s deletedDeleteClause) Name() string {</pre></code><tr class=miss><td>119<td><code><pre> return ""</pre></code><tr><td>120<td><code><pre>}</pre></code></table><div class=funcname id=fn_TimestampDeleteClause.Name>func TimestampDeleteClause.Name</div><div class=info><a href=#s_fn_TimestampDeleteClause.Name>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>119<td><code><pre>func (t TimestampDeleteClause) Name() string {</pre></code><tr class=miss><td>120<td><code><pre> return ""</pre></code><tr><td>121<td><code><pre>}</pre></code></table><div class=funcname id=fn_Deleted.MarshalJSON>func Deleted.MarshalJSON</div><div class=info><a href=#s_fn_Deleted.MarshalJSON>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func (s Deleted) MarshalJSON() ([]byte, error) {</pre></code><tr class=miss><td>32<td><code><pre> return json.Marshal(bool(s))</pre></code><tr><td>33<td><code><pre>}</pre></code></table><div class=funcname id=fn_deletedUpdateClause.Name>func deletedUpdateClause.Name</div><div class=info><a href=#s_fn_deletedUpdateClause.Name>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>96<td><code><pre>func (s deletedUpdateClause) Name() string {</pre></code><tr class=miss><td>97<td><code><pre> return ""</pre></code><tr><td>98<td><code><pre>}</pre></code></table><div class=funcname id=fn_TimestampUpdateClause.Name>func TimestampUpdateClause.Name</div><div class=info><a href=#s_fn_TimestampUpdateClause.Name>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>97<td><code><pre>func (t TimestampUpdateClause) Name() string {</pre></code><tr class=miss><td>98<td><code><pre> return ""</pre></code><tr><td>99<td><code><pre>}</pre></code></table><div class=funcname id=fn_TimestampUpdateClause.MergeClause>func TimestampUpdateClause.MergeClause</div><div class=info><a href=#s_fn_TimestampUpdateClause.MergeClause>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>102<td><code><pre>func (t TimestampUpdateClause) MergeClause(*clause.Clause) {</pre></code><tr><td>103<td><code><pre>}</pre></code></table><div class=funcname id=fn_TimestampUpdateClause.Build>func TimestampUpdateClause.Build</div><div class=info><a href=#s_fn_TimestampUpdateClause.Build>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>100<td><code><pre>func (t TimestampUpdateClause) Build(clause.Builder) {</pre></code><tr><td>101<td><code><pre>}</pre></code></table><div class=funcname id=fn_deletedUpdateClause.Build>func deletedUpdateClause.Build</div><div class=info><a href=#s_fn_deletedUpdateClause.Build>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>99<td><code><pre>func (s deletedUpdateClause) Build(clause.Builder) {</pre></code><tr><td>100<td><code><pre>}</pre></code></table><div class=funcname id=fn_TimestampDeleteClause.Build>func TimestampDeleteClause.Build</div><div class=info><a href=#s_fn_TimestampDeleteClause.Build>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>122<td><code><pre>func (t TimestampDeleteClause) Build(clause.Builder) {</pre></code><tr><td>123<td><code><pre>}</pre></code></table><div class=funcname id=fn_TimestampDeleteClause.MergeClause>func TimestampDeleteClause.MergeClause</div><div class=info><a href=#s_fn_TimestampDeleteClause.MergeClause>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>124<td><code><pre>func (t TimestampDeleteClause) MergeClause(*clause.Clause) {</pre></code><tr><td>125<td><code><pre>}</pre></code></table><div class=funcname id=fn_deletedQueryClause.MergeClause>func deletedQueryClause.MergeClause</div><div class=info><a href=#s_fn_deletedQueryClause.MergeClause>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>61<td><code><pre>func (s deletedQueryClause) MergeClause(*clause.Clause) {</pre></code><tr><td>62<td><code><pre>}</pre></code></table><div class=funcname id=fn_TimestampQueryClause.MergeClause>func TimestampQueryClause.MergeClause</div><div class=info><a href=#s_fn_TimestampQueryClause.MergeClause>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>63<td><code><pre>func (t TimestampQueryClause) MergeClause(*clause.Clause) {</pre></code><tr><td>64<td><code><pre>}</pre></code></table><div class=funcname id=fn_TimestampQueryClause.Build>func TimestampQueryClause.Build</div><div class=info><a href=#s_fn_TimestampQueryClause.Build>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/timestamp.go</code>:</div><table class=listing><tr><td>61<td><code><pre>func (t TimestampQueryClause) Build(clause.Builder) {</pre></code><tr><td>62<td><code><pre>}</pre></code></table><div class=funcname id=fn_deletedUpdateClause.MergeClause>func deletedUpdateClause.MergeClause</div><div class=info><a href=#s_fn_deletedUpdateClause.MergeClause>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>101<td><code><pre>func (s deletedUpdateClause) MergeClause(*clause.Clause) {</pre></code><tr><td>102<td><code><pre>}</pre></code></table><div class=funcname id=fn_deletedDeleteClause.Build>func deletedDeleteClause.Build</div><div class=info><a href=#s_fn_deletedDeleteClause.Build>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>121<td><code><pre>func (s deletedDeleteClause) Build(clause.Builder) {</pre></code><tr><td>122<td><code><pre>}</pre></code></table><div class=funcname id=fn_deletedDeleteClause.MergeClause>func deletedDeleteClause.MergeClause</div><div class=info><a href=#s_fn_deletedDeleteClause.MergeClause>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>123<td><code><pre>func (s deletedDeleteClause) MergeClause(*clause.Clause) {</pre></code><tr><td>124<td><code><pre>}</pre></code></table><div class=funcname id=fn_deletedQueryClause.Build>func deletedQueryClause.Build</div><div class=info><a href=#s_fn_deletedQueryClause.Build>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/db/softdelete/deleted.go</code>:</div><table class=listing><tr><td>59<td><code><pre>func (s deletedQueryClause) Build(clause.Builder) {</pre></code><tr><td>60<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/http class=funcname>Package Overview: github.com/wfusion/gofusion/http 27 <span class=packageTotal>70.0%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_lookupFieldByStruct><td><code><a href=#fn_lookupFieldByStruct>lookupFieldByStruct(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>20/20</code><tr id=s_fn_Construct><td><code><a href=#fn_Construct>Construct(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>14/14</code><tr id=s_fn_addClient><td><code><a href=#fn_addClient>addClient(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>14/14</code><tr id=s_fn_addI18n><td><code><a href=#fn_addI18n>addI18n(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>12/12</code><tr id=s_fn_@232:9><td><code><a href=#fn_@232:9>@232:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>8/8</code><tr id=s_fn_@186:9><td><code><a href=#fn_@186:9>@186:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_router.checkParamType><td><code><a href=#fn_router.checkParamType>router.checkParamType(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_Err><td><code><a href=#fn_Err>Err(...)</a></code><td><code>github.com/wfusion/gofusion/http/error.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_router.Any><td><code><a href=#fn_router.Any>router.Any(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_router.rspSuccess><td><code><a href=#fn_router.rspSuccess>router.rspSuccess(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_router.wrapHandlerFunc><td><code><a href=#fn_router.wrapHandlerFunc>router.wrapHandlerFunc(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_router.Config><td><code><a href=#fn_router.Config>router.Config(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@452:8><td><code><a href=#fn_@452:8>@452:8(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_router.rspError><td><code><a href=#fn_router.rspError>router.rspError(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@506:8><td><code><a href=#fn_@506:8>@506:8(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@62:9><td><code><a href=#fn_@62:9>@62:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_router.GET><td><code><a href=#fn_router.GET>router.GET(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_router.POST><td><code><a href=#fn_router.POST>router.POST(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@145:8><td><code><a href=#fn_@145:8>@145:8(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@647:4><td><code><a href=#fn_@647:4>@647:4(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_router.StaticFile><td><code><a href=#fn_router.StaticFile>router.StaticFile(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@318:10><td><code><a href=#fn_@318:10>@318:10(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_StaticFileZeroCopy><td><code><a href=#fn_StaticFileZeroCopy>StaticFileZeroCopy(...)</a></code><td><code>github.com/wfusion/gofusion/http/zerocopy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_ContentZeroCopy><td><code><a href=#fn_ContentZeroCopy>ContentZeroCopy(...)</a></code><td><code>github.com/wfusion/gofusion/http/zerocopy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@63:23><td><code><a href=#fn_@63:23>@63:23(...)</a></code><td><code>github.com/wfusion/gofusion/http/zerocopy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@646:4><td><code><a href=#fn_@646:4>@646:4(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@22:9><td><code><a href=#fn_@22:9>@22:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/zerocopy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@179:22><td><code><a href=#fn_@179:22>@179:22(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_AppName><td><code><a href=#fn_AppName>AppName(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@252:9><td><code><a href=#fn_@252:9>@252:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_router.Closing><td><code><a href=#fn_router.Closing>router.Closing(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Errcode.String><td><code><a href=#fn_Errcode.String>Errcode.String(...)</a></code><td><code>github.com/wfusion/gofusion/http/error.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_router.Group><td><code><a href=#fn_router.Group>router.Group(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@770:42><td><code><a href=#fn_@770:42>@770:42(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/http/client.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Param><td><code><a href=#fn_Param>Param(...)</a></code><td><code>github.com/wfusion/gofusion/http/error.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@43:9><td><code><a href=#fn_@43:9>@43:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/error.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@532:4><td><code><a href=#fn_@532:4>@532:4(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_NewRequest><td><code><a href=#fn_NewRequest>NewRequest(...)</a></code><td><code>github.com/wfusion/gofusion/http/client.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_router.ServeHTTP><td><code><a href=#fn_router.ServeHTTP>router.ServeHTTP(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_newRouter><td><code><a href=#fn_newRouter>newRouter(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@468:8><td><code><a href=#fn_@468:8>@468:8(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/http/flag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@37:9><td><code><a href=#fn_@37:9>@37:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/client.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_ginBindingValidatorI18n><td><code><a href=#fn_ginBindingValidatorI18n>ginBindingValidatorI18n(...)</a></code><td><code>github.com/wfusion/gofusion/http/i18n.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@531:4><td><code><a href=#fn_@531:4>@531:4(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_CName><td><code><a href=#fn_CName>CName(...)</a></code><td><code>github.com/wfusion/gofusion/http/client.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_asynqRedisConnOpt.MakeRedisClient><td><code><a href=#fn_asynqRedisConnOpt.MakeRedisClient>asynqRedisConnOpt.MakeRedisClient(...)</a></code><td><code>github.com/wfusion/gofusion/http/asynq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_router.Use><td><code><a href=#fn_router.Use>router.Use(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_router.Running><td><code><a href=#fn_router.Running>router.Running(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@549:9><td><code><a href=#fn_@549:9>@549:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>92.3%</code><td class=linecount><code>24/26</code><tr id=s_fn_rspSuccess><td><code><a href=#fn_rspSuccess>rspSuccess(...)</a></code><td><code>github.com/wfusion/gofusion/http/response.go</code><td class=percent><code>90.9%</code><td class=linecount><code>10/11</code><tr id=s_fn_useClient><td><code><a href=#fn_useClient>useClient(...)</a></code><td><code>github.com/wfusion/gofusion/http/client.go</code><td class=percent><code>90.0%</code><td class=linecount><code>9/10</code><tr id=s_fn_addRouter><td><code><a href=#fn_addRouter>addRouter(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>88.9%</code><td class=linecount><code>24/27</code><tr id=s_fn_router.shutdown><td><code><a href=#fn_router.shutdown>router.shutdown(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>87.5%</code><td class=linecount><code>7/8</code><tr id=s_fn_New><td><code><a href=#fn_New>New(...)</a></code><td><code>github.com/wfusion/gofusion/http/client.go</code><td class=percent><code>87.1%</code><td class=linecount><code>27/31</code><tr id=s_fn_router.convert><td><code><a href=#fn_router.convert>router.convert(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>86.7%</code><td class=linecount><code>13/15</code><tr id=s_fn_router.Start><td><code><a href=#fn_router.Start>router.Start(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>85.7%</code><td class=linecount><code>12/14</code><tr id=s_fn_lookupFieldByMap><td><code><a href=#fn_lookupFieldByMap>lookupFieldByMap(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_Use><td><code><a href=#fn_Use>Use(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_router.parseReqFromBody><td><code><a href=#fn_router.parseReqFromBody>router.parseReqFromBody(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>84.0%</code><td class=linecount><code>21/25</code><tr id=s_fn_router.rspEmbed><td><code><a href=#fn_router.rspEmbed>router.rspEmbed(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>82.4%</code><td class=linecount><code>14/17</code><tr id=s_fn_rspError><td><code><a href=#fn_rspError>rspError(...)</a></code><td><code>github.com/wfusion/gofusion/http/response.go</code><td class=percent><code>81.8%</code><td class=linecount><code>9/11</code><tr id=s_fn_@137:9><td><code><a href=#fn_@137:9>@137:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>80.0%</code><td class=linecount><code>12/15</code><tr id=s_fn_router.use><td><code><a href=#fn_router.use>router.use(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_router.parseReqFromQuery><td><code><a href=#fn_router.parseReqFromQuery>router.parseReqFromQuery(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>78.9%</code><td class=linecount><code>15/19</code><tr id=s_fn_parseRspError><td><code><a href=#fn_parseRspError>parseRspError(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>75.0%</code><td class=linecount><code>6/8</code><tr id=s_fn_initAsynq><td><code><a href=#fn_initAsynq>initAsynq(...)</a></code><td><code>github.com/wfusion/gofusion/http/asynq.go</code><td class=percent><code>75.0%</code><td class=linecount><code>6/8</code><tr id=s_fn_lookupFieldByValue><td><code><a href=#fn_lookupFieldByValue>lookupFieldByValue(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_router.parseHeaderMetrics><td><code><a href=#fn_router.parseHeaderMetrics>router.parseHeaderMetrics(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_parseGinBindingValidatorError><td><code><a href=#fn_parseGinBindingValidatorError>parseGinBindingValidatorError(...)</a></code><td><code>github.com/wfusion/gofusion/http/i18n.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_@32:21><td><code><a href=#fn_@32:21>@32:21(...)</a></code><td><code>github.com/wfusion/gofusion/http/metrics.go</code><td class=percent><code>72.7%</code><td class=linecount><code>8/11</code><tr id=s_fn_router.convertMulti><td><code><a href=#fn_router.convertMulti>router.convertMulti(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>71.4%</code><td class=linecount><code>5/7</code><tr id=s_fn_traceHeaderMiddleware><td><code><a href=#fn_traceHeaderMiddleware>traceHeaderMiddleware(...)</a></code><td><code>github.com/wfusion/gofusion/http/client.go</code><td class=percent><code>66.7%</code><td class=linecount><code>4/6</code><tr id=s_fn_bizErr.Error><td><code><a href=#fn_bizErr.Error>bizErr.Error(...)</a></code><td><code>github.com/wfusion/gofusion/http/error.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_router.checkHandlerType><td><code><a href=#fn_router.checkHandlerType>router.checkHandlerType(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>63.2%</code><td class=linecount><code>12/19</code><tr id=s_fn_ginZeroCopyWriter.ReadFrom><td><code><a href=#fn_ginZeroCopyWriter.ReadFrom>ginZeroCopyWriter.ReadFrom(...)</a></code><td><code>github.com/wfusion/gofusion/http/zerocopy.go</code><td class=percent><code>62.5%</code><td class=linecount><code>10/16</code><tr id=s_fn_langs><td><code><a href=#fn_langs>langs(...)</a></code><td><code>github.com/wfusion/gofusion/http/response.go</code><td class=percent><code>62.5%</code><td class=linecount><code>5/8</code><tr id=s_fn_@44:24><td><code><a href=#fn_@44:24>@44:24(...)</a></code><td><code>github.com/wfusion/gofusion/http/i18n.go</code><td class=percent><code>60.0%</code><td class=linecount><code>9/15</code><tr id=s_fn_metricsCode><td><code><a href=#fn_metricsCode>metricsCode(...)</a></code><td><code>github.com/wfusion/gofusion/http/metrics.go</code><td class=percent><code>60.0%</code><td class=linecount><code>3/5</code><tr id=s_fn_parseRspSuccess><td><code><a href=#fn_parseRspSuccess>parseRspSuccess(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>58.3%</code><td class=linecount><code>7/12</code><tr id=s_fn_transformData><td><code><a href=#fn_transformData>transformData(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>57.1%</code><td class=linecount><code>4/7</code><tr id=s_fn_@30:9><td><code><a href=#fn_@30:9>@30:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/zerocopy.go</code><td class=percent><code>50.0%</code><td class=linecount><code>4/8</code><tr id=s_fn_embedResponse><td><code><a href=#fn_embedResponse>embedResponse(...)</a></code><td><code>github.com/wfusion/gofusion/http/response.go</code><td class=percent><code>50.0%</code><td class=linecount><code>3/6</code><tr id=s_fn_router.useIRouter><td><code><a href=#fn_router.useIRouter>router.useIRouter(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>40.0%</code><td class=linecount><code>2/5</code><tr id=s_fn_applyClientOptions><td><code><a href=#fn_applyClientOptions>applyClientOptions(...)</a></code><td><code>github.com/wfusion/gofusion/http/client.go</code><td class=percent><code>23.1%</code><td class=linecount><code>3/13</code><tr id=s_fn_router.ListenAndServe><td><code><a href=#fn_router.ListenAndServe>router.ListenAndServe(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/16</code><tr id=s_fn_RspError><td><code><a href=#fn_RspError>RspError(...)</a></code><td><code>github.com/wfusion/gofusion/http/response.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/8</code><tr id=s_fn_Localizable><td><code><a href=#fn_Localizable>Localizable(...)</a></code><td><code>github.com/wfusion/gofusion/http/i18n.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_@96:18><td><code><a href=#fn_@96:18>@96:18(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_@105:17><td><code><a href=#fn_@105:17>@105:17(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_ErrCtx><td><code><a href=#fn_ErrCtx>ErrCtx(...)</a></code><td><code>github.com/wfusion/gofusion/http/error.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_router.DELETE><td><code><a href=#fn_router.DELETE>router.DELETE(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@43:9><td><code><a href=#fn_@43:9>@43:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/client.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_router.OPTIONS><td><code><a href=#fn_router.OPTIONS>router.OPTIONS(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_RspSuccess><td><code><a href=#fn_RspSuccess>RspSuccess(...)</a></code><td><code>github.com/wfusion/gofusion/http/response.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_router.PUT><td><code><a href=#fn_router.PUT>router.PUT(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_router.HEAD><td><code><a href=#fn_router.HEAD>router.HEAD(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_router.Handle><td><code><a href=#fn_router.Handle>router.Handle(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_router.PATCH><td><code><a href=#fn_router.PATCH>router.PATCH(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@51:9><td><code><a href=#fn_@51:9>@51:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/client.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@71:8><td><code><a href=#fn_@71:8>@71:8(...)</a></code><td><code>github.com/wfusion/gofusion/http/zerocopy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@192:8><td><code><a href=#fn_@192:8>@192:8(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_router.Static><td><code><a href=#fn_router.Static>router.Static(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_router.StaticFileFS><td><code><a href=#fn_router.StaticFileFS>router.StaticFileFS(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_router.StaticFS><td><code><a href=#fn_router.StaticFS>router.StaticFS(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_Errcode.Error><td><code><a href=#fn_Errcode.Error>Errcode.Error(...)</a></code><td><code>github.com/wfusion/gofusion/http/error.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@49:9><td><code><a href=#fn_@49:9>@49:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/error.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_ParseFromBody><td><code><a href=#fn_ParseFromBody>ParseFromBody(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@814:9><td><code><a href=#fn_@814:9>@814:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_ParseFromQuery><td><code><a href=#fn_ParseFromQuery>ParseFromQuery(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@820:9><td><code><a href=#fn_@820:9>@820:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_HandleBefore><td><code><a href=#fn_HandleBefore>HandleBefore(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@826:9><td><code><a href=#fn_@826:9>@826:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_HandleAfter><td><code><a href=#fn_HandleAfter>HandleAfter(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@832:9><td><code><a href=#fn_@832:9>@832:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@37:9><td><code><a href=#fn_@37:9>@37:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/error.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_RetryHook><td><code><a href=#fn_RetryHook>RetryHook(...)</a></code><td><code>github.com/wfusion/gofusion/http/client.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Langs><td><code><a href=#fn_Langs>Langs(...)</a></code><td><code>github.com/wfusion/gofusion/http/error.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@134:22><td><code><a href=#fn_@134:22>@134:22(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@228:23><td><code><a href=#fn_@228:23>@228:23(...)</a></code><td><code>github.com/wfusion/gofusion/http/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_RetryCondition><td><code><a href=#fn_RetryCondition>RetryCondition(...)</a></code><td><code>github.com/wfusion/gofusion/http/client.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Msg><td><code><a href=#fn_Msg>Msg(...)</a></code><td><code>github.com/wfusion/gofusion/http/error.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_lookupFieldByStruct>func lookupFieldByStruct</div><div class=info><a href=#s_fn_lookupFieldByStruct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>712<td><code><pre>func lookupFieldByStruct(rspStruct reflect.Value) (data any, page, count int, msg string) {</pre></code><tr><td>713<td><code><pre> var (</pre></code><tr><td>714<td><code><pre> routerResponsePageName = map[string]bool{</pre></code><tr><td>715<td><code><pre> "page": true,</pre></code><tr><td>716<td><code><pre> "Page": true,</pre></code><tr><td>717<td><code><pre> }</pre></code><tr><td>718<td><code><pre> routerResponseCountName = map[string]bool{</pre></code><tr><td>719<td><code><pre> "count": true,</pre></code><tr><td>720<td><code><pre> "Count": true,</pre></code><tr><td>721<td><code><pre> }</pre></code><tr><td>722<td><code><pre> routerResponseDataName = map[string]bool{</pre></code><tr><td>723<td><code><pre> "data": true,</pre></code><tr><td>724<td><code><pre> "Data": true,</pre></code><tr><td>725<td><code><pre> }</pre></code><tr><td>726<td><code><pre> routerResponseMsgName = map[string]bool{</pre></code><tr><td>727<td><code><pre> "msg": true,</pre></code><tr><td>728<td><code><pre> "Msg": true,</pre></code><tr><td>729<td><code><pre> "message": true,</pre></code><tr><td>730<td><code><pre> "Message": true,</pre></code><tr><td>731<td><code><pre> }</pre></code><tr><td>732<td><code><pre> )</pre></code><tr><td>733<td><code><pre></pre></code><tr><td>734<td><code><pre> type lookupFunc func(v reflect.Value, keywords map[string]bool) (reflect.Value, bool)</pre></code><tr><td>735<td><code><pre> lookupFuncMap := map[reflect.Kind]lookupFunc{</pre></code><tr><td>736<td><code><pre> reflect.Map: lookupFieldByMap,</pre></code><tr><td>737<td><code><pre> reflect.Struct: lookupFieldByValue,</pre></code><tr><td>738<td><code><pre> }</pre></code><tr><td>739<td><code><pre></pre></code><tr><td>740<td><code><pre> rsp := utils.IndirectValue(rspStruct)</pre></code><tr><td>741<td><code><pre> lookup, ok := lookupFuncMap[rsp.Kind()]</pre></code><tr><td>742<td><code><pre> if !ok {</pre></code><tr><td>743<td><code><pre> data = rspStruct.Interface()</pre></code><tr><td>744<td><code><pre> return</pre></code><tr><td>745<td><code><pre> }</pre></code><tr><td>746<td><code><pre></pre></code><tr><td>747<td><code><pre> // cannot parse response.Data, resolve all rspStruct as data</pre></code><tr><td>748<td><code><pre> if dataValue, ok := lookup(rsp, routerResponseDataName); ok {</pre></code><tr><td>749<td><code><pre> if dataValue.IsValid() {</pre></code><tr><td>750<td><code><pre> data = transformData(reflect.ValueOf(valueInterface(dataValue, false)))</pre></code><tr><td>751<td><code><pre> }</pre></code><tr><td>752<td><code><pre> } else {</pre></code><tr><td>753<td><code><pre> data = rspStruct.Interface()</pre></code><tr><td>754<td><code><pre> return</pre></code><tr><td>755<td><code><pre> }</pre></code><tr><td>756<td><code><pre> if pageValue, ok := lookup(rsp, routerResponsePageName); ok && pageValue.IsValid() {</pre></code><tr><td>757<td><code><pre> page = cast.ToInt(pageValue.Int())</pre></code><tr><td>758<td><code><pre> }</pre></code><tr><td>759<td><code><pre> if countValue, ok := lookup(rsp, routerResponseCountName); ok && countValue.IsValid() {</pre></code><tr><td>760<td><code><pre> count = cast.ToInt(countValue.Int())</pre></code><tr><td>761<td><code><pre> }</pre></code><tr><td>762<td><code><pre> if msgValue, ok := lookup(rsp, routerResponseMsgName); ok && msgValue.IsValid() {</pre></code><tr><td>763<td><code><pre> msg = msgValue.String()</pre></code><tr><td>764<td><code><pre> }</pre></code><tr><td>765<td><code><pre></pre></code><tr><td>766<td><code><pre> return</pre></code><tr><td>767<td><code><pre>}</pre></code></table><div class=funcname id=fn_Construct>func Construct</div><div class=info><a href=#s_fn_Construct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func Construct(ctx context.Context, conf Conf, opts ...utils.OptionExtender) func() {</pre></code><tr><td>42<td><code><pre> opt := utils.ApplyOptions[config.InitOption](opts...)</pre></code><tr><td>43<td><code><pre> optU := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>44<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>45<td><code><pre> opt.AppName = optU.appName</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre></pre></code><tr><td>48<td><code><pre> var logger resty.Logger</pre></code><tr><td>49<td><code><pre> if utils.IsStrNotBlank(conf.Logger) {</pre></code><tr><td>50<td><code><pre> logger = reflect.New(inspect.TypeOf(conf.Logger)).Interface().(resty.Logger)</pre></code><tr><td>51<td><code><pre> if custom, ok := logger.(customLogger); ok {</pre></code><tr><td>52<td><code><pre> l := fusLog.Use(conf.LogInstance, fusLog.AppName(opt.AppName))</pre></code><tr><td>53<td><code><pre> custom.Init(l, opt.AppName)</pre></code><tr><td>54<td><code><pre> }</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre></pre></code><tr><td>57<td><code><pre> exitRouterFn := addRouter(ctx, conf, logger, opt)</pre></code><tr><td>58<td><code><pre> exitI18nFn := addI18n(conf, opt)</pre></code><tr><td>59<td><code><pre> exitClientFn := addClient(ctx, conf, logger, opt)</pre></code><tr><td>60<td><code><pre></pre></code><tr><td>61<td><code><pre> // gracefully exit outside gofusion</pre></code><tr><td>62<td><code><pre> return func() {</pre></code><tr><td>63<td><code><pre> exitClientFn()</pre></code><tr><td>64<td><code><pre> exitRouterFn()</pre></code><tr><td>65<td><code><pre> exitI18nFn()</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre>}</pre></code></table><div class=funcname id=fn_addClient>func addClient</div><div class=info><a href=#s_fn_addClient>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr><td>198<td><code><pre>func addClient(ctx context.Context, conf Conf, logger resty.Logger, opt *config.InitOption) func() {</pre></code><tr><td>199<td><code><pre> if _, ok := appClientCfgMap[opt.AppName]; !ok {</pre></code><tr><td>200<td><code><pre> defaultCfg := &cfg{</pre></code><tr><td>201<td><code><pre> c: clone.Clone(defaultClientConf),</pre></code><tr><td>202<td><code><pre> appName: opt.AppName,</pre></code><tr><td>203<td><code><pre> logger: logger,</pre></code><tr><td>204<td><code><pre> }</pre></code><tr><td>205<td><code><pre> appClientCfgMap[opt.AppName] = map[string]*cfg{</pre></code><tr><td>206<td><code><pre> "": defaultCfg,</pre></code><tr><td>207<td><code><pre> "default": defaultCfg,</pre></code><tr><td>208<td><code><pre> }</pre></code><tr><td>209<td><code><pre> }</pre></code><tr><td>210<td><code><pre> for name, cliConf := range conf.Clients {</pre></code><tr><td>211<td><code><pre> cliCfg := &cfg{</pre></code><tr><td>212<td><code><pre> c: cliConf,</pre></code><tr><td>213<td><code><pre> appName: opt.AppName,</pre></code><tr><td>214<td><code><pre> logger: logger,</pre></code><tr><td>215<td><code><pre> }</pre></code><tr><td>216<td><code><pre> appClientCfgMap[opt.AppName][name] = cliCfg</pre></code><tr><td>217<td><code><pre> if name == config.DefaultInstanceKey {</pre></code><tr><td>218<td><code><pre> appClientCfgMap[opt.AppName][""] = cliCfg</pre></code><tr><td>219<td><code><pre> }</pre></code><tr><td>220<td><code><pre></pre></code><tr><td>221<td><code><pre> if opt.AppName == "" && name == config.DefaultInstanceKey {</pre></code><tr><td>222<td><code><pre> Client = New(AppName(opt.AppName), CName(name))</pre></code><tr><td>223<td><code><pre> }</pre></code><tr><td>224<td><code><pre> }</pre></code><tr><td>225<td><code><pre></pre></code><tr><td>226<td><code><pre> if opt.DI != nil {</pre></code><tr><td>227<td><code><pre> for name := range conf.Clients {</pre></code><tr><td>228<td><code><pre> opt.DI.MustProvide(func() *resty.Client { return New(AppName(opt.AppName), CName(name)) }, di.Name(name))</pre></code><tr><td>229<td><code><pre> }</pre></code><tr><td>230<td><code><pre> }</pre></code><tr><td>231<td><code><pre></pre></code><tr><td>232<td><code><pre> return func() {</pre></code><tr><td>233<td><code><pre> locker.Lock()</pre></code><tr><td>234<td><code><pre> defer locker.Unlock()</pre></code><tr><td>235<td><code><pre> if appClientMap != nil {</pre></code><tr><td>236<td><code><pre> delete(appClientMap, opt.AppName)</pre></code><tr><td>237<td><code><pre> }</pre></code><tr><td>238<td><code><pre> if appClientCfgMap != nil {</pre></code><tr><td>239<td><code><pre> delete(appClientCfgMap, opt.AppName)</pre></code><tr><td>240<td><code><pre> }</pre></code><tr><td>241<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>242<td><code><pre> Client = nil</pre></code><tr><td>243<td><code><pre> }</pre></code><tr><td>244<td><code><pre> }</pre></code><tr><td>245<td><code><pre>}</pre></code></table><div class=funcname id=fn_addI18n>func addI18n</div><div class=info><a href=#s_fn_addI18n>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr><td>161<td><code><pre>func addI18n(conf Conf, opt *config.InitOption) func() {</pre></code><tr><td>162<td><code><pre> bundle := i18n.NewBundle[Errcode](i18n.DefaultLang(i18n.AppName(opt.AppName)))</pre></code><tr><td>163<td><code><pre> if I18n == nil {</pre></code><tr><td>164<td><code><pre> I18n = bundle</pre></code><tr><td>165<td><code><pre> }</pre></code><tr><td>166<td><code><pre> if i18ns == nil {</pre></code><tr><td>167<td><code><pre> i18ns = make(map[string]i18n.Localizable[Errcode])</pre></code><tr><td>168<td><code><pre> }</pre></code><tr><td>169<td><code><pre></pre></code><tr><td>170<td><code><pre> i18ns[opt.AppName] = bundle</pre></code><tr><td>171<td><code><pre></pre></code><tr><td>172<td><code><pre> // initialize http internal error</pre></code><tr><td>173<td><code><pre> bundle.AddMessages(Errcode(conf.ErrorCode), map[language.Tag]*i18n.Message{</pre></code><tr><td>174<td><code><pre> language.English: {Other: "Invalid request parameters{{.err}}"},</pre></code><tr><td>175<td><code><pre> language.Chinese: {Other: "请求参数错误{{.err}}"},</pre></code><tr><td>176<td><code><pre> }, i18n.Var("err"))</pre></code><tr><td>177<td><code><pre></pre></code><tr><td>178<td><code><pre> if opt.DI != nil {</pre></code><tr><td>179<td><code><pre> opt.DI.MustProvide(func() i18n.Localizable[Errcode] { return bundle })</pre></code><tr><td>180<td><code><pre> }</pre></code><tr><td>181<td><code><pre></pre></code><tr><td>182<td><code><pre> errParam = Errcode(conf.ErrorCode)</pre></code><tr><td>183<td><code><pre></pre></code><tr><td>184<td><code><pre> ginBindingValidatorI18n(opt.AppName)</pre></code><tr><td>185<td><code><pre></pre></code><tr><td>186<td><code><pre> return func() {</pre></code><tr><td>187<td><code><pre> locker.Lock()</pre></code><tr><td>188<td><code><pre> defer locker.Unlock()</pre></code><tr><td>189<td><code><pre> if i18ns != nil {</pre></code><tr><td>190<td><code><pre> delete(i18ns, opt.AppName)</pre></code><tr><td>191<td><code><pre> }</pre></code><tr><td>192<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>193<td><code><pre> I18n = nil</pre></code><tr><td>194<td><code><pre> }</pre></code><tr><td>195<td><code><pre> }</pre></code><tr><td>196<td><code><pre>}</pre></code></table><div class=funcname id=fn_@232:9>func @232:9</div><div class=info><a href=#s_fn_@232:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr><td>232<td><code><pre>func() {</pre></code><tr><td>233<td><code><pre> locker.Lock()</pre></code><tr><td>234<td><code><pre> defer locker.Unlock()</pre></code><tr><td>235<td><code><pre> if appClientMap != nil {</pre></code><tr><td>236<td><code><pre> delete(appClientMap, opt.AppName)</pre></code><tr><td>237<td><code><pre> }</pre></code><tr><td>238<td><code><pre> if appClientCfgMap != nil {</pre></code><tr><td>239<td><code><pre> delete(appClientCfgMap, opt.AppName)</pre></code><tr><td>240<td><code><pre> }</pre></code><tr><td>241<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>242<td><code><pre> Client = nil</pre></code><tr><td>243<td><code><pre> }</pre></code><tr><td>244<td><code><pre> }</pre></code></table><div class=funcname id=fn_@186:9>func @186:9</div><div class=info><a href=#s_fn_@186:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr><td>186<td><code><pre>func() {</pre></code><tr><td>187<td><code><pre> locker.Lock()</pre></code><tr><td>188<td><code><pre> defer locker.Unlock()</pre></code><tr><td>189<td><code><pre> if i18ns != nil {</pre></code><tr><td>190<td><code><pre> delete(i18ns, opt.AppName)</pre></code><tr><td>191<td><code><pre> }</pre></code><tr><td>192<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>193<td><code><pre> I18n = nil</pre></code><tr><td>194<td><code><pre> }</pre></code><tr><td>195<td><code><pre> }</pre></code></table><div class=funcname id=fn_router.checkParamType>func router.checkParamType</div><div class=info><a href=#s_fn_router.checkParamType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>438<td><code><pre>func (r *router) checkParamType(typ reflect.Type, supportType map[reflect.Kind]struct{}) bool {</pre></code><tr><td>439<td><code><pre> if typ.Kind() == reflect.Ptr {</pre></code><tr><td>440<td><code><pre> typ = typ.Elem()</pre></code><tr><td>441<td><code><pre> }</pre></code><tr><td>442<td><code><pre> _, ok := supportType[typ.Kind()]</pre></code><tr><td>443<td><code><pre> return ok</pre></code><tr><td>444<td><code><pre>}</pre></code></table><div class=funcname id=fn_Err>func Err</div><div class=info><a href=#s_fn_Err>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/error.go</code>:</div><table class=listing><tr><td>55<td><code><pre>func Err(c *gin.Context, code Errcode, opts ...utils.OptionExtender) error {</pre></code><tr><td>56<td><code><pre> opt := utils.ApplyOptions[errOption](opts...)</pre></code><tr><td>57<td><code><pre> if len(opt.langs) == 0 {</pre></code><tr><td>58<td><code><pre> opt.langs = langs(c)</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre> return &bizErr{</pre></code><tr><td>61<td><code><pre> code: code,</pre></code><tr><td>62<td><code><pre> errOption: opt,</pre></code><tr><td>63<td><code><pre> }</pre></code><tr><td>64<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.Any>func router.Any</div><div class=info><a href=#s_fn_router.Any>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>105<td><code><pre>func (r *router) Any(uri string, fn routerHandler, opts ...utils.OptionExtender) IRouter {</pre></code><tr><td>106<td><code><pre> opt := utils.ApplyOptions[routerOption](opts...)</pre></code><tr><td>107<td><code><pre> r.use().Any(uri, r.convertMulti("Any", uri, fn, opt)...)</pre></code><tr><td>108<td><code><pre> return r</pre></code><tr><td>109<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.rspSuccess>func router.rspSuccess</div><div class=info><a href=#s_fn_router.rspSuccess>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>610<td><code><pre>func (r *router) rspSuccess(c *gin.Context, rspVals []reflect.Value) {</pre></code><tr><td>611<td><code><pre> data, page, count, msg := parseRspSuccess(rspVals)</pre></code><tr><td>612<td><code><pre> rspSuccess(c, r.successCode, data, page, count, msg)</pre></code><tr><td>613<td><code><pre></pre></code><tr><td>614<td><code><pre> go metricsCode(r.ctx, r.appName, c.Request.URL.Path, c.Request.Method, r.parseHeaderMetrics(c),</pre></code><tr><td>615<td><code><pre> r.successCode, c.Writer.Status(), c.Writer.Size(), c.Request.ContentLength)</pre></code><tr><td>616<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.wrapHandlerFunc>func router.wrapHandlerFunc</div><div class=info><a href=#s_fn_router.wrapHandlerFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>546<td><code><pre>func (r *router) wrapHandlerFunc(handler routerHandler, reqParse routerRequestParser) gin.HandlerFunc {</pre></code><tr><td>547<td><code><pre> typ := reflect.TypeOf(handler)</pre></code><tr><td>548<td><code><pre> numOut := typ.NumOut()</pre></code><tr><td>549<td><code><pre> return func(c *gin.Context) {</pre></code><tr><td>550<td><code><pre> var (</pre></code><tr><td>551<td><code><pre> err error</pre></code><tr><td>552<td><code><pre> reqVal reflect.Value</pre></code><tr><td>553<td><code><pre> rspVals []reflect.Value</pre></code><tr><td>554<td><code><pre> )</pre></code><tr><td>555<td><code><pre></pre></code><tr><td>556<td><code><pre> // deal with request & call handler</pre></code><tr><td>557<td><code><pre> if reqParse == nil {</pre></code><tr><td>558<td><code><pre> rspVals = reflect.ValueOf(handler).Call([]reflect.Value{reflect.ValueOf(c)})</pre></code><tr><td>559<td><code><pre> } else if reqVal, err = reqParse(c, typ.In(1)); err == nil {</pre></code><tr><td>560<td><code><pre> rspVals = reflect.ValueOf(handler).Call([]reflect.Value{reflect.ValueOf(c), reqVal})</pre></code><tr><td>561<td><code><pre> } else {</pre></code><tr><td>562<td><code><pre> switch e := err.(type) {</pre></code><tr><td>563<td><code><pre> case *json.UnmarshalTypeError:</pre></code><tr><td>564<td><code><pre> msg := fmt.Sprintf(": %s field type should be %s", e.Value, e.Type.String())</pre></code><tr><td>565<td><code><pre> r.rspError(c, nil, Err(c, r.errorCode, Param(map[string]any{"err": msg})))</pre></code><tr><td>566<td><code><pre> default:</pre></code><tr><td>567<td><code><pre> r.rspError(c, nil, Err(c, r.errorCode,</pre></code><tr><td>568<td><code><pre> Param(map[string]any{"err": fmt.Sprintf(": %s", err.Error())})))</pre></code><tr><td>569<td><code><pre> }</pre></code><tr><td>570<td><code><pre> c.Next()</pre></code><tr><td>571<td><code><pre> return</pre></code><tr><td>572<td><code><pre> }</pre></code><tr><td>573<td><code><pre></pre></code><tr><td>574<td><code><pre> // deal with response</pre></code><tr><td>575<td><code><pre> errVal := rspVals[numOut-1]</pre></code><tr><td>576<td><code><pre> if !errVal.IsNil() {</pre></code><tr><td>577<td><code><pre> err = errVal.Interface().(error)</pre></code><tr><td>578<td><code><pre> }</pre></code><tr><td>579<td><code><pre> rspVals = rspVals[:numOut-1]</pre></code><tr><td>580<td><code><pre></pre></code><tr><td>581<td><code><pre> var rspType reflect.Type</pre></code><tr><td>582<td><code><pre> isEmbed, isResponse := false, false</pre></code><tr><td>583<td><code><pre> if len(rspVals) > 0 {</pre></code><tr><td>584<td><code><pre> rspType = utils.IndirectType(rspVals[0].Type())</pre></code><tr><td>585<td><code><pre> isEmbed = utils.EmbedsType(rspType, embedType)</pre></code><tr><td>586<td><code><pre> isResponse = utils.EmbedsType(rspType, responseType)</pre></code><tr><td>587<td><code><pre> }</pre></code><tr><td>588<td><code><pre></pre></code><tr><td>589<td><code><pre> switch {</pre></code><tr><td>590<td><code><pre> case isEmbed, isResponse:</pre></code><tr><td>591<td><code><pre> r.rspEmbed(c, rspVals[0], rspType, err) // directly json marshal embed response</pre></code><tr><td>592<td><code><pre> case err != nil:</pre></code><tr><td>593<td><code><pre> r.rspError(c, rspVals, err) // business error</pre></code><tr><td>594<td><code><pre> default:</pre></code><tr><td>595<td><code><pre> r.rspSuccess(c, rspVals) // success with response</pre></code><tr><td>596<td><code><pre> }</pre></code><tr><td>597<td><code><pre></pre></code><tr><td>598<td><code><pre> c.Next()</pre></code><tr><td>599<td><code><pre> }</pre></code><tr><td>600<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.Config>func router.Config</div><div class=info><a href=#s_fn_router.Config>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>224<td><code><pre>func (r *router) Config() OutputConf {</pre></code><tr><td>225<td><code><pre> cfg := new(Conf)</pre></code><tr><td>226<td><code><pre> _ = config.Use(r.appName).LoadComponentConfig(config.ComponentHttp, cfg)</pre></code><tr><td>227<td><code><pre></pre></code><tr><td>228<td><code><pre> return OutputConf{</pre></code><tr><td>229<td><code><pre> Port: cfg.Port,</pre></code><tr><td>230<td><code><pre> TLS: cfg.TLS,</pre></code><tr><td>231<td><code><pre> Cert: cfg.Cert,</pre></code><tr><td>232<td><code><pre> Key: cfg.Key,</pre></code><tr><td>233<td><code><pre> NextProtos: cfg.NextProtos,</pre></code><tr><td>234<td><code><pre> SuccessCode: cfg.SuccessCode,</pre></code><tr><td>235<td><code><pre> ReadTimeout: utils.Must(time.ParseDuration(cfg.ReadTimeout)),</pre></code><tr><td>236<td><code><pre> WriteTimeout: utils.Must(time.ParseDuration(cfg.WriteTimeout)),</pre></code><tr><td>237<td><code><pre> AsynqConf: clone.Slowly(cfg.Asynq),</pre></code><tr><td>238<td><code><pre> }</pre></code><tr><td>239<td><code><pre>}</pre></code></table><div class=funcname id=fn_@452:8>func @452:8</div><div class=info><a href=#s_fn_@452:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>452<td><code><pre>func() {</pre></code><tr><td>453<td><code><pre> for ptrDepth > 0 {</pre></code><tr><td>454<td><code><pre> dst = dst.Addr()</pre></code><tr><td>455<td><code><pre> ptrDepth--</pre></code><tr><td>456<td><code><pre> }</pre></code><tr><td>457<td><code><pre> }</pre></code></table><div class=funcname id=fn_router.rspError>func router.rspError</div><div class=info><a href=#s_fn_router.rspError>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>602<td><code><pre>func (r *router) rspError(c *gin.Context, rspVals []reflect.Value, err error) {</pre></code><tr><td>603<td><code><pre> code, data, page, count, msg := parseRspError(rspVals, err)</pre></code><tr><td>604<td><code><pre> rspError(c, r.appName, code, data, page, count, msg)</pre></code><tr><td>605<td><code><pre></pre></code><tr><td>606<td><code><pre> go metricsCode(r.ctx, r.appName, c.Request.URL.Path, c.Request.Method, r.parseHeaderMetrics(c),</pre></code><tr><td>607<td><code><pre> cast.ToInt(code), c.Writer.Status(), c.Writer.Size(), c.Request.ContentLength)</pre></code><tr><td>608<td><code><pre>}</pre></code></table><div class=funcname id=fn_@506:8>func @506:8</div><div class=info><a href=#s_fn_@506:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>506<td><code><pre>func() {</pre></code><tr><td>507<td><code><pre> for ptrDepth > 0 {</pre></code><tr><td>508<td><code><pre> dst = dst.Addr()</pre></code><tr><td>509<td><code><pre> ptrDepth--</pre></code><tr><td>510<td><code><pre> }</pre></code><tr><td>511<td><code><pre> }</pre></code></table><div class=funcname id=fn_@62:9>func @62:9</div><div class=info><a href=#s_fn_@62:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr><td>62<td><code><pre>func() {</pre></code><tr><td>63<td><code><pre> exitClientFn()</pre></code><tr><td>64<td><code><pre> exitRouterFn()</pre></code><tr><td>65<td><code><pre> exitI18nFn()</pre></code><tr><td>66<td><code><pre> }</pre></code></table><div class=funcname id=fn_router.GET>func router.GET</div><div class=info><a href=#s_fn_router.GET>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>110<td><code><pre>func (r *router) GET(uri string, fn routerHandler, opts ...utils.OptionExtender) IRouter {</pre></code><tr><td>111<td><code><pre> opt := utils.ApplyOptions[routerOption](opts...)</pre></code><tr><td>112<td><code><pre> r.use().GET(uri, r.convertMulti(http.MethodGet, uri, fn, opt)...)</pre></code><tr><td>113<td><code><pre> return r</pre></code><tr><td>114<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.POST>func router.POST</div><div class=info><a href=#s_fn_router.POST>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>115<td><code><pre>func (r *router) POST(uri string, fn routerHandler, opts ...utils.OptionExtender) IRouter {</pre></code><tr><td>116<td><code><pre> opt := utils.ApplyOptions[routerOption](opts...)</pre></code><tr><td>117<td><code><pre> r.use().POST(uri, r.convertMulti(http.MethodPost, uri, fn, opt)...)</pre></code><tr><td>118<td><code><pre> return r</pre></code><tr><td>119<td><code><pre>}</pre></code></table><div class=funcname id=fn_@145:8>func @145:8</div><div class=info><a href=#s_fn_@145:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr><td>145<td><code><pre>func() { defer wg.Done(); <-router.Closing() }</pre></code></table><div class=funcname id=fn_@647:4>func @647:4</div><div class=info><a href=#s_fn_@647:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>647<td><code><pre>func() (ok bool) { code, ok = rspData["Code"]; return ok }</pre></code></table><div class=funcname id=fn_router.StaticFile>func router.StaticFile</div><div class=info><a href=#s_fn_router.StaticFile>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>161<td><code><pre>func (r *router) StaticFile(uri, file string) IRouter { r.use().StaticFile(uri, file); return r }</pre></code></table><div class=funcname id=fn_@318:10>func @318:10</div><div class=info><a href=#s_fn_@318:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>318<td><code><pre>func(c *gin.Context) {</pre></code><tr><td>319<td><code><pre> reflect.ValueOf(handler).Call([]reflect.Value{reflect.ValueOf(c)})</pre></code><tr><td>320<td><code><pre> c.Next()</pre></code><tr><td>321<td><code><pre> }</pre></code></table><div class=funcname id=fn_StaticFileZeroCopy>func StaticFileZeroCopy</div><div class=info><a href=#s_fn_StaticFileZeroCopy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/zerocopy.go</code>:</div><table class=listing><tr><td>20<td><code><pre>func StaticFileZeroCopy(filename string) func(c *gin.Context) {</pre></code><tr><td>21<td><code><pre> filename = path.Clean(filename)</pre></code><tr><td>22<td><code><pre> return func(c *gin.Context) {</pre></code><tr><td>23<td><code><pre> http.ServeFile(&ginZeroCopyWriter{ResponseWriter: c.Writer, ctx: c}, c.Request, filename)</pre></code><tr><td>24<td><code><pre> }</pre></code><tr><td>25<td><code><pre>}</pre></code></table><div class=funcname id=fn_ContentZeroCopy>func ContentZeroCopy</div><div class=info><a href=#s_fn_ContentZeroCopy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/zerocopy.go</code>:</div><table class=listing><tr><td>28<td><code><pre>func ContentZeroCopy(fn getContentFn, opts ...utils.OptionExtender) func(c *gin.Context) {</pre></code><tr><td>29<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>30<td><code><pre> return func(c *gin.Context) {</pre></code><tr><td>31<td><code><pre> name, modTime, content, err := fn(c)</pre></code><tr><td>32<td><code><pre> if err != nil {</pre></code><tr><td>33<td><code><pre> code, data, page, count, msg := parseRspError(nil, err)</pre></code><tr><td>34<td><code><pre> rspError(c, opt.appName, code, data, page, count, msg)</pre></code><tr><td>35<td><code><pre> c.Abort()</pre></code><tr><td>36<td><code><pre> return</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre> defer utils.CloseAnyway(content)</pre></code><tr><td>39<td><code><pre> http.ServeContent(&ginZeroCopyWriter{ResponseWriter: c.Writer, ctx: c}, c.Request, name, modTime, content)</pre></code><tr><td>40<td><code><pre> }</pre></code><tr><td>41<td><code><pre>}</pre></code></table><div class=funcname id=fn_@63:23>func @63:23</div><div class=info><a href=#s_fn_@63:23>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/zerocopy.go</code>:</div><table class=listing><tr><td>63<td><code><pre>func() (err error) { conn, _, err = z.ResponseWriter.Hijack(); return }</pre></code></table><div class=funcname id=fn_@646:4>func @646:4</div><div class=info><a href=#s_fn_@646:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>646<td><code><pre>func() (ok bool) { code, ok = rspData["code"]; return ok }</pre></code></table><div class=funcname id=fn_@22:9>func @22:9</div><div class=info><a href=#s_fn_@22:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/zerocopy.go</code>:</div><table class=listing><tr><td>22<td><code><pre>func(c *gin.Context) {</pre></code><tr><td>23<td><code><pre> http.ServeFile(&ginZeroCopyWriter{ResponseWriter: c.Writer, ctx: c}, c.Request, filename)</pre></code><tr><td>24<td><code><pre> }</pre></code></table><div class=funcname id=fn_@179:22>func @179:22</div><div class=info><a href=#s_fn_@179:22>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr><td>179<td><code><pre>func() i18n.Localizable[Errcode] { return bundle }</pre></code></table><div class=funcname id=fn_AppName>func AppName</div><div class=info><a href=#s_fn_AppName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr><td>251<td><code><pre>func AppName(name string) utils.OptionFunc[useOption] {</pre></code><tr><td>252<td><code><pre> return func(o *useOption) {</pre></code><tr><td>253<td><code><pre> o.appName = name</pre></code><tr><td>254<td><code><pre> }</pre></code><tr><td>255<td><code><pre>}</pre></code></table><div class=funcname id=fn_@252:9>func @252:9</div><div class=info><a href=#s_fn_@252:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr><td>252<td><code><pre>func(o *useOption) {</pre></code><tr><td>253<td><code><pre> o.appName = name</pre></code><tr><td>254<td><code><pre> }</pre></code></table><div class=funcname id=fn_router.Closing>func router.Closing</div><div class=info><a href=#s_fn_router.Closing>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>241<td><code><pre>func (r *router) Closing() <-chan struct{} { return r.close }</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr><td>269<td><code><pre>func init() {</pre></code><tr><td>270<td><code><pre> config.AddComponent(config.ComponentHttp, Construct, config.WithFlag(&flagString))</pre></code><tr><td>271<td><code><pre>}</pre></code></table><div class=funcname id=fn_Errcode.String>func Errcode.String</div><div class=info><a href=#s_fn_Errcode.String>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/error.go</code>:</div><table class=listing><tr><td>23<td><code><pre>func (e Errcode) String() (r string) {</pre></code><tr><td>24<td><code><pre> return strconv.Itoa(int(e))</pre></code><tr><td>25<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.Group>func router.Group</div><div class=info><a href=#s_fn_router.Group>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>145<td><code><pre>func (r *router) Group(relativePath string, handlers ...gin.HandlerFunc) IRouter {</pre></code><tr><td>146<td><code><pre> return &router{</pre></code><tr><td>147<td><code><pre> IRouter: r.IRouter,</pre></code><tr><td>148<td><code><pre> open: r.open,</pre></code><tr><td>149<td><code><pre> close: r.close,</pre></code><tr><td>150<td><code><pre> ctx: r.ctx,</pre></code><tr><td>151<td><code><pre> appName: r.appName,</pre></code><tr><td>152<td><code><pre> successCode: r.successCode,</pre></code><tr><td>153<td><code><pre> errorCode: r.errorCode,</pre></code><tr><td>154<td><code><pre> shutdownFunc: r.shutdownFunc,</pre></code><tr><td>155<td><code><pre> routes: r.routes,</pre></code><tr><td>156<td><code><pre> group: r.useIRouter().Group(relativePath, handlers...),</pre></code><tr><td>157<td><code><pre> ptr: dispatchGroup,</pre></code><tr><td>158<td><code><pre> }</pre></code><tr><td>159<td><code><pre>}</pre></code></table><div class=funcname id=fn_@770:42>func @770:42</div><div class=info><a href=#s_fn_@770:42>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>770<td><code><pre>func(s string) bool { return keywords[s] }</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/client.go</code>:</div><table class=listing><tr><td>186<td><code><pre>func init() {</pre></code><tr><td>187<td><code><pre> _ = utils.ParseTag(defaultClientConf,</pre></code><tr><td>188<td><code><pre> utils.ParseTagName("default"),</pre></code><tr><td>189<td><code><pre> utils.ParseTagUnmarshalType(utils.UnmarshalTypeYaml))</pre></code><tr><td>190<td><code><pre>}</pre></code></table><div class=funcname id=fn_Param>func Param</div><div class=info><a href=#s_fn_Param>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/error.go</code>:</div><table class=listing><tr><td>42<td><code><pre>func Param(param map[string]any) utils.OptionFunc[errOption] {</pre></code><tr><td>43<td><code><pre> return func(e *errOption) {</pre></code><tr><td>44<td><code><pre> e.param = param</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre>}</pre></code></table><div class=funcname id=fn_@43:9>func @43:9</div><div class=info><a href=#s_fn_@43:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/error.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func(e *errOption) {</pre></code><tr><td>44<td><code><pre> e.param = param</pre></code><tr><td>45<td><code><pre> }</pre></code></table><div class=funcname id=fn_@532:4>func @532:4</div><div class=info><a href=#s_fn_@532:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>532<td><code><pre>func() error { return parser.MapFormByTag(dst.Addr().Interface(), c.Request.URL.Query(), "json") }</pre></code></table><div class=funcname id=fn_NewRequest>func NewRequest</div><div class=info><a href=#s_fn_NewRequest>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/client.go</code>:</div><table class=listing><tr><td>130<td><code><pre>func NewRequest(ctx context.Context, opts ...utils.OptionExtender) *resty.Request {</pre></code><tr><td>131<td><code><pre> return New(opts...).R().SetContext(ctx)</pre></code><tr><td>132<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.ServeHTTP>func router.ServeHTTP</div><div class=info><a href=#s_fn_router.ServeHTTP>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>172<td><code><pre>func (r *router) ServeHTTP(w http.ResponseWriter, req *http.Request) {</pre></code><tr><td>173<td><code><pre> r.IRouter.(*gin.Engine).ServeHTTP(w, req)</pre></code><tr><td>174<td><code><pre>}</pre></code></table><div class=funcname id=fn_newRouter>func newRouter</div><div class=info><a href=#s_fn_newRouter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>72<td><code><pre>func newRouter(ctx context.Context, r gin.IRouter, appName string, successCode, errorCode int) IRouter {</pre></code><tr><td>73<td><code><pre> return &router{</pre></code><tr><td>74<td><code><pre> IRouter: r,</pre></code><tr><td>75<td><code><pre> ctx: ctx,</pre></code><tr><td>76<td><code><pre> open: make(chan struct{}),</pre></code><tr><td>77<td><code><pre> close: make(chan struct{}),</pre></code><tr><td>78<td><code><pre> appName: appName,</pre></code><tr><td>79<td><code><pre> successCode: successCode,</pre></code><tr><td>80<td><code><pre> errorCode: Errcode(errorCode),</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre>}</pre></code></table><div class=funcname id=fn_@468:8>func @468:8</div><div class=info><a href=#s_fn_@468:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>468<td><code><pre>func() { c.Request.Body = io.NopCloser(bytes.NewBuffer(bodyBytes)) }</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/flag.go</code>:</div><table class=listing><tr><td>7<td><code><pre>func init() {</pre></code><tr><td>8<td><code><pre> pflag.StringVarP(&flagString, "http-config", "", "", "json string for http config")</pre></code><tr><td>9<td><code><pre>}</pre></code></table><div class=funcname id=fn_@37:9>func @37:9</div><div class=info><a href=#s_fn_@37:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/client.go</code>:</div><table class=listing><tr><td>37<td><code><pre>func(o *clientOption) {</pre></code><tr><td>38<td><code><pre> o.name = name</pre></code><tr><td>39<td><code><pre> }</pre></code></table><div class=funcname id=fn_ginBindingValidatorI18n>func ginBindingValidatorI18n</div><div class=info><a href=#s_fn_ginBindingValidatorI18n>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/i18n.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func ginBindingValidatorI18n(appName string) {</pre></code><tr><td>44<td><code><pre> ginBindingI18nOnce.Do(func() {</pre></code><tr><td>45<td><code><pre> var ok bool</pre></code><tr><td>46<td><code><pre> engine, ok := binding.Validator.Engine().(*validator.Validate)</pre></code><tr><td>47<td><code><pre> if !ok {</pre></code><tr><td>48<td><code><pre> return</pre></code><tr><td>49<td><code><pre> }</pre></code><tr><td>50<td><code><pre></pre></code><tr><td>51<td><code><pre> enLocales := en.New()</pre></code><tr><td>52<td><code><pre> zhLocales := zh.New()</pre></code><tr><td>53<td><code><pre> switch lang := i18n.DefaultLang(i18n.AppName(appName)); lang {</pre></code><tr><td>54<td><code><pre> case language.English:</pre></code><tr><td>55<td><code><pre> ginBindingI18nTranslator, ok = ut.New(enLocales, zhLocales, enLocales).GetTranslator(lang.String())</pre></code><tr><td>56<td><code><pre> if !ok {</pre></code><tr><td>57<td><code><pre> return</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre> utils.MustSuccess(enT.RegisterDefaultTranslations(engine, ginBindingI18nTranslator))</pre></code><tr><td>60<td><code><pre> default:</pre></code><tr><td>61<td><code><pre> ginBindingI18nTranslator, ok = ut.New(zhLocales, zhLocales, enLocales).GetTranslator(lang.String())</pre></code><tr><td>62<td><code><pre> if !ok {</pre></code><tr><td>63<td><code><pre> return</pre></code><tr><td>64<td><code><pre> }</pre></code><tr><td>65<td><code><pre> utils.MustSuccess(zhT.RegisterDefaultTranslations(engine, ginBindingI18nTranslator))</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre> })</pre></code><tr><td>68<td><code><pre>}</pre></code></table><div class=funcname id=fn_@531:4>func @531:4</div><div class=info><a href=#s_fn_@531:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>531<td><code><pre>func() error { return parser.MapFormByTag(dst.Addr().Interface(), m, "json") }</pre></code></table><div class=funcname id=fn_CName>func CName</div><div class=info><a href=#s_fn_CName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/client.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func CName(name string) utils.OptionFunc[clientOption] {</pre></code><tr><td>37<td><code><pre> return func(o *clientOption) {</pre></code><tr><td>38<td><code><pre> o.name = name</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre>}</pre></code></table><div class=funcname id=fn_asynqRedisConnOpt.MakeRedisClient>func asynqRedisConnOpt.MakeRedisClient</div><div class=info><a href=#s_fn_asynqRedisConnOpt.MakeRedisClient>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/asynq.go</code>:</div><table class=listing><tr><td>42<td><code><pre>func (a *asynqRedisConnOpt) MakeRedisClient() any { return a.UniversalClient }</pre></code></table><div class=funcname id=fn_router.Use>func router.Use</div><div class=info><a href=#s_fn_router.Use>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>84<td><code><pre>func (r *router) Use(middlewares ...gin.HandlerFunc) IRouter {</pre></code><tr><td>85<td><code><pre> return &router{</pre></code><tr><td>86<td><code><pre> IRouter: r.IRouter,</pre></code><tr><td>87<td><code><pre> open: r.open,</pre></code><tr><td>88<td><code><pre> close: r.close,</pre></code><tr><td>89<td><code><pre> ctx: r.ctx,</pre></code><tr><td>90<td><code><pre> appName: r.appName,</pre></code><tr><td>91<td><code><pre> successCode: r.successCode,</pre></code><tr><td>92<td><code><pre> errorCode: r.errorCode,</pre></code><tr><td>93<td><code><pre> shutdownFunc: r.shutdownFunc,</pre></code><tr><td>94<td><code><pre> routes: r.use().Use(middlewares...),</pre></code><tr><td>95<td><code><pre> group: r.group,</pre></code><tr><td>96<td><code><pre> ptr: dispatchRoutes,</pre></code><tr><td>97<td><code><pre> }</pre></code><tr><td>98<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.Running>func router.Running</div><div class=info><a href=#s_fn_router.Running>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>240<td><code><pre>func (r *router) Running() <-chan struct{} { return r.open }</pre></code></table><div class=funcname id=fn_@549:9>func @549:9</div><div class=info><a href=#s_fn_@549:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>549<td><code><pre>func(c *gin.Context) {</pre></code><tr><td>550<td><code><pre> var (</pre></code><tr><td>551<td><code><pre> err error</pre></code><tr><td>552<td><code><pre> reqVal reflect.Value</pre></code><tr><td>553<td><code><pre> rspVals []reflect.Value</pre></code><tr><td>554<td><code><pre> )</pre></code><tr><td>555<td><code><pre></pre></code><tr><td>556<td><code><pre> // deal with request & call handler</pre></code><tr><td>557<td><code><pre> if reqParse == nil {</pre></code><tr><td>558<td><code><pre> rspVals = reflect.ValueOf(handler).Call([]reflect.Value{reflect.ValueOf(c)})</pre></code><tr><td>559<td><code><pre> } else if reqVal, err = reqParse(c, typ.In(1)); err == nil {</pre></code><tr><td>560<td><code><pre> rspVals = reflect.ValueOf(handler).Call([]reflect.Value{reflect.ValueOf(c), reqVal})</pre></code><tr><td>561<td><code><pre> } else {</pre></code><tr><td>562<td><code><pre> switch e := err.(type) {</pre></code><tr><td>563<td><code><pre> case *json.UnmarshalTypeError:</pre></code><tr class=miss><td>564<td><code><pre> msg := fmt.Sprintf(": %s field type should be %s", e.Value, e.Type.String())</pre></code><tr class=miss><td>565<td><code><pre> r.rspError(c, nil, Err(c, r.errorCode, Param(map[string]any{"err": msg})))</pre></code><tr><td>566<td><code><pre> default:</pre></code><tr><td>567<td><code><pre> r.rspError(c, nil, Err(c, r.errorCode,</pre></code><tr><td>568<td><code><pre> Param(map[string]any{"err": fmt.Sprintf(": %s", err.Error())})))</pre></code><tr><td>569<td><code><pre> }</pre></code><tr><td>570<td><code><pre> c.Next()</pre></code><tr><td>571<td><code><pre> return</pre></code><tr><td>572<td><code><pre> }</pre></code><tr><td>573<td><code><pre></pre></code><tr><td>574<td><code><pre> // deal with response</pre></code><tr><td>575<td><code><pre> errVal := rspVals[numOut-1]</pre></code><tr><td>576<td><code><pre> if !errVal.IsNil() {</pre></code><tr><td>577<td><code><pre> err = errVal.Interface().(error)</pre></code><tr><td>578<td><code><pre> }</pre></code><tr><td>579<td><code><pre> rspVals = rspVals[:numOut-1]</pre></code><tr><td>580<td><code><pre></pre></code><tr><td>581<td><code><pre> var rspType reflect.Type</pre></code><tr><td>582<td><code><pre> isEmbed, isResponse := false, false</pre></code><tr><td>583<td><code><pre> if len(rspVals) > 0 {</pre></code><tr><td>584<td><code><pre> rspType = utils.IndirectType(rspVals[0].Type())</pre></code><tr><td>585<td><code><pre> isEmbed = utils.EmbedsType(rspType, embedType)</pre></code><tr><td>586<td><code><pre> isResponse = utils.EmbedsType(rspType, responseType)</pre></code><tr><td>587<td><code><pre> }</pre></code><tr><td>588<td><code><pre></pre></code><tr><td>589<td><code><pre> switch {</pre></code><tr><td>590<td><code><pre> case isEmbed, isResponse:</pre></code><tr><td>591<td><code><pre> r.rspEmbed(c, rspVals[0], rspType, err) // directly json marshal embed response</pre></code><tr><td>592<td><code><pre> case err != nil:</pre></code><tr><td>593<td><code><pre> r.rspError(c, rspVals, err) // business error</pre></code><tr><td>594<td><code><pre> default:</pre></code><tr><td>595<td><code><pre> r.rspSuccess(c, rspVals) // success with response</pre></code><tr><td>596<td><code><pre> }</pre></code><tr><td>597<td><code><pre></pre></code><tr><td>598<td><code><pre> c.Next()</pre></code><tr><td>599<td><code><pre> }</pre></code></table><div class=funcname id=fn_rspSuccess>func rspSuccess</div><div class=info><a href=#s_fn_rspSuccess>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/response.go</code>:</div><table class=listing><tr><td>64<td><code><pre>func rspSuccess(c *gin.Context, code int, data any, page, count int, msg string) {</pre></code><tr><td>65<td><code><pre> status := c.Writer.Status()</pre></code><tr><td>66<td><code><pre> if status <= 0 {</pre></code><tr class=miss><td>67<td><code><pre> status = http.StatusOK</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre> if msg == "" {</pre></code><tr><td>70<td><code><pre> msg = "ok"</pre></code><tr><td>71<td><code><pre> }</pre></code><tr><td>72<td><code><pre> var (</pre></code><tr><td>73<td><code><pre> pagePtr *int</pre></code><tr><td>74<td><code><pre> countPtr *int</pre></code><tr><td>75<td><code><pre> )</pre></code><tr><td>76<td><code><pre> if page > 0 {</pre></code><tr><td>77<td><code><pre> pagePtr = utils.AnyPtr(page)</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre> if count >= 0 {</pre></code><tr><td>80<td><code><pre> countPtr = utils.AnyPtr(count)</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre></pre></code><tr><td>83<td><code><pre> c.PureJSON(status, &Response{</pre></code><tr><td>84<td><code><pre> Code: code,</pre></code><tr><td>85<td><code><pre> Message: msg,</pre></code><tr><td>86<td><code><pre> Data: data,</pre></code><tr><td>87<td><code><pre> Page: pagePtr,</pre></code><tr><td>88<td><code><pre> Count: countPtr,</pre></code><tr><td>89<td><code><pre> TraceID: c.GetString(fusCtx.KeyTraceID),</pre></code><tr><td>90<td><code><pre> })</pre></code><tr><td>91<td><code><pre>}</pre></code></table><div class=funcname id=fn_useClient>func useClient</div><div class=info><a href=#s_fn_useClient>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/client.go</code>:</div><table class=listing><tr><td>171<td><code><pre>func useClient(opts ...utils.OptionExtender) (cli *resty.Client) {</pre></code><tr><td>172<td><code><pre> locker.RLock()</pre></code><tr><td>173<td><code><pre> defer locker.RUnlock()</pre></code><tr><td>174<td><code><pre></pre></code><tr><td>175<td><code><pre> opt := utils.ApplyOptions[clientOption](opts...)</pre></code><tr><td>176<td><code><pre> opt.appName = utils.ApplyOptions[useOption](opts...).appName</pre></code><tr><td>177<td><code><pre> locker.RLock()</pre></code><tr><td>178<td><code><pre> defer locker.RUnlock()</pre></code><tr><td>179<td><code><pre> appClients, ok := appClientMap[opt.appName]</pre></code><tr><td>180<td><code><pre> if !ok {</pre></code><tr><td>181<td><code><pre> return</pre></code><tr><td>182<td><code><pre> }</pre></code><tr class=miss><td>183<td><code><pre> return appClients[opt.name]</pre></code><tr><td>184<td><code><pre>}</pre></code></table><div class=funcname id=fn_addRouter>func addRouter</div><div class=info><a href=#s_fn_addRouter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr><td>69<td><code><pre>func addRouter(ctx context.Context, conf Conf, logger resty.Logger, opt *config.InitOption) func() {</pre></code><tr><td>70<td><code><pre> if config.Use(opt.AppName).Debug() {</pre></code><tr><td>71<td><code><pre> gin.SetMode(gin.DebugMode)</pre></code><tr><td>72<td><code><pre> } else {</pre></code><tr><td>73<td><code><pre> gin.SetMode(gin.ReleaseMode)</pre></code><tr><td>74<td><code><pre> }</pre></code><tr><td>75<td><code><pre> if !conf.ColorfulConsole {</pre></code><tr><td>76<td><code><pre> gin.DisableConsoleColor()</pre></code><tr><td>77<td><code><pre> } else {</pre></code><tr class=miss><td>78<td><code><pre> gin.ForceConsoleColor()</pre></code><tr><td>79<td><code><pre> }</pre></code><tr><td>80<td><code><pre></pre></code><tr><td>81<td><code><pre> engine := gin.New()</pre></code><tr><td>82<td><code><pre> engine.Use(</pre></code><tr><td>83<td><code><pre> gin.Recovery(),</pre></code><tr><td>84<td><code><pre> middleware.Gateway,</pre></code><tr><td>85<td><code><pre> middleware.Trace(),</pre></code><tr><td>86<td><code><pre> middleware.Logging(ctx, opt.AppName, conf.Metrics.HeaderLabels, logger),</pre></code><tr><td>87<td><code><pre> middleware.Cors(),</pre></code><tr><td>88<td><code><pre> middleware.XSS(conf.XSSWhiteURLList),</pre></code><tr><td>89<td><code><pre> middleware.Recover(opt.AppName, logger, map[string]any{</pre></code><tr><td>90<td><code><pre> "code": Errcode(conf.ErrorCode),</pre></code><tr><td>91<td><code><pre> "message": "service internal error",</pre></code><tr><td>92<td><code><pre> }),</pre></code><tr><td>93<td><code><pre> )</pre></code><tr><td>94<td><code><pre></pre></code><tr><td>95<td><code><pre> tag := i18n.DefaultLang(i18n.AppName(opt.AppName))</pre></code><tr><td>96<td><code><pre> engine.NoMethod(func(c *gin.Context) {</pre></code><tr><td>97<td><code><pre> c.Status(http.StatusMethodNotAllowed)</pre></code><tr><td>98<td><code><pre> msg := fmt.Sprintf("找不到该方法, Method: %s", c.Request.Method)</pre></code><tr><td>99<td><code><pre> if tag != language.Chinese {</pre></code><tr><td>100<td><code><pre> msg = fmt.Sprintf("Cannot find method: %s", c.Request.Method)</pre></code><tr><td>101<td><code><pre> }</pre></code><tr><td>102<td><code><pre></pre></code><tr><td>103<td><code><pre> rspError(c, opt.AppName, Errcode(conf.ErrorCode), nil, 0, 0, msg)</pre></code><tr><td>104<td><code><pre> })</pre></code><tr><td>105<td><code><pre> engine.NoRoute(func(c *gin.Context) {</pre></code><tr><td>106<td><code><pre> c.Status(http.StatusNotFound)</pre></code><tr><td>107<td><code><pre> msg := fmt.Sprintf("找不到该内容, URL: %s", c.Request.URL.String())</pre></code><tr><td>108<td><code><pre> if tag != language.Chinese {</pre></code><tr><td>109<td><code><pre> msg = fmt.Sprintf("Cannot find URL content: %s", c.Request.URL.String())</pre></code><tr><td>110<td><code><pre> }</pre></code><tr><td>111<td><code><pre> rspError(c, opt.AppName, Errcode(conf.ErrorCode), nil, 0, 0, msg)</pre></code><tr><td>112<td><code><pre> })</pre></code><tr><td>113<td><code><pre></pre></code><tr><td>114<td><code><pre> if conf.Pprof {</pre></code><tr class=miss><td>115<td><code><pre> pprof.Register(engine)</pre></code><tr><td>116<td><code><pre> }</pre></code><tr><td>117<td><code><pre> instance := newRouter(ctx, engine, opt.AppName, conf.SuccessCode, conf.ErrorCode)</pre></code><tr><td>118<td><code><pre> instance.(*router).metricsConf = conf.Metrics</pre></code><tr><td>119<td><code><pre></pre></code><tr><td>120<td><code><pre> locker.Lock()</pre></code><tr><td>121<td><code><pre> defer locker.Unlock()</pre></code><tr><td>122<td><code><pre> if len(conf.Asynq) > 0 {</pre></code><tr><td>123<td><code><pre> initAsynq(ctx, opt.AppName, instance, conf.Asynq)</pre></code><tr><td>124<td><code><pre> }</pre></code><tr><td>125<td><code><pre> if _, ok := routers[opt.AppName]; ok {</pre></code><tr class=miss><td>126<td><code><pre> panic(errors.Errorf("duplicated http name: %s", opt.AppName))</pre></code><tr><td>127<td><code><pre> }</pre></code><tr><td>128<td><code><pre> routers[opt.AppName] = instance</pre></code><tr><td>129<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>130<td><code><pre> Router = instance</pre></code><tr><td>131<td><code><pre> }</pre></code><tr><td>132<td><code><pre></pre></code><tr><td>133<td><code><pre> if opt.DI != nil {</pre></code><tr><td>134<td><code><pre> opt.DI.MustProvide(func() IRouter { return Use(AppName(opt.AppName)) })</pre></code><tr><td>135<td><code><pre> }</pre></code><tr><td>136<td><code><pre></pre></code><tr><td>137<td><code><pre> return func() {</pre></code><tr><td>138<td><code><pre> locker.Lock()</pre></code><tr><td>139<td><code><pre> defer locker.Unlock()</pre></code><tr><td>140<td><code><pre> if routers != nil {</pre></code><tr><td>141<td><code><pre> if router, ok := routers[opt.AppName]; ok {</pre></code><tr><td>142<td><code><pre> router.shutdown()</pre></code><tr><td>143<td><code><pre> wg := new(sync.WaitGroup)</pre></code><tr><td>144<td><code><pre> wg.Add(1)</pre></code><tr><td>145<td><code><pre> go func() { defer wg.Done(); <-router.Closing() }()</pre></code><tr><td>146<td><code><pre> if utils.Timeout(15*time.Second, utils.TimeoutWg(wg)) {</pre></code><tr><td>147<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>148<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>149<td><code><pre> log.Printf("%v [Gofusion] %s %s close http server timeout", pid, app, config.ComponentHttp)</pre></code><tr><td>150<td><code><pre> }</pre></code><tr><td>151<td><code><pre> }</pre></code><tr><td>152<td><code><pre></pre></code><tr><td>153<td><code><pre> delete(routers, opt.AppName)</pre></code><tr><td>154<td><code><pre> }</pre></code><tr><td>155<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>156<td><code><pre> Router = nil</pre></code><tr><td>157<td><code><pre> }</pre></code><tr><td>158<td><code><pre> }</pre></code><tr><td>159<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.shutdown>func router.shutdown</div><div class=info><a href=#s_fn_router.shutdown>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>243<td><code><pre>func (r *router) shutdown() {</pre></code><tr><td>244<td><code><pre> if r.close != nil {</pre></code><tr><td>245<td><code><pre> if _, ok := utils.IsChannelClosed(r.close); ok {</pre></code><tr class=miss><td>246<td><code><pre> return</pre></code><tr><td>247<td><code><pre> }</pre></code><tr><td>248<td><code><pre> }</pre></code><tr><td>249<td><code><pre> if r.shutdownFunc != nil {</pre></code><tr><td>250<td><code><pre> r.shutdownFunc()</pre></code><tr><td>251<td><code><pre> }</pre></code><tr><td>252<td><code><pre> if r.close != nil {</pre></code><tr><td>253<td><code><pre> close(r.close)</pre></code><tr><td>254<td><code><pre> }</pre></code><tr><td>255<td><code><pre></pre></code><tr><td>256<td><code><pre> r.open = make(chan struct{})</pre></code><tr><td>257<td><code><pre>}</pre></code></table><div class=funcname id=fn_New>func New</div><div class=info><a href=#s_fn_New>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/client.go</code>:</div><table class=listing><tr><td>58<td><code><pre>func New(opts ...utils.OptionExtender) *resty.Client {</pre></code><tr><td>59<td><code><pre> opt := utils.ApplyOptions[clientOption](opts...)</pre></code><tr><td>60<td><code><pre> opt.appName = utils.ApplyOptions[useOption](opts...).appName</pre></code><tr><td>61<td><code><pre></pre></code><tr><td>62<td><code><pre> cli := useClient(opts...)</pre></code><tr><td>63<td><code><pre> if cli != nil {</pre></code><tr class=miss><td>64<td><code><pre> return applyClientOptions(cli, opt)</pre></code><tr><td>65<td><code><pre> }</pre></code><tr><td>66<td><code><pre></pre></code><tr><td>67<td><code><pre> locker.Lock()</pre></code><tr><td>68<td><code><pre> defer locker.Unlock()</pre></code><tr><td>69<td><code><pre></pre></code><tr><td>70<td><code><pre> c := resty.New().</pre></code><tr><td>71<td><code><pre> OnBeforeRequest(traceHeaderMiddleware).</pre></code><tr><td>72<td><code><pre> SetTransport(http.DefaultTransport).</pre></code><tr><td>73<td><code><pre> SetJSONMarshaler(json.Marshal).</pre></code><tr><td>74<td><code><pre> SetJSONUnmarshaler(json.Unmarshal).</pre></code><tr><td>75<td><code><pre> SetDebug(true)</pre></code><tr><td>76<td><code><pre></pre></code><tr><td>77<td><code><pre> cfg, ok := appClientCfgMap[opt.appName][opt.name]</pre></code><tr><td>78<td><code><pre> if !ok {</pre></code><tr class=miss><td>79<td><code><pre> cfg = appClientCfgMap[opt.appName][config.DefaultInstanceKey]</pre></code><tr><td>80<td><code><pre> }</pre></code><tr><td>81<td><code><pre></pre></code><tr><td>82<td><code><pre> if cfg.logger != nil {</pre></code><tr><td>83<td><code><pre> c.SetLogger(cfg.logger)</pre></code><tr><td>84<td><code><pre> }</pre></code><tr><td>85<td><code><pre></pre></code><tr><td>86<td><code><pre> if cliCfg := cfg.c; cliCfg == nil || !cliCfg.Mock {</pre></code><tr><td>87<td><code><pre> c.EnableTrace()</pre></code><tr><td>88<td><code><pre> } else {</pre></code><tr><td>89<td><code><pre> c.SetTimeout(utils.Must(time.ParseDuration(cliCfg.Timeout)))</pre></code><tr><td>90<td><code><pre> c.SetRetryCount(cliCfg.RetryCount)</pre></code><tr><td>91<td><code><pre> c.SetRetryWaitTime(utils.Must(time.ParseDuration(cliCfg.RetryWaitTime)))</pre></code><tr><td>92<td><code><pre> c.SetRetryMaxWaitTime(utils.Must(time.ParseDuration(cliCfg.RetryMaxWaitTime)))</pre></code><tr><td>93<td><code><pre> for _, funcName := range cliCfg.RetryConditionFuncs {</pre></code><tr class=miss><td>94<td><code><pre> c.AddRetryCondition(*(*resty.RetryConditionFunc)(inspect.FuncOf(funcName)))</pre></code><tr><td>95<td><code><pre> }</pre></code><tr><td>96<td><code><pre> for _, hookName := range cliCfg.RetryHooks {</pre></code><tr class=miss><td>97<td><code><pre> c.AddRetryHook(*(*resty.OnRetryFunc)(inspect.FuncOf(hookName)))</pre></code><tr><td>98<td><code><pre> }</pre></code><tr><td>99<td><code><pre></pre></code><tr><td>100<td><code><pre> dialer := &net.Dialer{</pre></code><tr><td>101<td><code><pre> Timeout: utils.Must(time.ParseDuration(cliCfg.DialTimeout)),</pre></code><tr><td>102<td><code><pre> KeepAlive: utils.Must(time.ParseDuration(cliCfg.DialKeepaliveTime)),</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre></pre></code><tr><td>105<td><code><pre> c.SetTransport(&http.Transport{</pre></code><tr><td>106<td><code><pre> Proxy: http.ProxyFromEnvironment,</pre></code><tr><td>107<td><code><pre> DialContext: dialer.DialContext,</pre></code><tr><td>108<td><code><pre> ForceAttemptHTTP2: cliCfg.ForceAttemptHTTP2,</pre></code><tr><td>109<td><code><pre> DisableCompression: cliCfg.DisableCompression,</pre></code><tr><td>110<td><code><pre> IdleConnTimeout: utils.Must(time.ParseDuration(cliCfg.IdleConnTimeout)),</pre></code><tr><td>111<td><code><pre> TLSHandshakeTimeout: utils.Must(time.ParseDuration(cliCfg.TLSHandshakeTimeout)),</pre></code><tr><td>112<td><code><pre> ExpectContinueTimeout: utils.Must(time.ParseDuration(cliCfg.TLSHandshakeTimeout)),</pre></code><tr><td>113<td><code><pre> MaxIdleConns: cliCfg.MaxIdleConns,</pre></code><tr><td>114<td><code><pre> MaxIdleConnsPerHost: cliCfg.MaxIdleConnsPerHost,</pre></code><tr><td>115<td><code><pre> MaxConnsPerHost: cliCfg.MaxConnsPerHost,</pre></code><tr><td>116<td><code><pre> })</pre></code><tr><td>117<td><code><pre></pre></code><tr><td>118<td><code><pre> if cliCfg.Mock {</pre></code><tr><td>119<td><code><pre> httpmock.ActivateNonDefault(c.GetClient())</pre></code><tr><td>120<td><code><pre> }</pre></code><tr><td>121<td><code><pre> }</pre></code><tr><td>122<td><code><pre></pre></code><tr><td>123<td><code><pre> if _, ok := appClientMap[opt.appName]; !ok {</pre></code><tr><td>124<td><code><pre> appClientMap[opt.appName] = make(map[string]*resty.Client)</pre></code><tr><td>125<td><code><pre> }</pre></code><tr><td>126<td><code><pre> appClientMap[opt.appName][opt.name] = c</pre></code><tr><td>127<td><code><pre> return applyClientOptions(c, opt)</pre></code><tr><td>128<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.convert>func router.convert</div><div class=info><a href=#s_fn_router.convert>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>309<td><code><pre>func (r *router) convert(method, uri string, handler routerHandler, opt *routerOption) gin.HandlerFunc {</pre></code><tr><td>310<td><code><pre> // check IRouter handler type</pre></code><tr><td>311<td><code><pre> typ := reflect.TypeOf(handler)</pre></code><tr><td>312<td><code><pre> if err := r.checkHandlerType(method, uri, typ); err != nil {</pre></code><tr class=miss><td>313<td><code><pre> panic(err)</pre></code><tr><td>314<td><code><pre> }</pre></code><tr><td>315<td><code><pre></pre></code><tr><td>316<td><code><pre> // return raw gin handler</pre></code><tr><td>317<td><code><pre> if typ.NumIn() == 1 && typ.NumOut() == 0 {</pre></code><tr><td>318<td><code><pre> return func(c *gin.Context) {</pre></code><tr><td>319<td><code><pre> reflect.ValueOf(handler).Call([]reflect.Value{reflect.ValueOf(c)})</pre></code><tr><td>320<td><code><pre> c.Next()</pre></code><tr><td>321<td><code><pre> }</pre></code><tr><td>322<td><code><pre> }</pre></code><tr><td>323<td><code><pre></pre></code><tr><td>324<td><code><pre> // parse request&response</pre></code><tr><td>325<td><code><pre> if typ.NumIn() == 1 {</pre></code><tr><td>326<td><code><pre> return r.wrapHandlerFunc(handler, nil)</pre></code><tr><td>327<td><code><pre> }</pre></code><tr><td>328<td><code><pre></pre></code><tr><td>329<td><code><pre> parseMap := map[parseFrom]routerRequestParser{</pre></code><tr><td>330<td><code><pre> parseFromBody: r.parseReqFromBody,</pre></code><tr><td>331<td><code><pre> parseFromQuery: r.parseReqFromQuery,</pre></code><tr><td>332<td><code><pre> }</pre></code><tr><td>333<td><code><pre></pre></code><tr><td>334<td><code><pre> var reqParse routerRequestParser</pre></code><tr><td>335<td><code><pre> if p, ok := parseMap[opt.parseFrom]; ok {</pre></code><tr class=miss><td>336<td><code><pre> reqParse = p</pre></code><tr><td>337<td><code><pre> } else if methodWithBody[method] {</pre></code><tr><td>338<td><code><pre> reqParse = r.parseReqFromBody</pre></code><tr><td>339<td><code><pre> } else {</pre></code><tr><td>340<td><code><pre> reqParse = r.parseReqFromQuery</pre></code><tr><td>341<td><code><pre> }</pre></code><tr><td>342<td><code><pre></pre></code><tr><td>343<td><code><pre> return r.wrapHandlerFunc(handler, reqParse)</pre></code><tr><td>344<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.Start>func router.Start</div><div class=info><a href=#s_fn_router.Start>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>203<td><code><pre>func (r *router) Start() {</pre></code><tr><td>204<td><code><pre> if _, ok := utils.IsChannelClosed(r.open); ok {</pre></code><tr class=miss><td>205<td><code><pre> return</pre></code><tr><td>206<td><code><pre> }</pre></code><tr><td>207<td><code><pre> conf := r.Config()</pre></code><tr><td>208<td><code><pre> gracefully.DefaultReadTimeOut = conf.ReadTimeout</pre></code><tr><td>209<td><code><pre> gracefully.DefaultWriteTimeOut = conf.WriteTimeout</pre></code><tr><td>210<td><code><pre> gracefully.DefaultMaxHeaderBytes = 1 << 20 // use http.DefaultMaxHeaderBytes - which currently is 1 << 20 (1MB)</pre></code><tr><td>211<td><code><pre></pre></code><tr><td>212<td><code><pre> port := fmt.Sprintf(":%v", conf.Port)</pre></code><tr><td>213<td><code><pre> srv := gracefully.NewServer(r.appName, r.IRouter.(*gin.Engine), port, conf.NextProtos)</pre></code><tr><td>214<td><code><pre> r.shutdownFunc = srv.Shutdown</pre></code><tr><td>215<td><code><pre> if conf.TLS {</pre></code><tr class=miss><td>216<td><code><pre> routine.Go(srv.ListenAndServeTLS, routine.Args(conf.Cert, conf.Key), routine.AppName(r.appName))</pre></code><tr><td>217<td><code><pre> } else {</pre></code><tr><td>218<td><code><pre> routine.Go(srv.ListenAndServe, routine.AppName(r.appName))</pre></code><tr><td>219<td><code><pre> }</pre></code><tr><td>220<td><code><pre></pre></code><tr><td>221<td><code><pre> r.close = make(chan struct{})</pre></code><tr><td>222<td><code><pre> close(r.open)</pre></code><tr><td>223<td><code><pre>}</pre></code></table><div class=funcname id=fn_lookupFieldByMap>func lookupFieldByMap</div><div class=info><a href=#s_fn_lookupFieldByMap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>777<td><code><pre>func lookupFieldByMap(v reflect.Value, keywords map[string]bool) (reflect.Value, bool) {</pre></code><tr><td>778<td><code><pre> vMap, ok := v.Interface().(map[string]any)</pre></code><tr><td>779<td><code><pre> if !ok {</pre></code><tr><td>780<td><code><pre> return reflect.Value{}, false</pre></code><tr><td>781<td><code><pre> }</pre></code><tr><td>782<td><code><pre></pre></code><tr><td>783<td><code><pre> for key := range keywords {</pre></code><tr><td>784<td><code><pre> if vv, ok := vMap[key]; ok {</pre></code><tr><td>785<td><code><pre> return reflect.ValueOf(vv), true</pre></code><tr><td>786<td><code><pre> }</pre></code><tr><td>787<td><code><pre> }</pre></code><tr class=miss><td>788<td><code><pre> return reflect.Value{}, false</pre></code><tr><td>789<td><code><pre>}</pre></code></table><div class=funcname id=fn_Use>func Use</div><div class=info><a href=#s_fn_Use>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr><td>257<td><code><pre>func Use(opts ...utils.OptionExtender) IRouter {</pre></code><tr><td>258<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>259<td><code><pre> locker.RLock()</pre></code><tr><td>260<td><code><pre> defer locker.RUnlock()</pre></code><tr><td>261<td><code><pre></pre></code><tr><td>262<td><code><pre> router, ok := routers[opt.appName]</pre></code><tr><td>263<td><code><pre> if !ok {</pre></code><tr class=miss><td>264<td><code><pre> panic(errors.Errorf("router not found"))</pre></code><tr><td>265<td><code><pre> }</pre></code><tr><td>266<td><code><pre> return router</pre></code><tr><td>267<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.parseReqFromBody>func router.parseReqFromBody</div><div class=info><a href=#s_fn_router.parseReqFromBody>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>446<td><code><pre>func (r *router) parseReqFromBody(c *gin.Context, typ reflect.Type) (dst reflect.Value, err error) {</pre></code><tr><td>447<td><code><pre> ptrDepth := 0</pre></code><tr><td>448<td><code><pre> for typ.Kind() == reflect.Ptr {</pre></code><tr><td>449<td><code><pre> typ = typ.Elem()</pre></code><tr><td>450<td><code><pre> ptrDepth++</pre></code><tr><td>451<td><code><pre> }</pre></code><tr><td>452<td><code><pre> defer func() {</pre></code><tr><td>453<td><code><pre> for ptrDepth > 0 {</pre></code><tr><td>454<td><code><pre> dst = dst.Addr()</pre></code><tr><td>455<td><code><pre> ptrDepth--</pre></code><tr><td>456<td><code><pre> }</pre></code><tr><td>457<td><code><pre> }()</pre></code><tr><td>458<td><code><pre></pre></code><tr><td>459<td><code><pre> bodyBytes, _ := io.ReadAll(c.Request.Body)</pre></code><tr><td>460<td><code><pre> c.Request.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))</pre></code><tr><td>461<td><code><pre></pre></code><tr><td>462<td><code><pre> dst = reflect.Indirect(reflect.New(typ))</pre></code><tr><td>463<td><code><pre> if err = c.ShouldBind(dst.Addr().Interface()); err != nil &&</pre></code><tr><td>464<td><code><pre> !(errors.Is(err, binding.ErrConvertToMapString) || (errors.Is(err, binding.ErrConvertMapStringSlice))) {</pre></code><tr><td>465<td><code><pre> err = parseGinBindingValidatorError(err)</pre></code><tr><td>466<td><code><pre> return</pre></code><tr><td>467<td><code><pre> }</pre></code><tr><td>468<td><code><pre> defer func() { c.Request.Body = io.NopCloser(bytes.NewBuffer(bodyBytes)) }()</pre></code><tr><td>469<td><code><pre></pre></code><tr><td>470<td><code><pre> if dst.IsZero() {</pre></code><tr><td>471<td><code><pre> var (</pre></code><tr><td>472<td><code><pre> p parser.Parser</pre></code><tr><td>473<td><code><pre> param map[string]string</pre></code><tr><td>474<td><code><pre> contentType string</pre></code><tr><td>475<td><code><pre> )</pre></code><tr><td>476<td><code><pre> if contentType, param, err = mime.ParseMediaType(c.GetHeader("Content-Type")); err != nil {</pre></code><tr class=miss><td>477<td><code><pre> return</pre></code><tr><td>478<td><code><pre> }</pre></code><tr><td>479<td><code><pre> if p, err = parser.GetByContentType(contentType); err != nil {</pre></code><tr class=miss><td>480<td><code><pre> return</pre></code><tr><td>481<td><code><pre> }</pre></code><tr><td>482<td><code><pre> if err = p.PreParse(param); err != nil {</pre></code><tr class=miss><td>483<td><code><pre> return</pre></code><tr><td>484<td><code><pre> }</pre></code><tr><td>485<td><code><pre> c.Request.Body = io.NopCloser(bytes.NewBuffer(bodyBytes))</pre></code><tr><td>486<td><code><pre> if err = p.Parse(c.Request.Body, dst); err != nil {</pre></code><tr class=miss><td>487<td><code><pre> return</pre></code><tr><td>488<td><code><pre> }</pre></code><tr><td>489<td><code><pre> }</pre></code><tr><td>490<td><code><pre></pre></code><tr><td>491<td><code><pre> err = utils.ParseTag(</pre></code><tr><td>492<td><code><pre> dst.Addr().Interface(),</pre></code><tr><td>493<td><code><pre> utils.ParseTagName("default"),</pre></code><tr><td>494<td><code><pre> utils.ParseTagUnmarshalType(utils.UnmarshalTypeYaml),</pre></code><tr><td>495<td><code><pre> )</pre></code><tr><td>496<td><code><pre></pre></code><tr><td>497<td><code><pre> return</pre></code><tr><td>498<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.rspEmbed>func router.rspEmbed</div><div class=info><a href=#s_fn_router.rspEmbed>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>618<td><code><pre>func (r *router) rspEmbed(c *gin.Context, rspVal reflect.Value, rspType reflect.Type, err error) {</pre></code><tr><td>619<td><code><pre> var data any</pre></code><tr><td>620<td><code><pre> if rspVal.IsValid() {</pre></code><tr><td>621<td><code><pre> data = rspVal.Interface()</pre></code><tr><td>622<td><code><pre> } else {</pre></code><tr class=miss><td>623<td><code><pre> data = reflect.New(rspType).Interface()</pre></code><tr><td>624<td><code><pre> }</pre></code><tr><td>625<td><code><pre></pre></code><tr><td>626<td><code><pre> embedResponse(c, data, err)</pre></code><tr><td>627<td><code><pre></pre></code><tr><td>628<td><code><pre> switch rsp := data.(type) {</pre></code><tr><td>629<td><code><pre> case Response:</pre></code><tr class=miss><td>630<td><code><pre> go metricsCode(r.ctx, r.appName, c.Request.URL.Path, c.Request.Method, r.parseHeaderMetrics(c),</pre></code><tr><td>631<td><code><pre> rsp.Code, c.Writer.Status(), c.Writer.Size(), c.Request.ContentLength)</pre></code><tr><td>632<td><code><pre> case *Response:</pre></code><tr class=miss><td>633<td><code><pre> go metricsCode(r.ctx, r.appName, c.Request.URL.Path, c.Request.Method, r.parseHeaderMetrics(c),</pre></code><tr><td>634<td><code><pre> rsp.Code, c.Writer.Status(), c.Writer.Size(), c.Request.ContentLength)</pre></code><tr><td>635<td><code><pre> default:</pre></code><tr><td>636<td><code><pre> rspData := make(map[string]any)</pre></code><tr><td>637<td><code><pre> dec, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{</pre></code><tr><td>638<td><code><pre> Result: &rspData,</pre></code><tr><td>639<td><code><pre> TagName: "json",</pre></code><tr><td>640<td><code><pre> })</pre></code><tr><td>641<td><code><pre> if err == nil && dec != nil {</pre></code><tr><td>642<td><code><pre> _ = dec.Decode(data)</pre></code><tr><td>643<td><code><pre> }</pre></code><tr><td>644<td><code><pre> var code any</pre></code><tr><td>645<td><code><pre> utils.IfAny(</pre></code><tr><td>646<td><code><pre> func() (ok bool) { code, ok = rspData["code"]; return ok },</pre></code><tr><td>647<td><code><pre> func() (ok bool) { code, ok = rspData["Code"]; return ok },</pre></code><tr><td>648<td><code><pre> )</pre></code><tr><td>649<td><code><pre> if code == nil {</pre></code><tr><td>650<td><code><pre> code = -2</pre></code><tr><td>651<td><code><pre> }</pre></code><tr><td>652<td><code><pre> go metricsCode(r.ctx, r.appName, c.Request.URL.Path, c.Request.Method, r.parseHeaderMetrics(c),</pre></code><tr><td>653<td><code><pre> cast.ToInt(code), c.Writer.Status(), c.Writer.Size(), c.Request.ContentLength)</pre></code><tr><td>654<td><code><pre> }</pre></code><tr><td>655<td><code><pre>}</pre></code></table><div class=funcname id=fn_rspError>func rspError</div><div class=info><a href=#s_fn_rspError>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/response.go</code>:</div><table class=listing><tr><td>93<td><code><pre>func rspError[T constraint.Integer](c *gin.Context, appName string, code T, data any, page, count int, msg string) {</pre></code><tr><td>94<td><code><pre> status := c.Writer.Status()</pre></code><tr><td>95<td><code><pre> if status <= 0 {</pre></code><tr class=miss><td>96<td><code><pre> status = http.StatusBadRequest</pre></code><tr><td>97<td><code><pre> }</pre></code><tr><td>98<td><code><pre></pre></code><tr><td>99<td><code><pre> if msg == "" {</pre></code><tr class=miss><td>100<td><code><pre> msg = Localizable(AppName(appName)).Localize(Errcode(code), i18n.Langs(langs(c)))</pre></code><tr><td>101<td><code><pre> }</pre></code><tr><td>102<td><code><pre> var (</pre></code><tr><td>103<td><code><pre> pagePtr *int</pre></code><tr><td>104<td><code><pre> countPtr *int</pre></code><tr><td>105<td><code><pre> )</pre></code><tr><td>106<td><code><pre> if page > 0 {</pre></code><tr><td>107<td><code><pre> pagePtr = utils.AnyPtr(page)</pre></code><tr><td>108<td><code><pre> }</pre></code><tr><td>109<td><code><pre> if count >= 0 {</pre></code><tr><td>110<td><code><pre> countPtr = utils.AnyPtr(count)</pre></code><tr><td>111<td><code><pre> }</pre></code><tr><td>112<td><code><pre></pre></code><tr><td>113<td><code><pre> c.PureJSON(status, &Response{</pre></code><tr><td>114<td><code><pre> Code: cast.ToInt(code),</pre></code><tr><td>115<td><code><pre> Message: msg,</pre></code><tr><td>116<td><code><pre> Data: data,</pre></code><tr><td>117<td><code><pre> Page: pagePtr,</pre></code><tr><td>118<td><code><pre> Count: countPtr,</pre></code><tr><td>119<td><code><pre> TraceID: c.GetString(fusCtx.KeyTraceID),</pre></code><tr><td>120<td><code><pre> })</pre></code><tr><td>121<td><code><pre>}</pre></code></table><div class=funcname id=fn_@137:9>func @137:9</div><div class=info><a href=#s_fn_@137:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr><td>137<td><code><pre>func() {</pre></code><tr><td>138<td><code><pre> locker.Lock()</pre></code><tr><td>139<td><code><pre> defer locker.Unlock()</pre></code><tr><td>140<td><code><pre> if routers != nil {</pre></code><tr><td>141<td><code><pre> if router, ok := routers[opt.AppName]; ok {</pre></code><tr><td>142<td><code><pre> router.shutdown()</pre></code><tr><td>143<td><code><pre> wg := new(sync.WaitGroup)</pre></code><tr><td>144<td><code><pre> wg.Add(1)</pre></code><tr><td>145<td><code><pre> go func() { defer wg.Done(); <-router.Closing() }()</pre></code><tr><td>146<td><code><pre> if utils.Timeout(15*time.Second, utils.TimeoutWg(wg)) {</pre></code><tr class=miss><td>147<td><code><pre> pid := syscall.Getpid()</pre></code><tr class=miss><td>148<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr class=miss><td>149<td><code><pre> log.Printf("%v [Gofusion] %s %s close http server timeout", pid, app, config.ComponentHttp)</pre></code><tr><td>150<td><code><pre> }</pre></code><tr><td>151<td><code><pre> }</pre></code><tr><td>152<td><code><pre></pre></code><tr><td>153<td><code><pre> delete(routers, opt.AppName)</pre></code><tr><td>154<td><code><pre> }</pre></code><tr><td>155<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>156<td><code><pre> Router = nil</pre></code><tr><td>157<td><code><pre> }</pre></code><tr><td>158<td><code><pre> }</pre></code></table><div class=funcname id=fn_router.use>func router.use</div><div class=info><a href=#s_fn_router.use>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>259<td><code><pre>func (r *router) use() gin.IRoutes {</pre></code><tr><td>260<td><code><pre> switch r.ptr {</pre></code><tr><td>261<td><code><pre> case dispatchIRouter:</pre></code><tr><td>262<td><code><pre> return r.IRouter</pre></code><tr><td>263<td><code><pre> case dispatchGroup:</pre></code><tr><td>264<td><code><pre> return r.group</pre></code><tr><td>265<td><code><pre> case dispatchRoutes:</pre></code><tr><td>266<td><code><pre> return r.routes</pre></code><tr><td>267<td><code><pre> default:</pre></code><tr class=miss><td>268<td><code><pre> return r.IRouter</pre></code><tr><td>269<td><code><pre> }</pre></code><tr><td>270<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.parseReqFromQuery>func router.parseReqFromQuery</div><div class=info><a href=#s_fn_router.parseReqFromQuery>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>500<td><code><pre>func (r *router) parseReqFromQuery(c *gin.Context, typ reflect.Type) (dst reflect.Value, err error) {</pre></code><tr><td>501<td><code><pre> ptrDepth := 0</pre></code><tr><td>502<td><code><pre> for typ.Kind() == reflect.Ptr {</pre></code><tr><td>503<td><code><pre> typ = typ.Elem()</pre></code><tr><td>504<td><code><pre> ptrDepth++</pre></code><tr><td>505<td><code><pre> }</pre></code><tr><td>506<td><code><pre> defer func() {</pre></code><tr><td>507<td><code><pre> for ptrDepth > 0 {</pre></code><tr><td>508<td><code><pre> dst = dst.Addr()</pre></code><tr><td>509<td><code><pre> ptrDepth--</pre></code><tr><td>510<td><code><pre> }</pre></code><tr><td>511<td><code><pre> }()</pre></code><tr><td>512<td><code><pre></pre></code><tr><td>513<td><code><pre> dst = reflect.Indirect(reflect.New(typ))</pre></code><tr><td>514<td><code><pre> if err = c.ShouldBindUri(dst.Addr().Interface()); err != nil &&</pre></code><tr><td>515<td><code><pre> !(errors.Is(err, binding.ErrConvertToMapString) || (errors.Is(err, binding.ErrConvertMapStringSlice))) {</pre></code><tr class=miss><td>516<td><code><pre> err = parseGinBindingValidatorError(err)</pre></code><tr class=miss><td>517<td><code><pre> return</pre></code><tr><td>518<td><code><pre> }</pre></code><tr><td>519<td><code><pre> if err = c.ShouldBindQuery(dst.Addr().Interface()); err != nil &&</pre></code><tr><td>520<td><code><pre> !(errors.Is(err, binding.ErrConvertToMapString) || (errors.Is(err, binding.ErrConvertMapStringSlice))) {</pre></code><tr class=miss><td>521<td><code><pre> err = parseGinBindingValidatorError(err)</pre></code><tr class=miss><td>522<td><code><pre> return</pre></code><tr><td>523<td><code><pre> }</pre></code><tr><td>524<td><code><pre> // support query with json tag</pre></code><tr><td>525<td><code><pre> if dst.IsZero() {</pre></code><tr><td>526<td><code><pre> m := make(map[string][]string)</pre></code><tr><td>527<td><code><pre> for _, v := range c.Params {</pre></code><tr><td>528<td><code><pre> m[v.Key] = []string{v.Value}</pre></code><tr><td>529<td><code><pre> }</pre></code><tr><td>530<td><code><pre> err = utils.CheckIfAny(</pre></code><tr><td>531<td><code><pre> func() error { return parser.MapFormByTag(dst.Addr().Interface(), m, "json") },</pre></code><tr><td>532<td><code><pre> func() error { return parser.MapFormByTag(dst.Addr().Interface(), c.Request.URL.Query(), "json") },</pre></code><tr><td>533<td><code><pre> )</pre></code><tr><td>534<td><code><pre> }</pre></code><tr><td>535<td><code><pre></pre></code><tr><td>536<td><code><pre> // parse default tag</pre></code><tr><td>537<td><code><pre> err = utils.ParseTag(</pre></code><tr><td>538<td><code><pre> dst.Addr().Interface(),</pre></code><tr><td>539<td><code><pre> utils.ParseTagName("default"),</pre></code><tr><td>540<td><code><pre> utils.ParseTagUnmarshalType(utils.UnmarshalTypeYaml),</pre></code><tr><td>541<td><code><pre> )</pre></code><tr><td>542<td><code><pre></pre></code><tr><td>543<td><code><pre> return</pre></code><tr><td>544<td><code><pre>}</pre></code></table><div class=funcname id=fn_parseRspError>func parseRspError</div><div class=info><a href=#s_fn_parseRspError>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>694<td><code><pre>func parseRspError(rspVals []reflect.Value, err error) (code int, data any, page, count int, msg string) {</pre></code><tr><td>695<td><code><pre> switch e := err.(type) {</pre></code><tr><td>696<td><code><pre> case Errcode:</pre></code><tr class=miss><td>697<td><code><pre> code, msg = int(e), e.Error()</pre></code><tr><td>698<td><code><pre> case *bizErr:</pre></code><tr><td>699<td><code><pre> code, msg = int(e.code), e.Error()</pre></code><tr><td>700<td><code><pre> default:</pre></code><tr><td>701<td><code><pre> code, msg = int(errParam), e.Error()</pre></code><tr><td>702<td><code><pre> }</pre></code><tr><td>703<td><code><pre></pre></code><tr><td>704<td><code><pre> data, page, count, retMsg := parseRspSuccess(rspVals)</pre></code><tr><td>705<td><code><pre> if retMsg != "" {</pre></code><tr class=miss><td>706<td><code><pre> msg = retMsg</pre></code><tr><td>707<td><code><pre> }</pre></code><tr><td>708<td><code><pre></pre></code><tr><td>709<td><code><pre> return</pre></code><tr><td>710<td><code><pre>}</pre></code></table><div class=funcname id=fn_initAsynq>func initAsynq</div><div class=info><a href=#s_fn_initAsynq>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/asynq.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func initAsynq(ctx context.Context, appName string, r IRouter, confs []asynqConf) {</pre></code><tr><td>16<td><code><pre> if len(confs) == 0 || r == nil {</pre></code><tr class=miss><td>17<td><code><pre> return</pre></code><tr><td>18<td><code><pre> }</pre></code><tr><td>19<td><code><pre></pre></code><tr><td>20<td><code><pre> for _, conf := range confs {</pre></code><tr><td>21<td><code><pre> switch conf.InstanceType {</pre></code><tr><td>22<td><code><pre> case instanceTypeRedis:</pre></code><tr><td>23<td><code><pre> default:</pre></code><tr class=miss><td>24<td><code><pre> panic(errors.Errorf("unknown asynq instance type: %+v", conf.InstanceType))</pre></code><tr><td>25<td><code><pre> }</pre></code><tr><td>26<td><code><pre> connOpt := &asynqRedisConnOpt{UniversalClient: redis.Use(ctx, conf.Instance, redis.AppName(appName))}</pre></code><tr><td>27<td><code><pre> h := asynqmon.New(asynqmon.Options{</pre></code><tr><td>28<td><code><pre> RootPath: conf.Path,</pre></code><tr><td>29<td><code><pre> RedisConnOpt: connOpt,</pre></code><tr><td>30<td><code><pre> PayloadFormatter: nil,</pre></code><tr><td>31<td><code><pre> ResultFormatter: nil,</pre></code><tr><td>32<td><code><pre> PrometheusAddress: conf.PrometheusAddress,</pre></code><tr><td>33<td><code><pre> ReadOnly: conf.Readonly,</pre></code><tr><td>34<td><code><pre> })</pre></code><tr><td>35<td><code><pre></pre></code><tr><td>36<td><code><pre> r.Any(h.RootPath()+"/*any", gin.WrapH(h))</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre>}</pre></code></table><div class=funcname id=fn_lookupFieldByValue>func lookupFieldByValue</div><div class=info><a href=#s_fn_lookupFieldByValue>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>769<td><code><pre>func lookupFieldByValue(v reflect.Value, keywords map[string]bool) (reflect.Value, bool) {</pre></code><tr><td>770<td><code><pre> f := reflect.Indirect(v.FieldByNameFunc(func(s string) bool { return keywords[s] }))</pre></code><tr><td>771<td><code><pre> if !f.IsValid() || f.IsZero() {</pre></code><tr class=miss><td>772<td><code><pre> return reflect.Value{}, false</pre></code><tr><td>773<td><code><pre> }</pre></code><tr><td>774<td><code><pre> return reflect.Indirect(f), true</pre></code><tr><td>775<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.parseHeaderMetrics>func router.parseHeaderMetrics</div><div class=info><a href=#s_fn_router.parseHeaderMetrics>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>657<td><code><pre>func (r *router) parseHeaderMetrics(c *gin.Context) (headerLabels map[string]string) {</pre></code><tr><td>658<td><code><pre> headerLabels = make(map[string]string, len(r.metricsConf.HeaderLabels))</pre></code><tr><td>659<td><code><pre> for _, metricsHeader := range r.metricsConf.HeaderLabels {</pre></code><tr class=miss><td>660<td><code><pre> headerLabels[metricsHeader] = c.Request.Header.Get(metricsHeader)</pre></code><tr><td>661<td><code><pre> }</pre></code><tr><td>662<td><code><pre> return</pre></code><tr><td>663<td><code><pre>}</pre></code></table><div class=funcname id=fn_parseGinBindingValidatorError>func parseGinBindingValidatorError</div><div class=info><a href=#s_fn_parseGinBindingValidatorError>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/i18n.go</code>:</div><table class=listing><tr><td>70<td><code><pre>func parseGinBindingValidatorError(src error) (dst error) {</pre></code><tr><td>71<td><code><pre> e, ok := src.(validator.ValidationErrors)</pre></code><tr><td>72<td><code><pre> if !ok || ginBindingI18nTranslator == nil {</pre></code><tr class=miss><td>73<td><code><pre> return src</pre></code><tr><td>74<td><code><pre> }</pre></code><tr><td>75<td><code><pre> return errors.New(strings.Join(utils.MapValues(e.Translate(ginBindingI18nTranslator)), constant.LineBreak))</pre></code><tr><td>76<td><code><pre>}</pre></code></table><div class=funcname id=fn_@32:21>func @32:21</div><div class=info><a href=#s_fn_@32:21>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/metrics.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func() {</pre></code><tr><td>33<td><code><pre> app := config.Use(appName).AppName()</pre></code><tr><td>34<td><code><pre> labels := []metrics.Label{</pre></code><tr><td>35<td><code><pre> {Key: "path", Value: path},</pre></code><tr><td>36<td><code><pre> {Key: "method", Value: method},</pre></code><tr><td>37<td><code><pre> {Key: "code", Value: cast.ToString(code)},</pre></code><tr><td>38<td><code><pre> {Key: "status", Value: cast.ToString(status)},</pre></code><tr><td>39<td><code><pre> {Key: "req_size", Value: cast.ToString(reqSize)},</pre></code><tr><td>40<td><code><pre> {Key: "rsp_size", Value: cast.ToString(rspSize)},</pre></code><tr><td>41<td><code><pre> }</pre></code><tr><td>42<td><code><pre> for k, v := range headerLabels {</pre></code><tr class=miss><td>43<td><code><pre> labels = append(labels, metrics.Label{Key: strcase.ToSnake(k), Value: v})</pre></code><tr><td>44<td><code><pre> }</pre></code><tr><td>45<td><code><pre></pre></code><tr><td>46<td><code><pre> totalKey := append([]string{app}, metricsCodeTotalKey...)</pre></code><tr><td>47<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr><td>48<td><code><pre> select {</pre></code><tr><td>49<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>50<td><code><pre> return</pre></code><tr><td>51<td><code><pre> default:</pre></code><tr><td>52<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr><td>53<td><code><pre> m.IncrCounter(ctx, totalKey, 1, metrics.Labels(labels))</pre></code><tr><td>54<td><code><pre> } else {</pre></code><tr class=miss><td>55<td><code><pre> m.IncrCounter(ctx, metricsCodeTotalKey, 1, metrics.Labels(labels))</pre></code><tr><td>56<td><code><pre> }</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre> }</pre></code></table><div class=funcname id=fn_router.convertMulti>func router.convertMulti</div><div class=info><a href=#s_fn_router.convertMulti>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>346<td><code><pre>func (r *router) convertMulti(method, uri string, hdr routerHandler, opt *routerOption) (result gin.HandlersChain) {</pre></code><tr><td>347<td><code><pre> result = make(gin.HandlersChain, 0, len(opt.beforeHandlers)+len(opt.aftersHandlers)+1)</pre></code><tr><td>348<td><code><pre> for _, hdr := range opt.beforeHandlers {</pre></code><tr class=miss><td>349<td><code><pre> result = append(result, r.convert(method, uri, hdr, opt))</pre></code><tr><td>350<td><code><pre> }</pre></code><tr><td>351<td><code><pre> result = append(result, r.convert(method, uri, hdr, opt))</pre></code><tr><td>352<td><code><pre> for _, hdr := range opt.aftersHandlers {</pre></code><tr class=miss><td>353<td><code><pre> result = append(result, r.convert(method, uri, hdr, opt))</pre></code><tr><td>354<td><code><pre> }</pre></code><tr><td>355<td><code><pre> return</pre></code><tr><td>356<td><code><pre>}</pre></code></table><div class=funcname id=fn_traceHeaderMiddleware>func traceHeaderMiddleware</div><div class=info><a href=#s_fn_traceHeaderMiddleware>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/client.go</code>:</div><table class=listing><tr><td>134<td><code><pre>func traceHeaderMiddleware(cli *resty.Client, req *resty.Request) (err error) {</pre></code><tr><td>135<td><code><pre> ctx := req.Context()</pre></code><tr><td>136<td><code><pre> if userID := fusCtx.GetUserID(ctx); utils.IsStrNotBlank(userID) {</pre></code><tr class=miss><td>137<td><code><pre> req.SetHeader("User-ID", userID)</pre></code><tr><td>138<td><code><pre> }</pre></code><tr><td>139<td><code><pre> if traceID := fusCtx.GetTraceID(ctx); utils.IsStrNotBlank(traceID) {</pre></code><tr class=miss><td>140<td><code><pre> req.SetHeader("Trace-ID", traceID)</pre></code><tr><td>141<td><code><pre> }</pre></code><tr><td>142<td><code><pre> return</pre></code><tr><td>143<td><code><pre>}</pre></code></table><div class=funcname id=fn_bizErr.Error>func bizErr.Error</div><div class=info><a href=#s_fn_bizErr.Error>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/error.go</code>:</div><table class=listing><tr><td>83<td><code><pre>func (b *bizErr) Error() (r string) {</pre></code><tr><td>84<td><code><pre> if b.msg != "" {</pre></code><tr class=miss><td>85<td><code><pre> return b.msg</pre></code><tr><td>86<td><code><pre> }</pre></code><tr><td>87<td><code><pre> return I18n.Localize(b.code, i18n.Langs(b.langs), i18n.Param(b.param))</pre></code><tr><td>88<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.checkHandlerType>func router.checkHandlerType</div><div class=info><a href=#s_fn_router.checkHandlerType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>358<td><code><pre>func (r *router) checkHandlerType(method, uri string, typ reflect.Type) (err error) {</pre></code><tr><td>359<td><code><pre> if typ.Kind() != reflect.Func {</pre></code><tr class=miss><td>360<td><code><pre> return errors.Errorf("router handler should be a function [method[%s] uri[%s]]", method, uri)</pre></code><tr><td>361<td><code><pre> }</pre></code><tr><td>362<td><code><pre></pre></code><tr><td>363<td><code><pre> // check in</pre></code><tr><td>364<td><code><pre> if typ.NumIn() < 1 {</pre></code><tr class=miss><td>365<td><code><pre> return errors.Errorf("router handler should have at least 1 parameter in "+</pre></code><tr><td>366<td><code><pre> "[method[%s] uri[%s]]", method, uri)</pre></code><tr><td>367<td><code><pre> }</pre></code><tr><td>368<td><code><pre> if typ.NumIn() > 2 {</pre></code><tr class=miss><td>369<td><code><pre> return errors.Errorf("router handler should not have more than 2 parameters in "+</pre></code><tr><td>370<td><code><pre> "[method[%s] uri[%s]]", method, uri)</pre></code><tr><td>371<td><code><pre> }</pre></code><tr><td>372<td><code><pre> if typ.In(0) != constant.GinContextType {</pre></code><tr class=miss><td>373<td><code><pre> return errors.Errorf("router handler first parameter in should be *gin.Context "+</pre></code><tr><td>374<td><code><pre> "[method[%s] uri[%s]]", method, uri)</pre></code><tr><td>375<td><code><pre> }</pre></code><tr><td>376<td><code><pre> if typ.NumIn() == 2 {</pre></code><tr><td>377<td><code><pre> if !r.checkParamType(typ.In(1), supportParamType) {</pre></code><tr class=miss><td>378<td><code><pre> return errors.Errorf("router handler second parameter in type not supportted "+</pre></code><tr><td>379<td><code><pre> "[method[%s] uri[%s]]", method, uri)</pre></code><tr><td>380<td><code><pre> }</pre></code><tr><td>381<td><code><pre> }</pre></code><tr><td>382<td><code><pre></pre></code><tr><td>383<td><code><pre> // check out</pre></code><tr><td>384<td><code><pre></pre></code><tr><td>385<td><code><pre> // check error</pre></code><tr><td>386<td><code><pre> if typ.NumOut() > 0 && !typ.Out(typ.NumOut()-1).AssignableTo(constant.ErrorType) {</pre></code><tr class=miss><td>387<td><code><pre> return errors.Errorf("router handler last paramater out should be error type "+</pre></code><tr><td>388<td><code><pre> "[method[%s] uri[%s]]", method, uri)</pre></code><tr><td>389<td><code><pre> }</pre></code><tr><td>390<td><code><pre></pre></code><tr><td>391<td><code><pre> // check (data any, page, count int, msg string, err error)</pre></code><tr><td>392<td><code><pre> if numOut := typ.NumOut(); numOut > 1 {</pre></code><tr><td>393<td><code><pre> supportTypes := supportReturnTypeList[numOut-1]</pre></code><tr><td>394<td><code><pre> for i := 0; i < numOut-1; i++ {</pre></code><tr><td>395<td><code><pre> if !r.checkParamType(typ.Out(i), supportTypes[i]) {</pre></code><tr class=miss><td>396<td><code><pre> return errors.Errorf("router handler paramater out format is illegal "+</pre></code><tr><td>397<td><code><pre> "[method[%s] uri[%s] index[%v] unsupported[%s] suppoted[%+v]]",</pre></code><tr><td>398<td><code><pre> method, uri, i+1, typ.Out(i).Kind(), supportTypes[i])</pre></code><tr><td>399<td><code><pre> }</pre></code><tr><td>400<td><code><pre> }</pre></code><tr><td>401<td><code><pre> }</pre></code><tr><td>402<td><code><pre></pre></code><tr><td>403<td><code><pre> return</pre></code><tr><td>404<td><code><pre>}</pre></code></table><div class=funcname id=fn_ginZeroCopyWriter.ReadFrom>func ginZeroCopyWriter.ReadFrom</div><div class=info><a href=#s_fn_ginZeroCopyWriter.ReadFrom>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/zerocopy.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func (z *ginZeroCopyWriter) ReadFrom(r io.Reader) (n int64, err error) {</pre></code><tr><td>50<td><code><pre> var size int64</pre></code><tr><td>51<td><code><pre> if limitedReader, ok := r.(*io.LimitedReader); ok {</pre></code><tr><td>52<td><code><pre> size = limitedReader.N</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre></pre></code><tr><td>55<td><code><pre> // forces to write the http header (status code + headers)</pre></code><tr><td>56<td><code><pre> z.ResponseWriter.WriteHeaderNow()</pre></code><tr><td>57<td><code><pre> if z.ctx.Request.Method == http.MethodHead {</pre></code><tr class=miss><td>58<td><code><pre> return size, nil</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre></pre></code><tr><td>61<td><code><pre> // hijack conn to call zero copy</pre></code><tr><td>62<td><code><pre> var conn net.Conn</pre></code><tr><td>63<td><code><pre> _, err = utils.Catch(func() (err error) { conn, _, err = z.ResponseWriter.Hijack(); return })</pre></code><tr><td>64<td><code><pre> if err != nil || conn == nil {</pre></code><tr><td>65<td><code><pre> // write by memory buffer</pre></code><tr><td>66<td><code><pre> if size > 0 {</pre></code><tr><td>67<td><code><pre> return io.CopyN(z.ResponseWriter, r.(*io.LimitedReader), size)</pre></code><tr><td>68<td><code><pre> }</pre></code><tr class=miss><td>69<td><code><pre> return io.Copy(z.ResponseWriter, r)</pre></code><tr><td>70<td><code><pre> }</pre></code><tr class=miss><td>71<td><code><pre> defer func() {</pre></code><tr><td>72<td><code><pre> if closeErr := conn.Close(); closeErr != nil {</pre></code><tr><td>73<td><code><pre> err = multierr.Append(err, closeErr)</pre></code><tr><td>74<td><code><pre> }</pre></code><tr><td>75<td><code><pre> }()</pre></code><tr><td>76<td><code><pre></pre></code><tr><td>77<td><code><pre> // set write timeout again because it is reset when hijack</pre></code><tr class=miss><td>78<td><code><pre> if err = conn.SetWriteDeadline(time.Now().Add(gracefully.DefaultWriteTimeOut)); err != nil {</pre></code><tr class=miss><td>79<td><code><pre> return</pre></code><tr><td>80<td><code><pre> }</pre></code><tr><td>81<td><code><pre></pre></code><tr><td>82<td><code><pre> // write body</pre></code><tr class=miss><td>83<td><code><pre> return io.Copy(conn, r)</pre></code><tr><td>84<td><code><pre>}</pre></code></table><div class=funcname id=fn_langs>func langs</div><div class=info><a href=#s_fn_langs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/response.go</code>:</div><table class=listing><tr><td>136<td><code><pre>func langs(c *gin.Context) (langs []string) {</pre></code><tr><td>137<td><code><pre> if c == nil {</pre></code><tr class=miss><td>138<td><code><pre> return</pre></code><tr><td>139<td><code><pre> }</pre></code><tr><td>140<td><code><pre> langs = c.Request.Header.Values("Accept-Language")</pre></code><tr><td>141<td><code><pre> if lang := c.GetString("lang"); utils.IsStrNotBlank(lang) {</pre></code><tr class=miss><td>142<td><code><pre> langs = append(langs, lang)</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre> if lang := c.GetString(fusCtx.KeyLangs); utils.IsStrNotBlank(lang) {</pre></code><tr class=miss><td>145<td><code><pre> langs = append(langs, lang)</pre></code><tr><td>146<td><code><pre> }</pre></code><tr><td>147<td><code><pre> return langs</pre></code><tr><td>148<td><code><pre>}</pre></code></table><div class=funcname id=fn_@44:24>func @44:24</div><div class=info><a href=#s_fn_@44:24>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/i18n.go</code>:</div><table class=listing><tr><td>44<td><code><pre>func() {</pre></code><tr><td>45<td><code><pre> var ok bool</pre></code><tr><td>46<td><code><pre> engine, ok := binding.Validator.Engine().(*validator.Validate)</pre></code><tr><td>47<td><code><pre> if !ok {</pre></code><tr class=miss><td>48<td><code><pre> return</pre></code><tr><td>49<td><code><pre> }</pre></code><tr><td>50<td><code><pre></pre></code><tr><td>51<td><code><pre> enLocales := en.New()</pre></code><tr><td>52<td><code><pre> zhLocales := zh.New()</pre></code><tr><td>53<td><code><pre> switch lang := i18n.DefaultLang(i18n.AppName(appName)); lang {</pre></code><tr><td>54<td><code><pre> case language.English:</pre></code><tr class=miss><td>55<td><code><pre> ginBindingI18nTranslator, ok = ut.New(enLocales, zhLocales, enLocales).GetTranslator(lang.String())</pre></code><tr class=miss><td>56<td><code><pre> if !ok {</pre></code><tr class=miss><td>57<td><code><pre> return</pre></code><tr><td>58<td><code><pre> }</pre></code><tr class=miss><td>59<td><code><pre> utils.MustSuccess(enT.RegisterDefaultTranslations(engine, ginBindingI18nTranslator))</pre></code><tr><td>60<td><code><pre> default:</pre></code><tr><td>61<td><code><pre> ginBindingI18nTranslator, ok = ut.New(zhLocales, zhLocales, enLocales).GetTranslator(lang.String())</pre></code><tr><td>62<td><code><pre> if !ok {</pre></code><tr class=miss><td>63<td><code><pre> return</pre></code><tr><td>64<td><code><pre> }</pre></code><tr><td>65<td><code><pre> utils.MustSuccess(zhT.RegisterDefaultTranslations(engine, ginBindingI18nTranslator))</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre> }</pre></code></table><div class=funcname id=fn_metricsCode>func metricsCode</div><div class=info><a href=#s_fn_metricsCode>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/metrics.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func metricsCode(ctx context.Context, appName, path, method string, headerLabels map[string]string,</pre></code><tr><td>20<td><code><pre> code, status, rspSize int, reqSize int64) {</pre></code><tr><td>21<td><code><pre> select {</pre></code><tr><td>22<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>23<td><code><pre> return</pre></code><tr><td>24<td><code><pre> default:</pre></code><tr><td>25<td><code><pre> }</pre></code><tr><td>26<td><code><pre></pre></code><tr><td>27<td><code><pre> // skip health check logging</pre></code><tr><td>28<td><code><pre> if path == "/health" && method == http.MethodGet {</pre></code><tr class=miss><td>29<td><code><pre> return</pre></code><tr><td>30<td><code><pre> }</pre></code><tr><td>31<td><code><pre></pre></code><tr><td>32<td><code><pre> _, _ = utils.Catch(func() {</pre></code><tr><td>33<td><code><pre> app := config.Use(appName).AppName()</pre></code><tr><td>34<td><code><pre> labels := []metrics.Label{</pre></code><tr><td>35<td><code><pre> {Key: "path", Value: path},</pre></code><tr><td>36<td><code><pre> {Key: "method", Value: method},</pre></code><tr><td>37<td><code><pre> {Key: "code", Value: cast.ToString(code)},</pre></code><tr><td>38<td><code><pre> {Key: "status", Value: cast.ToString(status)},</pre></code><tr><td>39<td><code><pre> {Key: "req_size", Value: cast.ToString(reqSize)},</pre></code><tr><td>40<td><code><pre> {Key: "rsp_size", Value: cast.ToString(rspSize)},</pre></code><tr><td>41<td><code><pre> }</pre></code><tr><td>42<td><code><pre> for k, v := range headerLabels {</pre></code><tr><td>43<td><code><pre> labels = append(labels, metrics.Label{Key: strcase.ToSnake(k), Value: v})</pre></code><tr><td>44<td><code><pre> }</pre></code><tr><td>45<td><code><pre></pre></code><tr><td>46<td><code><pre> totalKey := append([]string{app}, metricsCodeTotalKey...)</pre></code><tr><td>47<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr><td>48<td><code><pre> select {</pre></code><tr><td>49<td><code><pre> case <-ctx.Done():</pre></code><tr><td>50<td><code><pre> return</pre></code><tr><td>51<td><code><pre> default:</pre></code><tr><td>52<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr><td>53<td><code><pre> m.IncrCounter(ctx, totalKey, 1, metrics.Labels(labels))</pre></code><tr><td>54<td><code><pre> } else {</pre></code><tr><td>55<td><code><pre> m.IncrCounter(ctx, metricsCodeTotalKey, 1, metrics.Labels(labels))</pre></code><tr><td>56<td><code><pre> }</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre> })</pre></code><tr><td>60<td><code><pre>}</pre></code></table><div class=funcname id=fn_parseRspSuccess>func parseRspSuccess</div><div class=info><a href=#s_fn_parseRspSuccess>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>672<td><code><pre>func parseRspSuccess(rspVals []reflect.Value) (data any, page, count int, msg string) {</pre></code><tr><td>673<td><code><pre> switch {</pre></code><tr><td>674<td><code><pre> case len(rspVals) == 0:</pre></code><tr><td>675<td><code><pre> case len(rspVals) == 2:</pre></code><tr class=miss><td>676<td><code><pre> data = transformData(rspVals[0])</pre></code><tr class=miss><td>677<td><code><pre> msg = reflect.Indirect(rspVals[1]).String()</pre></code><tr><td>678<td><code><pre> case len(rspVals) == 3:</pre></code><tr class=miss><td>679<td><code><pre> data = transformData(rspVals[0])</pre></code><tr class=miss><td>680<td><code><pre> count = cast.ToInt(reflect.Indirect(rspVals[1]).Int())</pre></code><tr class=miss><td>681<td><code><pre> msg = reflect.Indirect(rspVals[2]).String()</pre></code><tr><td>682<td><code><pre> case len(rspVals) > 3:</pre></code><tr><td>683<td><code><pre> data = transformData(rspVals[0])</pre></code><tr><td>684<td><code><pre> page = cast.ToInt(reflect.Indirect(rspVals[1]).Int())</pre></code><tr><td>685<td><code><pre> count = cast.ToInt(reflect.Indirect(rspVals[2]).Int())</pre></code><tr><td>686<td><code><pre> msg = reflect.Indirect(rspVals[3]).String()</pre></code><tr><td>687<td><code><pre> default:</pre></code><tr><td>688<td><code><pre> data, page, count, msg = lookupFieldByStruct(rspVals[0])</pre></code><tr><td>689<td><code><pre> }</pre></code><tr><td>690<td><code><pre></pre></code><tr><td>691<td><code><pre> return</pre></code><tr><td>692<td><code><pre>}</pre></code></table><div class=funcname id=fn_transformData>func transformData</div><div class=info><a href=#s_fn_transformData>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>791<td><code><pre>func transformData(data reflect.Value) (transformed any) {</pre></code><tr><td>792<td><code><pre> if !data.IsValid() {</pre></code><tr class=miss><td>793<td><code><pre> return</pre></code><tr><td>794<td><code><pre> }</pre></code><tr><td>795<td><code><pre></pre></code><tr><td>796<td><code><pre> // some structs return as an interface</pre></code><tr><td>797<td><code><pre> if data.Kind() == reflect.Interface {</pre></code><tr class=miss><td>798<td><code><pre> data = reflect.ValueOf(data.Interface())</pre></code><tr><td>799<td><code><pre> }</pre></code><tr><td>800<td><code><pre> if data = utils.IndirectValue(data); !data.IsValid() {</pre></code><tr class=miss><td>801<td><code><pre> return</pre></code><tr><td>802<td><code><pre> }</pre></code><tr><td>803<td><code><pre></pre></code><tr><td>804<td><code><pre> return data.Interface()</pre></code><tr><td>805<td><code><pre>}</pre></code></table><div class=funcname id=fn_@30:9>func @30:9</div><div class=info><a href=#s_fn_@30:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/zerocopy.go</code>:</div><table class=listing><tr><td>30<td><code><pre>func(c *gin.Context) {</pre></code><tr><td>31<td><code><pre> name, modTime, content, err := fn(c)</pre></code><tr><td>32<td><code><pre> if err != nil {</pre></code><tr class=miss><td>33<td><code><pre> code, data, page, count, msg := parseRspError(nil, err)</pre></code><tr class=miss><td>34<td><code><pre> rspError(c, opt.appName, code, data, page, count, msg)</pre></code><tr class=miss><td>35<td><code><pre> c.Abort()</pre></code><tr class=miss><td>36<td><code><pre> return</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre> defer utils.CloseAnyway(content)</pre></code><tr><td>39<td><code><pre> http.ServeContent(&ginZeroCopyWriter{ResponseWriter: c.Writer, ctx: c}, c.Request, name, modTime, content)</pre></code><tr><td>40<td><code><pre> }</pre></code></table><div class=funcname id=fn_embedResponse>func embedResponse</div><div class=info><a href=#s_fn_embedResponse>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/response.go</code>:</div><table class=listing><tr><td>123<td><code><pre>func embedResponse(c *gin.Context, data any, err error) {</pre></code><tr><td>124<td><code><pre> status := c.Writer.Status()</pre></code><tr><td>125<td><code><pre> if status == 0 {</pre></code><tr class=miss><td>126<td><code><pre> if err != nil {</pre></code><tr class=miss><td>127<td><code><pre> status = http.StatusOK</pre></code><tr><td>128<td><code><pre> } else {</pre></code><tr class=miss><td>129<td><code><pre> status = http.StatusBadRequest</pre></code><tr><td>130<td><code><pre> }</pre></code><tr><td>131<td><code><pre> }</pre></code><tr><td>132<td><code><pre></pre></code><tr><td>133<td><code><pre> c.PureJSON(status, data)</pre></code><tr><td>134<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.useIRouter>func router.useIRouter</div><div class=info><a href=#s_fn_router.useIRouter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>272<td><code><pre>func (r *router) useIRouter() gin.IRouter {</pre></code><tr><td>273<td><code><pre> switch r.ptr {</pre></code><tr><td>274<td><code><pre> case dispatchIRouter:</pre></code><tr><td>275<td><code><pre> return r.IRouter</pre></code><tr><td>276<td><code><pre> case dispatchGroup:</pre></code><tr class=miss><td>277<td><code><pre> return r.group</pre></code><tr><td>278<td><code><pre> case dispatchRoutes:</pre></code><tr class=miss><td>279<td><code><pre> panic(errors.New("group method unsupported for gin.Routes interface"))</pre></code><tr><td>280<td><code><pre> default:</pre></code><tr class=miss><td>281<td><code><pre> return r.IRouter</pre></code><tr><td>282<td><code><pre> }</pre></code><tr><td>283<td><code><pre>}</pre></code></table><div class=funcname id=fn_applyClientOptions>func applyClientOptions</div><div class=info><a href=#s_fn_applyClientOptions>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/client.go</code>:</div><table class=listing><tr><td>145<td><code><pre>func applyClientOptions(src *resty.Client, opt *clientOption) (dst *resty.Client) {</pre></code><tr><td>146<td><code><pre>RetryConditionLoop:</pre></code><tr><td>147<td><code><pre> for _, cond := range opt.retryConditions {</pre></code><tr class=miss><td>148<td><code><pre> condName := utils.GetFuncName(cond)</pre></code><tr class=miss><td>149<td><code><pre> for _, exist := range src.RetryConditions {</pre></code><tr class=miss><td>150<td><code><pre> if condName == utils.GetFuncName(exist) {</pre></code><tr class=miss><td>151<td><code><pre> break RetryConditionLoop</pre></code><tr><td>152<td><code><pre> }</pre></code><tr><td>153<td><code><pre> }</pre></code><tr class=miss><td>154<td><code><pre> src.AddRetryCondition(cond)</pre></code><tr><td>155<td><code><pre> }</pre></code><tr><td>156<td><code><pre></pre></code><tr><td>157<td><code><pre>RetryHookLoop:</pre></code><tr><td>158<td><code><pre> for _, hook := range opt.retryHooks {</pre></code><tr class=miss><td>159<td><code><pre> condName := utils.GetFuncName(hook)</pre></code><tr class=miss><td>160<td><code><pre> for _, exist := range src.RetryHooks {</pre></code><tr class=miss><td>161<td><code><pre> if condName == utils.GetFuncName(exist) {</pre></code><tr class=miss><td>162<td><code><pre> break RetryHookLoop</pre></code><tr><td>163<td><code><pre> }</pre></code><tr><td>164<td><code><pre> }</pre></code><tr class=miss><td>165<td><code><pre> src.AddRetryHook(hook)</pre></code><tr><td>166<td><code><pre> }</pre></code><tr><td>167<td><code><pre></pre></code><tr><td>168<td><code><pre> return src</pre></code><tr><td>169<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.ListenAndServe>func router.ListenAndServe</div><div class=info><a href=#s_fn_router.ListenAndServe>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>175<td><code><pre>func (r *router) ListenAndServe() (err error) {</pre></code><tr class=miss><td>176<td><code><pre> if _, ok := utils.IsChannelClosed(r.open); ok {</pre></code><tr class=miss><td>177<td><code><pre> <-r.Closing()</pre></code><tr class=miss><td>178<td><code><pre> return</pre></code><tr><td>179<td><code><pre> }</pre></code><tr><td>180<td><code><pre></pre></code><tr class=miss><td>181<td><code><pre> conf := r.Config()</pre></code><tr class=miss><td>182<td><code><pre> gracefully.DefaultReadTimeOut = conf.ReadTimeout</pre></code><tr class=miss><td>183<td><code><pre> gracefully.DefaultWriteTimeOut = conf.WriteTimeout</pre></code><tr class=miss><td>184<td><code><pre> gracefully.DefaultMaxHeaderBytes = 1 << 20 // use http.DefaultMaxHeaderBytes - which currently is 1 << 20 (1MB)</pre></code><tr><td>185<td><code><pre></pre></code><tr class=miss><td>186<td><code><pre> port := fmt.Sprintf(":%v", conf.Port)</pre></code><tr class=miss><td>187<td><code><pre> srv := gracefully.NewServer(r.appName, r.IRouter.(*gin.Engine), port, conf.NextProtos)</pre></code><tr class=miss><td>188<td><code><pre> r.shutdownFunc = srv.Shutdown</pre></code><tr><td>189<td><code><pre></pre></code><tr class=miss><td>190<td><code><pre> r.close = make(chan struct{})</pre></code><tr class=miss><td>191<td><code><pre> close(r.open)</pre></code><tr class=miss><td>192<td><code><pre> defer func() {</pre></code><tr><td>193<td><code><pre> close(r.close)</pre></code><tr><td>194<td><code><pre> r.open = make(chan struct{})</pre></code><tr><td>195<td><code><pre> }()</pre></code><tr><td>196<td><code><pre></pre></code><tr class=miss><td>197<td><code><pre> if conf.TLS {</pre></code><tr class=miss><td>198<td><code><pre> return srv.ListenAndServeTLS(conf.Cert, conf.Key)</pre></code><tr><td>199<td><code><pre> } else {</pre></code><tr class=miss><td>200<td><code><pre> return srv.ListenAndServe()</pre></code><tr><td>201<td><code><pre> }</pre></code><tr><td>202<td><code><pre>}</pre></code></table><div class=funcname id=fn_RspError>func RspError</div><div class=info><a href=#s_fn_RspError>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/response.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func RspError(c *gin.Context, data any, page, count int, msg string, err error, opts ...utils.OptionExtender) {</pre></code><tr class=miss><td>39<td><code><pre> var code int</pre></code><tr class=miss><td>40<td><code><pre> switch e := err.(type) {</pre></code><tr><td>41<td><code><pre> case Errcode:</pre></code><tr class=miss><td>42<td><code><pre> code, msg = int(e), e.Error()</pre></code><tr><td>43<td><code><pre> case *bizErr:</pre></code><tr class=miss><td>44<td><code><pre> code, msg = int(e.code), e.Error()</pre></code><tr><td>45<td><code><pre> default:</pre></code><tr class=miss><td>46<td><code><pre> code, msg = int(errParam), e.Error()</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre></pre></code><tr class=miss><td>49<td><code><pre> r, _ := Use(opts...).(*router)</pre></code><tr class=miss><td>50<td><code><pre> rspError(c, r.appName, code, data, page, count, msg)</pre></code><tr><td>51<td><code><pre></pre></code><tr class=miss><td>52<td><code><pre> go metricsCode(r.ctx, r.appName, c.Request.URL.Path, c.Request.Method, r.parseHeaderMetrics(c),</pre></code><tr><td>53<td><code><pre> cast.ToInt(code), c.Writer.Status(), c.Writer.Size(), c.Request.ContentLength)</pre></code><tr><td>54<td><code><pre>}</pre></code></table><div class=funcname id=fn_Localizable>func Localizable</div><div class=info><a href=#s_fn_Localizable>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/i18n.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func Localizable(opts ...utils.OptionExtender) i18n.Localizable[Errcode] {</pre></code><tr class=miss><td>32<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>33<td><code><pre></pre></code><tr class=miss><td>34<td><code><pre> locker.RLock()</pre></code><tr class=miss><td>35<td><code><pre> defer locker.RUnlock()</pre></code><tr class=miss><td>36<td><code><pre> i, ok := i18ns[opt.appName]</pre></code><tr class=miss><td>37<td><code><pre> if !ok {</pre></code><tr class=miss><td>38<td><code><pre> panic(errors.Errorf("http i18n not founc: %s", opt.appName))</pre></code><tr><td>39<td><code><pre> }</pre></code><tr class=miss><td>40<td><code><pre> return i</pre></code><tr><td>41<td><code><pre>}</pre></code></table><div class=funcname id=fn_@96:18>func @96:18</div><div class=info><a href=#s_fn_@96:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr><td>96<td><code><pre>func(c *gin.Context) {</pre></code><tr class=miss><td>97<td><code><pre> c.Status(http.StatusMethodNotAllowed)</pre></code><tr class=miss><td>98<td><code><pre> msg := fmt.Sprintf("找不到该方法, Method: %s", c.Request.Method)</pre></code><tr class=miss><td>99<td><code><pre> if tag != language.Chinese {</pre></code><tr class=miss><td>100<td><code><pre> msg = fmt.Sprintf("Cannot find method: %s", c.Request.Method)</pre></code><tr><td>101<td><code><pre> }</pre></code><tr><td>102<td><code><pre></pre></code><tr class=miss><td>103<td><code><pre> rspError(c, opt.AppName, Errcode(conf.ErrorCode), nil, 0, 0, msg)</pre></code><tr><td>104<td><code><pre> }</pre></code></table><div class=funcname id=fn_@105:17>func @105:17</div><div class=info><a href=#s_fn_@105:17>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr><td>105<td><code><pre>func(c *gin.Context) {</pre></code><tr class=miss><td>106<td><code><pre> c.Status(http.StatusNotFound)</pre></code><tr class=miss><td>107<td><code><pre> msg := fmt.Sprintf("找不到该内容, URL: %s", c.Request.URL.String())</pre></code><tr class=miss><td>108<td><code><pre> if tag != language.Chinese {</pre></code><tr class=miss><td>109<td><code><pre> msg = fmt.Sprintf("Cannot find URL content: %s", c.Request.URL.String())</pre></code><tr><td>110<td><code><pre> }</pre></code><tr class=miss><td>111<td><code><pre> rspError(c, opt.AppName, Errcode(conf.ErrorCode), nil, 0, 0, msg)</pre></code><tr><td>112<td><code><pre> }</pre></code></table><div class=funcname id=fn_ErrCtx>func ErrCtx</div><div class=info><a href=#s_fn_ErrCtx>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/error.go</code>:</div><table class=listing><tr><td>67<td><code><pre>func ErrCtx(ctx context.Context, code Errcode, opts ...utils.OptionExtender) error {</pre></code><tr class=miss><td>68<td><code><pre> opt := utils.ApplyOptions[errOption](opts...)</pre></code><tr class=miss><td>69<td><code><pre> if len(opt.langs) == 0 {</pre></code><tr class=miss><td>70<td><code><pre> opt.langs = fusCtx.GetLangs(ctx)</pre></code><tr><td>71<td><code><pre> }</pre></code><tr class=miss><td>72<td><code><pre> return &bizErr{</pre></code><tr><td>73<td><code><pre> code: code,</pre></code><tr><td>74<td><code><pre> errOption: opt,</pre></code><tr><td>75<td><code><pre> }</pre></code><tr><td>76<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.DELETE>func router.DELETE</div><div class=info><a href=#s_fn_router.DELETE>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>120<td><code><pre>func (r *router) DELETE(uri string, fn routerHandler, opts ...utils.OptionExtender) IRouter {</pre></code><tr class=miss><td>121<td><code><pre> opt := utils.ApplyOptions[routerOption](opts...)</pre></code><tr class=miss><td>122<td><code><pre> r.use().DELETE(uri, r.convertMulti(http.MethodDelete, uri, fn, opt)...)</pre></code><tr class=miss><td>123<td><code><pre> return r</pre></code><tr><td>124<td><code><pre>}</pre></code></table><div class=funcname id=fn_@43:9>func @43:9</div><div class=info><a href=#s_fn_@43:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/client.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func(o *clientOption) {</pre></code><tr class=miss><td>44<td><code><pre> o.mu.Lock()</pre></code><tr class=miss><td>45<td><code><pre> defer o.mu.Unlock()</pre></code><tr class=miss><td>46<td><code><pre> o.retryConditions = append(o.retryConditions, fn)</pre></code><tr><td>47<td><code><pre> }</pre></code></table><div class=funcname id=fn_router.OPTIONS>func router.OPTIONS</div><div class=info><a href=#s_fn_router.OPTIONS>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>135<td><code><pre>func (r *router) OPTIONS(uri string, fn routerHandler, opts ...utils.OptionExtender) IRouter {</pre></code><tr class=miss><td>136<td><code><pre> opt := utils.ApplyOptions[routerOption](opts...)</pre></code><tr class=miss><td>137<td><code><pre> r.use().OPTIONS(uri, r.convertMulti(http.MethodOptions, uri, fn, opt)...)</pre></code><tr class=miss><td>138<td><code><pre> return r</pre></code><tr><td>139<td><code><pre>}</pre></code></table><div class=funcname id=fn_RspSuccess>func RspSuccess</div><div class=info><a href=#s_fn_RspSuccess>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/response.go</code>:</div><table class=listing><tr><td>56<td><code><pre>func RspSuccess(c *gin.Context, data any, page, count int, msg string, opts ...utils.OptionExtender) {</pre></code><tr class=miss><td>57<td><code><pre> r, _ := Use(opts...).(*router)</pre></code><tr class=miss><td>58<td><code><pre> rspSuccess(c, r.successCode, data, page, count, msg)</pre></code><tr><td>59<td><code><pre></pre></code><tr class=miss><td>60<td><code><pre> go metricsCode(r.ctx, r.appName, c.Request.URL.Path, c.Request.Method, r.parseHeaderMetrics(c),</pre></code><tr><td>61<td><code><pre> r.successCode, c.Writer.Status(), c.Writer.Size(), c.Request.ContentLength)</pre></code><tr><td>62<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.PUT>func router.PUT</div><div class=info><a href=#s_fn_router.PUT>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>130<td><code><pre>func (r *router) PUT(uri string, fn routerHandler, opts ...utils.OptionExtender) IRouter {</pre></code><tr class=miss><td>131<td><code><pre> opt := utils.ApplyOptions[routerOption](opts...)</pre></code><tr class=miss><td>132<td><code><pre> r.use().PUT(uri, r.convertMulti(http.MethodPut, uri, fn, opt)...)</pre></code><tr class=miss><td>133<td><code><pre> return r</pre></code><tr><td>134<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.HEAD>func router.HEAD</div><div class=info><a href=#s_fn_router.HEAD>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>140<td><code><pre>func (r *router) HEAD(uri string, fn routerHandler, opts ...utils.OptionExtender) IRouter {</pre></code><tr class=miss><td>141<td><code><pre> opt := utils.ApplyOptions[routerOption](opts...)</pre></code><tr class=miss><td>142<td><code><pre> r.use().HEAD(uri, r.convertMulti(http.MethodHead, uri, fn, opt)...)</pre></code><tr class=miss><td>143<td><code><pre> return r</pre></code><tr><td>144<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.Handle>func router.Handle</div><div class=info><a href=#s_fn_router.Handle>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>100<td><code><pre>func (r *router) Handle(uri string, fn routerHandler, opts ...utils.OptionExtender) IRouter {</pre></code><tr class=miss><td>101<td><code><pre> opt := utils.ApplyOptions[routerOption](opts...)</pre></code><tr class=miss><td>102<td><code><pre> r.use().HEAD(uri, r.convertMulti("Handle", uri, fn, opt)...)</pre></code><tr class=miss><td>103<td><code><pre> return r</pre></code><tr><td>104<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.PATCH>func router.PATCH</div><div class=info><a href=#s_fn_router.PATCH>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>125<td><code><pre>func (r *router) PATCH(uri string, fn routerHandler, opts ...utils.OptionExtender) IRouter {</pre></code><tr class=miss><td>126<td><code><pre> opt := utils.ApplyOptions[routerOption](opts...)</pre></code><tr class=miss><td>127<td><code><pre> r.use().PATCH(uri, r.convertMulti(http.MethodPatch, uri, fn, opt)...)</pre></code><tr class=miss><td>128<td><code><pre> return r</pre></code><tr><td>129<td><code><pre>}</pre></code></table><div class=funcname id=fn_@51:9>func @51:9</div><div class=info><a href=#s_fn_@51:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/client.go</code>:</div><table class=listing><tr><td>51<td><code><pre>func(o *clientOption) {</pre></code><tr class=miss><td>52<td><code><pre> o.mu.Lock()</pre></code><tr class=miss><td>53<td><code><pre> defer o.mu.Unlock()</pre></code><tr class=miss><td>54<td><code><pre> o.retryHooks = append(o.retryHooks, fn)</pre></code><tr><td>55<td><code><pre> }</pre></code></table><div class=funcname id=fn_@71:8>func @71:8</div><div class=info><a href=#s_fn_@71:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/zerocopy.go</code>:</div><table class=listing><tr><td>71<td><code><pre>func() {</pre></code><tr class=miss><td>72<td><code><pre> if closeErr := conn.Close(); closeErr != nil {</pre></code><tr class=miss><td>73<td><code><pre> err = multierr.Append(err, closeErr)</pre></code><tr><td>74<td><code><pre> }</pre></code><tr><td>75<td><code><pre> }</pre></code></table><div class=funcname id=fn_@192:8>func @192:8</div><div class=info><a href=#s_fn_@192:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>192<td><code><pre>func() {</pre></code><tr class=miss><td>193<td><code><pre> close(r.close)</pre></code><tr class=miss><td>194<td><code><pre> r.open = make(chan struct{})</pre></code><tr><td>195<td><code><pre> }</pre></code></table><div class=funcname id=fn_router.Static>func router.Static</div><div class=info><a href=#s_fn_router.Static>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr class=miss><td>166<td><code><pre>func (r *router) Static(uri, file string) IRouter { r.use().Static(uri, file); return r }</pre></code></table><div class=funcname id=fn_router.StaticFileFS>func router.StaticFileFS</div><div class=info><a href=#s_fn_router.StaticFileFS>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>162<td><code><pre>func (r *router) StaticFileFS(uri, file string, fs http.FileSystem) IRouter {</pre></code><tr class=miss><td>163<td><code><pre> r.use().StaticFileFS(uri, file, fs)</pre></code><tr class=miss><td>164<td><code><pre> return r</pre></code><tr><td>165<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.StaticFS>func router.StaticFS</div><div class=info><a href=#s_fn_router.StaticFS>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>167<td><code><pre>func (r *router) StaticFS(uri string, fs http.FileSystem) IRouter {</pre></code><tr class=miss><td>168<td><code><pre> r.use().StaticFS(uri, fs)</pre></code><tr class=miss><td>169<td><code><pre> return r</pre></code><tr><td>170<td><code><pre>}</pre></code></table><div class=funcname id=fn_Errcode.Error>func Errcode.Error</div><div class=info><a href=#s_fn_Errcode.Error>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/error.go</code>:</div><table class=listing><tr><td>26<td><code><pre>func (e Errcode) Error() (r string) {</pre></code><tr class=miss><td>27<td><code><pre> return I18n.Localize(e)</pre></code><tr><td>28<td><code><pre>}</pre></code></table><div class=funcname id=fn_@49:9>func @49:9</div><div class=info><a href=#s_fn_@49:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/error.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func(e *errOption) {</pre></code><tr class=miss><td>50<td><code><pre> e.msg = msg</pre></code><tr><td>51<td><code><pre> }</pre></code></table><div class=funcname id=fn_ParseFromBody>func ParseFromBody</div><div class=info><a href=#s_fn_ParseFromBody>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>813<td><code><pre>func ParseFromBody() utils.OptionFunc[routerOption] {</pre></code><tr class=miss><td>814<td><code><pre> return func(r *routerOption) {</pre></code><tr><td>815<td><code><pre> r.parseFrom = parseFromBody</pre></code><tr><td>816<td><code><pre> }</pre></code><tr><td>817<td><code><pre>}</pre></code></table><div class=funcname id=fn_@814:9>func @814:9</div><div class=info><a href=#s_fn_@814:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>814<td><code><pre>func(r *routerOption) {</pre></code><tr class=miss><td>815<td><code><pre> r.parseFrom = parseFromBody</pre></code><tr><td>816<td><code><pre> }</pre></code></table><div class=funcname id=fn_ParseFromQuery>func ParseFromQuery</div><div class=info><a href=#s_fn_ParseFromQuery>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>819<td><code><pre>func ParseFromQuery() utils.OptionFunc[routerOption] {</pre></code><tr class=miss><td>820<td><code><pre> return func(r *routerOption) {</pre></code><tr><td>821<td><code><pre> r.parseFrom = parseFromQuery</pre></code><tr><td>822<td><code><pre> }</pre></code><tr><td>823<td><code><pre>}</pre></code></table><div class=funcname id=fn_@820:9>func @820:9</div><div class=info><a href=#s_fn_@820:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>820<td><code><pre>func(r *routerOption) {</pre></code><tr class=miss><td>821<td><code><pre> r.parseFrom = parseFromQuery</pre></code><tr><td>822<td><code><pre> }</pre></code></table><div class=funcname id=fn_HandleBefore>func HandleBefore</div><div class=info><a href=#s_fn_HandleBefore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>825<td><code><pre>func HandleBefore(beforeHandlers ...routerHandler) utils.OptionFunc[routerOption] {</pre></code><tr class=miss><td>826<td><code><pre> return func(o *routerOption) {</pre></code><tr><td>827<td><code><pre> o.beforeHandlers = beforeHandlers</pre></code><tr><td>828<td><code><pre> }</pre></code><tr><td>829<td><code><pre>}</pre></code></table><div class=funcname id=fn_@826:9>func @826:9</div><div class=info><a href=#s_fn_@826:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>826<td><code><pre>func(o *routerOption) {</pre></code><tr class=miss><td>827<td><code><pre> o.beforeHandlers = beforeHandlers</pre></code><tr><td>828<td><code><pre> }</pre></code></table><div class=funcname id=fn_HandleAfter>func HandleAfter</div><div class=info><a href=#s_fn_HandleAfter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>831<td><code><pre>func HandleAfter(aftersHandlers ...routerHandler) utils.OptionFunc[routerOption] {</pre></code><tr class=miss><td>832<td><code><pre> return func(o *routerOption) {</pre></code><tr><td>833<td><code><pre> o.aftersHandlers = aftersHandlers</pre></code><tr><td>834<td><code><pre> }</pre></code><tr><td>835<td><code><pre>}</pre></code></table><div class=funcname id=fn_@832:9>func @832:9</div><div class=info><a href=#s_fn_@832:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/router.go</code>:</div><table class=listing><tr><td>832<td><code><pre>func(o *routerOption) {</pre></code><tr class=miss><td>833<td><code><pre> o.aftersHandlers = aftersHandlers</pre></code><tr><td>834<td><code><pre> }</pre></code></table><div class=funcname id=fn_@37:9>func @37:9</div><div class=info><a href=#s_fn_@37:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/error.go</code>:</div><table class=listing><tr><td>37<td><code><pre>func(e *errOption) {</pre></code><tr class=miss><td>38<td><code><pre> e.langs = langs(c)</pre></code><tr><td>39<td><code><pre> }</pre></code></table><div class=funcname id=fn_RetryHook>func RetryHook</div><div class=info><a href=#s_fn_RetryHook>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/client.go</code>:</div><table class=listing><tr><td>50<td><code><pre>func RetryHook(fn resty.OnRetryFunc) utils.OptionFunc[clientOption] {</pre></code><tr class=miss><td>51<td><code><pre> return func(o *clientOption) {</pre></code><tr><td>52<td><code><pre> o.mu.Lock()</pre></code><tr><td>53<td><code><pre> defer o.mu.Unlock()</pre></code><tr><td>54<td><code><pre> o.retryHooks = append(o.retryHooks, fn)</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre>}</pre></code></table><div class=funcname id=fn_Langs>func Langs</div><div class=info><a href=#s_fn_Langs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/error.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func Langs(c *gin.Context) utils.OptionFunc[errOption] {</pre></code><tr class=miss><td>37<td><code><pre> return func(e *errOption) {</pre></code><tr><td>38<td><code><pre> e.langs = langs(c)</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre>}</pre></code></table><div class=funcname id=fn_@134:22>func @134:22</div><div class=info><a href=#s_fn_@134:22>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr class=miss><td>134<td><code><pre>func() IRouter { return Use(AppName(opt.AppName)) }</pre></code></table><div class=funcname id=fn_@228:23>func @228:23</div><div class=info><a href=#s_fn_@228:23>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/construct.go</code>:</div><table class=listing><tr class=miss><td>228<td><code><pre>func() *resty.Client { return New(AppName(opt.AppName), CName(name)) }</pre></code></table><div class=funcname id=fn_RetryCondition>func RetryCondition</div><div class=info><a href=#s_fn_RetryCondition>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/client.go</code>:</div><table class=listing><tr><td>42<td><code><pre>func RetryCondition(fn resty.RetryConditionFunc) utils.OptionFunc[clientOption] {</pre></code><tr class=miss><td>43<td><code><pre> return func(o *clientOption) {</pre></code><tr><td>44<td><code><pre> o.mu.Lock()</pre></code><tr><td>45<td><code><pre> defer o.mu.Unlock()</pre></code><tr><td>46<td><code><pre> o.retryConditions = append(o.retryConditions, fn)</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre>}</pre></code></table><div class=funcname id=fn_Msg>func Msg</div><div class=info><a href=#s_fn_Msg>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/error.go</code>:</div><table class=listing><tr><td>48<td><code><pre>func Msg(msg string) utils.OptionFunc[errOption] {</pre></code><tr class=miss><td>49<td><code><pre> return func(e *errOption) {</pre></code><tr><td>50<td><code><pre> e.msg = msg</pre></code><tr><td>51<td><code><pre> }</pre></code><tr><td>52<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/http/consts class=funcname>Package Overview: github.com/wfusion/gofusion/http/consts 28 <span class=packageTotal>88.9%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_SetReqStartTime><td><code><a href=#fn_SetReqStartTime>SetReqStartTime(...)</a></code><td><code>github.com/wfusion/gofusion/http/consts/context.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_GetReqCost><td><code><a href=#fn_GetReqCost>GetReqCost(...)</a></code><td><code>github.com/wfusion/gofusion/http/consts/context.go</code><td class=percent><code>87.5%</code><td class=linecount><code>7/8</code></table><div class=funcname id=fn_SetReqStartTime>func SetReqStartTime</div><div class=info><a href=#s_fn_SetReqStartTime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/consts/context.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func SetReqStartTime(c *gin.Context) {</pre></code><tr><td>16<td><code><pre> c.Set(ctxReqStartAtKey, time.Now())</pre></code><tr><td>17<td><code><pre>}</pre></code></table><div class=funcname id=fn_GetReqCost>func GetReqCost</div><div class=info><a href=#s_fn_GetReqCost>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/consts/context.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func GetReqCost(c *gin.Context) time.Duration {</pre></code><tr><td>20<td><code><pre> if cost, ok := c.Get(ctxReqCostKey); ok {</pre></code><tr class=miss><td>21<td><code><pre> return cast.ToDuration(cost)</pre></code><tr><td>22<td><code><pre> }</pre></code><tr><td>23<td><code><pre></pre></code><tr><td>24<td><code><pre> start := time.Now()</pre></code><tr><td>25<td><code><pre> if _, ok := c.Get(ctxReqStartAtKey); ok {</pre></code><tr><td>26<td><code><pre> start = c.GetTime(ctxReqStartAtKey)</pre></code><tr><td>27<td><code><pre> }</pre></code><tr><td>28<td><code><pre> cost := time.Since(start)</pre></code><tr><td>29<td><code><pre> c.Set(ctxReqCostKey, cost)</pre></code><tr><td>30<td><code><pre> return cost</pre></code><tr><td>31<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/http/gracefully class=funcname>Package Overview: github.com/wfusion/gofusion/http/gracefully 29 <span class=packageTotal>38.9%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_endlessServer.Serve><td><code><a href=#fn_endlessServer.Serve>endlessServer.Serve(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>100.0%</code><td class=linecount><code>11/11</code><tr id=s_fn_endlessListener.Accept><td><code><a href=#fn_endlessListener.Accept>endlessListener.Accept(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>100.0%</code><td class=linecount><code>8/8</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_endlessServer.getState><td><code><a href=#fn_endlessServer.getState>endlessServer.getState(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_endlessServer.setState><td><code><a href=#fn_endlessServer.setState>endlessServer.setState(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_endlessConn.Close><td><code><a href=#fn_endlessConn.Close>endlessConn.Close(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_endlessConn.SetReadDeadline><td><code><a href=#fn_endlessConn.SetReadDeadline>endlessConn.SetReadDeadline(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_endlessConn.RemoteAddr><td><code><a href=#fn_endlessConn.RemoteAddr>endlessConn.RemoteAddr(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_endlessConn.SetWriteDeadline><td><code><a href=#fn_endlessConn.SetWriteDeadline>endlessConn.SetWriteDeadline(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@514:22><td><code><a href=#fn_@514:22>@514:22(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_endlessConn.Write><td><code><a href=#fn_endlessConn.Write>endlessConn.Write(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/signal_darwin.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_newSignalHookFunc><td><code><a href=#fn_newSignalHookFunc>newSignalHookFunc(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/signal_darwin.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_newEndlessListener><td><code><a href=#fn_newEndlessListener>newEndlessListener(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_endlessConn.LocalAddr><td><code><a href=#fn_endlessConn.LocalAddr>endlessConn.LocalAddr(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_endlessConn.Read><td><code><a href=#fn_endlessConn.Read>endlessConn.Read(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_NewServer><td><code><a href=#fn_NewServer>NewServer(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>83.3%</code><td class=linecount><code>10/12</code><tr id=s_fn_@272:8><td><code><a href=#fn_@272:8>@272:8(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_endlessServer.Shutdown><td><code><a href=#fn_endlessServer.Shutdown>endlessServer.Shutdown(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_endlessListener.Close><td><code><a href=#fn_endlessListener.Close>endlessListener.Close(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/signal_darwin.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_endlessServer.ListenAndServe><td><code><a href=#fn_endlessServer.ListenAndServe>endlessServer.ListenAndServe(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>62.5%</code><td class=linecount><code>10/16</code><tr id=s_fn_@365:8><td><code><a href=#fn_@365:8>@365:8(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>50.0%</code><td class=linecount><code>1/2</code><tr id=s_fn_endlessServer.hammerTime><td><code><a href=#fn_endlessServer.hammerTime>endlessServer.hammerTime(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>30.0%</code><td class=linecount><code>3/10</code><tr id=s_fn_endlessServer.getListener><td><code><a href=#fn_endlessServer.getListener>endlessServer.getListener(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>23.5%</code><td class=linecount><code>4/17</code><tr id=s_fn_endlessServer.handleSignals><td><code><a href=#fn_endlessServer.handleSignals>endlessServer.handleSignals(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/signal_darwin.go</code><td class=percent><code>15.8%</code><td class=linecount><code>6/38</code><tr id=s_fn_endlessServer.fork><td><code><a href=#fn_endlessServer.fork>endlessServer.fork(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/27</code><tr id=s_fn_endlessServer.ListenAndServeTLS><td><code><a href=#fn_endlessServer.ListenAndServeTLS>endlessServer.ListenAndServeTLS(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/26</code><tr id=s_fn_endlessServer.RegisterSignalHook><td><code><a href=#fn_endlessServer.RegisterSignalHook>endlessServer.RegisterSignalHook(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/9</code><tr id=s_fn_endlessServer.signalHooks><td><code><a href=#fn_endlessServer.signalHooks>endlessServer.signalHooks(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_endlessListener.File><td><code><a href=#fn_endlessListener.File>endlessListener.File(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_ListenAndServe><td><code><a href=#fn_ListenAndServe>ListenAndServe(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_ListenAndServeTLS><td><code><a href=#fn_ListenAndServeTLS>ListenAndServeTLS(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_endlessConn.SetKeepAlive><td><code><a href=#fn_endlessConn.SetKeepAlive>endlessConn.SetKeepAlive(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_endlessConn.SetKeepAlivePeriod><td><code><a href=#fn_endlessConn.SetKeepAlivePeriod>endlessConn.SetKeepAlivePeriod(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_endlessConn.SetNoDelay><td><code><a href=#fn_endlessConn.SetNoDelay>endlessConn.SetNoDelay(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_endlessConn.SetLinger><td><code><a href=#fn_endlessConn.SetLinger>endlessConn.SetLinger(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_endlessConn.ReadFrom><td><code><a href=#fn_endlessConn.ReadFrom>endlessConn.ReadFrom(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_endlessConn.SyscallConn><td><code><a href=#fn_endlessConn.SyscallConn>endlessConn.SyscallConn(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_endlessConn.SetDeadline><td><code><a href=#fn_endlessConn.SetDeadline>endlessConn.SetDeadline(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/endless.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_syscallKill><td><code><a href=#fn_syscallKill>syscallKill(...)</a></code><td><code>github.com/wfusion/gofusion/http/gracefully/signal_darwin.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_endlessServer.Serve>func endlessServer.Serve</div><div class=info><a href=#s_fn_endlessServer.Serve>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>156<td><code><pre>func (e *endlessServer) Serve() (err error) {</pre></code><tr><td>157<td><code><pre> defer log.Println(syscall.Getpid(), "[Common] endless exited.")</pre></code><tr><td>158<td><code><pre></pre></code><tr><td>159<td><code><pre> e.setState(StateRunning)</pre></code><tr><td>160<td><code><pre> log.Println(syscall.Getpid(), "[Common] endless listening", e.endlessListener.Addr())</pre></code><tr><td>161<td><code><pre></pre></code><tr><td>162<td><code><pre> // ignore server closed error because it happened when we call Server.Shutdown or Server.Close</pre></code><tr><td>163<td><code><pre> if err = e.Server.Serve(e.endlessListener); err != nil {</pre></code><tr><td>164<td><code><pre> // http: Server closed</pre></code><tr><td>165<td><code><pre> // use of closed network connection</pre></code><tr><td>166<td><code><pre> if errors.Is(err, http.ErrServerClosed) || isClosedConnError(err) {</pre></code><tr><td>167<td><code><pre> err = nil</pre></code><tr><td>168<td><code><pre> }</pre></code><tr><td>169<td><code><pre> }</pre></code><tr><td>170<td><code><pre> log.Println(syscall.Getpid(), "[Common] endless waiting for connections to finish...")</pre></code><tr><td>171<td><code><pre> e.wg.Wait()</pre></code><tr><td>172<td><code><pre> e.setState(StateTerminate)</pre></code><tr><td>173<td><code><pre></pre></code><tr><td>174<td><code><pre> <-e.close</pre></code><tr><td>175<td><code><pre></pre></code><tr><td>176<td><code><pre> return</pre></code><tr><td>177<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessListener.Accept>func endlessListener.Accept</div><div class=info><a href=#s_fn_endlessListener.Accept>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>468<td><code><pre>func (e *endlessListener) Accept() (c net.Conn, err error) {</pre></code><tr><td>469<td><code><pre> tc, err := e.Listener.(*net.TCPListener).AcceptTCP()</pre></code><tr><td>470<td><code><pre> if err != nil {</pre></code><tr><td>471<td><code><pre> return</pre></code><tr><td>472<td><code><pre> }</pre></code><tr><td>473<td><code><pre></pre></code><tr><td>474<td><code><pre> // see net/http.tcpKeepAliveListener</pre></code><tr><td>475<td><code><pre> _ = tc.SetKeepAlive(true)</pre></code><tr><td>476<td><code><pre> // see net/http.tcpKeepAliveListener</pre></code><tr><td>477<td><code><pre> _ = tc.SetKeepAlivePeriod(3 * time.Minute)</pre></code><tr><td>478<td><code><pre></pre></code><tr><td>479<td><code><pre> c = &endlessConn{</pre></code><tr><td>480<td><code><pre> Conn: tc,</pre></code><tr><td>481<td><code><pre> server: e.server,</pre></code><tr><td>482<td><code><pre> }</pre></code><tr><td>483<td><code><pre></pre></code><tr><td>484<td><code><pre> e.server.wg.Add(1)</pre></code><tr><td>485<td><code><pre> return</pre></code><tr><td>486<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>58<td><code><pre>func init() {</pre></code><tr><td>59<td><code><pre> runningServerReg = sync.RWMutex{}</pre></code><tr><td>60<td><code><pre> runningServers = make(map[string]*endlessServer)</pre></code><tr><td>61<td><code><pre> runningServersOrder = []string{}</pre></code><tr><td>62<td><code><pre> socketPtrOffsetMap = make(map[string]uint)</pre></code><tr><td>63<td><code><pre></pre></code><tr><td>64<td><code><pre> DefaultMaxHeaderBytes = 0 // use http.DefaultMaxHeaderBytes - which currently is 1 << 20 (1MB)</pre></code><tr><td>65<td><code><pre></pre></code><tr><td>66<td><code><pre> // after a restart the parent will finish ongoing requests before</pre></code><tr><td>67<td><code><pre> // shutting down. set to a negative value to disable</pre></code><tr><td>68<td><code><pre> DefaultHammerTime = 60 * time.Second</pre></code><tr><td>69<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessServer.getState>func endlessServer.getState</div><div class=info><a href=#s_fn_endlessServer.getState>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>441<td><code><pre>func (e *endlessServer) getState() uint8 {</pre></code><tr><td>442<td><code><pre> e.lock.RLock()</pre></code><tr><td>443<td><code><pre> defer e.lock.RUnlock()</pre></code><tr><td>444<td><code><pre></pre></code><tr><td>445<td><code><pre> return e.state</pre></code><tr><td>446<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessServer.setState>func endlessServer.setState</div><div class=info><a href=#s_fn_endlessServer.setState>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>448<td><code><pre>func (e *endlessServer) setState(st uint8) {</pre></code><tr><td>449<td><code><pre> e.lock.Lock()</pre></code><tr><td>450<td><code><pre> defer e.lock.Unlock()</pre></code><tr><td>451<td><code><pre></pre></code><tr><td>452<td><code><pre> e.state = st</pre></code><tr><td>453<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessConn.Close>func endlessConn.Close</div><div class=info><a href=#s_fn_endlessConn.Close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>513<td><code><pre>func (e *endlessConn) Close() (err error) {</pre></code><tr><td>514<td><code><pre> defer e.doneOnce.Do(func() {</pre></code><tr><td>515<td><code><pre> e.server.wg.Done()</pre></code><tr><td>516<td><code><pre> })</pre></code><tr><td>517<td><code><pre> return e.Conn.Close()</pre></code><tr><td>518<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessConn.SetReadDeadline>func endlessConn.SetReadDeadline</div><div class=info><a href=#s_fn_endlessConn.SetReadDeadline>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>552<td><code><pre>func (e *endlessConn) SetReadDeadline(t time.Time) error { return e.Conn.SetReadDeadline(t) }</pre></code></table><div class=funcname id=fn_endlessConn.RemoteAddr>func endlessConn.RemoteAddr</div><div class=info><a href=#s_fn_endlessConn.RemoteAddr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>524<td><code><pre>func (e *endlessConn) RemoteAddr() net.Addr { return e.Conn.RemoteAddr() }</pre></code></table><div class=funcname id=fn_endlessConn.SetWriteDeadline>func endlessConn.SetWriteDeadline</div><div class=info><a href=#s_fn_endlessConn.SetWriteDeadline>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>559<td><code><pre>func (e *endlessConn) SetWriteDeadline(t time.Time) error { return e.Conn.SetWriteDeadline(t) }</pre></code></table><div class=funcname id=fn_@514:22>func @514:22</div><div class=info><a href=#s_fn_@514:22>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>514<td><code><pre>func() {</pre></code><tr><td>515<td><code><pre> e.server.wg.Done()</pre></code><tr><td>516<td><code><pre> }</pre></code></table><div class=funcname id=fn_endlessConn.Write>func endlessConn.Write</div><div class=info><a href=#s_fn_endlessConn.Write>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>509<td><code><pre>func (e *endlessConn) Write(b []byte) (n int, err error) { return e.Conn.Write(b) }</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/signal_darwin.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func init() {</pre></code><tr><td>16<td><code><pre> hookableSignals = []os.Signal{</pre></code><tr><td>17<td><code><pre> syscall.SIGHUP,</pre></code><tr><td>18<td><code><pre> syscall.SIGUSR1,</pre></code><tr><td>19<td><code><pre> syscall.SIGUSR2,</pre></code><tr><td>20<td><code><pre> syscall.SIGINT,</pre></code><tr><td>21<td><code><pre> syscall.SIGQUIT,</pre></code><tr><td>22<td><code><pre> syscall.SIGTERM,</pre></code><tr><td>23<td><code><pre> syscall.SIGTSTP,</pre></code><tr><td>24<td><code><pre> }</pre></code><tr><td>25<td><code><pre>}</pre></code></table><div class=funcname id=fn_newSignalHookFunc>func newSignalHookFunc</div><div class=info><a href=#s_fn_newSignalHookFunc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/signal_darwin.go</code>:</div><table class=listing><tr><td>27<td><code><pre>func newSignalHookFunc() map[int]map[os.Signal][]func() {</pre></code><tr><td>28<td><code><pre> return map[int]map[os.Signal][]func(){</pre></code><tr><td>29<td><code><pre> PreSignal: {</pre></code><tr><td>30<td><code><pre> syscall.SIGHUP: []func(){},</pre></code><tr><td>31<td><code><pre> syscall.SIGUSR1: []func(){},</pre></code><tr><td>32<td><code><pre> syscall.SIGUSR2: []func(){},</pre></code><tr><td>33<td><code><pre> syscall.SIGINT: []func(){},</pre></code><tr><td>34<td><code><pre> syscall.SIGQUIT: []func(){},</pre></code><tr><td>35<td><code><pre> syscall.SIGTERM: []func(){},</pre></code><tr><td>36<td><code><pre> syscall.SIGTSTP: []func(){},</pre></code><tr><td>37<td><code><pre> },</pre></code><tr><td>38<td><code><pre> PostSignal: {</pre></code><tr><td>39<td><code><pre> syscall.SIGHUP: []func(){},</pre></code><tr><td>40<td><code><pre> syscall.SIGUSR1: []func(){},</pre></code><tr><td>41<td><code><pre> syscall.SIGUSR2: []func(){},</pre></code><tr><td>42<td><code><pre> syscall.SIGINT: []func(){},</pre></code><tr><td>43<td><code><pre> syscall.SIGQUIT: []func(){},</pre></code><tr><td>44<td><code><pre> syscall.SIGTERM: []func(){},</pre></code><tr><td>45<td><code><pre> syscall.SIGTSTP: []func(){},</pre></code><tr><td>46<td><code><pre> },</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre>}</pre></code></table><div class=funcname id=fn_newEndlessListener>func newEndlessListener</div><div class=info><a href=#s_fn_newEndlessListener>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>461<td><code><pre>func newEndlessListener(l net.Listener, srv *endlessServer) (el *endlessListener) {</pre></code><tr><td>462<td><code><pre> return &endlessListener{</pre></code><tr><td>463<td><code><pre> Listener: l,</pre></code><tr><td>464<td><code><pre> server: srv,</pre></code><tr><td>465<td><code><pre> }</pre></code><tr><td>466<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessConn.LocalAddr>func endlessConn.LocalAddr</div><div class=info><a href=#s_fn_endlessConn.LocalAddr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>521<td><code><pre>func (e *endlessConn) LocalAddr() net.Addr { return e.Conn.LocalAddr() }</pre></code></table><div class=funcname id=fn_endlessConn.Read>func endlessConn.Read</div><div class=info><a href=#s_fn_endlessConn.Read>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>504<td><code><pre>func (e *endlessConn) Read(b []byte) (n int, err error) { return e.Conn.Read(b) }</pre></code></table><div class=funcname id=fn_NewServer>func NewServer</div><div class=info><a href=#s_fn_NewServer>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>89<td><code><pre>func NewServer(appName string, handler http.Handler, addr string, nextProtos []string) (srv *endlessServer) {</pre></code><tr><td>90<td><code><pre> runningServerReg.Lock()</pre></code><tr><td>91<td><code><pre> defer runningServerReg.Unlock()</pre></code><tr><td>92<td><code><pre></pre></code><tr><td>93<td><code><pre> socketOrder = os.Getenv("ENDLESS_SOCKET_ORDER")</pre></code><tr><td>94<td><code><pre> isChild = os.Getenv("ENDLESS_CONTINUE") != ""</pre></code><tr><td>95<td><code><pre></pre></code><tr><td>96<td><code><pre> if len(socketOrder) > 0 {</pre></code><tr class=miss><td>97<td><code><pre> for i, addr := range strings.Split(socketOrder, ",") {</pre></code><tr class=miss><td>98<td><code><pre> socketPtrOffsetMap[addr] = uint(i)</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre> } else {</pre></code><tr><td>101<td><code><pre> socketPtrOffsetMap[addr] = uint(len(runningServersOrder))</pre></code><tr><td>102<td><code><pre> }</pre></code><tr><td>103<td><code><pre></pre></code><tr><td>104<td><code><pre> srv = &endlessServer{</pre></code><tr><td>105<td><code><pre> AppName: appName,</pre></code><tr><td>106<td><code><pre> Server: &http.Server{</pre></code><tr><td>107<td><code><pre> Addr: addr,</pre></code><tr><td>108<td><code><pre> ReadTimeout: DefaultReadTimeOut,</pre></code><tr><td>109<td><code><pre> WriteTimeout: DefaultWriteTimeOut,</pre></code><tr><td>110<td><code><pre> MaxHeaderBytes: DefaultMaxHeaderBytes,</pre></code><tr><td>111<td><code><pre> Handler: handler,</pre></code><tr><td>112<td><code><pre> TLSConfig: &tls.Config{NextProtos: nextProtos},</pre></code><tr><td>113<td><code><pre> },</pre></code><tr><td>114<td><code><pre> close: make(chan struct{}),</pre></code><tr><td>115<td><code><pre> wg: new(sync.WaitGroup),</pre></code><tr><td>116<td><code><pre> sigChan: make(chan os.Signal),</pre></code><tr><td>117<td><code><pre> isChild: isChild,</pre></code><tr><td>118<td><code><pre> SignalHooks: newSignalHookFunc(),</pre></code><tr><td>119<td><code><pre> state: StateInit,</pre></code><tr><td>120<td><code><pre> lock: new(sync.RWMutex),</pre></code><tr><td>121<td><code><pre> }</pre></code><tr><td>122<td><code><pre></pre></code><tr><td>123<td><code><pre> runningServersOrder = append(runningServersOrder, addr)</pre></code><tr><td>124<td><code><pre> runningServers[addr] = srv</pre></code><tr><td>125<td><code><pre></pre></code><tr><td>126<td><code><pre> return</pre></code><tr><td>127<td><code><pre>}</pre></code></table><div class=funcname id=fn_@272:8>func @272:8</div><div class=info><a href=#s_fn_@272:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>272<td><code><pre>func() {</pre></code><tr><td>273<td><code><pre> e.lock.Lock()</pre></code><tr><td>274<td><code><pre> defer e.lock.Unlock()</pre></code><tr><td>275<td><code><pre> if _, ok := utils.IsChannelClosed(e.close); ok {</pre></code><tr class=miss><td>276<td><code><pre> return</pre></code><tr><td>277<td><code><pre> }</pre></code><tr><td>278<td><code><pre> if e.close != nil {</pre></code><tr><td>279<td><code><pre> close(e.close)</pre></code><tr><td>280<td><code><pre> }</pre></code><tr><td>281<td><code><pre> }</pre></code></table><div class=funcname id=fn_endlessServer.Shutdown>func endlessServer.Shutdown</div><div class=info><a href=#s_fn_endlessServer.Shutdown>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>270<td><code><pre>func (e *endlessServer) Shutdown() {</pre></code><tr><td>271<td><code><pre> // make sure server Shutdown & log printed before Serve() return</pre></code><tr><td>272<td><code><pre> defer func() {</pre></code><tr><td>273<td><code><pre> e.lock.Lock()</pre></code><tr><td>274<td><code><pre> defer e.lock.Unlock()</pre></code><tr><td>275<td><code><pre> if _, ok := utils.IsChannelClosed(e.close); ok {</pre></code><tr><td>276<td><code><pre> return</pre></code><tr><td>277<td><code><pre> }</pre></code><tr><td>278<td><code><pre> if e.close != nil {</pre></code><tr><td>279<td><code><pre> close(e.close)</pre></code><tr><td>280<td><code><pre> }</pre></code><tr><td>281<td><code><pre> }()</pre></code><tr><td>282<td><code><pre></pre></code><tr><td>283<td><code><pre> if e.getState() != StateRunning {</pre></code><tr class=miss><td>284<td><code><pre> return</pre></code><tr><td>285<td><code><pre> }</pre></code><tr><td>286<td><code><pre></pre></code><tr><td>287<td><code><pre> e.setState(StateShuttingDown)</pre></code><tr><td>288<td><code><pre> if DefaultHammerTime >= 0 {</pre></code><tr><td>289<td><code><pre> routine.Loop(e.hammerTime, routine.Args(DefaultHammerTime), routine.AppName(e.AppName))</pre></code><tr><td>290<td><code><pre> }</pre></code><tr><td>291<td><code><pre> // disable keep-alive on existing connections</pre></code><tr><td>292<td><code><pre> e.Server.SetKeepAlivesEnabled(false)</pre></code><tr><td>293<td><code><pre></pre></code><tr><td>294<td><code><pre> // TODO: new context with timeout because system may forcefully kill the program</pre></code><tr><td>295<td><code><pre> if err := e.Server.Shutdown(context.TODO()); err != nil {</pre></code><tr class=miss><td>296<td><code><pre> log.Println(syscall.Getpid(), "[Common] endless close listener error:", err)</pre></code><tr><td>297<td><code><pre> } else {</pre></code><tr><td>298<td><code><pre> log.Println(syscall.Getpid(), "[Common] endless", e.endlessListener.Addr(), "listener closed.")</pre></code><tr><td>299<td><code><pre> }</pre></code><tr><td>300<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessListener.Close>func endlessListener.Close</div><div class=info><a href=#s_fn_endlessListener.Close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/signal_darwin.go</code>:</div><table class=listing><tr><td>113<td><code><pre>func (e *endlessListener) Close() error {</pre></code><tr><td>114<td><code><pre> if e.stopped {</pre></code><tr class=miss><td>115<td><code><pre> return syscall.EINVAL</pre></code><tr><td>116<td><code><pre> }</pre></code><tr><td>117<td><code><pre></pre></code><tr><td>118<td><code><pre> e.stopped = true</pre></code><tr><td>119<td><code><pre> return e.Listener.Close()</pre></code><tr><td>120<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessServer.ListenAndServe>func endlessServer.ListenAndServe</div><div class=info><a href=#s_fn_endlessServer.ListenAndServe>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>182<td><code><pre>func (e *endlessServer) ListenAndServe() (err error) {</pre></code><tr><td>183<td><code><pre> addr := e.Addr</pre></code><tr><td>184<td><code><pre> if addr == "" {</pre></code><tr class=miss><td>185<td><code><pre> addr = ":http"</pre></code><tr><td>186<td><code><pre> }</pre></code><tr><td>187<td><code><pre></pre></code><tr><td>188<td><code><pre> if err = setupHTTP2_Serve(e.Server); err != nil {</pre></code><tr class=miss><td>189<td><code><pre> return</pre></code><tr><td>190<td><code><pre> }</pre></code><tr><td>191<td><code><pre></pre></code><tr><td>192<td><code><pre> routine.Go(e.handleSignals, routine.AppName(e.AppName))</pre></code><tr><td>193<td><code><pre></pre></code><tr><td>194<td><code><pre> l, err := e.getListener(addr)</pre></code><tr><td>195<td><code><pre> if err != nil {</pre></code><tr class=miss><td>196<td><code><pre> log.Println(syscall.Getpid(), "[Common] endless", err)</pre></code><tr class=miss><td>197<td><code><pre> return</pre></code><tr><td>198<td><code><pre> }</pre></code><tr><td>199<td><code><pre></pre></code><tr><td>200<td><code><pre> e.endlessListener = newEndlessListener(l, e)</pre></code><tr><td>201<td><code><pre> if e.isChild {</pre></code><tr class=miss><td>202<td><code><pre> _ = syscallKill(syscall.Getppid())</pre></code><tr><td>203<td><code><pre> }</pre></code><tr><td>204<td><code><pre></pre></code><tr><td>205<td><code><pre> if e.BeforeBegin != nil {</pre></code><tr class=miss><td>206<td><code><pre> e.BeforeBegin(e.Addr)</pre></code><tr><td>207<td><code><pre> }</pre></code><tr><td>208<td><code><pre></pre></code><tr><td>209<td><code><pre> return e.Serve()</pre></code><tr><td>210<td><code><pre>}</pre></code></table><div class=funcname id=fn_@365:8>func @365:8</div><div class=info><a href=#s_fn_@365:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>365<td><code><pre>func() {</pre></code><tr><td>366<td><code><pre> // we are calling e.wg.Done() until it panics which means we called</pre></code><tr><td>367<td><code><pre> // Done() when the counter was already at 0, and we're done.</pre></code><tr><td>368<td><code><pre> // (and thus Serve() will return and the parent will exit)</pre></code><tr><td>369<td><code><pre> if r := recover(); r != nil {</pre></code><tr class=miss><td>370<td><code><pre> log.Println(syscall.Getpid(), "[Common] endless wait group at 0", r)</pre></code><tr><td>371<td><code><pre> }</pre></code><tr><td>372<td><code><pre> }</pre></code></table><div class=funcname id=fn_endlessServer.hammerTime>func endlessServer.hammerTime</div><div class=info><a href=#s_fn_endlessServer.hammerTime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>364<td><code><pre>func (e *endlessServer) hammerTime(d time.Duration) {</pre></code><tr><td>365<td><code><pre> defer func() {</pre></code><tr><td>366<td><code><pre> // we are calling e.wg.Done() until it panics which means we called</pre></code><tr><td>367<td><code><pre> // Done() when the counter was already at 0, and we're done.</pre></code><tr><td>368<td><code><pre> // (and thus Serve() will return and the parent will exit)</pre></code><tr><td>369<td><code><pre> if r := recover(); r != nil {</pre></code><tr><td>370<td><code><pre> log.Println(syscall.Getpid(), "[Common] endless wait group at 0", r)</pre></code><tr><td>371<td><code><pre> }</pre></code><tr><td>372<td><code><pre> }()</pre></code><tr><td>373<td><code><pre> if e.getState() != StateShuttingDown {</pre></code><tr><td>374<td><code><pre> return</pre></code><tr><td>375<td><code><pre> }</pre></code><tr class=miss><td>376<td><code><pre> time.Sleep(d)</pre></code><tr class=miss><td>377<td><code><pre> log.Println(syscall.Getpid(), "[Common] endless harmerTime() forcefully shutting down parent")</pre></code><tr class=miss><td>378<td><code><pre> for {</pre></code><tr class=miss><td>379<td><code><pre> if e.getState() == StateTerminate {</pre></code><tr class=miss><td>380<td><code><pre> break</pre></code><tr><td>381<td><code><pre> }</pre></code><tr class=miss><td>382<td><code><pre> e.wg.Done()</pre></code><tr class=miss><td>383<td><code><pre> runtime.Gosched()</pre></code><tr><td>384<td><code><pre> }</pre></code><tr><td>385<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessServer.getListener>func endlessServer.getListener</div><div class=info><a href=#s_fn_endlessServer.getListener>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>322<td><code><pre>func (e *endlessServer) getListener(addr string) (l net.Listener, err error) {</pre></code><tr><td>323<td><code><pre> if e.isChild {</pre></code><tr class=miss><td>324<td><code><pre> ptrOffset := uint(0)</pre></code><tr class=miss><td>325<td><code><pre> runningServerReg.RLock()</pre></code><tr class=miss><td>326<td><code><pre> defer runningServerReg.RUnlock()</pre></code><tr class=miss><td>327<td><code><pre> if len(socketPtrOffsetMap) > 0 {</pre></code><tr class=miss><td>328<td><code><pre> ptrOffset = socketPtrOffsetMap[addr]</pre></code><tr class=miss><td>329<td><code><pre> log.Println(syscall.Getpid(), "[Common] endless addr:", addr, "ptr offset:", socketPtrOffsetMap[addr])</pre></code><tr><td>330<td><code><pre> }</pre></code><tr><td>331<td><code><pre></pre></code><tr class=miss><td>332<td><code><pre> f := os.NewFile(uintptr(3+ptrOffset), "")</pre></code><tr class=miss><td>333<td><code><pre> l, err = net.FileListener(f)</pre></code><tr class=miss><td>334<td><code><pre> if err != nil {</pre></code><tr class=miss><td>335<td><code><pre> err = fmt.Errorf("net.FileListener error: %v", err)</pre></code><tr class=miss><td>336<td><code><pre> return</pre></code><tr><td>337<td><code><pre> }</pre></code><tr><td>338<td><code><pre> } else {</pre></code><tr><td>339<td><code><pre> l, err = net.Listen("tcp", addr)</pre></code><tr><td>340<td><code><pre> if err != nil {</pre></code><tr class=miss><td>341<td><code><pre> err = fmt.Errorf("net.Listen error: %v", err)</pre></code><tr class=miss><td>342<td><code><pre> return</pre></code><tr><td>343<td><code><pre> }</pre></code><tr><td>344<td><code><pre> }</pre></code><tr><td>345<td><code><pre> return</pre></code><tr><td>346<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessServer.handleSignals>func endlessServer.handleSignals</div><div class=info><a href=#s_fn_endlessServer.handleSignals>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/signal_darwin.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func (e *endlessServer) handleSignals() {</pre></code><tr><td>53<td><code><pre> var sig os.Signal</pre></code><tr><td>54<td><code><pre></pre></code><tr><td>55<td><code><pre> signal.Notify(</pre></code><tr><td>56<td><code><pre> e.sigChan,</pre></code><tr><td>57<td><code><pre> hookableSignals...,</pre></code><tr><td>58<td><code><pre> )</pre></code><tr><td>59<td><code><pre></pre></code><tr><td>60<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>61<td><code><pre> for {</pre></code><tr><td>62<td><code><pre> select {</pre></code><tr><td>63<td><code><pre> case sig = <-e.sigChan:</pre></code><tr><td>64<td><code><pre> case <-e.close:</pre></code><tr><td>65<td><code><pre> return</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre></pre></code><tr class=miss><td>68<td><code><pre> e.signalHooks(PreSignal, sig)</pre></code><tr class=miss><td>69<td><code><pre> switch sig {</pre></code><tr><td>70<td><code><pre> case syscall.SIGHUP:</pre></code><tr class=miss><td>71<td><code><pre> signal.Stop(e.sigChan)</pre></code><tr class=miss><td>72<td><code><pre> close(e.sigChan)</pre></code><tr class=miss><td>73<td><code><pre> log.Println(pid, "[Common] endless received SIGHUP. forking...")</pre></code><tr class=miss><td>74<td><code><pre> if err := e.fork(); err != nil {</pre></code><tr class=miss><td>75<td><code><pre> log.Println("[Common] endless fork err:", err)</pre></code><tr><td>76<td><code><pre> }</pre></code><tr class=miss><td>77<td><code><pre> return</pre></code><tr><td>78<td><code><pre> case syscall.SIGUSR1:</pre></code><tr class=miss><td>79<td><code><pre> log.Println(pid, "[Common] endless received SIGUSR1.")</pre></code><tr><td>80<td><code><pre> case syscall.SIGUSR2:</pre></code><tr class=miss><td>81<td><code><pre> signal.Stop(e.sigChan)</pre></code><tr class=miss><td>82<td><code><pre> close(e.sigChan)</pre></code><tr class=miss><td>83<td><code><pre> log.Println(pid, "[Common] endless received SIGUSR2.")</pre></code><tr class=miss><td>84<td><code><pre> e.hammerTime(0 * time.Second)</pre></code><tr class=miss><td>85<td><code><pre> return</pre></code><tr><td>86<td><code><pre> case syscall.SIGINT:</pre></code><tr class=miss><td>87<td><code><pre> signal.Stop(e.sigChan)</pre></code><tr class=miss><td>88<td><code><pre> close(e.sigChan)</pre></code><tr class=miss><td>89<td><code><pre> log.Println(pid, "[Common] endless received SIGINT.")</pre></code><tr class=miss><td>90<td><code><pre> e.Shutdown()</pre></code><tr class=miss><td>91<td><code><pre> return</pre></code><tr><td>92<td><code><pre> case syscall.SIGQUIT:</pre></code><tr class=miss><td>93<td><code><pre> signal.Stop(e.sigChan)</pre></code><tr class=miss><td>94<td><code><pre> close(e.sigChan)</pre></code><tr class=miss><td>95<td><code><pre> log.Println(pid, "[Common] endless received SIGQUIT.")</pre></code><tr class=miss><td>96<td><code><pre> e.Shutdown()</pre></code><tr class=miss><td>97<td><code><pre> return</pre></code><tr><td>98<td><code><pre> case syscall.SIGTERM:</pre></code><tr class=miss><td>99<td><code><pre> signal.Stop(e.sigChan)</pre></code><tr class=miss><td>100<td><code><pre> close(e.sigChan)</pre></code><tr class=miss><td>101<td><code><pre> log.Println(pid, "[Common] endless received SIGTERM.")</pre></code><tr class=miss><td>102<td><code><pre> e.Shutdown()</pre></code><tr class=miss><td>103<td><code><pre> return</pre></code><tr><td>104<td><code><pre> case syscall.SIGTSTP:</pre></code><tr class=miss><td>105<td><code><pre> log.Println(pid, "[Common] endless received SIGTSTP.")</pre></code><tr><td>106<td><code><pre> default:</pre></code><tr class=miss><td>107<td><code><pre> log.Printf("[Common] endless received %v: nothing we care about...\n", sig)</pre></code><tr><td>108<td><code><pre> }</pre></code><tr class=miss><td>109<td><code><pre> e.signalHooks(PostSignal, sig)</pre></code><tr><td>110<td><code><pre> }</pre></code><tr><td>111<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessServer.fork>func endlessServer.fork</div><div class=info><a href=#s_fn_endlessServer.fork>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>387<td><code><pre>func (e *endlessServer) fork() (err error) {</pre></code><tr class=miss><td>388<td><code><pre> runningServerReg.Lock()</pre></code><tr class=miss><td>389<td><code><pre> defer runningServerReg.Unlock()</pre></code><tr><td>390<td><code><pre></pre></code><tr><td>391<td><code><pre> // only one server instance should fork!</pre></code><tr class=miss><td>392<td><code><pre> if runningServersForked {</pre></code><tr class=miss><td>393<td><code><pre> return errors.New("another process already forked, ignoring this one")</pre></code><tr><td>394<td><code><pre> }</pre></code><tr><td>395<td><code><pre></pre></code><tr class=miss><td>396<td><code><pre> runningServersForked = true</pre></code><tr><td>397<td><code><pre></pre></code><tr class=miss><td>398<td><code><pre> var files = make([]*os.File, len(runningServers))</pre></code><tr class=miss><td>399<td><code><pre> var orderArgs = make([]string, len(runningServers))</pre></code><tr><td>400<td><code><pre> // get the accessor socket fds for _all_ server instances</pre></code><tr class=miss><td>401<td><code><pre> for _, srvPtr := range runningServers {</pre></code><tr><td>402<td><code><pre> // introspect.PrintTypeDump(srvPtr.endlessListener)</pre></code><tr class=miss><td>403<td><code><pre> switch srvPtr.endlessListener.(type) {</pre></code><tr><td>404<td><code><pre> case *endlessListener:</pre></code><tr><td>405<td><code><pre> // normal listener</pre></code><tr class=miss><td>406<td><code><pre> files[socketPtrOffsetMap[srvPtr.Server.Addr]] = srvPtr.endlessListener.(*endlessListener).File()</pre></code><tr><td>407<td><code><pre> default:</pre></code><tr><td>408<td><code><pre> // tls listener</pre></code><tr class=miss><td>409<td><code><pre> files[socketPtrOffsetMap[srvPtr.Server.Addr]] = srvPtr.tlsInnerListener.File()</pre></code><tr><td>410<td><code><pre> }</pre></code><tr class=miss><td>411<td><code><pre> orderArgs[socketPtrOffsetMap[srvPtr.Server.Addr]] = srvPtr.Server.Addr</pre></code><tr><td>412<td><code><pre> }</pre></code><tr><td>413<td><code><pre></pre></code><tr class=miss><td>414<td><code><pre> env := append(</pre></code><tr><td>415<td><code><pre> os.Environ(),</pre></code><tr><td>416<td><code><pre> "ENDLESS_CONTINUE=1",</pre></code><tr><td>417<td><code><pre> )</pre></code><tr class=miss><td>418<td><code><pre> if len(runningServers) > 1 {</pre></code><tr class=miss><td>419<td><code><pre> env = append(env, fmt.Sprintf(`ENDLESS_SOCKET_ORDER=%s`, strings.Join(orderArgs, ",")))</pre></code><tr><td>420<td><code><pre> }</pre></code><tr><td>421<td><code><pre></pre></code><tr class=miss><td>422<td><code><pre> path := os.Args[0]</pre></code><tr class=miss><td>423<td><code><pre> var args []string</pre></code><tr class=miss><td>424<td><code><pre> if len(os.Args) > 1 {</pre></code><tr class=miss><td>425<td><code><pre> args = os.Args[1:]</pre></code><tr><td>426<td><code><pre> }</pre></code><tr><td>427<td><code><pre></pre></code><tr class=miss><td>428<td><code><pre> cmd := exec.Command(path, args...)</pre></code><tr class=miss><td>429<td><code><pre> cmd.Stdout = os.Stdout</pre></code><tr class=miss><td>430<td><code><pre> cmd.Stderr = os.Stderr</pre></code><tr class=miss><td>431<td><code><pre> cmd.ExtraFiles = files</pre></code><tr class=miss><td>432<td><code><pre> cmd.Env = env</pre></code><tr><td>433<td><code><pre></pre></code><tr class=miss><td>434<td><code><pre> if err = cmd.Start(); err != nil {</pre></code><tr class=miss><td>435<td><code><pre> log.Fatalf("%v [Common] endless restart: failed to launch, error: %v", syscall.Getpid(), err)</pre></code><tr><td>436<td><code><pre> }</pre></code><tr><td>437<td><code><pre></pre></code><tr class=miss><td>438<td><code><pre> return</pre></code><tr><td>439<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessServer.ListenAndServeTLS>func endlessServer.ListenAndServeTLS</div><div class=info><a href=#s_fn_endlessServer.ListenAndServeTLS>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>221<td><code><pre>func (e *endlessServer) ListenAndServeTLS(certFile, keyFile string) (err error) {</pre></code><tr class=miss><td>222<td><code><pre> addr := e.Addr</pre></code><tr class=miss><td>223<td><code><pre> if addr == "" {</pre></code><tr class=miss><td>224<td><code><pre> addr = ":https"</pre></code><tr><td>225<td><code><pre> }</pre></code><tr><td>226<td><code><pre></pre></code><tr><td>227<td><code><pre> // Setup HTTP/2 before srv.Serve, to initialize srv.TLSConfig</pre></code><tr><td>228<td><code><pre> // before we clone it and create the TLS Listener.</pre></code><tr class=miss><td>229<td><code><pre> if err = setupHTTP2_ServeTLS(e.Server); err != nil {</pre></code><tr class=miss><td>230<td><code><pre> return</pre></code><tr><td>231<td><code><pre> }</pre></code><tr><td>232<td><code><pre></pre></code><tr class=miss><td>233<td><code><pre> config := new(tls.Config)</pre></code><tr class=miss><td>234<td><code><pre> if e.Server.TLSConfig != nil {</pre></code><tr class=miss><td>235<td><code><pre> *config = *e.Server.TLSConfig.Clone()</pre></code><tr><td>236<td><code><pre> }</pre></code><tr class=miss><td>237<td><code><pre> if !utils.NewSet(config.NextProtos...).Contains("http/1.1") {</pre></code><tr class=miss><td>238<td><code><pre> config.NextProtos = append(config.NextProtos, "http/1.1")</pre></code><tr><td>239<td><code><pre> }</pre></code><tr><td>240<td><code><pre></pre></code><tr class=miss><td>241<td><code><pre> configHasCert := len(config.Certificates) > 0 || config.GetCertificate != nil</pre></code><tr class=miss><td>242<td><code><pre> if !configHasCert || certFile != "" || keyFile != "" {</pre></code><tr class=miss><td>243<td><code><pre> config.Certificates = make([]tls.Certificate, 1)</pre></code><tr class=miss><td>244<td><code><pre> config.Certificates[0], err = tls.LoadX509KeyPair(certFile, keyFile)</pre></code><tr class=miss><td>245<td><code><pre> if err != nil {</pre></code><tr class=miss><td>246<td><code><pre> return err</pre></code><tr><td>247<td><code><pre> }</pre></code><tr><td>248<td><code><pre> }</pre></code><tr><td>249<td><code><pre></pre></code><tr class=miss><td>250<td><code><pre> routine.Go(e.handleSignals, routine.AppName(e.AppName))</pre></code><tr><td>251<td><code><pre></pre></code><tr class=miss><td>252<td><code><pre> l, err := e.getListener(addr)</pre></code><tr class=miss><td>253<td><code><pre> if err != nil {</pre></code><tr class=miss><td>254<td><code><pre> log.Println(syscall.Getpid(), "[Common] endless error occur when get listener:", err)</pre></code><tr class=miss><td>255<td><code><pre> return</pre></code><tr><td>256<td><code><pre> }</pre></code><tr><td>257<td><code><pre></pre></code><tr class=miss><td>258<td><code><pre> e.tlsInnerListener = newEndlessListener(l, e)</pre></code><tr class=miss><td>259<td><code><pre> e.endlessListener = tls.NewListener(e.tlsInnerListener, config)</pre></code><tr class=miss><td>260<td><code><pre> if e.isChild {</pre></code><tr class=miss><td>261<td><code><pre> _ = syscallKill(syscall.Getppid())</pre></code><tr><td>262<td><code><pre> }</pre></code><tr><td>263<td><code><pre></pre></code><tr class=miss><td>264<td><code><pre> return e.Serve()</pre></code><tr><td>265<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessServer.RegisterSignalHook>func endlessServer.RegisterSignalHook</div><div class=info><a href=#s_fn_endlessServer.RegisterSignalHook>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>305<td><code><pre>func (e *endlessServer) RegisterSignalHook(prePost int, sig os.Signal, f func()) (err error) {</pre></code><tr class=miss><td>306<td><code><pre> if prePost != PreSignal && prePost != PostSignal {</pre></code><tr class=miss><td>307<td><code><pre> err = fmt.Errorf("cannot use %v for prePost arg. Must be endless.PRE_SIGNAL or endless.POST_SIGNAL", sig)</pre></code><tr class=miss><td>308<td><code><pre> return</pre></code><tr><td>309<td><code><pre> }</pre></code><tr class=miss><td>310<td><code><pre> for _, s := range hookableSignals {</pre></code><tr class=miss><td>311<td><code><pre> if s == sig {</pre></code><tr class=miss><td>312<td><code><pre> e.SignalHooks[prePost][sig] = append(e.SignalHooks[prePost][sig], f)</pre></code><tr class=miss><td>313<td><code><pre> return</pre></code><tr><td>314<td><code><pre> }</pre></code><tr><td>315<td><code><pre> }</pre></code><tr class=miss><td>316<td><code><pre> err = fmt.Errorf("signal %v is not supported", sig)</pre></code><tr class=miss><td>317<td><code><pre> return</pre></code><tr><td>318<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessServer.signalHooks>func endlessServer.signalHooks</div><div class=info><a href=#s_fn_endlessServer.signalHooks>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>348<td><code><pre>func (e *endlessServer) signalHooks(ppFlag int, sig os.Signal) {</pre></code><tr class=miss><td>349<td><code><pre> if _, notSet := e.SignalHooks[ppFlag][sig]; !notSet {</pre></code><tr class=miss><td>350<td><code><pre> return</pre></code><tr><td>351<td><code><pre> }</pre></code><tr class=miss><td>352<td><code><pre> for _, f := range e.SignalHooks[ppFlag][sig] {</pre></code><tr class=miss><td>353<td><code><pre> f()</pre></code><tr><td>354<td><code><pre> }</pre></code><tr><td>355<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessListener.File>func endlessListener.File</div><div class=info><a href=#s_fn_endlessListener.File>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>488<td><code><pre>func (e *endlessListener) File() *os.File {</pre></code><tr><td>489<td><code><pre> // returns a dup(2) - FD_CLOEXEC flag *not* set</pre></code><tr class=miss><td>490<td><code><pre> tl := e.Listener.(*net.TCPListener)</pre></code><tr class=miss><td>491<td><code><pre> fl, _ := tl.File()</pre></code><tr class=miss><td>492<td><code><pre> return fl</pre></code><tr><td>493<td><code><pre>}</pre></code></table><div class=funcname id=fn_ListenAndServe>func ListenAndServe</div><div class=info><a href=#s_fn_ListenAndServe>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>132<td><code><pre>func ListenAndServe(appName string, handler http.Handler, addr string, nextProtos []string) error {</pre></code><tr class=miss><td>133<td><code><pre> server := NewServer(appName, handler, addr, nextProtos)</pre></code><tr class=miss><td>134<td><code><pre> return server.ListenAndServe()</pre></code><tr><td>135<td><code><pre>}</pre></code></table><div class=funcname id=fn_ListenAndServeTLS>func ListenAndServeTLS</div><div class=info><a href=#s_fn_ListenAndServeTLS>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>142<td><code><pre>func ListenAndServeTLS(appName string, handler http.Handler, addr, certFile, keyFile string,</pre></code><tr><td>143<td><code><pre> nextProtos []string) error {</pre></code><tr class=miss><td>144<td><code><pre> server := NewServer(appName, handler, addr, nextProtos)</pre></code><tr class=miss><td>145<td><code><pre> return server.ListenAndServeTLS(certFile, keyFile)</pre></code><tr><td>146<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessConn.SetKeepAlive>func endlessConn.SetKeepAlive</div><div class=info><a href=#s_fn_endlessConn.SetKeepAlive>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>590<td><code><pre>func (e *endlessConn) SetKeepAlive(keepalive bool) error {</pre></code><tr class=miss><td>591<td><code><pre> return e.Conn.(*net.TCPConn).SetKeepAlive(keepalive)</pre></code><tr><td>592<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessConn.SetKeepAlivePeriod>func endlessConn.SetKeepAlivePeriod</div><div class=info><a href=#s_fn_endlessConn.SetKeepAlivePeriod>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>595<td><code><pre>func (e *endlessConn) SetKeepAlivePeriod(d time.Duration) error {</pre></code><tr class=miss><td>596<td><code><pre> return e.Conn.(*net.TCPConn).SetKeepAlivePeriod(d)</pre></code><tr><td>597<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessConn.SetNoDelay>func endlessConn.SetNoDelay</div><div class=info><a href=#s_fn_endlessConn.SetNoDelay>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>603<td><code><pre>func (e *endlessConn) SetNoDelay(noDelay bool) error {</pre></code><tr class=miss><td>604<td><code><pre> return e.Conn.(*net.TCPConn).SetNoDelay(noDelay)</pre></code><tr><td>605<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessConn.SetLinger>func endlessConn.SetLinger</div><div class=info><a href=#s_fn_endlessConn.SetLinger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>584<td><code><pre>func (e *endlessConn) SetLinger(sec int) error {</pre></code><tr class=miss><td>585<td><code><pre> return e.Conn.(*net.TCPConn).SetLinger(sec)</pre></code><tr><td>586<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessConn.ReadFrom>func endlessConn.ReadFrom</div><div class=info><a href=#s_fn_endlessConn.ReadFrom>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>568<td><code><pre>func (e *endlessConn) ReadFrom(r io.Reader) (int64, error) {</pre></code><tr class=miss><td>569<td><code><pre> return e.Conn.(*net.TCPConn).ReadFrom(r)</pre></code><tr><td>570<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessConn.SyscallConn>func endlessConn.SyscallConn</div><div class=info><a href=#s_fn_endlessConn.SyscallConn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr><td>563<td><code><pre>func (e *endlessConn) SyscallConn() (syscall.RawConn, error) {</pre></code><tr class=miss><td>564<td><code><pre> return e.Conn.(*net.TCPConn).SyscallConn()</pre></code><tr><td>565<td><code><pre>}</pre></code></table><div class=funcname id=fn_endlessConn.SetDeadline>func endlessConn.SetDeadline</div><div class=info><a href=#s_fn_endlessConn.SetDeadline>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/endless.go</code>:</div><table class=listing><tr class=miss><td>547<td><code><pre>func (e *endlessConn) SetDeadline(t time.Time) error { return e.Conn.SetDeadline(t) }</pre></code></table><div class=funcname id=fn_syscallKill>func syscallKill</div><div class=info><a href=#s_fn_syscallKill>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/gracefully/signal_darwin.go</code>:</div><table class=listing><tr><td>122<td><code><pre>func syscallKill(ppid int) error {</pre></code><tr class=miss><td>123<td><code><pre> return syscall.Kill(ppid, syscall.SIGTERM)</pre></code><tr><td>124<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/http/middleware class=funcname>Package Overview: github.com/wfusion/gofusion/http/middleware 30 <span class=packageTotal>52.9%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_@12:9><td><code><a href=#fn_@12:9>@12:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/trace.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_@130:9><td><code><a href=#fn_@130:9>@130:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/logging.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@29:4><td><code><a href=#fn_@29:4>@29:4(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/trace.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@38:4><td><code><a href=#fn_@38:4>@38:4(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/trace.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@34:4><td><code><a href=#fn_@34:4>@34:4(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/trace.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@18:4><td><code><a href=#fn_@18:4>@18:4(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/trace.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@19:4><td><code><a href=#fn_@19:4>@19:4(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/trace.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_Recover><td><code><a href=#fn_Recover>Recover(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/recover.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@26:9><td><code><a href=#fn_@26:9>@26:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/recover.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@30:4><td><code><a href=#fn_@30:4>@30:4(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/trace.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@17:4><td><code><a href=#fn_@17:4>@17:4(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/trace.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_XSS><td><code><a href=#fn_XSS>XSS(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/xss.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@23:4><td><code><a href=#fn_@23:4>@23:4(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/trace.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_Trace><td><code><a href=#fn_Trace>Trace(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/trace.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Logging><td><code><a href=#fn_Logging>Logging(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/logging.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Gateway><td><code><a href=#fn_Gateway>Gateway(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/gateway.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Cors><td><code><a href=#fn_Cors>Cors(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/cors.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_logging><td><code><a href=#fn_logging>logging(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/logging.go</code><td class=percent><code>76.5%</code><td class=linecount><code>13/17</code><tr id=s_fn_metricsLogging><td><code><a href=#fn_metricsLogging>metricsLogging(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/logging.go</code><td class=percent><code>68.8%</code><td class=linecount><code>11/16</code><tr id=s_fn_@12:9><td><code><a href=#fn_@12:9>@12:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/cors.go</code><td class=percent><code>63.2%</code><td class=linecount><code>12/19</code><tr id=s_fn_@27:9><td><code><a href=#fn_@27:9>@27:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/recover.go</code><td class=percent><code>60.5%</code><td class=linecount><code>23/38</code><tr id=s_fn_@22:9><td><code><a href=#fn_@22:9>@22:9(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/xss.go</code><td class=percent><code>12.1%</code><td class=linecount><code>4/33</code><tr id=s_fn_xssFilterJSON><td><code><a href=#fn_xssFilterJSON>xssFilterJSON(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/xss.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/9</code><tr id=s_fn_xssFilterJSONData><td><code><a href=#fn_xssFilterJSONData>xssFilterJSONData(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/xss.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/9</code><tr id=s_fn_xssFilterQuery><td><code><a href=#fn_xssFilterQuery>xssFilterQuery(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/xss.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/8</code><tr id=s_fn_xssFilterPlain><td><code><a href=#fn_xssFilterPlain>xssFilterPlain(...)</a></code><td><code>github.com/wfusion/gofusion/http/middleware/xss.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code></table><div class=funcname id=fn_@12:9>func @12:9</div><div class=info><a href=#s_fn_@12:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/trace.go</code>:</div><table class=listing><tr><td>12<td><code><pre>func(c *gin.Context) {</pre></code><tr><td>13<td><code><pre> var (</pre></code><tr><td>14<td><code><pre> userID, traceID string</pre></code><tr><td>15<td><code><pre> )</pre></code><tr><td>16<td><code><pre> utils.IfAny(</pre></code><tr><td>17<td><code><pre> func() bool { traceID = c.GetHeader(fusCtx.KeyTraceID); return traceID != "" },</pre></code><tr><td>18<td><code><pre> func() bool { traceID = c.GetHeader("HTTP_TRACE_ID"); return traceID != "" },</pre></code><tr><td>19<td><code><pre> func() bool {</pre></code><tr><td>20<td><code><pre> traceID = utils.LookupByFuzzyKeyword[string](c.GetHeader, "trace_id")</pre></code><tr><td>21<td><code><pre> return traceID != ""</pre></code><tr><td>22<td><code><pre> },</pre></code><tr><td>23<td><code><pre> func() bool { traceID = utils.NginxID(); return traceID != "" },</pre></code><tr><td>24<td><code><pre> )</pre></code><tr><td>25<td><code><pre> c.Header("Trace-Id", traceID)</pre></code><tr><td>26<td><code><pre> c.Set(fusCtx.KeyTraceID, traceID)</pre></code><tr><td>27<td><code><pre></pre></code><tr><td>28<td><code><pre> utils.IfAny(</pre></code><tr><td>29<td><code><pre> func() bool { userID = c.GetHeader(fusCtx.KeyUserID); return userID != "" },</pre></code><tr><td>30<td><code><pre> func() bool {</pre></code><tr><td>31<td><code><pre> userID = utils.LookupByFuzzyKeyword[string](c.GetHeader, "user_id")</pre></code><tr><td>32<td><code><pre> return userID != ""</pre></code><tr><td>33<td><code><pre> },</pre></code><tr><td>34<td><code><pre> func() bool {</pre></code><tr><td>35<td><code><pre> userID = utils.LookupByFuzzyKeyword[string](c.GetQuery, "user_id")</pre></code><tr><td>36<td><code><pre> return userID != ""</pre></code><tr><td>37<td><code><pre> },</pre></code><tr><td>38<td><code><pre> func() bool {</pre></code><tr><td>39<td><code><pre> userID = utils.LookupByFuzzyKeyword[string](c.GetPostForm, "user_id")</pre></code><tr><td>40<td><code><pre> return userID != ""</pre></code><tr><td>41<td><code><pre> },</pre></code><tr><td>42<td><code><pre> )</pre></code><tr><td>43<td><code><pre> c.Set(fusCtx.KeyUserID, userID)</pre></code><tr><td>44<td><code><pre> c.Next()</pre></code><tr><td>45<td><code><pre> }</pre></code></table><div class=funcname id=fn_@130:9>func @130:9</div><div class=info><a href=#s_fn_@130:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/logging.go</code>:</div><table class=listing><tr><td>130<td><code><pre>func(c *gin.Context) {</pre></code><tr><td>131<td><code><pre> reqURL := clone.Clone(c.Request.URL)</pre></code><tr><td>132<td><code><pre> defer logging(ctx, c, logger, reqURL, metricsHeaders, appName)</pre></code><tr><td>133<td><code><pre></pre></code><tr><td>134<td><code><pre> c.Next()</pre></code><tr><td>135<td><code><pre> }</pre></code></table><div class=funcname id=fn_@29:4>func @29:4</div><div class=info><a href=#s_fn_@29:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/trace.go</code>:</div><table class=listing><tr><td>29<td><code><pre>func() bool { userID = c.GetHeader(fusCtx.KeyUserID); return userID != "" }</pre></code></table><div class=funcname id=fn_@38:4>func @38:4</div><div class=info><a href=#s_fn_@38:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/trace.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func() bool {</pre></code><tr><td>39<td><code><pre> userID = utils.LookupByFuzzyKeyword[string](c.GetPostForm, "user_id")</pre></code><tr><td>40<td><code><pre> return userID != ""</pre></code><tr><td>41<td><code><pre> }</pre></code></table><div class=funcname id=fn_@34:4>func @34:4</div><div class=info><a href=#s_fn_@34:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/trace.go</code>:</div><table class=listing><tr><td>34<td><code><pre>func() bool {</pre></code><tr><td>35<td><code><pre> userID = utils.LookupByFuzzyKeyword[string](c.GetQuery, "user_id")</pre></code><tr><td>36<td><code><pre> return userID != ""</pre></code><tr><td>37<td><code><pre> }</pre></code></table><div class=funcname id=fn_@18:4>func @18:4</div><div class=info><a href=#s_fn_@18:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/trace.go</code>:</div><table class=listing><tr><td>18<td><code><pre>func() bool { traceID = c.GetHeader("HTTP_TRACE_ID"); return traceID != "" }</pre></code></table><div class=funcname id=fn_@19:4>func @19:4</div><div class=info><a href=#s_fn_@19:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/trace.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func() bool {</pre></code><tr><td>20<td><code><pre> traceID = utils.LookupByFuzzyKeyword[string](c.GetHeader, "trace_id")</pre></code><tr><td>21<td><code><pre> return traceID != ""</pre></code><tr><td>22<td><code><pre> }</pre></code></table><div class=funcname id=fn_Recover>func Recover</div><div class=info><a href=#s_fn_Recover>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/recover.go</code>:</div><table class=listing><tr><td>24<td><code><pre>func Recover(appName string, logger resty.Logger, errMsg map[string]any) gin.HandlerFunc {</pre></code><tr><td>25<td><code><pre> tag := i18n.DefaultLang(i18n.AppName(appName))</pre></code><tr><td>26<td><code><pre> return func(c *gin.Context) {</pre></code><tr><td>27<td><code><pre> defer func() {</pre></code><tr><td>28<td><code><pre> if err := recover(); err != nil {</pre></code><tr><td>29<td><code><pre> // Check for a broken connection, as it is not really a</pre></code><tr><td>30<td><code><pre> // condition that warrants a panic stack trace.</pre></code><tr><td>31<td><code><pre> var brokenPipe bool</pre></code><tr><td>32<td><code><pre> if ne, ok := err.(*net.OpError); ok {</pre></code><tr><td>33<td><code><pre> if se, ok := ne.Err.(*os.SyscallError); ok {</pre></code><tr><td>34<td><code><pre> if strings.Contains(strings.ToLower(se.Error()), "broken pipe") ||</pre></code><tr><td>35<td><code><pre> strings.Contains(strings.ToLower(se.Error()), "connection reset by peer") {</pre></code><tr><td>36<td><code><pre> brokenPipe = true</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre> if brokenPipe {</pre></code><tr><td>41<td><code><pre> c.Abort()</pre></code><tr><td>42<td><code><pre> return</pre></code><tr><td>43<td><code><pre> }</pre></code><tr><td>44<td><code><pre> debugStack := ""</pre></code><tr><td>45<td><code><pre> for _, v := range strings.Split(string(debug.Stack()), "\n") {</pre></code><tr><td>46<td><code><pre> debugStack += "> " + v + "\n"</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> hostname, hostnameErr := os.Hostname()</pre></code><tr><td>49<td><code><pre> if hostnameErr != nil {</pre></code><tr><td>50<td><code><pre> hostname = "unknown"</pre></code><tr><td>51<td><code><pre> }</pre></code><tr><td>52<td><code><pre> buffer, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>53<td><code><pre> defer cb()</pre></code><tr><td>54<td><code><pre></pre></code><tr><td>55<td><code><pre> if tag == language.Chinese {</pre></code><tr><td>56<td><code><pre> buffer.WriteString(fmt.Sprintf("%v \n", err))</pre></code><tr><td>57<td><code><pre> buffer.WriteString(fmt.Sprintf("请求时间:%v \n", time.Now().Format(constant.StdTimeLayout)))</pre></code><tr><td>58<td><code><pre> buffer.WriteString(fmt.Sprintf("主机名称:%v \n", hostname))</pre></code><tr><td>59<td><code><pre> buffer.WriteString(fmt.Sprintf("请求编号:%v \n", c.GetString(fusCtx.KeyTraceID)))</pre></code><tr><td>60<td><code><pre> buffer.WriteString(fmt.Sprintf("请求地址:%v \n",</pre></code><tr><td>61<td><code><pre> c.Request.Method+" "+c.Request.Host+c.Request.RequestURI))</pre></code><tr><td>62<td><code><pre> buffer.WriteString(fmt.Sprintf("请求UA:%v \n", c.Request.UserAgent()))</pre></code><tr><td>63<td><code><pre> buffer.WriteString(fmt.Sprintf("请求IP:%v \n", c.ClientIP()))</pre></code><tr><td>64<td><code><pre> buffer.WriteString(fmt.Sprintf("异常捕获:\n%v", debugStack))</pre></code><tr><td>65<td><code><pre> } else {</pre></code><tr><td>66<td><code><pre> buffer.WriteString(fmt.Sprintf("%v \n", err))</pre></code><tr><td>67<td><code><pre> buffer.WriteString(fmt.Sprintf("RequstTime:%v \n", time.Now().Format(constant.StdTimeLayout)))</pre></code><tr><td>68<td><code><pre> buffer.WriteString(fmt.Sprintf("Hostname:%v \n", hostname))</pre></code><tr><td>69<td><code><pre> buffer.WriteString(fmt.Sprintf("TraceID:%v \n", c.GetString(fusCtx.KeyTraceID)))</pre></code><tr><td>70<td><code><pre> buffer.WriteString(fmt.Sprintf("RequestURI:%v \n",</pre></code><tr><td>71<td><code><pre> c.Request.Method+" "+c.Request.Host+c.Request.RequestURI))</pre></code><tr><td>72<td><code><pre> buffer.WriteString(fmt.Sprintf("UA:%v \n", c.Request.UserAgent()))</pre></code><tr><td>73<td><code><pre> buffer.WriteString(fmt.Sprintf("IP:%v \n", c.ClientIP()))</pre></code><tr><td>74<td><code><pre> buffer.WriteString(fmt.Sprintf("ErrorStack:\n%v", debugStack))</pre></code><tr><td>75<td><code><pre> }</pre></code><tr><td>76<td><code><pre></pre></code><tr><td>77<td><code><pre> if logger != nil {</pre></code><tr><td>78<td><code><pre> logger.Errorf(buffer.String(), fusCtx.New(fusCtx.Gin(c)))</pre></code><tr><td>79<td><code><pre> } else {</pre></code><tr><td>80<td><code><pre> log.Printf(buffer.String())</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre></pre></code><tr><td>83<td><code><pre> c.AbortWithStatusJSON(http.StatusInternalServerError, errMsg)</pre></code><tr><td>84<td><code><pre> }</pre></code><tr><td>85<td><code><pre> }()</pre></code><tr><td>86<td><code><pre> c.Next()</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre>}</pre></code></table><div class=funcname id=fn_@26:9>func @26:9</div><div class=info><a href=#s_fn_@26:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/recover.go</code>:</div><table class=listing><tr><td>26<td><code><pre>func(c *gin.Context) {</pre></code><tr><td>27<td><code><pre> defer func() {</pre></code><tr><td>28<td><code><pre> if err := recover(); err != nil {</pre></code><tr><td>29<td><code><pre> // Check for a broken connection, as it is not really a</pre></code><tr><td>30<td><code><pre> // condition that warrants a panic stack trace.</pre></code><tr><td>31<td><code><pre> var brokenPipe bool</pre></code><tr><td>32<td><code><pre> if ne, ok := err.(*net.OpError); ok {</pre></code><tr><td>33<td><code><pre> if se, ok := ne.Err.(*os.SyscallError); ok {</pre></code><tr><td>34<td><code><pre> if strings.Contains(strings.ToLower(se.Error()), "broken pipe") ||</pre></code><tr><td>35<td><code><pre> strings.Contains(strings.ToLower(se.Error()), "connection reset by peer") {</pre></code><tr><td>36<td><code><pre> brokenPipe = true</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre> if brokenPipe {</pre></code><tr><td>41<td><code><pre> c.Abort()</pre></code><tr><td>42<td><code><pre> return</pre></code><tr><td>43<td><code><pre> }</pre></code><tr><td>44<td><code><pre> debugStack := ""</pre></code><tr><td>45<td><code><pre> for _, v := range strings.Split(string(debug.Stack()), "\n") {</pre></code><tr><td>46<td><code><pre> debugStack += "> " + v + "\n"</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> hostname, hostnameErr := os.Hostname()</pre></code><tr><td>49<td><code><pre> if hostnameErr != nil {</pre></code><tr><td>50<td><code><pre> hostname = "unknown"</pre></code><tr><td>51<td><code><pre> }</pre></code><tr><td>52<td><code><pre> buffer, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>53<td><code><pre> defer cb()</pre></code><tr><td>54<td><code><pre></pre></code><tr><td>55<td><code><pre> if tag == language.Chinese {</pre></code><tr><td>56<td><code><pre> buffer.WriteString(fmt.Sprintf("%v \n", err))</pre></code><tr><td>57<td><code><pre> buffer.WriteString(fmt.Sprintf("请求时间:%v \n", time.Now().Format(constant.StdTimeLayout)))</pre></code><tr><td>58<td><code><pre> buffer.WriteString(fmt.Sprintf("主机名称:%v \n", hostname))</pre></code><tr><td>59<td><code><pre> buffer.WriteString(fmt.Sprintf("请求编号:%v \n", c.GetString(fusCtx.KeyTraceID)))</pre></code><tr><td>60<td><code><pre> buffer.WriteString(fmt.Sprintf("请求地址:%v \n",</pre></code><tr><td>61<td><code><pre> c.Request.Method+" "+c.Request.Host+c.Request.RequestURI))</pre></code><tr><td>62<td><code><pre> buffer.WriteString(fmt.Sprintf("请求UA:%v \n", c.Request.UserAgent()))</pre></code><tr><td>63<td><code><pre> buffer.WriteString(fmt.Sprintf("请求IP:%v \n", c.ClientIP()))</pre></code><tr><td>64<td><code><pre> buffer.WriteString(fmt.Sprintf("异常捕获:\n%v", debugStack))</pre></code><tr><td>65<td><code><pre> } else {</pre></code><tr><td>66<td><code><pre> buffer.WriteString(fmt.Sprintf("%v \n", err))</pre></code><tr><td>67<td><code><pre> buffer.WriteString(fmt.Sprintf("RequstTime:%v \n", time.Now().Format(constant.StdTimeLayout)))</pre></code><tr><td>68<td><code><pre> buffer.WriteString(fmt.Sprintf("Hostname:%v \n", hostname))</pre></code><tr><td>69<td><code><pre> buffer.WriteString(fmt.Sprintf("TraceID:%v \n", c.GetString(fusCtx.KeyTraceID)))</pre></code><tr><td>70<td><code><pre> buffer.WriteString(fmt.Sprintf("RequestURI:%v \n",</pre></code><tr><td>71<td><code><pre> c.Request.Method+" "+c.Request.Host+c.Request.RequestURI))</pre></code><tr><td>72<td><code><pre> buffer.WriteString(fmt.Sprintf("UA:%v \n", c.Request.UserAgent()))</pre></code><tr><td>73<td><code><pre> buffer.WriteString(fmt.Sprintf("IP:%v \n", c.ClientIP()))</pre></code><tr><td>74<td><code><pre> buffer.WriteString(fmt.Sprintf("ErrorStack:\n%v", debugStack))</pre></code><tr><td>75<td><code><pre> }</pre></code><tr><td>76<td><code><pre></pre></code><tr><td>77<td><code><pre> if logger != nil {</pre></code><tr><td>78<td><code><pre> logger.Errorf(buffer.String(), fusCtx.New(fusCtx.Gin(c)))</pre></code><tr><td>79<td><code><pre> } else {</pre></code><tr><td>80<td><code><pre> log.Printf(buffer.String())</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre></pre></code><tr><td>83<td><code><pre> c.AbortWithStatusJSON(http.StatusInternalServerError, errMsg)</pre></code><tr><td>84<td><code><pre> }</pre></code><tr><td>85<td><code><pre> }()</pre></code><tr><td>86<td><code><pre> c.Next()</pre></code><tr><td>87<td><code><pre> }</pre></code></table><div class=funcname id=fn_@30:4>func @30:4</div><div class=info><a href=#s_fn_@30:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/trace.go</code>:</div><table class=listing><tr><td>30<td><code><pre>func() bool {</pre></code><tr><td>31<td><code><pre> userID = utils.LookupByFuzzyKeyword[string](c.GetHeader, "user_id")</pre></code><tr><td>32<td><code><pre> return userID != ""</pre></code><tr><td>33<td><code><pre> }</pre></code></table><div class=funcname id=fn_@17:4>func @17:4</div><div class=info><a href=#s_fn_@17:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/trace.go</code>:</div><table class=listing><tr><td>17<td><code><pre>func() bool { traceID = c.GetHeader(fusCtx.KeyTraceID); return traceID != "" }</pre></code></table><div class=funcname id=fn_XSS>func XSS</div><div class=info><a href=#s_fn_XSS>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/xss.go</code>:</div><table class=listing><tr><td>17<td><code><pre>func XSS(whitelistURLs []string) gin.HandlerFunc {</pre></code><tr><td>18<td><code><pre> // Do this once for each unique policy, and use the policy for the life of the</pre></code><tr><td>19<td><code><pre> // program Policy creation/editing is not safe to use in multiple goroutines.</pre></code><tr><td>20<td><code><pre> p := bluemonday.UGCPolicy()</pre></code><tr><td>21<td><code><pre></pre></code><tr><td>22<td><code><pre> return func(c *gin.Context) {</pre></code><tr><td>23<td><code><pre> for _, u := range whitelistURLs {</pre></code><tr><td>24<td><code><pre> if strings.HasPrefix(c.Request.URL.String(), u) {</pre></code><tr><td>25<td><code><pre> c.Next()</pre></code><tr><td>26<td><code><pre> return</pre></code><tr><td>27<td><code><pre> }</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre></pre></code><tr><td>30<td><code><pre> sanitizedQuery, err := xssFilterQuery(p, c.Request.URL.RawQuery)</pre></code><tr><td>31<td><code><pre> if err != nil {</pre></code><tr><td>32<td><code><pre> err = errors.Wrap(err, "filter query")</pre></code><tr><td>33<td><code><pre> _ = c.Error(err)</pre></code><tr><td>34<td><code><pre> c.Abort()</pre></code><tr><td>35<td><code><pre> return</pre></code><tr><td>36<td><code><pre> }</pre></code><tr><td>37<td><code><pre> c.Request.URL.RawQuery = sanitizedQuery</pre></code><tr><td>38<td><code><pre></pre></code><tr><td>39<td><code><pre> var sanitizedBody string</pre></code><tr><td>40<td><code><pre> body, err := c.GetRawData()</pre></code><tr><td>41<td><code><pre> if err != nil {</pre></code><tr><td>42<td><code><pre> err = errors.Wrap(err, "read body")</pre></code><tr><td>43<td><code><pre> _ = c.Error(err)</pre></code><tr><td>44<td><code><pre> c.Abort()</pre></code><tr><td>45<td><code><pre> return</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre></pre></code><tr><td>48<td><code><pre> // xssFilterJSON() will return error when body is empty.</pre></code><tr><td>49<td><code><pre> if len(body) == 0 {</pre></code><tr><td>50<td><code><pre> c.Next()</pre></code><tr><td>51<td><code><pre> return</pre></code><tr><td>52<td><code><pre> }</pre></code><tr><td>53<td><code><pre></pre></code><tr><td>54<td><code><pre> switch binding.Default(c.Request.Method, c.ContentType()) {</pre></code><tr><td>55<td><code><pre> case binding.JSON:</pre></code><tr><td>56<td><code><pre> if sanitizedBody, err = xssFilterJSON(p, string(body)); err != nil {</pre></code><tr><td>57<td><code><pre> err = errors.Wrap(err, "filter json")</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre> case binding.FormMultipart:</pre></code><tr><td>60<td><code><pre> sanitizedBody = xssFilterPlain(p, string(body))</pre></code><tr><td>61<td><code><pre> case binding.Form:</pre></code><tr><td>62<td><code><pre> if sanitizedBody, err = xssFilterQuery(p, string(body)); err != nil {</pre></code><tr><td>63<td><code><pre> err = errors.Wrap(err, "filter form")</pre></code><tr><td>64<td><code><pre> }</pre></code><tr><td>65<td><code><pre> }</pre></code><tr><td>66<td><code><pre> if err != nil {</pre></code><tr><td>67<td><code><pre> _ = c.Error(err)</pre></code><tr><td>68<td><code><pre> c.Abort()</pre></code><tr><td>69<td><code><pre> return</pre></code><tr><td>70<td><code><pre> }</pre></code><tr><td>71<td><code><pre></pre></code><tr><td>72<td><code><pre> c.Request.Body = ioutil.NopCloser(strings.NewReader(sanitizedBody))</pre></code><tr><td>73<td><code><pre> c.Next()</pre></code><tr><td>74<td><code><pre> }</pre></code><tr><td>75<td><code><pre>}</pre></code></table><div class=funcname id=fn_@23:4>func @23:4</div><div class=info><a href=#s_fn_@23:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/trace.go</code>:</div><table class=listing><tr><td>23<td><code><pre>func() bool { traceID = utils.NginxID(); return traceID != "" }</pre></code></table><div class=funcname id=fn_Trace>func Trace</div><div class=info><a href=#s_fn_Trace>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/trace.go</code>:</div><table class=listing><tr><td>11<td><code><pre>func Trace() gin.HandlerFunc {</pre></code><tr><td>12<td><code><pre> return func(c *gin.Context) {</pre></code><tr><td>13<td><code><pre> var (</pre></code><tr><td>14<td><code><pre> userID, traceID string</pre></code><tr><td>15<td><code><pre> )</pre></code><tr><td>16<td><code><pre> utils.IfAny(</pre></code><tr><td>17<td><code><pre> func() bool { traceID = c.GetHeader(fusCtx.KeyTraceID); return traceID != "" },</pre></code><tr><td>18<td><code><pre> func() bool { traceID = c.GetHeader("HTTP_TRACE_ID"); return traceID != "" },</pre></code><tr><td>19<td><code><pre> func() bool {</pre></code><tr><td>20<td><code><pre> traceID = utils.LookupByFuzzyKeyword[string](c.GetHeader, "trace_id")</pre></code><tr><td>21<td><code><pre> return traceID != ""</pre></code><tr><td>22<td><code><pre> },</pre></code><tr><td>23<td><code><pre> func() bool { traceID = utils.NginxID(); return traceID != "" },</pre></code><tr><td>24<td><code><pre> )</pre></code><tr><td>25<td><code><pre> c.Header("Trace-Id", traceID)</pre></code><tr><td>26<td><code><pre> c.Set(fusCtx.KeyTraceID, traceID)</pre></code><tr><td>27<td><code><pre></pre></code><tr><td>28<td><code><pre> utils.IfAny(</pre></code><tr><td>29<td><code><pre> func() bool { userID = c.GetHeader(fusCtx.KeyUserID); return userID != "" },</pre></code><tr><td>30<td><code><pre> func() bool {</pre></code><tr><td>31<td><code><pre> userID = utils.LookupByFuzzyKeyword[string](c.GetHeader, "user_id")</pre></code><tr><td>32<td><code><pre> return userID != ""</pre></code><tr><td>33<td><code><pre> },</pre></code><tr><td>34<td><code><pre> func() bool {</pre></code><tr><td>35<td><code><pre> userID = utils.LookupByFuzzyKeyword[string](c.GetQuery, "user_id")</pre></code><tr><td>36<td><code><pre> return userID != ""</pre></code><tr><td>37<td><code><pre> },</pre></code><tr><td>38<td><code><pre> func() bool {</pre></code><tr><td>39<td><code><pre> userID = utils.LookupByFuzzyKeyword[string](c.GetPostForm, "user_id")</pre></code><tr><td>40<td><code><pre> return userID != ""</pre></code><tr><td>41<td><code><pre> },</pre></code><tr><td>42<td><code><pre> )</pre></code><tr><td>43<td><code><pre> c.Set(fusCtx.KeyUserID, userID)</pre></code><tr><td>44<td><code><pre> c.Next()</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre>}</pre></code></table><div class=funcname id=fn_Logging>func Logging</div><div class=info><a href=#s_fn_Logging>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/logging.go</code>:</div><table class=listing><tr><td>129<td><code><pre>func Logging(ctx context.Context, appName string, metricsHeaders []string, logger resty.Logger) gin.HandlerFunc {</pre></code><tr><td>130<td><code><pre> return func(c *gin.Context) {</pre></code><tr><td>131<td><code><pre> reqURL := clone.Clone(c.Request.URL)</pre></code><tr><td>132<td><code><pre> defer logging(ctx, c, logger, reqURL, metricsHeaders, appName)</pre></code><tr><td>133<td><code><pre></pre></code><tr><td>134<td><code><pre> c.Next()</pre></code><tr><td>135<td><code><pre> }</pre></code><tr><td>136<td><code><pre></pre></code><tr><td>137<td><code><pre>}</pre></code></table><div class=funcname id=fn_Gateway>func Gateway</div><div class=info><a href=#s_fn_Gateway>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/gateway.go</code>:</div><table class=listing><tr><td>9<td><code><pre>func Gateway(c *gin.Context) {</pre></code><tr><td>10<td><code><pre> consts.SetReqStartTime(c)</pre></code><tr><td>11<td><code><pre>}</pre></code></table><div class=funcname id=fn_Cors>func Cors</div><div class=info><a href=#s_fn_Cors>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/cors.go</code>:</div><table class=listing><tr><td>11<td><code><pre>func Cors() gin.HandlerFunc {</pre></code><tr><td>12<td><code><pre> return func(c *gin.Context) {</pre></code><tr><td>13<td><code><pre> origin := c.Request.Header.Get("Origin")</pre></code><tr><td>14<td><code><pre> var headerKeys []string</pre></code><tr><td>15<td><code><pre> for k := range c.Request.Header {</pre></code><tr><td>16<td><code><pre> headerKeys = append(headerKeys, k)</pre></code><tr><td>17<td><code><pre> }</pre></code><tr><td>18<td><code><pre> corsHeader := c.GetHeader("Access-Control-Request-Headers")</pre></code><tr><td>19<td><code><pre> headerKeys = append(headerKeys, strings.Split(corsHeader, ",")...)</pre></code><tr><td>20<td><code><pre></pre></code><tr><td>21<td><code><pre> headerStr := strings.Join(headerKeys, ", ")</pre></code><tr><td>22<td><code><pre> if headerStr != "" {</pre></code><tr><td>23<td><code><pre> headerStr = fmt.Sprintf("access-control-allow-origin, access-control-allow-headers, %s", headerStr)</pre></code><tr><td>24<td><code><pre> } else {</pre></code><tr><td>25<td><code><pre> headerStr = "access-control-allow-origin, access-control-allow-headers"</pre></code><tr><td>26<td><code><pre> }</pre></code><tr><td>27<td><code><pre> if origin != "" {</pre></code><tr><td>28<td><code><pre> c.Writer.Header().Set("Access-Control-Allow-Origin", origin)</pre></code><tr><td>29<td><code><pre> c.Writer.Header().Set("Access-Control-Allow-Headers", headerStr)</pre></code><tr><td>30<td><code><pre> c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT, DELETE")</pre></code><tr><td>31<td><code><pre> c.Writer.Header().Set("Access-Control-Expose-Headers",</pre></code><tr><td>32<td><code><pre> "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type")</pre></code><tr><td>33<td><code><pre> c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")</pre></code><tr><td>34<td><code><pre> }</pre></code><tr><td>35<td><code><pre></pre></code><tr><td>36<td><code><pre> if c.Request.Method == "OPTIONS" {</pre></code><tr><td>37<td><code><pre> c.AbortWithStatusJSON(http.StatusNoContent, "no content")</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre> c.Next()</pre></code><tr><td>40<td><code><pre> }</pre></code><tr><td>41<td><code><pre>}</pre></code></table><div class=funcname id=fn_logging>func logging</div><div class=info><a href=#s_fn_logging>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/logging.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func logging(rootCtx context.Context, c *gin.Context, logger resty.Logger, rawURL *url.URL, metricsHeaders []string,</pre></code><tr><td>39<td><code><pre> appName string) {</pre></code><tr><td>40<td><code><pre> ctx := fusCtx.New(fusCtx.Gin(c))</pre></code><tr><td>41<td><code><pre> cost := float64(consts.GetReqCost(c)) / float64(time.Millisecond)</pre></code><tr><td>42<td><code><pre> status := c.Writer.Status()</pre></code><tr><td>43<td><code><pre> fields := fusLog.Fields{</pre></code><tr><td>44<td><code><pre> "path": rawURL.Path,</pre></code><tr><td>45<td><code><pre> "method": c.Request.Method,</pre></code><tr><td>46<td><code><pre> "status": status,</pre></code><tr><td>47<td><code><pre> "referer": c.Request.Referer(),</pre></code><tr><td>48<td><code><pre> "req_size": c.Request.ContentLength,</pre></code><tr><td>49<td><code><pre> "rsp_size": c.Writer.Size(),</pre></code><tr><td>50<td><code><pre> "cost": cost,</pre></code><tr><td>51<td><code><pre> "user_agent": c.Request.UserAgent(),</pre></code><tr><td>52<td><code><pre> "client_addr": c.ClientIP(),</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre></pre></code><tr><td>55<td><code><pre> // skip health check logging</pre></code><tr><td>56<td><code><pre> if rawURL.Path == "/health" && c.Request.Method == http.MethodGet {</pre></code><tr class=miss><td>57<td><code><pre> return</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre></pre></code><tr><td>60<td><code><pre> msg := fmt.Sprintf(</pre></code><tr><td>61<td><code><pre> "%s -> %s %s %d %d %d (%.2fms)",</pre></code><tr><td>62<td><code><pre> c.ClientIP(), utils.LocalIP.String(),</pre></code><tr><td>63<td><code><pre> strconv.Quote(fmt.Sprintf("%s %s", c.Request.Method, rawURL)),</pre></code><tr><td>64<td><code><pre> c.Request.ContentLength, c.Writer.Size(), status, cost,</pre></code><tr><td>65<td><code><pre> )</pre></code><tr><td>66<td><code><pre></pre></code><tr><td>67<td><code><pre> if logger != nil {</pre></code><tr><td>68<td><code><pre> switch {</pre></code><tr><td>69<td><code><pre> case status < http.StatusBadRequest:</pre></code><tr><td>70<td><code><pre> logger.Debugf(msg, ctx, fields)</pre></code><tr><td>71<td><code><pre> case status >= http.StatusBadRequest && status < http.StatusInternalServerError:</pre></code><tr class=miss><td>72<td><code><pre> logger.Warnf(msg, ctx, fields)</pre></code><tr><td>73<td><code><pre> default:</pre></code><tr><td>74<td><code><pre> logger.Errorf(msg, ctx, fields)</pre></code><tr><td>75<td><code><pre> }</pre></code><tr><td>76<td><code><pre> } else {</pre></code><tr class=miss><td>77<td><code><pre> log.Printf(msg+" %s", utils.MustJsonMarshal(fields))</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre></pre></code><tr><td>80<td><code><pre> headerLabels := make(map[string]string, len(metricsHeaders))</pre></code><tr><td>81<td><code><pre> for _, metricsHeader := range metricsHeaders {</pre></code><tr class=miss><td>82<td><code><pre> headerLabels[metricsHeader] = c.Request.Header.Get(metricsHeader)</pre></code><tr><td>83<td><code><pre> }</pre></code><tr><td>84<td><code><pre></pre></code><tr><td>85<td><code><pre> go metricsLogging(rootCtx, appName, rawURL.Path, c.Request.Method, headerLabels,</pre></code><tr><td>86<td><code><pre> status, c.Writer.Size(), c.Request.ContentLength, cost)</pre></code><tr><td>87<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricsLogging>func metricsLogging</div><div class=info><a href=#s_fn_metricsLogging>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/logging.go</code>:</div><table class=listing><tr><td>89<td><code><pre>func metricsLogging(ctx context.Context, appName, path, method string, headerLabels map[string]string,</pre></code><tr><td>90<td><code><pre> status, rspSize int, reqSize int64, cost float64) {</pre></code><tr><td>91<td><code><pre> select {</pre></code><tr><td>92<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>93<td><code><pre> return</pre></code><tr><td>94<td><code><pre> default:</pre></code><tr><td>95<td><code><pre> }</pre></code><tr><td>96<td><code><pre></pre></code><tr><td>97<td><code><pre> labels := []metrics.Label{</pre></code><tr><td>98<td><code><pre> {Key: "path", Value: path},</pre></code><tr><td>99<td><code><pre> {Key: "method", Value: method},</pre></code><tr><td>100<td><code><pre> {Key: "status", Value: cast.ToString(status)},</pre></code><tr><td>101<td><code><pre> {Key: "req_size", Value: cast.ToString(reqSize)},</pre></code><tr><td>102<td><code><pre> {Key: "rsp_size", Value: cast.ToString(rspSize)},</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre> for k, v := range headerLabels {</pre></code><tr class=miss><td>105<td><code><pre> labels = append(labels, metrics.Label{Key: strcase.ToSnake(k), Value: v})</pre></code><tr><td>106<td><code><pre> }</pre></code><tr><td>107<td><code><pre></pre></code><tr><td>108<td><code><pre> app := config.Use(appName).AppName()</pre></code><tr><td>109<td><code><pre> latencyKey := append([]string{app}, metricsLatencyKey...)</pre></code><tr><td>110<td><code><pre> totalKey := append([]string{app}, metricsTotalKey...)</pre></code><tr><td>111<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr><td>112<td><code><pre> select {</pre></code><tr><td>113<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>114<td><code><pre> return</pre></code><tr><td>115<td><code><pre> default:</pre></code><tr><td>116<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr><td>117<td><code><pre> m.IncrCounter(ctx, totalKey, 1, metrics.Labels(labels))</pre></code><tr><td>118<td><code><pre> m.AddSample(ctx, latencyKey, cost, metrics.Labels(labels),</pre></code><tr><td>119<td><code><pre> metrics.PrometheusBuckets(metricsLatencyBuckets))</pre></code><tr><td>120<td><code><pre> } else {</pre></code><tr class=miss><td>121<td><code><pre> m.IncrCounter(ctx, metricsTotalKey, 1, metrics.Labels(labels))</pre></code><tr class=miss><td>122<td><code><pre> m.AddSample(ctx, metricsLatencyKey, cost, metrics.Labels(labels),</pre></code><tr><td>123<td><code><pre> metrics.PrometheusBuckets(metricsLatencyBuckets))</pre></code><tr><td>124<td><code><pre> }</pre></code><tr><td>125<td><code><pre> }</pre></code><tr><td>126<td><code><pre> }</pre></code><tr><td>127<td><code><pre>}</pre></code></table><div class=funcname id=fn_@12:9>func @12:9</div><div class=info><a href=#s_fn_@12:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/cors.go</code>:</div><table class=listing><tr><td>12<td><code><pre>func(c *gin.Context) {</pre></code><tr><td>13<td><code><pre> origin := c.Request.Header.Get("Origin")</pre></code><tr><td>14<td><code><pre> var headerKeys []string</pre></code><tr><td>15<td><code><pre> for k := range c.Request.Header {</pre></code><tr><td>16<td><code><pre> headerKeys = append(headerKeys, k)</pre></code><tr><td>17<td><code><pre> }</pre></code><tr><td>18<td><code><pre> corsHeader := c.GetHeader("Access-Control-Request-Headers")</pre></code><tr><td>19<td><code><pre> headerKeys = append(headerKeys, strings.Split(corsHeader, ",")...)</pre></code><tr><td>20<td><code><pre></pre></code><tr><td>21<td><code><pre> headerStr := strings.Join(headerKeys, ", ")</pre></code><tr><td>22<td><code><pre> if headerStr != "" {</pre></code><tr><td>23<td><code><pre> headerStr = fmt.Sprintf("access-control-allow-origin, access-control-allow-headers, %s", headerStr)</pre></code><tr><td>24<td><code><pre> } else {</pre></code><tr class=miss><td>25<td><code><pre> headerStr = "access-control-allow-origin, access-control-allow-headers"</pre></code><tr><td>26<td><code><pre> }</pre></code><tr><td>27<td><code><pre> if origin != "" {</pre></code><tr class=miss><td>28<td><code><pre> c.Writer.Header().Set("Access-Control-Allow-Origin", origin)</pre></code><tr class=miss><td>29<td><code><pre> c.Writer.Header().Set("Access-Control-Allow-Headers", headerStr)</pre></code><tr class=miss><td>30<td><code><pre> c.Writer.Header().Set("Access-Control-Allow-Methods", "POST, OPTIONS, GET, PUT, DELETE")</pre></code><tr class=miss><td>31<td><code><pre> c.Writer.Header().Set("Access-Control-Expose-Headers",</pre></code><tr><td>32<td><code><pre> "Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type")</pre></code><tr class=miss><td>33<td><code><pre> c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")</pre></code><tr><td>34<td><code><pre> }</pre></code><tr><td>35<td><code><pre></pre></code><tr><td>36<td><code><pre> if c.Request.Method == "OPTIONS" {</pre></code><tr class=miss><td>37<td><code><pre> c.AbortWithStatusJSON(http.StatusNoContent, "no content")</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre> c.Next()</pre></code><tr><td>40<td><code><pre> }</pre></code></table><div class=funcname id=fn_@27:9>func @27:9</div><div class=info><a href=#s_fn_@27:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/recover.go</code>:</div><table class=listing><tr><td>27<td><code><pre>func() {</pre></code><tr><td>28<td><code><pre> if err := recover(); err != nil {</pre></code><tr><td>29<td><code><pre> // Check for a broken connection, as it is not really a</pre></code><tr><td>30<td><code><pre> // condition that warrants a panic stack trace.</pre></code><tr><td>31<td><code><pre> var brokenPipe bool</pre></code><tr><td>32<td><code><pre> if ne, ok := err.(*net.OpError); ok {</pre></code><tr class=miss><td>33<td><code><pre> if se, ok := ne.Err.(*os.SyscallError); ok {</pre></code><tr class=miss><td>34<td><code><pre> if strings.Contains(strings.ToLower(se.Error()), "broken pipe") ||</pre></code><tr><td>35<td><code><pre> strings.Contains(strings.ToLower(se.Error()), "connection reset by peer") {</pre></code><tr class=miss><td>36<td><code><pre> brokenPipe = true</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre> if brokenPipe {</pre></code><tr class=miss><td>41<td><code><pre> c.Abort()</pre></code><tr class=miss><td>42<td><code><pre> return</pre></code><tr><td>43<td><code><pre> }</pre></code><tr><td>44<td><code><pre> debugStack := ""</pre></code><tr><td>45<td><code><pre> for _, v := range strings.Split(string(debug.Stack()), "\n") {</pre></code><tr><td>46<td><code><pre> debugStack += "> " + v + "\n"</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> hostname, hostnameErr := os.Hostname()</pre></code><tr><td>49<td><code><pre> if hostnameErr != nil {</pre></code><tr class=miss><td>50<td><code><pre> hostname = "unknown"</pre></code><tr><td>51<td><code><pre> }</pre></code><tr><td>52<td><code><pre> buffer, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>53<td><code><pre> defer cb()</pre></code><tr><td>54<td><code><pre></pre></code><tr><td>55<td><code><pre> if tag == language.Chinese {</pre></code><tr><td>56<td><code><pre> buffer.WriteString(fmt.Sprintf("%v \n", err))</pre></code><tr><td>57<td><code><pre> buffer.WriteString(fmt.Sprintf("请求时间:%v \n", time.Now().Format(constant.StdTimeLayout)))</pre></code><tr><td>58<td><code><pre> buffer.WriteString(fmt.Sprintf("主机名称:%v \n", hostname))</pre></code><tr><td>59<td><code><pre> buffer.WriteString(fmt.Sprintf("请求编号:%v \n", c.GetString(fusCtx.KeyTraceID)))</pre></code><tr><td>60<td><code><pre> buffer.WriteString(fmt.Sprintf("请求地址:%v \n",</pre></code><tr><td>61<td><code><pre> c.Request.Method+" "+c.Request.Host+c.Request.RequestURI))</pre></code><tr><td>62<td><code><pre> buffer.WriteString(fmt.Sprintf("请求UA:%v \n", c.Request.UserAgent()))</pre></code><tr><td>63<td><code><pre> buffer.WriteString(fmt.Sprintf("请求IP:%v \n", c.ClientIP()))</pre></code><tr><td>64<td><code><pre> buffer.WriteString(fmt.Sprintf("异常捕获:\n%v", debugStack))</pre></code><tr><td>65<td><code><pre> } else {</pre></code><tr class=miss><td>66<td><code><pre> buffer.WriteString(fmt.Sprintf("%v \n", err))</pre></code><tr class=miss><td>67<td><code><pre> buffer.WriteString(fmt.Sprintf("RequstTime:%v \n", time.Now().Format(constant.StdTimeLayout)))</pre></code><tr class=miss><td>68<td><code><pre> buffer.WriteString(fmt.Sprintf("Hostname:%v \n", hostname))</pre></code><tr class=miss><td>69<td><code><pre> buffer.WriteString(fmt.Sprintf("TraceID:%v \n", c.GetString(fusCtx.KeyTraceID)))</pre></code><tr class=miss><td>70<td><code><pre> buffer.WriteString(fmt.Sprintf("RequestURI:%v \n",</pre></code><tr><td>71<td><code><pre> c.Request.Method+" "+c.Request.Host+c.Request.RequestURI))</pre></code><tr class=miss><td>72<td><code><pre> buffer.WriteString(fmt.Sprintf("UA:%v \n", c.Request.UserAgent()))</pre></code><tr class=miss><td>73<td><code><pre> buffer.WriteString(fmt.Sprintf("IP:%v \n", c.ClientIP()))</pre></code><tr class=miss><td>74<td><code><pre> buffer.WriteString(fmt.Sprintf("ErrorStack:\n%v", debugStack))</pre></code><tr><td>75<td><code><pre> }</pre></code><tr><td>76<td><code><pre></pre></code><tr><td>77<td><code><pre> if logger != nil {</pre></code><tr><td>78<td><code><pre> logger.Errorf(buffer.String(), fusCtx.New(fusCtx.Gin(c)))</pre></code><tr><td>79<td><code><pre> } else {</pre></code><tr class=miss><td>80<td><code><pre> log.Printf(buffer.String())</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre></pre></code><tr><td>83<td><code><pre> c.AbortWithStatusJSON(http.StatusInternalServerError, errMsg)</pre></code><tr><td>84<td><code><pre> }</pre></code><tr><td>85<td><code><pre> }</pre></code></table><div class=funcname id=fn_@22:9>func @22:9</div><div class=info><a href=#s_fn_@22:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/xss.go</code>:</div><table class=listing><tr><td>22<td><code><pre>func(c *gin.Context) {</pre></code><tr><td>23<td><code><pre> for _, u := range whitelistURLs {</pre></code><tr><td>24<td><code><pre> if strings.HasPrefix(c.Request.URL.String(), u) {</pre></code><tr><td>25<td><code><pre> c.Next()</pre></code><tr><td>26<td><code><pre> return</pre></code><tr><td>27<td><code><pre> }</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre></pre></code><tr class=miss><td>30<td><code><pre> sanitizedQuery, err := xssFilterQuery(p, c.Request.URL.RawQuery)</pre></code><tr class=miss><td>31<td><code><pre> if err != nil {</pre></code><tr class=miss><td>32<td><code><pre> err = errors.Wrap(err, "filter query")</pre></code><tr class=miss><td>33<td><code><pre> _ = c.Error(err)</pre></code><tr class=miss><td>34<td><code><pre> c.Abort()</pre></code><tr class=miss><td>35<td><code><pre> return</pre></code><tr><td>36<td><code><pre> }</pre></code><tr class=miss><td>37<td><code><pre> c.Request.URL.RawQuery = sanitizedQuery</pre></code><tr><td>38<td><code><pre></pre></code><tr class=miss><td>39<td><code><pre> var sanitizedBody string</pre></code><tr class=miss><td>40<td><code><pre> body, err := c.GetRawData()</pre></code><tr class=miss><td>41<td><code><pre> if err != nil {</pre></code><tr class=miss><td>42<td><code><pre> err = errors.Wrap(err, "read body")</pre></code><tr class=miss><td>43<td><code><pre> _ = c.Error(err)</pre></code><tr class=miss><td>44<td><code><pre> c.Abort()</pre></code><tr class=miss><td>45<td><code><pre> return</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre></pre></code><tr><td>48<td><code><pre> // xssFilterJSON() will return error when body is empty.</pre></code><tr class=miss><td>49<td><code><pre> if len(body) == 0 {</pre></code><tr class=miss><td>50<td><code><pre> c.Next()</pre></code><tr class=miss><td>51<td><code><pre> return</pre></code><tr><td>52<td><code><pre> }</pre></code><tr><td>53<td><code><pre></pre></code><tr class=miss><td>54<td><code><pre> switch binding.Default(c.Request.Method, c.ContentType()) {</pre></code><tr><td>55<td><code><pre> case binding.JSON:</pre></code><tr class=miss><td>56<td><code><pre> if sanitizedBody, err = xssFilterJSON(p, string(body)); err != nil {</pre></code><tr class=miss><td>57<td><code><pre> err = errors.Wrap(err, "filter json")</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre> case binding.FormMultipart:</pre></code><tr class=miss><td>60<td><code><pre> sanitizedBody = xssFilterPlain(p, string(body))</pre></code><tr><td>61<td><code><pre> case binding.Form:</pre></code><tr class=miss><td>62<td><code><pre> if sanitizedBody, err = xssFilterQuery(p, string(body)); err != nil {</pre></code><tr class=miss><td>63<td><code><pre> err = errors.Wrap(err, "filter form")</pre></code><tr><td>64<td><code><pre> }</pre></code><tr><td>65<td><code><pre> }</pre></code><tr class=miss><td>66<td><code><pre> if err != nil {</pre></code><tr class=miss><td>67<td><code><pre> _ = c.Error(err)</pre></code><tr class=miss><td>68<td><code><pre> c.Abort()</pre></code><tr class=miss><td>69<td><code><pre> return</pre></code><tr><td>70<td><code><pre> }</pre></code><tr><td>71<td><code><pre></pre></code><tr class=miss><td>72<td><code><pre> c.Request.Body = ioutil.NopCloser(strings.NewReader(sanitizedBody))</pre></code><tr class=miss><td>73<td><code><pre> c.Next()</pre></code><tr><td>74<td><code><pre> }</pre></code></table><div class=funcname id=fn_xssFilterJSON>func xssFilterJSON</div><div class=info><a href=#s_fn_xssFilterJSON>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/xss.go</code>:</div><table class=listing><tr><td>93<td><code><pre>func xssFilterJSON(p *bluemonday.Policy, s string) (string, error) {</pre></code><tr class=miss><td>94<td><code><pre> var data any</pre></code><tr class=miss><td>95<td><code><pre> if err := json.Unmarshal([]byte(s), &data); err != nil {</pre></code><tr class=miss><td>96<td><code><pre> return "", err</pre></code><tr><td>97<td><code><pre> }</pre></code><tr><td>98<td><code><pre></pre></code><tr class=miss><td>99<td><code><pre> b := strings.Builder{}</pre></code><tr class=miss><td>100<td><code><pre> e := json.NewEncoder(&b)</pre></code><tr class=miss><td>101<td><code><pre> e.SetEscapeHTML(false)</pre></code><tr class=miss><td>102<td><code><pre> if err := e.Encode(xssFilterJSONData(p, data)); err != nil {</pre></code><tr class=miss><td>103<td><code><pre> return "", err</pre></code><tr><td>104<td><code><pre> }</pre></code><tr><td>105<td><code><pre> // use `TrimSpace` to trim newline char add by `Encode`.</pre></code><tr class=miss><td>106<td><code><pre> return strings.TrimSpace(b.String()), nil</pre></code><tr><td>107<td><code><pre>}</pre></code></table><div class=funcname id=fn_xssFilterJSONData>func xssFilterJSONData</div><div class=info><a href=#s_fn_xssFilterJSONData>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/xss.go</code>:</div><table class=listing><tr><td>109<td><code><pre>func xssFilterJSONData(p *bluemonday.Policy, d any) any {</pre></code><tr class=miss><td>110<td><code><pre> switch data := d.(type) {</pre></code><tr><td>111<td><code><pre> case []any:</pre></code><tr class=miss><td>112<td><code><pre> for i, v := range data {</pre></code><tr class=miss><td>113<td><code><pre> data[i] = xssFilterJSONData(p, v)</pre></code><tr><td>114<td><code><pre> }</pre></code><tr class=miss><td>115<td><code><pre> return data</pre></code><tr><td>116<td><code><pre> case map[string]any:</pre></code><tr class=miss><td>117<td><code><pre> for k, v := range data {</pre></code><tr class=miss><td>118<td><code><pre> data[k] = xssFilterJSONData(p, v)</pre></code><tr><td>119<td><code><pre> }</pre></code><tr class=miss><td>120<td><code><pre> return data</pre></code><tr><td>121<td><code><pre> case string:</pre></code><tr class=miss><td>122<td><code><pre> return xssFilterPlain(p, data)</pre></code><tr><td>123<td><code><pre> default:</pre></code><tr class=miss><td>124<td><code><pre> return data</pre></code><tr><td>125<td><code><pre> }</pre></code><tr><td>126<td><code><pre>}</pre></code></table><div class=funcname id=fn_xssFilterQuery>func xssFilterQuery</div><div class=info><a href=#s_fn_xssFilterQuery>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/xss.go</code>:</div><table class=listing><tr><td>77<td><code><pre>func xssFilterQuery(p *bluemonday.Policy, s string) (string, error) {</pre></code><tr class=miss><td>78<td><code><pre> values, err := url.ParseQuery(s)</pre></code><tr class=miss><td>79<td><code><pre> if err != nil {</pre></code><tr class=miss><td>80<td><code><pre> return "", err</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre></pre></code><tr class=miss><td>83<td><code><pre> for k, v := range values {</pre></code><tr class=miss><td>84<td><code><pre> values.Del(k)</pre></code><tr class=miss><td>85<td><code><pre> for _, vv := range v {</pre></code><tr class=miss><td>86<td><code><pre> values.Add(k, xssFilterPlain(p, vv))</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre> }</pre></code><tr><td>89<td><code><pre></pre></code><tr class=miss><td>90<td><code><pre> return values.Encode(), nil</pre></code><tr><td>91<td><code><pre>}</pre></code></table><div class=funcname id=fn_xssFilterPlain>func xssFilterPlain</div><div class=info><a href=#s_fn_xssFilterPlain>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/middleware/xss.go</code>:</div><table class=listing><tr><td>128<td><code><pre>func xssFilterPlain(p *bluemonday.Policy, s string) string {</pre></code><tr class=miss><td>129<td><code><pre> sanitized := p.Sanitize(s)</pre></code><tr class=miss><td>130<td><code><pre> return html.UnescapeString(sanitized)</pre></code><tr><td>131<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/http/parser class=funcname>Package Overview: github.com/wfusion/gofusion/http/parser 31 <span class=packageTotal>47.4%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_MapFormByTag><td><code><a href=#fn_MapFormByTag>MapFormByTag(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>100.0%</code><td class=linecount><code>10/10</code><tr id=s_fn_mappingByPtr><td><code><a href=#fn_mappingByPtr>mappingByPtr(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_ApplicationFormUrlencodedParser.PreParse><td><code><a href=#fn_ApplicationFormUrlencodedParser.PreParse>ApplicationFormUrlencodedParser.PreParse(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/application_x_www_form_urlencoded.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_formSource.TrySet><td><code><a href=#fn_formSource.TrySet>formSource.TrySet(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_MultipartFormDataParser.transformField><td><code><a href=#fn_MultipartFormDataParser.transformField>MultipartFormDataParser.transformField(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>92.3%</code><td class=linecount><code>12/13</code><tr id=s_fn_mapping><td><code><a href=#fn_mapping>mapping(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>85.3%</code><td class=linecount><code>29/34</code><tr id=s_fn_setSlice><td><code><a href=#fn_setSlice>setSlice(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_setIntField><td><code><a href=#fn_setIntField>setIntField(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_MultipartFormDataParser.lookupFieldByTag><td><code><a href=#fn_MultipartFormDataParser.lookupFieldByTag>MultipartFormDataParser.lookupFieldByTag(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_setArray><td><code><a href=#fn_setArray>setArray(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_MultipartFormDataParser.PreParse><td><code><a href=#fn_MultipartFormDataParser.PreParse>MultipartFormDataParser.PreParse(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_GetByContentType><td><code><a href=#fn_GetByContentType>GetByContentType(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/parser.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_head><td><code><a href=#fn_head>head(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_tryToSetValue><td><code><a href=#fn_tryToSetValue>tryToSetValue(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>73.3%</code><td class=linecount><code>11/15</code><tr id=s_fn_MultipartFormDataParser.Parse><td><code><a href=#fn_MultipartFormDataParser.Parse>MultipartFormDataParser.Parse(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>72.0%</code><td class=linecount><code>18/25</code><tr id=s_fn_ApplicationFormUrlencodedParser.Parse><td><code><a href=#fn_ApplicationFormUrlencodedParser.Parse>ApplicationFormUrlencodedParser.Parse(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/application_x_www_form_urlencoded.go</code><td class=percent><code>71.4%</code><td class=linecount><code>5/7</code><tr id=s_fn_setByForm><td><code><a href=#fn_setByForm>setByForm(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>61.1%</code><td class=linecount><code>11/18</code><tr id=s_fn_setFormMap><td><code><a href=#fn_setFormMap>setFormMap(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>58.8%</code><td class=linecount><code>10/17</code><tr id=s_fn_@48:8><td><code><a href=#fn_@48:8>@48:8(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>50.0%</code><td class=linecount><code>1/2</code><tr id=s_fn_setWithProperType><td><code><a href=#fn_setWithProperType>setWithProperType(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>17.4%</code><td class=linecount><code>4/23</code><tr id=s_fn_setTimeField><td><code><a href=#fn_setTimeField>setTimeField(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/29</code><tr id=s_fn_setFloatField><td><code><a href=#fn_setFloatField>setFloatField(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_setBoolField><td><code><a href=#fn_setBoolField>setBoolField(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_setUintField><td><code><a href=#fn_setUintField>setUintField(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_setTimeDuration><td><code><a href=#fn_setTimeDuration>setTimeDuration(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/form_mapping.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_@105:20><td><code><a href=#fn_@105:20>@105:20(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@100:20><td><code><a href=#fn_@100:20>@100:20(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@101:20><td><code><a href=#fn_@101:20>@101:20(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@102:20><td><code><a href=#fn_@102:20>@102:20(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@103:20><td><code><a href=#fn_@103:20>@103:20(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@104:20><td><code><a href=#fn_@104:20>@104:20(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@99:20><td><code><a href=#fn_@99:20>@99:20(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@106:20><td><code><a href=#fn_@106:20>@106:20(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@107:20><td><code><a href=#fn_@107:20>@107:20(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@108:20><td><code><a href=#fn_@108:20>@108:20(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@109:20><td><code><a href=#fn_@109:20>@109:20(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@110:20><td><code><a href=#fn_@110:20>@110:20(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_ApplicationJsonParser.Parse><td><code><a href=#fn_ApplicationJsonParser.Parse>ApplicationJsonParser.Parse(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/application_json.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@112:20><td><code><a href=#fn_@112:20>@112:20(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@111:20><td><code><a href=#fn_@111:20>@111:20(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_ApplicationJsonParser.PreParse><td><code><a href=#fn_ApplicationJsonParser.PreParse>ApplicationJsonParser.PreParse(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/application_json.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_malformedRequest><td><code><a href=#fn_malformedRequest>malformedRequest(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/parser.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_unsupportedContentType><td><code><a href=#fn_unsupportedContentType>unsupportedContentType(...)</a></code><td><code>github.com/wfusion/gofusion/http/parser/parser.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_MapFormByTag>func MapFormByTag</div><div class=info><a href=#s_fn_MapFormByTag>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>28<td><code><pre>func MapFormByTag(ptr any, form map[string][]string, tag string) error {</pre></code><tr><td>29<td><code><pre> // Check if ptr is a map</pre></code><tr><td>30<td><code><pre> ptrVal := reflect.ValueOf(ptr)</pre></code><tr><td>31<td><code><pre> var pointed any</pre></code><tr><td>32<td><code><pre> if ptrVal.Kind() == reflect.Ptr {</pre></code><tr><td>33<td><code><pre> ptrVal = ptrVal.Elem()</pre></code><tr><td>34<td><code><pre> pointed = ptr</pre></code><tr><td>35<td><code><pre> }</pre></code><tr><td>36<td><code><pre> if ptrVal.Type() == mapStringInterfaceSliceType ||</pre></code><tr><td>37<td><code><pre> (ptrVal.Kind() == reflect.Map && ptrVal.Type().Key().Kind() == reflect.String) {</pre></code><tr><td>38<td><code><pre> if pointed != nil {</pre></code><tr><td>39<td><code><pre> ptr = pointed</pre></code><tr><td>40<td><code><pre> }</pre></code><tr><td>41<td><code><pre> return setFormMap(ptr, form)</pre></code><tr><td>42<td><code><pre> }</pre></code><tr><td>43<td><code><pre></pre></code><tr><td>44<td><code><pre> return mappingByPtr(ptr, formSource(form), tag)</pre></code><tr><td>45<td><code><pre>}</pre></code></table><div class=funcname id=fn_mappingByPtr>func mappingByPtr</div><div class=info><a href=#s_fn_mappingByPtr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>62<td><code><pre>func mappingByPtr(ptr any, setter setter, tag string) error {</pre></code><tr><td>63<td><code><pre> _, err := mapping(reflect.ValueOf(ptr), emptyField, setter, tag)</pre></code><tr><td>64<td><code><pre> return err</pre></code><tr><td>65<td><code><pre>}</pre></code></table><div class=funcname id=fn_ApplicationFormUrlencodedParser.PreParse>func ApplicationFormUrlencodedParser.PreParse</div><div class=info><a href=#s_fn_ApplicationFormUrlencodedParser.PreParse>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/application_x_www_form_urlencoded.go</code>:</div><table class=listing><tr><td>11<td><code><pre>func (a *ApplicationFormUrlencodedParser) PreParse(args map[string]string) error {</pre></code><tr><td>12<td><code><pre> return nil</pre></code><tr><td>13<td><code><pre>}</pre></code></table><div class=funcname id=fn_formSource.TrySet>func formSource.TrySet</div><div class=info><a href=#s_fn_formSource.TrySet>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>57<td><code><pre>func (form formSource) TrySet(value reflect.Value, field reflect.StructField,</pre></code><tr><td>58<td><code><pre> tagValue string, opt setOptions) (isSetted bool, err error) {</pre></code><tr><td>59<td><code><pre> return setByForm(value, field, form, tagValue, opt)</pre></code><tr><td>60<td><code><pre>}</pre></code></table><div class=funcname id=fn_MultipartFormDataParser.transformField>func MultipartFormDataParser.transformField</div><div class=info><a href=#s_fn_MultipartFormDataParser.transformField>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr><td>116<td><code><pre>func (m *MultipartFormDataParser) transformField(f reflect.Value, param []byte) (err error) {</pre></code><tr><td>117<td><code><pre> ft := f.Type()</pre></code><tr><td>118<td><code><pre> if ft.Kind() == reflect.Ptr {</pre></code><tr><td>119<td><code><pre> ft = ft.Elem()</pre></code><tr><td>120<td><code><pre> if f.IsNil() {</pre></code><tr><td>121<td><code><pre> f.Set(reflect.New(ft))</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre> f = f.Elem()</pre></code><tr><td>124<td><code><pre> }</pre></code><tr><td>125<td><code><pre></pre></code><tr><td>126<td><code><pre> if byteSliceType.ConvertibleTo(ft) {</pre></code><tr><td>127<td><code><pre> f.Set(reflect.ValueOf(param).Convert(ft))</pre></code><tr><td>128<td><code><pre> return</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre></pre></code><tr><td>131<td><code><pre> caster, ok := castReflectTypeMap[ft.Kind()]</pre></code><tr><td>132<td><code><pre> if !ok {</pre></code><tr><td>133<td><code><pre> return json.Unmarshal(param, f.Addr().Interface())</pre></code><tr><td>134<td><code><pre> }</pre></code><tr><td>135<td><code><pre></pre></code><tr class=miss><td>136<td><code><pre> return caster(f, param)</pre></code><tr><td>137<td><code><pre>}</pre></code></table><div class=funcname id=fn_mapping>func mapping</div><div class=info><a href=#s_fn_mapping>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>67<td><code><pre>func mapping(value reflect.Value, field reflect.StructField, setter setter, tag string) (bool, error) {</pre></code><tr><td>68<td><code><pre> if field.Tag.Get(tag) == "-" { // just ignoring this field</pre></code><tr class=miss><td>69<td><code><pre> return false, nil</pre></code><tr><td>70<td><code><pre> }</pre></code><tr><td>71<td><code><pre></pre></code><tr><td>72<td><code><pre> var vKind = value.Kind()</pre></code><tr><td>73<td><code><pre></pre></code><tr><td>74<td><code><pre> if vKind == reflect.Ptr {</pre></code><tr><td>75<td><code><pre> var isNew bool</pre></code><tr><td>76<td><code><pre> vPtr := value</pre></code><tr><td>77<td><code><pre> if value.IsNil() {</pre></code><tr><td>78<td><code><pre> isNew = true</pre></code><tr><td>79<td><code><pre> vPtr = reflect.New(value.Type().Elem())</pre></code><tr><td>80<td><code><pre> }</pre></code><tr><td>81<td><code><pre> isSetted, err := mapping(vPtr.Elem(), field, setter, tag)</pre></code><tr><td>82<td><code><pre> if err != nil {</pre></code><tr class=miss><td>83<td><code><pre> return false, err</pre></code><tr><td>84<td><code><pre> }</pre></code><tr><td>85<td><code><pre> if isNew && isSetted {</pre></code><tr><td>86<td><code><pre> value.Set(vPtr)</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre> return isSetted, nil</pre></code><tr><td>89<td><code><pre> }</pre></code><tr><td>90<td><code><pre></pre></code><tr><td>91<td><code><pre> if vKind != reflect.Struct || !field.Anonymous {</pre></code><tr><td>92<td><code><pre> ok, err := tryToSetValue(value, field, setter, tag)</pre></code><tr><td>93<td><code><pre> if err != nil {</pre></code><tr class=miss><td>94<td><code><pre> return false, err</pre></code><tr><td>95<td><code><pre> }</pre></code><tr><td>96<td><code><pre> if ok {</pre></code><tr><td>97<td><code><pre> return true, nil</pre></code><tr><td>98<td><code><pre> }</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre></pre></code><tr><td>101<td><code><pre> if vKind == reflect.Struct {</pre></code><tr><td>102<td><code><pre> tValue := value.Type()</pre></code><tr><td>103<td><code><pre></pre></code><tr><td>104<td><code><pre> var isSetted bool</pre></code><tr><td>105<td><code><pre> for i := 0; i < value.NumField(); i++ {</pre></code><tr><td>106<td><code><pre> sf := tValue.Field(i)</pre></code><tr><td>107<td><code><pre> if sf.PkgPath != "" && !sf.Anonymous { // unexported</pre></code><tr class=miss><td>108<td><code><pre> continue</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre> ok, err := mapping(value.Field(i), tValue.Field(i), setter, tag)</pre></code><tr><td>111<td><code><pre> if err != nil {</pre></code><tr class=miss><td>112<td><code><pre> return false, err</pre></code><tr><td>113<td><code><pre> }</pre></code><tr><td>114<td><code><pre> isSetted = isSetted || ok</pre></code><tr><td>115<td><code><pre> }</pre></code><tr><td>116<td><code><pre> return isSetted, nil</pre></code><tr><td>117<td><code><pre> }</pre></code><tr><td>118<td><code><pre> return false, nil</pre></code><tr><td>119<td><code><pre>}</pre></code></table><div class=funcname id=fn_setSlice>func setSlice</div><div class=info><a href=#s_fn_setSlice>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>340<td><code><pre>func setSlice(vals []string, value reflect.Value, field reflect.StructField) error {</pre></code><tr><td>341<td><code><pre> slice := reflect.MakeSlice(value.Type(), len(vals), len(vals))</pre></code><tr><td>342<td><code><pre> err := setArray(vals, slice, field)</pre></code><tr><td>343<td><code><pre> if err != nil {</pre></code><tr class=miss><td>344<td><code><pre> return err</pre></code><tr><td>345<td><code><pre> }</pre></code><tr><td>346<td><code><pre> value.Set(slice)</pre></code><tr><td>347<td><code><pre> return nil</pre></code><tr><td>348<td><code><pre>}</pre></code></table><div class=funcname id=fn_setIntField>func setIntField</div><div class=info><a href=#s_fn_setIntField>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>235<td><code><pre>func setIntField(val string, bitSize int, field reflect.Value) error {</pre></code><tr><td>236<td><code><pre> if val == "" {</pre></code><tr class=miss><td>237<td><code><pre> val = "0"</pre></code><tr><td>238<td><code><pre> }</pre></code><tr><td>239<td><code><pre> intVal, err := strconv.ParseInt(val, 10, bitSize)</pre></code><tr><td>240<td><code><pre> if err == nil {</pre></code><tr><td>241<td><code><pre> field.SetInt(intVal)</pre></code><tr><td>242<td><code><pre> }</pre></code><tr><td>243<td><code><pre> return err</pre></code><tr><td>244<td><code><pre>}</pre></code></table><div class=funcname id=fn_MultipartFormDataParser.lookupFieldByTag>func MultipartFormDataParser.lookupFieldByTag</div><div class=info><a href=#s_fn_MultipartFormDataParser.lookupFieldByTag>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr><td>86<td><code><pre>func (m *MultipartFormDataParser) lookupFieldByTag(t reflect.Type, key, tag string) (fNum int) {</pre></code><tr><td>87<td><code><pre> n := t.NumField()</pre></code><tr><td>88<td><code><pre> for i := 0; i < n; i++ {</pre></code><tr><td>89<td><code><pre> f := t.Field(i)</pre></code><tr><td>90<td><code><pre> if v, ok := f.Tag.Lookup(tag); ok && v == key {</pre></code><tr><td>91<td><code><pre> return i</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre> }</pre></code><tr class=miss><td>94<td><code><pre> return -1</pre></code><tr><td>95<td><code><pre>}</pre></code></table><div class=funcname id=fn_setArray>func setArray</div><div class=info><a href=#s_fn_setArray>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>330<td><code><pre>func setArray(vals []string, value reflect.Value, field reflect.StructField) error {</pre></code><tr><td>331<td><code><pre> for i, s := range vals {</pre></code><tr><td>332<td><code><pre> err := setWithProperType(s, value.Index(i), field)</pre></code><tr><td>333<td><code><pre> if err != nil {</pre></code><tr class=miss><td>334<td><code><pre> return err</pre></code><tr><td>335<td><code><pre> }</pre></code><tr><td>336<td><code><pre> }</pre></code><tr><td>337<td><code><pre> return nil</pre></code><tr><td>338<td><code><pre>}</pre></code></table><div class=funcname id=fn_MultipartFormDataParser.PreParse>func MultipartFormDataParser.PreParse</div><div class=info><a href=#s_fn_MultipartFormDataParser.PreParse>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr><td>27<td><code><pre>func (m *MultipartFormDataParser) PreParse(args map[string]string) error {</pre></code><tr><td>28<td><code><pre> boundary, ok := args[keyBoundary]</pre></code><tr><td>29<td><code><pre> if !ok {</pre></code><tr class=miss><td>30<td><code><pre> return malformedRequest("missing boundary in multipart/form-data")</pre></code><tr><td>31<td><code><pre> }</pre></code><tr><td>32<td><code><pre> m.boundary = boundary</pre></code><tr><td>33<td><code><pre> return nil</pre></code><tr><td>34<td><code><pre>}</pre></code></table><div class=funcname id=fn_GetByContentType>func GetByContentType</div><div class=info><a href=#s_fn_GetByContentType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/parser.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func GetByContentType(typ string) (parser Parser, err error) {</pre></code><tr><td>33<td><code><pre> parserType, ok := parserMap[typ]</pre></code><tr><td>34<td><code><pre> if !ok {</pre></code><tr class=miss><td>35<td><code><pre> return nil, unsupportedContentType(typ)</pre></code><tr><td>36<td><code><pre> }</pre></code><tr><td>37<td><code><pre></pre></code><tr><td>38<td><code><pre> return reflect.New(parserType.Elem()).Interface().(Parser), nil</pre></code><tr><td>39<td><code><pre>}</pre></code></table><div class=funcname id=fn_head>func head</div><div class=info><a href=#s_fn_head>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>359<td><code><pre>func head(str, sep string) (head string, tail string) {</pre></code><tr><td>360<td><code><pre> idx := strings.Index(str, sep)</pre></code><tr><td>361<td><code><pre> if idx < 0 {</pre></code><tr><td>362<td><code><pre> return str, ""</pre></code><tr><td>363<td><code><pre> }</pre></code><tr class=miss><td>364<td><code><pre> return str[:idx], str[idx+len(sep):]</pre></code><tr><td>365<td><code><pre>}</pre></code></table><div class=funcname id=fn_tryToSetValue>func tryToSetValue</div><div class=info><a href=#s_fn_tryToSetValue>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>126<td><code><pre>func tryToSetValue(value reflect.Value, field reflect.StructField, setter setter, tag string) (bool, error) {</pre></code><tr><td>127<td><code><pre> var tagValue string</pre></code><tr><td>128<td><code><pre> var setOpt setOptions</pre></code><tr><td>129<td><code><pre></pre></code><tr><td>130<td><code><pre> tagValue = field.Tag.Get(tag)</pre></code><tr><td>131<td><code><pre> tagValue, opts := head(tagValue, ",")</pre></code><tr><td>132<td><code><pre></pre></code><tr><td>133<td><code><pre> if tagValue == "" { // default value is FieldName</pre></code><tr><td>134<td><code><pre> tagValue = field.Name</pre></code><tr><td>135<td><code><pre> }</pre></code><tr><td>136<td><code><pre> if tagValue == "" { // when field is "emptyField" variable</pre></code><tr><td>137<td><code><pre> return false, nil</pre></code><tr><td>138<td><code><pre> }</pre></code><tr><td>139<td><code><pre></pre></code><tr><td>140<td><code><pre> var opt string</pre></code><tr><td>141<td><code><pre> for len(opts) > 0 {</pre></code><tr class=miss><td>142<td><code><pre> opt, opts = head(opts, ",")</pre></code><tr><td>143<td><code><pre></pre></code><tr class=miss><td>144<td><code><pre> if k, v := head(opt, "="); k == "default" {</pre></code><tr class=miss><td>145<td><code><pre> setOpt.isDefaultExists = true</pre></code><tr class=miss><td>146<td><code><pre> setOpt.defaultValue = v</pre></code><tr><td>147<td><code><pre> }</pre></code><tr><td>148<td><code><pre> }</pre></code><tr><td>149<td><code><pre></pre></code><tr><td>150<td><code><pre> return setter.TrySet(value, field, tagValue, setOpt)</pre></code><tr><td>151<td><code><pre>}</pre></code></table><div class=funcname id=fn_MultipartFormDataParser.Parse>func MultipartFormDataParser.Parse</div><div class=info><a href=#s_fn_MultipartFormDataParser.Parse>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func (m *MultipartFormDataParser) Parse(src io.Reader, dst reflect.Value) (err error) {</pre></code><tr><td>37<td><code><pre> for dst.Kind() == reflect.Ptr {</pre></code><tr class=miss><td>38<td><code><pre> dst.Set(reflect.New(dst.Type().Elem()))</pre></code><tr class=miss><td>39<td><code><pre> dst = dst.Elem()</pre></code><tr><td>40<td><code><pre> }</pre></code><tr><td>41<td><code><pre></pre></code><tr><td>42<td><code><pre> var (</pre></code><tr><td>43<td><code><pre> part *multipart.Part</pre></code><tr><td>44<td><code><pre> body []byte</pre></code><tr><td>45<td><code><pre> dt = reflect.TypeOf(dst.Interface())</pre></code><tr><td>46<td><code><pre> reader = multipart.NewReader(src, m.boundary)</pre></code><tr><td>47<td><code><pre> )</pre></code><tr><td>48<td><code><pre> defer func() {</pre></code><tr><td>49<td><code><pre> if part != nil {</pre></code><tr><td>50<td><code><pre> utils.CloseAnyway(part)</pre></code><tr><td>51<td><code><pre> }</pre></code><tr><td>52<td><code><pre> }()</pre></code><tr><td>53<td><code><pre></pre></code><tr><td>54<td><code><pre> for {</pre></code><tr><td>55<td><code><pre> part, err = reader.NextPart()</pre></code><tr><td>56<td><code><pre> if err != nil {</pre></code><tr><td>57<td><code><pre> if err == io.EOF {</pre></code><tr><td>58<td><code><pre> err = nil</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre> break</pre></code><tr><td>61<td><code><pre> }</pre></code><tr><td>62<td><code><pre></pre></code><tr><td>63<td><code><pre> k := part.FormName()</pre></code><tr><td>64<td><code><pre> fNum := m.lookupFieldByTag(dt, k, "json")</pre></code><tr><td>65<td><code><pre> if fNum == -1 {</pre></code><tr class=miss><td>66<td><code><pre> continue</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre> fv := dst.Field(fNum)</pre></code><tr><td>69<td><code><pre> if !fv.IsValid() || !fv.CanSet() {</pre></code><tr class=miss><td>70<td><code><pre> continue</pre></code><tr><td>71<td><code><pre> }</pre></code><tr><td>72<td><code><pre></pre></code><tr><td>73<td><code><pre> // transform</pre></code><tr><td>74<td><code><pre> if body, err = ioutil.ReadAll(part); err != nil {</pre></code><tr class=miss><td>75<td><code><pre> break</pre></code><tr><td>76<td><code><pre> } else if err = m.transformField(fv, body); err != nil {</pre></code><tr class=miss><td>77<td><code><pre> break</pre></code><tr><td>78<td><code><pre> } else if err = part.Close(); err != nil {</pre></code><tr class=miss><td>79<td><code><pre> break</pre></code><tr><td>80<td><code><pre> }</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre></pre></code><tr><td>83<td><code><pre> return</pre></code><tr><td>84<td><code><pre>}</pre></code></table><div class=funcname id=fn_ApplicationFormUrlencodedParser.Parse>func ApplicationFormUrlencodedParser.Parse</div><div class=info><a href=#s_fn_ApplicationFormUrlencodedParser.Parse>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/application_x_www_form_urlencoded.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func (a *ApplicationFormUrlencodedParser) Parse(src io.Reader, dst reflect.Value) (err error) {</pre></code><tr><td>16<td><code><pre> body, err := io.ReadAll(src)</pre></code><tr><td>17<td><code><pre> if err != nil {</pre></code><tr class=miss><td>18<td><code><pre> return</pre></code><tr><td>19<td><code><pre> }</pre></code><tr><td>20<td><code><pre></pre></code><tr><td>21<td><code><pre> vals, err := url.ParseQuery(string(body))</pre></code><tr><td>22<td><code><pre> if err != nil {</pre></code><tr class=miss><td>23<td><code><pre> return</pre></code><tr><td>24<td><code><pre> }</pre></code><tr><td>25<td><code><pre></pre></code><tr><td>26<td><code><pre> return MapFormByTag(dst.Addr().Interface(), vals, "json")</pre></code><tr><td>27<td><code><pre>}</pre></code></table><div class=funcname id=fn_setByForm>func setByForm</div><div class=info><a href=#s_fn_setByForm>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>153<td><code><pre>func setByForm(value reflect.Value, field reflect.StructField, form map[string][]string,</pre></code><tr><td>154<td><code><pre> tagValue string, opt setOptions) (isSetted bool, err error) {</pre></code><tr><td>155<td><code><pre> vs, ok := form[tagValue]</pre></code><tr><td>156<td><code><pre> if !ok && !opt.isDefaultExists {</pre></code><tr><td>157<td><code><pre> return false, nil</pre></code><tr><td>158<td><code><pre> }</pre></code><tr><td>159<td><code><pre></pre></code><tr><td>160<td><code><pre> switch value.Kind() {</pre></code><tr><td>161<td><code><pre> case reflect.Slice:</pre></code><tr><td>162<td><code><pre> if !ok {</pre></code><tr class=miss><td>163<td><code><pre> vs = []string{opt.defaultValue}</pre></code><tr><td>164<td><code><pre> }</pre></code><tr><td>165<td><code><pre> return true, setSlice(vs, value, field)</pre></code><tr><td>166<td><code><pre> case reflect.Array:</pre></code><tr class=miss><td>167<td><code><pre> if !ok {</pre></code><tr class=miss><td>168<td><code><pre> vs = []string{opt.defaultValue}</pre></code><tr><td>169<td><code><pre> }</pre></code><tr class=miss><td>170<td><code><pre> if len(vs) != value.Len() {</pre></code><tr class=miss><td>171<td><code><pre> return false, fmt.Errorf("%q is not valid value for %s", vs, value.Type().String())</pre></code><tr><td>172<td><code><pre> }</pre></code><tr class=miss><td>173<td><code><pre> return true, setArray(vs, value, field)</pre></code><tr><td>174<td><code><pre> default:</pre></code><tr><td>175<td><code><pre> var val string</pre></code><tr><td>176<td><code><pre> if !ok {</pre></code><tr class=miss><td>177<td><code><pre> val = opt.defaultValue</pre></code><tr><td>178<td><code><pre> }</pre></code><tr><td>179<td><code><pre></pre></code><tr><td>180<td><code><pre> if len(vs) > 0 {</pre></code><tr><td>181<td><code><pre> val = vs[0]</pre></code><tr><td>182<td><code><pre> }</pre></code><tr><td>183<td><code><pre> return true, setWithProperType(val, value, field)</pre></code><tr><td>184<td><code><pre> }</pre></code><tr><td>185<td><code><pre>}</pre></code></table><div class=funcname id=fn_setFormMap>func setFormMap</div><div class=info><a href=#s_fn_setFormMap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>367<td><code><pre>func setFormMap(ptr any, form map[string][]string) error {</pre></code><tr><td>368<td><code><pre> switch ptrMap := ptr.(type) {</pre></code><tr><td>369<td><code><pre> case *map[string]any:</pre></code><tr><td>370<td><code><pre> *ptrMap = make(map[string]any, len(form))</pre></code><tr><td>371<td><code><pre> for k, v := range form {</pre></code><tr><td>372<td><code><pre> (*ptrMap)[k] = v</pre></code><tr><td>373<td><code><pre> }</pre></code><tr><td>374<td><code><pre> case *[]map[string]any:</pre></code><tr><td>375<td><code><pre> *ptrMap = make([]map[string]any, 0, 1)</pre></code><tr><td>376<td><code><pre> tmp := make(map[string]any, len(form))</pre></code><tr><td>377<td><code><pre> for k, v := range form {</pre></code><tr><td>378<td><code><pre> tmp[k] = v</pre></code><tr><td>379<td><code><pre> }</pre></code><tr><td>380<td><code><pre> *ptrMap = append(*ptrMap, tmp)</pre></code><tr><td>381<td><code><pre> case *map[string][]string:</pre></code><tr class=miss><td>382<td><code><pre> *ptrMap = make(map[string][]string, len(form))</pre></code><tr class=miss><td>383<td><code><pre> for k, v := range form {</pre></code><tr class=miss><td>384<td><code><pre> (*ptrMap)[k] = v</pre></code><tr><td>385<td><code><pre> }</pre></code><tr><td>386<td><code><pre> case *map[string]string:</pre></code><tr class=miss><td>387<td><code><pre> *ptrMap = make(map[string]string, len(form))</pre></code><tr class=miss><td>388<td><code><pre> for k, v := range form {</pre></code><tr class=miss><td>389<td><code><pre> (*ptrMap)[k] = v[len(v)-1] // pick last</pre></code><tr><td>390<td><code><pre> }</pre></code><tr><td>391<td><code><pre> default:</pre></code><tr class=miss><td>392<td><code><pre> return errors.New("cannot convert to map slices of strings")</pre></code><tr><td>393<td><code><pre> }</pre></code><tr><td>394<td><code><pre></pre></code><tr><td>395<td><code><pre> return nil</pre></code><tr><td>396<td><code><pre>}</pre></code></table><div class=funcname id=fn_@48:8>func @48:8</div><div class=info><a href=#s_fn_@48:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr><td>48<td><code><pre>func() {</pre></code><tr><td>49<td><code><pre> if part != nil {</pre></code><tr class=miss><td>50<td><code><pre> utils.CloseAnyway(part)</pre></code><tr><td>51<td><code><pre> }</pre></code><tr><td>52<td><code><pre> }</pre></code></table><div class=funcname id=fn_setWithProperType>func setWithProperType</div><div class=info><a href=#s_fn_setWithProperType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>187<td><code><pre>func setWithProperType(val string, value reflect.Value, field reflect.StructField) error {</pre></code><tr><td>188<td><code><pre> switch value.Kind() {</pre></code><tr><td>189<td><code><pre> case reflect.Int:</pre></code><tr><td>190<td><code><pre> return setIntField(val, 0, value)</pre></code><tr><td>191<td><code><pre> case reflect.Int8:</pre></code><tr class=miss><td>192<td><code><pre> return setIntField(val, 8, value)</pre></code><tr><td>193<td><code><pre> case reflect.Int16:</pre></code><tr class=miss><td>194<td><code><pre> return setIntField(val, 16, value)</pre></code><tr><td>195<td><code><pre> case reflect.Int32:</pre></code><tr class=miss><td>196<td><code><pre> return setIntField(val, 32, value)</pre></code><tr><td>197<td><code><pre> case reflect.Int64:</pre></code><tr class=miss><td>198<td><code><pre> switch value.Interface().(type) {</pre></code><tr><td>199<td><code><pre> case time.Duration:</pre></code><tr class=miss><td>200<td><code><pre> return setTimeDuration(val, value, field)</pre></code><tr><td>201<td><code><pre> }</pre></code><tr class=miss><td>202<td><code><pre> return setIntField(val, 64, value)</pre></code><tr><td>203<td><code><pre> case reflect.Uint:</pre></code><tr class=miss><td>204<td><code><pre> return setUintField(val, 0, value)</pre></code><tr><td>205<td><code><pre> case reflect.Uint8:</pre></code><tr class=miss><td>206<td><code><pre> return setUintField(val, 8, value)</pre></code><tr><td>207<td><code><pre> case reflect.Uint16:</pre></code><tr class=miss><td>208<td><code><pre> return setUintField(val, 16, value)</pre></code><tr><td>209<td><code><pre> case reflect.Uint32:</pre></code><tr class=miss><td>210<td><code><pre> return setUintField(val, 32, value)</pre></code><tr><td>211<td><code><pre> case reflect.Uint64:</pre></code><tr class=miss><td>212<td><code><pre> return setUintField(val, 64, value)</pre></code><tr><td>213<td><code><pre> case reflect.Bool:</pre></code><tr class=miss><td>214<td><code><pre> return setBoolField(val, value)</pre></code><tr><td>215<td><code><pre> case reflect.Float32:</pre></code><tr class=miss><td>216<td><code><pre> return setFloatField(val, 32, value)</pre></code><tr><td>217<td><code><pre> case reflect.Float64:</pre></code><tr class=miss><td>218<td><code><pre> return setFloatField(val, 64, value)</pre></code><tr><td>219<td><code><pre> case reflect.String:</pre></code><tr><td>220<td><code><pre> value.SetString(val)</pre></code><tr><td>221<td><code><pre> case reflect.Struct:</pre></code><tr class=miss><td>222<td><code><pre> switch value.Interface().(type) {</pre></code><tr><td>223<td><code><pre> case time.Time:</pre></code><tr class=miss><td>224<td><code><pre> return setTimeField(val, field, value)</pre></code><tr><td>225<td><code><pre> }</pre></code><tr class=miss><td>226<td><code><pre> return json.Unmarshal(utils.UnsafeStringToBytes(val), value.Addr().Interface())</pre></code><tr><td>227<td><code><pre> case reflect.Map:</pre></code><tr class=miss><td>228<td><code><pre> return json.Unmarshal(utils.UnsafeStringToBytes(val), value.Addr().Interface())</pre></code><tr><td>229<td><code><pre> default:</pre></code><tr class=miss><td>230<td><code><pre> return errUnknownType</pre></code><tr><td>231<td><code><pre> }</pre></code><tr><td>232<td><code><pre> return nil</pre></code><tr><td>233<td><code><pre>}</pre></code></table><div class=funcname id=fn_setTimeField>func setTimeField</div><div class=info><a href=#s_fn_setTimeField>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>279<td><code><pre>func setTimeField(val string, structField reflect.StructField, value reflect.Value) error {</pre></code><tr class=miss><td>280<td><code><pre> timeFormat := structField.Tag.Get("time_format")</pre></code><tr class=miss><td>281<td><code><pre> if timeFormat == "" {</pre></code><tr class=miss><td>282<td><code><pre> timeFormat = time.RFC3339</pre></code><tr><td>283<td><code><pre> }</pre></code><tr><td>284<td><code><pre></pre></code><tr class=miss><td>285<td><code><pre> switch tf := strings.ToLower(timeFormat); tf {</pre></code><tr><td>286<td><code><pre> case "unix", "unixnano":</pre></code><tr class=miss><td>287<td><code><pre> tv, err := strconv.ParseInt(val, 10, 64)</pre></code><tr class=miss><td>288<td><code><pre> if err != nil {</pre></code><tr class=miss><td>289<td><code><pre> return err</pre></code><tr><td>290<td><code><pre> }</pre></code><tr><td>291<td><code><pre></pre></code><tr class=miss><td>292<td><code><pre> d := time.Duration(1)</pre></code><tr class=miss><td>293<td><code><pre> if tf == "unixnano" {</pre></code><tr class=miss><td>294<td><code><pre> d = time.Second</pre></code><tr><td>295<td><code><pre> }</pre></code><tr><td>296<td><code><pre></pre></code><tr class=miss><td>297<td><code><pre> t := time.Unix(tv/int64(d), tv%int64(d))</pre></code><tr class=miss><td>298<td><code><pre> value.Set(reflect.ValueOf(t))</pre></code><tr class=miss><td>299<td><code><pre> return nil</pre></code><tr><td>300<td><code><pre></pre></code><tr><td>301<td><code><pre> }</pre></code><tr><td>302<td><code><pre></pre></code><tr class=miss><td>303<td><code><pre> if val == "" {</pre></code><tr class=miss><td>304<td><code><pre> value.Set(reflect.ValueOf(time.Time{}))</pre></code><tr class=miss><td>305<td><code><pre> return nil</pre></code><tr><td>306<td><code><pre> }</pre></code><tr><td>307<td><code><pre></pre></code><tr class=miss><td>308<td><code><pre> l := time.Local</pre></code><tr class=miss><td>309<td><code><pre> if isUTC, _ := strconv.ParseBool(structField.Tag.Get("time_utc")); isUTC {</pre></code><tr class=miss><td>310<td><code><pre> l = time.UTC</pre></code><tr><td>311<td><code><pre> }</pre></code><tr><td>312<td><code><pre></pre></code><tr class=miss><td>313<td><code><pre> if locTag := structField.Tag.Get("time_location"); locTag != "" {</pre></code><tr class=miss><td>314<td><code><pre> loc, err := time.LoadLocation(locTag)</pre></code><tr class=miss><td>315<td><code><pre> if err != nil {</pre></code><tr class=miss><td>316<td><code><pre> return err</pre></code><tr><td>317<td><code><pre> }</pre></code><tr class=miss><td>318<td><code><pre> l = loc</pre></code><tr><td>319<td><code><pre> }</pre></code><tr><td>320<td><code><pre></pre></code><tr class=miss><td>321<td><code><pre> t, err := time.ParseInLocation(timeFormat, val, l)</pre></code><tr class=miss><td>322<td><code><pre> if err != nil {</pre></code><tr class=miss><td>323<td><code><pre> return err</pre></code><tr><td>324<td><code><pre> }</pre></code><tr><td>325<td><code><pre></pre></code><tr class=miss><td>326<td><code><pre> value.Set(reflect.ValueOf(t))</pre></code><tr class=miss><td>327<td><code><pre> return nil</pre></code><tr><td>328<td><code><pre>}</pre></code></table><div class=funcname id=fn_setFloatField>func setFloatField</div><div class=info><a href=#s_fn_setFloatField>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>268<td><code><pre>func setFloatField(val string, bitSize int, field reflect.Value) error {</pre></code><tr class=miss><td>269<td><code><pre> if val == "" {</pre></code><tr class=miss><td>270<td><code><pre> val = "0.0"</pre></code><tr><td>271<td><code><pre> }</pre></code><tr class=miss><td>272<td><code><pre> floatVal, err := strconv.ParseFloat(val, bitSize)</pre></code><tr class=miss><td>273<td><code><pre> if err == nil {</pre></code><tr class=miss><td>274<td><code><pre> field.SetFloat(floatVal)</pre></code><tr><td>275<td><code><pre> }</pre></code><tr class=miss><td>276<td><code><pre> return err</pre></code><tr><td>277<td><code><pre>}</pre></code></table><div class=funcname id=fn_setBoolField>func setBoolField</div><div class=info><a href=#s_fn_setBoolField>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>257<td><code><pre>func setBoolField(val string, field reflect.Value) error {</pre></code><tr class=miss><td>258<td><code><pre> if val == "" {</pre></code><tr class=miss><td>259<td><code><pre> val = "false"</pre></code><tr><td>260<td><code><pre> }</pre></code><tr class=miss><td>261<td><code><pre> boolVal, err := strconv.ParseBool(val)</pre></code><tr class=miss><td>262<td><code><pre> if err == nil {</pre></code><tr class=miss><td>263<td><code><pre> field.SetBool(boolVal)</pre></code><tr><td>264<td><code><pre> }</pre></code><tr class=miss><td>265<td><code><pre> return err</pre></code><tr><td>266<td><code><pre>}</pre></code></table><div class=funcname id=fn_setUintField>func setUintField</div><div class=info><a href=#s_fn_setUintField>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>246<td><code><pre>func setUintField(val string, bitSize int, field reflect.Value) error {</pre></code><tr class=miss><td>247<td><code><pre> if val == "" {</pre></code><tr class=miss><td>248<td><code><pre> val = "0"</pre></code><tr><td>249<td><code><pre> }</pre></code><tr class=miss><td>250<td><code><pre> uintVal, err := strconv.ParseUint(val, 10, bitSize)</pre></code><tr class=miss><td>251<td><code><pre> if err == nil {</pre></code><tr class=miss><td>252<td><code><pre> field.SetUint(uintVal)</pre></code><tr><td>253<td><code><pre> }</pre></code><tr class=miss><td>254<td><code><pre> return err</pre></code><tr><td>255<td><code><pre>}</pre></code></table><div class=funcname id=fn_setTimeDuration>func setTimeDuration</div><div class=info><a href=#s_fn_setTimeDuration>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/form_mapping.go</code>:</div><table class=listing><tr><td>350<td><code><pre>func setTimeDuration(val string, value reflect.Value, field reflect.StructField) error {</pre></code><tr class=miss><td>351<td><code><pre> d, err := time.ParseDuration(val)</pre></code><tr class=miss><td>352<td><code><pre> if err != nil {</pre></code><tr class=miss><td>353<td><code><pre> return err</pre></code><tr><td>354<td><code><pre> }</pre></code><tr class=miss><td>355<td><code><pre> value.Set(reflect.ValueOf(d))</pre></code><tr class=miss><td>356<td><code><pre> return nil</pre></code><tr><td>357<td><code><pre>}</pre></code></table><div class=funcname id=fn_@105:20>func @105:20</div><div class=info><a href=#s_fn_@105:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr class=miss><td>105<td><code><pre>func(f reflect.Value, b []byte) (e error) { v, e := cast.ToInt64E(b); f.SetInt(v); return }</pre></code></table><div class=funcname id=fn_@100:20>func @100:20</div><div class=info><a href=#s_fn_@100:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr class=miss><td>100<td><code><pre>func(f reflect.Value, b []byte) (e error) { v, e := cast.ToStringE(b); f.SetString(v); return }</pre></code></table><div class=funcname id=fn_@101:20>func @101:20</div><div class=info><a href=#s_fn_@101:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr class=miss><td>101<td><code><pre>func(f reflect.Value, b []byte) (e error) { v, e := cast.ToInt64E(b); f.SetInt(v); return }</pre></code></table><div class=funcname id=fn_@102:20>func @102:20</div><div class=info><a href=#s_fn_@102:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr class=miss><td>102<td><code><pre>func(f reflect.Value, b []byte) (e error) { v, e := cast.ToInt64E(b); f.SetInt(v); return }</pre></code></table><div class=funcname id=fn_@103:20>func @103:20</div><div class=info><a href=#s_fn_@103:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr class=miss><td>103<td><code><pre>func(f reflect.Value, b []byte) (e error) { v, e := cast.ToInt64E(b); f.SetInt(v); return }</pre></code></table><div class=funcname id=fn_@104:20>func @104:20</div><div class=info><a href=#s_fn_@104:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr class=miss><td>104<td><code><pre>func(f reflect.Value, b []byte) (e error) { v, e := cast.ToInt64E(b); f.SetInt(v); return }</pre></code></table><div class=funcname id=fn_@99:20>func @99:20</div><div class=info><a href=#s_fn_@99:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr class=miss><td>99<td><code><pre>func(f reflect.Value, b []byte) (e error) { v, e := cast.ToBoolE(b); f.SetBool(v); return }</pre></code></table><div class=funcname id=fn_@106:20>func @106:20</div><div class=info><a href=#s_fn_@106:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr class=miss><td>106<td><code><pre>func(f reflect.Value, b []byte) (e error) { v, e := cast.ToUint64E(b); f.SetUint(v); return }</pre></code></table><div class=funcname id=fn_@107:20>func @107:20</div><div class=info><a href=#s_fn_@107:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr class=miss><td>107<td><code><pre>func(f reflect.Value, b []byte) (e error) { v, e := cast.ToUint64E(b); f.SetUint(v); return }</pre></code></table><div class=funcname id=fn_@108:20>func @108:20</div><div class=info><a href=#s_fn_@108:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr class=miss><td>108<td><code><pre>func(f reflect.Value, b []byte) (e error) { v, e := cast.ToUint64E(b); f.SetUint(v); return }</pre></code></table><div class=funcname id=fn_@109:20>func @109:20</div><div class=info><a href=#s_fn_@109:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr class=miss><td>109<td><code><pre>func(f reflect.Value, b []byte) (e error) { v, e := cast.ToUint64E(b); f.SetUint(v); return }</pre></code></table><div class=funcname id=fn_@110:20>func @110:20</div><div class=info><a href=#s_fn_@110:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr class=miss><td>110<td><code><pre>func(f reflect.Value, b []byte) (e error) { v, e := cast.ToUint64E(b); f.SetUint(v); return }</pre></code></table><div class=funcname id=fn_ApplicationJsonParser.Parse>func ApplicationJsonParser.Parse</div><div class=info><a href=#s_fn_ApplicationJsonParser.Parse>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/application_json.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func (a *ApplicationJsonParser) Parse(src io.Reader, dst reflect.Value) (err error) {</pre></code><tr class=miss><td>17<td><code><pre> if err = json.NewDecoder(src).Decode(dst.Addr().Interface()); err != nil {</pre></code><tr class=miss><td>18<td><code><pre> return malformedRequest(err.Error())</pre></code><tr><td>19<td><code><pre> }</pre></code><tr><td>20<td><code><pre></pre></code><tr class=miss><td>21<td><code><pre> return</pre></code><tr><td>22<td><code><pre>}</pre></code></table><div class=funcname id=fn_@112:20>func @112:20</div><div class=info><a href=#s_fn_@112:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr class=miss><td>112<td><code><pre>func(f reflect.Value, b []byte) (e error) { v, e := cast.ToFloat64E(b); f.SetFloat(v); return }</pre></code></table><div class=funcname id=fn_@111:20>func @111:20</div><div class=info><a href=#s_fn_@111:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/multipart_formdata.go</code>:</div><table class=listing><tr class=miss><td>111<td><code><pre>func(f reflect.Value, b []byte) (e error) { v, e := cast.ToFloat64E(b); f.SetFloat(v); return }</pre></code></table><div class=funcname id=fn_ApplicationJsonParser.PreParse>func ApplicationJsonParser.PreParse</div><div class=info><a href=#s_fn_ApplicationJsonParser.PreParse>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/application_json.go</code>:</div><table class=listing><tr><td>12<td><code><pre>func (a *ApplicationJsonParser) PreParse(args map[string]string) error {</pre></code><tr class=miss><td>13<td><code><pre> return nil</pre></code><tr><td>14<td><code><pre>}</pre></code></table><div class=funcname id=fn_malformedRequest>func malformedRequest</div><div class=info><a href=#s_fn_malformedRequest>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/parser.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func malformedRequest(msg string) error {</pre></code><tr class=miss><td>17<td><code><pre> return fmt.Errorf("malformed request %s", msg)</pre></code><tr><td>18<td><code><pre>}</pre></code></table><div class=funcname id=fn_unsupportedContentType>func unsupportedContentType</div><div class=info><a href=#s_fn_unsupportedContentType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/http/parser/parser.go</code>:</div><table class=listing><tr><td>20<td><code><pre>func unsupportedContentType(typ string) error {</pre></code><tr class=miss><td>21<td><code><pre> return fmt.Errorf("unsupported content-type %s", typ)</pre></code><tr><td>22<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/i18n class=funcname>Package Overview: github.com/wfusion/gofusion/i18n 32 <span class=packageTotal>74.7%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_bundle[T].AddMessages><td><code><a href=#fn_bundle[T].AddMessages>bundle[T].AddMessages(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/i18n.go</code><td class=percent><code>100.0%</code><td class=linecount><code>9/9</code><tr id=s_fn_NewBundle><td><code><a href=#fn_NewBundle>NewBundle(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/i18n.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_DefaultLang><td><code><a href=#fn_DefaultLang>DefaultLang(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_@51:9><td><code><a href=#fn_@51:9>@51:9(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_AppName><td><code><a href=#fn_AppName>AppName(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@66:9><td><code><a href=#fn_@66:9>@66:9(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@124:9><td><code><a href=#fn_@124:9>@124:9(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/i18n.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/flag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Langs><td><code><a href=#fn_Langs>Langs(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/i18n.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Var><td><code><a href=#fn_Var>Var(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/i18n.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@57:9><td><code><a href=#fn_@57:9>@57:9(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/i18n.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Param><td><code><a href=#fn_Param>Param(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/i18n.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Construct><td><code><a href=#fn_Construct>Construct(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/construct.go</code><td class=percent><code>95.0%</code><td class=linecount><code>19/20</code><tr id=s_fn_@142:9><td><code><a href=#fn_@142:9>@142:9(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/i18n.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_bundle[T].Localize><td><code><a href=#fn_bundle[T].Localize>bundle[T].Localize(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/i18n.go</code><td class=percent><code>62.5%</code><td class=linecount><code>10/16</code><tr id=s_fn_bundle[T].checkDuplicated><td><code><a href=#fn_bundle[T].checkDuplicated>bundle[T].checkDuplicated(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/i18n.go</code><td class=percent><code>27.3%</code><td class=linecount><code>3/11</code><tr id=s_fn_@130:9><td><code><a href=#fn_@130:9>@130:9(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/i18n.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Lang><td><code><a href=#fn_Lang>Lang(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/i18n.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@136:9><td><code><a href=#fn_@136:9>@136:9(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/i18n.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@47:16><td><code><a href=#fn_@47:16>@47:16(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@48:16><td><code><a href=#fn_@48:16>@48:16(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Plural><td><code><a href=#fn_Plural>Plural(...)</a></code><td><code>github.com/wfusion/gofusion/i18n/i18n.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_bundle[T].AddMessages>func bundle[T].AddMessages</div><div class=info><a href=#s_fn_bundle[T].AddMessages>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/i18n.go</code>:</div><table class=listing><tr><td>62<td><code><pre>func (i *bundle[T]) AddMessages(code T, trans map[language.Tag]*Message, opts ...utils.OptionExtender) Localizable[T] {</pre></code><tr><td>63<td><code><pre> i.checkDuplicated(code, trans)</pre></code><tr><td>64<td><code><pre></pre></code><tr><td>65<td><code><pre> i.mutex.Lock()</pre></code><tr><td>66<td><code><pre> defer i.mutex.Unlock()</pre></code><tr><td>67<td><code><pre></pre></code><tr><td>68<td><code><pre> o := utils.ApplyOptions[addMessagesOption](opts...)</pre></code><tr><td>69<td><code><pre> id := cast.ToString(code)</pre></code><tr><td>70<td><code><pre> i.vars[code] = o.vars</pre></code><tr><td>71<td><code><pre> for lang, msg := range trans {</pre></code><tr><td>72<td><code><pre> i.bundle.MustAddMessages(lang, &i18n.Message{</pre></code><tr><td>73<td><code><pre> ID: id,</pre></code><tr><td>74<td><code><pre> Hash: msg.Hash,</pre></code><tr><td>75<td><code><pre> Description: msg.Description,</pre></code><tr><td>76<td><code><pre> LeftDelim: msg.LeftDelim,</pre></code><tr><td>77<td><code><pre> RightDelim: msg.RightDelim,</pre></code><tr><td>78<td><code><pre> Zero: msg.Zero,</pre></code><tr><td>79<td><code><pre> One: msg.One,</pre></code><tr><td>80<td><code><pre> Two: msg.Two,</pre></code><tr><td>81<td><code><pre> Few: msg.Few,</pre></code><tr><td>82<td><code><pre> Many: msg.Many,</pre></code><tr><td>83<td><code><pre> Other: msg.Other,</pre></code><tr><td>84<td><code><pre> })</pre></code><tr><td>85<td><code><pre> }</pre></code><tr><td>86<td><code><pre> return i</pre></code><tr><td>87<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewBundle>func NewBundle</div><div class=info><a href=#s_fn_NewBundle>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/i18n.go</code>:</div><table class=listing><tr><td>37<td><code><pre>func NewBundle[T comparable](lang language.Tag) Localizable[T] {</pre></code><tr><td>38<td><code><pre> b := &bundle[T]{</pre></code><tr><td>39<td><code><pre> dup: utils.NewSet[T](),</pre></code><tr><td>40<td><code><pre> bundle: i18n.NewBundle(lang),</pre></code><tr><td>41<td><code><pre> vars: make(map[T][]string),</pre></code><tr><td>42<td><code><pre> }</pre></code><tr><td>43<td><code><pre></pre></code><tr><td>44<td><code><pre> b.bundle.RegisterUnmarshalFunc("json", json.Unmarshal)</pre></code><tr><td>45<td><code><pre> b.bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal)</pre></code><tr><td>46<td><code><pre> b.bundle.RegisterUnmarshalFunc("yaml", yaml.Unmarshal)</pre></code><tr><td>47<td><code><pre> b.bundle.RegisterUnmarshalFunc("yml", yaml.Unmarshal)</pre></code><tr><td>48<td><code><pre></pre></code><tr><td>49<td><code><pre> return b</pre></code><tr><td>50<td><code><pre>}</pre></code></table><div class=funcname id=fn_DefaultLang>func DefaultLang</div><div class=info><a href=#s_fn_DefaultLang>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/construct.go</code>:</div><table class=listing><tr><td>71<td><code><pre>func DefaultLang(opts ...utils.OptionExtender) (lang language.Tag) {</pre></code><tr><td>72<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>73<td><code><pre></pre></code><tr><td>74<td><code><pre> conf := new(Conf)</pre></code><tr><td>75<td><code><pre> utils.MustSuccess(config.Use(opt.appName).LoadComponentConfig(config.ComponentI18n, conf))</pre></code><tr><td>76<td><code><pre> return utils.Must(language.Parse(conf.DefaultLang))</pre></code><tr><td>77<td><code><pre>}</pre></code></table><div class=funcname id=fn_@51:9>func @51:9</div><div class=info><a href=#s_fn_@51:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/construct.go</code>:</div><table class=listing><tr><td>51<td><code><pre>func() {</pre></code><tr><td>52<td><code><pre> locker.Lock()</pre></code><tr><td>53<td><code><pre> defer locker.Unlock()</pre></code><tr><td>54<td><code><pre> Bundle = &bundle[int]{</pre></code><tr><td>55<td><code><pre> dup: utils.NewSet[int](),</pre></code><tr><td>56<td><code><pre> bundle: i18n.NewBundle(lang),</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre> }</pre></code></table><div class=funcname id=fn_AppName>func AppName</div><div class=info><a href=#s_fn_AppName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/construct.go</code>:</div><table class=listing><tr><td>65<td><code><pre>func AppName(name string) utils.OptionFunc[useOption] {</pre></code><tr><td>66<td><code><pre> return func(o *useOption) {</pre></code><tr><td>67<td><code><pre> o.appName = name</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre>}</pre></code></table><div class=funcname id=fn_@66:9>func @66:9</div><div class=info><a href=#s_fn_@66:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/construct.go</code>:</div><table class=listing><tr><td>66<td><code><pre>func(o *useOption) {</pre></code><tr><td>67<td><code><pre> o.appName = name</pre></code><tr><td>68<td><code><pre> }</pre></code></table><div class=funcname id=fn_@124:9>func @124:9</div><div class=info><a href=#s_fn_@124:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/i18n.go</code>:</div><table class=listing><tr><td>124<td><code><pre>func(o *localizeOption) {</pre></code><tr><td>125<td><code><pre> o.templateData = data</pre></code><tr><td>126<td><code><pre> }</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/construct.go</code>:</div><table class=listing><tr><td>79<td><code><pre>func init() {</pre></code><tr><td>80<td><code><pre> config.AddComponent(config.ComponentI18n, Construct, config.WithFlag(&flagString))</pre></code><tr><td>81<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/flag.go</code>:</div><table class=listing><tr><td>7<td><code><pre>func init() {</pre></code><tr><td>8<td><code><pre> pflag.StringVarP(&flagString, "i18n-config", "", "", "json string for i18n config")</pre></code><tr><td>9<td><code><pre>}</pre></code></table><div class=funcname id=fn_Langs>func Langs</div><div class=info><a href=#s_fn_Langs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/i18n.go</code>:</div><table class=listing><tr><td>141<td><code><pre>func Langs(langs []string) utils.OptionFunc[localizeOption] {</pre></code><tr><td>142<td><code><pre> return func(o *localizeOption) {</pre></code><tr><td>143<td><code><pre> if len(langs) > 0 {</pre></code><tr><td>144<td><code><pre> o.lang, _ = language.Parse(langs[0])</pre></code><tr><td>145<td><code><pre> }</pre></code><tr><td>146<td><code><pre> o.langs = clone.SliceComparable(langs)</pre></code><tr><td>147<td><code><pre> }</pre></code><tr><td>148<td><code><pre>}</pre></code></table><div class=funcname id=fn_Var>func Var</div><div class=info><a href=#s_fn_Var>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/i18n.go</code>:</div><table class=listing><tr><td>56<td><code><pre>func Var(vars ...string) utils.OptionFunc[addMessagesOption] {</pre></code><tr><td>57<td><code><pre> return func(o *addMessagesOption) {</pre></code><tr><td>58<td><code><pre> o.vars = vars</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre>}</pre></code></table><div class=funcname id=fn_@57:9>func @57:9</div><div class=info><a href=#s_fn_@57:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/i18n.go</code>:</div><table class=listing><tr><td>57<td><code><pre>func(o *addMessagesOption) {</pre></code><tr><td>58<td><code><pre> o.vars = vars</pre></code><tr><td>59<td><code><pre> }</pre></code></table><div class=funcname id=fn_Param>func Param</div><div class=info><a href=#s_fn_Param>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/i18n.go</code>:</div><table class=listing><tr><td>123<td><code><pre>func Param(data map[string]any) utils.OptionFunc[localizeOption] {</pre></code><tr><td>124<td><code><pre> return func(o *localizeOption) {</pre></code><tr><td>125<td><code><pre> o.templateData = data</pre></code><tr><td>126<td><code><pre> }</pre></code><tr><td>127<td><code><pre>}</pre></code></table><div class=funcname id=fn_Construct>func Construct</div><div class=info><a href=#s_fn_Construct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/construct.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func Construct(ctx context.Context, conf Conf, opts ...utils.OptionExtender) func() {</pre></code><tr><td>17<td><code><pre> var err error</pre></code><tr><td>18<td><code><pre> lang := defaultLang</pre></code><tr><td>19<td><code><pre> if utils.IsStrNotBlank(conf.DefaultLang) {</pre></code><tr><td>20<td><code><pre> if lang, err = language.Parse(conf.DefaultLang); err != nil {</pre></code><tr class=miss><td>21<td><code><pre> panic(err)</pre></code><tr><td>22<td><code><pre> }</pre></code><tr><td>23<td><code><pre> }</pre></code><tr><td>24<td><code><pre></pre></code><tr><td>25<td><code><pre> opt := utils.ApplyOptions[config.InitOption](opts...)</pre></code><tr><td>26<td><code><pre> optU := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>27<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>28<td><code><pre> opt.AppName = optU.appName</pre></code><tr><td>29<td><code><pre> }</pre></code><tr><td>30<td><code><pre></pre></code><tr><td>31<td><code><pre> locker.Lock()</pre></code><tr><td>32<td><code><pre> defer locker.Unlock()</pre></code><tr><td>33<td><code><pre> if Bundle == nil {</pre></code><tr><td>34<td><code><pre> Bundle = &bundle[int]{</pre></code><tr><td>35<td><code><pre> dup: utils.NewSet[int](),</pre></code><tr><td>36<td><code><pre> bundle: i18n.NewBundle(lang),</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre> Bundle.bundle.RegisterUnmarshalFunc("json", json.Unmarshal)</pre></code><tr><td>39<td><code><pre> Bundle.bundle.RegisterUnmarshalFunc("toml", toml.Unmarshal)</pre></code><tr><td>40<td><code><pre> Bundle.bundle.RegisterUnmarshalFunc("yaml", yaml.Unmarshal)</pre></code><tr><td>41<td><code><pre> Bundle.bundle.RegisterUnmarshalFunc("yml", yaml.Unmarshal)</pre></code><tr><td>42<td><code><pre> }</pre></code><tr><td>43<td><code><pre></pre></code><tr><td>44<td><code><pre> // ioc</pre></code><tr><td>45<td><code><pre> if opt.DI != nil {</pre></code><tr><td>46<td><code><pre> opt.DI.</pre></code><tr><td>47<td><code><pre> MustProvide(func() Localizable[int] { return NewBundle[int](lang) }).</pre></code><tr><td>48<td><code><pre> MustProvide(func() Localizable[string] { return NewBundle[string](lang) })</pre></code><tr><td>49<td><code><pre> }</pre></code><tr><td>50<td><code><pre></pre></code><tr><td>51<td><code><pre> return func() {</pre></code><tr><td>52<td><code><pre> locker.Lock()</pre></code><tr><td>53<td><code><pre> defer locker.Unlock()</pre></code><tr><td>54<td><code><pre> Bundle = &bundle[int]{</pre></code><tr><td>55<td><code><pre> dup: utils.NewSet[int](),</pre></code><tr><td>56<td><code><pre> bundle: i18n.NewBundle(lang),</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre>}</pre></code></table><div class=funcname id=fn_@142:9>func @142:9</div><div class=info><a href=#s_fn_@142:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/i18n.go</code>:</div><table class=listing><tr><td>142<td><code><pre>func(o *localizeOption) {</pre></code><tr><td>143<td><code><pre> if len(langs) > 0 {</pre></code><tr class=miss><td>144<td><code><pre> o.lang, _ = language.Parse(langs[0])</pre></code><tr><td>145<td><code><pre> }</pre></code><tr><td>146<td><code><pre> o.langs = clone.SliceComparable(langs)</pre></code><tr><td>147<td><code><pre> }</pre></code></table><div class=funcname id=fn_bundle[T].Localize>func bundle[T].Localize</div><div class=info><a href=#s_fn_bundle[T].Localize>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/i18n.go</code>:</div><table class=listing><tr><td>150<td><code><pre>func (i *bundle[T]) Localize(code T, opts ...utils.OptionExtender) (message string) {</pre></code><tr><td>151<td><code><pre> option := utils.ApplyOptions[localizeOption](opts...)</pre></code><tr><td>152<td><code><pre> if option.templateData == nil && len(i.vars) > 0 {</pre></code><tr class=miss><td>153<td><code><pre> option.templateData = make(map[string]any, len(i.vars))</pre></code><tr><td>154<td><code><pre> }</pre></code><tr><td>155<td><code><pre></pre></code><tr><td>156<td><code><pre> // TODO: Access the third-party internationalization platform to obtain text</pre></code><tr><td>157<td><code><pre> cfg := &i18n.LocalizeConfig{</pre></code><tr><td>158<td><code><pre> MessageID: cast.ToString(code),</pre></code><tr><td>159<td><code><pre> TemplateData: option.templateData,</pre></code><tr><td>160<td><code><pre> PluralCount: option.pluralCount,</pre></code><tr><td>161<td><code><pre> }</pre></code><tr><td>162<td><code><pre></pre></code><tr><td>163<td><code><pre> i.mutex.RLock()</pre></code><tr><td>164<td><code><pre> defer i.mutex.RUnlock()</pre></code><tr><td>165<td><code><pre> // Assign an empty string to a variable to avoid rendering < no value > data</pre></code><tr><td>166<td><code><pre> for _, v := range i.vars[code] {</pre></code><tr><td>167<td><code><pre> if _, ok := option.templateData[v]; !ok {</pre></code><tr class=miss><td>168<td><code><pre> option.templateData[v] = ""</pre></code><tr><td>169<td><code><pre> }</pre></code><tr><td>170<td><code><pre> }</pre></code><tr><td>171<td><code><pre> message, err := i18n.NewLocalizer(i.bundle, option.langs...).Localize(cfg)</pre></code><tr><td>172<td><code><pre> if err == nil {</pre></code><tr><td>173<td><code><pre> return</pre></code><tr><td>174<td><code><pre> }</pre></code><tr class=miss><td>175<td><code><pre> message, ok := defaultErrorMessages[option.lang]</pre></code><tr class=miss><td>176<td><code><pre> if ok {</pre></code><tr class=miss><td>177<td><code><pre> return</pre></code><tr><td>178<td><code><pre> }</pre></code><tr><td>179<td><code><pre></pre></code><tr class=miss><td>180<td><code><pre> return defaultErrorMessages[defaultLang]</pre></code><tr><td>181<td><code><pre>}</pre></code></table><div class=funcname id=fn_bundle[T].checkDuplicated>func bundle[T].checkDuplicated</div><div class=info><a href=#s_fn_bundle[T].checkDuplicated>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/i18n.go</code>:</div><table class=listing><tr><td>89<td><code><pre>func (i *bundle[T]) checkDuplicated(code T, trans map[language.Tag]*Message) {</pre></code><tr><td>90<td><code><pre> if !i.dup.Contains(code) {</pre></code><tr><td>91<td><code><pre> i.dup.Insert(code)</pre></code><tr><td>92<td><code><pre> return</pre></code><tr><td>93<td><code><pre> }</pre></code><tr class=miss><td>94<td><code><pre> if trans == nil {</pre></code><tr class=miss><td>95<td><code><pre> panic(errors.Errorf("%+v %s code translation is empty", code, cast.ToString(code)))</pre></code><tr><td>96<td><code><pre> }</pre></code><tr><td>97<td><code><pre></pre></code><tr><td>98<td><code><pre> // panic if duplicated</pre></code><tr class=miss><td>99<td><code><pre> var (</pre></code><tr><td>100<td><code><pre> cfg = &i18n.LocalizeConfig{MessageID: cast.ToString(code)}</pre></code><tr><td>101<td><code><pre> existMsgEn = i18n.NewLocalizer(i.bundle, language.English.String()).MustLocalize(cfg)</pre></code><tr><td>102<td><code><pre> existMsgCn = i18n.NewLocalizer(i.bundle, language.Chinese.String()).MustLocalize(cfg)</pre></code><tr><td>103<td><code><pre> dupMsgCn, dupMsgEn string</pre></code><tr><td>104<td><code><pre> )</pre></code><tr class=miss><td>105<td><code><pre> if dupMsg, ok := trans[language.Chinese]; ok {</pre></code><tr class=miss><td>106<td><code><pre> dupMsgCn = dupMsg.Other</pre></code><tr><td>107<td><code><pre> }</pre></code><tr class=miss><td>108<td><code><pre> if dupMsg, ok := trans[language.English]; ok {</pre></code><tr class=miss><td>109<td><code><pre> dupMsgEn = dupMsg.Other</pre></code><tr><td>110<td><code><pre> }</pre></code><tr><td>111<td><code><pre></pre></code><tr class=miss><td>112<td><code><pre> panic(errors.Errorf("%s(%s)(%+v)(%v) is duplicated with %s(%s)",</pre></code><tr><td>113<td><code><pre> dupMsgCn, dupMsgEn, code, cast.ToString(code), existMsgCn, existMsgEn))</pre></code><tr><td>114<td><code><pre>}</pre></code></table><div class=funcname id=fn_@130:9>func @130:9</div><div class=info><a href=#s_fn_@130:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/i18n.go</code>:</div><table class=listing><tr><td>130<td><code><pre>func(o *localizeOption) {</pre></code><tr class=miss><td>131<td><code><pre> o.pluralCount = pluralCount</pre></code><tr><td>132<td><code><pre> }</pre></code></table><div class=funcname id=fn_Lang>func Lang</div><div class=info><a href=#s_fn_Lang>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/i18n.go</code>:</div><table class=listing><tr><td>135<td><code><pre>func Lang(lang language.Tag) utils.OptionFunc[localizeOption] {</pre></code><tr class=miss><td>136<td><code><pre> return func(o *localizeOption) {</pre></code><tr><td>137<td><code><pre> o.lang = lang</pre></code><tr><td>138<td><code><pre> }</pre></code><tr><td>139<td><code><pre>}</pre></code></table><div class=funcname id=fn_@136:9>func @136:9</div><div class=info><a href=#s_fn_@136:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/i18n.go</code>:</div><table class=listing><tr><td>136<td><code><pre>func(o *localizeOption) {</pre></code><tr class=miss><td>137<td><code><pre> o.lang = lang</pre></code><tr><td>138<td><code><pre> }</pre></code></table><div class=funcname id=fn_@47:16>func @47:16</div><div class=info><a href=#s_fn_@47:16>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/construct.go</code>:</div><table class=listing><tr class=miss><td>47<td><code><pre>func() Localizable[int] { return NewBundle[int](lang) }</pre></code></table><div class=funcname id=fn_@48:16>func @48:16</div><div class=info><a href=#s_fn_@48:16>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/construct.go</code>:</div><table class=listing><tr class=miss><td>48<td><code><pre>func() Localizable[string] { return NewBundle[string](lang) }</pre></code></table><div class=funcname id=fn_Plural>func Plural</div><div class=info><a href=#s_fn_Plural>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/i18n/i18n.go</code>:</div><table class=listing><tr><td>129<td><code><pre>func Plural(pluralCount any) utils.OptionFunc[localizeOption] {</pre></code><tr class=miss><td>130<td><code><pre> return func(o *localizeOption) {</pre></code><tr><td>131<td><code><pre> o.pluralCount = pluralCount</pre></code><tr><td>132<td><code><pre> }</pre></code><tr><td>133<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/internal/configor class=funcname>Package Overview: github.com/wfusion/gofusion/internal/configor 33 <span class=packageTotal>59.3%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_Configor.GetErrorOnUnmatchedKeys><td><code><a href=#fn_Configor.GetErrorOnUnmatchedKeys>Configor.GetErrorOnUnmatchedKeys(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/configor.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Configor.Load><td><code><a href=#fn_Configor.Load>Configor.Load(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/configor.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_@166:6><td><code><a href=#fn_@166:6>@166:6(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/configor.go</code><td class=percent><code>84.6%</code><td class=linecount><code>11/13</code><tr id=s_fn_Configor.load><td><code><a href=#fn_Configor.load>Configor.load(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/utils.go</code><td class=percent><code>83.3%</code><td class=linecount><code>30/36</code><tr id=s_fn_@96:13><td><code><a href=#fn_@96:13>@96:13(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/configor.go</code><td class=percent><code>77.8%</code><td class=linecount><code>7/9</code><tr id=s_fn_@317:11><td><code><a href=#fn_@317:11>@317:11(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/utils.go</code><td class=percent><code>75.0%</code><td class=linecount><code>9/12</code><tr id=s_fn_unmarshalJSON><td><code><a href=#fn_unmarshalJSON>unmarshalJSON(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/utils.go</code><td class=percent><code>75.0%</code><td class=linecount><code>6/8</code><tr id=s_fn_unmarshalToml><td><code><a href=#fn_unmarshalToml>unmarshalToml(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/utils.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_Configor.GetEnvironment><td><code><a href=#fn_Configor.GetEnvironment>Configor.GetEnvironment(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/configor.go</code><td class=percent><code>71.4%</code><td class=linecount><code>5/7</code><tr id=s_fn_getPrefixForStruct><td><code><a href=#fn_getPrefixForStruct>getPrefixForStruct(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/utils.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_Configor.getConfigurationFileWithENVPrefix><td><code><a href=#fn_Configor.getConfigurationFileWithENVPrefix>Configor.getConfigurationFileWithENVPrefix(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/utils.go</code><td class=percent><code>62.5%</code><td class=linecount><code>5/8</code><tr id=s_fn_Configor.getConfigurationFiles><td><code><a href=#fn_Configor.getConfigurationFiles>Configor.getConfigurationFiles(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/utils.go</code><td class=percent><code>61.3%</code><td class=linecount><code>19/31</code><tr id=s_fn_New><td><code><a href=#fn_New>New(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/configor.go</code><td class=percent><code>60.0%</code><td class=linecount><code>9/15</code><tr id=s_fn_Configor.getENVPrefix><td><code><a href=#fn_Configor.getENVPrefix>Configor.getENVPrefix(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/utils.go</code><td class=percent><code>60.0%</code><td class=linecount><code>3/5</code><tr id=s_fn_Configor.processTags><td><code><a href=#fn_Configor.processTags>Configor.processTags(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/utils.go</code><td class=percent><code>57.5%</code><td class=linecount><code>23/40</code><tr id=s_fn_@346:8><td><code><a href=#fn_@346:8>@346:8(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/utils.go</code><td class=percent><code>28.6%</code><td class=linecount><code>2/7</code><tr id=s_fn_Configor.processFile><td><code><a href=#fn_Configor.processFile>Configor.processFile(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/utils.go</code><td class=percent><code>27.3%</code><td class=linecount><code>9/33</code><tr id=s_fn_@114:18><td><code><a href=#fn_@114:18>@114:18(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/configor.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/9</code><tr id=s_fn_@146:14><td><code><a href=#fn_@146:14>@146:14(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Load><td><code><a href=#fn_Load>Load(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/configor.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_ENV><td><code><a href=#fn_ENV>ENV(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/configor.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@111:18><td><code><a href=#fn_@111:18>@111:18(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/configor.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_UnmatchedTomlKeysError.Error><td><code><a href=#fn_UnmatchedTomlKeysError.Error>UnmatchedTomlKeysError.Error(...)</a></code><td><code>github.com/wfusion/gofusion/internal/configor/utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_Configor.GetErrorOnUnmatchedKeys>func Configor.GetErrorOnUnmatchedKeys</div><div class=info><a href=#s_fn_Configor.GetErrorOnUnmatchedKeys>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/configor.go</code>:</div><table class=listing><tr><td>153<td><code><pre>func (c *Configor) GetErrorOnUnmatchedKeys() bool {</pre></code><tr><td>154<td><code><pre> return c.ErrorOnUnmatchedKeys</pre></code><tr><td>155<td><code><pre>}</pre></code></table><div class=funcname id=fn_Configor.Load>func Configor.Load</div><div class=info><a href=#s_fn_Configor.Load>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/configor.go</code>:</div><table class=listing><tr><td>158<td><code><pre>func (c *Configor) Load(config any, files ...string) (err error) {</pre></code><tr><td>159<td><code><pre> defaultValue := reflect.Indirect(reflect.ValueOf(config))</pre></code><tr><td>160<td><code><pre> if !defaultValue.CanAddr() {</pre></code><tr class=miss><td>161<td><code><pre> return fmt.Errorf("config %v should be addressable", config)</pre></code><tr><td>162<td><code><pre> }</pre></code><tr><td>163<td><code><pre> err, _ = c.load(config, false, files...)</pre></code><tr><td>164<td><code><pre></pre></code><tr><td>165<td><code><pre> if c.Config.AutoReload {</pre></code><tr><td>166<td><code><pre> go func() {</pre></code><tr><td>167<td><code><pre> timer := time.NewTimer(c.Config.AutoReloadInterval)</pre></code><tr><td>168<td><code><pre> for range timer.C {</pre></code><tr><td>169<td><code><pre> reflectPtr := reflect.New(reflect.ValueOf(config).Elem().Type())</pre></code><tr><td>170<td><code><pre> reflectPtr.Elem().Set(defaultValue)</pre></code><tr><td>171<td><code><pre></pre></code><tr><td>172<td><code><pre> var changed bool</pre></code><tr><td>173<td><code><pre> if err, changed = c.load(reflectPtr.Interface(), true, files...); err == nil && changed {</pre></code><tr><td>174<td><code><pre> reflect.ValueOf(config).Elem().Set(reflectPtr.Elem())</pre></code><tr><td>175<td><code><pre> if c.Config.AutoReloadCallback != nil {</pre></code><tr><td>176<td><code><pre> c.Config.AutoReloadCallback(config)</pre></code><tr><td>177<td><code><pre> }</pre></code><tr><td>178<td><code><pre> } else if err != nil {</pre></code><tr><td>179<td><code><pre> if !c.Silent {</pre></code><tr><td>180<td><code><pre> fmt.Printf("Failed to reload configuration from %v, got error %v\n", files, err)</pre></code><tr><td>181<td><code><pre> }</pre></code><tr><td>182<td><code><pre> }</pre></code><tr><td>183<td><code><pre> timer.Reset(c.Config.AutoReloadInterval)</pre></code><tr><td>184<td><code><pre> }</pre></code><tr><td>185<td><code><pre> }()</pre></code><tr><td>186<td><code><pre> }</pre></code><tr><td>187<td><code><pre> return</pre></code><tr><td>188<td><code><pre>}</pre></code></table><div class=funcname id=fn_@166:6>func @166:6</div><div class=info><a href=#s_fn_@166:6>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/configor.go</code>:</div><table class=listing><tr><td>166<td><code><pre>func() {</pre></code><tr><td>167<td><code><pre> timer := time.NewTimer(c.Config.AutoReloadInterval)</pre></code><tr><td>168<td><code><pre> for range timer.C {</pre></code><tr><td>169<td><code><pre> reflectPtr := reflect.New(reflect.ValueOf(config).Elem().Type())</pre></code><tr><td>170<td><code><pre> reflectPtr.Elem().Set(defaultValue)</pre></code><tr><td>171<td><code><pre></pre></code><tr><td>172<td><code><pre> var changed bool</pre></code><tr><td>173<td><code><pre> if err, changed = c.load(reflectPtr.Interface(), true, files...); err == nil && changed {</pre></code><tr><td>174<td><code><pre> reflect.ValueOf(config).Elem().Set(reflectPtr.Elem())</pre></code><tr><td>175<td><code><pre> if c.Config.AutoReloadCallback != nil {</pre></code><tr><td>176<td><code><pre> c.Config.AutoReloadCallback(config)</pre></code><tr><td>177<td><code><pre> }</pre></code><tr><td>178<td><code><pre> } else if err != nil {</pre></code><tr class=miss><td>179<td><code><pre> if !c.Silent {</pre></code><tr class=miss><td>180<td><code><pre> fmt.Printf("Failed to reload configuration from %v, got error %v\n", files, err)</pre></code><tr><td>181<td><code><pre> }</pre></code><tr><td>182<td><code><pre> }</pre></code><tr><td>183<td><code><pre> timer.Reset(c.Config.AutoReloadInterval)</pre></code><tr><td>184<td><code><pre> }</pre></code><tr><td>185<td><code><pre> }</pre></code></table><div class=funcname id=fn_Configor.load>func Configor.load</div><div class=info><a href=#s_fn_Configor.load>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/utils.go</code>:</div><table class=listing><tr><td>345<td><code><pre>func (c *Configor) load(config any, watchMode bool, files ...string) (err error, changed bool) {</pre></code><tr><td>346<td><code><pre> defer func() {</pre></code><tr><td>347<td><code><pre> if r := recover(); r != nil {</pre></code><tr><td>348<td><code><pre> err = errors.Errorf("panic %s =>\n%s", r, debug.Stack())</pre></code><tr><td>349<td><code><pre> return</pre></code><tr><td>350<td><code><pre> }</pre></code><tr><td>351<td><code><pre> if c.Config.Debug || c.Config.Verbose {</pre></code><tr><td>352<td><code><pre> if err != nil {</pre></code><tr><td>353<td><code><pre> fmt.Printf("Failed to load configuration from %v, got %v\n", files, err)</pre></code><tr><td>354<td><code><pre> }</pre></code><tr><td>355<td><code><pre></pre></code><tr><td>356<td><code><pre> fmt.Printf("Configuration:\n %#v\n", config)</pre></code><tr><td>357<td><code><pre> }</pre></code><tr><td>358<td><code><pre> }()</pre></code><tr><td>359<td><code><pre></pre></code><tr><td>360<td><code><pre> configFiles, configModTimeMap, hashMap := c.getConfigurationFiles(watchMode, files...)</pre></code><tr><td>361<td><code><pre> if watchMode && len(configModTimeMap) == len(c.configModTimes) && len(hashMap) == len(c.configHash) {</pre></code><tr><td>362<td><code><pre> var changed bool</pre></code><tr><td>363<td><code><pre> for f, curModTime := range configModTimeMap {</pre></code><tr><td>364<td><code><pre> curHash := hashMap[f]</pre></code><tr><td>365<td><code><pre> preHash, ok1 := c.configHash[f]</pre></code><tr><td>366<td><code><pre> preModTime, ok2 := c.configModTimes[f]</pre></code><tr><td>367<td><code><pre> if changed = !ok1 || !ok2 || curModTime.After(preModTime) || curHash != preHash; changed {</pre></code><tr class=miss><td>368<td><code><pre> break</pre></code><tr><td>369<td><code><pre> }</pre></code><tr><td>370<td><code><pre> }</pre></code><tr><td>371<td><code><pre></pre></code><tr><td>372<td><code><pre> if !changed {</pre></code><tr><td>373<td><code><pre> return nil, false</pre></code><tr><td>374<td><code><pre> }</pre></code><tr><td>375<td><code><pre> }</pre></code><tr><td>376<td><code><pre></pre></code><tr><td>377<td><code><pre> type withBeforeCallback interface {</pre></code><tr><td>378<td><code><pre> BeforeLoad(opts ...utils.OptionExtender)</pre></code><tr><td>379<td><code><pre> }</pre></code><tr><td>380<td><code><pre> type withAfterCallback interface {</pre></code><tr><td>381<td><code><pre> AfterLoad(opts ...utils.OptionExtender)</pre></code><tr><td>382<td><code><pre> }</pre></code><tr><td>383<td><code><pre> if cb, ok := config.(withBeforeCallback); ok {</pre></code><tr><td>384<td><code><pre> cb.BeforeLoad()</pre></code><tr><td>385<td><code><pre> }</pre></code><tr><td>386<td><code><pre> if cb, ok := config.(withAfterCallback); ok {</pre></code><tr><td>387<td><code><pre> defer cb.AfterLoad()</pre></code><tr><td>388<td><code><pre> }</pre></code><tr><td>389<td><code><pre></pre></code><tr><td>390<td><code><pre> for _, file := range configFiles {</pre></code><tr><td>391<td><code><pre> if c.Config.Debug || c.Config.Verbose {</pre></code><tr class=miss><td>392<td><code><pre> fmt.Printf("Loading configurations from file '%v'...\n", file)</pre></code><tr><td>393<td><code><pre> }</pre></code><tr><td>394<td><code><pre> if err = c.processFile(config, file, c.GetErrorOnUnmatchedKeys()); err != nil {</pre></code><tr class=miss><td>395<td><code><pre> return err, true</pre></code><tr><td>396<td><code><pre> }</pre></code><tr><td>397<td><code><pre> }</pre></code><tr><td>398<td><code><pre></pre></code><tr><td>399<td><code><pre> // process defaults after process file because map struct should be assigned first</pre></code><tr><td>400<td><code><pre> _ = utils.ParseTag(config, utils.ParseTagName("default"), utils.ParseTagUnmarshalType(utils.UnmarshalTypeYaml))</pre></code><tr><td>401<td><code><pre></pre></code><tr><td>402<td><code><pre> // process file again to ensure read config from file</pre></code><tr><td>403<td><code><pre> for _, file := range configFiles {</pre></code><tr><td>404<td><code><pre> if c.Config.Debug || c.Config.Verbose {</pre></code><tr class=miss><td>405<td><code><pre> fmt.Printf("Loading configurations from file '%v'...\n", file)</pre></code><tr><td>406<td><code><pre> }</pre></code><tr><td>407<td><code><pre> if err = c.processFile(config, file, c.GetErrorOnUnmatchedKeys()); err != nil {</pre></code><tr class=miss><td>408<td><code><pre> return err, true</pre></code><tr><td>409<td><code><pre> }</pre></code><tr><td>410<td><code><pre> }</pre></code><tr><td>411<td><code><pre></pre></code><tr><td>412<td><code><pre> c.configHash = hashMap</pre></code><tr><td>413<td><code><pre> c.configModTimes = configModTimeMap</pre></code><tr><td>414<td><code><pre></pre></code><tr><td>415<td><code><pre> if prefix := c.getENVPrefix(config); prefix == "-" {</pre></code><tr class=miss><td>416<td><code><pre> err = c.processTags(config)</pre></code><tr><td>417<td><code><pre> } else {</pre></code><tr><td>418<td><code><pre> err = c.processTags(config, prefix)</pre></code><tr><td>419<td><code><pre> }</pre></code><tr><td>420<td><code><pre></pre></code><tr><td>421<td><code><pre> // process defaults</pre></code><tr><td>422<td><code><pre> _ = utils.ParseTag(config, utils.ParseTagName("default"), utils.ParseTagUnmarshalType(utils.UnmarshalTypeYaml))</pre></code><tr><td>423<td><code><pre></pre></code><tr><td>424<td><code><pre> return err, true</pre></code><tr><td>425<td><code><pre>}</pre></code></table><div class=funcname id=fn_@96:13>func @96:13</div><div class=info><a href=#s_fn_@96:13>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/configor.go</code>:</div><table class=listing><tr><td>96<td><code><pre>func(name string) (h string, err error) {</pre></code><tr><td>97<td><code><pre> var file fs.File</pre></code><tr><td>98<td><code><pre> if file, err = os.Open(name); err != nil {</pre></code><tr class=miss><td>99<td><code><pre> return</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre> defer utils.CloseAnyway(file)</pre></code><tr><td>102<td><code><pre> sha256Hash := sha256.New()</pre></code><tr><td>103<td><code><pre> if _, err = io.Copy(sha256Hash, file); err != nil {</pre></code><tr class=miss><td>104<td><code><pre> return</pre></code><tr><td>105<td><code><pre> }</pre></code><tr><td>106<td><code><pre> h = string(sha256Hash.Sum(nil))</pre></code><tr><td>107<td><code><pre> return</pre></code><tr><td>108<td><code><pre> }</pre></code></table><div class=funcname id=fn_@317:11>func @317:11</div><div class=info><a href=#s_fn_@317:11>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/utils.go</code>:</div><table class=listing><tr><td>317<td><code><pre>func(field reflect.Value, fieldStruct reflect.StructField) {</pre></code><tr><td>318<td><code><pre> if !configValue.IsZero() {</pre></code><tr><td>319<td><code><pre> // load slice from env</pre></code><tr><td>320<td><code><pre> newVal := reflect.New(field.Type().Elem()).Elem()</pre></code><tr><td>321<td><code><pre> if newVal.Kind() == reflect.Struct {</pre></code><tr><td>322<td><code><pre> idx := 0</pre></code><tr><td>323<td><code><pre> for {</pre></code><tr><td>324<td><code><pre> newVal = reflect.New(field.Type().Elem()).Elem()</pre></code><tr><td>325<td><code><pre> if err := c.processTags(newVal.Addr().Interface(), append(</pre></code><tr><td>326<td><code><pre> getPrefixForStruct(prefixes, &fieldStruct), fmt.Sprint(idx))...); err != nil {</pre></code><tr class=miss><td>327<td><code><pre> return // err</pre></code><tr><td>328<td><code><pre> } else if reflect.DeepEqual(newVal.Interface(),</pre></code><tr><td>329<td><code><pre> reflect.New(field.Type().Elem()).Elem().Interface()) {</pre></code><tr><td>330<td><code><pre> break</pre></code><tr><td>331<td><code><pre> } else {</pre></code><tr class=miss><td>332<td><code><pre> idx++</pre></code><tr class=miss><td>333<td><code><pre> field.Set(reflect.Append(field, newVal))</pre></code><tr><td>334<td><code><pre> }</pre></code><tr><td>335<td><code><pre> }</pre></code><tr><td>336<td><code><pre> }</pre></code><tr><td>337<td><code><pre> }</pre></code><tr><td>338<td><code><pre> }</pre></code></table><div class=funcname id=fn_unmarshalJSON>func unmarshalJSON</div><div class=info><a href=#s_fn_unmarshalJSON>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/utils.go</code>:</div><table class=listing><tr><td>210<td><code><pre>func unmarshalJSON(data []byte, config any, errorOnUnmatchedKeys bool) error {</pre></code><tr><td>211<td><code><pre> reader := strings.NewReader(string(data))</pre></code><tr><td>212<td><code><pre> decoder := json.NewDecoder(reader)</pre></code><tr><td>213<td><code><pre></pre></code><tr><td>214<td><code><pre> if errorOnUnmatchedKeys {</pre></code><tr class=miss><td>215<td><code><pre> decoder.DisallowUnknownFields()</pre></code><tr><td>216<td><code><pre> }</pre></code><tr><td>217<td><code><pre></pre></code><tr><td>218<td><code><pre> err := decoder.Decode(config)</pre></code><tr><td>219<td><code><pre> if err != nil && err != io.EOF {</pre></code><tr class=miss><td>220<td><code><pre> return err</pre></code><tr><td>221<td><code><pre> }</pre></code><tr><td>222<td><code><pre> return nil</pre></code><tr><td>223<td><code><pre>}</pre></code></table><div class=funcname id=fn_unmarshalToml>func unmarshalToml</div><div class=info><a href=#s_fn_unmarshalToml>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/utils.go</code>:</div><table class=listing><tr><td>199<td><code><pre>func unmarshalToml(data []byte, config any, errorOnUnmatchedKeys bool) error {</pre></code><tr><td>200<td><code><pre> metadata, err := toml.Decode(string(data), config)</pre></code><tr><td>201<td><code><pre> if err == nil && len(metadata.Undecoded()) > 0 && errorOnUnmatchedKeys {</pre></code><tr class=miss><td>202<td><code><pre> return &UnmatchedTomlKeysError{Keys: metadata.Undecoded()}</pre></code><tr><td>203<td><code><pre> }</pre></code><tr><td>204<td><code><pre> return err</pre></code><tr><td>205<td><code><pre>}</pre></code></table><div class=funcname id=fn_Configor.GetEnvironment>func Configor.GetEnvironment</div><div class=info><a href=#s_fn_Configor.GetEnvironment>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/configor.go</code>:</div><table class=listing><tr><td>135<td><code><pre>func (c *Configor) GetEnvironment() string {</pre></code><tr><td>136<td><code><pre> if c.Environment == "" {</pre></code><tr><td>137<td><code><pre> if env := os.Getenv("CONFIGOR_ENV"); env != "" {</pre></code><tr class=miss><td>138<td><code><pre> return env</pre></code><tr><td>139<td><code><pre> }</pre></code><tr><td>140<td><code><pre></pre></code><tr><td>141<td><code><pre> if testRegexp.MatchString(os.Args[0]) {</pre></code><tr><td>142<td><code><pre> return "test"</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre></pre></code><tr class=miss><td>145<td><code><pre> return "development"</pre></code><tr><td>146<td><code><pre> }</pre></code><tr><td>147<td><code><pre> return c.Environment</pre></code><tr><td>148<td><code><pre>}</pre></code></table><div class=funcname id=fn_getPrefixForStruct>func getPrefixForStruct</div><div class=info><a href=#s_fn_getPrefixForStruct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/utils.go</code>:</div><table class=listing><tr><td>225<td><code><pre>func getPrefixForStruct(prefixes []string, fieldStruct *reflect.StructField) []string {</pre></code><tr><td>226<td><code><pre> if fieldStruct.Anonymous && fieldStruct.Tag.Get("anonymous") == "true" {</pre></code><tr class=miss><td>227<td><code><pre> return prefixes</pre></code><tr><td>228<td><code><pre> }</pre></code><tr><td>229<td><code><pre> return append(prefixes, fieldStruct.Name)</pre></code><tr><td>230<td><code><pre>}</pre></code></table><div class=funcname id=fn_Configor.getConfigurationFileWithENVPrefix>func Configor.getConfigurationFileWithENVPrefix</div><div class=info><a href=#s_fn_Configor.getConfigurationFileWithENVPrefix>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/utils.go</code>:</div><table class=listing><tr><td>72<td><code><pre>func (c *Configor) getConfigurationFileWithENVPrefix(file, env string) (string, time.Time, string, error) {</pre></code><tr><td>73<td><code><pre> var (</pre></code><tr><td>74<td><code><pre> envFile string</pre></code><tr><td>75<td><code><pre> extname = path.Ext(file)</pre></code><tr><td>76<td><code><pre> )</pre></code><tr><td>77<td><code><pre></pre></code><tr><td>78<td><code><pre> if extname == "" {</pre></code><tr class=miss><td>79<td><code><pre> envFile = fmt.Sprintf("%v.%v", file, env)</pre></code><tr><td>80<td><code><pre> } else {</pre></code><tr><td>81<td><code><pre> envFile = fmt.Sprintf("%v.%v%v", strings.TrimSuffix(file, extname), env, extname)</pre></code><tr><td>82<td><code><pre> }</pre></code><tr><td>83<td><code><pre></pre></code><tr><td>84<td><code><pre> if fileInfo, err := c.statFunc(envFile); err == nil && fileInfo.Mode().IsRegular() {</pre></code><tr class=miss><td>85<td><code><pre> fileHash, _ := c.hashFunc(envFile)</pre></code><tr class=miss><td>86<td><code><pre> return envFile, fileInfo.ModTime(), fileHash, nil</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre> return "", time.Now(), "", fmt.Errorf("failed to find file %v", file)</pre></code><tr><td>89<td><code><pre>}</pre></code></table><div class=funcname id=fn_Configor.getConfigurationFiles>func Configor.getConfigurationFiles</div><div class=info><a href=#s_fn_Configor.getConfigurationFiles>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/utils.go</code>:</div><table class=listing><tr><td>91<td><code><pre>func (c *Configor) getConfigurationFiles(watchMode bool, files ...string) (</pre></code><tr><td>92<td><code><pre> []string, map[string]time.Time, map[string]string) {</pre></code><tr><td>93<td><code><pre> resultKeys := make([]string, 0, len(files))</pre></code><tr><td>94<td><code><pre> hashResult := make(map[string]string, len(files))</pre></code><tr><td>95<td><code><pre> modTimeResult := make(map[string]time.Time, len(files))</pre></code><tr><td>96<td><code><pre> if !watchMode && (c.Config.Debug || c.Config.Verbose) {</pre></code><tr class=miss><td>97<td><code><pre> fmt.Printf("Current environment: '%v'\n", c.GetEnvironment())</pre></code><tr><td>98<td><code><pre> }</pre></code><tr><td>99<td><code><pre></pre></code><tr><td>100<td><code><pre> for i := len(files) - 1; i >= 0; i-- {</pre></code><tr><td>101<td><code><pre> foundFile := false</pre></code><tr><td>102<td><code><pre> file := files[i]</pre></code><tr><td>103<td><code><pre></pre></code><tr><td>104<td><code><pre> // check configuration</pre></code><tr><td>105<td><code><pre> if fileInfo, err := c.statFunc(file); err == nil && fileInfo.Mode().IsRegular() {</pre></code><tr><td>106<td><code><pre> foundFile = true</pre></code><tr><td>107<td><code><pre> resultKeys = append(resultKeys, file)</pre></code><tr><td>108<td><code><pre> modTimeResult[file] = fileInfo.ModTime()</pre></code><tr><td>109<td><code><pre> if hash, err := c.hashFunc(file); err == nil {</pre></code><tr><td>110<td><code><pre> hashResult[file] = hash</pre></code><tr><td>111<td><code><pre> }</pre></code><tr><td>112<td><code><pre> }</pre></code><tr><td>113<td><code><pre></pre></code><tr><td>114<td><code><pre> // check configuration with env</pre></code><tr><td>115<td><code><pre> if file, modTime, hash, err := c.getConfigurationFileWithENVPrefix(file, c.GetEnvironment()); err == nil {</pre></code><tr class=miss><td>116<td><code><pre> foundFile = true</pre></code><tr class=miss><td>117<td><code><pre> resultKeys = append(resultKeys, file)</pre></code><tr class=miss><td>118<td><code><pre> modTimeResult[file] = modTime</pre></code><tr class=miss><td>119<td><code><pre> if hash != "" {</pre></code><tr class=miss><td>120<td><code><pre> hashResult[file] = hash</pre></code><tr><td>121<td><code><pre> }</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre></pre></code><tr><td>124<td><code><pre> // check example configuration</pre></code><tr><td>125<td><code><pre> if !foundFile {</pre></code><tr><td>126<td><code><pre> if example, modTime, hash, err := c.getConfigurationFileWithENVPrefix(file, "example"); err == nil {</pre></code><tr class=miss><td>127<td><code><pre> if !watchMode && !c.Silent {</pre></code><tr class=miss><td>128<td><code><pre> log.Printf("Failed to find configuration %v, using example file %v\n", file, example)</pre></code><tr><td>129<td><code><pre> }</pre></code><tr class=miss><td>130<td><code><pre> resultKeys = append(resultKeys, example)</pre></code><tr class=miss><td>131<td><code><pre> modTimeResult[example] = modTime</pre></code><tr class=miss><td>132<td><code><pre> if hash != "" {</pre></code><tr class=miss><td>133<td><code><pre> hashResult[file] = hash</pre></code><tr><td>134<td><code><pre> }</pre></code><tr><td>135<td><code><pre> } else if !c.Silent {</pre></code><tr><td>136<td><code><pre> fmt.Printf("Failed to find configuration %v\n", file)</pre></code><tr><td>137<td><code><pre> }</pre></code><tr><td>138<td><code><pre> }</pre></code><tr><td>139<td><code><pre> }</pre></code><tr><td>140<td><code><pre> return resultKeys, modTimeResult, hashResult</pre></code><tr><td>141<td><code><pre>}</pre></code></table><div class=funcname id=fn_New>func New</div><div class=info><a href=#s_fn_New>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/configor.go</code>:</div><table class=listing><tr><td>70<td><code><pre>func New(config *Config) *Configor {</pre></code><tr><td>71<td><code><pre> if config == nil {</pre></code><tr class=miss><td>72<td><code><pre> config = &Config{}</pre></code><tr><td>73<td><code><pre> }</pre></code><tr><td>74<td><code><pre></pre></code><tr><td>75<td><code><pre> if os.Getenv("CONFIGOR_DEBUG_MODE") != "" {</pre></code><tr class=miss><td>76<td><code><pre> config.Debug = true</pre></code><tr><td>77<td><code><pre> }</pre></code><tr><td>78<td><code><pre></pre></code><tr><td>79<td><code><pre> if os.Getenv("CONFIGOR_VERBOSE_MODE") != "" {</pre></code><tr class=miss><td>80<td><code><pre> config.Verbose = true</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre></pre></code><tr><td>83<td><code><pre> if os.Getenv("CONFIGOR_SILENT_MODE") != "" {</pre></code><tr class=miss><td>84<td><code><pre> config.Silent = true</pre></code><tr><td>85<td><code><pre> }</pre></code><tr><td>86<td><code><pre></pre></code><tr><td>87<td><code><pre> if config.AutoReload && config.AutoReloadInterval == 0 {</pre></code><tr><td>88<td><code><pre> config.AutoReloadInterval = time.Second</pre></code><tr><td>89<td><code><pre> }</pre></code><tr><td>90<td><code><pre></pre></code><tr><td>91<td><code><pre> cfg := &Configor{</pre></code><tr><td>92<td><code><pre> Config: config,</pre></code><tr><td>93<td><code><pre> configHash: make(map[string]string),</pre></code><tr><td>94<td><code><pre> configModTimes: make(map[string]time.Time),</pre></code><tr><td>95<td><code><pre> statFunc: os.Stat,</pre></code><tr><td>96<td><code><pre> hashFunc: func(name string) (h string, err error) {</pre></code><tr><td>97<td><code><pre> var file fs.File</pre></code><tr><td>98<td><code><pre> if file, err = os.Open(name); err != nil {</pre></code><tr><td>99<td><code><pre> return</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre> defer utils.CloseAnyway(file)</pre></code><tr><td>102<td><code><pre> sha256Hash := sha256.New()</pre></code><tr><td>103<td><code><pre> if _, err = io.Copy(sha256Hash, file); err != nil {</pre></code><tr><td>104<td><code><pre> return</pre></code><tr><td>105<td><code><pre> }</pre></code><tr><td>106<td><code><pre> h = string(sha256Hash.Sum(nil))</pre></code><tr><td>107<td><code><pre> return</pre></code><tr><td>108<td><code><pre> },</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre> if cfg.FS != nil {</pre></code><tr class=miss><td>111<td><code><pre> cfg.statFunc = func(name string) (os.FileInfo, error) {</pre></code><tr><td>112<td><code><pre> return fs.Stat(cfg.FS, name)</pre></code><tr><td>113<td><code><pre> }</pre></code><tr class=miss><td>114<td><code><pre> cfg.hashFunc = func(name string) (h string, err error) {</pre></code><tr><td>115<td><code><pre> var file fs.File</pre></code><tr><td>116<td><code><pre> if file, err = cfg.FS.Open(name); err != nil {</pre></code><tr><td>117<td><code><pre> return</pre></code><tr><td>118<td><code><pre> }</pre></code><tr><td>119<td><code><pre> defer utils.CloseAnyway(file)</pre></code><tr><td>120<td><code><pre> sha256Hash := sha256.New()</pre></code><tr><td>121<td><code><pre> if _, err = io.Copy(sha256Hash, file); err != nil {</pre></code><tr><td>122<td><code><pre> return</pre></code><tr><td>123<td><code><pre> }</pre></code><tr><td>124<td><code><pre> h = string(sha256Hash.Sum(nil))</pre></code><tr><td>125<td><code><pre> return</pre></code><tr><td>126<td><code><pre> }</pre></code><tr><td>127<td><code><pre> }</pre></code><tr><td>128<td><code><pre></pre></code><tr><td>129<td><code><pre> return cfg</pre></code><tr><td>130<td><code><pre>}</pre></code></table><div class=funcname id=fn_Configor.getENVPrefix>func Configor.getENVPrefix</div><div class=info><a href=#s_fn_Configor.getENVPrefix>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/utils.go</code>:</div><table class=listing><tr><td>62<td><code><pre>func (c *Configor) getENVPrefix(config any) string {</pre></code><tr><td>63<td><code><pre> if c.Config.ENVPrefix == "" {</pre></code><tr><td>64<td><code><pre> if prefix := os.Getenv("CONFIGOR_ENV_PREFIX"); prefix != "" {</pre></code><tr class=miss><td>65<td><code><pre> return prefix</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre> return "Configor"</pre></code><tr><td>68<td><code><pre> }</pre></code><tr class=miss><td>69<td><code><pre> return c.Config.ENVPrefix</pre></code><tr><td>70<td><code><pre>}</pre></code></table><div class=funcname id=fn_Configor.processTags>func Configor.processTags</div><div class=info><a href=#s_fn_Configor.processTags>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/utils.go</code>:</div><table class=listing><tr><td>232<td><code><pre>func (c *Configor) processTags(config any, prefixes ...string) error {</pre></code><tr><td>233<td><code><pre> configValue := reflect.Indirect(reflect.ValueOf(config))</pre></code><tr><td>234<td><code><pre> if configValue.Kind() != reflect.Struct {</pre></code><tr class=miss><td>235<td><code><pre> return errors.New("invalid config, should be struct")</pre></code><tr><td>236<td><code><pre> }</pre></code><tr><td>237<td><code><pre></pre></code><tr><td>238<td><code><pre> configType := configValue.Type()</pre></code><tr><td>239<td><code><pre> for i := 0; i < configType.NumField(); i++ {</pre></code><tr><td>240<td><code><pre> var (</pre></code><tr><td>241<td><code><pre> envNames []string</pre></code><tr><td>242<td><code><pre> fieldStruct = configType.Field(i)</pre></code><tr><td>243<td><code><pre> field = configValue.Field(i)</pre></code><tr><td>244<td><code><pre> envName = fieldStruct.Tag.Get("env") // read configuration from shell env</pre></code><tr><td>245<td><code><pre> )</pre></code><tr><td>246<td><code><pre></pre></code><tr><td>247<td><code><pre> if !field.CanAddr() || !field.CanInterface() {</pre></code><tr class=miss><td>248<td><code><pre> continue</pre></code><tr><td>249<td><code><pre> }</pre></code><tr><td>250<td><code><pre></pre></code><tr><td>251<td><code><pre> if envName == "" {</pre></code><tr><td>252<td><code><pre> envNames = append(envNames,</pre></code><tr><td>253<td><code><pre> strings.Join(append(prefixes, fieldStruct.Name), "_")) // Configor_DB_Name</pre></code><tr><td>254<td><code><pre> envNames = append(envNames,</pre></code><tr><td>255<td><code><pre> strings.ToUpper(strings.Join(append(prefixes, fieldStruct.Name), "_"))) // CONFIGOR_DB_NAME</pre></code><tr><td>256<td><code><pre> } else {</pre></code><tr class=miss><td>257<td><code><pre> envNames = []string{envName}</pre></code><tr><td>258<td><code><pre> }</pre></code><tr><td>259<td><code><pre></pre></code><tr><td>260<td><code><pre> if c.Config.Verbose {</pre></code><tr class=miss><td>261<td><code><pre> fmt.Printf("Trying to load struct `%v`'s field `%v` from env %v\n",</pre></code><tr><td>262<td><code><pre> configType.Name(), fieldStruct.Name, strings.Join(envNames, ", "))</pre></code><tr><td>263<td><code><pre> }</pre></code><tr><td>264<td><code><pre></pre></code><tr><td>265<td><code><pre> // Load From Shell ENV</pre></code><tr><td>266<td><code><pre> for _, env := range envNames {</pre></code><tr><td>267<td><code><pre> if value := os.Getenv(env); value != "" {</pre></code><tr class=miss><td>268<td><code><pre> if c.Config.Debug || c.Config.Verbose {</pre></code><tr class=miss><td>269<td><code><pre> fmt.Printf("Loading configuration for struct `%v`'s field `%v` from env %v...\n",</pre></code><tr><td>270<td><code><pre> configType.Name(), fieldStruct.Name, env)</pre></code><tr><td>271<td><code><pre> }</pre></code><tr><td>272<td><code><pre></pre></code><tr class=miss><td>273<td><code><pre> switch reflect.Indirect(field).Kind() {</pre></code><tr><td>274<td><code><pre> case reflect.Bool:</pre></code><tr class=miss><td>275<td><code><pre> switch strings.ToLower(value) {</pre></code><tr><td>276<td><code><pre> case "", "0", "f", "false":</pre></code><tr class=miss><td>277<td><code><pre> field.Set(reflect.ValueOf(false))</pre></code><tr><td>278<td><code><pre> default:</pre></code><tr class=miss><td>279<td><code><pre> field.Set(reflect.ValueOf(true))</pre></code><tr><td>280<td><code><pre> }</pre></code><tr><td>281<td><code><pre> case reflect.String:</pre></code><tr class=miss><td>282<td><code><pre> field.Set(reflect.ValueOf(value))</pre></code><tr><td>283<td><code><pre> default:</pre></code><tr class=miss><td>284<td><code><pre> if err := yaml.Unmarshal([]byte(value), field.Addr().Interface()); err != nil {</pre></code><tr class=miss><td>285<td><code><pre> return err</pre></code><tr><td>286<td><code><pre> }</pre></code><tr><td>287<td><code><pre> }</pre></code><tr class=miss><td>288<td><code><pre> break</pre></code><tr><td>289<td><code><pre> }</pre></code><tr><td>290<td><code><pre> }</pre></code><tr><td>291<td><code><pre></pre></code><tr><td>292<td><code><pre> if isBlank := reflect.DeepEqual(field.Interface(), reflect.Zero(field.Type()).Interface()); isBlank &&</pre></code><tr><td>293<td><code><pre> fieldStruct.Tag.Get("required") == "true" {</pre></code><tr><td>294<td><code><pre> // return error if it is required but blank</pre></code><tr class=miss><td>295<td><code><pre> return errors.New(fieldStruct.Name + " is required, but blank")</pre></code><tr><td>296<td><code><pre> }</pre></code><tr><td>297<td><code><pre></pre></code><tr><td>298<td><code><pre> field = utils.IndirectValue(field)</pre></code><tr><td>299<td><code><pre> if field.Kind() == reflect.Struct {</pre></code><tr><td>300<td><code><pre> if err := c.processTags(field.Addr().Interface(),</pre></code><tr><td>301<td><code><pre> getPrefixForStruct(prefixes, &fieldStruct)...); err != nil {</pre></code><tr class=miss><td>302<td><code><pre> return err</pre></code><tr><td>303<td><code><pre> }</pre></code><tr><td>304<td><code><pre> }</pre></code><tr><td>305<td><code><pre></pre></code><tr><td>306<td><code><pre> if field.Kind() == reflect.Slice {</pre></code><tr><td>307<td><code><pre> if arrLen := field.Len(); arrLen > 0 {</pre></code><tr><td>308<td><code><pre> for i := 0; i < arrLen; i++ {</pre></code><tr><td>309<td><code><pre> if reflect.Indirect(field.Index(i)).Kind() == reflect.Struct {</pre></code><tr><td>310<td><code><pre> if err := c.processTags(field.Index(i).Addr().Interface(),</pre></code><tr><td>311<td><code><pre> append(getPrefixForStruct(prefixes, &fieldStruct), fmt.Sprint(i))...); err != nil {</pre></code><tr class=miss><td>312<td><code><pre> return err</pre></code><tr><td>313<td><code><pre> }</pre></code><tr><td>314<td><code><pre> }</pre></code><tr><td>315<td><code><pre> }</pre></code><tr><td>316<td><code><pre> } else {</pre></code><tr><td>317<td><code><pre> defer func(field reflect.Value, fieldStruct reflect.StructField) {</pre></code><tr><td>318<td><code><pre> if !configValue.IsZero() {</pre></code><tr><td>319<td><code><pre> // load slice from env</pre></code><tr><td>320<td><code><pre> newVal := reflect.New(field.Type().Elem()).Elem()</pre></code><tr><td>321<td><code><pre> if newVal.Kind() == reflect.Struct {</pre></code><tr><td>322<td><code><pre> idx := 0</pre></code><tr><td>323<td><code><pre> for {</pre></code><tr><td>324<td><code><pre> newVal = reflect.New(field.Type().Elem()).Elem()</pre></code><tr><td>325<td><code><pre> if err := c.processTags(newVal.Addr().Interface(), append(</pre></code><tr><td>326<td><code><pre> getPrefixForStruct(prefixes, &fieldStruct), fmt.Sprint(idx))...); err != nil {</pre></code><tr><td>327<td><code><pre> return // err</pre></code><tr><td>328<td><code><pre> } else if reflect.DeepEqual(newVal.Interface(),</pre></code><tr><td>329<td><code><pre> reflect.New(field.Type().Elem()).Elem().Interface()) {</pre></code><tr><td>330<td><code><pre> break</pre></code><tr><td>331<td><code><pre> } else {</pre></code><tr><td>332<td><code><pre> idx++</pre></code><tr><td>333<td><code><pre> field.Set(reflect.Append(field, newVal))</pre></code><tr><td>334<td><code><pre> }</pre></code><tr><td>335<td><code><pre> }</pre></code><tr><td>336<td><code><pre> }</pre></code><tr><td>337<td><code><pre> }</pre></code><tr><td>338<td><code><pre> }(field, fieldStruct)</pre></code><tr><td>339<td><code><pre> }</pre></code><tr><td>340<td><code><pre> }</pre></code><tr><td>341<td><code><pre> }</pre></code><tr><td>342<td><code><pre> return nil</pre></code><tr><td>343<td><code><pre>}</pre></code></table><div class=funcname id=fn_@346:8>func @346:8</div><div class=info><a href=#s_fn_@346:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/utils.go</code>:</div><table class=listing><tr><td>346<td><code><pre>func() {</pre></code><tr><td>347<td><code><pre> if r := recover(); r != nil {</pre></code><tr class=miss><td>348<td><code><pre> err = errors.Errorf("panic %s =>\n%s", r, debug.Stack())</pre></code><tr class=miss><td>349<td><code><pre> return</pre></code><tr><td>350<td><code><pre> }</pre></code><tr><td>351<td><code><pre> if c.Config.Debug || c.Config.Verbose {</pre></code><tr class=miss><td>352<td><code><pre> if err != nil {</pre></code><tr class=miss><td>353<td><code><pre> fmt.Printf("Failed to load configuration from %v, got %v\n", files, err)</pre></code><tr><td>354<td><code><pre> }</pre></code><tr><td>355<td><code><pre></pre></code><tr class=miss><td>356<td><code><pre> fmt.Printf("Configuration:\n %#v\n", config)</pre></code><tr><td>357<td><code><pre> }</pre></code><tr><td>358<td><code><pre> }</pre></code></table><div class=funcname id=fn_Configor.processFile>func Configor.processFile</div><div class=info><a href=#s_fn_Configor.processFile>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/utils.go</code>:</div><table class=listing><tr><td>143<td><code><pre>func (c *Configor) processFile(config any, file string, errorOnUnmatchedKeys bool) error {</pre></code><tr><td>144<td><code><pre> readFile := ioutil.ReadFile</pre></code><tr><td>145<td><code><pre> if c.FS != nil {</pre></code><tr class=miss><td>146<td><code><pre> readFile = func(filename string) ([]byte, error) {</pre></code><tr><td>147<td><code><pre> return fs.ReadFile(c.FS, filename)</pre></code><tr><td>148<td><code><pre> }</pre></code><tr><td>149<td><code><pre> }</pre></code><tr><td>150<td><code><pre> data, err := readFile(file)</pre></code><tr><td>151<td><code><pre> if err != nil {</pre></code><tr class=miss><td>152<td><code><pre> return err</pre></code><tr><td>153<td><code><pre> }</pre></code><tr><td>154<td><code><pre></pre></code><tr><td>155<td><code><pre> switch {</pre></code><tr><td>156<td><code><pre> case strings.HasSuffix(file, ".yaml") || strings.HasSuffix(file, ".yml"):</pre></code><tr><td>157<td><code><pre> if errorOnUnmatchedKeys {</pre></code><tr class=miss><td>158<td><code><pre> decoder := yaml.NewDecoder(bytes.NewBuffer(data))</pre></code><tr class=miss><td>159<td><code><pre> decoder.KnownFields(true)</pre></code><tr class=miss><td>160<td><code><pre> return decoder.Decode(config)</pre></code><tr><td>161<td><code><pre> }</pre></code><tr><td>162<td><code><pre> return yaml.Unmarshal(data, config)</pre></code><tr><td>163<td><code><pre> case strings.HasSuffix(file, ".toml"):</pre></code><tr><td>164<td><code><pre> return unmarshalToml(data, config, errorOnUnmatchedKeys)</pre></code><tr><td>165<td><code><pre> case strings.HasSuffix(file, ".json"):</pre></code><tr><td>166<td><code><pre> return unmarshalJSON(data, config, errorOnUnmatchedKeys)</pre></code><tr><td>167<td><code><pre> default:</pre></code><tr class=miss><td>168<td><code><pre> if err := unmarshalToml(data, config, errorOnUnmatchedKeys); err == nil {</pre></code><tr class=miss><td>169<td><code><pre> return nil</pre></code><tr class=miss><td>170<td><code><pre> } else if errUnmatchedKeys, ok := err.(*UnmatchedTomlKeysError); ok {</pre></code><tr class=miss><td>171<td><code><pre> return errUnmatchedKeys</pre></code><tr><td>172<td><code><pre> }</pre></code><tr><td>173<td><code><pre></pre></code><tr class=miss><td>174<td><code><pre> if err := unmarshalJSON(data, config, errorOnUnmatchedKeys); err == nil {</pre></code><tr class=miss><td>175<td><code><pre> return nil</pre></code><tr class=miss><td>176<td><code><pre> } else if strings.Contains(err.Error(), "json: unknown field") {</pre></code><tr class=miss><td>177<td><code><pre> return err</pre></code><tr><td>178<td><code><pre> }</pre></code><tr><td>179<td><code><pre></pre></code><tr class=miss><td>180<td><code><pre> var yamlError error</pre></code><tr class=miss><td>181<td><code><pre> if errorOnUnmatchedKeys {</pre></code><tr class=miss><td>182<td><code><pre> decoder := yaml.NewDecoder(bytes.NewBuffer(data))</pre></code><tr class=miss><td>183<td><code><pre> decoder.KnownFields(true)</pre></code><tr class=miss><td>184<td><code><pre> yamlError = decoder.Decode(config)</pre></code><tr><td>185<td><code><pre> } else {</pre></code><tr class=miss><td>186<td><code><pre> yamlError = yaml.Unmarshal(data, config)</pre></code><tr><td>187<td><code><pre> }</pre></code><tr><td>188<td><code><pre></pre></code><tr class=miss><td>189<td><code><pre> if yamlError == nil {</pre></code><tr class=miss><td>190<td><code><pre> return nil</pre></code><tr class=miss><td>191<td><code><pre> } else if yErr, ok := yamlError.(*yaml.TypeError); ok {</pre></code><tr class=miss><td>192<td><code><pre> return yErr</pre></code><tr><td>193<td><code><pre> }</pre></code><tr><td>194<td><code><pre></pre></code><tr class=miss><td>195<td><code><pre> return errors.New("failed to decode config")</pre></code><tr><td>196<td><code><pre> }</pre></code><tr><td>197<td><code><pre>}</pre></code></table><div class=funcname id=fn_@114:18>func @114:18</div><div class=info><a href=#s_fn_@114:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/configor.go</code>:</div><table class=listing><tr><td>114<td><code><pre>func(name string) (h string, err error) {</pre></code><tr class=miss><td>115<td><code><pre> var file fs.File</pre></code><tr class=miss><td>116<td><code><pre> if file, err = cfg.FS.Open(name); err != nil {</pre></code><tr class=miss><td>117<td><code><pre> return</pre></code><tr><td>118<td><code><pre> }</pre></code><tr class=miss><td>119<td><code><pre> defer utils.CloseAnyway(file)</pre></code><tr class=miss><td>120<td><code><pre> sha256Hash := sha256.New()</pre></code><tr class=miss><td>121<td><code><pre> if _, err = io.Copy(sha256Hash, file); err != nil {</pre></code><tr class=miss><td>122<td><code><pre> return</pre></code><tr><td>123<td><code><pre> }</pre></code><tr class=miss><td>124<td><code><pre> h = string(sha256Hash.Sum(nil))</pre></code><tr class=miss><td>125<td><code><pre> return</pre></code><tr><td>126<td><code><pre> }</pre></code></table><div class=funcname id=fn_@146:14>func @146:14</div><div class=info><a href=#s_fn_@146:14>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/utils.go</code>:</div><table class=listing><tr><td>146<td><code><pre>func(filename string) ([]byte, error) {</pre></code><tr class=miss><td>147<td><code><pre> return fs.ReadFile(c.FS, filename)</pre></code><tr><td>148<td><code><pre> }</pre></code></table><div class=funcname id=fn_Load>func Load</div><div class=info><a href=#s_fn_Load>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/configor.go</code>:</div><table class=listing><tr><td>196<td><code><pre>func Load(config any, files ...string) error {</pre></code><tr class=miss><td>197<td><code><pre> return New(nil).Load(config, files...)</pre></code><tr><td>198<td><code><pre>}</pre></code></table><div class=funcname id=fn_ENV>func ENV</div><div class=info><a href=#s_fn_ENV>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/configor.go</code>:</div><table class=listing><tr><td>191<td><code><pre>func ENV() string {</pre></code><tr class=miss><td>192<td><code><pre> return New(nil).GetEnvironment()</pre></code><tr><td>193<td><code><pre>}</pre></code></table><div class=funcname id=fn_@111:18>func @111:18</div><div class=info><a href=#s_fn_@111:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/configor.go</code>:</div><table class=listing><tr><td>111<td><code><pre>func(name string) (os.FileInfo, error) {</pre></code><tr class=miss><td>112<td><code><pre> return fs.Stat(cfg.FS, name)</pre></code><tr><td>113<td><code><pre> }</pre></code></table><div class=funcname id=fn_UnmatchedTomlKeysError.Error>func UnmatchedTomlKeysError.Error</div><div class=info><a href=#s_fn_UnmatchedTomlKeysError.Error>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/configor/utils.go</code>:</div><table class=listing><tr><td>58<td><code><pre>func (e *UnmatchedTomlKeysError) Error() string {</pre></code><tr class=miss><td>59<td><code><pre> return fmt.Sprintf("There are keys in the config file that do not match any field in the given struct: %v", e.Keys)</pre></code><tr><td>60<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/internal/util/payload class=funcname>Package Overview: github.com/wfusion/gofusion/internal/util/payload 34 <span class=packageTotal>60.2%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_@41:9><td><code><a href=#fn_@41:9>@41:9(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Context><td><code><a href=#fn_Context>Context(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@29:9><td><code><a href=#fn_@29:9>@29:9(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Serialize><td><code><a href=#fn_Serialize>Serialize(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@35:9><td><code><a href=#fn_@35:9>@35:9(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Compress><td><code><a href=#fn_Compress>Compress(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Type><td><code><a href=#fn_Type>Type(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@47:9><td><code><a href=#fn_@47:9>@47:9(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_unsealV1><td><code><a href=#fn_unsealV1>unsealV1(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/unseal.go</code><td class=percent><code>85.4%</code><td class=linecount><code>35/41</code><tr id=s_fn_unsealV1T><td><code><a href=#fn_unsealV1T>unsealV1T(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/unseal.go</code><td class=percent><code>75.6%</code><td class=linecount><code>31/41</code><tr id=s_fn_Seal><td><code><a href=#fn_Seal>Seal(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/seal.go</code><td class=percent><code>69.8%</code><td class=linecount><code>37/53</code><tr id=s_fn_Unseal><td><code><a href=#fn_Unseal>Unseal(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/unseal.go</code><td class=percent><code>66.7%</code><td class=linecount><code>6/9</code><tr id=s_fn_UnsealT><td><code><a href=#fn_UnsealT>UnsealT(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/unseal.go</code><td class=percent><code>66.7%</code><td class=linecount><code>6/9</code><tr id=s_fn_UnsealRaw><td><code><a href=#fn_UnsealRaw>UnsealRaw(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/unseal.go</code><td class=percent><code>40.0%</code><td class=linecount><code>4/10</code><tr id=s_fn_unsealRawV1><td><code><a href=#fn_unsealRawV1>unsealRawV1(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/unseal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/22</code><tr id=s_fn_defaultUnseal><td><code><a href=#fn_defaultUnseal>defaultUnseal(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/unseal.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/16</code><tr id=s_fn_@53:9><td><code><a href=#fn_@53:9>@53:9(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Version><td><code><a href=#fn_Version>Version(...)</a></code><td><code>github.com/wfusion/gofusion/internal/util/payload/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_@41:9>func @41:9</div><div class=info><a href=#s_fn_@41:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/types.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func(o *option) {</pre></code><tr><td>42<td><code><pre> o.compressType = compressType</pre></code><tr><td>43<td><code><pre> }</pre></code></table><div class=funcname id=fn_Context>func Context</div><div class=info><a href=#s_fn_Context>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/types.go</code>:</div><table class=listing><tr><td>28<td><code><pre>func Context(ctx context.Context) utils.OptionFunc[option] {</pre></code><tr><td>29<td><code><pre> return func(o *option) {</pre></code><tr><td>30<td><code><pre> o.ctx = ctx</pre></code><tr><td>31<td><code><pre> }</pre></code><tr><td>32<td><code><pre>}</pre></code></table><div class=funcname id=fn_@29:9>func @29:9</div><div class=info><a href=#s_fn_@29:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/types.go</code>:</div><table class=listing><tr><td>29<td><code><pre>func(o *option) {</pre></code><tr><td>30<td><code><pre> o.ctx = ctx</pre></code><tr><td>31<td><code><pre> }</pre></code></table><div class=funcname id=fn_Serialize>func Serialize</div><div class=info><a href=#s_fn_Serialize>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/types.go</code>:</div><table class=listing><tr><td>34<td><code><pre>func Serialize(serializeType serialize.Algorithm) utils.OptionFunc[option] {</pre></code><tr><td>35<td><code><pre> return func(o *option) {</pre></code><tr><td>36<td><code><pre> o.serializeType = serializeType</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre>}</pre></code></table><div class=funcname id=fn_@35:9>func @35:9</div><div class=info><a href=#s_fn_@35:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/types.go</code>:</div><table class=listing><tr><td>35<td><code><pre>func(o *option) {</pre></code><tr><td>36<td><code><pre> o.serializeType = serializeType</pre></code><tr><td>37<td><code><pre> }</pre></code></table><div class=funcname id=fn_Compress>func Compress</div><div class=info><a href=#s_fn_Compress>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/types.go</code>:</div><table class=listing><tr><td>40<td><code><pre>func Compress(compressType compress.Algorithm) utils.OptionFunc[option] {</pre></code><tr><td>41<td><code><pre> return func(o *option) {</pre></code><tr><td>42<td><code><pre> o.compressType = compressType</pre></code><tr><td>43<td><code><pre> }</pre></code><tr><td>44<td><code><pre>}</pre></code></table><div class=funcname id=fn_Type>func Type</div><div class=info><a href=#s_fn_Type>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/types.go</code>:</div><table class=listing><tr><td>46<td><code><pre>func Type(typ reflect.Type) utils.OptionFunc[option] {</pre></code><tr><td>47<td><code><pre> return func(o *option) {</pre></code><tr><td>48<td><code><pre> o.dataType = typ</pre></code><tr><td>49<td><code><pre> }</pre></code><tr><td>50<td><code><pre>}</pre></code></table><div class=funcname id=fn_@47:9>func @47:9</div><div class=info><a href=#s_fn_@47:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/types.go</code>:</div><table class=listing><tr><td>47<td><code><pre>func(o *option) {</pre></code><tr><td>48<td><code><pre> o.dataType = typ</pre></code><tr><td>49<td><code><pre> }</pre></code></table><div class=funcname id=fn_unsealV1>func unsealV1</div><div class=info><a href=#s_fn_unsealV1>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/unseal.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func unsealV1(inf, src []byte, opts ...utils.OptionExtender) (ctx context.Context, dst any, ok bool, err error) {</pre></code><tr><td>42<td><code><pre> opt := utils.ApplyOptions[option](opts...)</pre></code><tr><td>43<td><code><pre> serializeType := serialize.ParseAlgorithm(serialize.Algorithm(inf[1]))</pre></code><tr><td>44<td><code><pre> if opt.serializeType.IsValid() {</pre></code><tr><td>45<td><code><pre> serializeType = opt.serializeType</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre> compressType := compress.ParseAlgorithm(compress.Algorithm(inf[2]))</pre></code><tr><td>48<td><code><pre> if opt.compressType.IsValid() {</pre></code><tr><td>49<td><code><pre> compressType = opt.compressType</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre></pre></code><tr><td>52<td><code><pre> isRaw := false</pre></code><tr><td>53<td><code><pre> if inf[3] == 1 {</pre></code><tr class=miss><td>54<td><code><pre> isRaw = true</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre></pre></code><tr><td>57<td><code><pre> // unseal encrypted inf</pre></code><tr><td>58<td><code><pre> encryptedInfLength := binary.LittleEndian.Uint32(inf[4:])</pre></code><tr><td>59<td><code><pre> _, src = src[:encryptedInfLength], src[encryptedInfLength:]</pre></code><tr><td>60<td><code><pre></pre></code><tr><td>61<td><code><pre> // unseal context</pre></code><tr><td>62<td><code><pre> contextLengthBytes, src := src[:8], src[8:]</pre></code><tr><td>63<td><code><pre> contextLength := binary.LittleEndian.Uint64(contextLengthBytes)</pre></code><tr><td>64<td><code><pre> if contextLength > 0 {</pre></code><tr><td>65<td><code><pre> var contextBytes []byte</pre></code><tr><td>66<td><code><pre> contextBytes, src = src[:contextLength], src[contextLength:]</pre></code><tr><td>67<td><code><pre> ctx = fusCtx.New(fusCtx.Context(contextBytes))</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre></pre></code><tr><td>70<td><code><pre> // unseal data type</pre></code><tr><td>71<td><code><pre> inf, src = src[:8], src[8:]</pre></code><tr><td>72<td><code><pre> structNameLength := binary.LittleEndian.Uint64(inf)</pre></code><tr><td>73<td><code><pre> structName, src := src[:structNameLength], src[structNameLength:]</pre></code><tr><td>74<td><code><pre> if !isRaw && opt.dataType == nil {</pre></code><tr class=miss><td>75<td><code><pre> if opt.dataType = inspect.TypeOf(string(structName)); opt.dataType == nil {</pre></code><tr class=miss><td>76<td><code><pre> opt.dataType = reflect.TypeOf((*any)(nil)).Elem()</pre></code><tr><td>77<td><code><pre> }</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre></pre></code><tr><td>80<td><code><pre> // unseal data</pre></code><tr><td>81<td><code><pre> // unseal data length</pre></code><tr><td>82<td><code><pre> _, src = src[:8], src[8:]</pre></code><tr><td>83<td><code><pre> // binary.LittleEndian.Uint64(src[:8])</pre></code><tr><td>84<td><code><pre></pre></code><tr><td>85<td><code><pre> // unseal data</pre></code><tr><td>86<td><code><pre> var decoded []byte</pre></code><tr><td>87<td><code><pre> if compressType.IsValid() {</pre></code><tr><td>88<td><code><pre> decoded, err = encode.From(src).Decode(encode.Compress(compressType)).ToBytes()</pre></code><tr><td>89<td><code><pre> } else {</pre></code><tr><td>90<td><code><pre> decoded = src</pre></code><tr><td>91<td><code><pre> }</pre></code><tr><td>92<td><code><pre> if err != nil {</pre></code><tr class=miss><td>93<td><code><pre> return</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre></pre></code><tr><td>96<td><code><pre> if !serializeType.IsValid() {</pre></code><tr class=miss><td>97<td><code><pre> dst = decoded</pre></code><tr><td>98<td><code><pre> } else {</pre></code><tr><td>99<td><code><pre> dstBuffer, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>100<td><code><pre> defer cb()</pre></code><tr><td>101<td><code><pre> dstBuffer.Write(decoded)</pre></code><tr><td>102<td><code><pre></pre></code><tr><td>103<td><code><pre> unmarshalFunc := serialize.UnmarshalStreamFuncByType(serializeType, opt.dataType)</pre></code><tr><td>104<td><code><pre> if dst, err = unmarshalFunc(dstBuffer); err != nil {</pre></code><tr class=miss><td>105<td><code><pre> return</pre></code><tr><td>106<td><code><pre> }</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre></pre></code><tr><td>109<td><code><pre> ok = true</pre></code><tr><td>110<td><code><pre> return</pre></code><tr><td>111<td><code><pre>}</pre></code></table><div class=funcname id=fn_unsealV1T>func unsealV1T</div><div class=info><a href=#s_fn_unsealV1T>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/unseal.go</code>:</div><table class=listing><tr><td>134<td><code><pre>func unsealV1T[T any](inf, src []byte, opts ...utils.OptionExtender) (ctx context.Context, dst T, ok bool, err error) {</pre></code><tr><td>135<td><code><pre> opt := utils.ApplyOptions[option](opts...)</pre></code><tr><td>136<td><code><pre> serializeType := serialize.ParseAlgorithm(serialize.Algorithm(inf[1]))</pre></code><tr><td>137<td><code><pre> if opt.serializeType.IsValid() {</pre></code><tr class=miss><td>138<td><code><pre> serializeType = opt.serializeType</pre></code><tr><td>139<td><code><pre> }</pre></code><tr><td>140<td><code><pre> compressType := compress.ParseAlgorithm(compress.Algorithm(inf[2]))</pre></code><tr><td>141<td><code><pre> if opt.compressType.IsValid() {</pre></code><tr class=miss><td>142<td><code><pre> compressType = opt.compressType</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre></pre></code><tr><td>145<td><code><pre> isRaw := false</pre></code><tr><td>146<td><code><pre> if inf[3] == 1 {</pre></code><tr class=miss><td>147<td><code><pre> isRaw = true</pre></code><tr><td>148<td><code><pre> }</pre></code><tr><td>149<td><code><pre></pre></code><tr><td>150<td><code><pre> // unseal encrypted inf</pre></code><tr><td>151<td><code><pre> encryptedInfLength := binary.LittleEndian.Uint32(inf[4:])</pre></code><tr><td>152<td><code><pre> _, src = src[:encryptedInfLength], src[encryptedInfLength:]</pre></code><tr><td>153<td><code><pre></pre></code><tr><td>154<td><code><pre> // unseal context</pre></code><tr><td>155<td><code><pre> contextLengthBytes, src := src[:8], src[8:]</pre></code><tr><td>156<td><code><pre> contextLength := binary.LittleEndian.Uint64(contextLengthBytes)</pre></code><tr><td>157<td><code><pre> if contextLength > 0 {</pre></code><tr class=miss><td>158<td><code><pre> var contextBytes []byte</pre></code><tr class=miss><td>159<td><code><pre> contextBytes, src = src[:contextLength], src[contextLength:]</pre></code><tr class=miss><td>160<td><code><pre> ctx = fusCtx.New(fusCtx.Context(contextBytes))</pre></code><tr><td>161<td><code><pre> }</pre></code><tr><td>162<td><code><pre></pre></code><tr><td>163<td><code><pre> // unseal data type</pre></code><tr><td>164<td><code><pre> inf, src = src[:8], src[8:]</pre></code><tr><td>165<td><code><pre> structNameLength := binary.LittleEndian.Uint64(inf)</pre></code><tr><td>166<td><code><pre> structName, src := src[:structNameLength], src[structNameLength:]</pre></code><tr><td>167<td><code><pre> if !isRaw && opt.dataType == nil {</pre></code><tr><td>168<td><code><pre> if opt.dataType = inspect.TypeOf(string(structName)); opt.dataType == nil {</pre></code><tr class=miss><td>169<td><code><pre> opt.dataType = reflect.TypeOf((*any)(nil)).Elem()</pre></code><tr><td>170<td><code><pre> }</pre></code><tr><td>171<td><code><pre> }</pre></code><tr><td>172<td><code><pre></pre></code><tr><td>173<td><code><pre> // unseal data</pre></code><tr><td>174<td><code><pre> // unseal data length</pre></code><tr><td>175<td><code><pre> _, src = src[:8], src[8:]</pre></code><tr><td>176<td><code><pre> // binary.LittleEndian.Uint64(src[:8])</pre></code><tr><td>177<td><code><pre></pre></code><tr><td>178<td><code><pre> // unseal data</pre></code><tr><td>179<td><code><pre> var decoded []byte</pre></code><tr><td>180<td><code><pre> if compressType.IsValid() {</pre></code><tr><td>181<td><code><pre> decoded, err = encode.From(src).Decode(encode.Compress(compressType)).ToBytes()</pre></code><tr><td>182<td><code><pre> } else {</pre></code><tr><td>183<td><code><pre> decoded = src</pre></code><tr><td>184<td><code><pre> }</pre></code><tr><td>185<td><code><pre> if err != nil {</pre></code><tr class=miss><td>186<td><code><pre> return</pre></code><tr><td>187<td><code><pre> }</pre></code><tr><td>188<td><code><pre></pre></code><tr><td>189<td><code><pre> if !serializeType.IsValid() {</pre></code><tr class=miss><td>190<td><code><pre> dst = reflect.ValueOf(decoded).Convert(reflect.TypeOf(new(T)).Elem()).Interface().(T)</pre></code><tr><td>191<td><code><pre> } else {</pre></code><tr><td>192<td><code><pre> dstBuffer, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>193<td><code><pre> defer cb()</pre></code><tr><td>194<td><code><pre> dstBuffer.Write(decoded)</pre></code><tr><td>195<td><code><pre></pre></code><tr><td>196<td><code><pre> unmarshalFunc := serialize.UnmarshalStreamFunc[T](serializeType)</pre></code><tr><td>197<td><code><pre> if dst, err = unmarshalFunc(dstBuffer); err != nil {</pre></code><tr class=miss><td>198<td><code><pre> return</pre></code><tr><td>199<td><code><pre> }</pre></code><tr><td>200<td><code><pre> }</pre></code><tr><td>201<td><code><pre></pre></code><tr><td>202<td><code><pre> ok = true</pre></code><tr><td>203<td><code><pre> return</pre></code><tr><td>204<td><code><pre>}</pre></code></table><div class=funcname id=fn_Seal>func Seal</div><div class=info><a href=#s_fn_Seal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/seal.go</code>:</div><table class=listing><tr><td>14<td><code><pre>func Seal(data any, opts ...utils.OptionExtender) (dst []byte, err error) {</pre></code><tr><td>15<td><code><pre> opt := utils.ApplyOptions[option](opts...)</pre></code><tr><td>16<td><code><pre></pre></code><tr><td>17<td><code><pre> dstBuffer, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>18<td><code><pre> defer cb()</pre></code><tr><td>19<td><code><pre></pre></code><tr><td>20<td><code><pre> dbytes, ok1 := data.([]byte)</pre></code><tr><td>21<td><code><pre> dstring, ok2 := data.(string)</pre></code><tr><td>22<td><code><pre> isRaw := ok1 || ok2</pre></code><tr><td>23<td><code><pre></pre></code><tr><td>24<td><code><pre> // magic number</pre></code><tr><td>25<td><code><pre> if err = binary.Write(dstBuffer, binary.LittleEndian, sealMagicNumber); err != nil {</pre></code><tr class=miss><td>26<td><code><pre> return</pre></code><tr><td>27<td><code><pre> }</pre></code><tr><td>28<td><code><pre></pre></code><tr><td>29<td><code><pre> // seal info</pre></code><tr><td>30<td><code><pre> inf := sealTypeNumber</pre></code><tr><td>31<td><code><pre> if opt.version > 0 {</pre></code><tr class=miss><td>32<td><code><pre> inf[0] = opt.version</pre></code><tr><td>33<td><code><pre> }</pre></code><tr><td>34<td><code><pre> if isRaw {</pre></code><tr class=miss><td>35<td><code><pre> inf[3] = 1</pre></code><tr><td>36<td><code><pre> } else {</pre></code><tr><td>37<td><code><pre> inf[1] = opt.serializeType.Value()</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre> inf[2] = opt.compressType.Value()</pre></code><tr><td>40<td><code><pre> if err = binary.Write(dstBuffer, binary.LittleEndian, inf[:]); err != nil {</pre></code><tr class=miss><td>41<td><code><pre> return</pre></code><tr><td>42<td><code><pre> }</pre></code><tr><td>43<td><code><pre></pre></code><tr><td>44<td><code><pre> // seal encrypted info TODO</pre></code><tr><td>45<td><code><pre></pre></code><tr><td>46<td><code><pre> // seal context</pre></code><tr><td>47<td><code><pre> if opt.ctx == nil {</pre></code><tr><td>48<td><code><pre> if err = binary.Write(dstBuffer, binary.LittleEndian, uint64(0)); err != nil {</pre></code><tr class=miss><td>49<td><code><pre> return</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre> } else {</pre></code><tr><td>52<td><code><pre> ctxBytes := fusCtx.Flatten(opt.ctx).Marshal()</pre></code><tr><td>53<td><code><pre> if err = binary.Write(dstBuffer, binary.LittleEndian, uint64(len(ctxBytes))); err != nil {</pre></code><tr class=miss><td>54<td><code><pre> return</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre> if err = binary.Write(dstBuffer, binary.LittleEndian, ctxBytes); err != nil {</pre></code><tr class=miss><td>57<td><code><pre> return</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre></pre></code><tr><td>61<td><code><pre> // seal data type</pre></code><tr><td>62<td><code><pre> dt := utils.IndirectValue(reflect.ValueOf(data)).Type()</pre></code><tr><td>63<td><code><pre> structName := dt.PkgPath() + "." + dt.Name()</pre></code><tr><td>64<td><code><pre> if err = binary.Write(dstBuffer, binary.LittleEndian, uint64(len(structName))); err != nil {</pre></code><tr class=miss><td>65<td><code><pre> return</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre> if err = binary.Write(dstBuffer, binary.LittleEndian, []byte(structName)); err != nil {</pre></code><tr class=miss><td>68<td><code><pre> return</pre></code><tr><td>69<td><code><pre> }</pre></code><tr><td>70<td><code><pre></pre></code><tr><td>71<td><code><pre> // seal data</pre></code><tr><td>72<td><code><pre> marshaledBuffer, cb := utils.BytesBufferPool.Get(nil)</pre></code><tr><td>73<td><code><pre> defer cb()</pre></code><tr><td>74<td><code><pre></pre></code><tr><td>75<td><code><pre> if isRaw {</pre></code><tr class=miss><td>76<td><code><pre> switch {</pre></code><tr><td>77<td><code><pre> case ok1:</pre></code><tr class=miss><td>78<td><code><pre> marshaledBuffer.Write(dbytes)</pre></code><tr><td>79<td><code><pre> case ok2:</pre></code><tr class=miss><td>80<td><code><pre> marshaledBuffer.WriteString(dstring)</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre> } else {</pre></code><tr><td>83<td><code><pre> marshalFunc := serialize.MarshalStreamFunc(opt.serializeType, serialize.JsonEscapeHTML(false))</pre></code><tr><td>84<td><code><pre> if err = marshalFunc(marshaledBuffer, data); err != nil {</pre></code><tr class=miss><td>85<td><code><pre> return</pre></code><tr><td>86<td><code><pre> }</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre></pre></code><tr><td>89<td><code><pre> var encoded []byte</pre></code><tr><td>90<td><code><pre> if opt.compressType.IsValid() {</pre></code><tr><td>91<td><code><pre> encoded, err = encode.From(marshaledBuffer.Bytes()).Encode(encode.Compress(opt.compressType)).ToBytes()</pre></code><tr><td>92<td><code><pre> } else {</pre></code><tr><td>93<td><code><pre> encoded = marshaledBuffer.Bytes()</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre> if err != nil {</pre></code><tr class=miss><td>96<td><code><pre> return</pre></code><tr><td>97<td><code><pre> }</pre></code><tr><td>98<td><code><pre></pre></code><tr><td>99<td><code><pre> if err = binary.Write(dstBuffer, binary.LittleEndian, uint64(len(encoded))); err != nil {</pre></code><tr class=miss><td>100<td><code><pre> return</pre></code><tr><td>101<td><code><pre> }</pre></code><tr><td>102<td><code><pre> if err = binary.Write(dstBuffer, binary.LittleEndian, encoded); err != nil {</pre></code><tr class=miss><td>103<td><code><pre> return</pre></code><tr><td>104<td><code><pre> }</pre></code><tr><td>105<td><code><pre></pre></code><tr><td>106<td><code><pre> dst = make([]byte, dstBuffer.Len())</pre></code><tr><td>107<td><code><pre> copy(dst, dstBuffer.Bytes())</pre></code><tr><td>108<td><code><pre> return</pre></code><tr><td>109<td><code><pre>}</pre></code></table><div class=funcname id=fn_Unseal>func Unseal</div><div class=info><a href=#s_fn_Unseal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/unseal.go</code>:</div><table class=listing><tr><td>20<td><code><pre>func Unseal(src []byte, opts ...utils.OptionExtender) (ctx context.Context, dst any, ok bool, err error) {</pre></code><tr><td>21<td><code><pre> if len(src) <= sealPrefixLength {</pre></code><tr class=miss><td>22<td><code><pre> return defaultUnseal(src, opts...)</pre></code><tr><td>23<td><code><pre> }</pre></code><tr><td>24<td><code><pre></pre></code><tr><td>25<td><code><pre> // unseal magic number</pre></code><tr><td>26<td><code><pre> magicNumber, next := src[:4], src[4:]</pre></code><tr><td>27<td><code><pre> if binary.LittleEndian.Uint32(magicNumber) != sealMagicNumber {</pre></code><tr class=miss><td>28<td><code><pre> return defaultUnseal(src, opts...)</pre></code><tr><td>29<td><code><pre> }</pre></code><tr><td>30<td><code><pre></pre></code><tr><td>31<td><code><pre> // unseal info</pre></code><tr><td>32<td><code><pre> inf, next := next[:len(sealTypeNumber)], next[len(sealTypeNumber):]</pre></code><tr><td>33<td><code><pre> switch inf[0] {</pre></code><tr><td>34<td><code><pre> case 1:</pre></code><tr><td>35<td><code><pre> return unsealV1(inf, next, opts...)</pre></code><tr><td>36<td><code><pre> default:</pre></code><tr class=miss><td>37<td><code><pre> panic(errors.Errorf("unsupported message version for unseal: %v", inf[0]))</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre>}</pre></code></table><div class=funcname id=fn_UnsealT>func UnsealT</div><div class=info><a href=#s_fn_UnsealT>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/unseal.go</code>:</div><table class=listing><tr><td>113<td><code><pre>func UnsealT[T any](src []byte, opts ...utils.OptionExtender) (ctx context.Context, dst T, ok bool, err error) {</pre></code><tr><td>114<td><code><pre> if len(src) <= sealPrefixLength {</pre></code><tr class=miss><td>115<td><code><pre> return</pre></code><tr><td>116<td><code><pre> }</pre></code><tr><td>117<td><code><pre></pre></code><tr><td>118<td><code><pre> // unseal magic number</pre></code><tr><td>119<td><code><pre> magicNumber, src := src[:4], src[4:]</pre></code><tr><td>120<td><code><pre> if binary.LittleEndian.Uint32(magicNumber) != sealMagicNumber {</pre></code><tr class=miss><td>121<td><code><pre> return</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre></pre></code><tr><td>124<td><code><pre> // unseal info</pre></code><tr><td>125<td><code><pre> inf, src := src[:len(sealTypeNumber)], src[len(sealTypeNumber):]</pre></code><tr><td>126<td><code><pre> switch inf[0] {</pre></code><tr><td>127<td><code><pre> case 1:</pre></code><tr><td>128<td><code><pre> return unsealV1T[T](inf, src, opts...)</pre></code><tr><td>129<td><code><pre> default:</pre></code><tr class=miss><td>130<td><code><pre> panic(errors.Errorf("unsupported message version for unseal: %v", inf[0]))</pre></code><tr><td>131<td><code><pre> }</pre></code><tr><td>132<td><code><pre>}</pre></code></table><div class=funcname id=fn_UnsealRaw>func UnsealRaw</div><div class=info><a href=#s_fn_UnsealRaw>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/unseal.go</code>:</div><table class=listing><tr><td>206<td><code><pre>func UnsealRaw(src []byte, opts ...utils.OptionExtender) (ctx context.Context, dst []byte, isRaw bool, err error) {</pre></code><tr><td>207<td><code><pre> if len(src) <= sealPrefixLength {</pre></code><tr class=miss><td>208<td><code><pre> return nil, src, true, nil</pre></code><tr><td>209<td><code><pre> }</pre></code><tr><td>210<td><code><pre></pre></code><tr><td>211<td><code><pre> // unseal magic number</pre></code><tr><td>212<td><code><pre> magicNumber, next := src[:4], src[4:]</pre></code><tr><td>213<td><code><pre> if binary.LittleEndian.Uint32(magicNumber) != sealMagicNumber {</pre></code><tr><td>214<td><code><pre> return nil, src, true, nil</pre></code><tr><td>215<td><code><pre> }</pre></code><tr><td>216<td><code><pre></pre></code><tr><td>217<td><code><pre> // unseal info</pre></code><tr class=miss><td>218<td><code><pre> inf, src := next[:len(sealTypeNumber)], next[len(sealTypeNumber):]</pre></code><tr class=miss><td>219<td><code><pre> switch inf[0] {</pre></code><tr><td>220<td><code><pre> case 1:</pre></code><tr class=miss><td>221<td><code><pre> return unsealRawV1(inf, src, opts...)</pre></code><tr><td>222<td><code><pre> default:</pre></code><tr class=miss><td>223<td><code><pre> panic(errors.Errorf("unsupported message version for unseal raw: %v", inf[0]))</pre></code><tr><td>224<td><code><pre> }</pre></code><tr class=miss><td>225<td><code><pre> return</pre></code><tr><td>226<td><code><pre>}</pre></code></table><div class=funcname id=fn_unsealRawV1>func unsealRawV1</div><div class=info><a href=#s_fn_unsealRawV1>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/unseal.go</code>:</div><table class=listing><tr><td>228<td><code><pre>func unsealRawV1(inf, src []byte, opts ...utils.OptionExtender) (</pre></code><tr><td>229<td><code><pre> ctx context.Context, dst []byte, isRaw bool, err error) {</pre></code><tr class=miss><td>230<td><code><pre> opt := utils.ApplyOptions[option](opts...)</pre></code><tr class=miss><td>231<td><code><pre> compressType := compress.ParseAlgorithm(compress.Algorithm(inf[2]))</pre></code><tr class=miss><td>232<td><code><pre> if opt.compressType.IsValid() {</pre></code><tr class=miss><td>233<td><code><pre> compressType = opt.compressType</pre></code><tr><td>234<td><code><pre> }</pre></code><tr class=miss><td>235<td><code><pre> if src[3] == 1 {</pre></code><tr class=miss><td>236<td><code><pre> isRaw = true</pre></code><tr><td>237<td><code><pre> }</pre></code><tr><td>238<td><code><pre></pre></code><tr><td>239<td><code><pre> // unseal encrypted inf</pre></code><tr class=miss><td>240<td><code><pre> encryptedInfLength := binary.LittleEndian.Uint32(inf[4:])</pre></code><tr class=miss><td>241<td><code><pre> _, src = src[:encryptedInfLength], src[encryptedInfLength:]</pre></code><tr><td>242<td><code><pre></pre></code><tr><td>243<td><code><pre> // unseal context</pre></code><tr class=miss><td>244<td><code><pre> contextLengthBytes, src := src[:8], src[8:]</pre></code><tr class=miss><td>245<td><code><pre> contextLength := binary.LittleEndian.Uint64(contextLengthBytes)</pre></code><tr class=miss><td>246<td><code><pre> if contextLength > 0 {</pre></code><tr class=miss><td>247<td><code><pre> var contextBytes []byte</pre></code><tr class=miss><td>248<td><code><pre> contextBytes, src = src[:contextLength], src[contextLength:]</pre></code><tr class=miss><td>249<td><code><pre> ctx = fusCtx.New(fusCtx.Context(contextBytes))</pre></code><tr><td>250<td><code><pre> }</pre></code><tr><td>251<td><code><pre></pre></code><tr><td>252<td><code><pre> // unseal data type</pre></code><tr class=miss><td>253<td><code><pre> inf, src = src[:8], src[8:]</pre></code><tr class=miss><td>254<td><code><pre> structNameLength := binary.LittleEndian.Uint64(inf)</pre></code><tr class=miss><td>255<td><code><pre> _, src = src[:structNameLength], src[structNameLength:]</pre></code><tr><td>256<td><code><pre></pre></code><tr><td>257<td><code><pre> // unseal data</pre></code><tr><td>258<td><code><pre> // unseal data length</pre></code><tr class=miss><td>259<td><code><pre> _, src = src[:8], src[8:]</pre></code><tr><td>260<td><code><pre> // binary.LittleEndian.Uint64(src[:8])</pre></code><tr><td>261<td><code><pre></pre></code><tr><td>262<td><code><pre> // unseal data</pre></code><tr class=miss><td>263<td><code><pre> if compressType.IsValid() {</pre></code><tr class=miss><td>264<td><code><pre> dst, err = encode.From(src).Decode(encode.Compress(compressType)).ToBytes()</pre></code><tr><td>265<td><code><pre> } else {</pre></code><tr class=miss><td>266<td><code><pre> dst = src</pre></code><tr><td>267<td><code><pre> }</pre></code><tr class=miss><td>268<td><code><pre> return</pre></code><tr><td>269<td><code><pre>}</pre></code></table><div class=funcname id=fn_defaultUnseal>func defaultUnseal</div><div class=info><a href=#s_fn_defaultUnseal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/unseal.go</code>:</div><table class=listing><tr><td>271<td><code><pre>func defaultUnseal(src []byte, opts ...utils.OptionExtender) (ctx context.Context, dst any, ok bool, err error) {</pre></code><tr class=miss><td>272<td><code><pre> opt := utils.ApplyOptions[option](opts...)</pre></code><tr class=miss><td>273<td><code><pre> if opt.compressType.IsValid() {</pre></code><tr class=miss><td>274<td><code><pre> if src, err = encode.From(src).Decode(encode.Compress(opt.compressType)).ToBytes(); err != nil {</pre></code><tr class=miss><td>275<td><code><pre> return</pre></code><tr><td>276<td><code><pre> }</pre></code><tr><td>277<td><code><pre> }</pre></code><tr class=miss><td>278<td><code><pre> if !opt.serializeType.IsValid() {</pre></code><tr><td>279<td><code><pre> // try to convert directly</pre></code><tr class=miss><td>280<td><code><pre> srcVal := reflect.ValueOf(src)</pre></code><tr class=miss><td>281<td><code><pre> if srcVal.CanConvert(opt.dataType) {</pre></code><tr class=miss><td>282<td><code><pre> return nil, srcVal.Convert(opt.dataType).Interface(), false, nil</pre></code><tr><td>283<td><code><pre> }</pre></code><tr><td>284<td><code><pre></pre></code><tr><td>285<td><code><pre> // try to map the structure</pre></code><tr class=miss><td>286<td><code><pre> out := reflect.New(opt.dataType).Interface()</pre></code><tr class=miss><td>287<td><code><pre> if err = mapstructure.Decode(src, out); err != nil {</pre></code><tr class=miss><td>288<td><code><pre> return</pre></code><tr><td>289<td><code><pre> }</pre></code><tr class=miss><td>290<td><code><pre> dst = reflect.ValueOf(out).Elem()</pre></code><tr class=miss><td>291<td><code><pre> return</pre></code><tr><td>292<td><code><pre> }</pre></code><tr class=miss><td>293<td><code><pre> unmarshalFunc := serialize.UnmarshalFuncByType(opt.serializeType, opt.dataType, serialize.JsonEscapeHTML(false))</pre></code><tr class=miss><td>294<td><code><pre> dst, err = unmarshalFunc(src)</pre></code><tr class=miss><td>295<td><code><pre> return</pre></code><tr><td>296<td><code><pre>}</pre></code></table><div class=funcname id=fn_@53:9>func @53:9</div><div class=info><a href=#s_fn_@53:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/types.go</code>:</div><table class=listing><tr><td>53<td><code><pre>func(o *option) {</pre></code><tr class=miss><td>54<td><code><pre> o.version = ver</pre></code><tr><td>55<td><code><pre> }</pre></code></table><div class=funcname id=fn_Version>func Version</div><div class=info><a href=#s_fn_Version>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/internal/util/payload/types.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func Version(ver uint8) utils.OptionFunc[option] {</pre></code><tr class=miss><td>53<td><code><pre> return func(o *option) {</pre></code><tr><td>54<td><code><pre> o.version = ver</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/lock class=funcname>Package Overview: github.com/wfusion/gofusion/lock 35 <span class=packageTotal>80.9%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_redisLuaLocker.Lock><td><code><a href=#fn_redisLuaLocker.Lock>redisLuaLocker.Lock(...)</a></code><td><code>github.com/wfusion/gofusion/lock/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>9/9</code><tr id=s_fn_Construct><td><code><a href=#fn_Construct>Construct(...)</a></code><td><code>github.com/wfusion/gofusion/lock/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_@31:9><td><code><a href=#fn_@31:9>@31:9(...)</a></code><td><code>github.com/wfusion/gofusion/lock/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_mysqlLocker.isLocked><td><code><a href=#fn_mysqlLocker.isLocked>mysqlLocker.isLocked(...)</a></code><td><code>github.com/wfusion/gofusion/lock/mysql.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_redisLuaLocker.Unlock><td><code><a href=#fn_redisLuaLocker.Unlock>redisLuaLocker.Unlock(...)</a></code><td><code>github.com/wfusion/gofusion/lock/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_redisNXLocker.Unlock><td><code><a href=#fn_redisNXLocker.Unlock>redisNXLocker.Unlock(...)</a></code><td><code>github.com/wfusion/gofusion/lock/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@54:9><td><code><a href=#fn_@54:9>@54:9(...)</a></code><td><code>github.com/wfusion/gofusion/lock/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Expire><td><code><a href=#fn_Expire>Expire(...)</a></code><td><code>github.com/wfusion/gofusion/lock/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_redisNXLocker.formatLockKey><td><code><a href=#fn_redisNXLocker.formatLockKey>redisNXLocker.formatLockKey(...)</a></code><td><code>github.com/wfusion/gofusion/lock/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_AppName><td><code><a href=#fn_AppName>AppName(...)</a></code><td><code>github.com/wfusion/gofusion/lock/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@90:9><td><code><a href=#fn_@90:9>@90:9(...)</a></code><td><code>github.com/wfusion/gofusion/lock/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@72:8><td><code><a href=#fn_@72:8>@72:8(...)</a></code><td><code>github.com/wfusion/gofusion/lock/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_newRedisNXLocker><td><code><a href=#fn_newRedisNXLocker>newRedisNXLocker(...)</a></code><td><code>github.com/wfusion/gofusion/lock/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/lock/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/lock/flag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_redisLuaLocker.formatLockKey><td><code><a href=#fn_redisLuaLocker.formatLockKey>redisLuaLocker.formatLockKey(...)</a></code><td><code>github.com/wfusion/gofusion/lock/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@31:9><td><code><a href=#fn_@31:9>@31:9(...)</a></code><td><code>github.com/wfusion/gofusion/lock/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_ReentrantKey><td><code><a href=#fn_ReentrantKey>ReentrantKey(...)</a></code><td><code>github.com/wfusion/gofusion/lock/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_newRedisLuaLocker><td><code><a href=#fn_newRedisLuaLocker>newRedisLuaLocker(...)</a></code><td><code>github.com/wfusion/gofusion/lock/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_mongoLocker.formatLockKey><td><code><a href=#fn_mongoLocker.formatLockKey>mongoLocker.formatLockKey(...)</a></code><td><code>github.com/wfusion/gofusion/lock/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_newMysqlLocker><td><code><a href=#fn_newMysqlLocker>newMysqlLocker(...)</a></code><td><code>github.com/wfusion/gofusion/lock/mysql.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_mysqlLocker.formatLockKey><td><code><a href=#fn_mysqlLocker.formatLockKey>mysqlLocker.formatLockKey(...)</a></code><td><code>github.com/wfusion/gofusion/lock/mysql.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@60:9><td><code><a href=#fn_@60:9>@60:9(...)</a></code><td><code>github.com/wfusion/gofusion/lock/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_mongoLocker.Lock><td><code><a href=#fn_mongoLocker.Lock>mongoLocker.Lock(...)</a></code><td><code>github.com/wfusion/gofusion/lock/mongo.go</code><td class=percent><code>93.8%</code><td class=linecount><code>15/16</code><tr id=s_fn_redisNXLocker.Lock><td><code><a href=#fn_redisNXLocker.Lock>redisNXLocker.Lock(...)</a></code><td><code>github.com/wfusion/gofusion/lock/redis.go</code><td class=percent><code>91.7%</code><td class=linecount><code>11/12</code><tr id=s_fn_@30:19><td><code><a href=#fn_@30:19>@30:19(...)</a></code><td><code>github.com/wfusion/gofusion/lock/candy.go</code><td class=percent><code>91.7%</code><td class=linecount><code>11/12</code><tr id=s_fn_mongoLocker.Unlock><td><code><a href=#fn_mongoLocker.Unlock>mongoLocker.Unlock(...)</a></code><td><code>github.com/wfusion/gofusion/lock/mongo.go</code><td class=percent><code>91.7%</code><td class=linecount><code>11/12</code><tr id=s_fn_mysqlLocker.Unlock><td><code><a href=#fn_mysqlLocker.Unlock>mysqlLocker.Unlock(...)</a></code><td><code>github.com/wfusion/gofusion/lock/mysql.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_mysqlLocker.Lock><td><code><a href=#fn_mysqlLocker.Lock>mysqlLocker.Lock(...)</a></code><td><code>github.com/wfusion/gofusion/lock/mysql.go</code><td class=percent><code>82.6%</code><td class=linecount><code>19/23</code><tr id=s_fn_addInstance><td><code><a href=#fn_addInstance>addInstance(...)</a></code><td><code>github.com/wfusion/gofusion/lock/construct.go</code><td class=percent><code>82.6%</code><td class=linecount><code>19/23</code><tr id=s_fn_Within><td><code><a href=#fn_Within>Within(...)</a></code><td><code>github.com/wfusion/gofusion/lock/candy.go</code><td class=percent><code>80.0%</code><td class=linecount><code>16/20</code><tr id=s_fn_Use><td><code><a href=#fn_Use>Use(...)</a></code><td><code>github.com/wfusion/gofusion/lock/construct.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_redisLuaLocker.ReentrantLock><td><code><a href=#fn_redisLuaLocker.ReentrantLock>redisLuaLocker.ReentrantLock(...)</a></code><td><code>github.com/wfusion/gofusion/lock/redis.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_mongoLocker.ReentrantLock><td><code><a href=#fn_mongoLocker.ReentrantLock>mongoLocker.ReentrantLock(...)</a></code><td><code>github.com/wfusion/gofusion/lock/mongo.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_@70:3><td><code><a href=#fn_@70:3>@70:3(...)</a></code><td><code>github.com/wfusion/gofusion/lock/mysql.go</code><td class=percent><code>73.3%</code><td class=linecount><code>11/15</code><tr id=s_fn_newMongoLocker><td><code><a href=#fn_newMongoLocker>newMongoLocker(...)</a></code><td><code>github.com/wfusion/gofusion/lock/mongo.go</code><td class=percent><code>70.6%</code><td class=linecount><code>12/17</code><tr id=s_fn_UseReentrant><td><code><a href=#fn_UseReentrant>UseReentrant(...)</a></code><td><code>github.com/wfusion/gofusion/lock/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/13</code><tr id=s_fn_@78:5><td><code><a href=#fn_@78:5>@78:5(...)</a></code><td><code>github.com/wfusion/gofusion/lock/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@75:22><td><code><a href=#fn_@75:22>@75:22(...)</a></code><td><code>github.com/wfusion/gofusion/lock/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_redisLuaLocker.Lock>func redisLuaLocker.Lock</div><div class=info><a href=#s_fn_redisLuaLocker.Lock>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/redis.go</code>:</div><table class=listing><tr><td>58<td><code><pre>func (r *redisLuaLocker) Lock(ctx context.Context, key string, opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>59<td><code><pre> opt := utils.ApplyOptions[lockOption](opts...)</pre></code><tr><td>60<td><code><pre> expired := tolerance</pre></code><tr><td>61<td><code><pre> if opt.expired > 0 {</pre></code><tr><td>62<td><code><pre> expired = opt.expired</pre></code><tr><td>63<td><code><pre> }</pre></code><tr><td>64<td><code><pre> lockKey := r.formatLockKey(key)</pre></code><tr><td>65<td><code><pre> err = redis.</pre></code><tr><td>66<td><code><pre> Use(ctx, r.redisName, redis.AppName(r.appName)).</pre></code><tr><td>67<td><code><pre> Eval(ctx, redisLuaLockCommand, []string{lockKey}, []string{</pre></code><tr><td>68<td><code><pre> opt.reentrantKey, strconv.Itoa(int(expired / time.Millisecond)),</pre></code><tr><td>69<td><code><pre> }).</pre></code><tr><td>70<td><code><pre> Err()</pre></code><tr><td>71<td><code><pre> if errors.Is(err, rdsDrv.Nil) {</pre></code><tr><td>72<td><code><pre> return ErrTimeout</pre></code><tr><td>73<td><code><pre> }</pre></code><tr><td>74<td><code><pre> return</pre></code><tr><td>75<td><code><pre>}</pre></code></table><div class=funcname id=fn_Construct>func Construct</div><div class=info><a href=#s_fn_Construct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/construct.go</code>:</div><table class=listing><tr><td>21<td><code><pre>func Construct(ctx context.Context, confs map[string]*Conf, opts ...utils.OptionExtender) func() {</pre></code><tr><td>22<td><code><pre> opt := utils.ApplyOptions[config.InitOption](opts...)</pre></code><tr><td>23<td><code><pre> optU := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>24<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>25<td><code><pre> opt.AppName = optU.appName</pre></code><tr><td>26<td><code><pre> }</pre></code><tr><td>27<td><code><pre> for name, conf := range confs {</pre></code><tr><td>28<td><code><pre> addInstance(ctx, name, conf, opt)</pre></code><tr><td>29<td><code><pre> }</pre></code><tr><td>30<td><code><pre></pre></code><tr><td>31<td><code><pre> return func() {</pre></code><tr><td>32<td><code><pre> rwlock.Lock()</pre></code><tr><td>33<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>34<td><code><pre> if appInstances != nil {</pre></code><tr><td>35<td><code><pre> delete(appInstances, opt.AppName)</pre></code><tr><td>36<td><code><pre> }</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre>}</pre></code></table><div class=funcname id=fn_@31:9>func @31:9</div><div class=info><a href=#s_fn_@31:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/construct.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func() {</pre></code><tr><td>32<td><code><pre> rwlock.Lock()</pre></code><tr><td>33<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>34<td><code><pre> if appInstances != nil {</pre></code><tr><td>35<td><code><pre> delete(appInstances, opt.AppName)</pre></code><tr><td>36<td><code><pre> }</pre></code><tr><td>37<td><code><pre> }</pre></code></table><div class=funcname id=fn_mysqlLocker.isLocked>func mysqlLocker.isLocked</div><div class=info><a href=#s_fn_mysqlLocker.isLocked>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/mysql.go</code>:</div><table class=listing><tr><td>112<td><code><pre>func (m *mysqlLocker) isLocked(ctx context.Context, lockKey string) (locked bool) {</pre></code><tr><td>113<td><code><pre> m.locker.RLock()</pre></code><tr><td>114<td><code><pre> defer m.locker.RUnlock()</pre></code><tr><td>115<td><code><pre> _, locked = m.lockTimers[lockKey]</pre></code><tr><td>116<td><code><pre> return</pre></code><tr><td>117<td><code><pre>}</pre></code></table><div class=funcname id=fn_redisLuaLocker.Unlock>func redisLuaLocker.Unlock</div><div class=info><a href=#s_fn_redisLuaLocker.Unlock>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/redis.go</code>:</div><table class=listing><tr><td>77<td><code><pre>func (r *redisLuaLocker) Unlock(ctx context.Context, key string, opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>78<td><code><pre> opt := utils.ApplyOptions[lockOption](opts...)</pre></code><tr><td>79<td><code><pre> lockKey := r.formatLockKey(key)</pre></code><tr><td>80<td><code><pre> return redis.</pre></code><tr><td>81<td><code><pre> Use(ctx, r.redisName, redis.AppName(r.appName)).</pre></code><tr><td>82<td><code><pre> Eval(ctx, redisLuaUnlockCommand, []string{lockKey}, []string{opt.reentrantKey}).</pre></code><tr><td>83<td><code><pre> Err()</pre></code><tr><td>84<td><code><pre>}</pre></code></table><div class=funcname id=fn_redisNXLocker.Unlock>func redisNXLocker.Unlock</div><div class=info><a href=#s_fn_redisNXLocker.Unlock>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/redis.go</code>:</div><table class=listing><tr><td>127<td><code><pre>func (r *redisNXLocker) Unlock(ctx context.Context, key string, _ ...utils.OptionExtender) (err error) {</pre></code><tr><td>128<td><code><pre> lockKey := r.formatLockKey(key)</pre></code><tr><td>129<td><code><pre> return redis.Use(ctx, r.redisName, redis.AppName(r.appName)).Del(ctx, lockKey).Err()</pre></code><tr><td>130<td><code><pre>}</pre></code></table><div class=funcname id=fn_@54:9>func @54:9</div><div class=info><a href=#s_fn_@54:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/types.go</code>:</div><table class=listing><tr><td>54<td><code><pre>func(l *lockOption) {</pre></code><tr><td>55<td><code><pre> l.expired = expired</pre></code><tr><td>56<td><code><pre> }</pre></code></table><div class=funcname id=fn_Expire>func Expire</div><div class=info><a href=#s_fn_Expire>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/types.go</code>:</div><table class=listing><tr><td>53<td><code><pre>func Expire(expired time.Duration) utils.OptionFunc[lockOption] {</pre></code><tr><td>54<td><code><pre> return func(l *lockOption) {</pre></code><tr><td>55<td><code><pre> l.expired = expired</pre></code><tr><td>56<td><code><pre> }</pre></code><tr><td>57<td><code><pre>}</pre></code></table><div class=funcname id=fn_redisNXLocker.formatLockKey>func redisNXLocker.formatLockKey</div><div class=info><a href=#s_fn_redisNXLocker.formatLockKey>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/redis.go</code>:</div><table class=listing><tr><td>132<td><code><pre>func (r *redisNXLocker) formatLockKey(key string) (format string) {</pre></code><tr><td>133<td><code><pre> return fmt.Sprintf("%s:%s", config.Use(r.appName).AppName(), key)</pre></code><tr><td>134<td><code><pre>}</pre></code></table><div class=funcname id=fn_AppName>func AppName</div><div class=info><a href=#s_fn_AppName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/construct.go</code>:</div><table class=listing><tr><td>89<td><code><pre>func AppName(name string) utils.OptionFunc[useOption] {</pre></code><tr><td>90<td><code><pre> return func(o *useOption) {</pre></code><tr><td>91<td><code><pre> o.appName = name</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre>}</pre></code></table><div class=funcname id=fn_@90:9>func @90:9</div><div class=info><a href=#s_fn_@90:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/construct.go</code>:</div><table class=listing><tr><td>90<td><code><pre>func(o *useOption) {</pre></code><tr><td>91<td><code><pre> o.appName = name</pre></code><tr><td>92<td><code><pre> }</pre></code></table><div class=funcname id=fn_@72:8>func @72:8</div><div class=info><a href=#s_fn_@72:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/candy.go</code>:</div><table class=listing><tr><td>72<td><code><pre>func() { err = multierr.Append(err, locker.Unlock(ctx, key, optionals...)) }</pre></code></table><div class=funcname id=fn_newRedisNXLocker>func newRedisNXLocker</div><div class=info><a href=#s_fn_newRedisNXLocker>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/redis.go</code>:</div><table class=listing><tr><td>105<td><code><pre>func newRedisNXLocker(ctx context.Context, appName, redisName string) Lockable {</pre></code><tr><td>106<td><code><pre> return &redisNXLocker{ctx: ctx, appName: appName, redisName: redisName}</pre></code><tr><td>107<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/construct.go</code>:</div><table class=listing><tr><td>132<td><code><pre>func init() {</pre></code><tr><td>133<td><code><pre> config.AddComponent(config.ComponentLock, Construct, config.WithFlag(&flagString))</pre></code><tr><td>134<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/flag.go</code>:</div><table class=listing><tr><td>7<td><code><pre>func init() {</pre></code><tr><td>8<td><code><pre> pflag.StringVarP(&flagString, "lock-config", "", "", "json string for lock config")</pre></code><tr><td>9<td><code><pre>}</pre></code></table><div class=funcname id=fn_redisLuaLocker.formatLockKey>func redisLuaLocker.formatLockKey</div><div class=info><a href=#s_fn_redisLuaLocker.formatLockKey>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/redis.go</code>:</div><table class=listing><tr><td>95<td><code><pre>func (r *redisLuaLocker) formatLockKey(key string) (format string) {</pre></code><tr><td>96<td><code><pre> return fmt.Sprintf("%s:%s", config.Use(r.appName).AppName(), key)</pre></code><tr><td>97<td><code><pre>}</pre></code></table><div class=funcname id=fn_@31:9>func @31:9</div><div class=info><a href=#s_fn_@31:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/candy.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func() { done <- struct{}{} }</pre></code></table><div class=funcname id=fn_ReentrantKey>func ReentrantKey</div><div class=info><a href=#s_fn_ReentrantKey>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/types.go</code>:</div><table class=listing><tr><td>59<td><code><pre>func ReentrantKey(key string) utils.OptionFunc[lockOption] {</pre></code><tr><td>60<td><code><pre> return func(l *lockOption) {</pre></code><tr><td>61<td><code><pre> l.reentrantKey = key</pre></code><tr><td>62<td><code><pre> }</pre></code><tr><td>63<td><code><pre>}</pre></code></table><div class=funcname id=fn_newRedisLuaLocker>func newRedisLuaLocker</div><div class=info><a href=#s_fn_newRedisLuaLocker>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/redis.go</code>:</div><table class=listing><tr><td>54<td><code><pre>func newRedisLuaLocker(ctx context.Context, appName, redisName string) ReentrantLockable {</pre></code><tr><td>55<td><code><pre> return &redisLuaLocker{ctx: ctx, appName: appName, redisName: redisName}</pre></code><tr><td>56<td><code><pre>}</pre></code></table><div class=funcname id=fn_mongoLocker.formatLockKey>func mongoLocker.formatLockKey</div><div class=info><a href=#s_fn_mongoLocker.formatLockKey>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/mongo.go</code>:</div><table class=listing><tr><td>153<td><code><pre>func (m *mongoLocker) formatLockKey(key string) (format string) {</pre></code><tr><td>154<td><code><pre> return fmt.Sprintf("%s_%s", config.Use(m.appName).AppName(), key)</pre></code><tr><td>155<td><code><pre>}</pre></code></table><div class=funcname id=fn_newMysqlLocker>func newMysqlLocker</div><div class=info><a href=#s_fn_newMysqlLocker>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/mysql.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func newMysqlLocker(ctx context.Context, appName, dbName string) Lockable {</pre></code><tr><td>33<td><code><pre> return &mysqlLocker{ctx: ctx, appName: appName, dbName: dbName, lockTimers: map[string]struct{}{}}</pre></code><tr><td>34<td><code><pre>}</pre></code></table><div class=funcname id=fn_mysqlLocker.formatLockKey>func mysqlLocker.formatLockKey</div><div class=info><a href=#s_fn_mysqlLocker.formatLockKey>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/mysql.go</code>:</div><table class=listing><tr><td>119<td><code><pre>func (m *mysqlLocker) formatLockKey(key string) string {</pre></code><tr><td>120<td><code><pre> return fmt.Sprintf("%s:%s", config.Use(m.appName).AppName(), key)</pre></code><tr><td>121<td><code><pre>}</pre></code></table><div class=funcname id=fn_@60:9>func @60:9</div><div class=info><a href=#s_fn_@60:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/types.go</code>:</div><table class=listing><tr><td>60<td><code><pre>func(l *lockOption) {</pre></code><tr><td>61<td><code><pre> l.reentrantKey = key</pre></code><tr><td>62<td><code><pre> }</pre></code></table><div class=funcname id=fn_mongoLocker.Lock>func mongoLocker.Lock</div><div class=info><a href=#s_fn_mongoLocker.Lock>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/mongo.go</code>:</div><table class=listing><tr><td>71<td><code><pre>func (m *mongoLocker) Lock(ctx context.Context, key string, opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>72<td><code><pre> opt := utils.ApplyOptions[lockOption](opts...)</pre></code><tr><td>73<td><code><pre> expired := tolerance</pre></code><tr><td>74<td><code><pre> if opt.expired > 0 {</pre></code><tr><td>75<td><code><pre> expired = opt.expired</pre></code><tr><td>76<td><code><pre> }</pre></code><tr><td>77<td><code><pre> now := time.Now()</pre></code><tr><td>78<td><code><pre> lockKey := m.formatLockKey(key)</pre></code><tr><td>79<td><code><pre> filter := bson.M{</pre></code><tr><td>80<td><code><pre> "lock_key": bson.M{"$eq": lockKey, "$exists": true},</pre></code><tr><td>81<td><code><pre> "$or": []bson.M{</pre></code><tr><td>82<td><code><pre> {"expires_at": bson.M{"$lt": now, "$exists": true}},</pre></code><tr><td>83<td><code><pre> {"holder": bson.M{"$eq": opt.reentrantKey, "$exists": true}},</pre></code><tr><td>84<td><code><pre> },</pre></code><tr><td>85<td><code><pre> }</pre></code><tr><td>86<td><code><pre> update := bson.M{</pre></code><tr><td>87<td><code><pre> "$setOnInsert": bson.M{</pre></code><tr><td>88<td><code><pre> "lock_key": lockKey,</pre></code><tr><td>89<td><code><pre> "holder": opt.reentrantKey,</pre></code><tr><td>90<td><code><pre> },</pre></code><tr><td>91<td><code><pre> "$inc": bson.M{"count": 1},</pre></code><tr><td>92<td><code><pre> "$max": bson.M{"expires_at": now.Add(expired)},</pre></code><tr><td>93<td><code><pre> }</pre></code><tr><td>94<td><code><pre> mopts := options.FindOneAndUpdate().SetUpsert(true).SetReturnDocument(options.After)</pre></code><tr><td>95<td><code><pre></pre></code><tr><td>96<td><code><pre> updatedDoc := new(mongoLockDoc)</pre></code><tr><td>97<td><code><pre> err = mongo.Use(m.mongoName, mongo.AppName(m.appName), mongo.WriteConcern(writeconcern.Majority())).</pre></code><tr><td>98<td><code><pre> Collection(m.collName).</pre></code><tr><td>99<td><code><pre> FindOneAndUpdate(ctx, filter, update, mopts).</pre></code><tr><td>100<td><code><pre> Decode(updatedDoc)</pre></code><tr><td>101<td><code><pre> if err != nil {</pre></code><tr><td>102<td><code><pre> return</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre></pre></code><tr><td>105<td><code><pre> if updatedDoc.LockKey == lockKey && updatedDoc.Holder == opt.reentrantKey {</pre></code><tr><td>106<td><code><pre> return</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre></pre></code><tr class=miss><td>109<td><code><pre> return ErrTimeout</pre></code><tr><td>110<td><code><pre>}</pre></code></table><div class=funcname id=fn_redisNXLocker.Lock>func redisNXLocker.Lock</div><div class=info><a href=#s_fn_redisNXLocker.Lock>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/redis.go</code>:</div><table class=listing><tr><td>109<td><code><pre>func (r *redisNXLocker) Lock(ctx context.Context, key string, opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>110<td><code><pre> opt := utils.ApplyOptions[lockOption](opts...)</pre></code><tr><td>111<td><code><pre> expired := tolerance</pre></code><tr><td>112<td><code><pre> if opt.expired > 0 {</pre></code><tr><td>113<td><code><pre> expired = opt.expired</pre></code><tr><td>114<td><code><pre> }</pre></code><tr><td>115<td><code><pre> lockKey := r.formatLockKey(key)</pre></code><tr><td>116<td><code><pre> cmd := redis.Use(ctx, r.redisName, redis.AppName(r.appName)).SetNX(ctx, lockKey, utils.UUID(), expired)</pre></code><tr><td>117<td><code><pre> if err = cmd.Err(); err != nil {</pre></code><tr class=miss><td>118<td><code><pre> return</pre></code><tr><td>119<td><code><pre> }</pre></code><tr><td>120<td><code><pre> if !cmd.Val() {</pre></code><tr><td>121<td><code><pre> err = ErrTimeout</pre></code><tr><td>122<td><code><pre> return</pre></code><tr><td>123<td><code><pre> }</pre></code><tr><td>124<td><code><pre> return</pre></code><tr><td>125<td><code><pre>}</pre></code></table><div class=funcname id=fn_@30:19>func @30:19</div><div class=info><a href=#s_fn_@30:19>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/candy.go</code>:</div><table class=listing><tr><td>30<td><code><pre>func() {</pre></code><tr><td>31<td><code><pre> defer func() { done <- struct{}{} }()</pre></code><tr><td>32<td><code><pre></pre></code><tr><td>33<td><code><pre> var e error</pre></code><tr><td>34<td><code><pre> rLocker, ok := locker.(ReentrantLockable)</pre></code><tr><td>35<td><code><pre> for {</pre></code><tr><td>36<td><code><pre> select {</pre></code><tr><td>37<td><code><pre> case <-timeFault: // timeout exit</pre></code><tr class=miss><td>38<td><code><pre> return</pre></code><tr><td>39<td><code><pre> default:</pre></code><tr><td>40<td><code><pre> if ok {</pre></code><tr><td>41<td><code><pre> if e = rLocker.ReentrantLock(ctx, key, optL.reentrantKey, optionals...); e == nil {</pre></code><tr><td>42<td><code><pre> return</pre></code><tr><td>43<td><code><pre> }</pre></code><tr><td>44<td><code><pre> } else {</pre></code><tr><td>45<td><code><pre> if e = locker.Lock(ctx, key, optionals...); e == nil {</pre></code><tr><td>46<td><code><pre> return</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre></pre></code><tr><td>50<td><code><pre> // relock after 200 milliseconds</pre></code><tr><td>51<td><code><pre> time.Sleep(reLockWaitTime)</pre></code><tr><td>52<td><code><pre> }</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre> }</pre></code></table><div class=funcname id=fn_mongoLocker.Unlock>func mongoLocker.Unlock</div><div class=info><a href=#s_fn_mongoLocker.Unlock>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/mongo.go</code>:</div><table class=listing><tr><td>112<td><code><pre>func (m *mongoLocker) Unlock(ctx context.Context, key string, opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>113<td><code><pre> opt := utils.ApplyOptions[lockOption](opts...)</pre></code><tr><td>114<td><code><pre> filter := bson.M{</pre></code><tr><td>115<td><code><pre> "lock_key": m.formatLockKey(key),</pre></code><tr><td>116<td><code><pre> "holder": opt.reentrantKey,</pre></code><tr><td>117<td><code><pre> "count": bson.M{"$gt": 0},</pre></code><tr><td>118<td><code><pre> }</pre></code><tr><td>119<td><code><pre> update := bson.M{</pre></code><tr><td>120<td><code><pre> "$inc": bson.M{"count": -1},</pre></code><tr><td>121<td><code><pre> "$max": bson.M{"expires_at": time.Now().Add(opt.expired / 2)},</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre> mopts := options.FindOneAndUpdate().SetReturnDocument(options.After)</pre></code><tr><td>124<td><code><pre></pre></code><tr><td>125<td><code><pre> updatedDoc := new(mongoLockDoc)</pre></code><tr><td>126<td><code><pre> coll := mongo.</pre></code><tr><td>127<td><code><pre> Use(m.mongoName, mongo.AppName(m.appName), mongo.WriteConcern(writeconcern.Majority())).</pre></code><tr><td>128<td><code><pre> Collection(m.collName)</pre></code><tr><td>129<td><code><pre> err = coll.FindOneAndUpdate(ctx, filter, update, mopts).Decode(&updatedDoc)</pre></code><tr><td>130<td><code><pre> if err != nil {</pre></code><tr class=miss><td>131<td><code><pre> return</pre></code><tr><td>132<td><code><pre> }</pre></code><tr><td>133<td><code><pre> if updatedDoc.Count <= 0 {</pre></code><tr><td>134<td><code><pre> _, err = coll.DeleteOne(ctx, bson.M{</pre></code><tr><td>135<td><code><pre> "lock_key": m.formatLockKey(key),</pre></code><tr><td>136<td><code><pre> "holder": opt.reentrantKey,</pre></code><tr><td>137<td><code><pre> "count": bson.M{"$lte": 0},</pre></code><tr><td>138<td><code><pre> })</pre></code><tr><td>139<td><code><pre> }</pre></code><tr><td>140<td><code><pre></pre></code><tr><td>141<td><code><pre> return</pre></code><tr><td>142<td><code><pre>}</pre></code></table><div class=funcname id=fn_mysqlLocker.Unlock>func mysqlLocker.Unlock</div><div class=info><a href=#s_fn_mysqlLocker.Unlock>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/mysql.go</code>:</div><table class=listing><tr><td>100<td><code><pre>func (m *mysqlLocker) Unlock(ctx context.Context, key string, _ ...utils.OptionExtender) (err error) {</pre></code><tr><td>101<td><code><pre> lockKey := m.formatLockKey(key)</pre></code><tr><td>102<td><code><pre> if err = db.Use(ctx, m.dbName, db.AppName(m.appName)).Raw(mysqlUnlockSQL, lockKey).Error; err != nil {</pre></code><tr class=miss><td>103<td><code><pre> return</pre></code><tr><td>104<td><code><pre> }</pre></code><tr><td>105<td><code><pre> m.locker.Lock()</pre></code><tr><td>106<td><code><pre> defer m.locker.Unlock()</pre></code><tr><td>107<td><code><pre> delete(m.lockTimers, lockKey)</pre></code><tr><td>108<td><code><pre></pre></code><tr><td>109<td><code><pre> return</pre></code><tr><td>110<td><code><pre>}</pre></code></table><div class=funcname id=fn_mysqlLocker.Lock>func mysqlLocker.Lock</div><div class=info><a href=#s_fn_mysqlLocker.Lock>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/mysql.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func (m *mysqlLocker) Lock(ctx context.Context, key string, opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>37<td><code><pre> opt := utils.ApplyOptions[lockOption](opts...)</pre></code><tr><td>38<td><code><pre> expired := tolerance</pre></code><tr><td>39<td><code><pre> if opt.expired > 0 {</pre></code><tr><td>40<td><code><pre> expired = opt.expired</pre></code><tr><td>41<td><code><pre> }</pre></code><tr><td>42<td><code><pre> lockKey := m.formatLockKey(key)</pre></code><tr><td>43<td><code><pre> if len(lockKey) > 64 {</pre></code><tr class=miss><td>44<td><code><pre> return errors.Errorf("key %s length is too long, max key length is 64", lockKey)</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre></pre></code><tr><td>47<td><code><pre> m.locker.Lock()</pre></code><tr><td>48<td><code><pre> defer m.locker.Unlock()</pre></code><tr><td>49<td><code><pre> // disable reentrant</pre></code><tr><td>50<td><code><pre> if _, ok := m.lockTimers[lockKey]; ok {</pre></code><tr><td>51<td><code><pre> return ErrTimeout</pre></code><tr><td>52<td><code><pre> }</pre></code><tr><td>53<td><code><pre></pre></code><tr><td>54<td><code><pre> ret := db.Use(ctx, m.dbName, db.AppName(m.appName)).Raw(mysqlLockSQL, lockKey, 0)</pre></code><tr><td>55<td><code><pre> if err = ret.Error; err != nil {</pre></code><tr class=miss><td>56<td><code><pre> return ret.Error</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre> var result int64</pre></code><tr><td>59<td><code><pre> if err = ret.Scan(&result).Error; err != nil {</pre></code><tr class=miss><td>60<td><code><pre> return</pre></code><tr><td>61<td><code><pre> }</pre></code><tr><td>62<td><code><pre> if result != 1 {</pre></code><tr class=miss><td>63<td><code><pre> return ErrTimeout</pre></code><tr><td>64<td><code><pre> }</pre></code><tr><td>65<td><code><pre></pre></code><tr><td>66<td><code><pre> // expire loop</pre></code><tr><td>67<td><code><pre> m.lockTimers[lockKey] = struct{}{}</pre></code><tr><td>68<td><code><pre> timer := time.NewTimer(expired)</pre></code><tr><td>69<td><code><pre> routine.Loop(</pre></code><tr><td>70<td><code><pre> func(ctx context.Context, key string, timer *time.Timer) {</pre></code><tr><td>71<td><code><pre> defer timer.Stop()</pre></code><tr><td>72<td><code><pre></pre></code><tr><td>73<td><code><pre> lockKey := m.formatLockKey(key)</pre></code><tr><td>74<td><code><pre> if !m.isLocked(ctx, lockKey) {</pre></code><tr><td>75<td><code><pre> return</pre></code><tr><td>76<td><code><pre> }</pre></code><tr><td>77<td><code><pre></pre></code><tr><td>78<td><code><pre> for {</pre></code><tr><td>79<td><code><pre> select {</pre></code><tr><td>80<td><code><pre> case <-ctx.Done():</pre></code><tr><td>81<td><code><pre> _ = m.Unlock(ctx, key) // context done</pre></code><tr><td>82<td><code><pre> return</pre></code><tr><td>83<td><code><pre> case <-m.ctx.Done():</pre></code><tr><td>84<td><code><pre> _ = m.Unlock(ctx, key) // context done</pre></code><tr><td>85<td><code><pre> return</pre></code><tr><td>86<td><code><pre> case <-timer.C:</pre></code><tr><td>87<td><code><pre> _ = m.Unlock(ctx, key) // timeout</pre></code><tr><td>88<td><code><pre> return</pre></code><tr><td>89<td><code><pre> default:</pre></code><tr><td>90<td><code><pre> if !m.isLocked(ctx, lockKey) {</pre></code><tr><td>91<td><code><pre> return</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre> time.Sleep(200*time.Millisecond + time.Duration(rand.Int63())%(100*time.Millisecond))</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre> }</pre></code><tr><td>96<td><code><pre> }, routine.Args(ctx, key, timer), routine.AppName(m.appName))</pre></code><tr><td>97<td><code><pre> return</pre></code><tr><td>98<td><code><pre>}</pre></code></table><div class=funcname id=fn_addInstance>func addInstance</div><div class=info><a href=#s_fn_addInstance>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/construct.go</code>:</div><table class=listing><tr><td>40<td><code><pre>func addInstance(ctx context.Context, name string, conf *Conf, opt *config.InitOption) {</pre></code><tr><td>41<td><code><pre> rwlock.Lock()</pre></code><tr><td>42<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>43<td><code><pre> if appInstances == nil {</pre></code><tr><td>44<td><code><pre> appInstances = make(map[string]map[string]Lockable)</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre> if appInstances[opt.AppName] == nil {</pre></code><tr><td>47<td><code><pre> appInstances[opt.AppName] = make(map[string]Lockable)</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre></pre></code><tr><td>50<td><code><pre> if _, ok := appInstances[opt.AppName][name]; ok {</pre></code><tr class=miss><td>51<td><code><pre> panic(ErrDuplicatedName)</pre></code><tr><td>52<td><code><pre> }</pre></code><tr><td>53<td><code><pre></pre></code><tr><td>54<td><code><pre> switch conf.Type {</pre></code><tr><td>55<td><code><pre> case lockTypeRedisLua:</pre></code><tr><td>56<td><code><pre> redis.Use(ctx, conf.Instance, redis.AppName(opt.AppName)) // check if instance exists</pre></code><tr><td>57<td><code><pre> appInstances[opt.AppName][name] = newRedisLuaLocker(ctx, opt.AppName, conf.Instance)</pre></code><tr><td>58<td><code><pre> case lockTypeRedisNX:</pre></code><tr><td>59<td><code><pre> redis.Use(ctx, conf.Instance, redis.AppName(opt.AppName)) // check if instance exists</pre></code><tr><td>60<td><code><pre> appInstances[opt.AppName][name] = newRedisNXLocker(ctx, opt.AppName, conf.Instance)</pre></code><tr><td>61<td><code><pre> case lockTypeMySQL:</pre></code><tr><td>62<td><code><pre> db.Use(ctx, conf.Instance, db.AppName(opt.AppName)) // check if instance exists</pre></code><tr><td>63<td><code><pre> appInstances[opt.AppName][name] = newMysqlLocker(ctx, opt.AppName, conf.Instance)</pre></code><tr><td>64<td><code><pre> case lockTypeMariaDB:</pre></code><tr class=miss><td>65<td><code><pre> db.Use(ctx, conf.Instance, db.AppName(opt.AppName)) // check if instance exists</pre></code><tr class=miss><td>66<td><code><pre> appInstances[opt.AppName][name] = newMysqlLocker(ctx, opt.AppName, conf.Instance)</pre></code><tr><td>67<td><code><pre> case lockTypeMongo:</pre></code><tr><td>68<td><code><pre> appInstances[opt.AppName][name] = newMongoLocker(ctx, opt.AppName, conf.Instance, conf.Scheme)</pre></code><tr><td>69<td><code><pre> default:</pre></code><tr class=miss><td>70<td><code><pre> panic(ErrUnsupportedLockType)</pre></code><tr><td>71<td><code><pre> }</pre></code><tr><td>72<td><code><pre></pre></code><tr><td>73<td><code><pre> // ioc</pre></code><tr><td>74<td><code><pre> if opt.DI != nil {</pre></code><tr><td>75<td><code><pre> opt.DI.MustProvide(func() Lockable { return Use(name, AppName(opt.AppName)) }, di.Name(name))</pre></code><tr><td>76<td><code><pre> if _, ok := appInstances[opt.AppName][name].(ReentrantLockable); ok {</pre></code><tr><td>77<td><code><pre> opt.DI.MustProvide(</pre></code><tr><td>78<td><code><pre> func() ReentrantLockable { return UseReentrant(ctx, name, AppName(opt.AppName)) },</pre></code><tr><td>79<td><code><pre> di.Name(name),</pre></code><tr><td>80<td><code><pre> )</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre> }</pre></code><tr><td>83<td><code><pre>}</pre></code></table><div class=funcname id=fn_Within>func Within</div><div class=info><a href=#s_fn_Within>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/candy.go</code>:</div><table class=listing><tr><td>13<td><code><pre>func Within(ctx context.Context, locker Lockable, key string,</pre></code><tr><td>14<td><code><pre> expired, timeout time.Duration, cb func() error, opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>15<td><code><pre> const (</pre></code><tr><td>16<td><code><pre> reLockWaitTime = time.Duration(200) * time.Millisecond</pre></code><tr><td>17<td><code><pre> )</pre></code><tr><td>18<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>19<td><code><pre> optL := utils.ApplyOptions[lockOption](opts...)</pre></code><tr><td>20<td><code><pre> if optL.reentrantKey == "" {</pre></code><tr><td>21<td><code><pre> optL.reentrantKey = utils.ULID()</pre></code><tr><td>22<td><code><pre> }</pre></code><tr><td>23<td><code><pre> optionals := []utils.OptionExtender{ReentrantKey(optL.reentrantKey)}</pre></code><tr><td>24<td><code><pre> if expired > 0 {</pre></code><tr><td>25<td><code><pre> optionals = append(optionals, Expire(expired))</pre></code><tr><td>26<td><code><pre> }</pre></code><tr><td>27<td><code><pre></pre></code><tr><td>28<td><code><pre> done := make(chan struct{}, 1)</pre></code><tr><td>29<td><code><pre> timeFault := make(chan struct{}, 1)</pre></code><tr><td>30<td><code><pre> routine.Goc(ctx, func() {</pre></code><tr><td>31<td><code><pre> defer func() { done <- struct{}{} }()</pre></code><tr><td>32<td><code><pre></pre></code><tr><td>33<td><code><pre> var e error</pre></code><tr><td>34<td><code><pre> rLocker, ok := locker.(ReentrantLockable)</pre></code><tr><td>35<td><code><pre> for {</pre></code><tr><td>36<td><code><pre> select {</pre></code><tr><td>37<td><code><pre> case <-timeFault: // timeout exit</pre></code><tr><td>38<td><code><pre> return</pre></code><tr><td>39<td><code><pre> default:</pre></code><tr><td>40<td><code><pre> if ok {</pre></code><tr><td>41<td><code><pre> if e = rLocker.ReentrantLock(ctx, key, optL.reentrantKey, optionals...); e == nil {</pre></code><tr><td>42<td><code><pre> return</pre></code><tr><td>43<td><code><pre> }</pre></code><tr><td>44<td><code><pre> } else {</pre></code><tr><td>45<td><code><pre> if e = locker.Lock(ctx, key, optionals...); e == nil {</pre></code><tr><td>46<td><code><pre> return</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre></pre></code><tr><td>50<td><code><pre> // relock after 200 milliseconds</pre></code><tr><td>51<td><code><pre> time.Sleep(reLockWaitTime)</pre></code><tr><td>52<td><code><pre> }</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre> }, routine.AppName(opt.appName))</pre></code><tr><td>55<td><code><pre></pre></code><tr><td>56<td><code><pre> timer := time.NewTimer(timeout)</pre></code><tr><td>57<td><code><pre> select {</pre></code><tr><td>58<td><code><pre> // success</pre></code><tr><td>59<td><code><pre> case <-done:</pre></code><tr><td>60<td><code><pre></pre></code><tr><td>61<td><code><pre> // context done</pre></code><tr><td>62<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>63<td><code><pre> timeFault <- struct{}{}</pre></code><tr class=miss><td>64<td><code><pre> return ErrContextDone</pre></code><tr><td>65<td><code><pre></pre></code><tr><td>66<td><code><pre> // timeout</pre></code><tr><td>67<td><code><pre> case <-timer.C:</pre></code><tr class=miss><td>68<td><code><pre> timeFault <- struct{}{}</pre></code><tr class=miss><td>69<td><code><pre> return ErrTimeout</pre></code><tr><td>70<td><code><pre> }</pre></code><tr><td>71<td><code><pre></pre></code><tr><td>72<td><code><pre> defer func() { err = multierr.Append(err, locker.Unlock(ctx, key, optionals...)) }()</pre></code><tr><td>73<td><code><pre></pre></code><tr><td>74<td><code><pre> _, err = utils.Catch(cb)</pre></code><tr><td>75<td><code><pre> return</pre></code><tr><td>76<td><code><pre>}</pre></code></table><div class=funcname id=fn_Use>func Use</div><div class=info><a href=#s_fn_Use>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/construct.go</code>:</div><table class=listing><tr><td>95<td><code><pre>func Use(name string, opts ...utils.OptionExtender) Lockable {</pre></code><tr><td>96<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>97<td><code><pre></pre></code><tr><td>98<td><code><pre> rwlock.RLock()</pre></code><tr><td>99<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>100<td><code><pre> instances, ok := appInstances[opt.appName]</pre></code><tr><td>101<td><code><pre> if !ok {</pre></code><tr class=miss><td>102<td><code><pre> panic(errors.Errorf("locker instance not found for app: %s", opt.appName))</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre> instance, ok := instances[name]</pre></code><tr><td>105<td><code><pre> if !ok {</pre></code><tr class=miss><td>106<td><code><pre> panic(errors.Errorf("locker instance not found for name: %s", name))</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre> return instance</pre></code><tr><td>109<td><code><pre>}</pre></code></table><div class=funcname id=fn_redisLuaLocker.ReentrantLock>func redisLuaLocker.ReentrantLock</div><div class=info><a href=#s_fn_redisLuaLocker.ReentrantLock>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/redis.go</code>:</div><table class=listing><tr><td>86<td><code><pre>func (r *redisLuaLocker) ReentrantLock(ctx context.Context, key, reentrantKey string,</pre></code><tr><td>87<td><code><pre> opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>88<td><code><pre> opt := utils.ApplyOptions[lockOption](opts...)</pre></code><tr><td>89<td><code><pre> if utils.IsStrBlank(opt.reentrantKey) {</pre></code><tr class=miss><td>90<td><code><pre> return ErrReentrantKeyNotFound</pre></code><tr><td>91<td><code><pre> }</pre></code><tr><td>92<td><code><pre> return r.Lock(ctx, key, append(opts, ReentrantKey(reentrantKey))...)</pre></code><tr><td>93<td><code><pre>}</pre></code></table><div class=funcname id=fn_mongoLocker.ReentrantLock>func mongoLocker.ReentrantLock</div><div class=info><a href=#s_fn_mongoLocker.ReentrantLock>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/mongo.go</code>:</div><table class=listing><tr><td>144<td><code><pre>func (m *mongoLocker) ReentrantLock(ctx context.Context, key, reentrantKey string,</pre></code><tr><td>145<td><code><pre> opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>146<td><code><pre> opt := utils.ApplyOptions[lockOption](opts...)</pre></code><tr><td>147<td><code><pre> if utils.IsStrBlank(opt.reentrantKey) {</pre></code><tr class=miss><td>148<td><code><pre> return ErrReentrantKeyNotFound</pre></code><tr><td>149<td><code><pre> }</pre></code><tr><td>150<td><code><pre> return m.Lock(ctx, key, append(opts, ReentrantKey(reentrantKey))...)</pre></code><tr><td>151<td><code><pre>}</pre></code></table><div class=funcname id=fn_@70:3>func @70:3</div><div class=info><a href=#s_fn_@70:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/mysql.go</code>:</div><table class=listing><tr><td>70<td><code><pre>func(ctx context.Context, key string, timer *time.Timer) {</pre></code><tr><td>71<td><code><pre> defer timer.Stop()</pre></code><tr><td>72<td><code><pre></pre></code><tr><td>73<td><code><pre> lockKey := m.formatLockKey(key)</pre></code><tr><td>74<td><code><pre> if !m.isLocked(ctx, lockKey) {</pre></code><tr><td>75<td><code><pre> return</pre></code><tr><td>76<td><code><pre> }</pre></code><tr><td>77<td><code><pre></pre></code><tr><td>78<td><code><pre> for {</pre></code><tr><td>79<td><code><pre> select {</pre></code><tr><td>80<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>81<td><code><pre> _ = m.Unlock(ctx, key) // context done</pre></code><tr class=miss><td>82<td><code><pre> return</pre></code><tr><td>83<td><code><pre> case <-m.ctx.Done():</pre></code><tr class=miss><td>84<td><code><pre> _ = m.Unlock(ctx, key) // context done</pre></code><tr class=miss><td>85<td><code><pre> return</pre></code><tr><td>86<td><code><pre> case <-timer.C:</pre></code><tr><td>87<td><code><pre> _ = m.Unlock(ctx, key) // timeout</pre></code><tr><td>88<td><code><pre> return</pre></code><tr><td>89<td><code><pre> default:</pre></code><tr><td>90<td><code><pre> if !m.isLocked(ctx, lockKey) {</pre></code><tr><td>91<td><code><pre> return</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre> time.Sleep(200*time.Millisecond + time.Duration(rand.Int63())%(100*time.Millisecond))</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre> }</pre></code><tr><td>96<td><code><pre> }</pre></code></table><div class=funcname id=fn_newMongoLocker>func newMongoLocker</div><div class=info><a href=#s_fn_newMongoLocker>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/mongo.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func newMongoLocker(ctx context.Context, appName, mongoName, collName string) Lockable {</pre></code><tr><td>33<td><code><pre> mongoInitLocker.Lock()</pre></code><tr><td>34<td><code><pre> defer mongoInitLocker.Unlock()</pre></code><tr><td>35<td><code><pre></pre></code><tr><td>36<td><code><pre> db := mongo.Use(mongoName, mongo.AppName(appName), mongo.WriteConcern(writeconcern.Majority()))</pre></code><tr><td>37<td><code><pre> coll := db.Collection(collName)</pre></code><tr><td>38<td><code><pre> colls, err := db.ListCollectionNames(ctx, bson.M{"name": collName})</pre></code><tr><td>39<td><code><pre> if err != nil {</pre></code><tr class=miss><td>40<td><code><pre> panic(errors.Errorf("%s lock component mongo %s parse collection %s failed: %s",</pre></code><tr><td>41<td><code><pre> appName, mongoName, collName, err))</pre></code><tr><td>42<td><code><pre> }</pre></code><tr><td>43<td><code><pre> if len(colls) == 0 {</pre></code><tr class=miss><td>44<td><code><pre> if err = db.CreateCollection(ctx, collName); err != nil {</pre></code><tr class=miss><td>45<td><code><pre> panic(errors.Errorf("%s lock component mongo %s create collection %s failed: %s",</pre></code><tr><td>46<td><code><pre> appName, mongoName, collName, err))</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre></pre></code><tr><td>50<td><code><pre> ttlIdxModel := mgoDrv.IndexModel{</pre></code><tr><td>51<td><code><pre> Keys: bson.M{"expires_at": 1},</pre></code><tr><td>52<td><code><pre> Options: options.Index().SetExpireAfterSeconds(0),</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre> if _, err = coll.Indexes().CreateOne(ctx, ttlIdxModel); err != nil {</pre></code><tr class=miss><td>55<td><code><pre> panic(errors.Errorf("%s lock component mongo %s create ttl index %s failed: %s",</pre></code><tr><td>56<td><code><pre> appName, mongoName, collName, err))</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre></pre></code><tr><td>59<td><code><pre> indexModel := mgoDrv.IndexModel{</pre></code><tr><td>60<td><code><pre> Keys: bson.M{"lock_key": 1},</pre></code><tr><td>61<td><code><pre> Options: options.Index().SetUnique(true),</pre></code><tr><td>62<td><code><pre> }</pre></code><tr><td>63<td><code><pre> if _, err = coll.Indexes().CreateOne(ctx, indexModel); err != nil {</pre></code><tr class=miss><td>64<td><code><pre> panic(errors.Errorf("%s lock component mongo %s create lock index %s failed: %s",</pre></code><tr><td>65<td><code><pre> appName, mongoName, collName, err))</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre></pre></code><tr><td>68<td><code><pre> return &mongoLocker{ctx: ctx, appName: appName, mongoName: mongoName, collName: collName}</pre></code><tr><td>69<td><code><pre>}</pre></code></table><div class=funcname id=fn_UseReentrant>func UseReentrant</div><div class=info><a href=#s_fn_UseReentrant>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/construct.go</code>:</div><table class=listing><tr><td>111<td><code><pre>func UseReentrant(ctx context.Context, name string, opts ...utils.OptionExtender) ReentrantLockable {</pre></code><tr class=miss><td>112<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>113<td><code><pre></pre></code><tr class=miss><td>114<td><code><pre> rwlock.RLock()</pre></code><tr class=miss><td>115<td><code><pre> defer rwlock.RUnlock()</pre></code><tr class=miss><td>116<td><code><pre> instances, ok := appInstances[opt.appName]</pre></code><tr class=miss><td>117<td><code><pre> if !ok {</pre></code><tr class=miss><td>118<td><code><pre> panic(errors.Errorf("reentrant locker instance not found for app: %s", opt.appName))</pre></code><tr><td>119<td><code><pre> }</pre></code><tr class=miss><td>120<td><code><pre> instance, ok := instances[name]</pre></code><tr class=miss><td>121<td><code><pre> if !ok {</pre></code><tr class=miss><td>122<td><code><pre> panic(errors.Errorf("reentrant locker instance not found for name: %s", name))</pre></code><tr><td>123<td><code><pre> }</pre></code><tr class=miss><td>124<td><code><pre> lockable, ok := instance.(ReentrantLockable)</pre></code><tr class=miss><td>125<td><code><pre> if !ok {</pre></code><tr class=miss><td>126<td><code><pre> panic(errors.Errorf("locker instance is not reentrantable: %s", name))</pre></code><tr><td>127<td><code><pre> }</pre></code><tr><td>128<td><code><pre></pre></code><tr class=miss><td>129<td><code><pre> return lockable</pre></code><tr><td>130<td><code><pre>}</pre></code></table><div class=funcname id=fn_@78:5>func @78:5</div><div class=info><a href=#s_fn_@78:5>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/construct.go</code>:</div><table class=listing><tr class=miss><td>78<td><code><pre>func() ReentrantLockable { return UseReentrant(ctx, name, AppName(opt.AppName)) }</pre></code></table><div class=funcname id=fn_@75:22>func @75:22</div><div class=info><a href=#s_fn_@75:22>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/lock/construct.go</code>:</div><table class=listing><tr class=miss><td>75<td><code><pre>func() Lockable { return Use(name, AppName(opt.AppName)) }</pre></code></table><div id=pkg_github.com/wfusion/gofusion/log class=funcname>Package Overview: github.com/wfusion/gofusion/log 36 <span class=packageTotal>68.3%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_@40:9><td><code><a href=#fn_@40:9>@40:9(...)</a></code><td><code>github.com/wfusion/gofusion/log/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>11/11</code><tr id=s_fn_logger.flush><td><code><a href=#fn_logger.flush>logger.flush(...)</a></code><td><code>github.com/wfusion/gofusion/log/logger.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_convertFieldsToZapFields><td><code><a href=#fn_convertFieldsToZapFields>convertFieldsToZapFields(...)</a></code><td><code>github.com/wfusion/gofusion/log/context.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_getEncoderConfig><td><code><a href=#fn_getEncoderConfig>getEncoderConfig(...)</a></code><td><code>github.com/wfusion/gofusion/log/utils.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_zapLogLevel.Enabled><td><code><a href=#fn_zapLogLevel.Enabled>zapLogLevel.Enabled(...)</a></code><td><code>github.com/wfusion/gofusion/log/utils.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_newZapLogLevel><td><code><a href=#fn_newZapLogLevel>newZapLogLevel(...)</a></code><td><code>github.com/wfusion/gofusion/log/utils.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@86:4><td><code><a href=#fn_@86:4>@86:4(...)</a></code><td><code>github.com/wfusion/gofusion/log/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@87:4><td><code><a href=#fn_@87:4>@87:4(...)</a></code><td><code>github.com/wfusion/gofusion/log/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_GetCtxLogger><td><code><a href=#fn_GetCtxLogger>GetCtxLogger(...)</a></code><td><code>github.com/wfusion/gofusion/log/context.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_SetCtxFields><td><code><a href=#fn_SetCtxFields>SetCtxFields(...)</a></code><td><code>github.com/wfusion/gofusion/log/context.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/log/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/log/flag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Info><td><code><a href=#fn_Info>Info(...)</a></code><td><code>github.com/wfusion/gofusion/log/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@40:9><td><code><a href=#fn_@40:9>@40:9(...)</a></code><td><code>github.com/wfusion/gofusion/log/logger.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_AppName><td><code><a href=#fn_AppName>AppName(...)</a></code><td><code>github.com/wfusion/gofusion/log/logger.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_logger.sweeten><td><code><a href=#fn_logger.sweeten>logger.sweeten(...)</a></code><td><code>github.com/wfusion/gofusion/log/logger.go</code><td class=percent><code>90.9%</code><td class=linecount><code>20/22</code><tr id=s_fn_Construct><td><code><a href=#fn_Construct>Construct(...)</a></code><td><code>github.com/wfusion/gofusion/log/construct.go</code><td class=percent><code>90.0%</code><td class=linecount><code>9/10</code><tr id=s_fn_addInstance><td><code><a href=#fn_addInstance>addInstance(...)</a></code><td><code>github.com/wfusion/gofusion/log/construct.go</code><td class=percent><code>88.4%</code><td class=linecount><code>38/43</code><tr id=s_fn_getContextZapFields><td><code><a href=#fn_getContextZapFields>getContextZapFields(...)</a></code><td><code>github.com/wfusion/gofusion/log/context.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_defaultLogger><td><code><a href=#fn_defaultLogger>defaultLogger(...)</a></code><td><code>github.com/wfusion/gofusion/log/logger.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_zapLogLevel.reloadConfig><td><code><a href=#fn_zapLogLevel.reloadConfig>zapLogLevel.reloadConfig(...)</a></code><td><code>github.com/wfusion/gofusion/log/utils.go</code><td class=percent><code>80.0%</code><td class=linecount><code>12/15</code><tr id=s_fn_logger.Warn><td><code><a href=#fn_logger.Warn>logger.Warn(...)</a></code><td><code>github.com/wfusion/gofusion/log/logger.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_logger.Info><td><code><a href=#fn_logger.Info>logger.Info(...)</a></code><td><code>github.com/wfusion/gofusion/log/logger.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_logger.Debug><td><code><a href=#fn_logger.Debug>logger.Debug(...)</a></code><td><code>github.com/wfusion/gofusion/log/logger.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_getEncoder><td><code><a href=#fn_getEncoder>getEncoder(...)</a></code><td><code>github.com/wfusion/gofusion/log/utils.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_@161:12><td><code><a href=#fn_@161:12>@161:12(...)</a></code><td><code>github.com/wfusion/gofusion/log/logger.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_Use><td><code><a href=#fn_Use>Use(...)</a></code><td><code>github.com/wfusion/gofusion/log/logger.go</code><td class=percent><code>62.5%</code><td class=linecount><code>10/16</code><tr id=s_fn_getLogLevel><td><code><a href=#fn_getLogLevel>getLogLevel(...)</a></code><td><code>github.com/wfusion/gofusion/log/utils.go</code><td class=percent><code>62.5%</code><td class=linecount><code>5/8</code><tr id=s_fn_logger.Level><td><code><a href=#fn_logger.Level>logger.Level(...)</a></code><td><code>github.com/wfusion/gofusion/log/logger.go</code><td class=percent><code>41.7%</code><td class=linecount><code>5/12</code><tr id=s_fn_DelCtxFields><td><code><a href=#fn_DelCtxFields>DelCtxFields(...)</a></code><td><code>github.com/wfusion/gofusion/log/context.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/9</code><tr id=s_fn_@19:8><td><code><a href=#fn_@19:8>@19:8(...)</a></code><td><code>github.com/wfusion/gofusion/log/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_logger.Panic><td><code><a href=#fn_logger.Panic>logger.Panic(...)</a></code><td><code>github.com/wfusion/gofusion/log/logger.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_logger.Error><td><code><a href=#fn_logger.Error>logger.Error(...)</a></code><td><code>github.com/wfusion/gofusion/log/logger.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_logger.Fatal><td><code><a href=#fn_logger.Fatal>logger.Fatal(...)</a></code><td><code>github.com/wfusion/gofusion/log/logger.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_@92:4><td><code><a href=#fn_@92:4>@92:4(...)</a></code><td><code>github.com/wfusion/gofusion/log/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_TimeElapsed><td><code><a href=#fn_TimeElapsed>TimeElapsed(...)</a></code><td><code>github.com/wfusion/gofusion/log/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@88:4><td><code><a href=#fn_@88:4>@88:4(...)</a></code><td><code>github.com/wfusion/gofusion/log/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_AddCtxFields><td><code><a href=#fn_AddCtxFields>AddCtxFields(...)</a></code><td><code>github.com/wfusion/gofusion/log/context.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@157:4><td><code><a href=#fn_@157:4>@157:4(...)</a></code><td><code>github.com/wfusion/gofusion/log/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Debug><td><code><a href=#fn_Debug>Debug(...)</a></code><td><code>github.com/wfusion/gofusion/log/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_SetCtxLogger><td><code><a href=#fn_SetCtxLogger>SetCtxLogger(...)</a></code><td><code>github.com/wfusion/gofusion/log/context.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_GetCtxFields><td><code><a href=#fn_GetCtxFields>GetCtxFields(...)</a></code><td><code>github.com/wfusion/gofusion/log/context.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Panic><td><code><a href=#fn_Panic>Panic(...)</a></code><td><code>github.com/wfusion/gofusion/log/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Error><td><code><a href=#fn_Error>Error(...)</a></code><td><code>github.com/wfusion/gofusion/log/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Warn><td><code><a href=#fn_Warn>Warn(...)</a></code><td><code>github.com/wfusion/gofusion/log/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Fatal><td><code><a href=#fn_Fatal>Fatal(...)</a></code><td><code>github.com/wfusion/gofusion/log/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_@40:9>func @40:9</div><div class=info><a href=#s_fn_@40:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/construct.go</code>:</div><table class=listing><tr><td>40<td><code><pre>func() {</pre></code><tr><td>41<td><code><pre> rwlock.Lock()</pre></code><tr><td>42<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>43<td><code><pre> if appInstances != nil {</pre></code><tr><td>44<td><code><pre> for _, instance := range appInstances[opt.AppName] {</pre></code><tr><td>45<td><code><pre> instance.flush()</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre> delete(appInstances, opt.AppName)</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre></pre></code><tr><td>50<td><code><pre> // there maybe some locally logging, avoid some NPE crash as possible as we can do</pre></code><tr><td>51<td><code><pre> colorful := false</pre></code><tr><td>52<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>53<td><code><pre> if confs != nil && confs[config.DefaultInstanceKey] != nil {</pre></code><tr><td>54<td><code><pre> colorful = confs[config.DefaultInstanceKey].ConsoleOutputOption.Colorful</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre> globalLogger = defaultLogger(colorful)</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre> }</pre></code></table><div class=funcname id=fn_logger.flush>func logger.flush</div><div class=info><a href=#s_fn_logger.flush>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/logger.go</code>:</div><table class=listing><tr><td>160<td><code><pre>func (l *logger) flush() {</pre></code><tr><td>161<td><code><pre> ignore := func(err error) bool {</pre></code><tr><td>162<td><code><pre> // ENOTTY:</pre></code><tr><td>163<td><code><pre> // ignore sync /dev/stdout: inappropriate ioctl for device errors,</pre></code><tr><td>164<td><code><pre> // which happens when redirect stderr to stdout</pre></code><tr><td>165<td><code><pre> // EINVAL:</pre></code><tr><td>166<td><code><pre> // ignore sync /dev/stdout: invalid argument</pre></code><tr><td>167<td><code><pre> for _, target := range []error{syscall.EINVAL, syscall.ENOTTY} {</pre></code><tr><td>168<td><code><pre> if errors.Is(err, target) {</pre></code><tr><td>169<td><code><pre> return true</pre></code><tr><td>170<td><code><pre> }</pre></code><tr><td>171<td><code><pre> }</pre></code><tr><td>172<td><code><pre> return false</pre></code><tr><td>173<td><code><pre> }</pre></code><tr><td>174<td><code><pre></pre></code><tr><td>175<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>176<td><code><pre> if _, err := utils.Catch(l.logger.Sync); err != nil && !ignore(err) {</pre></code><tr><td>177<td><code><pre> log.Printf("%v [Gofusion] %s flush %s logger error: %s", pid, config.ComponentLog, l.name, err)</pre></code><tr><td>178<td><code><pre> }</pre></code><tr><td>179<td><code><pre> if _, err := utils.Catch(l.sugaredLogger.Sync); err != nil && !ignore(err) {</pre></code><tr><td>180<td><code><pre> log.Printf("%v [Gofusion] %s flush %s sugared logger error: %s",</pre></code><tr><td>181<td><code><pre> pid, config.ComponentLog, l.name, err)</pre></code><tr><td>182<td><code><pre> }</pre></code><tr><td>183<td><code><pre>}</pre></code></table><div class=funcname id=fn_convertFieldsToZapFields>func convertFieldsToZapFields</div><div class=info><a href=#s_fn_convertFieldsToZapFields>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/context.go</code>:</div><table class=listing><tr><td>27<td><code><pre>func convertFieldsToZapFields(fields Fields) (zapFields []zap.Field) {</pre></code><tr><td>28<td><code><pre> zapFields = make([]zap.Field, 0, len(fields))</pre></code><tr><td>29<td><code><pre> for k, v := range fields {</pre></code><tr><td>30<td><code><pre> zapFields = append(zapFields, zap.Any(k, v))</pre></code><tr><td>31<td><code><pre> }</pre></code><tr><td>32<td><code><pre> return</pre></code><tr><td>33<td><code><pre>}</pre></code></table><div class=funcname id=fn_getEncoderConfig>func getEncoderConfig</div><div class=info><a href=#s_fn_getEncoderConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/utils.go</code>:</div><table class=listing><tr><td>33<td><code><pre>func getEncoderConfig(conf *Conf) zapcore.EncoderConfig {</pre></code><tr><td>34<td><code><pre> skips := make([]string, 0, len(encoder.SkipCallers)+len(conf.SkipCallers))</pre></code><tr><td>35<td><code><pre> skips = append(skips, encoder.SkipCallers...)</pre></code><tr><td>36<td><code><pre> skips = append(skips, conf.SkipCallers...)</pre></code><tr><td>37<td><code><pre> return zapcore.EncoderConfig{</pre></code><tr><td>38<td><code><pre> LevelKey: "L",</pre></code><tr><td>39<td><code><pre> TimeKey: "T",</pre></code><tr><td>40<td><code><pre> MessageKey: "M",</pre></code><tr><td>41<td><code><pre> NameKey: "N",</pre></code><tr><td>42<td><code><pre> CallerKey: "C",</pre></code><tr><td>43<td><code><pre> StacktraceKey: "S",</pre></code><tr><td>44<td><code><pre> LineEnding: zapcore.DefaultLineEnding,</pre></code><tr><td>45<td><code><pre> EncodeLevel: zapcore.CapitalLevelEncoder,</pre></code><tr><td>46<td><code><pre> EncodeTime: zapcore.ISO8601TimeEncoder,</pre></code><tr><td>47<td><code><pre> EncodeDuration: zapcore.SecondsDurationEncoder,</pre></code><tr><td>48<td><code><pre> EncodeCaller: encoder.SkipCallerEncoder(skips, conf.ShorterFilepath),</pre></code><tr><td>49<td><code><pre> }</pre></code><tr><td>50<td><code><pre>}</pre></code></table><div class=funcname id=fn_zapLogLevel.Enabled>func zapLogLevel.Enabled</div><div class=info><a href=#s_fn_zapLogLevel.Enabled>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/utils.go</code>:</div><table class=listing><tr><td>85<td><code><pre>func (z *zapLogLevel) Enabled(level zapcore.Level) bool {</pre></code><tr><td>86<td><code><pre> if z.reloadConfig(); !z.enabled {</pre></code><tr><td>87<td><code><pre> return false</pre></code><tr><td>88<td><code><pre> }</pre></code><tr><td>89<td><code><pre></pre></code><tr><td>90<td><code><pre> return level >= z.Level</pre></code><tr><td>91<td><code><pre>}</pre></code></table><div class=funcname id=fn_newZapLogLevel>func newZapLogLevel</div><div class=info><a href=#s_fn_newZapLogLevel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/utils.go</code>:</div><table class=listing><tr><td>63<td><code><pre>func newZapLogLevel(appName, confName, enableField, levelField string) zapcore.LevelEnabler {</pre></code><tr><td>64<td><code><pre> z := &zapLogLevel{</pre></code><tr><td>65<td><code><pre> enabled: true,</pre></code><tr><td>66<td><code><pre> appName: config.Use(appName).AppName(),</pre></code><tr><td>67<td><code><pre> confName: confName,</pre></code><tr><td>68<td><code><pre> enableField: enableField,</pre></code><tr><td>69<td><code><pre> levelField: levelField,</pre></code><tr><td>70<td><code><pre> }</pre></code><tr><td>71<td><code><pre> z.reloadConfig()</pre></code><tr><td>72<td><code><pre> return z</pre></code><tr><td>73<td><code><pre>}</pre></code></table><div class=funcname id=fn_@86:4>func @86:4</div><div class=info><a href=#s_fn_@86:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/construct.go</code>:</div><table class=listing><tr><td>86<td><code><pre>func() bool { logName = conf.FileOutputOption.Name; return utils.IsStrNotBlank(logName) }</pre></code></table><div class=funcname id=fn_@87:4>func @87:4</div><div class=info><a href=#s_fn_@87:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/construct.go</code>:</div><table class=listing><tr><td>87<td><code><pre>func() bool { logName = config.Use(opt.AppName).AppName() + ext; return utils.IsStrNotBlank(logName) }</pre></code></table><div class=funcname id=fn_GetCtxLogger>func GetCtxLogger</div><div class=info><a href=#s_fn_GetCtxLogger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/context.go</code>:</div><table class=listing><tr><td>35<td><code><pre>func GetCtxLogger(ctx context.Context, args ...Loggable) (logger Loggable) {</pre></code><tr><td>36<td><code><pre> return utils.GetCtxAny(ctx, fusCtx.KeyLoggable, args...)</pre></code><tr><td>37<td><code><pre>}</pre></code></table><div class=funcname id=fn_SetCtxFields>func SetCtxFields</div><div class=info><a href=#s_fn_SetCtxFields>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/context.go</code>:</div><table class=listing><tr><td>47<td><code><pre>func SetCtxFields(ctx context.Context, fields Fields) context.Context {</pre></code><tr><td>48<td><code><pre> return utils.SetCtxAny(ctx, fusCtx.KeyLogFields, fields)</pre></code><tr><td>49<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/construct.go</code>:</div><table class=listing><tr><td>163<td><code><pre>func init() {</pre></code><tr><td>164<td><code><pre> config.AddComponent(config.ComponentLog, Construct, config.WithFlag(&flagString))</pre></code><tr><td>165<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/flag.go</code>:</div><table class=listing><tr><td>9<td><code><pre>func init() {</pre></code><tr><td>10<td><code><pre> pflag.StringVarP(&flagString, "log-config", "", "", "json string for log config")</pre></code><tr><td>11<td><code><pre>}</pre></code></table><div class=funcname id=fn_Info>func Info</div><div class=info><a href=#s_fn_Info>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/candy.go</code>:</div><table class=listing><tr><td>11<td><code><pre>func Info(ctx context.Context, format string, args ...any) { globalLogger.Info(ctx, format, args...) }</pre></code></table><div class=funcname id=fn_@40:9>func @40:9</div><div class=info><a href=#s_fn_@40:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/logger.go</code>:</div><table class=listing><tr><td>40<td><code><pre>func(o *useOption) {</pre></code><tr><td>41<td><code><pre> o.appName = name</pre></code><tr><td>42<td><code><pre> }</pre></code></table><div class=funcname id=fn_AppName>func AppName</div><div class=info><a href=#s_fn_AppName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/logger.go</code>:</div><table class=listing><tr><td>39<td><code><pre>func AppName(name string) utils.OptionFunc[useOption] {</pre></code><tr><td>40<td><code><pre> return func(o *useOption) {</pre></code><tr><td>41<td><code><pre> o.appName = name</pre></code><tr><td>42<td><code><pre> }</pre></code><tr><td>43<td><code><pre>}</pre></code></table><div class=funcname id=fn_logger.sweeten>func logger.sweeten</div><div class=info><a href=#s_fn_logger.sweeten>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/logger.go</code>:</div><table class=listing><tr><td>185<td><code><pre>func (l *logger) sweeten(ctx context.Context, format string, raw ...any) (</pre></code><tr><td>186<td><code><pre> log Loggable, msg string, fields []zap.Field) {</pre></code><tr><td>187<td><code><pre> args := make([]any, 0, len(raw))</pre></code><tr><td>188<td><code><pre> fields = getContextZapFields(ctx)</pre></code><tr><td>189<td><code><pre> for _, arg := range raw {</pre></code><tr><td>190<td><code><pre> if f, ok := arg.(Fields); ok {</pre></code><tr><td>191<td><code><pre> fields = append(fields, convertFieldsToZapFields(f)...)</pre></code><tr><td>192<td><code><pre> continue</pre></code><tr><td>193<td><code><pre> }</pre></code><tr><td>194<td><code><pre> args = append(args, arg)</pre></code><tr><td>195<td><code><pre> }</pre></code><tr><td>196<td><code><pre></pre></code><tr><td>197<td><code><pre> msg = fmt.Sprintf(format, args...)</pre></code><tr><td>198<td><code><pre> if userID := fusCtx.GetUserID(ctx); utils.IsStrNotBlank(userID) {</pre></code><tr class=miss><td>199<td><code><pre> fields = append(fields, zap.String("user_id", userID))</pre></code><tr><td>200<td><code><pre> }</pre></code><tr><td>201<td><code><pre> if traceID := fusCtx.GetTraceID(ctx); utils.IsStrNotBlank(traceID) {</pre></code><tr><td>202<td><code><pre> fields = append(fields, zap.String("trace_id", traceID))</pre></code><tr><td>203<td><code><pre> }</pre></code><tr><td>204<td><code><pre> if taskID := fusCtx.GetCronTaskID(ctx); utils.IsStrNotBlank(taskID) {</pre></code><tr class=miss><td>205<td><code><pre> fields = append(fields, zap.String("cron_task_id", taskID))</pre></code><tr><td>206<td><code><pre> }</pre></code><tr><td>207<td><code><pre> if taskName := fusCtx.GetCronTaskName(ctx); utils.IsStrNotBlank(taskName) {</pre></code><tr><td>208<td><code><pre> fields = append(fields, zap.String("cron_task_name", taskName))</pre></code><tr><td>209<td><code><pre> }</pre></code><tr><td>210<td><code><pre> if id := utils.GetCtxAny[string](ctx, watermill.ContextKeyMessageUUID); utils.IsStrNotBlank(id) {</pre></code><tr><td>211<td><code><pre> fields = append(fields, zap.String("message_uuid", id))</pre></code><tr><td>212<td><code><pre> }</pre></code><tr><td>213<td><code><pre> if id := utils.GetCtxAny[string](ctx, watermill.ContextKeyRawMessageID); utils.IsStrNotBlank(id) {</pre></code><tr><td>214<td><code><pre> fields = append(fields, zap.String("message_raw_id", id))</pre></code><tr><td>215<td><code><pre> }</pre></code><tr><td>216<td><code><pre></pre></code><tr><td>217<td><code><pre> log = GetCtxLogger(ctx, l)</pre></code><tr><td>218<td><code><pre> return</pre></code><tr><td>219<td><code><pre>}</pre></code></table><div class=funcname id=fn_Construct>func Construct</div><div class=info><a href=#s_fn_Construct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/construct.go</code>:</div><table class=listing><tr><td>24<td><code><pre>func Construct(ctx context.Context, confs map[string]*Conf, opts ...utils.OptionExtender) func() {</pre></code><tr><td>25<td><code><pre> opt := utils.ApplyOptions[config.InitOption](opts...)</pre></code><tr><td>26<td><code><pre> optU := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>27<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>28<td><code><pre> opt.AppName = optU.appName</pre></code><tr><td>29<td><code><pre> }</pre></code><tr><td>30<td><code><pre> for name, conf := range confs {</pre></code><tr><td>31<td><code><pre> addInstance(ctx, name, conf, opt)</pre></code><tr><td>32<td><code><pre> }</pre></code><tr><td>33<td><code><pre></pre></code><tr><td>34<td><code><pre> if opt.AppName == "" && appInstances[opt.AppName] != nil {</pre></code><tr><td>35<td><code><pre> if conf, ok := appInstances[opt.AppName][config.DefaultInstanceKey]; !ok || conf == nil {</pre></code><tr class=miss><td>36<td><code><pre> panic(ErrDefaultLoggerNotFound)</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre></pre></code><tr><td>40<td><code><pre> return func() {</pre></code><tr><td>41<td><code><pre> rwlock.Lock()</pre></code><tr><td>42<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>43<td><code><pre> if appInstances != nil {</pre></code><tr><td>44<td><code><pre> for _, instance := range appInstances[opt.AppName] {</pre></code><tr><td>45<td><code><pre> instance.flush()</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre> delete(appInstances, opt.AppName)</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre></pre></code><tr><td>50<td><code><pre> // there maybe some locally logging, avoid some NPE crash as possible as we can do</pre></code><tr><td>51<td><code><pre> colorful := false</pre></code><tr><td>52<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>53<td><code><pre> if confs != nil && confs[config.DefaultInstanceKey] != nil {</pre></code><tr><td>54<td><code><pre> colorful = confs[config.DefaultInstanceKey].ConsoleOutputOption.Colorful</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre> globalLogger = defaultLogger(colorful)</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre>}</pre></code></table><div class=funcname id=fn_addInstance>func addInstance</div><div class=info><a href=#s_fn_addInstance>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/construct.go</code>:</div><table class=listing><tr><td>61<td><code><pre>func addInstance(ctx context.Context, name string, conf *Conf, opt *config.InitOption) {</pre></code><tr><td>62<td><code><pre> if !conf.EnableFileOutput && !conf.EnableConsoleOutput {</pre></code><tr class=miss><td>63<td><code><pre> panic(ErrUnknownOutput)</pre></code><tr><td>64<td><code><pre> }</pre></code><tr><td>65<td><code><pre></pre></code><tr><td>66<td><code><pre> var cores []zapcore.Core</pre></code><tr><td>67<td><code><pre> if conf.EnableConsoleOutput {</pre></code><tr><td>68<td><code><pre> cfg := getEncoderConfig(conf)</pre></code><tr><td>69<td><code><pre> if conf.ConsoleOutputOption.Colorful {</pre></code><tr class=miss><td>70<td><code><pre> cfg.EncodeLevel = zapcore.CapitalColorLevelEncoder</pre></code><tr><td>71<td><code><pre> }</pre></code><tr><td>72<td><code><pre> encoder := getEncoder(conf.ConsoleOutputOption.Layout, cfg)</pre></code><tr><td>73<td><code><pre> writer := zapcore.Lock(os.Stdout)</pre></code><tr><td>74<td><code><pre> logLevel := newZapLogLevel(opt.AppName, name, "enable_console_output", "log_level")</pre></code><tr><td>75<td><code><pre> cores = append(cores, zapcore.NewCore(encoder, writer, logLevel))</pre></code><tr><td>76<td><code><pre> }</pre></code><tr><td>77<td><code><pre> if conf.EnableFileOutput {</pre></code><tr><td>78<td><code><pre> var (</pre></code><tr><td>79<td><code><pre> ext = ".log"</pre></code><tr><td>80<td><code><pre> logName string</pre></code><tr><td>81<td><code><pre> )</pre></code><tr><td>82<td><code><pre></pre></code><tr><td>83<td><code><pre> cfg := getEncoderConfig(conf)</pre></code><tr><td>84<td><code><pre> encoder := getEncoder(conf.FileOutputOption.Layout, cfg)</pre></code><tr><td>85<td><code><pre> utils.IfAny(</pre></code><tr><td>86<td><code><pre> func() bool { logName = conf.FileOutputOption.Name; return utils.IsStrNotBlank(logName) },</pre></code><tr><td>87<td><code><pre> func() bool { logName = config.Use(opt.AppName).AppName() + ext; return utils.IsStrNotBlank(logName) },</pre></code><tr><td>88<td><code><pre> func() bool {</pre></code><tr><td>89<td><code><pre> logName = filepath.Base(env.WorkDir) + ext</pre></code><tr><td>90<td><code><pre> return logName != constant.PathSeparator+".log"</pre></code><tr><td>91<td><code><pre> },</pre></code><tr><td>92<td><code><pre> func() bool {</pre></code><tr><td>93<td><code><pre> sum := md5.Sum([]byte(env.WorkDir))</pre></code><tr><td>94<td><code><pre> logName = string(sum[:]) + ext</pre></code><tr><td>95<td><code><pre> return true</pre></code><tr><td>96<td><code><pre> },</pre></code><tr><td>97<td><code><pre> )</pre></code><tr><td>98<td><code><pre></pre></code><tr><td>99<td><code><pre> rotationSize, err := humanize.ParseBytes(conf.FileOutputOption.RotationSize)</pre></code><tr><td>100<td><code><pre> if err != nil {</pre></code><tr class=miss><td>101<td><code><pre> panic(errors.Errorf("log component parse ratation size %s failed for name %s: %s",</pre></code><tr><td>102<td><code><pre> conf.FileOutputOption.RotationSize, name, err))</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre></pre></code><tr><td>105<td><code><pre> maxAge, err := time.ParseDuration(conf.FileOutputOption.RotationMaxAge)</pre></code><tr><td>106<td><code><pre> if err != nil {</pre></code><tr class=miss><td>107<td><code><pre> panic(errors.Errorf("log component parse ratation time %s failed for name %s: %s",</pre></code><tr><td>108<td><code><pre> conf.FileOutputOption.RotationMaxAge, name, err))</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre></pre></code><tr><td>111<td><code><pre> writer := zapcore.AddSync(&rotatelog.Logger{</pre></code><tr><td>112<td><code><pre> Filename: path.Join(filepath.Clean(conf.FileOutputOption.Path), logName),</pre></code><tr><td>113<td><code><pre> MaxSize: int64(rotationSize),</pre></code><tr><td>114<td><code><pre> MaxBackups: conf.FileOutputOption.RotationCount,</pre></code><tr><td>115<td><code><pre> MaxAge: maxAge,</pre></code><tr><td>116<td><code><pre> Compress: conf.FileOutputOption.Compress,</pre></code><tr><td>117<td><code><pre> })</pre></code><tr><td>118<td><code><pre> logLevel := newZapLogLevel(opt.AppName, name, "enable_file_output", "log_level")</pre></code><tr><td>119<td><code><pre> cores = append(cores, zapcore.NewCore(encoder, writer, logLevel))</pre></code><tr><td>120<td><code><pre> }</pre></code><tr><td>121<td><code><pre></pre></code><tr><td>122<td><code><pre> zopts := []zap.Option{</pre></code><tr><td>123<td><code><pre> zap.Hooks(),</pre></code><tr><td>124<td><code><pre> zap.AddCaller(),</pre></code><tr><td>125<td><code><pre> zap.AddStacktrace(newZapLogLevel(opt.AppName, name, "enable_file_output", "stacktrace_level")),</pre></code><tr><td>126<td><code><pre> }</pre></code><tr><td>127<td><code><pre> if config.Use(opt.AppName).Debug() {</pre></code><tr><td>128<td><code><pre> zopts = append(zopts, zap.Development())</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre></pre></code><tr><td>131<td><code><pre> zapLogger := zap.</pre></code><tr><td>132<td><code><pre> New(zapcore.NewTee(cores...), zopts...).</pre></code><tr><td>133<td><code><pre> Named(config.Use(opt.AppName).AppName())</pre></code><tr><td>134<td><code><pre></pre></code><tr><td>135<td><code><pre> fusLogger := &logger{name: name, logger: zapLogger, sugaredLogger: zapLogger.Sugar()}</pre></code><tr><td>136<td><code><pre></pre></code><tr><td>137<td><code><pre> rwlock.Lock()</pre></code><tr><td>138<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>139<td><code><pre> if appInstances == nil {</pre></code><tr><td>140<td><code><pre> appInstances = make(map[string]map[string]*logger)</pre></code><tr><td>141<td><code><pre> }</pre></code><tr><td>142<td><code><pre> if appInstances[opt.AppName] == nil {</pre></code><tr><td>143<td><code><pre> appInstances[opt.AppName] = make(map[string]*logger)</pre></code><tr><td>144<td><code><pre> }</pre></code><tr><td>145<td><code><pre> if _, ok := appInstances[opt.AppName][name]; ok {</pre></code><tr class=miss><td>146<td><code><pre> panic(ErrDuplicatedName)</pre></code><tr><td>147<td><code><pre> }</pre></code><tr><td>148<td><code><pre> appInstances[opt.AppName][name] = fusLogger</pre></code><tr><td>149<td><code><pre></pre></code><tr><td>150<td><code><pre> if opt.AppName == "" && name == config.DefaultInstanceKey {</pre></code><tr><td>151<td><code><pre> globalLogger = fusLogger</pre></code><tr><td>152<td><code><pre> }</pre></code><tr><td>153<td><code><pre></pre></code><tr><td>154<td><code><pre> // ioc</pre></code><tr><td>155<td><code><pre> if opt.DI != nil {</pre></code><tr><td>156<td><code><pre> opt.DI.MustProvide(</pre></code><tr><td>157<td><code><pre> func() Loggable { return Use(name, AppName(opt.AppName)) },</pre></code><tr><td>158<td><code><pre> di.Name(name),</pre></code><tr><td>159<td><code><pre> )</pre></code><tr><td>160<td><code><pre> }</pre></code><tr><td>161<td><code><pre>}</pre></code></table><div class=funcname id=fn_getContextZapFields>func getContextZapFields</div><div class=info><a href=#s_fn_getContextZapFields>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/context.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func getContextZapFields(ctx context.Context) (zapFields []zap.Field) {</pre></code><tr><td>16<td><code><pre> v := ctx.Value(fusCtx.KeyLogFields)</pre></code><tr><td>17<td><code><pre> if v == nil {</pre></code><tr><td>18<td><code><pre> return</pre></code><tr><td>19<td><code><pre> }</pre></code><tr><td>20<td><code><pre> field, ok := v.(Fields)</pre></code><tr><td>21<td><code><pre> if !ok {</pre></code><tr class=miss><td>22<td><code><pre> return</pre></code><tr><td>23<td><code><pre> }</pre></code><tr><td>24<td><code><pre> return convertFieldsToZapFields(field)</pre></code><tr><td>25<td><code><pre>}</pre></code></table><div class=funcname id=fn_defaultLogger>func defaultLogger</div><div class=info><a href=#s_fn_defaultLogger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/logger.go</code>:</div><table class=listing><tr><td>72<td><code><pre>func defaultLogger(colorful bool) Loggable {</pre></code><tr><td>73<td><code><pre> devCfg := zap.NewDevelopmentConfig()</pre></code><tr><td>74<td><code><pre> devCfg.Level = zap.NewAtomicLevelAt(zap.InfoLevel)</pre></code><tr><td>75<td><code><pre> if colorful {</pre></code><tr class=miss><td>76<td><code><pre> devCfg.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder</pre></code><tr><td>77<td><code><pre> }</pre></code><tr><td>78<td><code><pre> devCfg.EncoderConfig.EncodeCaller = encoder.SkipCallerEncoder(encoder.SkipCallers, true)</pre></code><tr><td>79<td><code><pre> zapLogger, _ := devCfg.Build(</pre></code><tr><td>80<td><code><pre> zap.AddStacktrace(zap.PanicLevel),</pre></code><tr><td>81<td><code><pre> zap.AddCaller(),</pre></code><tr><td>82<td><code><pre> zap.Hooks(),</pre></code><tr><td>83<td><code><pre> )</pre></code><tr><td>84<td><code><pre> return &logger{</pre></code><tr><td>85<td><code><pre> logger: zapLogger,</pre></code><tr><td>86<td><code><pre> sugaredLogger: zapLogger.Sugar(),</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre>}</pre></code></table><div class=funcname id=fn_zapLogLevel.reloadConfig>func zapLogLevel.reloadConfig</div><div class=info><a href=#s_fn_zapLogLevel.reloadConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/utils.go</code>:</div><table class=listing><tr><td>93<td><code><pre>func (z *zapLogLevel) reloadConfig() {</pre></code><tr><td>94<td><code><pre> var cfgs map[string]map[string]any</pre></code><tr><td>95<td><code><pre> _ = config.Use(z.appName).LoadComponentConfig(config.ComponentLog, &cfgs)</pre></code><tr><td>96<td><code><pre> if len(cfgs) == 0 {</pre></code><tr class=miss><td>97<td><code><pre> return</pre></code><tr><td>98<td><code><pre> }</pre></code><tr><td>99<td><code><pre></pre></code><tr><td>100<td><code><pre> cfg, ok := cfgs[z.confName]</pre></code><tr><td>101<td><code><pre> if !ok {</pre></code><tr class=miss><td>102<td><code><pre> return</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre> enabled := cast.ToBool(cfg[z.enableField])</pre></code><tr><td>105<td><code><pre> z.enabled = enabled</pre></code><tr><td>106<td><code><pre></pre></code><tr><td>107<td><code><pre> logLevelObj, ok1 := cfg[z.levelField]</pre></code><tr><td>108<td><code><pre> logLevel, ok2 := logLevelObj.(string)</pre></code><tr><td>109<td><code><pre> if !ok1 || !ok2 {</pre></code><tr class=miss><td>110<td><code><pre> return</pre></code><tr><td>111<td><code><pre> }</pre></code><tr><td>112<td><code><pre> level := getLogLevel(logLevel)</pre></code><tr><td>113<td><code><pre> z.Level = level</pre></code><tr><td>114<td><code><pre>}</pre></code></table><div class=funcname id=fn_logger.Warn>func logger.Warn</div><div class=info><a href=#s_fn_logger.Warn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/logger.go</code>:</div><table class=listing><tr><td>105<td><code><pre>func (l *logger) Warn(ctx context.Context, format string, args ...any) {</pre></code><tr><td>106<td><code><pre> lg, msg, fields := l.sweeten(ctx, format, args...)</pre></code><tr><td>107<td><code><pre> if logger, ok := lg.(*logger); ok {</pre></code><tr><td>108<td><code><pre> logger.logger.Warn(msg, fields...)</pre></code><tr><td>109<td><code><pre> } else {</pre></code><tr class=miss><td>110<td><code><pre> lg.Warn(ctx, msg, args...)</pre></code><tr><td>111<td><code><pre> }</pre></code><tr><td>112<td><code><pre>}</pre></code></table><div class=funcname id=fn_logger.Info>func logger.Info</div><div class=info><a href=#s_fn_logger.Info>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/logger.go</code>:</div><table class=listing><tr><td>97<td><code><pre>func (l *logger) Info(ctx context.Context, format string, args ...any) {</pre></code><tr><td>98<td><code><pre> lg, msg, fields := l.sweeten(ctx, format, args...)</pre></code><tr><td>99<td><code><pre> if logger, ok := lg.(*logger); ok {</pre></code><tr><td>100<td><code><pre> logger.logger.Info(msg, fields...)</pre></code><tr><td>101<td><code><pre> } else {</pre></code><tr class=miss><td>102<td><code><pre> lg.Info(ctx, msg, args...)</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre>}</pre></code></table><div class=funcname id=fn_logger.Debug>func logger.Debug</div><div class=info><a href=#s_fn_logger.Debug>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/logger.go</code>:</div><table class=listing><tr><td>89<td><code><pre>func (l *logger) Debug(ctx context.Context, format string, args ...any) {</pre></code><tr><td>90<td><code><pre> lg, msg, fields := l.sweeten(ctx, format, args...)</pre></code><tr><td>91<td><code><pre> if logger, ok := lg.(*logger); ok {</pre></code><tr><td>92<td><code><pre> logger.logger.Debug(msg, fields...)</pre></code><tr><td>93<td><code><pre> } else {</pre></code><tr class=miss><td>94<td><code><pre> lg.Debug(ctx, msg, args...)</pre></code><tr><td>95<td><code><pre> }</pre></code><tr><td>96<td><code><pre>}</pre></code></table><div class=funcname id=fn_getEncoder>func getEncoder</div><div class=info><a href=#s_fn_getEncoder>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/utils.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func getEncoder(layout string, cfg zapcore.EncoderConfig) zapcore.Encoder {</pre></code><tr><td>53<td><code><pre> switch strings.ToLower(layout) {</pre></code><tr><td>54<td><code><pre> case "json":</pre></code><tr><td>55<td><code><pre> return zapcore.NewJSONEncoder(cfg)</pre></code><tr><td>56<td><code><pre> case "console":</pre></code><tr><td>57<td><code><pre> return zapcore.NewConsoleEncoder(cfg)</pre></code><tr><td>58<td><code><pre> default:</pre></code><tr class=miss><td>59<td><code><pre> return zapcore.NewJSONEncoder(cfg)</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre>}</pre></code></table><div class=funcname id=fn_@161:12>func @161:12</div><div class=info><a href=#s_fn_@161:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/logger.go</code>:</div><table class=listing><tr><td>161<td><code><pre>func(err error) bool {</pre></code><tr><td>162<td><code><pre> // ENOTTY:</pre></code><tr><td>163<td><code><pre> // ignore sync /dev/stdout: inappropriate ioctl for device errors,</pre></code><tr><td>164<td><code><pre> // which happens when redirect stderr to stdout</pre></code><tr><td>165<td><code><pre> // EINVAL:</pre></code><tr><td>166<td><code><pre> // ignore sync /dev/stdout: invalid argument</pre></code><tr><td>167<td><code><pre> for _, target := range []error{syscall.EINVAL, syscall.ENOTTY} {</pre></code><tr><td>168<td><code><pre> if errors.Is(err, target) {</pre></code><tr class=miss><td>169<td><code><pre> return true</pre></code><tr><td>170<td><code><pre> }</pre></code><tr><td>171<td><code><pre> }</pre></code><tr><td>172<td><code><pre> return false</pre></code><tr><td>173<td><code><pre> }</pre></code></table><div class=funcname id=fn_Use>func Use</div><div class=info><a href=#s_fn_Use>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/logger.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func Use(name string, opts ...utils.OptionExtender) Loggable {</pre></code><tr><td>46<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>47<td><code><pre></pre></code><tr><td>48<td><code><pre> rwlock.RLock()</pre></code><tr><td>49<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>50<td><code><pre> instances, ok := appInstances[opt.appName]</pre></code><tr><td>51<td><code><pre> if !ok {</pre></code><tr><td>52<td><code><pre> globalLogger.Debug(context.Background(), "%v [Gofusion] %s instance not found for app: %s",</pre></code><tr><td>53<td><code><pre> syscall.Getpid(), config.ComponentLog, opt.appName, Fields{"component": "log"})</pre></code><tr><td>54<td><code><pre> return globalLogger</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre> instance, ok := instances[name]</pre></code><tr><td>57<td><code><pre> if !ok {</pre></code><tr class=miss><td>58<td><code><pre> instance, ok = instances[config.DefaultInstanceKey]</pre></code><tr class=miss><td>59<td><code><pre> if ok {</pre></code><tr class=miss><td>60<td><code><pre> instance.Debug(context.Background(), "%v [Gofusion] %s instance not found for name: %s",</pre></code><tr><td>61<td><code><pre> syscall.Getpid(), config.ComponentLog, name, Fields{"component": "log"})</pre></code><tr class=miss><td>62<td><code><pre> return instance</pre></code><tr><td>63<td><code><pre> }</pre></code><tr class=miss><td>64<td><code><pre> globalLogger.Debug(context.Background(), "%v [Gofusion] %s instance not found for name: %s",</pre></code><tr><td>65<td><code><pre> syscall.Getpid(), config.ComponentLog, name, Fields{"component": "log"})</pre></code><tr class=miss><td>66<td><code><pre> return globalLogger</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre></pre></code><tr><td>69<td><code><pre> return instance</pre></code><tr><td>70<td><code><pre>}</pre></code></table><div class=funcname id=fn_getLogLevel>func getLogLevel</div><div class=info><a href=#s_fn_getLogLevel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/utils.go</code>:</div><table class=listing><tr><td>14<td><code><pre>func getLogLevel(level string) zapcore.Level {</pre></code><tr><td>15<td><code><pre> switch strings.ToLower(level) {</pre></code><tr><td>16<td><code><pre> case "debug":</pre></code><tr><td>17<td><code><pre> return zap.DebugLevel</pre></code><tr><td>18<td><code><pre> case "info":</pre></code><tr><td>19<td><code><pre> return zap.InfoLevel</pre></code><tr><td>20<td><code><pre> case "warn":</pre></code><tr class=miss><td>21<td><code><pre> return zap.WarnLevel</pre></code><tr><td>22<td><code><pre> case "error":</pre></code><tr><td>23<td><code><pre> return zap.ErrorLevel</pre></code><tr><td>24<td><code><pre> case "panic":</pre></code><tr><td>25<td><code><pre> return zap.PanicLevel</pre></code><tr><td>26<td><code><pre> case "fatal":</pre></code><tr class=miss><td>27<td><code><pre> return zap.FatalLevel</pre></code><tr><td>28<td><code><pre> default:</pre></code><tr class=miss><td>29<td><code><pre> return zap.InfoLevel</pre></code><tr><td>30<td><code><pre> }</pre></code><tr><td>31<td><code><pre>}</pre></code></table><div class=funcname id=fn_logger.Level>func logger.Level</div><div class=info><a href=#s_fn_logger.Level>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/logger.go</code>:</div><table class=listing><tr><td>137<td><code><pre>func (l *logger) Level(ctx context.Context) Level {</pre></code><tr><td>138<td><code><pre> ctxLogger := GetCtxLogger(ctx, l)</pre></code><tr><td>139<td><code><pre> lg, ok := ctxLogger.(*logger)</pre></code><tr><td>140<td><code><pre> if !ok {</pre></code><tr class=miss><td>141<td><code><pre> return InvalidLevel</pre></code><tr><td>142<td><code><pre> }</pre></code><tr><td>143<td><code><pre> switch lg.logger.Level() {</pre></code><tr><td>144<td><code><pre> case zap.DebugLevel:</pre></code><tr><td>145<td><code><pre> return DebugLevel</pre></code><tr><td>146<td><code><pre> case zap.InfoLevel:</pre></code><tr class=miss><td>147<td><code><pre> return InfoLevel</pre></code><tr><td>148<td><code><pre> case zap.WarnLevel:</pre></code><tr class=miss><td>149<td><code><pre> return WarnLevel</pre></code><tr><td>150<td><code><pre> case zap.ErrorLevel:</pre></code><tr class=miss><td>151<td><code><pre> return ErrorLevel</pre></code><tr><td>152<td><code><pre> case zap.PanicLevel:</pre></code><tr class=miss><td>153<td><code><pre> return PanicLevel</pre></code><tr><td>154<td><code><pre> case zap.FatalLevel:</pre></code><tr class=miss><td>155<td><code><pre> return FatalLevel</pre></code><tr><td>156<td><code><pre> default:</pre></code><tr class=miss><td>157<td><code><pre> return InfoLevel</pre></code><tr><td>158<td><code><pre> }</pre></code><tr><td>159<td><code><pre>}</pre></code></table><div class=funcname id=fn_DelCtxFields>func DelCtxFields</div><div class=info><a href=#s_fn_DelCtxFields>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/context.go</code>:</div><table class=listing><tr><td>55<td><code><pre>func DelCtxFields(ctx context.Context, keys ...string) context.Context {</pre></code><tr class=miss><td>56<td><code><pre> fs := GetCtxFields(ctx)</pre></code><tr class=miss><td>57<td><code><pre> if len(fs) == 0 {</pre></code><tr class=miss><td>58<td><code><pre> return ctx</pre></code><tr><td>59<td><code><pre> }</pre></code><tr class=miss><td>60<td><code><pre> keySet := utils.NewSet(keys...)</pre></code><tr class=miss><td>61<td><code><pre> deleted := make(Fields, len(fs))</pre></code><tr class=miss><td>62<td><code><pre> for k, v := range fs {</pre></code><tr class=miss><td>63<td><code><pre> if !keySet.Contains(k) {</pre></code><tr class=miss><td>64<td><code><pre> deleted[k] = v</pre></code><tr><td>65<td><code><pre> }</pre></code><tr><td>66<td><code><pre> }</pre></code><tr class=miss><td>67<td><code><pre> return SetCtxFields(ctx, deleted)</pre></code><tr><td>68<td><code><pre>}</pre></code></table><div class=funcname id=fn_@19:8>func @19:8</div><div class=info><a href=#s_fn_@19:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/candy.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func() {</pre></code><tr class=miss><td>20<td><code><pre> elapsed := time.Since(now).Milliseconds()</pre></code><tr class=miss><td>21<td><code><pre> if r := recover(); r != nil {</pre></code><tr class=miss><td>22<td><code><pre> panic(r)</pre></code><tr><td>23<td><code><pre> }</pre></code><tr class=miss><td>24<td><code><pre> if logger != nil {</pre></code><tr class=miss><td>25<td><code><pre> logger.Info(ctx, format, append(args, zap.Any("latency", elapsed))...)</pre></code><tr><td>26<td><code><pre> } else {</pre></code><tr class=miss><td>27<td><code><pre> Info(ctx, format, append(args, zap.Any("latency", elapsed))...)</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre> }</pre></code></table><div class=funcname id=fn_logger.Panic>func logger.Panic</div><div class=info><a href=#s_fn_logger.Panic>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/logger.go</code>:</div><table class=listing><tr><td>121<td><code><pre>func (l *logger) Panic(ctx context.Context, format string, args ...any) {</pre></code><tr class=miss><td>122<td><code><pre> lg, msg, fields := l.sweeten(ctx, format, args...)</pre></code><tr class=miss><td>123<td><code><pre> if logger, ok := lg.(*logger); ok {</pre></code><tr class=miss><td>124<td><code><pre> logger.logger.Panic(msg, fields...)</pre></code><tr><td>125<td><code><pre> } else {</pre></code><tr class=miss><td>126<td><code><pre> lg.Panic(ctx, msg, args...)</pre></code><tr><td>127<td><code><pre> }</pre></code><tr><td>128<td><code><pre>}</pre></code></table><div class=funcname id=fn_logger.Error>func logger.Error</div><div class=info><a href=#s_fn_logger.Error>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/logger.go</code>:</div><table class=listing><tr><td>113<td><code><pre>func (l *logger) Error(ctx context.Context, format string, args ...any) {</pre></code><tr class=miss><td>114<td><code><pre> lg, msg, fields := l.sweeten(ctx, format, args...)</pre></code><tr class=miss><td>115<td><code><pre> if logger, ok := lg.(*logger); ok {</pre></code><tr class=miss><td>116<td><code><pre> logger.logger.Error(msg, fields...)</pre></code><tr><td>117<td><code><pre> } else {</pre></code><tr class=miss><td>118<td><code><pre> lg.Error(ctx, msg, args...)</pre></code><tr><td>119<td><code><pre> }</pre></code><tr><td>120<td><code><pre>}</pre></code></table><div class=funcname id=fn_logger.Fatal>func logger.Fatal</div><div class=info><a href=#s_fn_logger.Fatal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/logger.go</code>:</div><table class=listing><tr><td>129<td><code><pre>func (l *logger) Fatal(ctx context.Context, format string, args ...any) {</pre></code><tr class=miss><td>130<td><code><pre> lg, msg, fields := l.sweeten(ctx, format, args...)</pre></code><tr class=miss><td>131<td><code><pre> if logger, ok := lg.(*logger); ok {</pre></code><tr class=miss><td>132<td><code><pre> logger.logger.Fatal(msg, fields...)</pre></code><tr><td>133<td><code><pre> } else {</pre></code><tr class=miss><td>134<td><code><pre> lg.Fatal(ctx, msg, args...)</pre></code><tr><td>135<td><code><pre> }</pre></code><tr><td>136<td><code><pre>}</pre></code></table><div class=funcname id=fn_@92:4>func @92:4</div><div class=info><a href=#s_fn_@92:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/construct.go</code>:</div><table class=listing><tr><td>92<td><code><pre>func() bool {</pre></code><tr class=miss><td>93<td><code><pre> sum := md5.Sum([]byte(env.WorkDir))</pre></code><tr class=miss><td>94<td><code><pre> logName = string(sum[:]) + ext</pre></code><tr class=miss><td>95<td><code><pre> return true</pre></code><tr><td>96<td><code><pre> }</pre></code></table><div class=funcname id=fn_TimeElapsed>func TimeElapsed</div><div class=info><a href=#s_fn_TimeElapsed>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/candy.go</code>:</div><table class=listing><tr><td>17<td><code><pre>func TimeElapsed(ctx context.Context, logger Loggable, fn func(), format string, args ...any) {</pre></code><tr class=miss><td>18<td><code><pre> now := time.Now()</pre></code><tr class=miss><td>19<td><code><pre> defer func() {</pre></code><tr><td>20<td><code><pre> elapsed := time.Since(now).Milliseconds()</pre></code><tr><td>21<td><code><pre> if r := recover(); r != nil {</pre></code><tr><td>22<td><code><pre> panic(r)</pre></code><tr><td>23<td><code><pre> }</pre></code><tr><td>24<td><code><pre> if logger != nil {</pre></code><tr><td>25<td><code><pre> logger.Info(ctx, format, append(args, zap.Any("latency", elapsed))...)</pre></code><tr><td>26<td><code><pre> } else {</pre></code><tr><td>27<td><code><pre> Info(ctx, format, append(args, zap.Any("latency", elapsed))...)</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre> }()</pre></code><tr><td>30<td><code><pre></pre></code><tr class=miss><td>31<td><code><pre> fn()</pre></code><tr><td>32<td><code><pre>}</pre></code></table><div class=funcname id=fn_@88:4>func @88:4</div><div class=info><a href=#s_fn_@88:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/construct.go</code>:</div><table class=listing><tr><td>88<td><code><pre>func() bool {</pre></code><tr class=miss><td>89<td><code><pre> logName = filepath.Base(env.WorkDir) + ext</pre></code><tr class=miss><td>90<td><code><pre> return logName != constant.PathSeparator+".log"</pre></code><tr><td>91<td><code><pre> }</pre></code></table><div class=funcname id=fn_AddCtxFields>func AddCtxFields</div><div class=info><a href=#s_fn_AddCtxFields>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/context.go</code>:</div><table class=listing><tr><td>51<td><code><pre>func AddCtxFields(ctx context.Context, fields Fields) context.Context {</pre></code><tr class=miss><td>52<td><code><pre> return SetCtxFields(ctx, utils.MapMerge(GetCtxFields(ctx), fields))</pre></code><tr><td>53<td><code><pre>}</pre></code></table><div class=funcname id=fn_@157:4>func @157:4</div><div class=info><a href=#s_fn_@157:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/construct.go</code>:</div><table class=listing><tr class=miss><td>157<td><code><pre>func() Loggable { return Use(name, AppName(opt.AppName)) }</pre></code></table><div class=funcname id=fn_Debug>func Debug</div><div class=info><a href=#s_fn_Debug>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/candy.go</code>:</div><table class=listing><tr class=miss><td>10<td><code><pre>func Debug(ctx context.Context, format string, args ...any) { globalLogger.Debug(ctx, format, args...) }</pre></code></table><div class=funcname id=fn_SetCtxLogger>func SetCtxLogger</div><div class=info><a href=#s_fn_SetCtxLogger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/context.go</code>:</div><table class=listing><tr><td>39<td><code><pre>func SetCtxLogger(ctx context.Context, val Loggable) context.Context {</pre></code><tr class=miss><td>40<td><code><pre> return utils.SetCtxAny(ctx, fusCtx.KeyLoggable, val)</pre></code><tr><td>41<td><code><pre>}</pre></code></table><div class=funcname id=fn_GetCtxFields>func GetCtxFields</div><div class=info><a href=#s_fn_GetCtxFields>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/context.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func GetCtxFields(ctx context.Context) Fields {</pre></code><tr class=miss><td>44<td><code><pre> return utils.GetCtxAny(ctx, fusCtx.KeyLogFields, (Fields)(nil))</pre></code><tr><td>45<td><code><pre>}</pre></code></table><div class=funcname id=fn_Panic>func Panic</div><div class=info><a href=#s_fn_Panic>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/candy.go</code>:</div><table class=listing><tr class=miss><td>14<td><code><pre>func Panic(ctx context.Context, format string, args ...any) { globalLogger.Panic(ctx, format, args...) }</pre></code></table><div class=funcname id=fn_Error>func Error</div><div class=info><a href=#s_fn_Error>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/candy.go</code>:</div><table class=listing><tr class=miss><td>13<td><code><pre>func Error(ctx context.Context, format string, args ...any) { globalLogger.Error(ctx, format, args...) }</pre></code></table><div class=funcname id=fn_Warn>func Warn</div><div class=info><a href=#s_fn_Warn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/candy.go</code>:</div><table class=listing><tr class=miss><td>12<td><code><pre>func Warn(ctx context.Context, format string, args ...any) { globalLogger.Warn(ctx, format, args...) }</pre></code></table><div class=funcname id=fn_Fatal>func Fatal</div><div class=info><a href=#s_fn_Fatal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/candy.go</code>:</div><table class=listing><tr class=miss><td>15<td><code><pre>func Fatal(ctx context.Context, format string, args ...any) { globalLogger.Fatal(ctx, format, args...) }</pre></code></table><div id=pkg_github.com/wfusion/gofusion/log/customlogger class=funcname>Package Overview: github.com/wfusion/gofusion/log/customlogger 37 <span class=packageTotal>59.2%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_gormLogger.Init><td><code><a href=#fn_gormLogger.Init>gormLogger.Init(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/gorm.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_mongoLogger.Init><td><code><a href=#fn_mongoLogger.Init>mongoLogger.Init(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_asyncLogger.Init><td><code><a href=#fn_asyncLogger.Init>asyncLogger.Init(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/async.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_cronLogger.Init><td><code><a href=#fn_cronLogger.Init>cronLogger.Init(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/cron.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_metricsLogger.Init><td><code><a href=#fn_metricsLogger.Init>metricsLogger.Init(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_mqLogger.Debug><td><code><a href=#fn_mqLogger.Debug>mqLogger.Debug(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_cronLogger.isLoggable><td><code><a href=#fn_cronLogger.isLoggable>cronLogger.isLoggable(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/cron.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_mqLogger.Info><td><code><a href=#fn_mqLogger.Info>mqLogger.Info(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_metricsLogger.Info><td><code><a href=#fn_metricsLogger.Info>metricsLogger.Info(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_redisLogger.Init><td><code><a href=#fn_redisLogger.Init>redisLogger.Init(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_mqLogger.isLoggable><td><code><a href=#fn_mqLogger.isLoggable>mqLogger.isLoggable(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_metricsLogger.Warn><td><code><a href=#fn_metricsLogger.Warn>metricsLogger.Warn(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_mqLogger.Init><td><code><a href=#fn_mqLogger.Init>mqLogger.Init(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_routineLogger.reloadConfig><td><code><a href=#fn_routineLogger.reloadConfig>routineLogger.reloadConfig(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/routine.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_mqLogger.logger><td><code><a href=#fn_mqLogger.logger>mqLogger.logger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_httpLogger.reloadConfig><td><code><a href=#fn_httpLogger.reloadConfig>httpLogger.reloadConfig(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/http.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_mongoLogger.succeeded><td><code><a href=#fn_mongoLogger.succeeded>mongoLogger.succeeded(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_mongoLogger.pushCommandString><td><code><a href=#fn_mongoLogger.pushCommandString>mongoLogger.pushCommandString(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_routineLogger.Init><td><code><a href=#fn_routineLogger.Init>routineLogger.Init(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/routine.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_cronLogger.logger><td><code><a href=#fn_cronLogger.logger>cronLogger.logger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/cron.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_mongoLogger.started><td><code><a href=#fn_mongoLogger.started>mongoLogger.started(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_httpLogger.Init><td><code><a href=#fn_httpLogger.Init>httpLogger.Init(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/http.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_gormLogger.Info><td><code><a href=#fn_gormLogger.Info>gormLogger.Info(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/gorm.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_mongoLogger.fields><td><code><a href=#fn_mongoLogger.fields>mongoLogger.fields(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_redisLogger.ProcessPipelineHook><td><code><a href=#fn_redisLogger.ProcessPipelineHook>redisLogger.ProcessPipelineHook(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_mqLogger.With><td><code><a href=#fn_mqLogger.With>mqLogger.With(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_mongoLogger.GetMonitor><td><code><a href=#fn_mongoLogger.GetMonitor>mongoLogger.GetMonitor(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_DefaultCronLogger><td><code><a href=#fn_DefaultCronLogger>DefaultCronLogger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/cron.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_gormLogger.format><td><code><a href=#fn_gormLogger.format>gormLogger.format(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/gorm.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_gormLogger.fields><td><code><a href=#fn_gormLogger.fields>gormLogger.fields(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/gorm.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_redisLogger.DialHook><td><code><a href=#fn_redisLogger.DialHook>redisLogger.DialHook(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@41:9><td><code><a href=#fn_@41:9>@41:9(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_redisLogger.ProcessHook><td><code><a href=#fn_redisLogger.ProcessHook>redisLogger.ProcessHook(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_redisLogger.fields><td><code><a href=#fn_redisLogger.fields>redisLogger.fields(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_mongoLogger.popCommandString><td><code><a href=#fn_mongoLogger.popCommandString>mongoLogger.popCommandString(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mongo.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_redisLogger.reloadConfig><td><code><a href=#fn_redisLogger.reloadConfig>redisLogger.reloadConfig(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/redis.go</code><td class=percent><code>80.0%</code><td class=linecount><code>12/15</code><tr id=s_fn_mqLogger.parseLogFields><td><code><a href=#fn_mqLogger.parseLogFields>mqLogger.parseLogFields(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mq.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_mongoLogger.isLoggableCommandName><td><code><a href=#fn_mongoLogger.isLoggableCommandName>mongoLogger.isLoggableCommandName(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mongo.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_gormLogger.reloadConfig><td><code><a href=#fn_gormLogger.reloadConfig>gormLogger.reloadConfig(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/gorm.go</code><td class=percent><code>78.6%</code><td class=linecount><code>11/14</code><tr id=s_fn_metricsLogger.reloadConfig><td><code><a href=#fn_metricsLogger.reloadConfig>metricsLogger.reloadConfig(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/metrics.go</code><td class=percent><code>77.8%</code><td class=linecount><code>7/9</code><tr id=s_fn_cronLogger.reloadConfig><td><code><a href=#fn_cronLogger.reloadConfig>cronLogger.reloadConfig(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/cron.go</code><td class=percent><code>77.8%</code><td class=linecount><code>7/9</code><tr id=s_fn_asyncLogger.reloadConfig><td><code><a href=#fn_asyncLogger.reloadConfig>asyncLogger.reloadConfig(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/async.go</code><td class=percent><code>77.8%</code><td class=linecount><code>7/9</code><tr id=s_fn_mqLogger.reloadConfig><td><code><a href=#fn_mqLogger.reloadConfig>mqLogger.reloadConfig(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mq.go</code><td class=percent><code>77.8%</code><td class=linecount><code>7/9</code><tr id=s_fn_mongoLogger.reloadConfig><td><code><a href=#fn_mongoLogger.reloadConfig>mongoLogger.reloadConfig(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mongo.go</code><td class=percent><code>75.0%</code><td class=linecount><code>12/16</code><tr id=s_fn_redisLogger.isLoggableCommandSet><td><code><a href=#fn_redisLogger.isLoggableCommandSet>redisLogger.isLoggableCommandSet(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/redis.go</code><td class=percent><code>75.0%</code><td class=linecount><code>6/8</code><tr id=s_fn_@45:9><td><code><a href=#fn_@45:9>@45:9(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/redis.go</code><td class=percent><code>75.0%</code><td class=linecount><code>6/8</code><tr id=s_fn_cronLogger.Debug><td><code><a href=#fn_cronLogger.Debug>cronLogger.Debug(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/cron.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_asyncLogger.isLoggable><td><code><a href=#fn_asyncLogger.isLoggable>asyncLogger.isLoggable(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/async.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_cronLogger.Info><td><code><a href=#fn_cronLogger.Info>cronLogger.Info(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/cron.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_cronLogger.Warn><td><code><a href=#fn_cronLogger.Warn>cronLogger.Warn(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/cron.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_asyncLogger.Info><td><code><a href=#fn_asyncLogger.Info>asyncLogger.Info(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/async.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_mqLogger.Trace><td><code><a href=#fn_mqLogger.Trace>mqLogger.Trace(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mq.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_gormLogger.isLoggable><td><code><a href=#fn_gormLogger.isLoggable>gormLogger.isLoggable(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/gorm.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_metricsLogger.Debug><td><code><a href=#fn_metricsLogger.Debug>metricsLogger.Debug(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/metrics.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_metricsLogger.isLoggable><td><code><a href=#fn_metricsLogger.isLoggable>metricsLogger.isLoggable(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/metrics.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_redisLogger.isLoggable><td><code><a href=#fn_redisLogger.isLoggable>redisLogger.isLoggable(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/redis.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_mongoLogger.logger><td><code><a href=#fn_mongoLogger.logger>mongoLogger.logger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mongo.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_metricsLogger.logger><td><code><a href=#fn_metricsLogger.logger>metricsLogger.logger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/metrics.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_mongoLogger.failed><td><code><a href=#fn_mongoLogger.failed>mongoLogger.failed(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mongo.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_cronLogger.Printf><td><code><a href=#fn_cronLogger.Printf>cronLogger.Printf(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/cron.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_redisLogger.logger><td><code><a href=#fn_redisLogger.logger>redisLogger.logger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/redis.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_gormLogger.logger><td><code><a href=#fn_gormLogger.logger>gormLogger.logger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/gorm.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_asyncLogger.logger><td><code><a href=#fn_asyncLogger.logger>asyncLogger.logger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/async.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_cronLogger.parseArgs><td><code><a href=#fn_cronLogger.parseArgs>cronLogger.parseArgs(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/cron.go</code><td class=percent><code>63.6%</code><td class=linecount><code>14/22</code><tr id=s_fn_asyncLogger.parseArgs><td><code><a href=#fn_asyncLogger.parseArgs>asyncLogger.parseArgs(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/async.go</code><td class=percent><code>63.6%</code><td class=linecount><code>14/22</code><tr id=s_fn_metricsLogger.parseArgs><td><code><a href=#fn_metricsLogger.parseArgs>metricsLogger.parseArgs(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/metrics.go</code><td class=percent><code>54.5%</code><td class=linecount><code>12/22</code><tr id=s_fn_gormLogger.Trace><td><code><a href=#fn_gormLogger.Trace>gormLogger.Trace(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/gorm.go</code><td class=percent><code>47.6%</code><td class=linecount><code>10/21</code><tr id=s_fn_gormLogger.getLogLevel><td><code><a href=#fn_gormLogger.getLogLevel>gormLogger.getLogLevel(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/gorm.go</code><td class=percent><code>33.3%</code><td class=linecount><code>2/6</code><tr id=s_fn_httpLogger.Debugf><td><code><a href=#fn_httpLogger.Debugf>httpLogger.Debugf(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/http.go</code><td class=percent><code>33.3%</code><td class=linecount><code>1/3</code><tr id=s_fn_httpLogger.Errorf><td><code><a href=#fn_httpLogger.Errorf>httpLogger.Errorf(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/http.go</code><td class=percent><code>33.3%</code><td class=linecount><code>1/3</code><tr id=s_fn_@64:9><td><code><a href=#fn_@64:9>@64:9(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/redis.go</code><td class=percent><code>18.2%</code><td class=linecount><code>2/11</code><tr id=s_fn_httpLogger.parseArgs><td><code><a href=#fn_httpLogger.parseArgs>httpLogger.parseArgs(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/http.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/14</code><tr id=s_fn_routineLogger.parseArgs><td><code><a href=#fn_routineLogger.parseArgs>routineLogger.parseArgs(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/routine.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/14</code><tr id=s_fn_mqLogger.Error><td><code><a href=#fn_mqLogger.Error>mqLogger.Error(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_asyncLogger.Debug><td><code><a href=#fn_asyncLogger.Debug>asyncLogger.Debug(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/async.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_asyncLogger.Warn><td><code><a href=#fn_asyncLogger.Warn>asyncLogger.Warn(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/async.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_cronLogger.Error><td><code><a href=#fn_cronLogger.Error>cronLogger.Error(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/cron.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_asyncLogger.Error><td><code><a href=#fn_asyncLogger.Error>asyncLogger.Error(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/async.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_metricsLogger.Fatal><td><code><a href=#fn_metricsLogger.Fatal>metricsLogger.Fatal(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/metrics.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_cronLogger.Fatal><td><code><a href=#fn_cronLogger.Fatal>cronLogger.Fatal(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/cron.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_asyncLogger.Fatal><td><code><a href=#fn_asyncLogger.Fatal>asyncLogger.Fatal(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/async.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_metricsLogger.Error><td><code><a href=#fn_metricsLogger.Error>metricsLogger.Error(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/metrics.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_httpLogger.Warnf><td><code><a href=#fn_httpLogger.Warnf>httpLogger.Warnf(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/http.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_metricsLogger.Printf><td><code><a href=#fn_metricsLogger.Printf>metricsLogger.Printf(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/metrics.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_DefaultMongoLogger><td><code><a href=#fn_DefaultMongoLogger>DefaultMongoLogger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mongo.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_httpLogger.logger><td><code><a href=#fn_httpLogger.logger>httpLogger.logger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/http.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_routineLogger.Printf><td><code><a href=#fn_routineLogger.Printf>routineLogger.Printf(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/routine.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_asyncLogger.Printf><td><code><a href=#fn_asyncLogger.Printf>asyncLogger.Printf(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/async.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_routineLogger.logger><td><code><a href=#fn_routineLogger.logger>routineLogger.logger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/routine.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_gormLogger.Error><td><code><a href=#fn_gormLogger.Error>gormLogger.Error(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/gorm.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_gormLogger.LogMode><td><code><a href=#fn_gormLogger.LogMode>gormLogger.LogMode(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/gorm.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_gormLogger.Warn><td><code><a href=#fn_gormLogger.Warn>gormLogger.Warn(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/gorm.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_DefaultHttpLogger><td><code><a href=#fn_DefaultHttpLogger>DefaultHttpLogger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/http.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_DefaultRoutineLogger><td><code><a href=#fn_DefaultRoutineLogger>DefaultRoutineLogger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/routine.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_DefaultAsyncLogger><td><code><a href=#fn_DefaultAsyncLogger>DefaultAsyncLogger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/async.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_DefaultAsynqAsyncLogger><td><code><a href=#fn_DefaultAsynqAsyncLogger>DefaultAsynqAsyncLogger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/async.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_DefaultMySQLLogger><td><code><a href=#fn_DefaultMySQLLogger>DefaultMySQLLogger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/gorm.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_NewLogger><td><code><a href=#fn_NewLogger>NewLogger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/mq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_DefaultAsynqCronLogger><td><code><a href=#fn_DefaultAsynqCronLogger>DefaultAsynqCronLogger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/cron.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_DefaultMetricsLogger><td><code><a href=#fn_DefaultMetricsLogger>DefaultMetricsLogger(...)</a></code><td><code>github.com/wfusion/gofusion/log/customlogger/metrics.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_gormLogger.Init>func gormLogger.Init</div><div class=info><a href=#s_fn_gormLogger.Init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/gorm.go</code>:</div><table class=listing><tr><td>112<td><code><pre>func (g *gormLogger) Init(log log.Loggable, appName, name string) {</pre></code><tr><td>113<td><code><pre> g.log = log</pre></code><tr><td>114<td><code><pre> g.appName = appName</pre></code><tr><td>115<td><code><pre> g.confName = name</pre></code><tr><td>116<td><code><pre> g.ignoreRecordNotFoundError = true</pre></code><tr><td>117<td><code><pre> g.reloadConfig()</pre></code><tr><td>118<td><code><pre>}</pre></code></table><div class=funcname id=fn_mongoLogger.Init>func mongoLogger.Init</div><div class=info><a href=#s_fn_mongoLogger.Init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mongo.go</code>:</div><table class=listing><tr><td>75<td><code><pre>func (m *mongoLogger) Init(log log.Loggable, appName, name string) {</pre></code><tr><td>76<td><code><pre> m.log = log</pre></code><tr><td>77<td><code><pre> m.appName = appName</pre></code><tr><td>78<td><code><pre> m.confName = name</pre></code><tr><td>79<td><code><pre> m.requestMap = make(map[int64]struct{ commandString string })</pre></code><tr><td>80<td><code><pre> m.loggableCommandSet = utils.NewSet[string](</pre></code><tr><td>81<td><code><pre> "ping",</pre></code><tr><td>82<td><code><pre> "insert",</pre></code><tr><td>83<td><code><pre> "find",</pre></code><tr><td>84<td><code><pre> "update",</pre></code><tr><td>85<td><code><pre> "delete",</pre></code><tr><td>86<td><code><pre> "aggregate",</pre></code><tr><td>87<td><code><pre> "distinct",</pre></code><tr><td>88<td><code><pre> "count",</pre></code><tr><td>89<td><code><pre> "findAndModify",</pre></code><tr><td>90<td><code><pre> "getMore",</pre></code><tr><td>91<td><code><pre> "killCursors",</pre></code><tr><td>92<td><code><pre> "create",</pre></code><tr><td>93<td><code><pre> "drop",</pre></code><tr><td>94<td><code><pre> "listDatabases",</pre></code><tr><td>95<td><code><pre> "dropDatabase",</pre></code><tr><td>96<td><code><pre> "createIndexes",</pre></code><tr><td>97<td><code><pre> "listIndexes",</pre></code><tr><td>98<td><code><pre> "dropIndexes",</pre></code><tr><td>99<td><code><pre> "listCollections",</pre></code><tr><td>100<td><code><pre> )</pre></code><tr><td>101<td><code><pre>}</pre></code></table><div class=funcname id=fn_asyncLogger.Init>func asyncLogger.Init</div><div class=info><a href=#s_fn_asyncLogger.Init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/async.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func (a *asyncLogger) Init(log log.Loggable, appName, confName string) {</pre></code><tr><td>37<td><code><pre> a.log = log</pre></code><tr><td>38<td><code><pre> a.appName = appName</pre></code><tr><td>39<td><code><pre> a.confName = confName</pre></code><tr><td>40<td><code><pre> a.reloadConfig()</pre></code><tr><td>41<td><code><pre>}</pre></code></table><div class=funcname id=fn_cronLogger.Init>func cronLogger.Init</div><div class=info><a href=#s_fn_cronLogger.Init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/cron.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func (c *cronLogger) Init(log log.Loggable, appName, name string) {</pre></code><tr><td>37<td><code><pre> c.log = log</pre></code><tr><td>38<td><code><pre> c.appName = appName</pre></code><tr><td>39<td><code><pre> c.confName = name</pre></code><tr><td>40<td><code><pre> c.reloadConfig()</pre></code><tr><td>41<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricsLogger.Init>func metricsLogger.Init</div><div class=info><a href=#s_fn_metricsLogger.Init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/metrics.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func (m *metricsLogger) Init(log log.Loggable, appName, name string) {</pre></code><tr><td>33<td><code><pre> m.log = log</pre></code><tr><td>34<td><code><pre> m.appName = appName</pre></code><tr><td>35<td><code><pre> m.confName = name</pre></code><tr><td>36<td><code><pre> m.reloadConfig()</pre></code><tr><td>37<td><code><pre>}</pre></code></table><div class=funcname id=fn_mqLogger.Debug>func mqLogger.Debug</div><div class=info><a href=#s_fn_mqLogger.Debug>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mq.go</code>:</div><table class=listing><tr><td>66<td><code><pre>func (m *mqLogger) Debug(msg string, fields watermill.LogFields) {</pre></code><tr><td>67<td><code><pre> if !m.isLoggable() {</pre></code><tr><td>68<td><code><pre> return</pre></code><tr><td>69<td><code><pre> }</pre></code><tr><td>70<td><code><pre> ctx, fs := m.parseLogFields(fields)</pre></code><tr><td>71<td><code><pre> m.logger().Debug(ctx, msg, fs)</pre></code><tr><td>72<td><code><pre>}</pre></code></table><div class=funcname id=fn_cronLogger.isLoggable>func cronLogger.isLoggable</div><div class=info><a href=#s_fn_cronLogger.isLoggable>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/cron.go</code>:</div><table class=listing><tr><td>140<td><code><pre>func (c *cronLogger) isLoggable() bool {</pre></code><tr><td>141<td><code><pre> if c.confName == "" {</pre></code><tr><td>142<td><code><pre> return true</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre> c.reloadConfig()</pre></code><tr><td>145<td><code><pre> return c.enabled</pre></code><tr><td>146<td><code><pre>}</pre></code></table><div class=funcname id=fn_mqLogger.Info>func mqLogger.Info</div><div class=info><a href=#s_fn_mqLogger.Info>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mq.go</code>:</div><table class=listing><tr><td>57<td><code><pre>func (m *mqLogger) Info(msg string, fields watermill.LogFields) {</pre></code><tr><td>58<td><code><pre> if !m.isLoggable() {</pre></code><tr><td>59<td><code><pre> return</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre> ctx, fs := m.parseLogFields(fields)</pre></code><tr><td>62<td><code><pre> m.logger().Info(ctx, msg, fs)</pre></code><tr><td>63<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricsLogger.Info>func metricsLogger.Info</div><div class=info><a href=#s_fn_metricsLogger.Info>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/metrics.go</code>:</div><table class=listing><tr><td>56<td><code><pre>func (m *metricsLogger) Info(args ...any) {</pre></code><tr><td>57<td><code><pre> if !m.isLoggable() {</pre></code><tr><td>58<td><code><pre> return</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre> ctx, format, args := m.parseArgs(args...)</pre></code><tr><td>61<td><code><pre> m.logger().Info(ctx, format, args...)</pre></code><tr><td>62<td><code><pre>}</pre></code></table><div class=funcname id=fn_redisLogger.Init>func redisLogger.Init</div><div class=info><a href=#s_fn_redisLogger.Init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/redis.go</code>:</div><table class=listing><tr><td>33<td><code><pre>func (r *redisLogger) Init(log log.Loggable, appName, name string) {</pre></code><tr><td>34<td><code><pre> r.log = log</pre></code><tr><td>35<td><code><pre> r.appName = appName</pre></code><tr><td>36<td><code><pre> r.confName = name</pre></code><tr><td>37<td><code><pre> r.reloadConfig()</pre></code><tr><td>38<td><code><pre>}</pre></code></table><div class=funcname id=fn_mqLogger.isLoggable>func mqLogger.isLoggable</div><div class=info><a href=#s_fn_mqLogger.isLoggable>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mq.go</code>:</div><table class=listing><tr><td>111<td><code><pre>func (m *mqLogger) isLoggable() bool {</pre></code><tr><td>112<td><code><pre> if m.confName == "" {</pre></code><tr><td>113<td><code><pre> return true</pre></code><tr><td>114<td><code><pre> }</pre></code><tr><td>115<td><code><pre></pre></code><tr><td>116<td><code><pre> m.reloadConfig()</pre></code><tr><td>117<td><code><pre> return m.enabled</pre></code><tr><td>118<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricsLogger.Warn>func metricsLogger.Warn</div><div class=info><a href=#s_fn_metricsLogger.Warn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/metrics.go</code>:</div><table class=listing><tr><td>65<td><code><pre>func (m *metricsLogger) Warn(args ...any) {</pre></code><tr><td>66<td><code><pre> if !m.isLoggable() {</pre></code><tr><td>67<td><code><pre> return</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre> ctx, format, args := m.parseArgs(args...)</pre></code><tr><td>70<td><code><pre> m.logger().Warn(ctx, format, args...)</pre></code><tr><td>71<td><code><pre>}</pre></code></table><div class=funcname id=fn_mqLogger.Init>func mqLogger.Init</div><div class=info><a href=#s_fn_mqLogger.Init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mq.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func (m *mqLogger) Init(log log.Loggable, appName, name string) {</pre></code><tr><td>37<td><code><pre> m.log = log</pre></code><tr><td>38<td><code><pre> m.appName = appName</pre></code><tr><td>39<td><code><pre> m.confName = name</pre></code><tr><td>40<td><code><pre> m.reloadConfig()</pre></code><tr><td>41<td><code><pre>}</pre></code></table><div class=funcname id=fn_routineLogger.reloadConfig>func routineLogger.reloadConfig</div><div class=info><a href=#s_fn_routineLogger.reloadConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/routine.go</code>:</div><table class=listing><tr><td>77<td><code><pre>func (r *routineLogger) reloadConfig() {</pre></code><tr><td>78<td><code><pre> cfg := make(map[string]any)</pre></code><tr><td>79<td><code><pre> _ = config.Use(r.appName).LoadComponentConfig(config.ComponentGoroutinePool, &cfg)</pre></code><tr><td>80<td><code><pre></pre></code><tr><td>81<td><code><pre> r.enabled = cast.ToBool(cfg["enable_logger"])</pre></code><tr><td>82<td><code><pre>}</pre></code></table><div class=funcname id=fn_mqLogger.logger>func mqLogger.logger</div><div class=info><a href=#s_fn_mqLogger.logger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mq.go</code>:</div><table class=listing><tr><td>88<td><code><pre>func (m *mqLogger) logger() log.Loggable {</pre></code><tr><td>89<td><code><pre> if m.log != nil {</pre></code><tr><td>90<td><code><pre> return m.log</pre></code><tr><td>91<td><code><pre> }</pre></code><tr><td>92<td><code><pre> return log.Use(config.DefaultInstanceKey, log.AppName(m.appName))</pre></code><tr><td>93<td><code><pre>}</pre></code></table><div class=funcname id=fn_httpLogger.reloadConfig>func httpLogger.reloadConfig</div><div class=info><a href=#s_fn_httpLogger.reloadConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/http.go</code>:</div><table class=listing><tr><td>87<td><code><pre>func (h *httpLogger) reloadConfig() {</pre></code><tr><td>88<td><code><pre> cfg := make(map[string]any)</pre></code><tr><td>89<td><code><pre> _ = config.Use(h.appName).LoadComponentConfig(config.ComponentHttp, &cfg)</pre></code><tr><td>90<td><code><pre></pre></code><tr><td>91<td><code><pre> h.enabled = cast.ToBool(cfg["enable_logger"])</pre></code><tr><td>92<td><code><pre>}</pre></code></table><div class=funcname id=fn_mongoLogger.succeeded>func mongoLogger.succeeded</div><div class=info><a href=#s_fn_mongoLogger.succeeded>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mongo.go</code>:</div><table class=listing><tr><td>118<td><code><pre>func (m *mongoLogger) succeeded(ctx context.Context, evt *event.CommandSucceededEvent) {</pre></code><tr><td>119<td><code><pre> if !m.isLoggableCommandName(evt.CommandName) {</pre></code><tr><td>120<td><code><pre> return</pre></code><tr><td>121<td><code><pre> }</pre></code><tr><td>122<td><code><pre> m.logger().Info(ctx, "%s succeeded: %s [request[%v] command[%s]]",</pre></code><tr><td>123<td><code><pre> evt.CommandName, evt.Reply, evt.RequestID, m.popCommandString(evt.RequestID),</pre></code><tr><td>124<td><code><pre> m.fields(log.Fields{"latency": int64(evt.Duration) / int64(time.Millisecond)}))</pre></code><tr><td>125<td><code><pre>}</pre></code></table><div class=funcname id=fn_mongoLogger.pushCommandString>func mongoLogger.pushCommandString</div><div class=info><a href=#s_fn_mongoLogger.pushCommandString>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mongo.go</code>:</div><table class=listing><tr><td>137<td><code><pre>func (m *mongoLogger) pushCommandString(requestID int64, commandString string) {</pre></code><tr><td>138<td><code><pre> m.mutex.Lock()</pre></code><tr><td>139<td><code><pre> defer m.mutex.Unlock()</pre></code><tr><td>140<td><code><pre> m.requestMap[requestID] = struct{ commandString string }{commandString: commandString}</pre></code><tr><td>141<td><code><pre>}</pre></code></table><div class=funcname id=fn_routineLogger.Init>func routineLogger.Init</div><div class=info><a href=#s_fn_routineLogger.Init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/routine.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func (r *routineLogger) Init(log log.Loggable, appName string) {</pre></code><tr><td>33<td><code><pre> r.log = log</pre></code><tr><td>34<td><code><pre> r.appName = appName</pre></code><tr><td>35<td><code><pre> r.reloadConfig()</pre></code><tr><td>36<td><code><pre>}</pre></code></table><div class=funcname id=fn_cronLogger.logger>func cronLogger.logger</div><div class=info><a href=#s_fn_cronLogger.logger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/cron.go</code>:</div><table class=listing><tr><td>96<td><code><pre>func (c *cronLogger) logger() log.Loggable {</pre></code><tr><td>97<td><code><pre> if c.log != nil {</pre></code><tr><td>98<td><code><pre> return c.log</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre> return log.Use(config.DefaultInstanceKey, log.AppName(c.appName))</pre></code><tr><td>101<td><code><pre>}</pre></code></table><div class=funcname id=fn_mongoLogger.started>func mongoLogger.started</div><div class=info><a href=#s_fn_mongoLogger.started>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mongo.go</code>:</div><table class=listing><tr><td>111<td><code><pre>func (m *mongoLogger) started(ctx context.Context, evt *event.CommandStartedEvent) {</pre></code><tr><td>112<td><code><pre> if !m.isLoggableCommandName(evt.CommandName) {</pre></code><tr><td>113<td><code><pre> return</pre></code><tr><td>114<td><code><pre> }</pre></code><tr><td>115<td><code><pre> m.pushCommandString(evt.RequestID, evt.Command.String())</pre></code><tr><td>116<td><code><pre>}</pre></code></table><div class=funcname id=fn_httpLogger.Init>func httpLogger.Init</div><div class=info><a href=#s_fn_httpLogger.Init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/http.go</code>:</div><table class=listing><tr><td>30<td><code><pre>func (h *httpLogger) Init(log log.Loggable, appName string) {</pre></code><tr><td>31<td><code><pre> h.log = log</pre></code><tr><td>32<td><code><pre> h.appName = appName</pre></code><tr><td>33<td><code><pre> h.reloadConfig()</pre></code><tr><td>34<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormLogger.Info>func gormLogger.Info</div><div class=info><a href=#s_fn_gormLogger.Info>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/gorm.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func (g *gormLogger) Info(ctx context.Context, msg string, data ...any) {</pre></code><tr><td>53<td><code><pre> if g.isLoggable() && g.logLevel >= logger.Info {</pre></code><tr><td>54<td><code><pre> g.logger().Info(ctx, msg, append(data, dbFields)...)</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre>}</pre></code></table><div class=funcname id=fn_mongoLogger.fields>func mongoLogger.fields</div><div class=info><a href=#s_fn_mongoLogger.fields>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mongo.go</code>:</div><table class=listing><tr><td>161<td><code><pre>func (m *mongoLogger) fields(fields log.Fields) log.Fields {</pre></code><tr><td>162<td><code><pre> return utils.MapMerge(fields, mongoFields)</pre></code><tr><td>163<td><code><pre>}</pre></code></table><div class=funcname id=fn_redisLogger.ProcessPipelineHook>func redisLogger.ProcessPipelineHook</div><div class=info><a href=#s_fn_redisLogger.ProcessPipelineHook>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/redis.go</code>:</div><table class=listing><tr><td>63<td><code><pre>func (r *redisLogger) ProcessPipelineHook(next rdsDrv.ProcessPipelineHook) rdsDrv.ProcessPipelineHook {</pre></code><tr><td>64<td><code><pre> return func(ctx context.Context, cmds []rdsDrv.Cmder) (err error) {</pre></code><tr><td>65<td><code><pre> if !r.isLoggable() {</pre></code><tr><td>66<td><code><pre> return next(ctx, cmds)</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre> begin := time.Now()</pre></code><tr><td>69<td><code><pre> fullNameSb := new(strings.Builder)</pre></code><tr><td>70<td><code><pre> for _, cmd := range cmds {</pre></code><tr><td>71<td><code><pre> _, _ = fullNameSb.WriteString(cmd.FullName() + " -> ")</pre></code><tr><td>72<td><code><pre> }</pre></code><tr><td>73<td><code><pre></pre></code><tr><td>74<td><code><pre> if err = next(ctx, cmds); err != nil {</pre></code><tr><td>75<td><code><pre> r.logger().Warn(ctx, "%s failed", fullNameSb.String(),</pre></code><tr><td>76<td><code><pre> r.fields(log.Fields{"latency": time.Since(begin).Milliseconds()}))</pre></code><tr><td>77<td><code><pre> return</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre></pre></code><tr><td>80<td><code><pre> r.logger().Info(ctx, "%s succeeded", fullNameSb.String(),</pre></code><tr><td>81<td><code><pre> r.fields(log.Fields{"latency": time.Since(begin).Milliseconds()}))</pre></code><tr><td>82<td><code><pre> return</pre></code><tr><td>83<td><code><pre> }</pre></code><tr><td>84<td><code><pre>}</pre></code></table><div class=funcname id=fn_mqLogger.With>func mqLogger.With</div><div class=info><a href=#s_fn_mqLogger.With>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mq.go</code>:</div><table class=listing><tr><td>84<td><code><pre>func (m *mqLogger) With(fields watermill.LogFields) watermill.LoggerAdapter {</pre></code><tr><td>85<td><code><pre> return &mqLogger{fields: m.fields.Add(fields)}</pre></code><tr><td>86<td><code><pre>}</pre></code></table><div class=funcname id=fn_mongoLogger.GetMonitor>func mongoLogger.GetMonitor</div><div class=info><a href=#s_fn_mongoLogger.GetMonitor>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mongo.go</code>:</div><table class=listing><tr><td>103<td><code><pre>func (m *mongoLogger) GetMonitor() *event.CommandMonitor {</pre></code><tr><td>104<td><code><pre> return &event.CommandMonitor{</pre></code><tr><td>105<td><code><pre> Started: m.started,</pre></code><tr><td>106<td><code><pre> Succeeded: m.succeeded,</pre></code><tr><td>107<td><code><pre> Failed: m.failed,</pre></code><tr><td>108<td><code><pre> }</pre></code><tr><td>109<td><code><pre>}</pre></code></table><div class=funcname id=fn_DefaultCronLogger>func DefaultCronLogger</div><div class=info><a href=#s_fn_DefaultCronLogger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/cron.go</code>:</div><table class=listing><tr><td>21<td><code><pre>func DefaultCronLogger() interface{ Printf(string, ...any) } {</pre></code><tr><td>22<td><code><pre> return &cronLogger{}</pre></code><tr><td>23<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormLogger.format>func gormLogger.format</div><div class=info><a href=#s_fn_gormLogger.format>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/gorm.go</code>:</div><table class=listing><tr><td>127<td><code><pre>func (g *gormLogger) format(sql string) string {</pre></code><tr><td>128<td><code><pre> return strings.ReplaceAll(sql, "%", "%%")</pre></code><tr><td>129<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormLogger.fields>func gormLogger.fields</div><div class=info><a href=#s_fn_gormLogger.fields>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/gorm.go</code>:</div><table class=listing><tr><td>131<td><code><pre>func (g *gormLogger) fields(fields log.Fields) log.Fields {</pre></code><tr><td>132<td><code><pre> return utils.MapMerge(fields, dbFields)</pre></code><tr><td>133<td><code><pre>}</pre></code></table><div class=funcname id=fn_redisLogger.DialHook>func redisLogger.DialHook</div><div class=info><a href=#s_fn_redisLogger.DialHook>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/redis.go</code>:</div><table class=listing><tr><td>40<td><code><pre>func (r *redisLogger) DialHook(next rdsDrv.DialHook) rdsDrv.DialHook {</pre></code><tr><td>41<td><code><pre> return func(ctx context.Context, network, addr string) (c net.Conn, e error) { return next(ctx, network, addr) }</pre></code><tr><td>42<td><code><pre>}</pre></code></table><div class=funcname id=fn_@41:9>func @41:9</div><div class=info><a href=#s_fn_@41:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/redis.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func(ctx context.Context, network, addr string) (c net.Conn, e error) { return next(ctx, network, addr) }</pre></code></table><div class=funcname id=fn_redisLogger.ProcessHook>func redisLogger.ProcessHook</div><div class=info><a href=#s_fn_redisLogger.ProcessHook>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/redis.go</code>:</div><table class=listing><tr><td>44<td><code><pre>func (r *redisLogger) ProcessHook(next rdsDrv.ProcessHook) rdsDrv.ProcessHook {</pre></code><tr><td>45<td><code><pre> return func(ctx context.Context, cmd rdsDrv.Cmder) (err error) {</pre></code><tr><td>46<td><code><pre> if !r.isLoggableCommandSet(cmd.Name()) {</pre></code><tr><td>47<td><code><pre> return next(ctx, cmd)</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre></pre></code><tr><td>50<td><code><pre> begin := time.Now()</pre></code><tr><td>51<td><code><pre> if err = next(ctx, cmd); err != nil {</pre></code><tr><td>52<td><code><pre> r.logger().Warn(ctx, "%s failed [command[%s]]", cmd.FullName(), cmd.String(),</pre></code><tr><td>53<td><code><pre> r.fields(log.Fields{"latency": time.Since(begin).Milliseconds()}))</pre></code><tr><td>54<td><code><pre> return</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre></pre></code><tr><td>57<td><code><pre> r.logger().Info(ctx, "%s succeeded [command[%s]]", cmd.FullName(), cmd.String(),</pre></code><tr><td>58<td><code><pre> r.fields(log.Fields{"latency": time.Since(begin).Milliseconds()}))</pre></code><tr><td>59<td><code><pre> return</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre>}</pre></code></table><div class=funcname id=fn_redisLogger.fields>func redisLogger.fields</div><div class=info><a href=#s_fn_redisLogger.fields>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/redis.go</code>:</div><table class=listing><tr><td>93<td><code><pre>func (r *redisLogger) fields(fields log.Fields) log.Fields {</pre></code><tr><td>94<td><code><pre> return utils.MapMerge(fields, redisFields)</pre></code><tr><td>95<td><code><pre>}</pre></code></table><div class=funcname id=fn_mongoLogger.popCommandString>func mongoLogger.popCommandString</div><div class=info><a href=#s_fn_mongoLogger.popCommandString>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mongo.go</code>:</div><table class=listing><tr><td>143<td><code><pre>func (m *mongoLogger) popCommandString(requestID int64) string {</pre></code><tr><td>144<td><code><pre> m.mutex.Lock()</pre></code><tr><td>145<td><code><pre> defer m.mutex.Unlock()</pre></code><tr><td>146<td><code><pre> reqCtx, ok := m.requestMap[requestID]</pre></code><tr><td>147<td><code><pre> if ok {</pre></code><tr><td>148<td><code><pre> delete(m.requestMap, requestID)</pre></code><tr><td>149<td><code><pre> return reqCtx.commandString</pre></code><tr><td>150<td><code><pre> }</pre></code><tr class=miss><td>151<td><code><pre> return ""</pre></code><tr><td>152<td><code><pre>}</pre></code></table><div class=funcname id=fn_redisLogger.reloadConfig>func redisLogger.reloadConfig</div><div class=info><a href=#s_fn_redisLogger.reloadConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/redis.go</code>:</div><table class=listing><tr><td>120<td><code><pre>func (r *redisLogger) reloadConfig() {</pre></code><tr><td>121<td><code><pre> var cfgs map[string]map[string]any</pre></code><tr><td>122<td><code><pre> _ = config.Use(r.appName).LoadComponentConfig(config.ComponentRedis, &cfgs)</pre></code><tr><td>123<td><code><pre> if len(cfgs) == 0 {</pre></code><tr class=miss><td>124<td><code><pre> return</pre></code><tr><td>125<td><code><pre> }</pre></code><tr><td>126<td><code><pre></pre></code><tr><td>127<td><code><pre> cfg, ok := cfgs[r.confName]</pre></code><tr><td>128<td><code><pre> if !ok {</pre></code><tr class=miss><td>129<td><code><pre> return</pre></code><tr><td>130<td><code><pre> }</pre></code><tr><td>131<td><code><pre> enabled := cast.ToBool(cfg["enable_logger"])</pre></code><tr><td>132<td><code><pre> r.enabled = enabled</pre></code><tr><td>133<td><code><pre></pre></code><tr><td>134<td><code><pre> unloggableCommandsObj, ok1 := cfg["unloggable_commands"]</pre></code><tr><td>135<td><code><pre> unloggableCommands, ok2 := unloggableCommandsObj.([]string)</pre></code><tr><td>136<td><code><pre> if !ok1 || !ok2 {</pre></code><tr class=miss><td>137<td><code><pre> return</pre></code><tr><td>138<td><code><pre> }</pre></code><tr><td>139<td><code><pre> sets := utils.NewSet(unloggableCommands...)</pre></code><tr><td>140<td><code><pre> r.unloggableCommandSet = sets</pre></code><tr><td>141<td><code><pre>}</pre></code></table><div class=funcname id=fn_mqLogger.parseLogFields>func mqLogger.parseLogFields</div><div class=info><a href=#s_fn_mqLogger.parseLogFields>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mq.go</code>:</div><table class=listing><tr><td>95<td><code><pre>func (m *mqLogger) parseLogFields(fields watermill.LogFields) (ctx context.Context, fs log.Fields) {</pre></code><tr><td>96<td><code><pre> ctx = context.Background()</pre></code><tr><td>97<td><code><pre> fields = m.fields.Add(fields)</pre></code><tr><td>98<td><code><pre></pre></code><tr><td>99<td><code><pre> fs = make(log.Fields, len(fields)+1)</pre></code><tr><td>100<td><code><pre> for k, v := range fields {</pre></code><tr><td>101<td><code><pre> if k == watermill.ContextLogFieldKey {</pre></code><tr class=miss><td>102<td><code><pre> ctx = v.(context.Context)</pre></code><tr class=miss><td>103<td><code><pre> continue</pre></code><tr><td>104<td><code><pre> }</pre></code><tr><td>105<td><code><pre> fs[k] = v</pre></code><tr><td>106<td><code><pre> }</pre></code><tr><td>107<td><code><pre> fs = utils.MapMerge(fs, mqFields)</pre></code><tr><td>108<td><code><pre> return</pre></code><tr><td>109<td><code><pre>}</pre></code></table><div class=funcname id=fn_mongoLogger.isLoggableCommandName>func mongoLogger.isLoggableCommandName</div><div class=info><a href=#s_fn_mongoLogger.isLoggableCommandName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mongo.go</code>:</div><table class=listing><tr><td>165<td><code><pre>func (m *mongoLogger) isLoggableCommandName(commandName string) bool {</pre></code><tr><td>166<td><code><pre> if m.confName == "" {</pre></code><tr class=miss><td>167<td><code><pre> return true</pre></code><tr><td>168<td><code><pre> }</pre></code><tr><td>169<td><code><pre> if m.reloadConfig(); !m.enabled {</pre></code><tr><td>170<td><code><pre> return false</pre></code><tr><td>171<td><code><pre> }</pre></code><tr><td>172<td><code><pre> return m.loggableCommandSet.Contains(commandName)</pre></code><tr><td>173<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormLogger.reloadConfig>func gormLogger.reloadConfig</div><div class=info><a href=#s_fn_gormLogger.reloadConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/gorm.go</code>:</div><table class=listing><tr><td>158<td><code><pre>func (g *gormLogger) reloadConfig() {</pre></code><tr><td>159<td><code><pre> var cfgs map[string]map[string]any</pre></code><tr><td>160<td><code><pre> _ = config.Use(g.appName).LoadComponentConfig(config.ComponentDB, &cfgs)</pre></code><tr><td>161<td><code><pre> if len(cfgs) == 0 {</pre></code><tr class=miss><td>162<td><code><pre> return</pre></code><tr><td>163<td><code><pre> }</pre></code><tr><td>164<td><code><pre></pre></code><tr><td>165<td><code><pre> cfg, ok := cfgs[g.confName]</pre></code><tr><td>166<td><code><pre> if !ok {</pre></code><tr class=miss><td>167<td><code><pre> return</pre></code><tr><td>168<td><code><pre> }</pre></code><tr><td>169<td><code><pre> g.enabled = cast.ToBool(cfg["enable_logger"])</pre></code><tr><td>170<td><code><pre> logConfigObj, ok1 := cfg["logger_config"]</pre></code><tr><td>171<td><code><pre> logCfg, ok2 := logConfigObj.(map[string]any)</pre></code><tr><td>172<td><code><pre> if !ok1 || !ok2 {</pre></code><tr class=miss><td>173<td><code><pre> return</pre></code><tr><td>174<td><code><pre> }</pre></code><tr><td>175<td><code><pre> g.logLevel = g.getLogLevel(cast.ToString(logCfg["log_level"]))</pre></code><tr><td>176<td><code><pre> g.slowThreshold, _ = time.ParseDuration(cast.ToString(logCfg["slow_threshold"]))</pre></code><tr><td>177<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricsLogger.reloadConfig>func metricsLogger.reloadConfig</div><div class=info><a href=#s_fn_metricsLogger.reloadConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/metrics.go</code>:</div><table class=listing><tr><td>144<td><code><pre>func (m *metricsLogger) reloadConfig() {</pre></code><tr><td>145<td><code><pre> var cfgs map[string]map[string]any</pre></code><tr><td>146<td><code><pre> _ = config.Use(m.appName).LoadComponentConfig(config.ComponentMetrics, &cfgs)</pre></code><tr><td>147<td><code><pre> if len(cfgs) == 0 {</pre></code><tr class=miss><td>148<td><code><pre> return</pre></code><tr><td>149<td><code><pre> }</pre></code><tr><td>150<td><code><pre></pre></code><tr><td>151<td><code><pre> cfg, ok := cfgs[m.confName]</pre></code><tr><td>152<td><code><pre> if !ok {</pre></code><tr class=miss><td>153<td><code><pre> return</pre></code><tr><td>154<td><code><pre> }</pre></code><tr><td>155<td><code><pre> enabled := cast.ToBool(cfg["enable_logger"])</pre></code><tr><td>156<td><code><pre> m.enabled = enabled</pre></code><tr><td>157<td><code><pre>}</pre></code></table><div class=funcname id=fn_cronLogger.reloadConfig>func cronLogger.reloadConfig</div><div class=info><a href=#s_fn_cronLogger.reloadConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/cron.go</code>:</div><table class=listing><tr><td>148<td><code><pre>func (c *cronLogger) reloadConfig() {</pre></code><tr><td>149<td><code><pre> var cfgs map[string]map[string]any</pre></code><tr><td>150<td><code><pre> _ = config.Use(c.appName).LoadComponentConfig(config.ComponentCron, &cfgs)</pre></code><tr><td>151<td><code><pre> if len(cfgs) == 0 {</pre></code><tr class=miss><td>152<td><code><pre> return</pre></code><tr><td>153<td><code><pre> }</pre></code><tr><td>154<td><code><pre></pre></code><tr><td>155<td><code><pre> cfg, ok := cfgs[c.confName]</pre></code><tr><td>156<td><code><pre> if !ok {</pre></code><tr class=miss><td>157<td><code><pre> return</pre></code><tr><td>158<td><code><pre> }</pre></code><tr><td>159<td><code><pre> enabled := cast.ToBool(cfg["enable_logger"])</pre></code><tr><td>160<td><code><pre> c.enabled = enabled</pre></code><tr><td>161<td><code><pre>}</pre></code></table><div class=funcname id=fn_asyncLogger.reloadConfig>func asyncLogger.reloadConfig</div><div class=info><a href=#s_fn_asyncLogger.reloadConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/async.go</code>:</div><table class=listing><tr><td>148<td><code><pre>func (a *asyncLogger) reloadConfig() {</pre></code><tr><td>149<td><code><pre> var cfgs map[string]map[string]any</pre></code><tr><td>150<td><code><pre> _ = config.Use(a.appName).LoadComponentConfig(config.ComponentAsync, &cfgs)</pre></code><tr><td>151<td><code><pre> if len(cfgs) == 0 {</pre></code><tr class=miss><td>152<td><code><pre> return</pre></code><tr><td>153<td><code><pre> }</pre></code><tr><td>154<td><code><pre></pre></code><tr><td>155<td><code><pre> cfg, ok := cfgs[a.confName]</pre></code><tr><td>156<td><code><pre> if !ok {</pre></code><tr class=miss><td>157<td><code><pre> return</pre></code><tr><td>158<td><code><pre> }</pre></code><tr><td>159<td><code><pre> enabled := cast.ToBool(cfg["enable_logger"])</pre></code><tr><td>160<td><code><pre> a.enabled = enabled</pre></code><tr><td>161<td><code><pre>}</pre></code></table><div class=funcname id=fn_mqLogger.reloadConfig>func mqLogger.reloadConfig</div><div class=info><a href=#s_fn_mqLogger.reloadConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mq.go</code>:</div><table class=listing><tr><td>120<td><code><pre>func (m *mqLogger) reloadConfig() {</pre></code><tr><td>121<td><code><pre> var cfgs map[string]map[string]any</pre></code><tr><td>122<td><code><pre> _ = config.Use(m.appName).LoadComponentConfig(config.ComponentMessageQueue, &cfgs)</pre></code><tr><td>123<td><code><pre> if len(cfgs) == 0 {</pre></code><tr class=miss><td>124<td><code><pre> return</pre></code><tr><td>125<td><code><pre> }</pre></code><tr><td>126<td><code><pre></pre></code><tr><td>127<td><code><pre> cfg, ok := cfgs[m.confName]</pre></code><tr><td>128<td><code><pre> if !ok {</pre></code><tr class=miss><td>129<td><code><pre> return</pre></code><tr><td>130<td><code><pre> }</pre></code><tr><td>131<td><code><pre> enabled := cast.ToBool(cfg["enable_logger"])</pre></code><tr><td>132<td><code><pre> m.enabled = enabled</pre></code><tr><td>133<td><code><pre>}</pre></code></table><div class=funcname id=fn_mongoLogger.reloadConfig>func mongoLogger.reloadConfig</div><div class=info><a href=#s_fn_mongoLogger.reloadConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mongo.go</code>:</div><table class=listing><tr><td>175<td><code><pre>func (m *mongoLogger) reloadConfig() {</pre></code><tr><td>176<td><code><pre> var cfgs map[string]map[string]any</pre></code><tr><td>177<td><code><pre> _ = config.Use(m.appName).LoadComponentConfig(config.ComponentMongo, &cfgs)</pre></code><tr><td>178<td><code><pre> if len(cfgs) == 0 {</pre></code><tr class=miss><td>179<td><code><pre> return</pre></code><tr><td>180<td><code><pre> }</pre></code><tr><td>181<td><code><pre></pre></code><tr><td>182<td><code><pre> cfg, ok := cfgs[m.confName]</pre></code><tr><td>183<td><code><pre> if !ok {</pre></code><tr class=miss><td>184<td><code><pre> return</pre></code><tr><td>185<td><code><pre> }</pre></code><tr><td>186<td><code><pre> m.enabled = cast.ToBool(cfg["enable_logger"])</pre></code><tr><td>187<td><code><pre> logConfigObj, ok1 := cfg["logger_config"]</pre></code><tr><td>188<td><code><pre> logCfg, ok2 := logConfigObj.(map[string]any)</pre></code><tr><td>189<td><code><pre> if !ok1 || !ok2 {</pre></code><tr class=miss><td>190<td><code><pre> return</pre></code><tr><td>191<td><code><pre> }</pre></code><tr><td>192<td><code><pre> loggableCommandList, ok := logCfg["loggable_commands"].([]string)</pre></code><tr><td>193<td><code><pre> if !ok {</pre></code><tr class=miss><td>194<td><code><pre> return</pre></code><tr><td>195<td><code><pre> }</pre></code><tr><td>196<td><code><pre></pre></code><tr><td>197<td><code><pre> m.loggableCommandSet = utils.NewSet(loggableCommandList...)</pre></code><tr><td>198<td><code><pre>}</pre></code></table><div class=funcname id=fn_redisLogger.isLoggableCommandSet>func redisLogger.isLoggableCommandSet</div><div class=info><a href=#s_fn_redisLogger.isLoggableCommandSet>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/redis.go</code>:</div><table class=listing><tr><td>97<td><code><pre>func (r *redisLogger) isLoggableCommandSet(command string) bool {</pre></code><tr><td>98<td><code><pre> if r.confName == "" {</pre></code><tr class=miss><td>99<td><code><pre> return true</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre></pre></code><tr><td>102<td><code><pre> r.reloadConfig()</pre></code><tr><td>103<td><code><pre> if !r.enabled {</pre></code><tr><td>104<td><code><pre> return false</pre></code><tr><td>105<td><code><pre> }</pre></code><tr><td>106<td><code><pre> if r.unloggableCommandSet == nil {</pre></code><tr class=miss><td>107<td><code><pre> return true</pre></code><tr><td>108<td><code><pre> }</pre></code><tr><td>109<td><code><pre> return !r.unloggableCommandSet.Contains(command)</pre></code><tr><td>110<td><code><pre>}</pre></code></table><div class=funcname id=fn_@45:9>func @45:9</div><div class=info><a href=#s_fn_@45:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/redis.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func(ctx context.Context, cmd rdsDrv.Cmder) (err error) {</pre></code><tr><td>46<td><code><pre> if !r.isLoggableCommandSet(cmd.Name()) {</pre></code><tr><td>47<td><code><pre> return next(ctx, cmd)</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre></pre></code><tr><td>50<td><code><pre> begin := time.Now()</pre></code><tr><td>51<td><code><pre> if err = next(ctx, cmd); err != nil {</pre></code><tr class=miss><td>52<td><code><pre> r.logger().Warn(ctx, "%s failed [command[%s]]", cmd.FullName(), cmd.String(),</pre></code><tr><td>53<td><code><pre> r.fields(log.Fields{"latency": time.Since(begin).Milliseconds()}))</pre></code><tr class=miss><td>54<td><code><pre> return</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre></pre></code><tr><td>57<td><code><pre> r.logger().Info(ctx, "%s succeeded [command[%s]]", cmd.FullName(), cmd.String(),</pre></code><tr><td>58<td><code><pre> r.fields(log.Fields{"latency": time.Since(begin).Milliseconds()}))</pre></code><tr><td>59<td><code><pre> return</pre></code><tr><td>60<td><code><pre> }</pre></code></table><div class=funcname id=fn_cronLogger.Debug>func cronLogger.Debug</div><div class=info><a href=#s_fn_cronLogger.Debug>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/cron.go</code>:</div><table class=listing><tr><td>51<td><code><pre>func (c *cronLogger) Debug(args ...any) {</pre></code><tr><td>52<td><code><pre> if !c.isLoggable() {</pre></code><tr class=miss><td>53<td><code><pre> return</pre></code><tr><td>54<td><code><pre> }</pre></code><tr><td>55<td><code><pre> ctx, format, args := c.parseArgs(args...)</pre></code><tr><td>56<td><code><pre> c.logger().Debug(ctx, format, args...)</pre></code><tr><td>57<td><code><pre>}</pre></code></table><div class=funcname id=fn_asyncLogger.isLoggable>func asyncLogger.isLoggable</div><div class=info><a href=#s_fn_asyncLogger.isLoggable>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/async.go</code>:</div><table class=listing><tr><td>140<td><code><pre>func (a *asyncLogger) isLoggable() bool {</pre></code><tr><td>141<td><code><pre> if a.confName == "" {</pre></code><tr class=miss><td>142<td><code><pre> return true</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre> a.reloadConfig()</pre></code><tr><td>145<td><code><pre> return a.enabled</pre></code><tr><td>146<td><code><pre>}</pre></code></table><div class=funcname id=fn_cronLogger.Info>func cronLogger.Info</div><div class=info><a href=#s_fn_cronLogger.Info>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/cron.go</code>:</div><table class=listing><tr><td>60<td><code><pre>func (c *cronLogger) Info(args ...any) {</pre></code><tr><td>61<td><code><pre> if !c.isLoggable() {</pre></code><tr class=miss><td>62<td><code><pre> return</pre></code><tr><td>63<td><code><pre> }</pre></code><tr><td>64<td><code><pre> ctx, format, args := c.parseArgs(args...)</pre></code><tr><td>65<td><code><pre> c.logger().Info(ctx, format, args...)</pre></code><tr><td>66<td><code><pre>}</pre></code></table><div class=funcname id=fn_cronLogger.Warn>func cronLogger.Warn</div><div class=info><a href=#s_fn_cronLogger.Warn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/cron.go</code>:</div><table class=listing><tr><td>69<td><code><pre>func (c *cronLogger) Warn(args ...any) {</pre></code><tr><td>70<td><code><pre> if !c.isLoggable() {</pre></code><tr class=miss><td>71<td><code><pre> return</pre></code><tr><td>72<td><code><pre> }</pre></code><tr><td>73<td><code><pre> ctx, format, args := c.parseArgs(args...)</pre></code><tr><td>74<td><code><pre> c.logger().Warn(ctx, format, args...)</pre></code><tr><td>75<td><code><pre>}</pre></code></table><div class=funcname id=fn_asyncLogger.Info>func asyncLogger.Info</div><div class=info><a href=#s_fn_asyncLogger.Info>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/async.go</code>:</div><table class=listing><tr><td>60<td><code><pre>func (a *asyncLogger) Info(args ...any) {</pre></code><tr><td>61<td><code><pre> if !a.isLoggable() {</pre></code><tr class=miss><td>62<td><code><pre> return</pre></code><tr><td>63<td><code><pre> }</pre></code><tr><td>64<td><code><pre> ctx, format, args := a.parseArgs(args...)</pre></code><tr><td>65<td><code><pre> a.logger().Info(ctx, format, args...)</pre></code><tr><td>66<td><code><pre>}</pre></code></table><div class=funcname id=fn_mqLogger.Trace>func mqLogger.Trace</div><div class=info><a href=#s_fn_mqLogger.Trace>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mq.go</code>:</div><table class=listing><tr><td>75<td><code><pre>func (m *mqLogger) Trace(msg string, fields watermill.LogFields) {</pre></code><tr><td>76<td><code><pre> if !m.isLoggable() {</pre></code><tr class=miss><td>77<td><code><pre> return</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre> ctx, fs := m.parseLogFields(fields)</pre></code><tr><td>80<td><code><pre> m.logger().Debug(ctx, msg, fs)</pre></code><tr><td>81<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormLogger.isLoggable>func gormLogger.isLoggable</div><div class=info><a href=#s_fn_gormLogger.isLoggable>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/gorm.go</code>:</div><table class=listing><tr><td>150<td><code><pre>func (g *gormLogger) isLoggable() bool {</pre></code><tr><td>151<td><code><pre> if g.confName == "" {</pre></code><tr class=miss><td>152<td><code><pre> return true</pre></code><tr><td>153<td><code><pre> }</pre></code><tr><td>154<td><code><pre> g.reloadConfig()</pre></code><tr><td>155<td><code><pre> return g.enabled</pre></code><tr><td>156<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricsLogger.Debug>func metricsLogger.Debug</div><div class=info><a href=#s_fn_metricsLogger.Debug>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/metrics.go</code>:</div><table class=listing><tr><td>47<td><code><pre>func (m *metricsLogger) Debug(args ...any) {</pre></code><tr><td>48<td><code><pre> if !m.isLoggable() {</pre></code><tr class=miss><td>49<td><code><pre> return</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre> ctx, format, args := m.parseArgs(args...)</pre></code><tr><td>52<td><code><pre> m.logger().Debug(ctx, format, args...)</pre></code><tr><td>53<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricsLogger.isLoggable>func metricsLogger.isLoggable</div><div class=info><a href=#s_fn_metricsLogger.isLoggable>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/metrics.go</code>:</div><table class=listing><tr><td>136<td><code><pre>func (m *metricsLogger) isLoggable() bool {</pre></code><tr><td>137<td><code><pre> if m.confName == "" {</pre></code><tr class=miss><td>138<td><code><pre> return true</pre></code><tr><td>139<td><code><pre> }</pre></code><tr><td>140<td><code><pre> m.reloadConfig()</pre></code><tr><td>141<td><code><pre> return m.enabled</pre></code><tr><td>142<td><code><pre>}</pre></code></table><div class=funcname id=fn_redisLogger.isLoggable>func redisLogger.isLoggable</div><div class=info><a href=#s_fn_redisLogger.isLoggable>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/redis.go</code>:</div><table class=listing><tr><td>112<td><code><pre>func (r *redisLogger) isLoggable() bool {</pre></code><tr><td>113<td><code><pre> if r.confName == "" {</pre></code><tr class=miss><td>114<td><code><pre> return true</pre></code><tr><td>115<td><code><pre> }</pre></code><tr><td>116<td><code><pre> r.reloadConfig()</pre></code><tr><td>117<td><code><pre> return r.enabled</pre></code><tr><td>118<td><code><pre>}</pre></code></table><div class=funcname id=fn_mongoLogger.logger>func mongoLogger.logger</div><div class=info><a href=#s_fn_mongoLogger.logger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mongo.go</code>:</div><table class=listing><tr><td>154<td><code><pre>func (m *mongoLogger) logger() log.Loggable {</pre></code><tr><td>155<td><code><pre> if m.log != nil {</pre></code><tr><td>156<td><code><pre> return m.log</pre></code><tr><td>157<td><code><pre> }</pre></code><tr class=miss><td>158<td><code><pre> return log.Use(config.DefaultInstanceKey, log.AppName(m.appName))</pre></code><tr><td>159<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricsLogger.logger>func metricsLogger.logger</div><div class=info><a href=#s_fn_metricsLogger.logger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/metrics.go</code>:</div><table class=listing><tr><td>92<td><code><pre>func (m *metricsLogger) logger() log.Loggable {</pre></code><tr><td>93<td><code><pre> if m.log != nil {</pre></code><tr><td>94<td><code><pre> return m.log</pre></code><tr><td>95<td><code><pre> }</pre></code><tr class=miss><td>96<td><code><pre> return log.Use(config.DefaultInstanceKey, log.AppName(m.appName))</pre></code><tr><td>97<td><code><pre>}</pre></code></table><div class=funcname id=fn_mongoLogger.failed>func mongoLogger.failed</div><div class=info><a href=#s_fn_mongoLogger.failed>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mongo.go</code>:</div><table class=listing><tr><td>127<td><code><pre>func (m *mongoLogger) failed(ctx context.Context, evt *event.CommandFailedEvent) {</pre></code><tr><td>128<td><code><pre> if !m.isLoggableCommandName(evt.CommandName) {</pre></code><tr><td>129<td><code><pre> return</pre></code><tr><td>130<td><code><pre> }</pre></code><tr><td>131<td><code><pre></pre></code><tr class=miss><td>132<td><code><pre> m.logger().Warn(ctx, "%s failed: %s [request[%v] command[%s]]",</pre></code><tr><td>133<td><code><pre> evt.CommandName, evt.Failure, evt.RequestID, m.popCommandString(evt.RequestID),</pre></code><tr><td>134<td><code><pre> m.fields(log.Fields{"latency": int64(evt.Duration) / int64(time.Millisecond)}))</pre></code><tr><td>135<td><code><pre>}</pre></code></table><div class=funcname id=fn_cronLogger.Printf>func cronLogger.Printf</div><div class=info><a href=#s_fn_cronLogger.Printf>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/cron.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func (c *cronLogger) Printf(format string, args ...any) {</pre></code><tr><td>44<td><code><pre> if !c.isLoggable() {</pre></code><tr class=miss><td>45<td><code><pre> return</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre> c.logger().Info(context.Background(), format, append(args, cronFields)...)</pre></code><tr><td>48<td><code><pre>}</pre></code></table><div class=funcname id=fn_redisLogger.logger>func redisLogger.logger</div><div class=info><a href=#s_fn_redisLogger.logger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/redis.go</code>:</div><table class=listing><tr><td>86<td><code><pre>func (r *redisLogger) logger() log.Loggable {</pre></code><tr><td>87<td><code><pre> if r.log != nil {</pre></code><tr><td>88<td><code><pre> return r.log</pre></code><tr><td>89<td><code><pre> }</pre></code><tr class=miss><td>90<td><code><pre> return log.Use(config.DefaultInstanceKey, log.AppName(r.appName))</pre></code><tr><td>91<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormLogger.logger>func gormLogger.logger</div><div class=info><a href=#s_fn_gormLogger.logger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/gorm.go</code>:</div><table class=listing><tr><td>120<td><code><pre>func (g *gormLogger) logger() log.Loggable {</pre></code><tr><td>121<td><code><pre> if g.log != nil {</pre></code><tr><td>122<td><code><pre> return g.log</pre></code><tr><td>123<td><code><pre> }</pre></code><tr class=miss><td>124<td><code><pre> return log.Use(config.DefaultInstanceKey, log.AppName(g.appName))</pre></code><tr><td>125<td><code><pre>}</pre></code></table><div class=funcname id=fn_asyncLogger.logger>func asyncLogger.logger</div><div class=info><a href=#s_fn_asyncLogger.logger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/async.go</code>:</div><table class=listing><tr><td>96<td><code><pre>func (a *asyncLogger) logger() log.Loggable {</pre></code><tr><td>97<td><code><pre> if a.log != nil {</pre></code><tr><td>98<td><code><pre> return a.log</pre></code><tr><td>99<td><code><pre> }</pre></code><tr class=miss><td>100<td><code><pre> return log.Use(config.DefaultInstanceKey, log.AppName(a.appName))</pre></code><tr><td>101<td><code><pre>}</pre></code></table><div class=funcname id=fn_cronLogger.parseArgs>func cronLogger.parseArgs</div><div class=info><a href=#s_fn_cronLogger.parseArgs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/cron.go</code>:</div><table class=listing><tr><td>104<td><code><pre>func (c *cronLogger) parseArgs(args ...any) (ctx context.Context, format string, params []any) {</pre></code><tr><td>105<td><code><pre> var ok bool</pre></code><tr><td>106<td><code><pre></pre></code><tr><td>107<td><code><pre> if len(args) == 0 {</pre></code><tr class=miss><td>108<td><code><pre> return context.Background(), "", []any{cronFields}</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre> if len(args) == 1 {</pre></code><tr><td>111<td><code><pre> args = append(args, cronFields)</pre></code><tr><td>112<td><code><pre> return context.Background(), "%+v", args</pre></code><tr><td>113<td><code><pre> }</pre></code><tr><td>114<td><code><pre></pre></code><tr><td>115<td><code><pre> format, ok = args[0].(string)</pre></code><tr><td>116<td><code><pre> if ok {</pre></code><tr class=miss><td>117<td><code><pre> params = args[1:]</pre></code><tr><td>118<td><code><pre> } else {</pre></code><tr><td>119<td><code><pre> ctx, _ = args[0].(context.Context)</pre></code><tr><td>120<td><code><pre> format, _ = args[1].(string)</pre></code><tr><td>121<td><code><pre> params = args[2:]</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre> if format == "" {</pre></code><tr class=miss><td>124<td><code><pre> placeholder := make([]string, len(args))</pre></code><tr class=miss><td>125<td><code><pre> for i := 0; i < len(args); i++ {</pre></code><tr class=miss><td>126<td><code><pre> placeholder[i] = "%+v"</pre></code><tr><td>127<td><code><pre> }</pre></code><tr class=miss><td>128<td><code><pre> format = strings.Join(placeholder, " ")</pre></code><tr class=miss><td>129<td><code><pre> params = args</pre></code><tr><td>130<td><code><pre> }</pre></code><tr><td>131<td><code><pre></pre></code><tr><td>132<td><code><pre> if ctx == nil {</pre></code><tr class=miss><td>133<td><code><pre> ctx = context.Background()</pre></code><tr><td>134<td><code><pre> }</pre></code><tr><td>135<td><code><pre></pre></code><tr><td>136<td><code><pre> params = append(params, cronFields)</pre></code><tr><td>137<td><code><pre> return</pre></code><tr><td>138<td><code><pre>}</pre></code></table><div class=funcname id=fn_asyncLogger.parseArgs>func asyncLogger.parseArgs</div><div class=info><a href=#s_fn_asyncLogger.parseArgs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/async.go</code>:</div><table class=listing><tr><td>104<td><code><pre>func (a *asyncLogger) parseArgs(args ...any) (ctx context.Context, format string, params []any) {</pre></code><tr><td>105<td><code><pre> var ok bool</pre></code><tr><td>106<td><code><pre></pre></code><tr><td>107<td><code><pre> if len(args) == 0 {</pre></code><tr class=miss><td>108<td><code><pre> return context.Background(), "", []any{asyncFields}</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre> if len(args) == 1 {</pre></code><tr><td>111<td><code><pre> args = append(args, asyncFields)</pre></code><tr><td>112<td><code><pre> return context.Background(), "%+v", args</pre></code><tr><td>113<td><code><pre> }</pre></code><tr><td>114<td><code><pre></pre></code><tr><td>115<td><code><pre> format, ok = args[0].(string)</pre></code><tr><td>116<td><code><pre> if ok {</pre></code><tr class=miss><td>117<td><code><pre> params = args[1:]</pre></code><tr><td>118<td><code><pre> } else {</pre></code><tr><td>119<td><code><pre> ctx, _ = args[0].(context.Context)</pre></code><tr><td>120<td><code><pre> format, _ = args[1].(string)</pre></code><tr><td>121<td><code><pre> params = args[2:]</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre> if format == "" {</pre></code><tr class=miss><td>124<td><code><pre> placeholder := make([]string, len(args))</pre></code><tr class=miss><td>125<td><code><pre> for i := 0; i < len(args); i++ {</pre></code><tr class=miss><td>126<td><code><pre> placeholder[i] = "%+v"</pre></code><tr><td>127<td><code><pre> }</pre></code><tr class=miss><td>128<td><code><pre> format = strings.Join(placeholder, " ")</pre></code><tr class=miss><td>129<td><code><pre> params = args</pre></code><tr><td>130<td><code><pre> }</pre></code><tr><td>131<td><code><pre></pre></code><tr><td>132<td><code><pre> if ctx == nil {</pre></code><tr class=miss><td>133<td><code><pre> ctx = context.Background()</pre></code><tr><td>134<td><code><pre> }</pre></code><tr><td>135<td><code><pre></pre></code><tr><td>136<td><code><pre> params = append(params, asyncFields)</pre></code><tr><td>137<td><code><pre> return</pre></code><tr><td>138<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricsLogger.parseArgs>func metricsLogger.parseArgs</div><div class=info><a href=#s_fn_metricsLogger.parseArgs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/metrics.go</code>:</div><table class=listing><tr><td>100<td><code><pre>func (m *metricsLogger) parseArgs(args ...any) (ctx context.Context, format string, params []any) {</pre></code><tr><td>101<td><code><pre> var ok bool</pre></code><tr><td>102<td><code><pre></pre></code><tr><td>103<td><code><pre> if len(args) == 0 {</pre></code><tr class=miss><td>104<td><code><pre> return context.Background(), "", []any{metricsFields}</pre></code><tr><td>105<td><code><pre> }</pre></code><tr><td>106<td><code><pre> if len(args) == 1 {</pre></code><tr class=miss><td>107<td><code><pre> args = append(args, metricsFields)</pre></code><tr class=miss><td>108<td><code><pre> return context.Background(), "%+v", args</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre></pre></code><tr><td>111<td><code><pre> format, ok = args[0].(string)</pre></code><tr><td>112<td><code><pre> if ok {</pre></code><tr class=miss><td>113<td><code><pre> params = args[1:]</pre></code><tr><td>114<td><code><pre> } else {</pre></code><tr><td>115<td><code><pre> ctx, _ = args[0].(context.Context)</pre></code><tr><td>116<td><code><pre> format, _ = args[1].(string)</pre></code><tr><td>117<td><code><pre> params = args[2:]</pre></code><tr><td>118<td><code><pre> }</pre></code><tr><td>119<td><code><pre> if format == "" {</pre></code><tr class=miss><td>120<td><code><pre> placeholder := make([]string, len(args))</pre></code><tr class=miss><td>121<td><code><pre> for i := 0; i < len(args); i++ {</pre></code><tr class=miss><td>122<td><code><pre> placeholder[i] = "%+v"</pre></code><tr><td>123<td><code><pre> }</pre></code><tr class=miss><td>124<td><code><pre> format = strings.Join(placeholder, " ")</pre></code><tr class=miss><td>125<td><code><pre> params = args</pre></code><tr><td>126<td><code><pre> }</pre></code><tr><td>127<td><code><pre></pre></code><tr><td>128<td><code><pre> if ctx == nil {</pre></code><tr class=miss><td>129<td><code><pre> ctx = context.Background()</pre></code><tr><td>130<td><code><pre> }</pre></code><tr><td>131<td><code><pre></pre></code><tr><td>132<td><code><pre> params = append(params, metricsFields)</pre></code><tr><td>133<td><code><pre> return</pre></code><tr><td>134<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormLogger.Trace>func gormLogger.Trace</div><div class=info><a href=#s_fn_gormLogger.Trace>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/gorm.go</code>:</div><table class=listing><tr><td>73<td><code><pre>func (g *gormLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) {</pre></code><tr><td>74<td><code><pre> if !g.isLoggable() {</pre></code><tr><td>75<td><code><pre> return</pre></code><tr><td>76<td><code><pre> }</pre></code><tr><td>77<td><code><pre> if g.logLevel <= logger.Silent {</pre></code><tr class=miss><td>78<td><code><pre> return</pre></code><tr><td>79<td><code><pre> }</pre></code><tr><td>80<td><code><pre></pre></code><tr><td>81<td><code><pre> elapsed := time.Since(begin)</pre></code><tr><td>82<td><code><pre> switch {</pre></code><tr><td>83<td><code><pre> case err != nil && g.logLevel >= logger.Error &&</pre></code><tr><td>84<td><code><pre> (!errors.Is(err, gorm.ErrRecordNotFound) || !g.ignoreRecordNotFoundError):</pre></code><tr class=miss><td>85<td><code><pre> sql, rows := fc()</pre></code><tr class=miss><td>86<td><code><pre> sql = fmt.Sprintf("err[%%s] %s", sql)</pre></code><tr class=miss><td>87<td><code><pre> if rows == -1 {</pre></code><tr class=miss><td>88<td><code><pre> g.logger().Info(ctx, sql, err.Error(), g.fields(log.Fields{"latency": elapsed.Milliseconds()}))</pre></code><tr><td>89<td><code><pre> } else {</pre></code><tr class=miss><td>90<td><code><pre> g.logger().Info(ctx, sql, err.Error(),</pre></code><tr><td>91<td><code><pre> g.fields(log.Fields{"rows": rows, "latency": elapsed.Milliseconds()}))</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre> case elapsed > g.slowThreshold && g.slowThreshold != 0 && g.logLevel >= logger.Warn:</pre></code><tr class=miss><td>94<td><code><pre> sql, rows := fc()</pre></code><tr class=miss><td>95<td><code><pre> slowLog := fmt.Sprintf("SLOW SQL >= %v %s", g.slowThreshold, g.format(sql))</pre></code><tr class=miss><td>96<td><code><pre> if rows == -1 {</pre></code><tr class=miss><td>97<td><code><pre> g.logger().Info(ctx, slowLog, g.fields(log.Fields{"latency": elapsed.Milliseconds()}))</pre></code><tr><td>98<td><code><pre> } else {</pre></code><tr class=miss><td>99<td><code><pre> g.logger().Info(ctx, slowLog, g.fields(log.Fields{"rows": rows, "latency": elapsed.Milliseconds()}))</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre> case g.logLevel == logger.Info:</pre></code><tr><td>102<td><code><pre> sql, rows := fc()</pre></code><tr><td>103<td><code><pre> sql = g.format(sql)</pre></code><tr><td>104<td><code><pre> if rows == -1 {</pre></code><tr><td>105<td><code><pre> g.logger().Info(ctx, sql, g.fields(log.Fields{"latency": elapsed.Milliseconds()}))</pre></code><tr><td>106<td><code><pre> } else {</pre></code><tr><td>107<td><code><pre> g.logger().Info(ctx, sql, g.fields(log.Fields{"rows": rows, "latency": elapsed.Milliseconds()}))</pre></code><tr><td>108<td><code><pre> }</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormLogger.getLogLevel>func gormLogger.getLogLevel</div><div class=info><a href=#s_fn_gormLogger.getLogLevel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/gorm.go</code>:</div><table class=listing><tr><td>135<td><code><pre>func (g *gormLogger) getLogLevel(level string) logger.LogLevel {</pre></code><tr><td>136<td><code><pre> switch strings.ToLower(level) {</pre></code><tr><td>137<td><code><pre> case "debug":</pre></code><tr class=miss><td>138<td><code><pre> return logger.Info</pre></code><tr><td>139<td><code><pre> case "info":</pre></code><tr><td>140<td><code><pre> return logger.Info</pre></code><tr><td>141<td><code><pre> case "warn":</pre></code><tr class=miss><td>142<td><code><pre> return logger.Warn</pre></code><tr><td>143<td><code><pre> case "error":</pre></code><tr class=miss><td>144<td><code><pre> return logger.Error</pre></code><tr><td>145<td><code><pre> default:</pre></code><tr class=miss><td>146<td><code><pre> return g.logLevel</pre></code><tr><td>147<td><code><pre> }</pre></code><tr><td>148<td><code><pre>}</pre></code></table><div class=funcname id=fn_httpLogger.Debugf>func httpLogger.Debugf</div><div class=info><a href=#s_fn_httpLogger.Debugf>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/http.go</code>:</div><table class=listing><tr><td>48<td><code><pre>func (h *httpLogger) Debugf(format string, v ...any) {</pre></code><tr><td>49<td><code><pre> if h.reloadConfig(); h.enabled {</pre></code><tr class=miss><td>50<td><code><pre> ctx, args := h.parseArgs(v...)</pre></code><tr class=miss><td>51<td><code><pre> h.logger().Debug(ctx, format, args...)</pre></code><tr><td>52<td><code><pre> }</pre></code><tr><td>53<td><code><pre>}</pre></code></table><div class=funcname id=fn_httpLogger.Errorf>func httpLogger.Errorf</div><div class=info><a href=#s_fn_httpLogger.Errorf>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/http.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func (h *httpLogger) Errorf(format string, v ...any) {</pre></code><tr><td>37<td><code><pre> if h.reloadConfig(); h.enabled {</pre></code><tr class=miss><td>38<td><code><pre> ctx, args := h.parseArgs(v...)</pre></code><tr class=miss><td>39<td><code><pre> h.logger().Error(ctx, format, args...)</pre></code><tr><td>40<td><code><pre> }</pre></code><tr><td>41<td><code><pre>}</pre></code></table><div class=funcname id=fn_@64:9>func @64:9</div><div class=info><a href=#s_fn_@64:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/redis.go</code>:</div><table class=listing><tr><td>64<td><code><pre>func(ctx context.Context, cmds []rdsDrv.Cmder) (err error) {</pre></code><tr><td>65<td><code><pre> if !r.isLoggable() {</pre></code><tr><td>66<td><code><pre> return next(ctx, cmds)</pre></code><tr><td>67<td><code><pre> }</pre></code><tr class=miss><td>68<td><code><pre> begin := time.Now()</pre></code><tr class=miss><td>69<td><code><pre> fullNameSb := new(strings.Builder)</pre></code><tr class=miss><td>70<td><code><pre> for _, cmd := range cmds {</pre></code><tr class=miss><td>71<td><code><pre> _, _ = fullNameSb.WriteString(cmd.FullName() + " -> ")</pre></code><tr><td>72<td><code><pre> }</pre></code><tr><td>73<td><code><pre></pre></code><tr class=miss><td>74<td><code><pre> if err = next(ctx, cmds); err != nil {</pre></code><tr class=miss><td>75<td><code><pre> r.logger().Warn(ctx, "%s failed", fullNameSb.String(),</pre></code><tr><td>76<td><code><pre> r.fields(log.Fields{"latency": time.Since(begin).Milliseconds()}))</pre></code><tr class=miss><td>77<td><code><pre> return</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre></pre></code><tr class=miss><td>80<td><code><pre> r.logger().Info(ctx, "%s succeeded", fullNameSb.String(),</pre></code><tr><td>81<td><code><pre> r.fields(log.Fields{"latency": time.Since(begin).Milliseconds()}))</pre></code><tr class=miss><td>82<td><code><pre> return</pre></code><tr><td>83<td><code><pre> }</pre></code></table><div class=funcname id=fn_httpLogger.parseArgs>func httpLogger.parseArgs</div><div class=info><a href=#s_fn_httpLogger.parseArgs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/http.go</code>:</div><table class=listing><tr><td>62<td><code><pre>func (h *httpLogger) parseArgs(args ...any) (ctx context.Context, params []any) {</pre></code><tr class=miss><td>63<td><code><pre> var ok bool</pre></code><tr><td>64<td><code><pre></pre></code><tr class=miss><td>65<td><code><pre> if len(args) == 0 {</pre></code><tr class=miss><td>66<td><code><pre> return context.Background(), []any{httpFields}</pre></code><tr><td>67<td><code><pre> }</pre></code><tr class=miss><td>68<td><code><pre> if len(args) == 1 {</pre></code><tr class=miss><td>69<td><code><pre> args = append(args, httpFields)</pre></code><tr class=miss><td>70<td><code><pre> return context.Background(), args</pre></code><tr><td>71<td><code><pre> }</pre></code><tr><td>72<td><code><pre></pre></code><tr class=miss><td>73<td><code><pre> params = args</pre></code><tr class=miss><td>74<td><code><pre> ctx, ok = args[0].(context.Context)</pre></code><tr class=miss><td>75<td><code><pre> if ok {</pre></code><tr class=miss><td>76<td><code><pre> params = args[1:]</pre></code><tr><td>77<td><code><pre> }</pre></code><tr><td>78<td><code><pre></pre></code><tr class=miss><td>79<td><code><pre> if ctx == nil {</pre></code><tr class=miss><td>80<td><code><pre> ctx = context.Background()</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre></pre></code><tr class=miss><td>83<td><code><pre> params = append(params, httpFields)</pre></code><tr class=miss><td>84<td><code><pre> return</pre></code><tr><td>85<td><code><pre>}</pre></code></table><div class=funcname id=fn_routineLogger.parseArgs>func routineLogger.parseArgs</div><div class=info><a href=#s_fn_routineLogger.parseArgs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/routine.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func (r *routineLogger) parseArgs(args ...any) (ctx context.Context, params []any) {</pre></code><tr class=miss><td>53<td><code><pre> var ok bool</pre></code><tr><td>54<td><code><pre></pre></code><tr class=miss><td>55<td><code><pre> if len(args) == 0 {</pre></code><tr class=miss><td>56<td><code><pre> return context.Background(), []any{routineFields}</pre></code><tr><td>57<td><code><pre> }</pre></code><tr class=miss><td>58<td><code><pre> if len(args) == 1 {</pre></code><tr class=miss><td>59<td><code><pre> args = append(args, routineFields)</pre></code><tr class=miss><td>60<td><code><pre> return context.Background(), args</pre></code><tr><td>61<td><code><pre> }</pre></code><tr><td>62<td><code><pre></pre></code><tr class=miss><td>63<td><code><pre> params = args</pre></code><tr class=miss><td>64<td><code><pre> ctx, ok = args[0].(context.Context)</pre></code><tr class=miss><td>65<td><code><pre> if ok {</pre></code><tr class=miss><td>66<td><code><pre> params = args[1:]</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre></pre></code><tr class=miss><td>69<td><code><pre> if ctx == nil {</pre></code><tr class=miss><td>70<td><code><pre> ctx = context.Background()</pre></code><tr><td>71<td><code><pre> }</pre></code><tr><td>72<td><code><pre></pre></code><tr class=miss><td>73<td><code><pre> params = append(params, routineFields)</pre></code><tr class=miss><td>74<td><code><pre> return</pre></code><tr><td>75<td><code><pre>}</pre></code></table><div class=funcname id=fn_mqLogger.Error>func mqLogger.Error</div><div class=info><a href=#s_fn_mqLogger.Error>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mq.go</code>:</div><table class=listing><tr><td>44<td><code><pre>func (m *mqLogger) Error(msg string, err error, fields watermill.LogFields) {</pre></code><tr class=miss><td>45<td><code><pre> if !m.isLoggable() {</pre></code><tr class=miss><td>46<td><code><pre> return</pre></code><tr><td>47<td><code><pre> }</pre></code><tr class=miss><td>48<td><code><pre> ctx, fs := m.parseLogFields(fields)</pre></code><tr class=miss><td>49<td><code><pre> if err != nil {</pre></code><tr class=miss><td>50<td><code><pre> m.logger().Error(ctx, msg+": %s", err, fs)</pre></code><tr><td>51<td><code><pre> } else {</pre></code><tr class=miss><td>52<td><code><pre> m.logger().Error(ctx, msg, err, fs)</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre>}</pre></code></table><div class=funcname id=fn_asyncLogger.Debug>func asyncLogger.Debug</div><div class=info><a href=#s_fn_asyncLogger.Debug>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/async.go</code>:</div><table class=listing><tr><td>51<td><code><pre>func (a *asyncLogger) Debug(args ...any) {</pre></code><tr class=miss><td>52<td><code><pre> if !a.isLoggable() {</pre></code><tr class=miss><td>53<td><code><pre> return</pre></code><tr><td>54<td><code><pre> }</pre></code><tr class=miss><td>55<td><code><pre> ctx, format, args := a.parseArgs(args...)</pre></code><tr class=miss><td>56<td><code><pre> a.logger().Debug(ctx, format, args...)</pre></code><tr><td>57<td><code><pre>}</pre></code></table><div class=funcname id=fn_asyncLogger.Warn>func asyncLogger.Warn</div><div class=info><a href=#s_fn_asyncLogger.Warn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/async.go</code>:</div><table class=listing><tr><td>69<td><code><pre>func (a *asyncLogger) Warn(args ...any) {</pre></code><tr class=miss><td>70<td><code><pre> if !a.isLoggable() {</pre></code><tr class=miss><td>71<td><code><pre> return</pre></code><tr><td>72<td><code><pre> }</pre></code><tr class=miss><td>73<td><code><pre> ctx, format, args := a.parseArgs(args...)</pre></code><tr class=miss><td>74<td><code><pre> a.logger().Warn(ctx, format, args...)</pre></code><tr><td>75<td><code><pre>}</pre></code></table><div class=funcname id=fn_cronLogger.Error>func cronLogger.Error</div><div class=info><a href=#s_fn_cronLogger.Error>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/cron.go</code>:</div><table class=listing><tr><td>78<td><code><pre>func (c *cronLogger) Error(args ...any) {</pre></code><tr class=miss><td>79<td><code><pre> if !c.isLoggable() {</pre></code><tr class=miss><td>80<td><code><pre> return</pre></code><tr><td>81<td><code><pre> }</pre></code><tr class=miss><td>82<td><code><pre> ctx, format, args := c.parseArgs(args...)</pre></code><tr class=miss><td>83<td><code><pre> c.logger().Error(ctx, format, args...)</pre></code><tr><td>84<td><code><pre>}</pre></code></table><div class=funcname id=fn_asyncLogger.Error>func asyncLogger.Error</div><div class=info><a href=#s_fn_asyncLogger.Error>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/async.go</code>:</div><table class=listing><tr><td>78<td><code><pre>func (a *asyncLogger) Error(args ...any) {</pre></code><tr class=miss><td>79<td><code><pre> if !a.isLoggable() {</pre></code><tr class=miss><td>80<td><code><pre> return</pre></code><tr><td>81<td><code><pre> }</pre></code><tr class=miss><td>82<td><code><pre> ctx, format, args := a.parseArgs(args...)</pre></code><tr class=miss><td>83<td><code><pre> a.logger().Error(ctx, format, args...)</pre></code><tr><td>84<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricsLogger.Fatal>func metricsLogger.Fatal</div><div class=info><a href=#s_fn_metricsLogger.Fatal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/metrics.go</code>:</div><table class=listing><tr><td>84<td><code><pre>func (m *metricsLogger) Fatal(args ...any) {</pre></code><tr class=miss><td>85<td><code><pre> if !m.isLoggable() {</pre></code><tr class=miss><td>86<td><code><pre> return</pre></code><tr><td>87<td><code><pre> }</pre></code><tr class=miss><td>88<td><code><pre> ctx, format, args := m.parseArgs(args...)</pre></code><tr class=miss><td>89<td><code><pre> m.logger().Fatal(ctx, format, args...)</pre></code><tr><td>90<td><code><pre>}</pre></code></table><div class=funcname id=fn_cronLogger.Fatal>func cronLogger.Fatal</div><div class=info><a href=#s_fn_cronLogger.Fatal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/cron.go</code>:</div><table class=listing><tr><td>88<td><code><pre>func (c *cronLogger) Fatal(args ...any) {</pre></code><tr class=miss><td>89<td><code><pre> if !c.isLoggable() {</pre></code><tr class=miss><td>90<td><code><pre> return</pre></code><tr><td>91<td><code><pre> }</pre></code><tr class=miss><td>92<td><code><pre> ctx, format, args := c.parseArgs(args...)</pre></code><tr class=miss><td>93<td><code><pre> c.logger().Fatal(ctx, format, args...)</pre></code><tr><td>94<td><code><pre>}</pre></code></table><div class=funcname id=fn_asyncLogger.Fatal>func asyncLogger.Fatal</div><div class=info><a href=#s_fn_asyncLogger.Fatal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/async.go</code>:</div><table class=listing><tr><td>88<td><code><pre>func (a *asyncLogger) Fatal(args ...any) {</pre></code><tr class=miss><td>89<td><code><pre> if !a.isLoggable() {</pre></code><tr class=miss><td>90<td><code><pre> return</pre></code><tr><td>91<td><code><pre> }</pre></code><tr class=miss><td>92<td><code><pre> ctx, format, args := a.parseArgs(args...)</pre></code><tr class=miss><td>93<td><code><pre> a.logger().Fatal(ctx, format, args...)</pre></code><tr><td>94<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricsLogger.Error>func metricsLogger.Error</div><div class=info><a href=#s_fn_metricsLogger.Error>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/metrics.go</code>:</div><table class=listing><tr><td>74<td><code><pre>func (m *metricsLogger) Error(args ...any) {</pre></code><tr class=miss><td>75<td><code><pre> if !m.isLoggable() {</pre></code><tr class=miss><td>76<td><code><pre> return</pre></code><tr><td>77<td><code><pre> }</pre></code><tr class=miss><td>78<td><code><pre> ctx, format, args := m.parseArgs(args...)</pre></code><tr class=miss><td>79<td><code><pre> m.logger().Error(ctx, format, args...)</pre></code><tr><td>80<td><code><pre>}</pre></code></table><div class=funcname id=fn_httpLogger.Warnf>func httpLogger.Warnf</div><div class=info><a href=#s_fn_httpLogger.Warnf>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/http.go</code>:</div><table class=listing><tr><td>42<td><code><pre>func (h *httpLogger) Warnf(format string, v ...any) {</pre></code><tr class=miss><td>43<td><code><pre> if h.reloadConfig(); h.enabled {</pre></code><tr class=miss><td>44<td><code><pre> ctx, args := h.parseArgs(v...)</pre></code><tr class=miss><td>45<td><code><pre> h.logger().Info(ctx, format, args...)</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricsLogger.Printf>func metricsLogger.Printf</div><div class=info><a href=#s_fn_metricsLogger.Printf>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/metrics.go</code>:</div><table class=listing><tr><td>39<td><code><pre>func (m *metricsLogger) Printf(format string, args ...any) {</pre></code><tr class=miss><td>40<td><code><pre> if !m.isLoggable() {</pre></code><tr class=miss><td>41<td><code><pre> return</pre></code><tr><td>42<td><code><pre> }</pre></code><tr class=miss><td>43<td><code><pre> m.logger().Info(context.Background(), format, append(args, metricsFields)...)</pre></code><tr><td>44<td><code><pre>}</pre></code></table><div class=funcname id=fn_DefaultMongoLogger>func DefaultMongoLogger</div><div class=info><a href=#s_fn_DefaultMongoLogger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mongo.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func DefaultMongoLogger() (logger *mongoLogger) {</pre></code><tr class=miss><td>42<td><code><pre> logger = &mongoLogger{</pre></code><tr><td>43<td><code><pre> enabled: true,</pre></code><tr><td>44<td><code><pre> requestMap: make(map[int64]struct{ commandString string }),</pre></code><tr><td>45<td><code><pre> loggableCommandSet: utils.NewSet[string](</pre></code><tr><td>46<td><code><pre> "ping",</pre></code><tr><td>47<td><code><pre> "insert",</pre></code><tr><td>48<td><code><pre> "find",</pre></code><tr><td>49<td><code><pre> "update",</pre></code><tr><td>50<td><code><pre> "delete",</pre></code><tr><td>51<td><code><pre> "aggregate",</pre></code><tr><td>52<td><code><pre> "distinct",</pre></code><tr><td>53<td><code><pre> "count",</pre></code><tr><td>54<td><code><pre> "findAndModify",</pre></code><tr><td>55<td><code><pre> "getMore",</pre></code><tr><td>56<td><code><pre> "killCursors",</pre></code><tr><td>57<td><code><pre> "create",</pre></code><tr><td>58<td><code><pre> "drop",</pre></code><tr><td>59<td><code><pre> "listDatabases",</pre></code><tr><td>60<td><code><pre> "dropDatabase",</pre></code><tr><td>61<td><code><pre> "createIndexes",</pre></code><tr><td>62<td><code><pre> "listIndexes",</pre></code><tr><td>63<td><code><pre> "dropIndexes",</pre></code><tr><td>64<td><code><pre> "listCollections",</pre></code><tr><td>65<td><code><pre> ),</pre></code><tr><td>66<td><code><pre> }</pre></code><tr class=miss><td>67<td><code><pre> logger.CommandMonitor = &event.CommandMonitor{</pre></code><tr><td>68<td><code><pre> Started: logger.started,</pre></code><tr><td>69<td><code><pre> Succeeded: logger.succeeded,</pre></code><tr><td>70<td><code><pre> Failed: logger.failed,</pre></code><tr><td>71<td><code><pre> }</pre></code><tr class=miss><td>72<td><code><pre> return</pre></code><tr><td>73<td><code><pre>}</pre></code></table><div class=funcname id=fn_httpLogger.logger>func httpLogger.logger</div><div class=info><a href=#s_fn_httpLogger.logger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/http.go</code>:</div><table class=listing><tr><td>55<td><code><pre>func (h *httpLogger) logger() log.Loggable {</pre></code><tr class=miss><td>56<td><code><pre> if h.log != nil {</pre></code><tr class=miss><td>57<td><code><pre> return h.log</pre></code><tr><td>58<td><code><pre> }</pre></code><tr class=miss><td>59<td><code><pre> return log.Use(config.DefaultInstanceKey, log.AppName(h.appName))</pre></code><tr><td>60<td><code><pre>}</pre></code></table><div class=funcname id=fn_routineLogger.Printf>func routineLogger.Printf</div><div class=info><a href=#s_fn_routineLogger.Printf>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/routine.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func (r *routineLogger) Printf(format string, args ...any) {</pre></code><tr class=miss><td>39<td><code><pre> if r.reloadConfig(); r.enabled {</pre></code><tr class=miss><td>40<td><code><pre> ctx, args := r.parseArgs(args...)</pre></code><tr class=miss><td>41<td><code><pre> r.logger().Info(ctx, format, args...)</pre></code><tr><td>42<td><code><pre> }</pre></code><tr><td>43<td><code><pre>}</pre></code></table><div class=funcname id=fn_asyncLogger.Printf>func asyncLogger.Printf</div><div class=info><a href=#s_fn_asyncLogger.Printf>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/async.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func (a *asyncLogger) Printf(format string, args ...any) {</pre></code><tr class=miss><td>44<td><code><pre> if !a.isLoggable() {</pre></code><tr class=miss><td>45<td><code><pre> return</pre></code><tr><td>46<td><code><pre> }</pre></code><tr class=miss><td>47<td><code><pre> a.logger().Info(context.Background(), format, append(args, asyncFields)...)</pre></code><tr><td>48<td><code><pre>}</pre></code></table><div class=funcname id=fn_routineLogger.logger>func routineLogger.logger</div><div class=info><a href=#s_fn_routineLogger.logger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/routine.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func (r *routineLogger) logger() log.Loggable {</pre></code><tr class=miss><td>46<td><code><pre> if r.log != nil {</pre></code><tr class=miss><td>47<td><code><pre> return r.log</pre></code><tr><td>48<td><code><pre> }</pre></code><tr class=miss><td>49<td><code><pre> return log.Use(config.DefaultInstanceKey, log.AppName(r.appName))</pre></code><tr><td>50<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormLogger.Error>func gormLogger.Error</div><div class=info><a href=#s_fn_gormLogger.Error>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/gorm.go</code>:</div><table class=listing><tr><td>66<td><code><pre>func (g *gormLogger) Error(ctx context.Context, msg string, data ...any) {</pre></code><tr class=miss><td>67<td><code><pre> if g.isLoggable() && g.logLevel >= logger.Error {</pre></code><tr class=miss><td>68<td><code><pre> g.logger().Error(ctx, msg, append(data, dbFields)...)</pre></code><tr><td>69<td><code><pre> }</pre></code><tr><td>70<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormLogger.LogMode>func gormLogger.LogMode</div><div class=info><a href=#s_fn_gormLogger.LogMode>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/gorm.go</code>:</div><table class=listing><tr><td>46<td><code><pre>func (g *gormLogger) LogMode(level logger.LogLevel) logger.Interface {</pre></code><tr class=miss><td>47<td><code><pre> g.logLevel = level</pre></code><tr class=miss><td>48<td><code><pre> return g</pre></code><tr><td>49<td><code><pre>}</pre></code></table><div class=funcname id=fn_gormLogger.Warn>func gormLogger.Warn</div><div class=info><a href=#s_fn_gormLogger.Warn>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/gorm.go</code>:</div><table class=listing><tr><td>59<td><code><pre>func (g *gormLogger) Warn(ctx context.Context, msg string, data ...any) {</pre></code><tr class=miss><td>60<td><code><pre> if g.isLoggable() && g.logLevel >= logger.Warn {</pre></code><tr class=miss><td>61<td><code><pre> g.logger().Warn(ctx, msg, append(data, dbFields)...)</pre></code><tr><td>62<td><code><pre> }</pre></code><tr><td>63<td><code><pre>}</pre></code></table><div class=funcname id=fn_DefaultHttpLogger>func DefaultHttpLogger</div><div class=info><a href=#s_fn_DefaultHttpLogger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/http.go</code>:</div><table class=listing><tr><td>20<td><code><pre>func DefaultHttpLogger() resty.Logger {</pre></code><tr class=miss><td>21<td><code><pre> return new(httpLogger)</pre></code><tr><td>22<td><code><pre>}</pre></code></table><div class=funcname id=fn_DefaultRoutineLogger>func DefaultRoutineLogger</div><div class=info><a href=#s_fn_DefaultRoutineLogger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/routine.go</code>:</div><table class=listing><tr><td>20<td><code><pre>func DefaultRoutineLogger() ants.Logger {</pre></code><tr class=miss><td>21<td><code><pre> return &routineLogger{</pre></code><tr><td>22<td><code><pre> enabled: true,</pre></code><tr><td>23<td><code><pre> }</pre></code><tr><td>24<td><code><pre>}</pre></code></table><div class=funcname id=fn_DefaultAsyncLogger>func DefaultAsyncLogger</div><div class=info><a href=#s_fn_DefaultAsyncLogger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/async.go</code>:</div><table class=listing><tr><td>21<td><code><pre>func DefaultAsyncLogger() interface{ Printf(string, ...any) } {</pre></code><tr class=miss><td>22<td><code><pre> return &asyncLogger{}</pre></code><tr><td>23<td><code><pre>}</pre></code></table><div class=funcname id=fn_DefaultAsynqAsyncLogger>func DefaultAsynqAsyncLogger</div><div class=info><a href=#s_fn_DefaultAsynqAsyncLogger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/async.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func DefaultAsynqAsyncLogger() asynq.Logger {</pre></code><tr class=miss><td>26<td><code><pre> return &asyncLogger{}</pre></code><tr><td>27<td><code><pre>}</pre></code></table><div class=funcname id=fn_DefaultMySQLLogger>func DefaultMySQLLogger</div><div class=info><a href=#s_fn_DefaultMySQLLogger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/gorm.go</code>:</div><table class=listing><tr><td>26<td><code><pre>func DefaultMySQLLogger() logger.Interface {</pre></code><tr class=miss><td>27<td><code><pre> return &gormLogger{</pre></code><tr><td>28<td><code><pre> enabled: true,</pre></code><tr><td>29<td><code><pre> slowThreshold: 200 * time.Millisecond,</pre></code><tr><td>30<td><code><pre> logLevel: logger.Silent,</pre></code><tr><td>31<td><code><pre> ignoreRecordNotFoundError: true,</pre></code><tr><td>32<td><code><pre> }</pre></code><tr><td>33<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewLogger>func NewLogger</div><div class=info><a href=#s_fn_NewLogger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/mq.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func NewLogger() watermill.LoggerAdapter {</pre></code><tr class=miss><td>33<td><code><pre> return new(mqLogger)</pre></code><tr><td>34<td><code><pre>}</pre></code></table><div class=funcname id=fn_DefaultAsynqCronLogger>func DefaultAsynqCronLogger</div><div class=info><a href=#s_fn_DefaultAsynqCronLogger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/cron.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func DefaultAsynqCronLogger() asynq.Logger {</pre></code><tr class=miss><td>26<td><code><pre> return &cronLogger{}</pre></code><tr><td>27<td><code><pre>}</pre></code></table><div class=funcname id=fn_DefaultMetricsLogger>func DefaultMetricsLogger</div><div class=info><a href=#s_fn_DefaultMetricsLogger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/customlogger/metrics.go</code>:</div><table class=listing><tr><td>21<td><code><pre>func DefaultMetricsLogger() metrics.Logger {</pre></code><tr class=miss><td>22<td><code><pre> return &metricsLogger{}</pre></code><tr><td>23<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/log/encoder class=funcname>Package Overview: github.com/wfusion/gofusion/log/encoder 38 <span class=packageTotal>100.0%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_@58:9><td><code><a href=#fn_@58:9>@58:9(...)</a></code><td><code>github.com/wfusion/gofusion/log/encoder/skip_caller.go</code><td class=percent><code>100.0%</code><td class=linecount><code>8/8</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/log/encoder/skip_caller.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_SkipCallerEncoder><td><code><a href=#fn_SkipCallerEncoder>SkipCallerEncoder(...)</a></code><td><code>github.com/wfusion/gofusion/log/encoder/skip_caller.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code></table><div class=funcname id=fn_@58:9>func @58:9</div><div class=info><a href=#s_fn_@58:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/encoder/skip_caller.go</code>:</div><table class=listing><tr><td>58<td><code><pre>func(entryCaller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder) {</pre></code><tr><td>59<td><code><pre> caller := utils.GetCaller(</pre></code><tr><td>60<td><code><pre> maximumCallerDepth,</pre></code><tr><td>61<td><code><pre> skipGlobOpt,</pre></code><tr><td>62<td><code><pre> defaultSuffixedRegOpt,</pre></code><tr><td>63<td><code><pre> minimumCallerDepthOpt,</pre></code><tr><td>64<td><code><pre> )</pre></code><tr><td>65<td><code><pre></pre></code><tr><td>66<td><code><pre> entryCaller.PC = caller.PC</pre></code><tr><td>67<td><code><pre> entryCaller.File = caller.File</pre></code><tr><td>68<td><code><pre> entryCaller.Line = caller.Line</pre></code><tr><td>69<td><code><pre> entryCaller.Function = caller.Function</pre></code><tr><td>70<td><code><pre> if shorter {</pre></code><tr><td>71<td><code><pre> enc.AppendString(entryCaller.TrimmedPath())</pre></code><tr><td>72<td><code><pre> } else {</pre></code><tr><td>73<td><code><pre> enc.AppendString(entryCaller.FullPath())</pre></code><tr><td>74<td><code><pre> }</pre></code><tr><td>75<td><code><pre> }</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/encoder/skip_caller.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func init() {</pre></code><tr><td>50<td><code><pre> defaultSuffixedRegOpt = utils.SkipRegexps(defaultSuffixesRegPatternList...)</pre></code><tr><td>51<td><code><pre> minimumCallerDepthOpt = utils.SkipKnownDepth(knownLogrusFrames)</pre></code><tr><td>52<td><code><pre>}</pre></code></table><div class=funcname id=fn_SkipCallerEncoder>func SkipCallerEncoder</div><div class=info><a href=#s_fn_SkipCallerEncoder>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/log/encoder/skip_caller.go</code>:</div><table class=listing><tr><td>55<td><code><pre>func SkipCallerEncoder(skipSuffixed []string, shorter bool) func(</pre></code><tr><td>56<td><code><pre> caller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder) {</pre></code><tr><td>57<td><code><pre> skipGlobOpt := utils.SkipGlobs(skipSuffixed...)</pre></code><tr><td>58<td><code><pre> return func(entryCaller zapcore.EntryCaller, enc zapcore.PrimitiveArrayEncoder) {</pre></code><tr><td>59<td><code><pre> caller := utils.GetCaller(</pre></code><tr><td>60<td><code><pre> maximumCallerDepth,</pre></code><tr><td>61<td><code><pre> skipGlobOpt,</pre></code><tr><td>62<td><code><pre> defaultSuffixedRegOpt,</pre></code><tr><td>63<td><code><pre> minimumCallerDepthOpt,</pre></code><tr><td>64<td><code><pre> )</pre></code><tr><td>65<td><code><pre></pre></code><tr><td>66<td><code><pre> entryCaller.PC = caller.PC</pre></code><tr><td>67<td><code><pre> entryCaller.File = caller.File</pre></code><tr><td>68<td><code><pre> entryCaller.Line = caller.Line</pre></code><tr><td>69<td><code><pre> entryCaller.Function = caller.Function</pre></code><tr><td>70<td><code><pre> if shorter {</pre></code><tr><td>71<td><code><pre> enc.AppendString(entryCaller.TrimmedPath())</pre></code><tr><td>72<td><code><pre> } else {</pre></code><tr><td>73<td><code><pre> enc.AppendString(entryCaller.FullPath())</pre></code><tr><td>74<td><code><pre> }</pre></code><tr><td>75<td><code><pre> }</pre></code><tr><td>76<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/metrics class=funcname>Package Overview: github.com/wfusion/gofusion/metrics 39 <span class=packageTotal>72.6%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_@32:9><td><code><a href=#fn_@32:9>@32:9(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>13/13</code><tr id=s_fn_Internal><td><code><a href=#fn_Internal>Internal(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>11/11</code><tr id=s_fn_abstract.convertOpts><td><code><a href=#fn_abstract.convertOpts>abstract.convertOpts(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>9/9</code><tr id=s_fn_Construct><td><code><a href=#fn_Construct>Construct(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_@243:5><td><code><a href=#fn_@243:5>@243:5(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_newMock><td><code><a href=#fn_newMock>newMock(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/mock.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_abstract.convertLabels><td><code><a href=#fn_abstract.convertLabels>abstract.convertLabels(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@120:9><td><code><a href=#fn_@120:9>@120:9(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@126:9><td><code><a href=#fn_@126:9>@126:9(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Labels><td><code><a href=#fn_Labels>Labels(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/flag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_WithoutTimeout><td><code><a href=#fn_WithoutTimeout>WithoutTimeout(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@114:9><td><code><a href=#fn_@114:9>@114:9(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@285:57><td><code><a href=#fn_@285:57>@285:57(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_abstract.SetGauge><td><code><a href=#fn_abstract.SetGauge>abstract.SetGauge(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_abstract.IncrCounter><td><code><a href=#fn_abstract.IncrCounter>abstract.IncrCounter(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@262:36><td><code><a href=#fn_@262:36>@262:36(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_abstract.MeasureSince><td><code><a href=#fn_abstract.MeasureSince>abstract.MeasureSince(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_abstract.IsEnableServiceLabel><td><code><a href=#fn_abstract.IsEnableServiceLabel>abstract.IsEnableServiceLabel(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Timeout><td><code><a href=#fn_Timeout>Timeout(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@108:9><td><code><a href=#fn_@108:9>@108:9(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Precision><td><code><a href=#fn_Precision>Precision(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_abstract.start><td><code><a href=#fn_abstract.start>abstract.start(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_AppName><td><code><a href=#fn_AppName>AppName(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@108:9><td><code><a href=#fn_@108:9>@108:9(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@102:9><td><code><a href=#fn_@102:9>@102:9(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_abstract.AddSample><td><code><a href=#fn_abstract.AddSample>abstract.AddSample(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_PrometheusBuckets><td><code><a href=#fn_PrometheusBuckets>PrometheusBuckets(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@336:33><td><code><a href=#fn_@336:33>@336:33(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_newMetrics><td><code><a href=#fn_newMetrics>newMetrics(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>96.0%</code><td class=linecount><code>24/25</code><tr id=s_fn_addConfig><td><code><a href=#fn_addConfig>addConfig(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/construct.go</code><td class=percent><code>90.9%</code><td class=linecount><code>20/22</code><tr id=s_fn_use><td><code><a href=#fn_use>use(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/construct.go</code><td class=percent><code>87.0%</code><td class=linecount><code>20/23</code><tr id=s_fn_abstract.addSampleWithLabels><td><code><a href=#fn_abstract.addSampleWithLabels>abstract.addSampleWithLabels(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_@279:23><td><code><a href=#fn_@279:23>@279:23(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_abstract.setGaugeWithLabels><td><code><a href=#fn_abstract.setGaugeWithLabels>abstract.setGaugeWithLabels(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_Use><td><code><a href=#fn_Use>Use(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/construct.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_abstract.shutdown><td><code><a href=#fn_abstract.shutdown>abstract.shutdown(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_abstract.incrCounterWithLabels><td><code><a href=#fn_abstract.incrCounterWithLabels>abstract.incrCounterWithLabels(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_@245:19><td><code><a href=#fn_@245:19>@245:19(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_newPrometheusPush><td><code><a href=#fn_newPrometheusPush>newPrometheusPush(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/prometheus.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_abstract.process><td><code><a href=#fn_abstract.process>abstract.process(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_abstract.measureSinceWithLabels><td><code><a href=#fn_abstract.measureSinceWithLabels>abstract.measureSinceWithLabels(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_@246:25><td><code><a href=#fn_@246:25>@246:25(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>70.0%</code><td class=linecount><code>7/10</code><tr id=s_fn_abstract.send><td><code><a href=#fn_abstract.send>abstract.send(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>24.2%</code><td class=linecount><code>8/33</code><tr id=s_fn_HttpHandler><td><code><a href=#fn_HttpHandler>HttpHandler(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/http.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/12</code><tr id=s_fn_newPrometheusPull><td><code><a href=#fn_newPrometheusPull>newPrometheusPull(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/prometheus.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/8</code><tr id=s_fn_task.String><td><code><a href=#fn_task.String>task.String(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_abstract.getProxy><td><code><a href=#fn_abstract.getProxy>abstract.getProxy(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/metrics.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@114:9><td><code><a href=#fn_@114:9>@114:9(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_NewDI><td><code><a href=#fn_NewDI>NewDI(...)</a></code><td><code>github.com/wfusion/gofusion/metrics/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_@32:9>func @32:9</div><div class=info><a href=#s_fn_@32:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/construct.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func() {</pre></code><tr><td>33<td><code><pre> rwlock.Lock()</pre></code><tr><td>34<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>35<td><code><pre></pre></code><tr><td>36<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>37<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>38<td><code><pre> if appInstances != nil {</pre></code><tr><td>39<td><code><pre> for _, sinks := range appInstances[opt.AppName] {</pre></code><tr><td>40<td><code><pre> for name, sink := range sinks {</pre></code><tr><td>41<td><code><pre> log.Printf("%v [Gofusion] %s %s %s router exiting...",</pre></code><tr><td>42<td><code><pre> pid, app, config.ComponentMetrics, name)</pre></code><tr><td>43<td><code><pre> sink.shutdown()</pre></code><tr><td>44<td><code><pre> log.Printf("%v [Gofusion] %s %s %s router exited",</pre></code><tr><td>45<td><code><pre> pid, app, config.ComponentMetrics, name)</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> delete(appInstances, opt.AppName)</pre></code><tr><td>49<td><code><pre> }</pre></code><tr><td>50<td><code><pre></pre></code><tr><td>51<td><code><pre> if cfgsMap != nil {</pre></code><tr><td>52<td><code><pre> delete(cfgsMap, opt.AppName)</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre> }</pre></code></table><div class=funcname id=fn_Internal>func Internal</div><div class=info><a href=#s_fn_Internal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/construct.go</code>:</div><table class=listing><tr><td>177<td><code><pre>func Internal(opts ...utils.OptionExtender) (sinks []Sink) {</pre></code><tr><td>178<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>179<td><code><pre> appName := config.Use(opt.appName).AppName()</pre></code><tr><td>180<td><code><pre> rwlock.Lock()</pre></code><tr><td>181<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>182<td><code><pre> cfgs, ok := cfgsMap[opt.appName]</pre></code><tr><td>183<td><code><pre> if !ok {</pre></code><tr><td>184<td><code><pre> return</pre></code><tr><td>185<td><code><pre> }</pre></code><tr><td>186<td><code><pre> for _, cfg := range cfgs {</pre></code><tr><td>187<td><code><pre> if cfg.c.EnableInternalMetrics {</pre></code><tr><td>188<td><code><pre> sinks = append(sinks, use(appName, cfg))</pre></code><tr><td>189<td><code><pre> }</pre></code><tr><td>190<td><code><pre> }</pre></code><tr><td>191<td><code><pre> return</pre></code><tr><td>192<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstract.convertOpts>func abstract.convertOpts</div><div class=info><a href=#s_fn_abstract.convertOpts>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>343<td><code><pre>func (a *abstract) convertOpts(src ...utils.OptionExtender) (dst []utils.OptionExtender) {</pre></code><tr><td>344<td><code><pre> if src == nil {</pre></code><tr><td>345<td><code><pre> return</pre></code><tr><td>346<td><code><pre> }</pre></code><tr><td>347<td><code><pre></pre></code><tr><td>348<td><code><pre> dst = make([]utils.OptionExtender, 0, len(src))</pre></code><tr><td>349<td><code><pre> opt := utils.ApplyOptions[option](src...)</pre></code><tr><td>350<td><code><pre> if opt.precision {</pre></code><tr><td>351<td><code><pre> dst = append(dst, metrics.Precision())</pre></code><tr><td>352<td><code><pre> }</pre></code><tr><td>353<td><code><pre> if len(opt.prometheusBuckets) > 0 {</pre></code><tr><td>354<td><code><pre> dst = append(dst, prometheus.Bucket(opt.prometheusBuckets))</pre></code><tr><td>355<td><code><pre> }</pre></code><tr><td>356<td><code><pre></pre></code><tr><td>357<td><code><pre> return</pre></code><tr><td>358<td><code><pre>}</pre></code></table><div class=funcname id=fn_Construct>func Construct</div><div class=info><a href=#s_fn_Construct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/construct.go</code>:</div><table class=listing><tr><td>22<td><code><pre>func Construct(ctx context.Context, confs map[string]*Conf, opts ...utils.OptionExtender) func() {</pre></code><tr><td>23<td><code><pre> opt := utils.ApplyOptions[config.InitOption](opts...)</pre></code><tr><td>24<td><code><pre> optU := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>25<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>26<td><code><pre> opt.AppName = optU.appName</pre></code><tr><td>27<td><code><pre> }</pre></code><tr><td>28<td><code><pre> for name, conf := range confs {</pre></code><tr><td>29<td><code><pre> addConfig(ctx, name, conf, opt)</pre></code><tr><td>30<td><code><pre> }</pre></code><tr><td>31<td><code><pre></pre></code><tr><td>32<td><code><pre> return func() {</pre></code><tr><td>33<td><code><pre> rwlock.Lock()</pre></code><tr><td>34<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>35<td><code><pre></pre></code><tr><td>36<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>37<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>38<td><code><pre> if appInstances != nil {</pre></code><tr><td>39<td><code><pre> for _, sinks := range appInstances[opt.AppName] {</pre></code><tr><td>40<td><code><pre> for name, sink := range sinks {</pre></code><tr><td>41<td><code><pre> log.Printf("%v [Gofusion] %s %s %s router exiting...",</pre></code><tr><td>42<td><code><pre> pid, app, config.ComponentMetrics, name)</pre></code><tr><td>43<td><code><pre> sink.shutdown()</pre></code><tr><td>44<td><code><pre> log.Printf("%v [Gofusion] %s %s %s router exited",</pre></code><tr><td>45<td><code><pre> pid, app, config.ComponentMetrics, name)</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> delete(appInstances, opt.AppName)</pre></code><tr><td>49<td><code><pre> }</pre></code><tr><td>50<td><code><pre></pre></code><tr><td>51<td><code><pre> if cfgsMap != nil {</pre></code><tr><td>52<td><code><pre> delete(cfgsMap, opt.AppName)</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre> }</pre></code><tr><td>55<td><code><pre>}</pre></code></table><div class=funcname id=fn_@243:5>func @243:5</div><div class=info><a href=#s_fn_@243:5>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>243<td><code><pre>func() {</pre></code><tr><td>244<td><code><pre> appName := config.Use(a.appName).AppName()</pre></code><tr><td>245<td><code><pre> _ = retry.Retry(func(attempt uint) (err error) {</pre></code><tr><td>246<td><code><pre> _, err = utils.Catch(func() {</pre></code><tr><td>247<td><code><pre> for {</pre></code><tr><td>248<td><code><pre> select {</pre></code><tr><td>249<td><code><pre> case <-a.ctx.Done():</pre></code><tr><td>250<td><code><pre> if a.log != nil {</pre></code><tr><td>251<td><code><pre> a.log.Info(a.ctx, "%v [Gofusion] %s %s %s process exited due to context done",</pre></code><tr><td>252<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>253<td><code><pre> return</pre></code><tr><td>254<td><code><pre> }</pre></code><tr><td>255<td><code><pre> case task, ok := <-a.queue:</pre></code><tr><td>256<td><code><pre> if !ok {</pre></code><tr><td>257<td><code><pre> a.log.Info(a.ctx, "%v [Gofusion] %s %s %s process exited due to queue closed",</pre></code><tr><td>258<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>259<td><code><pre> return</pre></code><tr><td>260<td><code><pre> }</pre></code><tr><td>261<td><code><pre></pre></code><tr><td>262<td><code><pre> if err := a.queuePool.Submit(func() { _ = a.process(task) }); err != nil && a.log != nil {</pre></code><tr><td>263<td><code><pre> a.log.Error(task.ctx, "%v [Gofusion] %s %s %s submit process %s error: %s",</pre></code><tr><td>264<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics,</pre></code><tr><td>265<td><code><pre> a.name, task, err)</pre></code><tr><td>266<td><code><pre> }</pre></code><tr><td>267<td><code><pre> }</pre></code><tr><td>268<td><code><pre> }</pre></code><tr><td>269<td><code><pre> })</pre></code><tr><td>270<td><code><pre> if err != nil {</pre></code><tr><td>271<td><code><pre> a.log.Warn(a.ctx, "%v [Gofusion] %s %s %s dispatcher exited with error: %s",</pre></code><tr><td>272<td><code><pre> syscall.Getpid(), appName, config.ComponentMetrics, a.name, err)</pre></code><tr><td>273<td><code><pre> }</pre></code><tr><td>274<td><code><pre> return</pre></code><tr><td>275<td><code><pre> }, strategy.Limit(10000))</pre></code><tr><td>276<td><code><pre> }</pre></code></table><div class=funcname id=fn_newMock>func newMock</div><div class=info><a href=#s_fn_newMock>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/mock.go</code>:</div><table class=listing><tr><td>13<td><code><pre>func newMock(ctx context.Context, appName, name, job string, conf *cfg) Sink {</pre></code><tr><td>14<td><code><pre> sink := new(metrics.BlackholeSink)</pre></code><tr><td>15<td><code><pre> return &mock{abstract: newMetrics(ctx, appName, name, job, sink, conf)}</pre></code><tr><td>16<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstract.convertLabels>func abstract.convertLabels</div><div class=info><a href=#s_fn_abstract.convertLabels>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>335<td><code><pre>func (a *abstract) convertLabels(src []Label) (dst []metrics.Label) {</pre></code><tr><td>336<td><code><pre> return utils.SliceMapping(src, func(l Label) metrics.Label {</pre></code><tr><td>337<td><code><pre> return metrics.Label{</pre></code><tr><td>338<td><code><pre> Name: l.Key,</pre></code><tr><td>339<td><code><pre> Value: l.Value,</pre></code><tr><td>340<td><code><pre> }</pre></code><tr><td>341<td><code><pre> })</pre></code><tr><td>342<td><code><pre>}</pre></code></table><div class=funcname id=fn_@120:9>func @120:9</div><div class=info><a href=#s_fn_@120:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/types.go</code>:</div><table class=listing><tr><td>120<td><code><pre>func(o *option) {</pre></code><tr><td>121<td><code><pre> o.timeout = -1</pre></code><tr><td>122<td><code><pre> }</pre></code></table><div class=funcname id=fn_@126:9>func @126:9</div><div class=info><a href=#s_fn_@126:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/types.go</code>:</div><table class=listing><tr><td>126<td><code><pre>func(o *option) {</pre></code><tr><td>127<td><code><pre> o.labels = labels</pre></code><tr><td>128<td><code><pre> }</pre></code></table><div class=funcname id=fn_Labels>func Labels</div><div class=info><a href=#s_fn_Labels>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/types.go</code>:</div><table class=listing><tr><td>125<td><code><pre>func Labels(labels []Label) utils.OptionFunc[option] {</pre></code><tr><td>126<td><code><pre> return func(o *option) {</pre></code><tr><td>127<td><code><pre> o.labels = labels</pre></code><tr><td>128<td><code><pre> }</pre></code><tr><td>129<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/construct.go</code>:</div><table class=listing><tr><td>194<td><code><pre>func init() {</pre></code><tr><td>195<td><code><pre> config.AddComponent(config.ComponentMetrics, Construct, config.WithFlag(&flagString))</pre></code><tr><td>196<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/flag.go</code>:</div><table class=listing><tr><td>7<td><code><pre>func init() {</pre></code><tr><td>8<td><code><pre> pflag.StringVarP(&flagString, "metrics-config", "", "", "json string for metrics config")</pre></code><tr><td>9<td><code><pre>}</pre></code></table><div class=funcname id=fn_WithoutTimeout>func WithoutTimeout</div><div class=info><a href=#s_fn_WithoutTimeout>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/types.go</code>:</div><table class=listing><tr><td>119<td><code><pre>func WithoutTimeout() utils.OptionFunc[option] {</pre></code><tr><td>120<td><code><pre> return func(o *option) {</pre></code><tr><td>121<td><code><pre> o.timeout = -1</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre>}</pre></code></table><div class=funcname id=fn_@114:9>func @114:9</div><div class=info><a href=#s_fn_@114:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/types.go</code>:</div><table class=listing><tr><td>114<td><code><pre>func(o *option) {</pre></code><tr><td>115<td><code><pre> o.timeout = timeout</pre></code><tr><td>116<td><code><pre> }</pre></code></table><div class=funcname id=fn_@285:57>func @285:57</div><div class=info><a href=#s_fn_@285:57>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>285<td><code><pre>func(o utils.OptionExtender) any { return o }</pre></code></table><div class=funcname id=fn_abstract.SetGauge>func abstract.SetGauge</div><div class=info><a href=#s_fn_abstract.SetGauge>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>128<td><code><pre>func (a *abstract) SetGauge(ctx context.Context, key []string, val float64, opts ...utils.OptionExtender) {</pre></code><tr><td>129<td><code><pre> a.send(ctx, "Gauge", key, val, opts...)</pre></code><tr><td>130<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstract.IncrCounter>func abstract.IncrCounter</div><div class=info><a href=#s_fn_abstract.IncrCounter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>131<td><code><pre>func (a *abstract) IncrCounter(ctx context.Context, key []string, val float64, opts ...utils.OptionExtender) {</pre></code><tr><td>132<td><code><pre> a.send(ctx, "Counter", key, val, opts...)</pre></code><tr><td>133<td><code><pre>}</pre></code></table><div class=funcname id=fn_@262:36>func @262:36</div><div class=info><a href=#s_fn_@262:36>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>262<td><code><pre>func() { _ = a.process(task) }</pre></code></table><div class=funcname id=fn_abstract.MeasureSince>func abstract.MeasureSince</div><div class=info><a href=#s_fn_abstract.MeasureSince>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>137<td><code><pre>func (a *abstract) MeasureSince(ctx context.Context, key []string, start time.Time, opts ...utils.OptionExtender) {</pre></code><tr><td>138<td><code><pre> a.send(ctx, "MeasureSince", key, start, opts...)</pre></code><tr><td>139<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstract.IsEnableServiceLabel>func abstract.IsEnableServiceLabel</div><div class=info><a href=#s_fn_abstract.IsEnableServiceLabel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>140<td><code><pre>func (a *abstract) IsEnableServiceLabel() bool { return a.EnableServiceLabel }</pre></code></table><div class=funcname id=fn_Timeout>func Timeout</div><div class=info><a href=#s_fn_Timeout>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/types.go</code>:</div><table class=listing><tr><td>113<td><code><pre>func Timeout(timeout time.Duration) utils.OptionFunc[option] {</pre></code><tr><td>114<td><code><pre> return func(o *option) {</pre></code><tr><td>115<td><code><pre> o.timeout = timeout</pre></code><tr><td>116<td><code><pre> }</pre></code><tr><td>117<td><code><pre>}</pre></code></table><div class=funcname id=fn_@108:9>func @108:9</div><div class=info><a href=#s_fn_@108:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/construct.go</code>:</div><table class=listing><tr><td>108<td><code><pre>func(o *useOption) {</pre></code><tr><td>109<td><code><pre> o.appName = name</pre></code><tr><td>110<td><code><pre> }</pre></code></table><div class=funcname id=fn_Precision>func Precision</div><div class=info><a href=#s_fn_Precision>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/types.go</code>:</div><table class=listing><tr><td>107<td><code><pre>func Precision() utils.OptionFunc[option] {</pre></code><tr><td>108<td><code><pre> return func(o *option) {</pre></code><tr><td>109<td><code><pre> o.precision = true</pre></code><tr><td>110<td><code><pre> }</pre></code><tr><td>111<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstract.start>func abstract.start</div><div class=info><a href=#s_fn_abstract.start>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>242<td><code><pre>func (a *abstract) start() {</pre></code><tr><td>243<td><code><pre> go func() {</pre></code><tr><td>244<td><code><pre> appName := config.Use(a.appName).AppName()</pre></code><tr><td>245<td><code><pre> _ = retry.Retry(func(attempt uint) (err error) {</pre></code><tr><td>246<td><code><pre> _, err = utils.Catch(func() {</pre></code><tr><td>247<td><code><pre> for {</pre></code><tr><td>248<td><code><pre> select {</pre></code><tr><td>249<td><code><pre> case <-a.ctx.Done():</pre></code><tr><td>250<td><code><pre> if a.log != nil {</pre></code><tr><td>251<td><code><pre> a.log.Info(a.ctx, "%v [Gofusion] %s %s %s process exited due to context done",</pre></code><tr><td>252<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>253<td><code><pre> return</pre></code><tr><td>254<td><code><pre> }</pre></code><tr><td>255<td><code><pre> case task, ok := <-a.queue:</pre></code><tr><td>256<td><code><pre> if !ok {</pre></code><tr><td>257<td><code><pre> a.log.Info(a.ctx, "%v [Gofusion] %s %s %s process exited due to queue closed",</pre></code><tr><td>258<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>259<td><code><pre> return</pre></code><tr><td>260<td><code><pre> }</pre></code><tr><td>261<td><code><pre></pre></code><tr><td>262<td><code><pre> if err := a.queuePool.Submit(func() { _ = a.process(task) }); err != nil && a.log != nil {</pre></code><tr><td>263<td><code><pre> a.log.Error(task.ctx, "%v [Gofusion] %s %s %s submit process %s error: %s",</pre></code><tr><td>264<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics,</pre></code><tr><td>265<td><code><pre> a.name, task, err)</pre></code><tr><td>266<td><code><pre> }</pre></code><tr><td>267<td><code><pre> }</pre></code><tr><td>268<td><code><pre> }</pre></code><tr><td>269<td><code><pre> })</pre></code><tr><td>270<td><code><pre> if err != nil {</pre></code><tr><td>271<td><code><pre> a.log.Warn(a.ctx, "%v [Gofusion] %s %s %s dispatcher exited with error: %s",</pre></code><tr><td>272<td><code><pre> syscall.Getpid(), appName, config.ComponentMetrics, a.name, err)</pre></code><tr><td>273<td><code><pre> }</pre></code><tr><td>274<td><code><pre> return</pre></code><tr><td>275<td><code><pre> }, strategy.Limit(10000))</pre></code><tr><td>276<td><code><pre> }()</pre></code><tr><td>277<td><code><pre>}</pre></code></table><div class=funcname id=fn_AppName>func AppName</div><div class=info><a href=#s_fn_AppName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/construct.go</code>:</div><table class=listing><tr><td>107<td><code><pre>func AppName(name string) utils.OptionFunc[useOption] {</pre></code><tr><td>108<td><code><pre> return func(o *useOption) {</pre></code><tr><td>109<td><code><pre> o.appName = name</pre></code><tr><td>110<td><code><pre> }</pre></code><tr><td>111<td><code><pre>}</pre></code></table><div class=funcname id=fn_@108:9>func @108:9</div><div class=info><a href=#s_fn_@108:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/types.go</code>:</div><table class=listing><tr><td>108<td><code><pre>func(o *option) {</pre></code><tr><td>109<td><code><pre> o.precision = true</pre></code><tr><td>110<td><code><pre> }</pre></code></table><div class=funcname id=fn_@102:9>func @102:9</div><div class=info><a href=#s_fn_@102:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/types.go</code>:</div><table class=listing><tr><td>102<td><code><pre>func(o *option) {</pre></code><tr><td>103<td><code><pre> o.prometheusBuckets = buckets</pre></code><tr><td>104<td><code><pre> }</pre></code></table><div class=funcname id=fn_abstract.AddSample>func abstract.AddSample</div><div class=info><a href=#s_fn_abstract.AddSample>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>134<td><code><pre>func (a *abstract) AddSample(ctx context.Context, key []string, val float64, opts ...utils.OptionExtender) {</pre></code><tr><td>135<td><code><pre> a.send(ctx, "Sample", key, val, opts...)</pre></code><tr><td>136<td><code><pre>}</pre></code></table><div class=funcname id=fn_PrometheusBuckets>func PrometheusBuckets</div><div class=info><a href=#s_fn_PrometheusBuckets>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/types.go</code>:</div><table class=listing><tr><td>101<td><code><pre>func PrometheusBuckets(buckets []float64) utils.OptionFunc[option] {</pre></code><tr><td>102<td><code><pre> return func(o *option) {</pre></code><tr><td>103<td><code><pre> o.prometheusBuckets = buckets</pre></code><tr><td>104<td><code><pre> }</pre></code><tr><td>105<td><code><pre>}</pre></code></table><div class=funcname id=fn_@336:33>func @336:33</div><div class=info><a href=#s_fn_@336:33>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>336<td><code><pre>func(l Label) metrics.Label {</pre></code><tr><td>337<td><code><pre> return metrics.Label{</pre></code><tr><td>338<td><code><pre> Name: l.Key,</pre></code><tr><td>339<td><code><pre> Value: l.Value,</pre></code><tr><td>340<td><code><pre> }</pre></code><tr><td>341<td><code><pre> }</pre></code></table><div class=funcname id=fn_newMetrics>func newMetrics</div><div class=info><a href=#s_fn_newMetrics>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>70<td><code><pre>func newMetrics(ctx context.Context, appName, name, job string, sink metrics.MetricSink, conf *cfg) *abstract {</pre></code><tr><td>71<td><code><pre> metricsConfig := metrics.DefaultConfig(config.Use(appName).AppName())</pre></code><tr><td>72<td><code><pre> if conf.c.EnableServiceLabel {</pre></code><tr><td>73<td><code><pre> metricsConfig.EnableHostname = true</pre></code><tr><td>74<td><code><pre> metricsConfig.EnableHostnameLabel = true</pre></code><tr><td>75<td><code><pre> metricsConfig.EnableServiceLabel = true</pre></code><tr><td>76<td><code><pre> metricsConfig.EnableClientIPLabel = true</pre></code><tr><td>77<td><code><pre> } else {</pre></code><tr><td>78<td><code><pre> metricsConfig.EnableHostname = false</pre></code><tr><td>79<td><code><pre> metricsConfig.EnableHostnameLabel = false</pre></code><tr><td>80<td><code><pre> metricsConfig.EnableServiceLabel = false</pre></code><tr><td>81<td><code><pre> metricsConfig.EnableClientIPLabel = false</pre></code><tr><td>82<td><code><pre> }</pre></code><tr><td>83<td><code><pre></pre></code><tr><td>84<td><code><pre> m, err := metrics.New(metricsConfig, sink)</pre></code><tr><td>85<td><code><pre> if err != nil {</pre></code><tr class=miss><td>86<td><code><pre> panic(errors.Errorf("initialize metrics failed: %s", err))</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre></pre></code><tr><td>89<td><code><pre> limit := defaultQueueLimit</pre></code><tr><td>90<td><code><pre> if conf.c.QueueLimit > 0 {</pre></code><tr><td>91<td><code><pre> limit = conf.c.QueueLimit</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre> if conf.c.QueueConcurrency == 0 {</pre></code><tr><td>94<td><code><pre> conf.c.QueueConcurrency = runtime.NumCPU()</pre></code><tr><td>95<td><code><pre> }</pre></code><tr><td>96<td><code><pre></pre></code><tr><td>97<td><code><pre> constLabels := make([]metrics.Label, 0, len(conf.c.Labels))</pre></code><tr><td>98<td><code><pre> for k, v := range conf.c.Labels {</pre></code><tr><td>99<td><code><pre> constLabels = append(constLabels, metrics.Label{Name: k, Value: v})</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre></pre></code><tr><td>102<td><code><pre> a := &abstract{</pre></code><tr><td>103<td><code><pre> Metrics: m,</pre></code><tr><td>104<td><code><pre></pre></code><tr><td>105<td><code><pre> ctx: ctx,</pre></code><tr><td>106<td><code><pre> constLabels: constLabels,</pre></code><tr><td>107<td><code><pre> job: job,</pre></code><tr><td>108<td><code><pre> name: name,</pre></code><tr><td>109<td><code><pre> appName: appName,</pre></code><tr><td>110<td><code><pre> log: conf.logger,</pre></code><tr><td>111<td><code><pre> stop: make(chan struct{}),</pre></code><tr><td>112<td><code><pre> queue: make(chan *task, limit),</pre></code><tr><td>113<td><code><pre> queuePool: utils.Must(ants.NewPool(conf.c.QueueConcurrency)),</pre></code><tr><td>114<td><code><pre> }</pre></code><tr><td>115<td><code><pre></pre></code><tr><td>116<td><code><pre> a.dispatcher = map[string]func(...any){</pre></code><tr><td>117<td><code><pre> "Gauge": utils.WrapFunc(a.setGaugeWithLabels),</pre></code><tr><td>118<td><code><pre> "Counter": utils.WrapFunc(a.incrCounterWithLabels),</pre></code><tr><td>119<td><code><pre> "Sample": utils.WrapFunc(a.addSampleWithLabels),</pre></code><tr><td>120<td><code><pre> "MeasureSince": utils.WrapFunc(a.measureSinceWithLabels),</pre></code><tr><td>121<td><code><pre> }</pre></code><tr><td>122<td><code><pre></pre></code><tr><td>123<td><code><pre> a.start()</pre></code><tr><td>124<td><code><pre></pre></code><tr><td>125<td><code><pre> return a</pre></code><tr><td>126<td><code><pre>}</pre></code></table><div class=funcname id=fn_addConfig>func addConfig</div><div class=info><a href=#s_fn_addConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/construct.go</code>:</div><table class=listing><tr><td>57<td><code><pre>func addConfig(ctx context.Context, name string, conf *Conf, opt *config.InitOption) {</pre></code><tr><td>58<td><code><pre> var (</pre></code><tr><td>59<td><code><pre> err error</pre></code><tr><td>60<td><code><pre> interval time.Duration</pre></code><tr><td>61<td><code><pre> )</pre></code><tr><td>62<td><code><pre> if utils.IsStrNotBlank(conf.Interval) {</pre></code><tr><td>63<td><code><pre> interval, err = time.ParseDuration(conf.Interval)</pre></code><tr><td>64<td><code><pre> if err != nil {</pre></code><tr class=miss><td>65<td><code><pre> panic(errors.Errorf("metrics component parse %s interval failed: %s", name, err))</pre></code><tr><td>66<td><code><pre> }</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre></pre></code><tr><td>69<td><code><pre> rwlock.Lock()</pre></code><tr><td>70<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>71<td><code><pre> if cfgsMap == nil {</pre></code><tr><td>72<td><code><pre> cfgsMap = make(map[string]map[string]*cfg)</pre></code><tr><td>73<td><code><pre> }</pre></code><tr><td>74<td><code><pre> if cfgsMap[opt.AppName] == nil {</pre></code><tr><td>75<td><code><pre> cfgsMap[opt.AppName] = make(map[string]*cfg)</pre></code><tr><td>76<td><code><pre> }</pre></code><tr><td>77<td><code><pre> if _, ok := cfgsMap[opt.AppName][name]; ok {</pre></code><tr class=miss><td>78<td><code><pre> panic(ErrDuplicatedName)</pre></code><tr><td>79<td><code><pre> }</pre></code><tr><td>80<td><code><pre></pre></code><tr><td>81<td><code><pre> var logger metrics.Logger</pre></code><tr><td>82<td><code><pre> if utils.IsStrNotBlank(conf.Logger) {</pre></code><tr><td>83<td><code><pre> loggerType := inspect.TypeOf(conf.Logger)</pre></code><tr><td>84<td><code><pre> loggerValue := reflect.New(loggerType)</pre></code><tr><td>85<td><code><pre> if loggerValue.Type().Implements(customLoggerType) {</pre></code><tr><td>86<td><code><pre> logger := fusLog.Use(conf.LogInstance, fusLog.AppName(opt.AppName))</pre></code><tr><td>87<td><code><pre> loggerValue.Interface().(customLogger).Init(logger, opt.AppName, name)</pre></code><tr><td>88<td><code><pre> }</pre></code><tr><td>89<td><code><pre> logger = loggerValue.Convert(metricsLoggerType).Interface().(metrics.Logger)</pre></code><tr><td>90<td><code><pre> }</pre></code><tr><td>91<td><code><pre></pre></code><tr><td>92<td><code><pre> cfgsMap[opt.AppName][name] = &cfg{</pre></code><tr><td>93<td><code><pre> c: conf,</pre></code><tr><td>94<td><code><pre> ctx: ctx,</pre></code><tr><td>95<td><code><pre> name: name,</pre></code><tr><td>96<td><code><pre> appName: opt.AppName,</pre></code><tr><td>97<td><code><pre> interval: interval,</pre></code><tr><td>98<td><code><pre> initOption: opt,</pre></code><tr><td>99<td><code><pre> logger: logger,</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre>}</pre></code></table><div class=funcname id=fn_use>func use</div><div class=info><a href=#s_fn_use>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/construct.go</code>:</div><table class=listing><tr><td>135<td><code><pre>func use(job string, conf *cfg) (sink Sink) {</pre></code><tr><td>136<td><code><pre> if appInstances == nil {</pre></code><tr><td>137<td><code><pre> appInstances = make(map[string]map[string]map[string]Sink)</pre></code><tr><td>138<td><code><pre> }</pre></code><tr><td>139<td><code><pre> instances, ok := appInstances[conf.appName]</pre></code><tr><td>140<td><code><pre> if !ok {</pre></code><tr><td>141<td><code><pre> instances = make(map[string]map[string]Sink)</pre></code><tr><td>142<td><code><pre> appInstances[conf.appName] = instances</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre></pre></code><tr><td>145<td><code><pre> jobs, ok := instances[conf.name]</pre></code><tr><td>146<td><code><pre> if !ok {</pre></code><tr><td>147<td><code><pre> jobs = make(map[string]Sink)</pre></code><tr><td>148<td><code><pre> instances[conf.name] = jobs</pre></code><tr><td>149<td><code><pre> }</pre></code><tr><td>150<td><code><pre> sink, ok = jobs[job]</pre></code><tr><td>151<td><code><pre> if ok {</pre></code><tr><td>152<td><code><pre> return</pre></code><tr><td>153<td><code><pre> }</pre></code><tr><td>154<td><code><pre></pre></code><tr><td>155<td><code><pre> switch conf.c.Type {</pre></code><tr><td>156<td><code><pre> case metricsTypePrometheus:</pre></code><tr><td>157<td><code><pre> switch conf.c.Mode {</pre></code><tr><td>158<td><code><pre> case modePull:</pre></code><tr class=miss><td>159<td><code><pre> sink = newPrometheusPull(conf.ctx, conf.appName, conf.name, job, conf)</pre></code><tr><td>160<td><code><pre> case modePush:</pre></code><tr><td>161<td><code><pre> sink = newPrometheusPush(conf.ctx, conf.appName, conf.name, job, conf.interval, conf)</pre></code><tr><td>162<td><code><pre> }</pre></code><tr><td>163<td><code><pre> case metricsTypeMock:</pre></code><tr><td>164<td><code><pre> sink = newMock(conf.ctx, conf.appName, conf.name, job, conf)</pre></code><tr><td>165<td><code><pre> default:</pre></code><tr class=miss><td>166<td><code><pre> panic(errors.Errorf("unknown metrics type: %s", conf.c.Type))</pre></code><tr><td>167<td><code><pre> }</pre></code><tr><td>168<td><code><pre></pre></code><tr><td>169<td><code><pre> if sink == nil {</pre></code><tr class=miss><td>170<td><code><pre> panic(errors.Errorf("unknown metrics mode: %s", conf.c.Mode))</pre></code><tr><td>171<td><code><pre> }</pre></code><tr><td>172<td><code><pre></pre></code><tr><td>173<td><code><pre> jobs[job] = sink</pre></code><tr><td>174<td><code><pre> return</pre></code><tr><td>175<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstract.addSampleWithLabels>func abstract.addSampleWithLabels</div><div class=info><a href=#s_fn_abstract.addSampleWithLabels>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>315<td><code><pre>func (a *abstract) addSampleWithLabels(key []string, v any, labels []metrics.Label, opts ...utils.OptionExtender) {</pre></code><tr><td>316<td><code><pre> val, ok := v.(float64)</pre></code><tr><td>317<td><code><pre> if !ok {</pre></code><tr class=miss><td>318<td><code><pre> return</pre></code><tr><td>319<td><code><pre> }</pre></code><tr><td>320<td><code><pre> opt := utils.ApplyOptions[option](opts...)</pre></code><tr><td>321<td><code><pre> if opt.precision {</pre></code><tr><td>322<td><code><pre> a.Metrics.AddPrecisionSampleWithLabels(key, val, labels, opts...)</pre></code><tr><td>323<td><code><pre> } else {</pre></code><tr><td>324<td><code><pre> a.Metrics.AddSampleWithLabels(key, float32(val), labels, opts...)</pre></code><tr><td>325<td><code><pre> }</pre></code><tr><td>326<td><code><pre>}</pre></code></table><div class=funcname id=fn_@279:23>func @279:23</div><div class=info><a href=#s_fn_@279:23>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>279<td><code><pre>func() (err error) {</pre></code><tr><td>280<td><code><pre> handler, ok := a.dispatcher[task.method]</pre></code><tr><td>281<td><code><pre> if !ok {</pre></code><tr class=miss><td>282<td><code><pre> return errors.Errorf("method %s not found", task.method)</pre></code><tr><td>283<td><code><pre> }</pre></code><tr><td>284<td><code><pre> params := []any{task.key, task.val, append(task.labels, a.constLabels...)}</pre></code><tr><td>285<td><code><pre> params = append(params, utils.SliceMapping(task.opts, func(o utils.OptionExtender) any { return o })...)</pre></code><tr><td>286<td><code><pre> handler(params...)</pre></code><tr><td>287<td><code><pre> return</pre></code><tr><td>288<td><code><pre> }</pre></code></table><div class=funcname id=fn_abstract.setGaugeWithLabels>func abstract.setGaugeWithLabels</div><div class=info><a href=#s_fn_abstract.setGaugeWithLabels>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>296<td><code><pre>func (a *abstract) setGaugeWithLabels(key []string, v any, labels []metrics.Label, opts ...utils.OptionExtender) {</pre></code><tr><td>297<td><code><pre> val, ok := v.(float64)</pre></code><tr><td>298<td><code><pre> if !ok {</pre></code><tr class=miss><td>299<td><code><pre> return</pre></code><tr><td>300<td><code><pre> }</pre></code><tr><td>301<td><code><pre> opt := utils.ApplyOptions[option](opts...)</pre></code><tr><td>302<td><code><pre> if opt.precision {</pre></code><tr><td>303<td><code><pre> a.Metrics.SetPrecisionGaugeWithLabels(key, val, labels, opts...)</pre></code><tr><td>304<td><code><pre> } else {</pre></code><tr><td>305<td><code><pre> a.Metrics.SetGaugeWithLabels(key, float32(val), labels, opts...)</pre></code><tr><td>306<td><code><pre> }</pre></code><tr><td>307<td><code><pre>}</pre></code></table><div class=funcname id=fn_Use>func Use</div><div class=info><a href=#s_fn_Use>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/construct.go</code>:</div><table class=listing><tr><td>119<td><code><pre>func Use(name, job string, opts ...utils.OptionExtender) Sink {</pre></code><tr><td>120<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>121<td><code><pre> rwlock.Lock()</pre></code><tr><td>122<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>123<td><code><pre> cfgs, ok := cfgsMap[opt.appName]</pre></code><tr><td>124<td><code><pre> if !ok {</pre></code><tr class=miss><td>125<td><code><pre> panic(errors.Errorf("app metrics config not found: %s", opt.appName))</pre></code><tr><td>126<td><code><pre> }</pre></code><tr><td>127<td><code><pre> cfg, ok := cfgs[name]</pre></code><tr><td>128<td><code><pre> if !ok {</pre></code><tr class=miss><td>129<td><code><pre> panic(errors.Errorf("metrics config not found: %s", name))</pre></code><tr><td>130<td><code><pre> }</pre></code><tr><td>131<td><code><pre></pre></code><tr><td>132<td><code><pre> return use(job, cfg)</pre></code><tr><td>133<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstract.shutdown>func abstract.shutdown</div><div class=info><a href=#s_fn_abstract.shutdown>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>145<td><code><pre>func (a *abstract) shutdown() {</pre></code><tr><td>146<td><code><pre> if _, ok := utils.IsChannelClosed(a.stop); ok {</pre></code><tr class=miss><td>147<td><code><pre> return</pre></code><tr><td>148<td><code><pre> }</pre></code><tr><td>149<td><code><pre></pre></code><tr><td>150<td><code><pre> close(a.stop)</pre></code><tr><td>151<td><code><pre> a.Metrics.Shutdown()</pre></code><tr><td>152<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstract.incrCounterWithLabels>func abstract.incrCounterWithLabels</div><div class=info><a href=#s_fn_abstract.incrCounterWithLabels>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>308<td><code><pre>func (a *abstract) incrCounterWithLabels(key []string, v any, labels []metrics.Label, opts ...utils.OptionExtender) {</pre></code><tr><td>309<td><code><pre> val, ok := v.(float64)</pre></code><tr><td>310<td><code><pre> if !ok {</pre></code><tr class=miss><td>311<td><code><pre> return</pre></code><tr><td>312<td><code><pre> }</pre></code><tr><td>313<td><code><pre> a.Metrics.IncrCounterWithLabels(key, float32(val), labels, opts...)</pre></code><tr><td>314<td><code><pre>}</pre></code></table><div class=funcname id=fn_@245:19>func @245:19</div><div class=info><a href=#s_fn_@245:19>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>245<td><code><pre>func(attempt uint) (err error) {</pre></code><tr><td>246<td><code><pre> _, err = utils.Catch(func() {</pre></code><tr><td>247<td><code><pre> for {</pre></code><tr><td>248<td><code><pre> select {</pre></code><tr><td>249<td><code><pre> case <-a.ctx.Done():</pre></code><tr><td>250<td><code><pre> if a.log != nil {</pre></code><tr><td>251<td><code><pre> a.log.Info(a.ctx, "%v [Gofusion] %s %s %s process exited due to context done",</pre></code><tr><td>252<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>253<td><code><pre> return</pre></code><tr><td>254<td><code><pre> }</pre></code><tr><td>255<td><code><pre> case task, ok := <-a.queue:</pre></code><tr><td>256<td><code><pre> if !ok {</pre></code><tr><td>257<td><code><pre> a.log.Info(a.ctx, "%v [Gofusion] %s %s %s process exited due to queue closed",</pre></code><tr><td>258<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>259<td><code><pre> return</pre></code><tr><td>260<td><code><pre> }</pre></code><tr><td>261<td><code><pre></pre></code><tr><td>262<td><code><pre> if err := a.queuePool.Submit(func() { _ = a.process(task) }); err != nil && a.log != nil {</pre></code><tr><td>263<td><code><pre> a.log.Error(task.ctx, "%v [Gofusion] %s %s %s submit process %s error: %s",</pre></code><tr><td>264<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics,</pre></code><tr><td>265<td><code><pre> a.name, task, err)</pre></code><tr><td>266<td><code><pre> }</pre></code><tr><td>267<td><code><pre> }</pre></code><tr><td>268<td><code><pre> }</pre></code><tr><td>269<td><code><pre> })</pre></code><tr><td>270<td><code><pre> if err != nil {</pre></code><tr class=miss><td>271<td><code><pre> a.log.Warn(a.ctx, "%v [Gofusion] %s %s %s dispatcher exited with error: %s",</pre></code><tr><td>272<td><code><pre> syscall.Getpid(), appName, config.ComponentMetrics, a.name, err)</pre></code><tr><td>273<td><code><pre> }</pre></code><tr><td>274<td><code><pre> return</pre></code><tr><td>275<td><code><pre> }</pre></code></table><div class=funcname id=fn_newPrometheusPush>func newPrometheusPush</div><div class=info><a href=#s_fn_newPrometheusPush>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/prometheus.go</code>:</div><table class=listing><tr><td>24<td><code><pre>func newPrometheusPush(ctx context.Context, appName, name, job string, interval time.Duration, conf *cfg) Sink {</pre></code><tr><td>25<td><code><pre> sink, err := prometheus.NewPrometheusPushSink(ctx, conf.c.Endpoint.Addresses[0], interval, job, conf.logger)</pre></code><tr><td>26<td><code><pre> if err != nil {</pre></code><tr class=miss><td>27<td><code><pre> panic(errors.Errorf("initialize metrics component push mode prometheus failed: %s", err))</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre> return &_Prometheus{abstract: newMetrics(ctx, appName, name, job, sink, conf)}</pre></code><tr><td>30<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstract.process>func abstract.process</div><div class=info><a href=#s_fn_abstract.process>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>278<td><code><pre>func (a *abstract) process(task *task) (err error) {</pre></code><tr><td>279<td><code><pre> _, err = utils.Catch(func() (err error) {</pre></code><tr><td>280<td><code><pre> handler, ok := a.dispatcher[task.method]</pre></code><tr><td>281<td><code><pre> if !ok {</pre></code><tr><td>282<td><code><pre> return errors.Errorf("method %s not found", task.method)</pre></code><tr><td>283<td><code><pre> }</pre></code><tr><td>284<td><code><pre> params := []any{task.key, task.val, append(task.labels, a.constLabels...)}</pre></code><tr><td>285<td><code><pre> params = append(params, utils.SliceMapping(task.opts, func(o utils.OptionExtender) any { return o })...)</pre></code><tr><td>286<td><code><pre> handler(params...)</pre></code><tr><td>287<td><code><pre> return</pre></code><tr><td>288<td><code><pre> })</pre></code><tr><td>289<td><code><pre> if err != nil && a.log != nil {</pre></code><tr class=miss><td>290<td><code><pre> a.log.Error(task.ctx, "%v [Gofusion] %s %s %s process %s catch error: %s",</pre></code><tr><td>291<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name, task, err)</pre></code><tr><td>292<td><code><pre> }</pre></code><tr><td>293<td><code><pre> return</pre></code><tr><td>294<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstract.measureSinceWithLabels>func abstract.measureSinceWithLabels</div><div class=info><a href=#s_fn_abstract.measureSinceWithLabels>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>327<td><code><pre>func (a *abstract) measureSinceWithLabels(key []string, v any, labels []metrics.Label, opts ...utils.OptionExtender) {</pre></code><tr><td>328<td><code><pre> start, ok := v.(time.Time)</pre></code><tr><td>329<td><code><pre> if !ok {</pre></code><tr class=miss><td>330<td><code><pre> return</pre></code><tr><td>331<td><code><pre> }</pre></code><tr><td>332<td><code><pre> a.Metrics.MeasureSinceWithLabels(key, start, labels, opts...)</pre></code><tr><td>333<td><code><pre>}</pre></code></table><div class=funcname id=fn_@246:25>func @246:25</div><div class=info><a href=#s_fn_@246:25>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>246<td><code><pre>func() {</pre></code><tr><td>247<td><code><pre> for {</pre></code><tr><td>248<td><code><pre> select {</pre></code><tr><td>249<td><code><pre> case <-a.ctx.Done():</pre></code><tr><td>250<td><code><pre> if a.log != nil {</pre></code><tr><td>251<td><code><pre> a.log.Info(a.ctx, "%v [Gofusion] %s %s %s process exited due to context done",</pre></code><tr><td>252<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>253<td><code><pre> return</pre></code><tr><td>254<td><code><pre> }</pre></code><tr><td>255<td><code><pre> case task, ok := <-a.queue:</pre></code><tr><td>256<td><code><pre> if !ok {</pre></code><tr class=miss><td>257<td><code><pre> a.log.Info(a.ctx, "%v [Gofusion] %s %s %s process exited due to queue closed",</pre></code><tr><td>258<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr class=miss><td>259<td><code><pre> return</pre></code><tr><td>260<td><code><pre> }</pre></code><tr><td>261<td><code><pre></pre></code><tr><td>262<td><code><pre> if err := a.queuePool.Submit(func() { _ = a.process(task) }); err != nil && a.log != nil {</pre></code><tr class=miss><td>263<td><code><pre> a.log.Error(task.ctx, "%v [Gofusion] %s %s %s submit process %s error: %s",</pre></code><tr><td>264<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics,</pre></code><tr><td>265<td><code><pre> a.name, task, err)</pre></code><tr><td>266<td><code><pre> }</pre></code><tr><td>267<td><code><pre> }</pre></code><tr><td>268<td><code><pre> }</pre></code><tr><td>269<td><code><pre> }</pre></code></table><div class=funcname id=fn_abstract.send>func abstract.send</div><div class=info><a href=#s_fn_abstract.send>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>154<td><code><pre>func (a *abstract) send(ctx context.Context, method string, key []string, val any, opts ...utils.OptionExtender) {</pre></code><tr><td>155<td><code><pre> opt := utils.ApplyOptions[option](opts...)</pre></code><tr><td>156<td><code><pre></pre></code><tr><td>157<td><code><pre> t := &task{</pre></code><tr><td>158<td><code><pre> ctx: ctx,</pre></code><tr><td>159<td><code><pre> key: key,</pre></code><tr><td>160<td><code><pre> val: val,</pre></code><tr><td>161<td><code><pre> opts: append(opts, a.convertOpts(opts...)...),</pre></code><tr><td>162<td><code><pre> labels: a.convertLabels(opt.labels),</pre></code><tr><td>163<td><code><pre> method: method,</pre></code><tr><td>164<td><code><pre> }</pre></code><tr><td>165<td><code><pre></pre></code><tr><td>166<td><code><pre> switch {</pre></code><tr><td>167<td><code><pre> case opt.timeout > 0:</pre></code><tr><td>168<td><code><pre> timeoutCtx, cancel := context.WithTimeout(a.ctx, opt.timeout)</pre></code><tr><td>169<td><code><pre> defer cancel()</pre></code><tr><td>170<td><code><pre></pre></code><tr><td>171<td><code><pre> select {</pre></code><tr><td>172<td><code><pre> case a.queue <- t:</pre></code><tr><td>173<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>174<td><code><pre> if a.log != nil {</pre></code><tr class=miss><td>175<td><code><pre> a.log.Info(ctx, "%v [Gofusion] %s %s %s async send task canceled due to context done",</pre></code><tr><td>176<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>177<td><code><pre> }</pre></code><tr><td>178<td><code><pre> case <-timeoutCtx.Done():</pre></code><tr class=miss><td>179<td><code><pre> if a.log != nil {</pre></code><tr class=miss><td>180<td><code><pre> a.log.Warn(ctx, "%v [Gofusion] %s %s %s async send task canceled due to timeout %s",</pre></code><tr><td>181<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name, opt.timeout)</pre></code><tr><td>182<td><code><pre> }</pre></code><tr><td>183<td><code><pre> case <-a.stop:</pre></code><tr class=miss><td>184<td><code><pre> close(a.queue)</pre></code><tr class=miss><td>185<td><code><pre> if a.log != nil {</pre></code><tr class=miss><td>186<td><code><pre> a.log.Info(ctx, "%v [Gofusion] %s %s %s async send task canceled due to metrics stopped",</pre></code><tr><td>187<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>188<td><code><pre> }</pre></code><tr><td>189<td><code><pre> case <-a.ctx.Done():</pre></code><tr class=miss><td>190<td><code><pre> if a.log != nil {</pre></code><tr class=miss><td>191<td><code><pre> a.log.Info(ctx, "%v [Gofusion] %s %s %s async send task canceled due to app exited",</pre></code><tr><td>192<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>193<td><code><pre> }</pre></code><tr><td>194<td><code><pre> }</pre></code><tr><td>195<td><code><pre> case opt.timeout < 0:</pre></code><tr><td>196<td><code><pre> select {</pre></code><tr><td>197<td><code><pre> case a.queue <- t:</pre></code><tr><td>198<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>199<td><code><pre> if a.log != nil {</pre></code><tr class=miss><td>200<td><code><pre> a.log.Info(ctx, "%v [Gofusion] %s %s %s async send task canceled due to context done",</pre></code><tr><td>201<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>202<td><code><pre> }</pre></code><tr><td>203<td><code><pre> case <-a.stop:</pre></code><tr class=miss><td>204<td><code><pre> close(a.queue)</pre></code><tr class=miss><td>205<td><code><pre> if a.log != nil {</pre></code><tr class=miss><td>206<td><code><pre> a.log.Info(ctx, "%v [Gofusion] %s %s %s async send task canceled due to metrics stopped",</pre></code><tr><td>207<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>208<td><code><pre> }</pre></code><tr><td>209<td><code><pre> case <-a.ctx.Done():</pre></code><tr class=miss><td>210<td><code><pre> if a.log != nil {</pre></code><tr class=miss><td>211<td><code><pre> a.log.Info(ctx, "%v [Gofusion] %s %s %s async send task canceled due to app exited",</pre></code><tr><td>212<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>213<td><code><pre> }</pre></code><tr><td>214<td><code><pre> }</pre></code><tr><td>215<td><code><pre> default:</pre></code><tr><td>216<td><code><pre> select {</pre></code><tr><td>217<td><code><pre> case a.queue <- t:</pre></code><tr><td>218<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>219<td><code><pre> if a.log != nil {</pre></code><tr class=miss><td>220<td><code><pre> a.log.Info(ctx, "%v [Gofusion] %s %s %s async send task canceled due to context done",</pre></code><tr><td>221<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>222<td><code><pre> }</pre></code><tr><td>223<td><code><pre> case <-a.ctx.Done():</pre></code><tr class=miss><td>224<td><code><pre> if a.log != nil {</pre></code><tr class=miss><td>225<td><code><pre> a.log.Info(ctx, "%v [Gofusion] %s %s %s async send task canceled due to app exited",</pre></code><tr><td>226<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>227<td><code><pre> }</pre></code><tr><td>228<td><code><pre> case <-a.stop:</pre></code><tr class=miss><td>229<td><code><pre> close(a.queue)</pre></code><tr class=miss><td>230<td><code><pre> if a.log != nil {</pre></code><tr class=miss><td>231<td><code><pre> a.log.Info(ctx, "%v [Gofusion] %s %s %s async send task canceled due to metrics stopped",</pre></code><tr><td>232<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>233<td><code><pre> }</pre></code><tr><td>234<td><code><pre> default:</pre></code><tr class=miss><td>235<td><code><pre> if a.log != nil {</pre></code><tr class=miss><td>236<td><code><pre> a.log.Warn(ctx, "%v [Gofusion] %s %s %s async send task canceled due to exceed the queue limit",</pre></code><tr><td>237<td><code><pre> syscall.Getpid(), config.Use(a.appName).AppName(), config.ComponentMetrics, a.name)</pre></code><tr><td>238<td><code><pre> }</pre></code><tr><td>239<td><code><pre> }</pre></code><tr><td>240<td><code><pre> }</pre></code><tr><td>241<td><code><pre>}</pre></code></table><div class=funcname id=fn_HttpHandler>func HttpHandler</div><div class=info><a href=#s_fn_HttpHandler>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/http.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func HttpHandler(path, name string, opts ...utils.OptionExtender) http.Handler {</pre></code><tr class=miss><td>16<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr class=miss><td>17<td><code><pre> rwlock.RLock()</pre></code><tr class=miss><td>18<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>19<td><code><pre></pre></code><tr class=miss><td>20<td><code><pre> if appInstances == nil || appInstances[opt.appName] == nil || appInstances[opt.appName][name] == nil {</pre></code><tr class=miss><td>21<td><code><pre> panic(errors.Errorf("metrics instance not found: %s %s", opt.appName, name))</pre></code><tr><td>22<td><code><pre> }</pre></code><tr><td>23<td><code><pre></pre></code><tr><td>24<td><code><pre> // cfg := cfgsMap[opt.appName][name]</pre></code><tr class=miss><td>25<td><code><pre> m := utils.MapValues(appInstances[opt.appName][name])[0]</pre></code><tr class=miss><td>26<td><code><pre> switch sink := m.getProxy().(type) {</pre></code><tr><td>27<td><code><pre> case *prometheus.PrometheusSink:</pre></code><tr class=miss><td>28<td><code><pre> gatherer, ok := sink.Registry.(proDrv.Gatherer)</pre></code><tr class=miss><td>29<td><code><pre> if !ok {</pre></code><tr class=miss><td>30<td><code><pre> gatherer = proDrv.DefaultGatherer</pre></code><tr><td>31<td><code><pre> }</pre></code><tr class=miss><td>32<td><code><pre> return promhttp.InstrumentMetricHandler(</pre></code><tr><td>33<td><code><pre> sink.Registry, promhttp.HandlerFor(gatherer, promhttp.HandlerOpts{}),</pre></code><tr><td>34<td><code><pre> )</pre></code><tr><td>35<td><code><pre> default:</pre></code><tr class=miss><td>36<td><code><pre> panic(errors.Errorf("metrics instance not support http exporter: %s %s", opt.appName, name))</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre>}</pre></code></table><div class=funcname id=fn_newPrometheusPull>func newPrometheusPull</div><div class=info><a href=#s_fn_newPrometheusPull>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/prometheus.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func newPrometheusPull(ctx context.Context, appName, name, job string, conf *cfg) Sink {</pre></code><tr class=miss><td>33<td><code><pre> prometheusRWLocker.Lock()</pre></code><tr class=miss><td>34<td><code><pre> if _, ok := prometheusRegisters[appName]; !ok {</pre></code><tr class=miss><td>35<td><code><pre> prometheusRegisters[appName] = proDrv.NewRegistry()</pre></code><tr><td>36<td><code><pre> }</pre></code><tr class=miss><td>37<td><code><pre> prometheusRWLocker.Unlock()</pre></code><tr><td>38<td><code><pre></pre></code><tr class=miss><td>39<td><code><pre> sink, err := prometheus.NewPrometheusSinkFrom(prometheus.PrometheusOpts{</pre></code><tr><td>40<td><code><pre> Expiration: prometheus.DefaultPrometheusOpts.Expiration,</pre></code><tr><td>41<td><code><pre> Registerer: prometheusRegisters[appName],</pre></code><tr><td>42<td><code><pre> GaugeDefinitions: nil,</pre></code><tr><td>43<td><code><pre> SummaryDefinitions: nil,</pre></code><tr><td>44<td><code><pre> CounterDefinitions: nil,</pre></code><tr><td>45<td><code><pre> HistogramDefinitions: nil,</pre></code><tr><td>46<td><code><pre> Name: job,</pre></code><tr><td>47<td><code><pre> })</pre></code><tr class=miss><td>48<td><code><pre> if err != nil {</pre></code><tr class=miss><td>49<td><code><pre> panic(errors.Errorf("initialize metrics component pull mode prometheus failed: %s", err))</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre></pre></code><tr class=miss><td>52<td><code><pre> return &_Prometheus{abstract: newMetrics(ctx, appName, name, job, sink, conf)}</pre></code><tr><td>53<td><code><pre>}</pre></code></table><div class=funcname id=fn_task.String>func task.String</div><div class=info><a href=#s_fn_task.String>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>61<td><code><pre>func (t *task) String() string {</pre></code><tr class=miss><td>62<td><code><pre> label := make(map[string]string, len(t.labels))</pre></code><tr class=miss><td>63<td><code><pre> for _, l := range t.labels {</pre></code><tr class=miss><td>64<td><code><pre> label[l.Name] = l.Value</pre></code><tr><td>65<td><code><pre> }</pre></code><tr><td>66<td><code><pre></pre></code><tr class=miss><td>67<td><code><pre> return fmt.Sprintf("%s:%s:%+v(%+v)", t.method, strings.Join(t.key, constant.Dot), t.val, label)</pre></code><tr><td>68<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstract.getProxy>func abstract.getProxy</div><div class=info><a href=#s_fn_abstract.getProxy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/metrics.go</code>:</div><table class=listing><tr><td>142<td><code><pre>func (a *abstract) getProxy() any {</pre></code><tr class=miss><td>143<td><code><pre> return inspect.GetField[metrics.MetricSink](a.Metrics, "sink")</pre></code><tr><td>144<td><code><pre>}</pre></code></table><div class=funcname id=fn_@114:9>func @114:9</div><div class=info><a href=#s_fn_@114:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/construct.go</code>:</div><table class=listing><tr><td>114<td><code><pre>func() Sink {</pre></code><tr class=miss><td>115<td><code><pre> return Use(name, job, opts...)</pre></code><tr><td>116<td><code><pre> }</pre></code></table><div class=funcname id=fn_NewDI>func NewDI</div><div class=info><a href=#s_fn_NewDI>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/metrics/construct.go</code>:</div><table class=listing><tr><td>113<td><code><pre>func NewDI(name, job string, opts ...utils.OptionExtender) func() Sink {</pre></code><tr class=miss><td>114<td><code><pre> return func() Sink {</pre></code><tr><td>115<td><code><pre> return Use(name, job, opts...)</pre></code><tr><td>116<td><code><pre> }</pre></code><tr><td>117<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/mongo class=funcname>Package Overview: github.com/wfusion/gofusion/mongo 40 <span class=packageTotal>76.4%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_metricsPoolMonitor><td><code><a href=#fn_metricsPoolMonitor>metricsPoolMonitor(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>13/13</code><tr id=s_fn_startDaemonRoutines><td><code><a href=#fn_startDaemonRoutines>startDaemonRoutines(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>10/10</code><tr id=s_fn_Construct><td><code><a href=#fn_Construct>Construct(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_@165:9><td><code><a href=#fn_@165:9>@165:9(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_@65:25><td><code><a href=#fn_@65:25>@65:25(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_@83:9><td><code><a href=#fn_@83:9>@83:9(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_WriteConcern><td><code><a href=#fn_WriteConcern>WriteConcern(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_AppName><td><code><a href=#fn_AppName>AppName(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.Database><td><code><a href=#fn_instance.Database>instance.Database(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@72:9><td><code><a href=#fn_@72:9>@72:9(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/flag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.GetProxy><td><code><a href=#fn_instance.GetProxy>instance.GetProxy(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/mongo.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_addInstance><td><code><a href=#fn_addInstance>addInstance(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/construct.go</code><td class=percent><code>91.3%</code><td class=linecount><code>21/23</code><tr id=s_fn_@33:9><td><code><a href=#fn_@33:9>@33:9(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/construct.go</code><td class=percent><code>88.9%</code><td class=linecount><code>8/9</code><tr id=s_fn_Use><td><code><a href=#fn_Use>Use(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/mongo.go</code><td class=percent><code>81.8%</code><td class=linecount><code>9/11</code><tr id=s_fn_metricMongoLatency><td><code><a href=#fn_metricMongoLatency>metricMongoLatency(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/metrics.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_metricMongoStats><td><code><a href=#fn_metricMongoStats>metricMongoStats(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/metrics.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_@106:21><td><code><a href=#fn_@106:21>@106:21(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/metrics.go</code><td class=percent><code>60.0%</code><td class=linecount><code>12/20</code><tr id=s_fn_@63:21><td><code><a href=#fn_@63:21>@63:21(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/metrics.go</code><td class=percent><code>47.4%</code><td class=linecount><code>9/19</code><tr id=s_fn_@78:9><td><code><a href=#fn_@78:9>@78:9(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/mongo.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_ReadConcern><td><code><a href=#fn_ReadConcern>ReadConcern(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/mongo.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@87:4><td><code><a href=#fn_@87:4>@87:4(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@88:9><td><code><a href=#fn_@88:9>@88:9(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/mongo.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_BsonOptions><td><code><a href=#fn_BsonOptions>BsonOptions(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/mongo.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@93:9><td><code><a href=#fn_@93:9>@93:9(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/mongo.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Registry><td><code><a href=#fn_Registry>Registry(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/mongo.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@98:9><td><code><a href=#fn_@98:9>@98:9(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/mongo.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_ReadPreference><td><code><a href=#fn_ReadPreference>ReadPreference(...)</a></code><td><code>github.com/wfusion/gofusion/mongo/mongo.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_metricsPoolMonitor>func metricsPoolMonitor</div><div class=info><a href=#s_fn_metricsPoolMonitor>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/metrics.go</code>:</div><table class=listing><tr><td>147<td><code><pre>func metricsPoolMonitor(appName, name string) func(evt *event.PoolEvent) {</pre></code><tr><td>148<td><code><pre> metricsPoolLocker.Lock()</pre></code><tr><td>149<td><code><pre> defer metricsPoolLocker.Unlock()</pre></code><tr><td>150<td><code><pre> if metricsPoolTotalCounter[appName] == nil {</pre></code><tr><td>151<td><code><pre> metricsPoolTotalCounter[appName] = make(map[string]*atomic.Int64)</pre></code><tr><td>152<td><code><pre> }</pre></code><tr><td>153<td><code><pre> if metricsPoolTotalCounter[appName][name] == nil {</pre></code><tr><td>154<td><code><pre> metricsPoolTotalCounter[appName][name] = atomic.NewInt64(0)</pre></code><tr><td>155<td><code><pre> }</pre></code><tr><td>156<td><code><pre> if metricsPoolInUseCounter[appName] == nil {</pre></code><tr><td>157<td><code><pre> metricsPoolInUseCounter[appName] = make(map[string]*atomic.Int64)</pre></code><tr><td>158<td><code><pre> }</pre></code><tr><td>159<td><code><pre> if metricsPoolInUseCounter[appName][name] == nil {</pre></code><tr><td>160<td><code><pre> metricsPoolInUseCounter[appName][name] = atomic.NewInt64(0)</pre></code><tr><td>161<td><code><pre> }</pre></code><tr><td>162<td><code><pre></pre></code><tr><td>163<td><code><pre> inuse := metricsPoolInUseCounter[appName][name]</pre></code><tr><td>164<td><code><pre> total := metricsPoolTotalCounter[appName][name]</pre></code><tr><td>165<td><code><pre> return func(evt *event.PoolEvent) {</pre></code><tr><td>166<td><code><pre> switch evt.Type {</pre></code><tr><td>167<td><code><pre> case event.PoolCreated:</pre></code><tr><td>168<td><code><pre> case event.PoolReady:</pre></code><tr><td>169<td><code><pre> case event.PoolCleared:</pre></code><tr><td>170<td><code><pre> case event.PoolClosedEvent:</pre></code><tr><td>171<td><code><pre> case event.ConnectionCreated:</pre></code><tr><td>172<td><code><pre> total.Add(1)</pre></code><tr><td>173<td><code><pre> case event.ConnectionReady:</pre></code><tr><td>174<td><code><pre> case event.ConnectionClosed:</pre></code><tr><td>175<td><code><pre> total.Add(-1)</pre></code><tr><td>176<td><code><pre> case event.GetStarted:</pre></code><tr><td>177<td><code><pre> case event.GetFailed:</pre></code><tr><td>178<td><code><pre> case event.GetSucceeded:</pre></code><tr><td>179<td><code><pre> inuse.Add(1)</pre></code><tr><td>180<td><code><pre> case event.ConnectionReturned:</pre></code><tr><td>181<td><code><pre> inuse.Add(-1)</pre></code><tr><td>182<td><code><pre> }</pre></code><tr><td>183<td><code><pre> }</pre></code><tr><td>184<td><code><pre></pre></code><tr><td>185<td><code><pre>}</pre></code></table><div class=funcname id=fn_startDaemonRoutines>func startDaemonRoutines</div><div class=info><a href=#s_fn_startDaemonRoutines>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/metrics.go</code>:</div><table class=listing><tr><td>34<td><code><pre>func startDaemonRoutines(ctx context.Context, appName, name string, conf *Conf) {</pre></code><tr><td>35<td><code><pre> ticker := time.Tick(time.Second * 5)</pre></code><tr><td>36<td><code><pre> app := config.Use(appName).AppName()</pre></code><tr><td>37<td><code><pre> labels := []metrics.Label{</pre></code><tr><td>38<td><code><pre> {Key: "config", Value: name},</pre></code><tr><td>39<td><code><pre> {Key: "database", Value: conf.DB},</pre></code><tr><td>40<td><code><pre> }</pre></code><tr><td>41<td><code><pre></pre></code><tr><td>42<td><code><pre> log.Printf("%v [Gofusion] %s %s %s metrics start", syscall.Getpid(), app, config.ComponentMongo, name)</pre></code><tr><td>43<td><code><pre> for {</pre></code><tr><td>44<td><code><pre> select {</pre></code><tr><td>45<td><code><pre> case <-ctx.Done():</pre></code><tr><td>46<td><code><pre> log.Printf("%v [Gofusion] %s %s %s metrics exited",</pre></code><tr><td>47<td><code><pre> syscall.Getpid(), app, config.ComponentMongo, name)</pre></code><tr><td>48<td><code><pre> return</pre></code><tr><td>49<td><code><pre> case <-ticker:</pre></code><tr><td>50<td><code><pre> go metricMongoStats(ctx, appName, name, labels)</pre></code><tr><td>51<td><code><pre> go metricMongoLatency(ctx, appName, name, labels)</pre></code><tr><td>52<td><code><pre> }</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre>}</pre></code></table><div class=funcname id=fn_Construct>func Construct</div><div class=info><a href=#s_fn_Construct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/construct.go</code>:</div><table class=listing><tr><td>23<td><code><pre>func Construct(ctx context.Context, confs map[string]*Conf, opts ...utils.OptionExtender) func() {</pre></code><tr><td>24<td><code><pre> opt := utils.ApplyOptions[config.InitOption](opts...)</pre></code><tr><td>25<td><code><pre> optU := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>26<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>27<td><code><pre> opt.AppName = optU.appName</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre> for name, conf := range confs {</pre></code><tr><td>30<td><code><pre> addInstance(ctx, name, conf, opt)</pre></code><tr><td>31<td><code><pre> }</pre></code><tr><td>32<td><code><pre></pre></code><tr><td>33<td><code><pre> return func() {</pre></code><tr><td>34<td><code><pre> rwlock.Lock()</pre></code><tr><td>35<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>36<td><code><pre></pre></code><tr><td>37<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>38<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>39<td><code><pre> if appInstances != nil {</pre></code><tr><td>40<td><code><pre> for name, instance := range appInstances[opt.AppName] {</pre></code><tr><td>41<td><code><pre> if err := instance.GetProxy().Disconnect(nil); err != nil {</pre></code><tr><td>42<td><code><pre> log.Printf("%v [Gofusion] %s %s %s disconnect error: %s",</pre></code><tr><td>43<td><code><pre> pid, app, config.ComponentMongo, name, err)</pre></code><tr><td>44<td><code><pre> }</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre> delete(appInstances, opt.AppName)</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> }</pre></code><tr><td>49<td><code><pre>}</pre></code></table><div class=funcname id=fn_@165:9>func @165:9</div><div class=info><a href=#s_fn_@165:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/metrics.go</code>:</div><table class=listing><tr><td>165<td><code><pre>func(evt *event.PoolEvent) {</pre></code><tr><td>166<td><code><pre> switch evt.Type {</pre></code><tr><td>167<td><code><pre> case event.PoolCreated:</pre></code><tr><td>168<td><code><pre> case event.PoolReady:</pre></code><tr><td>169<td><code><pre> case event.PoolCleared:</pre></code><tr><td>170<td><code><pre> case event.PoolClosedEvent:</pre></code><tr><td>171<td><code><pre> case event.ConnectionCreated:</pre></code><tr><td>172<td><code><pre> total.Add(1)</pre></code><tr><td>173<td><code><pre> case event.ConnectionReady:</pre></code><tr><td>174<td><code><pre> case event.ConnectionClosed:</pre></code><tr><td>175<td><code><pre> total.Add(-1)</pre></code><tr><td>176<td><code><pre> case event.GetStarted:</pre></code><tr><td>177<td><code><pre> case event.GetFailed:</pre></code><tr><td>178<td><code><pre> case event.GetSucceeded:</pre></code><tr><td>179<td><code><pre> inuse.Add(1)</pre></code><tr><td>180<td><code><pre> case event.ConnectionReturned:</pre></code><tr><td>181<td><code><pre> inuse.Add(-1)</pre></code><tr><td>182<td><code><pre> }</pre></code><tr><td>183<td><code><pre> }</pre></code></table><div class=funcname id=fn_@65:25>func @65:25</div><div class=info><a href=#s_fn_@65:25>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/metrics.go</code>:</div><table class=listing><tr><td>65<td><code><pre>func() {</pre></code><tr><td>66<td><code><pre> metricsPoolLocker.RLock()</pre></code><tr><td>67<td><code><pre> defer metricsPoolLocker.RUnlock()</pre></code><tr><td>68<td><code><pre> inuse = metricsPoolInUseCounter[appName][name].Load()</pre></code><tr><td>69<td><code><pre> total = metricsPoolTotalCounter[appName][name].Load()</pre></code><tr><td>70<td><code><pre> }</pre></code></table><div class=funcname id=fn_@83:9>func @83:9</div><div class=info><a href=#s_fn_@83:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/mongo.go</code>:</div><table class=listing><tr><td>83<td><code><pre>func(o *useOption) {</pre></code><tr><td>84<td><code><pre> o.writeConcern = writeConcern</pre></code><tr><td>85<td><code><pre> }</pre></code></table><div class=funcname id=fn_WriteConcern>func WriteConcern</div><div class=info><a href=#s_fn_WriteConcern>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/mongo.go</code>:</div><table class=listing><tr><td>82<td><code><pre>func WriteConcern(writeConcern *writeconcern.WriteConcern) utils.OptionFunc[useOption] {</pre></code><tr><td>83<td><code><pre> return func(o *useOption) {</pre></code><tr><td>84<td><code><pre> o.writeConcern = writeConcern</pre></code><tr><td>85<td><code><pre> }</pre></code><tr><td>86<td><code><pre>}</pre></code></table><div class=funcname id=fn_AppName>func AppName</div><div class=info><a href=#s_fn_AppName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/mongo.go</code>:</div><table class=listing><tr><td>71<td><code><pre>func AppName(name string) utils.OptionFunc[useOption] {</pre></code><tr><td>72<td><code><pre> return func(o *useOption) {</pre></code><tr><td>73<td><code><pre> o.appName = name</pre></code><tr><td>74<td><code><pre> }</pre></code><tr><td>75<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Database>func instance.Database</div><div class=info><a href=#s_fn_instance.Database>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/mongo.go</code>:</div><table class=listing><tr><td>34<td><code><pre>func (d *instance) Database(opts ...*options.DatabaseOptions) *mgoDrv.Database {</pre></code><tr><td>35<td><code><pre> return d.mongo.Database(d.database, opts...)</pre></code><tr><td>36<td><code><pre>}</pre></code></table><div class=funcname id=fn_@72:9>func @72:9</div><div class=info><a href=#s_fn_@72:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/mongo.go</code>:</div><table class=listing><tr><td>72<td><code><pre>func(o *useOption) {</pre></code><tr><td>73<td><code><pre> o.appName = name</pre></code><tr><td>74<td><code><pre> }</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/construct.go</code>:</div><table class=listing><tr><td>97<td><code><pre>func init() {</pre></code><tr><td>98<td><code><pre> config.AddComponent(config.ComponentMongo, Construct, config.WithFlag(&flagString))</pre></code><tr><td>99<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/flag.go</code>:</div><table class=listing><tr><td>7<td><code><pre>func init() {</pre></code><tr><td>8<td><code><pre> pflag.StringVarP(&flagString, "mongo-config", "", "", "json string for mongo config")</pre></code><tr><td>9<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GetProxy>func instance.GetProxy</div><div class=info><a href=#s_fn_instance.GetProxy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/mongo.go</code>:</div><table class=listing><tr><td>30<td><code><pre>func (d *instance) GetProxy() *mgoDrv.Client {</pre></code><tr><td>31<td><code><pre> return d.mongo.GetProxy()</pre></code><tr><td>32<td><code><pre>}</pre></code></table><div class=funcname id=fn_addInstance>func addInstance</div><div class=info><a href=#s_fn_addInstance>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/construct.go</code>:</div><table class=listing><tr><td>51<td><code><pre>func addInstance(ctx context.Context, name string, conf *Conf, opt *config.InitOption) {</pre></code><tr><td>52<td><code><pre> var monitor *mgoEvt.CommandMonitor</pre></code><tr><td>53<td><code><pre> if utils.IsStrNotBlank(conf.LoggerConfig.Logger) {</pre></code><tr><td>54<td><code><pre> loggerType := inspect.TypeOf(conf.LoggerConfig.Logger)</pre></code><tr><td>55<td><code><pre> loggerValue := reflect.New(loggerType)</pre></code><tr><td>56<td><code><pre> if loggerValue.Type().Implements(customLoggerType) {</pre></code><tr><td>57<td><code><pre> l := fusLog.Use(conf.LoggerConfig.LogInstance, fusLog.AppName(opt.AppName))</pre></code><tr><td>58<td><code><pre> loggerValue.Interface().(customLogger).Init(l, opt.AppName, name)</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre> monitor = loggerValue.Interface().(logger).GetMonitor()</pre></code><tr><td>61<td><code><pre> }</pre></code><tr><td>62<td><code><pre></pre></code><tr><td>63<td><code><pre> // conf.Option.Password = config.CryptoDecryptFunc()(conf.Option.Password)</pre></code><tr><td>64<td><code><pre> mgoCli, err := mongo.Default.New(ctx, conf.Option,</pre></code><tr><td>65<td><code><pre> mongo.WithMonitor(monitor),</pre></code><tr><td>66<td><code><pre> mongo.WithPoolMonitor(&mgoEvt.PoolMonitor{Event: metricsPoolMonitor(opt.AppName, name)}))</pre></code><tr><td>67<td><code><pre> if err != nil {</pre></code><tr class=miss><td>68<td><code><pre> panic(err)</pre></code><tr><td>69<td><code><pre> }</pre></code><tr><td>70<td><code><pre></pre></code><tr><td>71<td><code><pre> rwlock.Lock()</pre></code><tr><td>72<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>73<td><code><pre> if appInstances == nil {</pre></code><tr><td>74<td><code><pre> appInstances = make(map[string]map[string]*instance)</pre></code><tr><td>75<td><code><pre> }</pre></code><tr><td>76<td><code><pre> if appInstances[opt.AppName] == nil {</pre></code><tr><td>77<td><code><pre> appInstances[opt.AppName] = make(map[string]*instance)</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre> if _, ok := appInstances[opt.AppName][name]; ok {</pre></code><tr class=miss><td>80<td><code><pre> panic(ErrDuplicatedName)</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre> appInstances[opt.AppName][name] = &instance{mongo: mgoCli, name: name, database: conf.DB}</pre></code><tr><td>83<td><code><pre></pre></code><tr><td>84<td><code><pre> // ioc</pre></code><tr><td>85<td><code><pre> if opt.DI != nil {</pre></code><tr><td>86<td><code><pre> opt.DI.MustProvide(</pre></code><tr><td>87<td><code><pre> func() *mgoDrv.Database {</pre></code><tr><td>88<td><code><pre> return Use(name, AppName(opt.AppName)).Database</pre></code><tr><td>89<td><code><pre> },</pre></code><tr><td>90<td><code><pre> di.Name(name),</pre></code><tr><td>91<td><code><pre> )</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre></pre></code><tr><td>94<td><code><pre> go startDaemonRoutines(ctx, opt.AppName, name, conf)</pre></code><tr><td>95<td><code><pre>}</pre></code></table><div class=funcname id=fn_@33:9>func @33:9</div><div class=info><a href=#s_fn_@33:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/construct.go</code>:</div><table class=listing><tr><td>33<td><code><pre>func() {</pre></code><tr><td>34<td><code><pre> rwlock.Lock()</pre></code><tr><td>35<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>36<td><code><pre></pre></code><tr><td>37<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>38<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>39<td><code><pre> if appInstances != nil {</pre></code><tr><td>40<td><code><pre> for name, instance := range appInstances[opt.AppName] {</pre></code><tr><td>41<td><code><pre> if err := instance.GetProxy().Disconnect(nil); err != nil {</pre></code><tr class=miss><td>42<td><code><pre> log.Printf("%v [Gofusion] %s %s %s disconnect error: %s",</pre></code><tr><td>43<td><code><pre> pid, app, config.ComponentMongo, name, err)</pre></code><tr><td>44<td><code><pre> }</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre> delete(appInstances, opt.AppName)</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> }</pre></code></table><div class=funcname id=fn_Use>func Use</div><div class=info><a href=#s_fn_Use>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/mongo.go</code>:</div><table class=listing><tr><td>103<td><code><pre>func Use(name string, opts ...utils.OptionExtender) *Mongo {</pre></code><tr><td>104<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>105<td><code><pre> dbOpt := options.</pre></code><tr><td>106<td><code><pre> Database().</pre></code><tr><td>107<td><code><pre> SetReadConcern(opt.readConcern).</pre></code><tr><td>108<td><code><pre> SetWriteConcern(opt.writeConcern).</pre></code><tr><td>109<td><code><pre> SetReadPreference(opt.readPreference).</pre></code><tr><td>110<td><code><pre> SetBSONOptions(opt.bsonOptions).</pre></code><tr><td>111<td><code><pre> SetRegistry(opt.registry)</pre></code><tr><td>112<td><code><pre></pre></code><tr><td>113<td><code><pre> rwlock.RLock()</pre></code><tr><td>114<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>115<td><code><pre> instances, ok := appInstances[opt.appName]</pre></code><tr><td>116<td><code><pre> if !ok {</pre></code><tr class=miss><td>117<td><code><pre> panic(fmt.Errorf("mongo database instance not found for app: %s", opt.appName))</pre></code><tr><td>118<td><code><pre> }</pre></code><tr><td>119<td><code><pre> instance, ok := instances[name]</pre></code><tr><td>120<td><code><pre> if !ok {</pre></code><tr class=miss><td>121<td><code><pre> panic(fmt.Errorf("mongo database instance not found for name: %s", name))</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre> return &Mongo{Database: instance.Database(dbOpt), Name: name}</pre></code><tr><td>124<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricMongoLatency>func metricMongoLatency</div><div class=info><a href=#s_fn_metricMongoLatency>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/metrics.go</code>:</div><table class=listing><tr><td>99<td><code><pre>func metricMongoLatency(ctx context.Context, appName, name string, labels []metrics.Label) {</pre></code><tr><td>100<td><code><pre> select {</pre></code><tr><td>101<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>102<td><code><pre> return</pre></code><tr><td>103<td><code><pre> default:</pre></code><tr><td>104<td><code><pre> }</pre></code><tr><td>105<td><code><pre></pre></code><tr><td>106<td><code><pre> _, _ = utils.Catch(func() {</pre></code><tr><td>107<td><code><pre> rwlock.RLock()</pre></code><tr><td>108<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>109<td><code><pre> instances, ok := appInstances[appName]</pre></code><tr><td>110<td><code><pre> if !ok {</pre></code><tr><td>111<td><code><pre> return</pre></code><tr><td>112<td><code><pre> }</pre></code><tr><td>113<td><code><pre> instance, ok := instances[name]</pre></code><tr><td>114<td><code><pre> if !ok {</pre></code><tr><td>115<td><code><pre> return</pre></code><tr><td>116<td><code><pre> }</pre></code><tr><td>117<td><code><pre></pre></code><tr><td>118<td><code><pre> mgoCli := instance.GetProxy()</pre></code><tr><td>119<td><code><pre> begin := time.Now()</pre></code><tr><td>120<td><code><pre> if err := mgoCli.Ping(ctx, nil); err != nil {</pre></code><tr><td>121<td><code><pre> return</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre></pre></code><tr><td>124<td><code><pre> latency := float64(time.Since(begin)) / float64(time.Millisecond)</pre></code><tr><td>125<td><code><pre> latencyKey := append([]string{config.Use(appName).AppName()}, metricsLatencyKey...)</pre></code><tr><td>126<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr><td>127<td><code><pre> select {</pre></code><tr><td>128<td><code><pre> case <-ctx.Done():</pre></code><tr><td>129<td><code><pre> return</pre></code><tr><td>130<td><code><pre> default:</pre></code><tr><td>131<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr><td>132<td><code><pre> m.AddSample(ctx, latencyKey, latency,</pre></code><tr><td>133<td><code><pre> metrics.Labels(labels),</pre></code><tr><td>134<td><code><pre> metrics.PrometheusBuckets(metricsLatencyBuckets),</pre></code><tr><td>135<td><code><pre> )</pre></code><tr><td>136<td><code><pre> } else {</pre></code><tr><td>137<td><code><pre> m.AddSample(ctx, metricsLatencyKey, latency,</pre></code><tr><td>138<td><code><pre> metrics.Labels(labels),</pre></code><tr><td>139<td><code><pre> metrics.PrometheusBuckets(metricsLatencyBuckets),</pre></code><tr><td>140<td><code><pre> )</pre></code><tr><td>141<td><code><pre> }</pre></code><tr><td>142<td><code><pre> }</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre> })</pre></code><tr><td>145<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricMongoStats>func metricMongoStats</div><div class=info><a href=#s_fn_metricMongoStats>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/metrics.go</code>:</div><table class=listing><tr><td>56<td><code><pre>func metricMongoStats(ctx context.Context, appName, name string, labels []metrics.Label) {</pre></code><tr><td>57<td><code><pre> select {</pre></code><tr><td>58<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>59<td><code><pre> return</pre></code><tr><td>60<td><code><pre> default:</pre></code><tr><td>61<td><code><pre> }</pre></code><tr><td>62<td><code><pre></pre></code><tr><td>63<td><code><pre> _, _ = utils.Catch(func() {</pre></code><tr><td>64<td><code><pre> var total, inuse int64</pre></code><tr><td>65<td><code><pre> _, err := utils.Catch(func() {</pre></code><tr><td>66<td><code><pre> metricsPoolLocker.RLock()</pre></code><tr><td>67<td><code><pre> defer metricsPoolLocker.RUnlock()</pre></code><tr><td>68<td><code><pre> inuse = metricsPoolInUseCounter[appName][name].Load()</pre></code><tr><td>69<td><code><pre> total = metricsPoolTotalCounter[appName][name].Load()</pre></code><tr><td>70<td><code><pre> })</pre></code><tr><td>71<td><code><pre> if err != nil {</pre></code><tr><td>72<td><code><pre> return</pre></code><tr><td>73<td><code><pre> }</pre></code><tr><td>74<td><code><pre></pre></code><tr><td>75<td><code><pre> app := config.Use(appName).AppName()</pre></code><tr><td>76<td><code><pre> idleKey := append([]string{app}, metricsPoolIdleKey...)</pre></code><tr><td>77<td><code><pre> inuseKey := append([]string{app}, metricsPoolInUseKey...)</pre></code><tr><td>78<td><code><pre> totalKey := append([]string{app}, metricsPoolTotalKey...)</pre></code><tr><td>79<td><code><pre> ide := total - inuse</pre></code><tr><td>80<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr><td>81<td><code><pre> select {</pre></code><tr><td>82<td><code><pre> case <-ctx.Done():</pre></code><tr><td>83<td><code><pre> return</pre></code><tr><td>84<td><code><pre> default:</pre></code><tr><td>85<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr><td>86<td><code><pre> m.SetGauge(ctx, idleKey, float64(ide), metrics.Labels(labels))</pre></code><tr><td>87<td><code><pre> m.SetGauge(ctx, inuseKey, float64(inuse), metrics.Labels(labels))</pre></code><tr><td>88<td><code><pre> m.SetGauge(ctx, totalKey, float64(total), metrics.Labels(labels))</pre></code><tr><td>89<td><code><pre> } else {</pre></code><tr><td>90<td><code><pre> m.SetGauge(ctx, metricsPoolIdleKey, float64(ide), metrics.Labels(labels))</pre></code><tr><td>91<td><code><pre> m.SetGauge(ctx, metricsPoolInUseKey, float64(inuse), metrics.Labels(labels))</pre></code><tr><td>92<td><code><pre> m.SetGauge(ctx, metricsPoolTotalKey, float64(total), metrics.Labels(labels))</pre></code><tr><td>93<td><code><pre> }</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre> }</pre></code><tr><td>96<td><code><pre> })</pre></code><tr><td>97<td><code><pre>}</pre></code></table><div class=funcname id=fn_@106:21>func @106:21</div><div class=info><a href=#s_fn_@106:21>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/metrics.go</code>:</div><table class=listing><tr><td>106<td><code><pre>func() {</pre></code><tr><td>107<td><code><pre> rwlock.RLock()</pre></code><tr><td>108<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>109<td><code><pre> instances, ok := appInstances[appName]</pre></code><tr><td>110<td><code><pre> if !ok {</pre></code><tr class=miss><td>111<td><code><pre> return</pre></code><tr><td>112<td><code><pre> }</pre></code><tr><td>113<td><code><pre> instance, ok := instances[name]</pre></code><tr><td>114<td><code><pre> if !ok {</pre></code><tr class=miss><td>115<td><code><pre> return</pre></code><tr><td>116<td><code><pre> }</pre></code><tr><td>117<td><code><pre></pre></code><tr><td>118<td><code><pre> mgoCli := instance.GetProxy()</pre></code><tr><td>119<td><code><pre> begin := time.Now()</pre></code><tr><td>120<td><code><pre> if err := mgoCli.Ping(ctx, nil); err != nil {</pre></code><tr class=miss><td>121<td><code><pre> return</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre></pre></code><tr><td>124<td><code><pre> latency := float64(time.Since(begin)) / float64(time.Millisecond)</pre></code><tr><td>125<td><code><pre> latencyKey := append([]string{config.Use(appName).AppName()}, metricsLatencyKey...)</pre></code><tr><td>126<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr class=miss><td>127<td><code><pre> select {</pre></code><tr><td>128<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>129<td><code><pre> return</pre></code><tr><td>130<td><code><pre> default:</pre></code><tr class=miss><td>131<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr class=miss><td>132<td><code><pre> m.AddSample(ctx, latencyKey, latency,</pre></code><tr><td>133<td><code><pre> metrics.Labels(labels),</pre></code><tr><td>134<td><code><pre> metrics.PrometheusBuckets(metricsLatencyBuckets),</pre></code><tr><td>135<td><code><pre> )</pre></code><tr><td>136<td><code><pre> } else {</pre></code><tr class=miss><td>137<td><code><pre> m.AddSample(ctx, metricsLatencyKey, latency,</pre></code><tr><td>138<td><code><pre> metrics.Labels(labels),</pre></code><tr><td>139<td><code><pre> metrics.PrometheusBuckets(metricsLatencyBuckets),</pre></code><tr><td>140<td><code><pre> )</pre></code><tr><td>141<td><code><pre> }</pre></code><tr><td>142<td><code><pre> }</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre> }</pre></code></table><div class=funcname id=fn_@63:21>func @63:21</div><div class=info><a href=#s_fn_@63:21>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/metrics.go</code>:</div><table class=listing><tr><td>63<td><code><pre>func() {</pre></code><tr><td>64<td><code><pre> var total, inuse int64</pre></code><tr><td>65<td><code><pre> _, err := utils.Catch(func() {</pre></code><tr><td>66<td><code><pre> metricsPoolLocker.RLock()</pre></code><tr><td>67<td><code><pre> defer metricsPoolLocker.RUnlock()</pre></code><tr><td>68<td><code><pre> inuse = metricsPoolInUseCounter[appName][name].Load()</pre></code><tr><td>69<td><code><pre> total = metricsPoolTotalCounter[appName][name].Load()</pre></code><tr><td>70<td><code><pre> })</pre></code><tr><td>71<td><code><pre> if err != nil {</pre></code><tr class=miss><td>72<td><code><pre> return</pre></code><tr><td>73<td><code><pre> }</pre></code><tr><td>74<td><code><pre></pre></code><tr><td>75<td><code><pre> app := config.Use(appName).AppName()</pre></code><tr><td>76<td><code><pre> idleKey := append([]string{app}, metricsPoolIdleKey...)</pre></code><tr><td>77<td><code><pre> inuseKey := append([]string{app}, metricsPoolInUseKey...)</pre></code><tr><td>78<td><code><pre> totalKey := append([]string{app}, metricsPoolTotalKey...)</pre></code><tr><td>79<td><code><pre> ide := total - inuse</pre></code><tr><td>80<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr class=miss><td>81<td><code><pre> select {</pre></code><tr><td>82<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>83<td><code><pre> return</pre></code><tr><td>84<td><code><pre> default:</pre></code><tr class=miss><td>85<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr class=miss><td>86<td><code><pre> m.SetGauge(ctx, idleKey, float64(ide), metrics.Labels(labels))</pre></code><tr class=miss><td>87<td><code><pre> m.SetGauge(ctx, inuseKey, float64(inuse), metrics.Labels(labels))</pre></code><tr class=miss><td>88<td><code><pre> m.SetGauge(ctx, totalKey, float64(total), metrics.Labels(labels))</pre></code><tr><td>89<td><code><pre> } else {</pre></code><tr class=miss><td>90<td><code><pre> m.SetGauge(ctx, metricsPoolIdleKey, float64(ide), metrics.Labels(labels))</pre></code><tr class=miss><td>91<td><code><pre> m.SetGauge(ctx, metricsPoolInUseKey, float64(inuse), metrics.Labels(labels))</pre></code><tr class=miss><td>92<td><code><pre> m.SetGauge(ctx, metricsPoolTotalKey, float64(total), metrics.Labels(labels))</pre></code><tr><td>93<td><code><pre> }</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre> }</pre></code><tr><td>96<td><code><pre> }</pre></code></table><div class=funcname id=fn_@78:9>func @78:9</div><div class=info><a href=#s_fn_@78:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/mongo.go</code>:</div><table class=listing><tr><td>78<td><code><pre>func(o *useOption) {</pre></code><tr class=miss><td>79<td><code><pre> o.readConcern = readConcern</pre></code><tr><td>80<td><code><pre> }</pre></code></table><div class=funcname id=fn_ReadConcern>func ReadConcern</div><div class=info><a href=#s_fn_ReadConcern>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/mongo.go</code>:</div><table class=listing><tr><td>77<td><code><pre>func ReadConcern(readConcern *readconcern.ReadConcern) utils.OptionFunc[useOption] {</pre></code><tr class=miss><td>78<td><code><pre> return func(o *useOption) {</pre></code><tr><td>79<td><code><pre> o.readConcern = readConcern</pre></code><tr><td>80<td><code><pre> }</pre></code><tr><td>81<td><code><pre>}</pre></code></table><div class=funcname id=fn_@87:4>func @87:4</div><div class=info><a href=#s_fn_@87:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/construct.go</code>:</div><table class=listing><tr><td>87<td><code><pre>func() *mgoDrv.Database {</pre></code><tr class=miss><td>88<td><code><pre> return Use(name, AppName(opt.AppName)).Database</pre></code><tr><td>89<td><code><pre> }</pre></code></table><div class=funcname id=fn_@88:9>func @88:9</div><div class=info><a href=#s_fn_@88:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/mongo.go</code>:</div><table class=listing><tr><td>88<td><code><pre>func(o *useOption) {</pre></code><tr class=miss><td>89<td><code><pre> o.readPreference = readPreference</pre></code><tr><td>90<td><code><pre> }</pre></code></table><div class=funcname id=fn_BsonOptions>func BsonOptions</div><div class=info><a href=#s_fn_BsonOptions>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/mongo.go</code>:</div><table class=listing><tr><td>92<td><code><pre>func BsonOptions(bsonOptions *options.BSONOptions) utils.OptionFunc[useOption] {</pre></code><tr class=miss><td>93<td><code><pre> return func(o *useOption) {</pre></code><tr><td>94<td><code><pre> o.bsonOptions = bsonOptions</pre></code><tr><td>95<td><code><pre> }</pre></code><tr><td>96<td><code><pre>}</pre></code></table><div class=funcname id=fn_@93:9>func @93:9</div><div class=info><a href=#s_fn_@93:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/mongo.go</code>:</div><table class=listing><tr><td>93<td><code><pre>func(o *useOption) {</pre></code><tr class=miss><td>94<td><code><pre> o.bsonOptions = bsonOptions</pre></code><tr><td>95<td><code><pre> }</pre></code></table><div class=funcname id=fn_Registry>func Registry</div><div class=info><a href=#s_fn_Registry>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/mongo.go</code>:</div><table class=listing><tr><td>97<td><code><pre>func Registry(registry *bsoncodec.Registry) utils.OptionFunc[useOption] {</pre></code><tr class=miss><td>98<td><code><pre> return func(o *useOption) {</pre></code><tr><td>99<td><code><pre> o.registry = registry</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre>}</pre></code></table><div class=funcname id=fn_@98:9>func @98:9</div><div class=info><a href=#s_fn_@98:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/mongo.go</code>:</div><table class=listing><tr><td>98<td><code><pre>func(o *useOption) {</pre></code><tr class=miss><td>99<td><code><pre> o.registry = registry</pre></code><tr><td>100<td><code><pre> }</pre></code></table><div class=funcname id=fn_ReadPreference>func ReadPreference</div><div class=info><a href=#s_fn_ReadPreference>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mongo/mongo.go</code>:</div><table class=listing><tr><td>87<td><code><pre>func ReadPreference(readPreference *readpref.ReadPref) utils.OptionFunc[useOption] {</pre></code><tr class=miss><td>88<td><code><pre> return func(o *useOption) {</pre></code><tr><td>89<td><code><pre> o.readPreference = readPreference</pre></code><tr><td>90<td><code><pre> }</pre></code><tr><td>91<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/mq class=funcname>Package Overview: github.com/wfusion/gofusion/mq 41 <span class=packageTotal>62.2%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_NewEventSubscriber><td><code><a href=#fn_NewEventSubscriber>NewEventSubscriber(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>100.0%</code><td class=linecount><code>9/9</code><tr id=s_fn_Construct><td><code><a href=#fn_Construct>Construct(...)</a></code><td><code>github.com/wfusion/gofusion/mq/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_router.Handle><td><code><a href=#fn_router.Handle>router.Handle(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_newPostgres><td><code><a href=#fn_newPostgres>newPostgres(...)</a></code><td><code>github.com/wfusion/gofusion/mq/postgres.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_newMysql><td><code><a href=#fn_newMysql>newMysql(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mysql.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_newGoChannel><td><code><a href=#fn_newGoChannel>newGoChannel(...)</a></code><td><code>github.com/wfusion/gofusion/mq/gochannel.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_router.runEventHandlers><td><code><a href=#fn_router.runEventHandlers>router.runEventHandlers(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_newRedis><td><code><a href=#fn_newRedis>newRedis(...)</a></code><td><code>github.com/wfusion/gofusion/mq/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>6/6</code><tr id=s_fn_newKafka><td><code><a href=#fn_newKafka>newKafka(...)</a></code><td><code>github.com/wfusion/gofusion/mq/kafka.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_eventSubscriber[T].SubscribeEvent><td><code><a href=#fn_eventSubscriber[T].SubscribeEvent>eventSubscriber[T].SubscribeEvent(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_newPulsar><td><code><a href=#fn_newPulsar>newPulsar(...)</a></code><td><code>github.com/wfusion/gofusion/mq/pulsar.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_newAMQP><td><code><a href=#fn_newAMQP>newAMQP(...)</a></code><td><code>github.com/wfusion/gofusion/mq/amqp.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_newPub><td><code><a href=#fn_newPub>newPub(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_NewEventPublisher><td><code><a href=#fn_NewEventPublisher>NewEventPublisher(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_newSub><td><code><a href=#fn_newSub>newSub(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_messageConvertTo><td><code><a href=#fn_messageConvertTo>messageConvertTo(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_isEventHandler><td><code><a href=#fn_isEventHandler>isEventHandler(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_postgresPublisher.close><td><code><a href=#fn_postgresPublisher.close>postgresPublisher.close(...)</a></code><td><code>github.com/wfusion/gofusion/mq/postgres.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/mq/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@158:9><td><code><a href=#fn_@158:9>@158:9(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_messages><td><code><a href=#fn_messages>messages(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_EventHandler><td><code><a href=#fn_EventHandler>EventHandler(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@48:9><td><code><a href=#fn_@48:9>@48:9(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_EventHandlerWithMsg><td><code><a href=#fn_EventHandlerWithMsg>EventHandlerWithMsg(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@55:9><td><code><a href=#fn_@55:9>@55:9(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Messages><td><code><a href=#fn_Messages>Messages(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@161:9><td><code><a href=#fn_@161:9>@161:9(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Events><td><code><a href=#fn_Events>Events(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_router.close><td><code><a href=#fn_router.close>router.close(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_router.addEventDispatchHandler><td><code><a href=#fn_router.addEventDispatchHandler>router.addEventDispatchHandler(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@179:9><td><code><a href=#fn_@179:9>@179:9(...)</a></code><td><code>github.com/wfusion/gofusion/mq/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_AppName><td><code><a href=#fn_AppName>AppName(...)</a></code><td><code>github.com/wfusion/gofusion/mq/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@172:9><td><code><a href=#fn_@172:9>@172:9(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_router.Running><td><code><a href=#fn_router.Running>router.Running(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_redisSubscriber.close><td><code><a href=#fn_redisSubscriber.close>redisSubscriber.close(...)</a></code><td><code>github.com/wfusion/gofusion/mq/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_UntimedEvent><td><code><a href=#fn_UntimedEvent>UntimedEvent(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_redisPublisher.close><td><code><a href=#fn_redisPublisher.close>redisPublisher.close(...)</a></code><td><code>github.com/wfusion/gofusion/mq/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_ChannelLen><td><code><a href=#fn_ChannelLen>ChannelLen(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_pulsarSubscriber.close><td><code><a href=#fn_pulsarSubscriber.close>pulsarSubscriber.close(...)</a></code><td><code>github.com/wfusion/gofusion/mq/pulsar.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_newEvent><td><code><a href=#fn_newEvent>newEvent(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_pulsarPublisher.close><td><code><a href=#fn_pulsarPublisher.close>pulsarPublisher.close(...)</a></code><td><code>github.com/wfusion/gofusion/mq/pulsar.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_event[T].Type><td><code><a href=#fn_event[T].Type>event[T].Type(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_event[T].Payload><td><code><a href=#fn_event[T].Payload>event[T].Payload(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@182:9><td><code><a href=#fn_@182:9>@182:9(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_postgresSubscriber.close><td><code><a href=#fn_postgresSubscriber.close>postgresSubscriber.close(...)</a></code><td><code>github.com/wfusion/gofusion/mq/postgres.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@86:38><td><code><a href=#fn_@86:38>@86:38(...)</a></code><td><code>github.com/wfusion/gofusion/mq/postgres.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_event[T].Context><td><code><a href=#fn_event[T].Context>event[T].Context(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@80:31><td><code><a href=#fn_@80:31>@80:31(...)</a></code><td><code>github.com/wfusion/gofusion/mq/postgres.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@42:31><td><code><a href=#fn_@42:31>@42:31(...)</a></code><td><code>github.com/wfusion/gofusion/mq/postgres.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_handleEventSubscriber><td><code><a href=#fn_handleEventSubscriber>handleEventSubscriber(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/mq/flag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@192:9><td><code><a href=#fn_@192:9>@192:9(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_goChannel.close><td><code><a href=#fn_goChannel.close>goChannel.close(...)</a></code><td><code>github.com/wfusion/gofusion/mq/gochannel.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_NewMessage><td><code><a href=#fn_NewMessage>NewMessage(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_mysqlSubscriber.close><td><code><a href=#fn_mysqlSubscriber.close>mysqlSubscriber.close(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mysql.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_kafkaPublisher.close><td><code><a href=#fn_kafkaPublisher.close>kafkaPublisher.close(...)</a></code><td><code>github.com/wfusion/gofusion/mq/kafka.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@86:38><td><code><a href=#fn_@86:38>@86:38(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mysql.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_kafkaSubscriber.close><td><code><a href=#fn_kafkaSubscriber.close>kafkaSubscriber.close(...)</a></code><td><code>github.com/wfusion/gofusion/mq/kafka.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@80:31><td><code><a href=#fn_@80:31>@80:31(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mysql.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_mysqlPublisher.close><td><code><a href=#fn_mysqlPublisher.close>mysqlPublisher.close(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mysql.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@42:31><td><code><a href=#fn_@42:31>@42:31(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mysql.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_abstractMQ.topic><td><code><a href=#fn_abstractMQ.topic>abstractMQ.topic(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn__AMQPSubscriber.close><td><code><a href=#fn__AMQPSubscriber.close>_AMQPSubscriber.close(...)</a></code><td><code>github.com/wfusion/gofusion/mq/amqp.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_message.ID><td><code><a href=#fn_message.ID>message.ID(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_rawMessageConvertFrom><td><code><a href=#fn_rawMessageConvertFrom>rawMessageConvertFrom(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_abstractMQ.watermillSubscriber><td><code><a href=#fn_abstractMQ.watermillSubscriber>abstractMQ.watermillSubscriber(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn__AMQPPublisher.close><td><code><a href=#fn__AMQPPublisher.close>_AMQPPublisher.close(...)</a></code><td><code>github.com/wfusion/gofusion/mq/amqp.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_message.Payload><td><code><a href=#fn_message.Payload>message.Payload(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_abstractMQ.watermillPublisher><td><code><a href=#fn_abstractMQ.watermillPublisher>abstractMQ.watermillPublisher(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_event[T].ID><td><code><a href=#fn_event[T].ID>event[T].ID(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@395:6><td><code><a href=#fn_@395:6>@395:6(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>92.9%</code><td class=linecount><code>13/14</code><tr id=s_fn_eventPublisher[T].PublishEvent><td><code><a href=#fn_eventPublisher[T].PublishEvent>eventPublisher[T].PublishEvent(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>91.7%</code><td class=linecount><code>11/12</code><tr id=s_fn_router.handleEvent><td><code><a href=#fn_router.handleEvent>router.handleEvent(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>89.5%</code><td class=linecount><code>17/19</code><tr id=s_fn_@41:9><td><code><a href=#fn_@41:9>@41:9(...)</a></code><td><code>github.com/wfusion/gofusion/mq/construct.go</code><td class=percent><code>88.0%</code><td class=linecount><code>22/25</code><tr id=s_fn_@370:3><td><code><a href=#fn_@370:3>@370:3(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>86.2%</code><td class=linecount><code>25/29</code><tr id=s_fn_@278:5><td><code><a href=#fn_@278:5>@278:5(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_abstractMQ.SubscribeRaw><td><code><a href=#fn_abstractMQ.SubscribeRaw>abstractMQ.SubscribeRaw(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_formatEventHandlerSignature><td><code><a href=#fn_formatEventHandlerSignature>formatEventHandlerSignature(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>85.7%</code><td class=linecount><code>6/7</code><tr id=s_fn_addInstance><td><code><a href=#fn_addInstance>addInstance(...)</a></code><td><code>github.com/wfusion/gofusion/mq/construct.go</code><td class=percent><code>84.1%</code><td class=linecount><code>37/44</code><tr id=s_fn_router.isHandlerConflict><td><code><a href=#fn_router.isHandlerConflict>router.isHandlerConflict(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_Pub><td><code><a href=#fn_Pub>Pub(...)</a></code><td><code>github.com/wfusion/gofusion/mq/construct.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_Sub><td><code><a href=#fn_Sub>Sub(...)</a></code><td><code>github.com/wfusion/gofusion/mq/construct.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_Use><td><code><a href=#fn_Use>Use(...)</a></code><td><code>github.com/wfusion/gofusion/mq/construct.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_newMysqlSubscriber><td><code><a href=#fn_newMysqlSubscriber>newMysqlSubscriber(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mysql.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_newRedisSubscriber><td><code><a href=#fn_newRedisSubscriber>newRedisSubscriber(...)</a></code><td><code>github.com/wfusion/gofusion/mq/redis.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_newRedisPublisher><td><code><a href=#fn_newRedisPublisher>newRedisPublisher(...)</a></code><td><code>github.com/wfusion/gofusion/mq/redis.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_newKafkaPublisher><td><code><a href=#fn_newKafkaPublisher>newKafkaPublisher(...)</a></code><td><code>github.com/wfusion/gofusion/mq/kafka.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_newPostgresPublisher><td><code><a href=#fn_newPostgresPublisher>newPostgresPublisher(...)</a></code><td><code>github.com/wfusion/gofusion/mq/postgres.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_newMysqlPublisher><td><code><a href=#fn_newMysqlPublisher>newMysqlPublisher(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mysql.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_newPostgresSubscriber><td><code><a href=#fn_newPostgresSubscriber>newPostgresSubscriber(...)</a></code><td><code>github.com/wfusion/gofusion/mq/postgres.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_router.Start><td><code><a href=#fn_router.Start>router.Start(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_newAMQPPublisher><td><code><a href=#fn_newAMQPPublisher>newAMQPPublisher(...)</a></code><td><code>github.com/wfusion/gofusion/mq/amqp.go</code><td class=percent><code>78.6%</code><td class=linecount><code>11/14</code><tr id=s_fn_newAMQPSubscriber><td><code><a href=#fn_newAMQPSubscriber>newAMQPSubscriber(...)</a></code><td><code>github.com/wfusion/gofusion/mq/amqp.go</code><td class=percent><code>78.6%</code><td class=linecount><code>11/14</code><tr id=s_fn_newRouter><td><code><a href=#fn_newRouter>newRouter(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>75.0%</code><td class=linecount><code>18/24</code><tr id=s_fn_newPulsarPublisher><td><code><a href=#fn_newPulsarPublisher>newPulsarPublisher(...)</a></code><td><code>github.com/wfusion/gofusion/mq/pulsar.go</code><td class=percent><code>75.0%</code><td class=linecount><code>9/12</code><tr id=s_fn_abstractMQ.PublishRaw><td><code><a href=#fn_abstractMQ.PublishRaw>abstractMQ.PublishRaw(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>71.4%</code><td class=linecount><code>10/14</code><tr id=s_fn_newKafkaSubscriber><td><code><a href=#fn_newKafkaSubscriber>newKafkaSubscriber(...)</a></code><td><code>github.com/wfusion/gofusion/mq/kafka.go</code><td class=percent><code>71.4%</code><td class=linecount><code>5/7</code><tr id=s_fn_abstractMQ.newObjectMessage><td><code><a href=#fn_abstractMQ.newObjectMessage>abstractMQ.newObjectMessage(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>66.7%</code><td class=linecount><code>8/12</code><tr id=s_fn_router.run><td><code><a href=#fn_router.run>router.run(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>66.7%</code><td class=linecount><code>4/6</code><tr id=s_fn_event[T].Ack><td><code><a href=#fn_event[T].Ack>event[T].Ack(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_parseKafkaConf><td><code><a href=#fn_parseKafkaConf>parseKafkaConf(...)</a></code><td><code>github.com/wfusion/gofusion/mq/kafka.go</code><td class=percent><code>64.0%</code><td class=linecount><code>16/25</code><tr id=s_fn_messageConvertFrom><td><code><a href=#fn_messageConvertFrom>messageConvertFrom(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>63.6%</code><td class=linecount><code>7/11</code><tr id=s_fn_newPulsarSubscriber><td><code><a href=#fn_newPulsarSubscriber>newPulsarSubscriber(...)</a></code><td><code>github.com/wfusion/gofusion/mq/pulsar.go</code><td class=percent><code>60.0%</code><td class=linecount><code>9/15</code><tr id=s_fn_parseAMQPEndpoint><td><code><a href=#fn_parseAMQPEndpoint>parseAMQPEndpoint(...)</a></code><td><code>github.com/wfusion/gofusion/mq/amqp.go</code><td class=percent><code>54.5%</code><td class=linecount><code>6/11</code><tr id=s_fn_@146:13><td><code><a href=#fn_@146:13>@146:13(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>46.7%</code><td class=linecount><code>7/15</code><tr id=s_fn_router.addHandler><td><code><a href=#fn_router.addHandler>router.addHandler(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>45.5%</code><td class=linecount><code>5/11</code><tr id=s_fn_abstractMQ.Publish><td><code><a href=#fn_abstractMQ.Publish>abstractMQ.Publish(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>36.8%</code><td class=linecount><code>7/19</code><tr id=s_fn_@129:26><td><code><a href=#fn_@129:26>@129:26(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>25.0%</code><td class=linecount><code>3/12</code><tr id=s_fn_@188:13><td><code><a href=#fn_@188:13>@188:13(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/25</code><tr id=s_fn_setParams><td><code><a href=#fn_setParams>setParams(...)</a></code><td><code>github.com/wfusion/gofusion/mq/utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/12</code><tr id=s_fn_formatFields><td><code><a href=#fn_formatFields>formatFields(...)</a></code><td><code>github.com/wfusion/gofusion/mq/log.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/10</code><tr id=s_fn_sub><td><code><a href=#fn_sub>sub(...)</a></code><td><code>github.com/wfusion/gofusion/mq/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/10</code><tr id=s_fn_router.Serve><td><code><a href=#fn_router.Serve>router.Serve(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/8</code><tr id=s_fn_abstractMQ.newMessage><td><code><a href=#fn_abstractMQ.newMessage>abstractMQ.newMessage(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_abstractMQ.Subscribe><td><code><a href=#fn_abstractMQ.Subscribe>abstractMQ.Subscribe(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_wrapParams><td><code><a href=#fn_wrapParams>wrapParams(...)</a></code><td><code>github.com/wfusion/gofusion/mq/utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_@340:9><td><code><a href=#fn_@340:9>@340:9(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_@117:19><td><code><a href=#fn_@117:19>@117:19(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_event[T].toTime><td><code><a href=#fn_event[T].toTime>event[T].toTime(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_@113:18><td><code><a href=#fn_@113:18>@113:18(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_@78:19><td><code><a href=#fn_@78:19>@78:19(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_@220:4><td><code><a href=#fn_@220:4>@220:4(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_unwrapParams><td><code><a href=#fn_unwrapParams>unwrapParams(...)</a></code><td><code>github.com/wfusion/gofusion/mq/utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@150:9><td><code><a href=#fn_@150:9>@150:9(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_event[T].Nack><td><code><a href=#fn_event[T].Nack>event[T].Nack(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@120:16><td><code><a href=#fn_@120:16>@120:16(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@81:16><td><code><a href=#fn_@81:16>@81:16(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_router.handle><td><code><a href=#fn_router.handle>router.handle(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@166:9><td><code><a href=#fn_@166:9>@166:9(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_formatLogMsg><td><code><a href=#fn_formatLogMsg>formatLogMsg(...)</a></code><td><code>github.com/wfusion/gofusion/mq/log.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@252:5><td><code><a href=#fn_@252:5>@252:5(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@264:5><td><code><a href=#fn_@264:5>@264:5(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_logInfo><td><code><a href=#fn_logInfo>logInfo(...)</a></code><td><code>github.com/wfusion/gofusion/mq/log.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_logDebug><td><code><a href=#fn_logDebug>logDebug(...)</a></code><td><code>github.com/wfusion/gofusion/mq/log.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_logError><td><code><a href=#fn_logError>logError(...)</a></code><td><code>github.com/wfusion/gofusion/mq/log.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@102:9><td><code><a href=#fn_@102:9>@102:9(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_NewEventSubscriberDI><td><code><a href=#fn_NewEventSubscriberDI>NewEventSubscriberDI(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_logTrace><td><code><a href=#fn_logTrace>logTrace(...)</a></code><td><code>github.com/wfusion/gofusion/mq/log.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_event[T].UpdatedAt><td><code><a href=#fn_event[T].UpdatedAt>event[T].UpdatedAt(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_kafkaOAuthProvider.Token><td><code><a href=#fn_kafkaOAuthProvider.Token>kafkaOAuthProvider.Token(...)</a></code><td><code>github.com/wfusion/gofusion/mq/kafka.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@150:17><td><code><a href=#fn_@150:17>@150:17(...)</a></code><td><code>github.com/wfusion/gofusion/mq/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Objects><td><code><a href=#fn_Objects>Objects(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@62:9><td><code><a href=#fn_@62:9>@62:9(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_NewEventPublisherDI><td><code><a href=#fn_NewEventPublisherDI>NewEventPublisherDI(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_abstractMQ.watermillLogger><td><code><a href=#fn_abstractMQ.watermillLogger>abstractMQ.watermillLogger(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_EventDeleted><td><code><a href=#fn_EventDeleted>EventDeleted(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@133:19><td><code><a href=#fn_@133:19>@133:19(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Async><td><code><a href=#fn_Async>Async(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@130:20><td><code><a href=#fn_@130:20>@130:20(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@93:29><td><code><a href=#fn_@93:29>@93:29(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@169:23><td><code><a href=#fn_@169:23>@169:23(...)</a></code><td><code>github.com/wfusion/gofusion/mq/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_abstractMQ.close><td><code><a href=#fn_abstractMQ.close>abstractMQ.close(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@149:17><td><code><a href=#fn_@149:17>@149:17(...)</a></code><td><code>github.com/wfusion/gofusion/mq/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@77:18><td><code><a href=#fn_@77:18>@77:18(...)</a></code><td><code>github.com/wfusion/gofusion/mq/router.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_NewEvent><td><code><a href=#fn_NewEvent>NewEvent(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@118:38><td><code><a href=#fn_@118:38>@118:38(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_event[T].DeletedAt><td><code><a href=#fn_event[T].DeletedAt>event[T].DeletedAt(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_EventCreated><td><code><a href=#fn_EventCreated>EventCreated(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_message.RawMessage><td><code><a href=#fn_message.RawMessage>message.RawMessage(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_message.Object><td><code><a href=#fn_message.Object>message.Object(...)</a></code><td><code>github.com/wfusion/gofusion/mq/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_event[T].CreatedAt><td><code><a href=#fn_event[T].CreatedAt>event[T].CreatedAt(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_EventUpdated><td><code><a href=#fn_EventUpdated>EventUpdated(...)</a></code><td><code>github.com/wfusion/gofusion/mq/event.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@79:38><td><code><a href=#fn_@79:38>@79:38(...)</a></code><td><code>github.com/wfusion/gofusion/mq/mq.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_NewEventSubscriber>func NewEventSubscriber</div><div class=info><a href=#s_fn_NewEventSubscriber>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>107<td><code><pre>func NewEventSubscriber[T eventual](name string, opts ...utils.OptionExtender) EventSubscriber[T] {</pre></code><tr><td>108<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>109<td><code><pre> subscriber := Sub(name, AppName(opt.appName))</pre></code><tr><td>110<td><code><pre> abstractMq := inspect.GetField[*abstractMQ](subscriber, "abstractMQ")</pre></code><tr><td>111<td><code><pre></pre></code><tr><td>112<td><code><pre> var m reflect.Value</pre></code><tr><td>113<td><code><pre> for tv := reflect.ValueOf(new(T)); tv.Kind() == reflect.Ptr; tv = tv.Elem() {</pre></code><tr><td>114<td><code><pre> if m = tv.MethodByName("EventType"); m.IsValid() {</pre></code><tr><td>115<td><code><pre> break</pre></code><tr><td>116<td><code><pre> }</pre></code><tr><td>117<td><code><pre> }</pre></code><tr><td>118<td><code><pre> eventType := m.Call(nil)[0].String()</pre></code><tr><td>119<td><code><pre> return &eventSubscriber[T]{abstractMQ: abstractMq, evtType: eventType}</pre></code><tr><td>120<td><code><pre>}</pre></code></table><div class=funcname id=fn_Construct>func Construct</div><div class=info><a href=#s_fn_Construct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/construct.go</code>:</div><table class=listing><tr><td>30<td><code><pre>func Construct(ctx context.Context, confs map[string]*Conf, opts ...utils.OptionExtender) func() {</pre></code><tr><td>31<td><code><pre> opt := utils.ApplyOptions[config.InitOption](opts...)</pre></code><tr><td>32<td><code><pre> optU := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>33<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>34<td><code><pre> opt.AppName = optU.appName</pre></code><tr><td>35<td><code><pre> }</pre></code><tr><td>36<td><code><pre></pre></code><tr><td>37<td><code><pre> for name, conf := range confs {</pre></code><tr><td>38<td><code><pre> addInstance(ctx, name, conf, opt)</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre></pre></code><tr><td>41<td><code><pre> return func() {</pre></code><tr><td>42<td><code><pre> locker.Lock()</pre></code><tr><td>43<td><code><pre> defer locker.Unlock()</pre></code><tr><td>44<td><code><pre></pre></code><tr><td>45<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>46<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>47<td><code><pre> if routers != nil {</pre></code><tr><td>48<td><code><pre> for name, router := range routers[opt.AppName] {</pre></code><tr><td>49<td><code><pre> log.Printf("%v [Gofusion] %s %s %s router exiting...",</pre></code><tr><td>50<td><code><pre> pid, app, config.ComponentMessageQueue, name)</pre></code><tr><td>51<td><code><pre> if err := router.close(); err == nil {</pre></code><tr><td>52<td><code><pre> log.Printf("%v [Gofusion] %s %s %s router exited",</pre></code><tr><td>53<td><code><pre> pid, app, config.ComponentMessageQueue, name)</pre></code><tr><td>54<td><code><pre> } else {</pre></code><tr><td>55<td><code><pre> log.Printf("%v [Gofusion] %s %s %s router exit failed: %s",</pre></code><tr><td>56<td><code><pre> pid, app, config.ComponentMessageQueue, name, err)</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre> delete(routers, opt.AppName)</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre></pre></code><tr><td>62<td><code><pre> if publishers != nil {</pre></code><tr><td>63<td><code><pre> for name, publisher := range publishers[opt.AppName] {</pre></code><tr><td>64<td><code><pre> log.Printf("%v [Gofusion] %s %s %s publisher exiting...",</pre></code><tr><td>65<td><code><pre> pid, app, config.ComponentMessageQueue, name)</pre></code><tr><td>66<td><code><pre> if err := publisher.close(); err == nil {</pre></code><tr><td>67<td><code><pre> log.Printf("%v [Gofusion] %s %s %s publisher exited",</pre></code><tr><td>68<td><code><pre> pid, app, config.ComponentMessageQueue, name)</pre></code><tr><td>69<td><code><pre> } else {</pre></code><tr><td>70<td><code><pre> log.Printf("%v [Gofusion] %s %s %s publisher exit failed: %s",</pre></code><tr><td>71<td><code><pre> pid, app, config.ComponentMessageQueue, name, err)</pre></code><tr><td>72<td><code><pre> }</pre></code><tr><td>73<td><code><pre> }</pre></code><tr><td>74<td><code><pre> delete(publishers, opt.AppName)</pre></code><tr><td>75<td><code><pre> }</pre></code><tr><td>76<td><code><pre></pre></code><tr><td>77<td><code><pre> if subscribers != nil {</pre></code><tr><td>78<td><code><pre> for name, subscriber := range subscribers[opt.AppName] {</pre></code><tr><td>79<td><code><pre> log.Printf("%v [Gofusion] %s %s %s subscriber exiting...",</pre></code><tr><td>80<td><code><pre> pid, app, config.ComponentMessageQueue, name)</pre></code><tr><td>81<td><code><pre> if err := subscriber.close(); err == nil {</pre></code><tr><td>82<td><code><pre> log.Printf("%v [Gofusion] %s %s %s subscriber exited",</pre></code><tr><td>83<td><code><pre> pid, app, config.ComponentMessageQueue, name)</pre></code><tr><td>84<td><code><pre> } else {</pre></code><tr><td>85<td><code><pre> log.Printf("%v [Gofusion] %s %s %s subscriber exit failed: %s",</pre></code><tr><td>86<td><code><pre> pid, app, config.ComponentMessageQueue, name, err)</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre> }</pre></code><tr><td>89<td><code><pre> delete(subscribers, opt.AppName)</pre></code><tr><td>90<td><code><pre> }</pre></code><tr><td>91<td><code><pre> }</pre></code><tr><td>92<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.Handle>func router.Handle</div><div class=info><a href=#s_fn_router.Handle>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>161<td><code><pre>func (r *router) Handle(handlerName string, hdr any, opts ...utils.OptionExtender) {</pre></code><tr><td>162<td><code><pre> opt := utils.ApplyOptions[routerOption](opts...)</pre></code><tr><td>163<td><code><pre> if opt.isEventSubscriber || singleConsumerMQType.Contains(r.c.Type) {</pre></code><tr><td>164<td><code><pre> r.addHandler(handlerName, handlerName, hdr, opt)</pre></code><tr><td>165<td><code><pre> return</pre></code><tr><td>166<td><code><pre> }</pre></code><tr><td>167<td><code><pre> for i := 0; i < r.c.ConsumerConcurrency; i++ {</pre></code><tr><td>168<td><code><pre> consumerName := fmt.Sprintf("%s_%v", handlerName, i)</pre></code><tr><td>169<td><code><pre> r.addHandler(handlerName, consumerName, hdr, opt)</pre></code><tr><td>170<td><code><pre> }</pre></code><tr><td>171<td><code><pre>}</pre></code></table><div class=funcname id=fn_newPostgres>func newPostgres</div><div class=info><a href=#s_fn_newPostgres>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/postgres.go</code>:</div><table class=listing><tr><td>18<td><code><pre>func newPostgres(ctx context.Context, appName, name string, conf *Conf, logger watermill.LoggerAdapter) (</pre></code><tr><td>19<td><code><pre> pub Publisher, sub Subscriber) {</pre></code><tr><td>20<td><code><pre> instance := db.Use(ctx, conf.Endpoint.Instance, db.AppName(appName))</pre></code><tr><td>21<td><code><pre> cli := utils.Must(instance.GetProxy().DB())</pre></code><tr><td>22<td><code><pre> if conf.Producer {</pre></code><tr><td>23<td><code><pre> pub = newPostgresPublisher(ctx, appName, name, conf, logger, cli)</pre></code><tr><td>24<td><code><pre> }</pre></code><tr><td>25<td><code><pre></pre></code><tr><td>26<td><code><pre> if conf.Consumer {</pre></code><tr><td>27<td><code><pre> sub = newPostgresSubscriber(ctx, appName, name, conf, logger, cli)</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre></pre></code><tr><td>30<td><code><pre> return</pre></code><tr><td>31<td><code><pre>}</pre></code></table><div class=funcname id=fn_newMysql>func newMysql</div><div class=info><a href=#s_fn_newMysql>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mysql.go</code>:</div><table class=listing><tr><td>18<td><code><pre>func newMysql(ctx context.Context, appName, name string, conf *Conf, logger watermill.LoggerAdapter) (</pre></code><tr><td>19<td><code><pre> pub Publisher, sub Subscriber) {</pre></code><tr><td>20<td><code><pre> instance := db.Use(ctx, conf.Endpoint.Instance, db.AppName(appName))</pre></code><tr><td>21<td><code><pre> cli := utils.Must(instance.GetProxy().DB())</pre></code><tr><td>22<td><code><pre> if conf.Producer {</pre></code><tr><td>23<td><code><pre> pub = newMysqlPublisher(ctx, appName, name, conf, logger, cli)</pre></code><tr><td>24<td><code><pre> }</pre></code><tr><td>25<td><code><pre></pre></code><tr><td>26<td><code><pre> if conf.Consumer {</pre></code><tr><td>27<td><code><pre> sub = newMysqlSubscriber(ctx, appName, name, conf, logger, cli)</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre></pre></code><tr><td>30<td><code><pre> return</pre></code><tr><td>31<td><code><pre>}</pre></code></table><div class=funcname id=fn_newGoChannel>func newGoChannel</div><div class=info><a href=#s_fn_newGoChannel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/gochannel.go</code>:</div><table class=listing><tr><td>11<td><code><pre>func newGoChannel(ctx context.Context, appName, name string, conf *Conf, logger watermill.LoggerAdapter) (</pre></code><tr><td>12<td><code><pre> pub Publisher, sub Subscriber) {</pre></code><tr><td>13<td><code><pre> cfg := gochannel.Config{</pre></code><tr><td>14<td><code><pre> OutputChannelBuffer: int64(conf.ConsumerConcurrency),</pre></code><tr><td>15<td><code><pre> Persistent: conf.Persistent,</pre></code><tr><td>16<td><code><pre> ConsumerGroup: conf.ConsumerGroup,</pre></code><tr><td>17<td><code><pre> BlockPublishUntilSubscriberAck: false,</pre></code><tr><td>18<td><code><pre> AppID: config.Use(appName).AppName(),</pre></code><tr><td>19<td><code><pre> }</pre></code><tr><td>20<td><code><pre></pre></code><tr><td>21<td><code><pre> native := gochannel.NewGoChannel(cfg, logger)</pre></code><tr><td>22<td><code><pre> if conf.Producer {</pre></code><tr><td>23<td><code><pre> pub = &goChannel{</pre></code><tr><td>24<td><code><pre> abstractMQ: newPub(ctx, native, appName, name, conf, logger),</pre></code><tr><td>25<td><code><pre> ch: native,</pre></code><tr><td>26<td><code><pre> }</pre></code><tr><td>27<td><code><pre> }</pre></code><tr><td>28<td><code><pre></pre></code><tr><td>29<td><code><pre> if conf.Consumer {</pre></code><tr><td>30<td><code><pre> sub = &goChannel{</pre></code><tr><td>31<td><code><pre> abstractMQ: newSub(ctx, native, appName, name, conf, logger),</pre></code><tr><td>32<td><code><pre> ch: native,</pre></code><tr><td>33<td><code><pre> }</pre></code><tr><td>34<td><code><pre> }</pre></code><tr><td>35<td><code><pre> return</pre></code><tr><td>36<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.runEventHandlers>func router.runEventHandlers</div><div class=info><a href=#s_fn_router.runEventHandlers>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>352<td><code><pre>func (r *router) runEventHandlers() {</pre></code><tr><td>353<td><code><pre> if singleConsumerMQType.Contains(r.c.Type) {</pre></code><tr><td>354<td><code><pre> r.addEventDispatchHandler(defaultRouterEventHandlerName)</pre></code><tr><td>355<td><code><pre> return</pre></code><tr><td>356<td><code><pre> }</pre></code><tr><td>357<td><code><pre> for i := 0; i < r.c.ConsumerConcurrency; i++ {</pre></code><tr><td>358<td><code><pre> consumerName := fmt.Sprintf("%s_%v", defaultRouterEventHandlerName, i)</pre></code><tr><td>359<td><code><pre> r.addEventDispatchHandler(consumerName)</pre></code><tr><td>360<td><code><pre> }</pre></code><tr><td>361<td><code><pre>}</pre></code></table><div class=funcname id=fn_newRedis>func newRedis</div><div class=info><a href=#s_fn_newRedis>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/redis.go</code>:</div><table class=listing><tr><td>17<td><code><pre>func newRedis(ctx context.Context, appName, name string, conf *Conf, logger watermill.LoggerAdapter) (</pre></code><tr><td>18<td><code><pre> pub Publisher, sub Subscriber) {</pre></code><tr><td>19<td><code><pre></pre></code><tr><td>20<td><code><pre> cli := redis.Use(ctx, conf.Endpoint.Instance, redis.AppName(appName))</pre></code><tr><td>21<td><code><pre></pre></code><tr><td>22<td><code><pre> if conf.Producer {</pre></code><tr><td>23<td><code><pre> pub = newRedisPublisher(ctx, appName, name, conf, logger, cli)</pre></code><tr><td>24<td><code><pre> }</pre></code><tr><td>25<td><code><pre></pre></code><tr><td>26<td><code><pre> if conf.Consumer {</pre></code><tr><td>27<td><code><pre> sub = newRedisSubscriber(ctx, appName, name, conf, logger, cli)</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre></pre></code><tr><td>30<td><code><pre> return</pre></code><tr><td>31<td><code><pre>}</pre></code></table><div class=funcname id=fn_newKafka>func newKafka</div><div class=info><a href=#s_fn_newKafka>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/kafka.go</code>:</div><table class=listing><tr><td>17<td><code><pre>func newKafka(ctx context.Context, appName, name string, conf *Conf, logger watermill.LoggerAdapter) (</pre></code><tr><td>18<td><code><pre> pub Publisher, sub Subscriber) {</pre></code><tr><td>19<td><code><pre> if conf.Producer {</pre></code><tr><td>20<td><code><pre> pub = newKafkaPublisher(ctx, appName, name, conf, logger)</pre></code><tr><td>21<td><code><pre> }</pre></code><tr><td>22<td><code><pre></pre></code><tr><td>23<td><code><pre> if conf.Consumer {</pre></code><tr><td>24<td><code><pre> sub = newKafkaSubscriber(ctx, appName, name, conf, logger)</pre></code><tr><td>25<td><code><pre> }</pre></code><tr><td>26<td><code><pre></pre></code><tr><td>27<td><code><pre> return</pre></code><tr><td>28<td><code><pre>}</pre></code></table><div class=funcname id=fn_eventSubscriber[T].SubscribeEvent>func eventSubscriber[T].SubscribeEvent</div><div class=info><a href=#s_fn_eventSubscriber[T].SubscribeEvent>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>122<td><code><pre>func (e *eventSubscriber[T]) SubscribeEvent(ctx context.Context, opts ...utils.OptionExtender) (</pre></code><tr><td>123<td><code><pre> dst <-chan Event[T], err error) {</pre></code><tr><td>124<td><code><pre> opt := utils.ApplyOptions[subOption](opts...)</pre></code><tr><td>125<td><code><pre> out := make(chan Event[T], opt.channelLength)</pre></code><tr><td>126<td><code><pre> r := Use(e.name, AppName(e.appName)).(*router)</pre></code><tr><td>127<td><code><pre> r.Handle(</pre></code><tr><td>128<td><code><pre> e.evtType,</pre></code><tr><td>129<td><code><pre> EventHandlerWithMsg[T](func(ctx context.Context, event Event[T]) (msgs []Message, err error) {</pre></code><tr><td>130<td><code><pre> select {</pre></code><tr><td>131<td><code><pre> case out <- event:</pre></code><tr><td>132<td><code><pre> case <-r.Router.ClosingInProgressCh:</pre></code><tr><td>133<td><code><pre> event.Nack()</pre></code><tr><td>134<td><code><pre> e.logger.Info(fmt.Sprintf("event subscriber %s exited", e.name), nil)</pre></code><tr><td>135<td><code><pre> return</pre></code><tr><td>136<td><code><pre> case <-ctx.Done():</pre></code><tr><td>137<td><code><pre> event.Nack()</pre></code><tr><td>138<td><code><pre> e.logger.Info(fmt.Sprintf(</pre></code><tr><td>139<td><code><pre> "event subscriber %s exited with a message nacked when business ctx done", e.name),</pre></code><tr><td>140<td><code><pre> watermill.LogFields{watermill.ContextLogFieldKey: ctx})</pre></code><tr><td>141<td><code><pre> return</pre></code><tr><td>142<td><code><pre> case <-e.ctx.Done():</pre></code><tr><td>143<td><code><pre> event.Nack()</pre></code><tr><td>144<td><code><pre> e.logger.Info(fmt.Sprintf(</pre></code><tr><td>145<td><code><pre> "event subscriber %s exited with a message nacked when app ctx done", e.name),</pre></code><tr><td>146<td><code><pre> watermill.LogFields{watermill.ContextLogFieldKey: ctx})</pre></code><tr><td>147<td><code><pre> return</pre></code><tr><td>148<td><code><pre> }</pre></code><tr><td>149<td><code><pre></pre></code><tr><td>150<td><code><pre> msgs = append(msgs,</pre></code><tr><td>151<td><code><pre> &message{Message: &mw.Message{Metadata: mw.Metadata{watermill.MessageRouterAck: ""}}})</pre></code><tr><td>152<td><code><pre> return</pre></code><tr><td>153<td><code><pre> }),</pre></code><tr><td>154<td><code><pre> handleEventSubscriber(),</pre></code><tr><td>155<td><code><pre> )</pre></code><tr><td>156<td><code><pre> return out, err</pre></code><tr><td>157<td><code><pre>}</pre></code></table><div class=funcname id=fn_newPulsar>func newPulsar</div><div class=info><a href=#s_fn_newPulsar>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/pulsar.go</code>:</div><table class=listing><tr><td>18<td><code><pre>func newPulsar(ctx context.Context, appName, name string, conf *Conf, logger watermill.LoggerAdapter) (</pre></code><tr><td>19<td><code><pre> pub Publisher, sub Subscriber) {</pre></code><tr><td>20<td><code><pre> if conf.Producer {</pre></code><tr><td>21<td><code><pre> pub = newPulsarPublisher(ctx, appName, name, conf, logger)</pre></code><tr><td>22<td><code><pre> }</pre></code><tr><td>23<td><code><pre></pre></code><tr><td>24<td><code><pre> if conf.Consumer {</pre></code><tr><td>25<td><code><pre> sub = newPulsarSubscriber(ctx, appName, name, conf, logger)</pre></code><tr><td>26<td><code><pre> }</pre></code><tr><td>27<td><code><pre></pre></code><tr><td>28<td><code><pre> return</pre></code><tr><td>29<td><code><pre>}</pre></code></table><div class=funcname id=fn_newAMQP>func newAMQP</div><div class=info><a href=#s_fn_newAMQP>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/amqp.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func newAMQP(ctx context.Context, appName, name string, conf *Conf, logger watermill.LoggerAdapter) (</pre></code><tr><td>17<td><code><pre> pub Publisher, sub Subscriber) {</pre></code><tr><td>18<td><code><pre> if conf.Producer {</pre></code><tr><td>19<td><code><pre> pub = newAMQPPublisher(ctx, appName, name, conf, logger)</pre></code><tr><td>20<td><code><pre> }</pre></code><tr><td>21<td><code><pre></pre></code><tr><td>22<td><code><pre> if conf.Consumer {</pre></code><tr><td>23<td><code><pre> sub = newAMQPSubscriber(ctx, appName, name, conf, logger)</pre></code><tr><td>24<td><code><pre> }</pre></code><tr><td>25<td><code><pre></pre></code><tr><td>26<td><code><pre> return</pre></code><tr><td>27<td><code><pre>}</pre></code></table><div class=funcname id=fn_newPub>func newPub</div><div class=info><a href=#s_fn_newPub>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func newPub(ctx context.Context, pub mw.Publisher, appName, name string,</pre></code><tr><td>37<td><code><pre> conf *Conf, logger watermill.LoggerAdapter) *abstractMQ {</pre></code><tr><td>38<td><code><pre> mq := &abstractMQ{ctx: ctx, pub: pub, appName: appName, name: name, conf: clone.Slowly(conf), logger: logger}</pre></code><tr><td>39<td><code><pre> mq.serializeType = serialize.ParseAlgorithm(conf.SerializeType)</pre></code><tr><td>40<td><code><pre> mq.compressType = compress.ParseAlgorithm(conf.CompressType)</pre></code><tr><td>41<td><code><pre> return mq</pre></code><tr><td>42<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewEventPublisher>func NewEventPublisher</div><div class=info><a href=#s_fn_NewEventPublisher>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>67<td><code><pre>func NewEventPublisher[T eventual](name string, opts ...utils.OptionExtender) EventPublisher[T] {</pre></code><tr><td>68<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>69<td><code><pre> publisher := Pub(name, AppName(opt.appName))</pre></code><tr><td>70<td><code><pre> abstractMq := inspect.GetField[*abstractMQ](publisher, "abstractMQ")</pre></code><tr><td>71<td><code><pre> return &eventPublisher[T]{abstractMQ: abstractMq}</pre></code><tr><td>72<td><code><pre>}</pre></code></table><div class=funcname id=fn_newSub>func newSub</div><div class=info><a href=#s_fn_newSub>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>44<td><code><pre>func newSub(ctx context.Context, sub mw.Subscriber, appName, name string,</pre></code><tr><td>45<td><code><pre> conf *Conf, logger watermill.LoggerAdapter) *abstractMQ {</pre></code><tr><td>46<td><code><pre> mq := &abstractMQ{ctx: ctx, sub: sub, appName: appName, name: name, conf: clone.Slowly(conf), logger: logger}</pre></code><tr><td>47<td><code><pre> mq.serializeType = serialize.ParseAlgorithm(conf.SerializeType)</pre></code><tr><td>48<td><code><pre> mq.compressType = compress.ParseAlgorithm(conf.CompressType)</pre></code><tr><td>49<td><code><pre> return mq</pre></code><tr><td>50<td><code><pre>}</pre></code></table><div class=funcname id=fn_messageConvertTo>func messageConvertTo</div><div class=info><a href=#s_fn_messageConvertTo>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>280<td><code><pre>func messageConvertTo(src Message) (dst *mw.Message) {</pre></code><tr><td>281<td><code><pre> dst = src.(*message).Message</pre></code><tr><td>282<td><code><pre> return</pre></code><tr><td>283<td><code><pre>}</pre></code></table><div class=funcname id=fn_isEventHandler>func isEventHandler</div><div class=info><a href=#s_fn_isEventHandler>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>26<td><code><pre>func isEventHandler(f any) bool {</pre></code><tr><td>27<td><code><pre> sig := formatEventHandlerSignature(f)</pre></code><tr><td>28<td><code><pre> return strings.HasPrefix(sig, eventHandlerSignature) || strings.HasPrefix(sig, eventHandlerWithMsgSignature)</pre></code><tr><td>29<td><code><pre>}</pre></code></table><div class=funcname id=fn_postgresPublisher.close>func postgresPublisher.close</div><div class=info><a href=#s_fn_postgresPublisher.close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/postgres.go</code>:</div><table class=listing><tr><td>62<td><code><pre>func (p *postgresPublisher) close() (err error) {</pre></code><tr><td>63<td><code><pre> return p.publisher.Close()</pre></code><tr><td>64<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/construct.go</code>:</div><table class=listing><tr><td>248<td><code><pre>func init() {</pre></code><tr><td>249<td><code><pre> config.AddComponent(config.ComponentMessageQueue, Construct, config.WithFlag(&flagString))</pre></code><tr><td>250<td><code><pre>}</pre></code></table><div class=funcname id=fn_@158:9>func @158:9</div><div class=info><a href=#s_fn_@158:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>158<td><code><pre>func(o *pubOption) { o.messages = messages }</pre></code></table><div class=funcname id=fn_messages>func messages</div><div class=info><a href=#s_fn_messages>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>160<td><code><pre>func messages(messages ...*mw.Message) utils.OptionFunc[pubOption] {</pre></code><tr><td>161<td><code><pre> return func(o *pubOption) {</pre></code><tr><td>162<td><code><pre> o.watermillMessages = messages</pre></code><tr><td>163<td><code><pre> }</pre></code><tr><td>164<td><code><pre>}</pre></code></table><div class=funcname id=fn_EventHandler>func EventHandler</div><div class=info><a href=#s_fn_EventHandler>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>47<td><code><pre>func EventHandler[T eventual](hdr eventHandler[T]) eventHandler[T] {</pre></code><tr><td>48<td><code><pre> return func(ctx context.Context, event Event[T]) error {</pre></code><tr><td>49<td><code><pre> // TODO: dedup & discard expired event</pre></code><tr><td>50<td><code><pre> return hdr(ctx, event)</pre></code><tr><td>51<td><code><pre> }</pre></code><tr><td>52<td><code><pre>}</pre></code></table><div class=funcname id=fn_@48:9>func @48:9</div><div class=info><a href=#s_fn_@48:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>48<td><code><pre>func(ctx context.Context, event Event[T]) error {</pre></code><tr><td>49<td><code><pre> // TODO: dedup & discard expired event</pre></code><tr><td>50<td><code><pre> return hdr(ctx, event)</pre></code><tr><td>51<td><code><pre> }</pre></code></table><div class=funcname id=fn_EventHandlerWithMsg>func EventHandlerWithMsg</div><div class=info><a href=#s_fn_EventHandlerWithMsg>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>54<td><code><pre>func EventHandlerWithMsg[T eventual](hdr eventHandlerWithMsg[T]) eventHandlerWithMsg[T] {</pre></code><tr><td>55<td><code><pre> return func(ctx context.Context, event Event[T]) ([]Message, error) {</pre></code><tr><td>56<td><code><pre> // TODO: dedup & discard expired event</pre></code><tr><td>57<td><code><pre> return hdr(ctx, event)</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre>}</pre></code></table><div class=funcname id=fn_@55:9>func @55:9</div><div class=info><a href=#s_fn_@55:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>55<td><code><pre>func(ctx context.Context, event Event[T]) ([]Message, error) {</pre></code><tr><td>56<td><code><pre> // TODO: dedup & discard expired event</pre></code><tr><td>57<td><code><pre> return hdr(ctx, event)</pre></code><tr><td>58<td><code><pre> }</pre></code></table><div class=funcname id=fn_Messages>func Messages</div><div class=info><a href=#s_fn_Messages>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>157<td><code><pre>func Messages(messages ...Message) utils.OptionFunc[pubOption] {</pre></code><tr><td>158<td><code><pre> return func(o *pubOption) { o.messages = messages }</pre></code><tr><td>159<td><code><pre>}</pre></code></table><div class=funcname id=fn_@161:9>func @161:9</div><div class=info><a href=#s_fn_@161:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>161<td><code><pre>func(o *pubOption) {</pre></code><tr><td>162<td><code><pre> o.watermillMessages = messages</pre></code><tr><td>163<td><code><pre> }</pre></code></table><div class=funcname id=fn_Events>func Events</div><div class=info><a href=#s_fn_Events>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>171<td><code><pre>func Events[T eventual](events ...Event[T]) utils.OptionFunc[eventPubOption[T]] {</pre></code><tr><td>172<td><code><pre> return func(o *eventPubOption[T]) {</pre></code><tr><td>173<td><code><pre> o.events = events</pre></code><tr><td>174<td><code><pre> }</pre></code><tr><td>175<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.close>func router.close</div><div class=info><a href=#s_fn_router.close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>455<td><code><pre>func (r *router) close() (err error) {</pre></code><tr><td>456<td><code><pre> return r.Close()</pre></code><tr><td>457<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.addEventDispatchHandler>func router.addEventDispatchHandler</div><div class=info><a href=#s_fn_router.addEventDispatchHandler>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>363<td><code><pre>func (r *router) addEventDispatchHandler(consumerName string) {</pre></code><tr><td>364<td><code><pre> r.Router.AddHandler(</pre></code><tr><td>365<td><code><pre> consumerName,</pre></code><tr><td>366<td><code><pre> r.sub.topic(),</pre></code><tr><td>367<td><code><pre> r.sub.watermillSubscriber(),</pre></code><tr><td>368<td><code><pre> r.pub.topic(),</pre></code><tr><td>369<td><code><pre> r.pub.watermillPublisher(),</pre></code><tr><td>370<td><code><pre> func(msg *mw.Message) (pubMsgs []*mw.Message, err error) {</pre></code><tr><td>371<td><code><pre> eventType := msg.Metadata[keyEventType]</pre></code><tr><td>372<td><code><pre> r.locker.RLock()</pre></code><tr><td>373<td><code><pre> hdr, ok1 := r.eventHandlers[eventType]</pre></code><tr><td>374<td><code><pre> subhdr, ok2 := r.eventSubscriberHandlers[eventType]</pre></code><tr><td>375<td><code><pre> r.locker.RUnlock()</pre></code><tr><td>376<td><code><pre> if !ok1 && !ok2 {</pre></code><tr><td>377<td><code><pre> rawID := "unknown"</pre></code><tr><td>378<td><code><pre> if msg.Metadata != nil {</pre></code><tr><td>379<td><code><pre> rawID = msg.Metadata[watermill.ContextKeyRawMessageID]</pre></code><tr><td>380<td><code><pre> }</pre></code><tr><td>381<td><code><pre> return nil, errors.Errorf(</pre></code><tr><td>382<td><code><pre> "handle unknown event message [type[%s] message_uuid[%s] message_raw_id[%s]]",</pre></code><tr><td>383<td><code><pre> eventType, msg.UUID, rawID)</pre></code><tr><td>384<td><code><pre> }</pre></code><tr><td>385<td><code><pre> handlers := []*handler{hdr, subhdr}</pre></code><tr><td>386<td><code><pre></pre></code><tr><td>387<td><code><pre> wg := new(sync.WaitGroup)</pre></code><tr><td>388<td><code><pre> futures := make([]*routine.Future, 0, len(handlers))</pre></code><tr><td>389<td><code><pre> for _, hdr := range handlers {</pre></code><tr><td>390<td><code><pre> if hdr == nil {</pre></code><tr><td>391<td><code><pre> continue</pre></code><tr><td>392<td><code><pre> }</pre></code><tr><td>393<td><code><pre> wg.Add(1)</pre></code><tr><td>394<td><code><pre> f := routine.Promise(</pre></code><tr><td>395<td><code><pre> func(hdr handler) (msgs any, err error) {</pre></code><tr><td>396<td><code><pre> _, data, _, err := pd.Unseal(msg.Payload,</pre></code><tr><td>397<td><code><pre> pd.Serialize(r.serializeType), pd.Compress(r.compressType), pd.Type(hdr.evtPayloadType))</pre></code><tr><td>398<td><code><pre> if err != nil {</pre></code><tr><td>399<td><code><pre> return</pre></code><tr><td>400<td><code><pre> }</pre></code><tr><td>401<td><code><pre> event := reflect.New(hdr.evtType).Interface()</pre></code><tr><td>402<td><code><pre> inspect.SetField(event, "pd", data)</pre></code><tr><td>403<td><code><pre></pre></code><tr><td>404<td><code><pre> ctx := fusCtx.New(fusCtx.Watermill(msg.Metadata))</pre></code><tr><td>405<td><code><pre> ctx = log.SetCtxFields(ctx, log.Fields{</pre></code><tr><td>406<td><code><pre> keyEntityID: msg.Metadata[keyEntityID],</pre></code><tr><td>407<td><code><pre> keyEventType: msg.Metadata[keyEventType],</pre></code><tr><td>408<td><code><pre> })</pre></code><tr><td>409<td><code><pre> inspect.SetField(event, "ctx", ctx)</pre></code><tr><td>410<td><code><pre> inspect.SetField(event, "ackfn", msg.Ack)</pre></code><tr><td>411<td><code><pre> inspect.SetField(event, "nackfn", msg.Nack)</pre></code><tr><td>412<td><code><pre></pre></code><tr><td>413<td><code><pre> rets := hdr.fn.Call([]reflect.Value{reflect.ValueOf(ctx), reflect.ValueOf(event)})</pre></code><tr><td>414<td><code><pre> msgs = utils.ParseVariadicFuncResult[[]Message](rets, 0)</pre></code><tr><td>415<td><code><pre> err = utils.ParseVariadicFuncResult[error](rets, 0)</pre></code><tr><td>416<td><code><pre> return</pre></code><tr><td>417<td><code><pre> },</pre></code><tr><td>418<td><code><pre> true,</pre></code><tr><td>419<td><code><pre> routine.Args(hdr),</pre></code><tr><td>420<td><code><pre> routine.WaitGroup(wg),</pre></code><tr><td>421<td><code><pre> routine.AppName(r.appName),</pre></code><tr><td>422<td><code><pre> )</pre></code><tr><td>423<td><code><pre> futures = append(futures, f)</pre></code><tr><td>424<td><code><pre> }</pre></code><tr><td>425<td><code><pre> wg.Wait()</pre></code><tr><td>426<td><code><pre></pre></code><tr><td>427<td><code><pre> pubMsgs = make([]*mw.Message, 0, len(handlers))</pre></code><tr><td>428<td><code><pre> for _, f := range futures {</pre></code><tr><td>429<td><code><pre> msgsAny, msgErr := f.Get()</pre></code><tr><td>430<td><code><pre> err = multierr.Append(err, msgErr)</pre></code><tr><td>431<td><code><pre> if msgsAny != nil {</pre></code><tr><td>432<td><code><pre> msgs, _ := msgsAny.([]Message)</pre></code><tr><td>433<td><code><pre> for _, m := range msgs {</pre></code><tr><td>434<td><code><pre> pubMsgs = append(pubMsgs, messageConvertTo(m))</pre></code><tr><td>435<td><code><pre> }</pre></code><tr><td>436<td><code><pre> }</pre></code><tr><td>437<td><code><pre> }</pre></code><tr><td>438<td><code><pre> return</pre></code><tr><td>439<td><code><pre> },</pre></code><tr><td>440<td><code><pre> )</pre></code><tr><td>441<td><code><pre>}</pre></code></table><div class=funcname id=fn_@179:9>func @179:9</div><div class=info><a href=#s_fn_@179:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/construct.go</code>:</div><table class=listing><tr><td>179<td><code><pre>func(o *useOption) {</pre></code><tr><td>180<td><code><pre> o.appName = name</pre></code><tr><td>181<td><code><pre> }</pre></code></table><div class=funcname id=fn_AppName>func AppName</div><div class=info><a href=#s_fn_AppName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/construct.go</code>:</div><table class=listing><tr><td>178<td><code><pre>func AppName(name string) utils.OptionFunc[useOption] {</pre></code><tr><td>179<td><code><pre> return func(o *useOption) {</pre></code><tr><td>180<td><code><pre> o.appName = name</pre></code><tr><td>181<td><code><pre> }</pre></code><tr><td>182<td><code><pre>}</pre></code></table><div class=funcname id=fn_@172:9>func @172:9</div><div class=info><a href=#s_fn_@172:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>172<td><code><pre>func(o *eventPubOption[T]) {</pre></code><tr><td>173<td><code><pre> o.events = events</pre></code><tr><td>174<td><code><pre> }</pre></code></table><div class=funcname id=fn_router.Running>func router.Running</div><div class=info><a href=#s_fn_router.Running>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>197<td><code><pre>func (r *router) Running() <-chan struct{} {</pre></code><tr><td>198<td><code><pre> return r.Router.Running()</pre></code><tr><td>199<td><code><pre>}</pre></code></table><div class=funcname id=fn_redisSubscriber.close>func redisSubscriber.close</div><div class=info><a href=#s_fn_redisSubscriber.close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/redis.go</code>:</div><table class=listing><tr><td>97<td><code><pre>func (r *redisSubscriber) close() (err error) {</pre></code><tr><td>98<td><code><pre> return r.subscriber.Close()</pre></code><tr><td>99<td><code><pre>}</pre></code></table><div class=funcname id=fn_UntimedEvent>func UntimedEvent</div><div class=info><a href=#s_fn_UntimedEvent>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>175<td><code><pre>func UntimedEvent[T eventual](id string, payload T) Event[T] {</pre></code><tr><td>176<td><code><pre> return newEvent[T](id, time.Time{}, time.Time{}, time.Time{}, payload)</pre></code><tr><td>177<td><code><pre>}</pre></code></table><div class=funcname id=fn_redisPublisher.close>func redisPublisher.close</div><div class=info><a href=#s_fn_redisPublisher.close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/redis.go</code>:</div><table class=listing><tr><td>58<td><code><pre>func (r *redisPublisher) close() (err error) {</pre></code><tr><td>59<td><code><pre> return r.publisher.Close()</pre></code><tr><td>60<td><code><pre>}</pre></code></table><div class=funcname id=fn_ChannelLen>func ChannelLen</div><div class=info><a href=#s_fn_ChannelLen>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>181<td><code><pre>func ChannelLen(channelLength int) utils.OptionFunc[subOption] {</pre></code><tr><td>182<td><code><pre> return func(o *subOption) {</pre></code><tr><td>183<td><code><pre> o.channelLength = channelLength</pre></code><tr><td>184<td><code><pre> }</pre></code><tr><td>185<td><code><pre>}</pre></code></table><div class=funcname id=fn_pulsarSubscriber.close>func pulsarSubscriber.close</div><div class=info><a href=#s_fn_pulsarSubscriber.close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/pulsar.go</code>:</div><table class=listing><tr><td>107<td><code><pre>func (p *pulsarSubscriber) close() (err error) {</pre></code><tr><td>108<td><code><pre> return p.subscriber.Close()</pre></code><tr><td>109<td><code><pre>}</pre></code></table><div class=funcname id=fn_newEvent>func newEvent</div><div class=info><a href=#s_fn_newEvent>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>207<td><code><pre>func newEvent[T eventual](id string, createdAt, updatedAt, deletedAt time.Time, payload T) Event[T] {</pre></code><tr><td>208<td><code><pre> return &event[T]{</pre></code><tr><td>209<td><code><pre> pd: &eventPayload[T]{</pre></code><tr><td>210<td><code><pre> I: id,</pre></code><tr><td>211<td><code><pre> T: payload.EventType(),</pre></code><tr><td>212<td><code><pre> P: payload,</pre></code><tr><td>213<td><code><pre> C: createdAt.Format(time.RFC3339Nano),</pre></code><tr><td>214<td><code><pre> CL: createdAt.Location().String(),</pre></code><tr><td>215<td><code><pre> U: updatedAt.Format(time.RFC3339Nano),</pre></code><tr><td>216<td><code><pre> UL: updatedAt.Location().String(),</pre></code><tr><td>217<td><code><pre> D: deletedAt.Format(time.RFC3339Nano),</pre></code><tr><td>218<td><code><pre> DL: deletedAt.Location().String(),</pre></code><tr><td>219<td><code><pre> N: time.Now().UnixNano(),</pre></code><tr><td>220<td><code><pre> },</pre></code><tr><td>221<td><code><pre> }</pre></code><tr><td>222<td><code><pre>}</pre></code></table><div class=funcname id=fn_pulsarPublisher.close>func pulsarPublisher.close</div><div class=info><a href=#s_fn_pulsarPublisher.close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/pulsar.go</code>:</div><table class=listing><tr><td>63<td><code><pre>func (p *pulsarPublisher) close() (err error) {</pre></code><tr><td>64<td><code><pre> return p.publisher.Close()</pre></code><tr><td>65<td><code><pre>}</pre></code></table><div class=funcname id=fn_event[T].Type>func event[T].Type</div><div class=info><a href=#s_fn_event[T].Type>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>224<td><code><pre>func (e *event[T]) Type() string { return e.pd.T }</pre></code></table><div class=funcname id=fn_event[T].Payload>func event[T].Payload</div><div class=info><a href=#s_fn_event[T].Payload>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>225<td><code><pre>func (e *event[T]) Payload() T { return e.pd.P }</pre></code></table><div class=funcname id=fn_@182:9>func @182:9</div><div class=info><a href=#s_fn_@182:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>182<td><code><pre>func(o *subOption) {</pre></code><tr><td>183<td><code><pre> o.channelLength = channelLength</pre></code><tr><td>184<td><code><pre> }</pre></code></table><div class=funcname id=fn_postgresSubscriber.close>func postgresSubscriber.close</div><div class=info><a href=#s_fn_postgresSubscriber.close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/postgres.go</code>:</div><table class=listing><tr><td>105<td><code><pre>func (p *postgresSubscriber) close() (err error) {</pre></code><tr><td>106<td><code><pre> return p.subscriber.Close()</pre></code><tr><td>107<td><code><pre>}</pre></code></table><div class=funcname id=fn_@86:38>func @86:38</div><div class=info><a href=#s_fn_@86:38>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/postgres.go</code>:</div><table class=listing><tr><td>86<td><code><pre>func(topic string) string {</pre></code><tr><td>87<td><code><pre> return fmt.Sprintf("%s_offsets_%s", conf.MessageScheme, topic)</pre></code><tr><td>88<td><code><pre> }</pre></code></table><div class=funcname id=fn_event[T].Context>func event[T].Context</div><div class=info><a href=#s_fn_event[T].Context>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>229<td><code><pre>func (e *event[T]) Context() context.Context { return e.ctx }</pre></code></table><div class=funcname id=fn_@80:31>func @80:31</div><div class=info><a href=#s_fn_@80:31>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/postgres.go</code>:</div><table class=listing><tr><td>80<td><code><pre>func(topic string) string {</pre></code><tr><td>81<td><code><pre> return fmt.Sprintf("%s_%s", conf.MessageScheme, topic)</pre></code><tr><td>82<td><code><pre> }</pre></code></table><div class=funcname id=fn_@42:31>func @42:31</div><div class=info><a href=#s_fn_@42:31>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/postgres.go</code>:</div><table class=listing><tr><td>42<td><code><pre>func(topic string) string {</pre></code><tr><td>43<td><code><pre> return fmt.Sprintf("%s_%s", conf.MessageScheme, topic)</pre></code><tr><td>44<td><code><pre> }</pre></code></table><div class=funcname id=fn_handleEventSubscriber>func handleEventSubscriber</div><div class=info><a href=#s_fn_handleEventSubscriber>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>191<td><code><pre>func handleEventSubscriber() utils.OptionFunc[routerOption] {</pre></code><tr><td>192<td><code><pre> return func(o *routerOption) {</pre></code><tr><td>193<td><code><pre> o.isEventSubscriber = true</pre></code><tr><td>194<td><code><pre> }</pre></code><tr><td>195<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/flag.go</code>:</div><table class=listing><tr><td>7<td><code><pre>func init() {</pre></code><tr><td>8<td><code><pre> pflag.StringVarP(&flagString, "mq-config", "", "", "json string for message queue config")</pre></code><tr><td>9<td><code><pre>}</pre></code></table><div class=funcname id=fn_@192:9>func @192:9</div><div class=info><a href=#s_fn_@192:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>192<td><code><pre>func(o *routerOption) {</pre></code><tr><td>193<td><code><pre> o.isEventSubscriber = true</pre></code><tr><td>194<td><code><pre> }</pre></code></table><div class=funcname id=fn_goChannel.close>func goChannel.close</div><div class=info><a href=#s_fn_goChannel.close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/gochannel.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func (g *goChannel) close() (err error) { return g.ch.Close() }</pre></code></table><div class=funcname id=fn_NewMessage>func NewMessage</div><div class=info><a href=#s_fn_NewMessage>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>204<td><code><pre>func NewMessage(uuid string, payload []byte) Message {</pre></code><tr><td>205<td><code><pre> return &message{Message: mw.NewMessage(uuid, payload), payload: payload}</pre></code><tr><td>206<td><code><pre>}</pre></code></table><div class=funcname id=fn_mysqlSubscriber.close>func mysqlSubscriber.close</div><div class=info><a href=#s_fn_mysqlSubscriber.close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mysql.go</code>:</div><table class=listing><tr><td>105<td><code><pre>func (m *mysqlSubscriber) close() (err error) {</pre></code><tr><td>106<td><code><pre> return m.subscriber.Close()</pre></code><tr><td>107<td><code><pre>}</pre></code></table><div class=funcname id=fn_kafkaPublisher.close>func kafkaPublisher.close</div><div class=info><a href=#s_fn_kafkaPublisher.close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/kafka.go</code>:</div><table class=listing><tr><td>54<td><code><pre>func (k *kafkaPublisher) close() (err error) {</pre></code><tr><td>55<td><code><pre> return k.publisher.Close()</pre></code><tr><td>56<td><code><pre>}</pre></code></table><div class=funcname id=fn_@86:38>func @86:38</div><div class=info><a href=#s_fn_@86:38>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mysql.go</code>:</div><table class=listing><tr><td>86<td><code><pre>func(topic string) string {</pre></code><tr><td>87<td><code><pre> return fmt.Sprintf("%s_offsets_%s", conf.MessageScheme, topic)</pre></code><tr><td>88<td><code><pre> }</pre></code></table><div class=funcname id=fn_kafkaSubscriber.close>func kafkaSubscriber.close</div><div class=info><a href=#s_fn_kafkaSubscriber.close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/kafka.go</code>:</div><table class=listing><tr><td>95<td><code><pre>func (k *kafkaSubscriber) close() (err error) {</pre></code><tr><td>96<td><code><pre> return k.subscriber.Close()</pre></code><tr><td>97<td><code><pre>}</pre></code></table><div class=funcname id=fn_@80:31>func @80:31</div><div class=info><a href=#s_fn_@80:31>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mysql.go</code>:</div><table class=listing><tr><td>80<td><code><pre>func(topic string) string {</pre></code><tr><td>81<td><code><pre> return fmt.Sprintf("%s_%s", conf.MessageScheme, topic)</pre></code><tr><td>82<td><code><pre> }</pre></code></table><div class=funcname id=fn_mysqlPublisher.close>func mysqlPublisher.close</div><div class=info><a href=#s_fn_mysqlPublisher.close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mysql.go</code>:</div><table class=listing><tr><td>62<td><code><pre>func (m *mysqlPublisher) close() (err error) {</pre></code><tr><td>63<td><code><pre> return m.publisher.Close()</pre></code><tr><td>64<td><code><pre>}</pre></code></table><div class=funcname id=fn_@42:31>func @42:31</div><div class=info><a href=#s_fn_@42:31>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mysql.go</code>:</div><table class=listing><tr><td>42<td><code><pre>func(topic string) string {</pre></code><tr><td>43<td><code><pre> return fmt.Sprintf("%s_%s", conf.MessageScheme, topic)</pre></code><tr><td>44<td><code><pre> }</pre></code></table><div class=funcname id=fn_abstractMQ.topic>func abstractMQ.topic</div><div class=info><a href=#s_fn_abstractMQ.topic>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>242<td><code><pre>func (a *abstractMQ) topic() string { return a.conf.Topic }</pre></code></table><div class=funcname id=fn__AMQPSubscriber.close>func _AMQPSubscriber.close</div><div class=info><a href=#s_fn__AMQPSubscriber.close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/amqp.go</code>:</div><table class=listing><tr><td>106<td><code><pre>func (a *_AMQPSubscriber) close() (err error) {</pre></code><tr><td>107<td><code><pre> return a.subscriber.Close()</pre></code><tr><td>108<td><code><pre>}</pre></code></table><div class=funcname id=fn_message.ID>func message.ID</div><div class=info><a href=#s_fn_message.ID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>207<td><code><pre>func (m *message) ID() string { return m.Message.UUID }</pre></code></table><div class=funcname id=fn_rawMessageConvertFrom>func rawMessageConvertFrom</div><div class=info><a href=#s_fn_rawMessageConvertFrom>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>276<td><code><pre>func rawMessageConvertFrom(src *mw.Message) (dst Message) {</pre></code><tr><td>277<td><code><pre> return &message{Message: src, payload: src.Payload}</pre></code><tr><td>278<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstractMQ.watermillSubscriber>func abstractMQ.watermillSubscriber</div><div class=info><a href=#s_fn_abstractMQ.watermillSubscriber>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>244<td><code><pre>func (a *abstractMQ) watermillSubscriber() mw.Subscriber { return a.sub }</pre></code></table><div class=funcname id=fn__AMQPPublisher.close>func _AMQPPublisher.close</div><div class=info><a href=#s_fn__AMQPPublisher.close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/amqp.go</code>:</div><table class=listing><tr><td>67<td><code><pre>func (a *_AMQPPublisher) close() (err error) {</pre></code><tr><td>68<td><code><pre> return a.publisher.Close()</pre></code><tr><td>69<td><code><pre>}</pre></code></table><div class=funcname id=fn_message.Payload>func message.Payload</div><div class=info><a href=#s_fn_message.Payload>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>208<td><code><pre>func (m *message) Payload() []byte { return m.payload }</pre></code></table><div class=funcname id=fn_abstractMQ.watermillPublisher>func abstractMQ.watermillPublisher</div><div class=info><a href=#s_fn_abstractMQ.watermillPublisher>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>243<td><code><pre>func (a *abstractMQ) watermillPublisher() mw.Publisher { return a.pub }</pre></code></table><div class=funcname id=fn_event[T].ID>func event[T].ID</div><div class=info><a href=#s_fn_event[T].ID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>223<td><code><pre>func (e *event[T]) ID() string { return e.pd.I }</pre></code></table><div class=funcname id=fn_@395:6>func @395:6</div><div class=info><a href=#s_fn_@395:6>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>395<td><code><pre>func(hdr handler) (msgs any, err error) {</pre></code><tr><td>396<td><code><pre> _, data, _, err := pd.Unseal(msg.Payload,</pre></code><tr><td>397<td><code><pre> pd.Serialize(r.serializeType), pd.Compress(r.compressType), pd.Type(hdr.evtPayloadType))</pre></code><tr><td>398<td><code><pre> if err != nil {</pre></code><tr class=miss><td>399<td><code><pre> return</pre></code><tr><td>400<td><code><pre> }</pre></code><tr><td>401<td><code><pre> event := reflect.New(hdr.evtType).Interface()</pre></code><tr><td>402<td><code><pre> inspect.SetField(event, "pd", data)</pre></code><tr><td>403<td><code><pre></pre></code><tr><td>404<td><code><pre> ctx := fusCtx.New(fusCtx.Watermill(msg.Metadata))</pre></code><tr><td>405<td><code><pre> ctx = log.SetCtxFields(ctx, log.Fields{</pre></code><tr><td>406<td><code><pre> keyEntityID: msg.Metadata[keyEntityID],</pre></code><tr><td>407<td><code><pre> keyEventType: msg.Metadata[keyEventType],</pre></code><tr><td>408<td><code><pre> })</pre></code><tr><td>409<td><code><pre> inspect.SetField(event, "ctx", ctx)</pre></code><tr><td>410<td><code><pre> inspect.SetField(event, "ackfn", msg.Ack)</pre></code><tr><td>411<td><code><pre> inspect.SetField(event, "nackfn", msg.Nack)</pre></code><tr><td>412<td><code><pre></pre></code><tr><td>413<td><code><pre> rets := hdr.fn.Call([]reflect.Value{reflect.ValueOf(ctx), reflect.ValueOf(event)})</pre></code><tr><td>414<td><code><pre> msgs = utils.ParseVariadicFuncResult[[]Message](rets, 0)</pre></code><tr><td>415<td><code><pre> err = utils.ParseVariadicFuncResult[error](rets, 0)</pre></code><tr><td>416<td><code><pre> return</pre></code><tr><td>417<td><code><pre> }</pre></code></table><div class=funcname id=fn_eventPublisher[T].PublishEvent>func eventPublisher[T].PublishEvent</div><div class=info><a href=#s_fn_eventPublisher[T].PublishEvent>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>78<td><code><pre>func (e *eventPublisher[T]) PublishEvent(ctx context.Context, opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>79<td><code><pre> opt := utils.ApplyOptions[pubOption](opts...)</pre></code><tr><td>80<td><code><pre> optT := utils.ApplyOptions[eventPubOption[T]](opts...)</pre></code><tr><td>81<td><code><pre> msgs := make([]*mw.Message, 0, len(optT.events))</pre></code><tr><td>82<td><code><pre> for _, evt := range optT.events {</pre></code><tr><td>83<td><code><pre> msg, err := e.abstractMQ.newObjectMessage(ctx, evt.(*event[T]).pd, opt)</pre></code><tr><td>84<td><code><pre> if msg != nil {</pre></code><tr><td>85<td><code><pre> msg.Metadata[keyEntityID] = evt.ID()</pre></code><tr><td>86<td><code><pre> msg.Metadata[keyEventType] = evt.Type()</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre> if err != nil {</pre></code><tr class=miss><td>89<td><code><pre> return err</pre></code><tr><td>90<td><code><pre> }</pre></code><tr><td>91<td><code><pre> msgs = append(msgs, msg)</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre> return e.abstractMQ.Publish(ctx, messages(msgs...))</pre></code><tr><td>94<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.handleEvent>func router.handleEvent</div><div class=info><a href=#s_fn_router.handleEvent>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>302<td><code><pre>func (r *router) handleEvent(eventType string, fnVal reflect.Value, opt *routerOption) {</pre></code><tr><td>303<td><code><pre> // FIXME: Translating generics to corresponding implemented generic types like this is too hacky.</pre></code><tr><td>304<td><code><pre> // If this set becomes invalid, switch to the implementation of event payload as any without generics,</pre></code><tr><td>305<td><code><pre> // and the router can continue to provide it using the current method of storing reflect.Type.</pre></code><tr><td>306<td><code><pre> evtType := fnVal.Type().In(1)</pre></code><tr><td>307<td><code><pre> eventName := strings.Replace(evtType.Name(), "Event[", "event[", 1)</pre></code><tr><td>308<td><code><pre> eventTypeName := fmt.Sprintf(mqPackageSignFormat, eventName)</pre></code><tr><td>309<td><code><pre> et := inspect.TypeOf(eventTypeName)</pre></code><tr><td>310<td><code><pre> if et == nil {</pre></code><tr class=miss><td>311<td><code><pre> panic(errors.Errorf("unknown event generic object type: %s", eventTypeName))</pre></code><tr><td>312<td><code><pre> }</pre></code><tr><td>313<td><code><pre> eventPayloadName := strings.Replace(evtType.Name(), "Event[", "eventPayload[", 1)</pre></code><tr><td>314<td><code><pre> eventPayloadTypeName := fmt.Sprintf(mqPackageSignFormat, eventPayloadName)</pre></code><tr><td>315<td><code><pre> ept := inspect.TypeOf(eventPayloadTypeName)</pre></code><tr><td>316<td><code><pre> if ept == nil {</pre></code><tr class=miss><td>317<td><code><pre> panic(errors.Errorf("unknown event payload generic object type: %s", eventPayloadTypeName))</pre></code><tr><td>318<td><code><pre> }</pre></code><tr><td>319<td><code><pre></pre></code><tr><td>320<td><code><pre> hdr := &handler{</pre></code><tr><td>321<td><code><pre> fn: fnVal,</pre></code><tr><td>322<td><code><pre> evtType: et,</pre></code><tr><td>323<td><code><pre> evtPayloadType: reflect.PtrTo(ept),</pre></code><tr><td>324<td><code><pre> }</pre></code><tr><td>325<td><code><pre></pre></code><tr><td>326<td><code><pre> r.locker.Lock()</pre></code><tr><td>327<td><code><pre> defer r.locker.Unlock()</pre></code><tr><td>328<td><code><pre> if !opt.isEventSubscriber {</pre></code><tr><td>329<td><code><pre> r.eventHandlers[eventType] = hdr</pre></code><tr><td>330<td><code><pre> } else {</pre></code><tr><td>331<td><code><pre> r.eventSubscriberHandlers[eventType] = hdr</pre></code><tr><td>332<td><code><pre> r.addEventDispatchHandler(defaultRouterEventHandlerName + "_" + eventType)</pre></code><tr><td>333<td><code><pre> routine.Go(r.run, routine.AppName(r.appName))</pre></code><tr><td>334<td><code><pre> }</pre></code><tr><td>335<td><code><pre>}</pre></code></table><div class=funcname id=fn_@41:9>func @41:9</div><div class=info><a href=#s_fn_@41:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/construct.go</code>:</div><table class=listing><tr><td>41<td><code><pre>func() {</pre></code><tr><td>42<td><code><pre> locker.Lock()</pre></code><tr><td>43<td><code><pre> defer locker.Unlock()</pre></code><tr><td>44<td><code><pre></pre></code><tr><td>45<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>46<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>47<td><code><pre> if routers != nil {</pre></code><tr><td>48<td><code><pre> for name, router := range routers[opt.AppName] {</pre></code><tr><td>49<td><code><pre> log.Printf("%v [Gofusion] %s %s %s router exiting...",</pre></code><tr><td>50<td><code><pre> pid, app, config.ComponentMessageQueue, name)</pre></code><tr><td>51<td><code><pre> if err := router.close(); err == nil {</pre></code><tr><td>52<td><code><pre> log.Printf("%v [Gofusion] %s %s %s router exited",</pre></code><tr><td>53<td><code><pre> pid, app, config.ComponentMessageQueue, name)</pre></code><tr><td>54<td><code><pre> } else {</pre></code><tr class=miss><td>55<td><code><pre> log.Printf("%v [Gofusion] %s %s %s router exit failed: %s",</pre></code><tr><td>56<td><code><pre> pid, app, config.ComponentMessageQueue, name, err)</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre> delete(routers, opt.AppName)</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre></pre></code><tr><td>62<td><code><pre> if publishers != nil {</pre></code><tr><td>63<td><code><pre> for name, publisher := range publishers[opt.AppName] {</pre></code><tr><td>64<td><code><pre> log.Printf("%v [Gofusion] %s %s %s publisher exiting...",</pre></code><tr><td>65<td><code><pre> pid, app, config.ComponentMessageQueue, name)</pre></code><tr><td>66<td><code><pre> if err := publisher.close(); err == nil {</pre></code><tr><td>67<td><code><pre> log.Printf("%v [Gofusion] %s %s %s publisher exited",</pre></code><tr><td>68<td><code><pre> pid, app, config.ComponentMessageQueue, name)</pre></code><tr><td>69<td><code><pre> } else {</pre></code><tr class=miss><td>70<td><code><pre> log.Printf("%v [Gofusion] %s %s %s publisher exit failed: %s",</pre></code><tr><td>71<td><code><pre> pid, app, config.ComponentMessageQueue, name, err)</pre></code><tr><td>72<td><code><pre> }</pre></code><tr><td>73<td><code><pre> }</pre></code><tr><td>74<td><code><pre> delete(publishers, opt.AppName)</pre></code><tr><td>75<td><code><pre> }</pre></code><tr><td>76<td><code><pre></pre></code><tr><td>77<td><code><pre> if subscribers != nil {</pre></code><tr><td>78<td><code><pre> for name, subscriber := range subscribers[opt.AppName] {</pre></code><tr><td>79<td><code><pre> log.Printf("%v [Gofusion] %s %s %s subscriber exiting...",</pre></code><tr><td>80<td><code><pre> pid, app, config.ComponentMessageQueue, name)</pre></code><tr><td>81<td><code><pre> if err := subscriber.close(); err == nil {</pre></code><tr><td>82<td><code><pre> log.Printf("%v [Gofusion] %s %s %s subscriber exited",</pre></code><tr><td>83<td><code><pre> pid, app, config.ComponentMessageQueue, name)</pre></code><tr><td>84<td><code><pre> } else {</pre></code><tr class=miss><td>85<td><code><pre> log.Printf("%v [Gofusion] %s %s %s subscriber exit failed: %s",</pre></code><tr><td>86<td><code><pre> pid, app, config.ComponentMessageQueue, name, err)</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre> }</pre></code><tr><td>89<td><code><pre> delete(subscribers, opt.AppName)</pre></code><tr><td>90<td><code><pre> }</pre></code><tr><td>91<td><code><pre> }</pre></code></table><div class=funcname id=fn_@370:3>func @370:3</div><div class=info><a href=#s_fn_@370:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>370<td><code><pre>func(msg *mw.Message) (pubMsgs []*mw.Message, err error) {</pre></code><tr><td>371<td><code><pre> eventType := msg.Metadata[keyEventType]</pre></code><tr><td>372<td><code><pre> r.locker.RLock()</pre></code><tr><td>373<td><code><pre> hdr, ok1 := r.eventHandlers[eventType]</pre></code><tr><td>374<td><code><pre> subhdr, ok2 := r.eventSubscriberHandlers[eventType]</pre></code><tr><td>375<td><code><pre> r.locker.RUnlock()</pre></code><tr><td>376<td><code><pre> if !ok1 && !ok2 {</pre></code><tr class=miss><td>377<td><code><pre> rawID := "unknown"</pre></code><tr class=miss><td>378<td><code><pre> if msg.Metadata != nil {</pre></code><tr class=miss><td>379<td><code><pre> rawID = msg.Metadata[watermill.ContextKeyRawMessageID]</pre></code><tr><td>380<td><code><pre> }</pre></code><tr class=miss><td>381<td><code><pre> return nil, errors.Errorf(</pre></code><tr><td>382<td><code><pre> "handle unknown event message [type[%s] message_uuid[%s] message_raw_id[%s]]",</pre></code><tr><td>383<td><code><pre> eventType, msg.UUID, rawID)</pre></code><tr><td>384<td><code><pre> }</pre></code><tr><td>385<td><code><pre> handlers := []*handler{hdr, subhdr}</pre></code><tr><td>386<td><code><pre></pre></code><tr><td>387<td><code><pre> wg := new(sync.WaitGroup)</pre></code><tr><td>388<td><code><pre> futures := make([]*routine.Future, 0, len(handlers))</pre></code><tr><td>389<td><code><pre> for _, hdr := range handlers {</pre></code><tr><td>390<td><code><pre> if hdr == nil {</pre></code><tr><td>391<td><code><pre> continue</pre></code><tr><td>392<td><code><pre> }</pre></code><tr><td>393<td><code><pre> wg.Add(1)</pre></code><tr><td>394<td><code><pre> f := routine.Promise(</pre></code><tr><td>395<td><code><pre> func(hdr handler) (msgs any, err error) {</pre></code><tr><td>396<td><code><pre> _, data, _, err := pd.Unseal(msg.Payload,</pre></code><tr><td>397<td><code><pre> pd.Serialize(r.serializeType), pd.Compress(r.compressType), pd.Type(hdr.evtPayloadType))</pre></code><tr><td>398<td><code><pre> if err != nil {</pre></code><tr><td>399<td><code><pre> return</pre></code><tr><td>400<td><code><pre> }</pre></code><tr><td>401<td><code><pre> event := reflect.New(hdr.evtType).Interface()</pre></code><tr><td>402<td><code><pre> inspect.SetField(event, "pd", data)</pre></code><tr><td>403<td><code><pre></pre></code><tr><td>404<td><code><pre> ctx := fusCtx.New(fusCtx.Watermill(msg.Metadata))</pre></code><tr><td>405<td><code><pre> ctx = log.SetCtxFields(ctx, log.Fields{</pre></code><tr><td>406<td><code><pre> keyEntityID: msg.Metadata[keyEntityID],</pre></code><tr><td>407<td><code><pre> keyEventType: msg.Metadata[keyEventType],</pre></code><tr><td>408<td><code><pre> })</pre></code><tr><td>409<td><code><pre> inspect.SetField(event, "ctx", ctx)</pre></code><tr><td>410<td><code><pre> inspect.SetField(event, "ackfn", msg.Ack)</pre></code><tr><td>411<td><code><pre> inspect.SetField(event, "nackfn", msg.Nack)</pre></code><tr><td>412<td><code><pre></pre></code><tr><td>413<td><code><pre> rets := hdr.fn.Call([]reflect.Value{reflect.ValueOf(ctx), reflect.ValueOf(event)})</pre></code><tr><td>414<td><code><pre> msgs = utils.ParseVariadicFuncResult[[]Message](rets, 0)</pre></code><tr><td>415<td><code><pre> err = utils.ParseVariadicFuncResult[error](rets, 0)</pre></code><tr><td>416<td><code><pre> return</pre></code><tr><td>417<td><code><pre> },</pre></code><tr><td>418<td><code><pre> true,</pre></code><tr><td>419<td><code><pre> routine.Args(hdr),</pre></code><tr><td>420<td><code><pre> routine.WaitGroup(wg),</pre></code><tr><td>421<td><code><pre> routine.AppName(r.appName),</pre></code><tr><td>422<td><code><pre> )</pre></code><tr><td>423<td><code><pre> futures = append(futures, f)</pre></code><tr><td>424<td><code><pre> }</pre></code><tr><td>425<td><code><pre> wg.Wait()</pre></code><tr><td>426<td><code><pre></pre></code><tr><td>427<td><code><pre> pubMsgs = make([]*mw.Message, 0, len(handlers))</pre></code><tr><td>428<td><code><pre> for _, f := range futures {</pre></code><tr><td>429<td><code><pre> msgsAny, msgErr := f.Get()</pre></code><tr><td>430<td><code><pre> err = multierr.Append(err, msgErr)</pre></code><tr><td>431<td><code><pre> if msgsAny != nil {</pre></code><tr><td>432<td><code><pre> msgs, _ := msgsAny.([]Message)</pre></code><tr><td>433<td><code><pre> for _, m := range msgs {</pre></code><tr><td>434<td><code><pre> pubMsgs = append(pubMsgs, messageConvertTo(m))</pre></code><tr><td>435<td><code><pre> }</pre></code><tr><td>436<td><code><pre> }</pre></code><tr><td>437<td><code><pre> }</pre></code><tr><td>438<td><code><pre> return</pre></code><tr><td>439<td><code><pre> }</pre></code></table><div class=funcname id=fn_@278:5>func @278:5</div><div class=info><a href=#s_fn_@278:5>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>278<td><code><pre>func(wmsg *mw.Message) (msgs []*mw.Message, err error) {</pre></code><tr><td>279<td><code><pre> msg, err := messageConvertFrom(wmsg, r.serializeType, r.compressType)</pre></code><tr><td>280<td><code><pre> if err != nil {</pre></code><tr class=miss><td>281<td><code><pre> return</pre></code><tr><td>282<td><code><pre> }</pre></code><tr><td>283<td><code><pre> rets := fnVal.Convert(handlerFuncType).Call([]reflect.Value{reflect.ValueOf(msg)})</pre></code><tr><td>284<td><code><pre> msgs = utils.ParseVariadicFuncResult[[]*mw.Message](rets, 0)</pre></code><tr><td>285<td><code><pre> err = utils.ParseVariadicFuncResult[error](rets, 0)</pre></code><tr><td>286<td><code><pre> return</pre></code><tr><td>287<td><code><pre> }</pre></code></table><div class=funcname id=fn_abstractMQ.SubscribeRaw>func abstractMQ.SubscribeRaw</div><div class=info><a href=#s_fn_abstractMQ.SubscribeRaw>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>138<td><code><pre>func (a *abstractMQ) SubscribeRaw(ctx context.Context, opts ...utils.OptionExtender) (dst <-chan Message, err error) {</pre></code><tr><td>139<td><code><pre> opt := utils.ApplyOptions[subOption](opts...)</pre></code><tr><td>140<td><code><pre> ch, err := a.sub.Subscribe(ctx, a.conf.Topic)</pre></code><tr><td>141<td><code><pre> if err != nil {</pre></code><tr class=miss><td>142<td><code><pre> return</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre></pre></code><tr><td>145<td><code><pre> msgCh := make(chan Message, opt.channelLength)</pre></code><tr><td>146<td><code><pre> routine.Go(func() {</pre></code><tr><td>147<td><code><pre> defer close(msgCh)</pre></code><tr><td>148<td><code><pre> for {</pre></code><tr><td>149<td><code><pre> select {</pre></code><tr><td>150<td><code><pre> case wmsg, ok := <-ch:</pre></code><tr><td>151<td><code><pre> if !ok {</pre></code><tr><td>152<td><code><pre> return</pre></code><tr><td>153<td><code><pre> }</pre></code><tr><td>154<td><code><pre> msg := rawMessageConvertFrom(wmsg)</pre></code><tr><td>155<td><code><pre> select {</pre></code><tr><td>156<td><code><pre> case msgCh <- msg:</pre></code><tr><td>157<td><code><pre> case <-ctx.Done():</pre></code><tr><td>158<td><code><pre> msg.Nack()</pre></code><tr><td>159<td><code><pre> a.logger.Info(fmt.Sprintf(</pre></code><tr><td>160<td><code><pre> "raw subscriber %s exited with a message nacked when business ctx done", a.name),</pre></code><tr><td>161<td><code><pre> watermill.LogFields{watermill.ContextLogFieldKey: ctx})</pre></code><tr><td>162<td><code><pre> return</pre></code><tr><td>163<td><code><pre> case <-a.ctx.Done():</pre></code><tr><td>164<td><code><pre> msg.Nack()</pre></code><tr><td>165<td><code><pre> a.logger.Info(fmt.Sprintf(</pre></code><tr><td>166<td><code><pre> "raw subscriber %s exited with a message nacked when app ctx done", a.name),</pre></code><tr><td>167<td><code><pre> watermill.LogFields{watermill.ContextLogFieldKey: ctx})</pre></code><tr><td>168<td><code><pre> return</pre></code><tr><td>169<td><code><pre> }</pre></code><tr><td>170<td><code><pre> case <-ctx.Done():</pre></code><tr><td>171<td><code><pre> return</pre></code><tr><td>172<td><code><pre> case <-a.ctx.Done():</pre></code><tr><td>173<td><code><pre> return</pre></code><tr><td>174<td><code><pre> }</pre></code><tr><td>175<td><code><pre> }</pre></code><tr><td>176<td><code><pre> }, routine.AppName(a.appName))</pre></code><tr><td>177<td><code><pre> return msgCh, err</pre></code><tr><td>178<td><code><pre>}</pre></code></table><div class=funcname id=fn_formatEventHandlerSignature>func formatEventHandlerSignature</div><div class=info><a href=#s_fn_formatEventHandlerSignature>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>30<td><code><pre>func formatEventHandlerSignature(f any) string {</pre></code><tr><td>31<td><code><pre> ft, ok := f.(reflect.Type)</pre></code><tr><td>32<td><code><pre> if !ok {</pre></code><tr><td>33<td><code><pre> fv, ok := f.(reflect.Value)</pre></code><tr><td>34<td><code><pre> if ok {</pre></code><tr><td>35<td><code><pre> ft = fv.Type()</pre></code><tr><td>36<td><code><pre> } else {</pre></code><tr class=miss><td>37<td><code><pre> ft = reflect.TypeOf(f)</pre></code><tr><td>38<td><code><pre> }</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre></pre></code><tr><td>41<td><code><pre> return ft.PkgPath() + "." + ft.Name()</pre></code><tr><td>42<td><code><pre>}</pre></code></table><div class=funcname id=fn_addInstance>func addInstance</div><div class=info><a href=#s_fn_addInstance>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/construct.go</code>:</div><table class=listing><tr><td>94<td><code><pre>func addInstance(ctx context.Context, name string, conf *Conf, opt *config.InitOption) {</pre></code><tr><td>95<td><code><pre> var logger watermill.LoggerAdapter</pre></code><tr><td>96<td><code><pre> if utils.IsStrNotBlank(conf.Logger) {</pre></code><tr><td>97<td><code><pre> loggerType := inspect.TypeOf(conf.Logger)</pre></code><tr><td>98<td><code><pre> loggerValue := reflect.New(loggerType)</pre></code><tr><td>99<td><code><pre> if loggerValue.Type().Implements(customLoggerType) {</pre></code><tr><td>100<td><code><pre> l := fusLog.Use(conf.LogInstance, fusLog.AppName(opt.AppName))</pre></code><tr><td>101<td><code><pre> loggerValue.Interface().(customLogger).Init(l, opt.AppName, name)</pre></code><tr><td>102<td><code><pre> }</pre></code><tr><td>103<td><code><pre> logger = loggerValue.Convert(watermillLoggerType).Interface().(watermill.LoggerAdapter)</pre></code><tr><td>104<td><code><pre> }</pre></code><tr><td>105<td><code><pre></pre></code><tr><td>106<td><code><pre> if conf.ConsumerConcurrency < 1 {</pre></code><tr><td>107<td><code><pre> conf.ConsumerConcurrency = 1</pre></code><tr><td>108<td><code><pre> }</pre></code><tr><td>109<td><code><pre></pre></code><tr><td>110<td><code><pre> var (</pre></code><tr><td>111<td><code><pre> puber Publisher</pre></code><tr><td>112<td><code><pre> suber Subscriber</pre></code><tr><td>113<td><code><pre> )</pre></code><tr><td>114<td><code><pre> newFunc, ok := newFn[conf.Type]</pre></code><tr><td>115<td><code><pre> if ok {</pre></code><tr><td>116<td><code><pre> puber, suber = newFunc(ctx, opt.AppName, name, conf, logger)</pre></code><tr><td>117<td><code><pre> } else {</pre></code><tr class=miss><td>118<td><code><pre> panic(errors.Errorf("unknown message queue type: %+v", conf.Type))</pre></code><tr><td>119<td><code><pre> }</pre></code><tr><td>120<td><code><pre></pre></code><tr><td>121<td><code><pre> locker.Lock()</pre></code><tr><td>122<td><code><pre> defer locker.Unlock()</pre></code><tr><td>123<td><code><pre> if suber != nil {</pre></code><tr><td>124<td><code><pre> if subscribers == nil {</pre></code><tr class=miss><td>125<td><code><pre> subscribers = make(map[string]map[string]Subscriber)</pre></code><tr><td>126<td><code><pre> }</pre></code><tr><td>127<td><code><pre> if subscribers[opt.AppName] == nil {</pre></code><tr><td>128<td><code><pre> subscribers[opt.AppName] = make(map[string]Subscriber)</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre> if _, ok := subscribers[name]; ok {</pre></code><tr class=miss><td>131<td><code><pre> panic(ErrDuplicatedSubscriberName)</pre></code><tr><td>132<td><code><pre> }</pre></code><tr><td>133<td><code><pre> subscribers[opt.AppName][name] = suber</pre></code><tr><td>134<td><code><pre></pre></code><tr><td>135<td><code><pre> if routers == nil {</pre></code><tr class=miss><td>136<td><code><pre> routers = make(map[string]map[string]IRouter)</pre></code><tr><td>137<td><code><pre> }</pre></code><tr><td>138<td><code><pre> if routers[opt.AppName] == nil {</pre></code><tr><td>139<td><code><pre> routers[opt.AppName] = make(map[string]IRouter)</pre></code><tr><td>140<td><code><pre> }</pre></code><tr><td>141<td><code><pre> if _, ok := routers[opt.AppName][name]; ok {</pre></code><tr class=miss><td>142<td><code><pre> panic(ErrDuplicatedRouterName)</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre> routers[opt.AppName][name] = newRouter(ctx, opt.AppName, name, conf, puber, suber, logger)</pre></code><tr><td>145<td><code><pre></pre></code><tr><td>146<td><code><pre> // ioc</pre></code><tr><td>147<td><code><pre> if opt.DI != nil {</pre></code><tr><td>148<td><code><pre> opt.DI.</pre></code><tr><td>149<td><code><pre> MustProvide(func() Subscriber { return sub(name, AppName(opt.AppName)) }, di.Name(name)).</pre></code><tr><td>150<td><code><pre> MustProvide(func() IRouter { return Use(name, AppName(opt.AppName)) }, di.Name(name))</pre></code><tr><td>151<td><code><pre> }</pre></code><tr><td>152<td><code><pre></pre></code><tr><td>153<td><code><pre> }</pre></code><tr><td>154<td><code><pre></pre></code><tr><td>155<td><code><pre> if puber != nil {</pre></code><tr><td>156<td><code><pre> if publishers == nil {</pre></code><tr class=miss><td>157<td><code><pre> publishers = make(map[string]map[string]Publisher)</pre></code><tr><td>158<td><code><pre> }</pre></code><tr><td>159<td><code><pre> if publishers[opt.AppName] == nil {</pre></code><tr><td>160<td><code><pre> publishers[opt.AppName] = make(map[string]Publisher)</pre></code><tr><td>161<td><code><pre> }</pre></code><tr><td>162<td><code><pre> if _, ok := publishers[opt.AppName][name]; ok {</pre></code><tr class=miss><td>163<td><code><pre> panic(ErrDuplicatedPublisherName)</pre></code><tr><td>164<td><code><pre> }</pre></code><tr><td>165<td><code><pre> publishers[opt.AppName][name] = puber</pre></code><tr><td>166<td><code><pre></pre></code><tr><td>167<td><code><pre> // ioc</pre></code><tr><td>168<td><code><pre> if opt.DI != nil {</pre></code><tr><td>169<td><code><pre> opt.DI.MustProvide(func() Publisher { return Pub(name, AppName(opt.AppName)) }, di.Name(name))</pre></code><tr><td>170<td><code><pre> }</pre></code><tr><td>171<td><code><pre> }</pre></code><tr><td>172<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.isHandlerConflict>func router.isHandlerConflict</div><div class=info><a href=#s_fn_router.isHandlerConflict>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>443<td><code><pre>func (r *router) isHandlerConflict() (conflict bool) {</pre></code><tr><td>444<td><code><pre> if len(r.eventHandlers) == 0 {</pre></code><tr><td>445<td><code><pre> return</pre></code><tr><td>446<td><code><pre> }</pre></code><tr><td>447<td><code><pre> for name := range r.Handlers() {</pre></code><tr><td>448<td><code><pre> if !strings.Contains(name, defaultRouterEventHandlerName) {</pre></code><tr class=miss><td>449<td><code><pre> return true</pre></code><tr><td>450<td><code><pre> }</pre></code><tr><td>451<td><code><pre> }</pre></code><tr><td>452<td><code><pre> return</pre></code><tr><td>453<td><code><pre>}</pre></code></table><div class=funcname id=fn_Pub>func Pub</div><div class=info><a href=#s_fn_Pub>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/construct.go</code>:</div><table class=listing><tr><td>200<td><code><pre>func Pub(name string, opts ...utils.OptionExtender) Publisher {</pre></code><tr><td>201<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>202<td><code><pre></pre></code><tr><td>203<td><code><pre> locker.RLock()</pre></code><tr><td>204<td><code><pre> defer locker.RUnlock()</pre></code><tr><td>205<td><code><pre> publishers, ok := publishers[opt.appName]</pre></code><tr><td>206<td><code><pre> if !ok {</pre></code><tr class=miss><td>207<td><code><pre> panic(errors.Errorf("mq publisher instance not found for app: %s", opt.appName))</pre></code><tr><td>208<td><code><pre> }</pre></code><tr><td>209<td><code><pre> publisher, ok := publishers[name]</pre></code><tr><td>210<td><code><pre> if !ok {</pre></code><tr class=miss><td>211<td><code><pre> panic(errors.Errorf("mq publisher instance not found for name: %s", name))</pre></code><tr><td>212<td><code><pre> }</pre></code><tr><td>213<td><code><pre> return publisher</pre></code><tr><td>214<td><code><pre>}</pre></code></table><div class=funcname id=fn_Sub>func Sub</div><div class=info><a href=#s_fn_Sub>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/construct.go</code>:</div><table class=listing><tr><td>216<td><code><pre>func Sub(name string, opts ...utils.OptionExtender) Subscriber {</pre></code><tr><td>217<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>218<td><code><pre></pre></code><tr><td>219<td><code><pre> locker.RLock()</pre></code><tr><td>220<td><code><pre> defer locker.RUnlock()</pre></code><tr><td>221<td><code><pre> subscribers, ok := subscribers[opt.appName]</pre></code><tr><td>222<td><code><pre> if !ok {</pre></code><tr class=miss><td>223<td><code><pre> panic(errors.Errorf("mq subscriber instance not found for app: %s", opt.appName))</pre></code><tr><td>224<td><code><pre> }</pre></code><tr><td>225<td><code><pre> subscriber, ok := subscribers[name]</pre></code><tr><td>226<td><code><pre> if !ok {</pre></code><tr class=miss><td>227<td><code><pre> panic(errors.Errorf("mq subscriber instance not found for name: %s", name))</pre></code><tr><td>228<td><code><pre> }</pre></code><tr><td>229<td><code><pre> return subscriber</pre></code><tr><td>230<td><code><pre>}</pre></code></table><div class=funcname id=fn_Use>func Use</div><div class=info><a href=#s_fn_Use>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/construct.go</code>:</div><table class=listing><tr><td>232<td><code><pre>func Use(name string, opts ...utils.OptionExtender) IRouter {</pre></code><tr><td>233<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>234<td><code><pre></pre></code><tr><td>235<td><code><pre> locker.RLock()</pre></code><tr><td>236<td><code><pre> defer locker.RUnlock()</pre></code><tr><td>237<td><code><pre> routers, ok := routers[opt.appName]</pre></code><tr><td>238<td><code><pre> if !ok {</pre></code><tr class=miss><td>239<td><code><pre> panic(errors.Errorf("mq router instance not found for app: %s", opt.appName))</pre></code><tr><td>240<td><code><pre> }</pre></code><tr><td>241<td><code><pre> r, ok := routers[name]</pre></code><tr><td>242<td><code><pre> if !ok {</pre></code><tr class=miss><td>243<td><code><pre> panic(errors.Errorf("mq router instance not found for name: %s", name))</pre></code><tr><td>244<td><code><pre> }</pre></code><tr><td>245<td><code><pre> return r</pre></code><tr><td>246<td><code><pre>}</pre></code></table><div class=funcname id=fn_newMysqlSubscriber>func newMysqlSubscriber</div><div class=info><a href=#s_fn_newMysqlSubscriber>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mysql.go</code>:</div><table class=listing><tr><td>71<td><code><pre>func newMysqlSubscriber(ctx context.Context, appName, name string, conf *Conf, logger watermill.LoggerAdapter,</pre></code><tr><td>72<td><code><pre> cli *sql.DB) Subscriber {</pre></code><tr><td>73<td><code><pre> cfg := millSql.SubscriberConfig{</pre></code><tr><td>74<td><code><pre> ConsumerGroup: conf.ConsumerGroup,</pre></code><tr><td>75<td><code><pre> PollInterval: 0,</pre></code><tr><td>76<td><code><pre> ResendInterval: 0,</pre></code><tr><td>77<td><code><pre> RetryInterval: 0,</pre></code><tr><td>78<td><code><pre> BackoffManager: nil,</pre></code><tr><td>79<td><code><pre> SchemaAdapter: millSql.DefaultMySQLSchema{</pre></code><tr><td>80<td><code><pre> GenerateMessagesTableName: func(topic string) string {</pre></code><tr><td>81<td><code><pre> return fmt.Sprintf("%s_%s", conf.MessageScheme, topic)</pre></code><tr><td>82<td><code><pre> },</pre></code><tr><td>83<td><code><pre> SubscribeBatchSize: conf.ConsumerConcurrency, // fetch how many rows per query</pre></code><tr><td>84<td><code><pre> },</pre></code><tr><td>85<td><code><pre> OffsetsAdapter: millSql.DefaultMySQLOffsetsAdapter{</pre></code><tr><td>86<td><code><pre> GenerateMessagesOffsetsTableName: func(topic string) string {</pre></code><tr><td>87<td><code><pre> return fmt.Sprintf("%s_offsets_%s", conf.MessageScheme, topic)</pre></code><tr><td>88<td><code><pre> },</pre></code><tr><td>89<td><code><pre> },</pre></code><tr><td>90<td><code><pre> InitializeSchema: true,</pre></code><tr><td>91<td><code><pre> DisablePersistent: !conf.Persistent,</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre></pre></code><tr><td>94<td><code><pre> sub, err := millSql.NewSubscriber(cli, cfg, logger)</pre></code><tr><td>95<td><code><pre> if err != nil {</pre></code><tr class=miss><td>96<td><code><pre> panic(errors.Wrapf(err, "initialize mq component mysql subscriber failed: %s", err))</pre></code><tr><td>97<td><code><pre> }</pre></code><tr><td>98<td><code><pre></pre></code><tr><td>99<td><code><pre> return &mysqlSubscriber{</pre></code><tr><td>100<td><code><pre> abstractMQ: newSub(ctx, sub, appName, name, conf, logger),</pre></code><tr><td>101<td><code><pre> subscriber: sub,</pre></code><tr><td>102<td><code><pre> }</pre></code><tr><td>103<td><code><pre>}</pre></code></table><div class=funcname id=fn_newRedisSubscriber>func newRedisSubscriber</div><div class=info><a href=#s_fn_newRedisSubscriber>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/redis.go</code>:</div><table class=listing><tr><td>67<td><code><pre>func newRedisSubscriber(ctx context.Context, appName, name string, conf *Conf, logger watermill.LoggerAdapter,</pre></code><tr><td>68<td><code><pre> cli rdsDrv.UniversalClient) Subscriber {</pre></code><tr><td>69<td><code><pre> cfg := millRds.SubscriberConfig{</pre></code><tr><td>70<td><code><pre> Client: cli,</pre></code><tr><td>71<td><code><pre> Unmarshaller: millRds.DefaultMarshallerUnmarshaller{AppID: config.Use(appName).AppName()},</pre></code><tr><td>72<td><code><pre> Consumer: "",</pre></code><tr><td>73<td><code><pre> ConsumerGroup: conf.ConsumerGroup,</pre></code><tr><td>74<td><code><pre> NackResendSleep: 0,</pre></code><tr><td>75<td><code><pre> BlockTime: 0,</pre></code><tr><td>76<td><code><pre> ClaimInterval: 0,</pre></code><tr><td>77<td><code><pre> ClaimBatchSize: 0,</pre></code><tr><td>78<td><code><pre> MaxIdleTime: 0,</pre></code><tr><td>79<td><code><pre> CheckConsumersInterval: 0,</pre></code><tr><td>80<td><code><pre> ConsumerTimeout: 0,</pre></code><tr><td>81<td><code><pre> OldestId: "",</pre></code><tr><td>82<td><code><pre> ShouldClaimPendingMessage: nil,</pre></code><tr><td>83<td><code><pre> DisableRedisConnClose: true,</pre></code><tr><td>84<td><code><pre> }</pre></code><tr><td>85<td><code><pre></pre></code><tr><td>86<td><code><pre> sub, err := millRds.NewSubscriber(cfg, logger)</pre></code><tr><td>87<td><code><pre> if err != nil {</pre></code><tr class=miss><td>88<td><code><pre> panic(errors.Wrapf(err, "initialize mq component redis subscriber failed: %s", err))</pre></code><tr><td>89<td><code><pre> }</pre></code><tr><td>90<td><code><pre></pre></code><tr><td>91<td><code><pre> return &redisSubscriber{</pre></code><tr><td>92<td><code><pre> abstractMQ: newSub(ctx, sub, appName, name, conf, logger),</pre></code><tr><td>93<td><code><pre> subscriber: sub,</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre>}</pre></code></table><div class=funcname id=fn_newRedisPublisher>func newRedisPublisher</div><div class=info><a href=#s_fn_newRedisPublisher>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/redis.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func newRedisPublisher(ctx context.Context, appName, name string, conf *Conf, logger watermill.LoggerAdapter,</pre></code><tr><td>39<td><code><pre> cli rdsDrv.UniversalClient) Publisher {</pre></code><tr><td>40<td><code><pre> cfg := millRds.PublisherConfig{</pre></code><tr><td>41<td><code><pre> Client: cli,</pre></code><tr><td>42<td><code><pre> Marshaller: millRds.DefaultMarshallerUnmarshaller{AppID: config.Use(appName).AppName()},</pre></code><tr><td>43<td><code><pre> Maxlens: nil,</pre></code><tr><td>44<td><code><pre> DisableRedisConnClose: true,</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre></pre></code><tr><td>47<td><code><pre> pub, err := millRds.NewPublisher(cfg, logger)</pre></code><tr><td>48<td><code><pre> if err != nil {</pre></code><tr class=miss><td>49<td><code><pre> panic(errors.Wrapf(err, "initialize mq component redis publisher failed: %s", err))</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre></pre></code><tr><td>52<td><code><pre> return &redisPublisher{</pre></code><tr><td>53<td><code><pre> abstractMQ: newPub(ctx, pub, appName, name, conf, logger),</pre></code><tr><td>54<td><code><pre> publisher: pub,</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre>}</pre></code></table><div class=funcname id=fn_newKafkaPublisher>func newKafkaPublisher</div><div class=info><a href=#s_fn_newKafkaPublisher>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/kafka.go</code>:</div><table class=listing><tr><td>35<td><code><pre>func newKafkaPublisher(ctx context.Context, appName, name string,</pre></code><tr><td>36<td><code><pre> conf *Conf, logger watermill.LoggerAdapter) Publisher {</pre></code><tr><td>37<td><code><pre> cfg := kafka.PublisherConfig{</pre></code><tr><td>38<td><code><pre> Brokers: conf.Endpoint.Addresses,</pre></code><tr><td>39<td><code><pre> Marshaler: kafka.DefaultMarshaler{AppID: config.Use(appName).AppName()},</pre></code><tr><td>40<td><code><pre> OverwriteSaramaConfig: parseKafkaConf(appName, conf),</pre></code><tr><td>41<td><code><pre> }</pre></code><tr><td>42<td><code><pre></pre></code><tr><td>43<td><code><pre> pub, err := kafka.NewPublisher(cfg, logger)</pre></code><tr><td>44<td><code><pre> if err != nil {</pre></code><tr class=miss><td>45<td><code><pre> panic(errors.Wrapf(err, "initialize mq component kafka publisher failed: %s", err))</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre></pre></code><tr><td>48<td><code><pre> return &kafkaPublisher{</pre></code><tr><td>49<td><code><pre> abstractMQ: newPub(ctx, pub, appName, name, conf, logger),</pre></code><tr><td>50<td><code><pre> publisher: pub,</pre></code><tr><td>51<td><code><pre> }</pre></code><tr><td>52<td><code><pre>}</pre></code></table><div class=funcname id=fn_newPostgresPublisher>func newPostgresPublisher</div><div class=info><a href=#s_fn_newPostgresPublisher>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/postgres.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func newPostgresPublisher(ctx context.Context, appName, name string, conf *Conf, logger watermill.LoggerAdapter,</pre></code><tr><td>39<td><code><pre> cli *sql.DB) Publisher {</pre></code><tr><td>40<td><code><pre> cfg := millSql.PublisherConfig{</pre></code><tr><td>41<td><code><pre> SchemaAdapter: millSql.DefaultPostgreSQLSchema{</pre></code><tr><td>42<td><code><pre> GenerateMessagesTableName: func(topic string) string {</pre></code><tr><td>43<td><code><pre> return fmt.Sprintf("%s_%s", conf.MessageScheme, topic)</pre></code><tr><td>44<td><code><pre> },</pre></code><tr><td>45<td><code><pre> SubscribeBatchSize: conf.ConsumerConcurrency,</pre></code><tr><td>46<td><code><pre> },</pre></code><tr><td>47<td><code><pre> AutoInitializeSchema: true,</pre></code><tr><td>48<td><code><pre> AppID: config.Use(appName).AppName(),</pre></code><tr><td>49<td><code><pre> }</pre></code><tr><td>50<td><code><pre></pre></code><tr><td>51<td><code><pre> pub, err := millSql.NewPublisher(cli, cfg, logger)</pre></code><tr><td>52<td><code><pre> if err != nil {</pre></code><tr class=miss><td>53<td><code><pre> panic(errors.Wrapf(err, "initialize mq component postgres publisher failed: %s", err))</pre></code><tr><td>54<td><code><pre> }</pre></code><tr><td>55<td><code><pre></pre></code><tr><td>56<td><code><pre> return &postgresPublisher{</pre></code><tr><td>57<td><code><pre> abstractMQ: newPub(ctx, pub, appName, name, conf, logger),</pre></code><tr><td>58<td><code><pre> publisher: pub,</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre>}</pre></code></table><div class=funcname id=fn_newMysqlPublisher>func newMysqlPublisher</div><div class=info><a href=#s_fn_newMysqlPublisher>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mysql.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func newMysqlPublisher(ctx context.Context, appName, name string, conf *Conf, logger watermill.LoggerAdapter,</pre></code><tr><td>39<td><code><pre> cli *sql.DB) Publisher {</pre></code><tr><td>40<td><code><pre> cfg := millSql.PublisherConfig{</pre></code><tr><td>41<td><code><pre> SchemaAdapter: millSql.DefaultMySQLSchema{</pre></code><tr><td>42<td><code><pre> GenerateMessagesTableName: func(topic string) string {</pre></code><tr><td>43<td><code><pre> return fmt.Sprintf("%s_%s", conf.MessageScheme, topic)</pre></code><tr><td>44<td><code><pre> },</pre></code><tr><td>45<td><code><pre> SubscribeBatchSize: 1,</pre></code><tr><td>46<td><code><pre> },</pre></code><tr><td>47<td><code><pre> AutoInitializeSchema: true,</pre></code><tr><td>48<td><code><pre> AppID: config.Use(appName).AppName(),</pre></code><tr><td>49<td><code><pre> }</pre></code><tr><td>50<td><code><pre></pre></code><tr><td>51<td><code><pre> pub, err := millSql.NewPublisher(cli, cfg, logger)</pre></code><tr><td>52<td><code><pre> if err != nil {</pre></code><tr class=miss><td>53<td><code><pre> panic(errors.Wrapf(err, "initialize mq component mysql publisher failed: %s", err))</pre></code><tr><td>54<td><code><pre> }</pre></code><tr><td>55<td><code><pre></pre></code><tr><td>56<td><code><pre> return &mysqlPublisher{</pre></code><tr><td>57<td><code><pre> abstractMQ: newPub(ctx, pub, appName, name, conf, logger),</pre></code><tr><td>58<td><code><pre> publisher: pub,</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre>}</pre></code></table><div class=funcname id=fn_newPostgresSubscriber>func newPostgresSubscriber</div><div class=info><a href=#s_fn_newPostgresSubscriber>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/postgres.go</code>:</div><table class=listing><tr><td>71<td><code><pre>func newPostgresSubscriber(ctx context.Context, appName, name string, conf *Conf, logger watermill.LoggerAdapter,</pre></code><tr><td>72<td><code><pre> cli *sql.DB) Subscriber {</pre></code><tr><td>73<td><code><pre> cfg := millSql.SubscriberConfig{</pre></code><tr><td>74<td><code><pre> ConsumerGroup: conf.ConsumerGroup,</pre></code><tr><td>75<td><code><pre> PollInterval: 0,</pre></code><tr><td>76<td><code><pre> ResendInterval: 0,</pre></code><tr><td>77<td><code><pre> RetryInterval: 0,</pre></code><tr><td>78<td><code><pre> BackoffManager: nil,</pre></code><tr><td>79<td><code><pre> SchemaAdapter: millSql.DefaultPostgreSQLSchema{</pre></code><tr><td>80<td><code><pre> GenerateMessagesTableName: func(topic string) string {</pre></code><tr><td>81<td><code><pre> return fmt.Sprintf("%s_%s", conf.MessageScheme, topic)</pre></code><tr><td>82<td><code><pre> },</pre></code><tr><td>83<td><code><pre> SubscribeBatchSize: conf.ConsumerConcurrency, // fetch how many rows per query</pre></code><tr><td>84<td><code><pre> },</pre></code><tr><td>85<td><code><pre> OffsetsAdapter: millSql.DefaultPostgreSQLOffsetsAdapter{</pre></code><tr><td>86<td><code><pre> GenerateMessagesOffsetsTableName: func(topic string) string {</pre></code><tr><td>87<td><code><pre> return fmt.Sprintf("%s_offsets_%s", conf.MessageScheme, topic)</pre></code><tr><td>88<td><code><pre> },</pre></code><tr><td>89<td><code><pre> },</pre></code><tr><td>90<td><code><pre> InitializeSchema: true,</pre></code><tr><td>91<td><code><pre> DisablePersistent: !conf.Persistent,</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre></pre></code><tr><td>94<td><code><pre> sub, err := millSql.NewSubscriber(cli, cfg, logger)</pre></code><tr><td>95<td><code><pre> if err != nil {</pre></code><tr class=miss><td>96<td><code><pre> panic(errors.Wrapf(err, "initialize mq component mysql subscriber failed: %s", err))</pre></code><tr><td>97<td><code><pre> }</pre></code><tr><td>98<td><code><pre></pre></code><tr><td>99<td><code><pre> return &postgresSubscriber{</pre></code><tr><td>100<td><code><pre> abstractMQ: newSub(ctx, sub, appName, name, conf, logger),</pre></code><tr><td>101<td><code><pre> subscriber: sub,</pre></code><tr><td>102<td><code><pre> }</pre></code><tr><td>103<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.Start>func router.Start</div><div class=info><a href=#s_fn_router.Start>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>187<td><code><pre>func (r *router) Start() {</pre></code><tr><td>188<td><code><pre> if r.isHandlerConflict() {</pre></code><tr class=miss><td>189<td><code><pre> panic(ErrEventHandlerConflict)</pre></code><tr><td>190<td><code><pre> }</pre></code><tr><td>191<td><code><pre> if len(r.eventHandlers) > 0 {</pre></code><tr><td>192<td><code><pre> r.runEventHandlers()</pre></code><tr><td>193<td><code><pre> }</pre></code><tr><td>194<td><code><pre> routine.Go(r.run, routine.AppName(r.appName))</pre></code><tr><td>195<td><code><pre>}</pre></code></table><div class=funcname id=fn_newAMQPPublisher>func newAMQPPublisher</div><div class=info><a href=#s_fn_newAMQPPublisher>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/amqp.go</code>:</div><table class=listing><tr><td>34<td><code><pre>func newAMQPPublisher(ctx context.Context, appName, name string, conf *Conf, logger watermill.LoggerAdapter) Publisher {</pre></code><tr><td>35<td><code><pre> ep := parseAMQPEndpoint(conf)</pre></code><tr><td>36<td><code><pre></pre></code><tr><td>37<td><code><pre> var genFunc amqp.QueueNameGenerator</pre></code><tr><td>38<td><code><pre> if utils.IsStrNotBlank(conf.ConsumerGroup) {</pre></code><tr><td>39<td><code><pre> genFunc = amqp.GenerateQueueNameTopicNameWithSuffix(conf.ConsumerGroup)</pre></code><tr><td>40<td><code><pre> } else {</pre></code><tr class=miss><td>41<td><code><pre> genFunc = amqp.GenerateQueueNameTopicName</pre></code><tr><td>42<td><code><pre> }</pre></code><tr><td>43<td><code><pre></pre></code><tr><td>44<td><code><pre> var cfg amqp.Config</pre></code><tr><td>45<td><code><pre> if conf.Persistent {</pre></code><tr><td>46<td><code><pre> cfg = amqp.NewDurablePubSubConfig(ep, genFunc)</pre></code><tr><td>47<td><code><pre> } else {</pre></code><tr class=miss><td>48<td><code><pre> cfg = amqp.NewNonDurablePubSubConfig(ep, genFunc)</pre></code><tr><td>49<td><code><pre> }</pre></code><tr><td>50<td><code><pre></pre></code><tr><td>51<td><code><pre> cfg.Marshaler = amqp.DefaultMarshaler{</pre></code><tr><td>52<td><code><pre> NotPersistentDeliveryMode: !conf.Persistent,</pre></code><tr><td>53<td><code><pre> AppID: config.Use(appName).AppName(),</pre></code><tr><td>54<td><code><pre> }</pre></code><tr><td>55<td><code><pre></pre></code><tr><td>56<td><code><pre> pub, err := amqp.NewPublisher(cfg, logger)</pre></code><tr><td>57<td><code><pre> if err != nil {</pre></code><tr class=miss><td>58<td><code><pre> panic(errors.Wrapf(err, "initialize mq component amqp publisher failed: %s", err))</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre></pre></code><tr><td>61<td><code><pre> return &_AMQPPublisher{</pre></code><tr><td>62<td><code><pre> abstractMQ: newPub(ctx, pub, appName, name, conf, logger),</pre></code><tr><td>63<td><code><pre> publisher: pub,</pre></code><tr><td>64<td><code><pre> }</pre></code><tr><td>65<td><code><pre>}</pre></code></table><div class=funcname id=fn_newAMQPSubscriber>func newAMQPSubscriber</div><div class=info><a href=#s_fn_newAMQPSubscriber>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/amqp.go</code>:</div><table class=listing><tr><td>76<td><code><pre>func newAMQPSubscriber(ctx context.Context, appName, name string, conf *Conf, logger watermill.LoggerAdapter) Subscriber {</pre></code><tr><td>77<td><code><pre> ep := parseAMQPEndpoint(conf)</pre></code><tr><td>78<td><code><pre></pre></code><tr><td>79<td><code><pre> var genFunc amqp.QueueNameGenerator</pre></code><tr><td>80<td><code><pre> if utils.IsStrNotBlank(conf.ConsumerGroup) {</pre></code><tr><td>81<td><code><pre> genFunc = amqp.GenerateQueueNameTopicNameWithSuffix(conf.ConsumerGroup)</pre></code><tr><td>82<td><code><pre> } else {</pre></code><tr class=miss><td>83<td><code><pre> genFunc = amqp.GenerateQueueNameTopicName</pre></code><tr><td>84<td><code><pre> }</pre></code><tr><td>85<td><code><pre></pre></code><tr><td>86<td><code><pre> var cfg amqp.Config</pre></code><tr><td>87<td><code><pre> if conf.Persistent {</pre></code><tr><td>88<td><code><pre> cfg = amqp.NewDurablePubSubConfig(ep, genFunc)</pre></code><tr><td>89<td><code><pre> } else {</pre></code><tr class=miss><td>90<td><code><pre> cfg = amqp.NewNonDurablePubSubConfig(ep, genFunc)</pre></code><tr><td>91<td><code><pre> }</pre></code><tr><td>92<td><code><pre></pre></code><tr><td>93<td><code><pre> sub, err := amqp.NewSubscriber(cfg, logger)</pre></code><tr><td>94<td><code><pre> if err != nil {</pre></code><tr class=miss><td>95<td><code><pre> panic(errors.Wrapf(err, "initialize mq component amqp subscriber failed: %s", err))</pre></code><tr><td>96<td><code><pre> }</pre></code><tr><td>97<td><code><pre></pre></code><tr><td>98<td><code><pre> utils.MustSuccess(sub.SubscribeInitialize(conf.Topic))</pre></code><tr><td>99<td><code><pre></pre></code><tr><td>100<td><code><pre> return &_AMQPSubscriber{</pre></code><tr><td>101<td><code><pre> abstractMQ: newSub(ctx, sub, appName, name, conf, logger),</pre></code><tr><td>102<td><code><pre> subscriber: sub,</pre></code><tr><td>103<td><code><pre> }</pre></code><tr><td>104<td><code><pre>}</pre></code></table><div class=funcname id=fn_newRouter>func newRouter</div><div class=info><a href=#s_fn_newRouter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>59<td><code><pre>func newRouter(ctx context.Context, appName, name string, conf *Conf,</pre></code><tr><td>60<td><code><pre> pub Publisher, sub Subscriber, logger watermill.LoggerAdapter) *router {</pre></code><tr><td>61<td><code><pre> r := utils.Must(mw.NewRouter(mw.RouterConfig{CloseTimeout: 15 * time.Second}, logger))</pre></code><tr><td>62<td><code><pre> r.AddPlugin(plugin.SignalsHandler)</pre></code><tr><td>63<td><code><pre> r.AddMiddleware(</pre></code><tr><td>64<td><code><pre> middleware.Recoverer,</pre></code><tr><td>65<td><code><pre> middleware.CorrelationID,</pre></code><tr><td>66<td><code><pre> )</pre></code><tr><td>67<td><code><pre> for _, mwsConf := range conf.ConsumeMiddlewares {</pre></code><tr><td>68<td><code><pre> switch mwsConf.Type {</pre></code><tr><td>69<td><code><pre> case middlewareTypeRetry:</pre></code><tr><td>70<td><code><pre> r.AddMiddleware(middleware.Retry{</pre></code><tr><td>71<td><code><pre> MaxRetries: mwsConf.RetryMaxRetries,</pre></code><tr><td>72<td><code><pre> InitialInterval: utils.Must(time.ParseDuration(mwsConf.RetryInitialInterval)),</pre></code><tr><td>73<td><code><pre> MaxInterval: utils.Must(time.ParseDuration(mwsConf.RetryMaxInterval)),</pre></code><tr><td>74<td><code><pre> Multiplier: mwsConf.RetryMultiplier,</pre></code><tr><td>75<td><code><pre> MaxElapsedTime: utils.Must(time.ParseDuration(mwsConf.RetryMaxElapsedTime)),</pre></code><tr><td>76<td><code><pre> RandomizationFactor: mwsConf.RetryRandomizationFactor,</pre></code><tr><td>77<td><code><pre> OnRetryHook: func(attempt int, delay time.Duration) {</pre></code><tr><td>78<td><code><pre> logTrace(ctx, logger, appName, name,</pre></code><tr><td>79<td><code><pre> "retry to consume message [attempt[%v] delay[%s]]", attempt, delay)</pre></code><tr><td>80<td><code><pre> },</pre></code><tr><td>81<td><code><pre> Logger: logger,</pre></code><tr><td>82<td><code><pre> }.Middleware)</pre></code><tr><td>83<td><code><pre> case middlewareTypeThrottle:</pre></code><tr><td>84<td><code><pre> r.AddMiddleware(</pre></code><tr><td>85<td><code><pre> middleware.NewThrottle(</pre></code><tr><td>86<td><code><pre> int64(mwsConf.ThrottleCount),</pre></code><tr><td>87<td><code><pre> utils.Must(time.ParseDuration(mwsConf.ThrottleDuration)),</pre></code><tr><td>88<td><code><pre> ).Middleware,</pre></code><tr><td>89<td><code><pre> )</pre></code><tr><td>90<td><code><pre> case middlewareTypeInstanceAck:</pre></code><tr class=miss><td>91<td><code><pre> r.AddMiddleware(middleware.InstantAck)</pre></code><tr><td>92<td><code><pre> case middlewareTypePoison:</pre></code><tr><td>93<td><code><pre> shouldGoToPoisonQueue := func(err error) bool { return err != nil }</pre></code><tr><td>94<td><code><pre> r.AddMiddleware(</pre></code><tr><td>95<td><code><pre> utils.Must(middleware.PoisonQueueWithFilter(</pre></code><tr><td>96<td><code><pre> pub.watermillPublisher(),</pre></code><tr><td>97<td><code><pre> mwsConf.PoisonTopic,</pre></code><tr><td>98<td><code><pre> shouldGoToPoisonQueue,</pre></code><tr><td>99<td><code><pre> )),</pre></code><tr><td>100<td><code><pre> )</pre></code><tr><td>101<td><code><pre> case middlewareTypeTimeout:</pre></code><tr><td>102<td><code><pre> r.AddMiddleware(middleware.Timeout(utils.Must(time.ParseDuration(mwsConf.Timeout))))</pre></code><tr><td>103<td><code><pre> case middlewareTypeCircuitBreaker:</pre></code><tr><td>104<td><code><pre> var expr gval.Evaluable</pre></code><tr><td>105<td><code><pre> if utils.IsStrNotBlank(mwsConf.CircuitBreakerTripExpr) {</pre></code><tr><td>106<td><code><pre> expr = utils.Must(gval.Full().NewEvaluable(mwsConf.CircuitBreakerTripExpr))</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre> r.AddMiddleware(middleware.NewCircuitBreaker(gobreaker.Settings{</pre></code><tr><td>109<td><code><pre> Name: name,</pre></code><tr><td>110<td><code><pre> MaxRequests: uint32(mwsConf.CircuitBreakerMaxRequests),</pre></code><tr><td>111<td><code><pre> Interval: utils.Must(time.ParseDuration(mwsConf.CircuitBreakerInterval)),</pre></code><tr><td>112<td><code><pre> Timeout: utils.Must(time.ParseDuration(mwsConf.CircuitBreakerTimeout)),</pre></code><tr><td>113<td><code><pre> ReadyToTrip: func(counts gobreaker.Counts) bool {</pre></code><tr><td>114<td><code><pre> // fallback to default ready to trip expression</pre></code><tr><td>115<td><code><pre> if expr == nil {</pre></code><tr><td>116<td><code><pre> return counts.ConsecutiveFailures > 5</pre></code><tr><td>117<td><code><pre> }</pre></code><tr><td>118<td><code><pre> if ok, err := expr.EvalBool(ctx, map[string]uint32{</pre></code><tr><td>119<td><code><pre> "requests": counts.Requests,</pre></code><tr><td>120<td><code><pre> "total_successes": counts.TotalSuccesses,</pre></code><tr><td>121<td><code><pre> "total_failures": counts.TotalFailures,</pre></code><tr><td>122<td><code><pre> "consecutive_successes": counts.ConsecutiveSuccesses,</pre></code><tr><td>123<td><code><pre> "consecutive_failures": counts.ConsecutiveFailures,</pre></code><tr><td>124<td><code><pre> }); err == nil {</pre></code><tr><td>125<td><code><pre> return ok</pre></code><tr><td>126<td><code><pre> }</pre></code><tr><td>127<td><code><pre> // fallback to default ready to trip expression</pre></code><tr><td>128<td><code><pre> return counts.ConsecutiveFailures > 5</pre></code><tr><td>129<td><code><pre> },</pre></code><tr><td>130<td><code><pre> OnStateChange: func(name string, from gobreaker.State, to gobreaker.State) {</pre></code><tr><td>131<td><code><pre> logInfo(ctx, logger, appName, name, "circuit breaker state changed: %s -> %s", from, to)</pre></code><tr><td>132<td><code><pre> },</pre></code><tr><td>133<td><code><pre> IsSuccessful: func(err error) bool { return err == nil },</pre></code><tr><td>134<td><code><pre> }).Middleware)</pre></code><tr><td>135<td><code><pre> default:</pre></code><tr class=miss><td>136<td><code><pre> typ := inspect.TypeOf(string(mwsConf.Type))</pre></code><tr class=miss><td>137<td><code><pre> if typ == nil || typ.ConvertibleTo(watermillHandlerMiddlewareType) {</pre></code><tr class=miss><td>138<td><code><pre> panic(errors.Errorf("unknown mq middleware: %s", mwsConf.Type))</pre></code><tr><td>139<td><code><pre> }</pre></code><tr class=miss><td>140<td><code><pre> mws := reflect.New(typ).Elem().Convert(watermillHandlerMiddlewareType).Interface()</pre></code><tr class=miss><td>141<td><code><pre> r.AddMiddleware(mws.(mw.HandlerMiddleware))</pre></code><tr><td>142<td><code><pre> }</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre></pre></code><tr><td>145<td><code><pre> rr := &router{</pre></code><tr><td>146<td><code><pre> ctx: ctx,</pre></code><tr><td>147<td><code><pre> appName: appName,</pre></code><tr><td>148<td><code><pre> c: conf,</pre></code><tr><td>149<td><code><pre> pub: pub,</pre></code><tr><td>150<td><code><pre> sub: sub,</pre></code><tr><td>151<td><code><pre> Router: r,</pre></code><tr><td>152<td><code><pre> eventHandlers: make(map[string]*handler),</pre></code><tr><td>153<td><code><pre> eventSubscriberHandlers: make(map[string]*handler),</pre></code><tr><td>154<td><code><pre> }</pre></code><tr><td>155<td><code><pre> rr.serializeType = serialize.ParseAlgorithm(conf.SerializeType)</pre></code><tr><td>156<td><code><pre> rr.compressType = compress.ParseAlgorithm(conf.CompressType)</pre></code><tr><td>157<td><code><pre></pre></code><tr><td>158<td><code><pre> return rr</pre></code><tr><td>159<td><code><pre>}</pre></code></table><div class=funcname id=fn_newPulsarPublisher>func newPulsarPublisher</div><div class=info><a href=#s_fn_newPulsarPublisher>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/pulsar.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func newPulsarPublisher(ctx context.Context, appName, name string,</pre></code><tr><td>37<td><code><pre> conf *Conf, logger watermill.LoggerAdapter) Publisher {</pre></code><tr><td>38<td><code><pre> cfg := pulsar.PublisherConfig{</pre></code><tr><td>39<td><code><pre> URL: fmt.Sprintf("pulsar://%s", strings.TrimPrefix(conf.Endpoint.Addresses[0], "pulsar://")),</pre></code><tr><td>40<td><code><pre> AppID: config.Use(appName).AppName(),</pre></code><tr><td>41<td><code><pre> }</pre></code><tr><td>42<td><code><pre> hasUser := utils.IsStrNotBlank(conf.Endpoint.User)</pre></code><tr><td>43<td><code><pre> hasPassword := utils.IsStrNotBlank(conf.Endpoint.Password)</pre></code><tr><td>44<td><code><pre> hasAuthType := utils.IsStrNotBlank(conf.Endpoint.AuthType)</pre></code><tr><td>45<td><code><pre> if hasUser && hasPassword {</pre></code><tr class=miss><td>46<td><code><pre> cfg.Authentication = utils.Must(plsDrv.NewAuthenticationBasic(conf.Endpoint.User, conf.Endpoint.Password))</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> if hasAuthType {</pre></code><tr class=miss><td>49<td><code><pre> cfg.Authentication = utils.Must(plsDrv.NewAuthentication(conf.Endpoint.AuthType, conf.Endpoint.Password))</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre></pre></code><tr><td>52<td><code><pre> pub, err := pulsar.NewPublisher(cfg, logger)</pre></code><tr><td>53<td><code><pre> if err != nil {</pre></code><tr class=miss><td>54<td><code><pre> panic(errors.Wrapf(err, "initialize mq component pulsar publisher failed: %s", err))</pre></code><tr><td>55<td><code><pre> }</pre></code><tr><td>56<td><code><pre></pre></code><tr><td>57<td><code><pre> return &pulsarPublisher{</pre></code><tr><td>58<td><code><pre> abstractMQ: newPub(ctx, pub, appName, name, conf, logger),</pre></code><tr><td>59<td><code><pre> publisher: pub,</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstractMQ.PublishRaw>func abstractMQ.PublishRaw</div><div class=info><a href=#s_fn_abstractMQ.PublishRaw>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>99<td><code><pre>func (a *abstractMQ) PublishRaw(ctx context.Context, opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>100<td><code><pre> opt := utils.ApplyOptions[pubOption](opts...)</pre></code><tr><td>101<td><code><pre> msgs := opt.watermillMessages</pre></code><tr><td>102<td><code><pre> for _, msg := range opt.messages {</pre></code><tr><td>103<td><code><pre> wmsg := mw.NewMessage(msg.ID(), msg.Payload())</pre></code><tr><td>104<td><code><pre> wmsg.Metadata = fusCtx.WatermillMetadata(ctx)</pre></code><tr><td>105<td><code><pre> wmsg.SetContext(ctx)</pre></code><tr><td>106<td><code><pre> msgs = append(msgs, wmsg)</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre> if len(msgs) == 0 {</pre></code><tr class=miss><td>109<td><code><pre> logInfo(ctx, a.logger, a.appName, a.name, "none messages to publish")</pre></code><tr class=miss><td>110<td><code><pre> return</pre></code><tr><td>111<td><code><pre> }</pre></code><tr><td>112<td><code><pre></pre></code><tr><td>113<td><code><pre> if !opt.async {</pre></code><tr><td>114<td><code><pre> return a.pub.Publish(ctx, a.conf.Topic, msgs...)</pre></code><tr><td>115<td><code><pre> }</pre></code><tr><td>116<td><code><pre></pre></code><tr class=miss><td>117<td><code><pre> routine.Goc(ctx, func() {</pre></code><tr><td>118<td><code><pre> idList := utils.SliceMapping(msgs, func(s *mw.Message) (id string) { return s.UUID })</pre></code><tr><td>119<td><code><pre> idList = utils.NewSet(idList...).Items()</pre></code><tr><td>120<td><code><pre> retryFunc := func(attempt uint) error {</pre></code><tr><td>121<td><code><pre> if attempt > 1 {</pre></code><tr><td>122<td><code><pre> logInfo(ctx, a.logger, a.appName, a.name,</pre></code><tr><td>123<td><code><pre> "retry to publish topic message [topic[%s] message%v[%v] attempt[%v]]",</pre></code><tr><td>124<td><code><pre> a.conf.Topic, idList, len(msgs), attempt-1)</pre></code><tr><td>125<td><code><pre> }</pre></code><tr><td>126<td><code><pre> return a.pub.Publish(ctx, a.conf.Topic, msgs...)</pre></code><tr><td>127<td><code><pre> }</pre></code><tr><td>128<td><code><pre></pre></code><tr><td>129<td><code><pre> if err = retry.Retry(retryFunc, opt.asyncStrategies...); err != nil {</pre></code><tr><td>130<td><code><pre> logError(ctx, a.logger, a.appName, a.name,</pre></code><tr><td>131<td><code><pre> "retry to publish topic message failed [err[%s] topic[%s] message%v[%v]]",</pre></code><tr><td>132<td><code><pre> err, a.conf.Topic, idList, len(msgs))</pre></code><tr><td>133<td><code><pre> }</pre></code><tr><td>134<td><code><pre> }, routine.AppName(a.appName))</pre></code><tr class=miss><td>135<td><code><pre> return</pre></code><tr><td>136<td><code><pre>}</pre></code></table><div class=funcname id=fn_newKafkaSubscriber>func newKafkaSubscriber</div><div class=info><a href=#s_fn_newKafkaSubscriber>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/kafka.go</code>:</div><table class=listing><tr><td>63<td><code><pre>func newKafkaSubscriber(ctx context.Context, appName, name string,</pre></code><tr><td>64<td><code><pre> conf *Conf, logger watermill.LoggerAdapter) Subscriber {</pre></code><tr><td>65<td><code><pre> cfg := kafka.SubscriberConfig{</pre></code><tr><td>66<td><code><pre> Brokers: conf.Endpoint.Addresses,</pre></code><tr><td>67<td><code><pre> Unmarshaler: kafka.DefaultMarshaler{AppID: config.Use(appName).AppName()},</pre></code><tr><td>68<td><code><pre> OverwriteSaramaConfig: parseKafkaConf(appName, conf),</pre></code><tr><td>69<td><code><pre> ConsumerGroup: conf.ConsumerGroup,</pre></code><tr><td>70<td><code><pre> NackResendSleep: 100 * time.Millisecond,</pre></code><tr><td>71<td><code><pre> ReconnectRetrySleep: time.Second,</pre></code><tr><td>72<td><code><pre> InitializeTopicDetails: &sarama.TopicDetail{</pre></code><tr><td>73<td><code><pre> NumPartitions: -1,</pre></code><tr><td>74<td><code><pre> ReplicationFactor: -1,</pre></code><tr><td>75<td><code><pre> ReplicaAssignment: nil,</pre></code><tr><td>76<td><code><pre> ConfigEntries: nil,</pre></code><tr><td>77<td><code><pre> },</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre></pre></code><tr><td>80<td><code><pre> sub, err := kafka.NewSubscriber(cfg, logger)</pre></code><tr><td>81<td><code><pre> if err != nil {</pre></code><tr class=miss><td>82<td><code><pre> panic(errors.Wrapf(err, "initialize mq component kafka subscriber failed: %s", err))</pre></code><tr><td>83<td><code><pre> }</pre></code><tr><td>84<td><code><pre></pre></code><tr><td>85<td><code><pre> if err = sub.SubscribeInitialize(conf.Topic); err != nil {</pre></code><tr class=miss><td>86<td><code><pre> panic(errors.Wrapf(err, "initialize mq component kafka subscriber intialize: %s", err))</pre></code><tr><td>87<td><code><pre> }</pre></code><tr><td>88<td><code><pre></pre></code><tr><td>89<td><code><pre> return &kafkaSubscriber{</pre></code><tr><td>90<td><code><pre> abstractMQ: newSub(ctx, sub, appName, name, conf, logger),</pre></code><tr><td>91<td><code><pre> subscriber: sub,</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstractMQ.newObjectMessage>func abstractMQ.newObjectMessage</div><div class=info><a href=#s_fn_abstractMQ.newObjectMessage>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>258<td><code><pre>func (a *abstractMQ) newObjectMessage(ctx context.Context, object any, opt *pubOption) (</pre></code><tr><td>259<td><code><pre> msg *mw.Message, err error) {</pre></code><tr><td>260<td><code><pre> payload, err := pd.Seal(object, pd.Compress(a.compressType), pd.Serialize(a.serializeType))</pre></code><tr><td>261<td><code><pre> if err != nil {</pre></code><tr class=miss><td>262<td><code><pre> return</pre></code><tr><td>263<td><code><pre> }</pre></code><tr><td>264<td><code><pre> uuid := utils.ULID()</pre></code><tr><td>265<td><code><pre> if opt.objectUUIDGenFunc.IsValid() && opt.objectUUIDGenFunc.Kind() == reflect.Func {</pre></code><tr class=miss><td>266<td><code><pre> inType := opt.objectUUIDGenFunc.Type().In(0)</pre></code><tr class=miss><td>267<td><code><pre> inParam := reflect.ValueOf(object).Convert(inType)</pre></code><tr class=miss><td>268<td><code><pre> uuid = opt.objectUUIDGenFunc.Call([]reflect.Value{inParam})[0].Interface().(string)</pre></code><tr><td>269<td><code><pre> }</pre></code><tr><td>270<td><code><pre> msg = mw.NewMessage(uuid, payload)</pre></code><tr><td>271<td><code><pre> msg.Metadata = fusCtx.WatermillMetadata(ctx)</pre></code><tr><td>272<td><code><pre> msg.SetContext(ctx)</pre></code><tr><td>273<td><code><pre> return</pre></code><tr><td>274<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.run>func router.run</div><div class=info><a href=#s_fn_router.run>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>201<td><code><pre>func (r *router) run() (err error) {</pre></code><tr><td>202<td><code><pre> if r.Router.IsRunning() {</pre></code><tr><td>203<td><code><pre> return r.Router.RunHandlers(r.ctx)</pre></code><tr><td>204<td><code><pre> }</pre></code><tr><td>205<td><code><pre> if err = r.Router.Run(r.ctx); err != nil {</pre></code><tr class=miss><td>206<td><code><pre> if errors.Is(err, mw.ErrRouterIsAlreadyRunning) {</pre></code><tr class=miss><td>207<td><code><pre> return r.Router.RunHandlers(r.ctx)</pre></code><tr><td>208<td><code><pre> }</pre></code><tr><td>209<td><code><pre> }</pre></code><tr><td>210<td><code><pre> return</pre></code><tr><td>211<td><code><pre>}</pre></code></table><div class=funcname id=fn_event[T].Ack>func event[T].Ack</div><div class=info><a href=#s_fn_event[T].Ack>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>230<td><code><pre>func (e *event[T]) Ack() bool {</pre></code><tr><td>231<td><code><pre> if e.ackfn != nil {</pre></code><tr><td>232<td><code><pre> return e.ackfn()</pre></code><tr><td>233<td><code><pre> }</pre></code><tr class=miss><td>234<td><code><pre> return true</pre></code><tr><td>235<td><code><pre>}</pre></code></table><div class=funcname id=fn_parseKafkaConf>func parseKafkaConf</div><div class=info><a href=#s_fn_parseKafkaConf>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/kafka.go</code>:</div><table class=listing><tr><td>99<td><code><pre>func parseKafkaConf(appName string, conf *Conf) (saramaCfg *sarama.Config) {</pre></code><tr><td>100<td><code><pre> saramaCfg = sarama.NewConfig()</pre></code><tr><td>101<td><code><pre> saramaCfg.Producer.Return.Errors = true</pre></code><tr><td>102<td><code><pre> saramaCfg.Producer.Return.Successes = true</pre></code><tr><td>103<td><code><pre> saramaCfg.Producer.RequiredAcks = sarama.WaitForLocal</pre></code><tr><td>104<td><code><pre> saramaCfg.Producer.Retry.Max = 10</pre></code><tr><td>105<td><code><pre> saramaCfg.Consumer.Fetch.Default = 16 * 1024 * 1024 // 16mb, default is 1mb</pre></code><tr><td>106<td><code><pre> saramaCfg.Consumer.Offsets.Initial = sarama.OffsetNewest</pre></code><tr><td>107<td><code><pre> saramaCfg.Consumer.Offsets.AutoCommit.Enable = true</pre></code><tr><td>108<td><code><pre> saramaCfg.Consumer.Offsets.AutoCommit.Interval = time.Second // only work when auto commit disabled</pre></code><tr><td>109<td><code><pre> saramaCfg.Consumer.Return.Errors = true</pre></code><tr><td>110<td><code><pre> saramaCfg.Metadata.Retry.Backoff = time.Second * 2</pre></code><tr><td>111<td><code><pre> saramaCfg.ClientID = config.Use(appName).AppName()</pre></code><tr><td>112<td><code><pre> if utils.IsStrNotBlank(conf.Endpoint.Version) {</pre></code><tr><td>113<td><code><pre> saramaCfg.Version = utils.Must(sarama.ParseKafkaVersion(conf.Endpoint.Version))</pre></code><tr><td>114<td><code><pre> }</pre></code><tr><td>115<td><code><pre> if utils.IsStrNotBlank(conf.Endpoint.User) {</pre></code><tr class=miss><td>116<td><code><pre> saramaCfg.Net.SASL.Enable = true</pre></code><tr class=miss><td>117<td><code><pre> saramaCfg.Net.SASL.User = conf.Endpoint.User</pre></code><tr class=miss><td>118<td><code><pre> saramaCfg.Net.SASL.Password = conf.Endpoint.Password</pre></code><tr class=miss><td>119<td><code><pre> saramaCfg.Net.SASL.Mechanism = sarama.SASLTypePlaintext</pre></code><tr class=miss><td>120<td><code><pre> switch {</pre></code><tr><td>121<td><code><pre> case strings.EqualFold(conf.Endpoint.AuthType, sarama.SASLTypeSCRAMSHA256):</pre></code><tr class=miss><td>122<td><code><pre> saramaCfg.Net.SASL.Mechanism = sarama.SASLTypeSCRAMSHA256</pre></code><tr><td>123<td><code><pre> case strings.EqualFold(conf.Endpoint.AuthType, sarama.SASLTypeSCRAMSHA512):</pre></code><tr class=miss><td>124<td><code><pre> saramaCfg.Net.SASL.Mechanism = sarama.SASLTypeSCRAMSHA512</pre></code><tr><td>125<td><code><pre> case strings.EqualFold(conf.Endpoint.AuthType, sarama.SASLTypeOAuth):</pre></code><tr class=miss><td>126<td><code><pre> saramaCfg.Net.SASL.Mechanism = sarama.SASLTypeOAuth</pre></code><tr class=miss><td>127<td><code><pre> saramaCfg.Net.SASL.TokenProvider = &kafkaOAuthProvider{token: saramaCfg.Net.SASL.Password}</pre></code><tr><td>128<td><code><pre> }</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre> return</pre></code><tr><td>131<td><code><pre>}</pre></code></table><div class=funcname id=fn_messageConvertFrom>func messageConvertFrom</div><div class=info><a href=#s_fn_messageConvertFrom>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>285<td><code><pre>func messageConvertFrom(src *mw.Message,</pre></code><tr><td>286<td><code><pre> serializeType serialize.Algorithm, compressType compress.Algorithm) (dst Message, err error) {</pre></code><tr><td>287<td><code><pre> _, data, isRaw, err := pd.UnsealRaw(src.Payload, pd.Compress(compressType))</pre></code><tr><td>288<td><code><pre> if err != nil {</pre></code><tr class=miss><td>289<td><code><pre> return</pre></code><tr><td>290<td><code><pre> }</pre></code><tr><td>291<td><code><pre> src.SetContext(fusCtx.New(fusCtx.Watermill(src.Metadata)))</pre></code><tr><td>292<td><code><pre> msg := &message{Message: src, payload: data}</pre></code><tr><td>293<td><code><pre> if !isRaw {</pre></code><tr class=miss><td>294<td><code><pre> _, msg.obj, _, err = pd.Unseal(src.Payload,</pre></code><tr><td>295<td><code><pre> pd.Serialize(serializeType), pd.Compress(compressType))</pre></code><tr class=miss><td>296<td><code><pre> if err != nil {</pre></code><tr class=miss><td>297<td><code><pre> return</pre></code><tr><td>298<td><code><pre> }</pre></code><tr><td>299<td><code><pre> }</pre></code><tr><td>300<td><code><pre> dst = msg</pre></code><tr><td>301<td><code><pre> return</pre></code><tr><td>302<td><code><pre>}</pre></code></table><div class=funcname id=fn_newPulsarSubscriber>func newPulsarSubscriber</div><div class=info><a href=#s_fn_newPulsarSubscriber>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/pulsar.go</code>:</div><table class=listing><tr><td>72<td><code><pre>func newPulsarSubscriber(ctx context.Context, appName, name string,</pre></code><tr><td>73<td><code><pre> conf *Conf, logger watermill.LoggerAdapter) Subscriber {</pre></code><tr><td>74<td><code><pre> cfg := &pulsar.SubscriberConfig{</pre></code><tr><td>75<td><code><pre> URL: fmt.Sprintf("pulsar://%s", strings.TrimPrefix(conf.Endpoint.Addresses[0], "pulsar://")),</pre></code><tr><td>76<td><code><pre> QueueGroup: conf.ConsumerGroup,</pre></code><tr><td>77<td><code><pre> Persistent: conf.Persistent,</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre> hasUser := utils.IsStrNotBlank(conf.Endpoint.User)</pre></code><tr><td>80<td><code><pre> hasPassword := utils.IsStrNotBlank(conf.Endpoint.Password)</pre></code><tr><td>81<td><code><pre> hasAuthType := utils.IsStrNotBlank(conf.Endpoint.AuthType)</pre></code><tr><td>82<td><code><pre> if hasUser && hasPassword {</pre></code><tr class=miss><td>83<td><code><pre> cfg.Authentication = utils.Must(plsDrv.NewAuthenticationBasic(conf.Endpoint.User, conf.Endpoint.Password))</pre></code><tr><td>84<td><code><pre> }</pre></code><tr><td>85<td><code><pre> if hasAuthType {</pre></code><tr class=miss><td>86<td><code><pre> params := conf.Endpoint.Password</pre></code><tr class=miss><td>87<td><code><pre> switch conf.Endpoint.AuthType {</pre></code><tr><td>88<td><code><pre> case "basic", "org.apache.pulsar.client.impl.auth.AuthenticationBasic":</pre></code><tr class=miss><td>89<td><code><pre> params = utils.MustJsonMarshalString(map[string]string{</pre></code><tr><td>90<td><code><pre> "username": conf.Endpoint.User,</pre></code><tr><td>91<td><code><pre> "password": conf.Endpoint.Password,</pre></code><tr><td>92<td><code><pre> })</pre></code><tr><td>93<td><code><pre> }</pre></code><tr class=miss><td>94<td><code><pre> cfg.Authentication = utils.Must(plsDrv.NewAuthentication(conf.Endpoint.AuthType, params))</pre></code><tr><td>95<td><code><pre> }</pre></code><tr><td>96<td><code><pre></pre></code><tr><td>97<td><code><pre> sub, err := pulsar.NewSubscriber(cfg, logger)</pre></code><tr><td>98<td><code><pre> if err != nil {</pre></code><tr class=miss><td>99<td><code><pre> panic(errors.Wrapf(err, "initialize mq component pulsar subscriber failed: %s", err))</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre></pre></code><tr><td>102<td><code><pre> return &pulsarSubscriber{</pre></code><tr><td>103<td><code><pre> abstractMQ: newSub(ctx, sub, appName, name, conf, logger),</pre></code><tr><td>104<td><code><pre> subscriber: sub,</pre></code><tr><td>105<td><code><pre> }</pre></code><tr><td>106<td><code><pre>}</pre></code></table><div class=funcname id=fn_parseAMQPEndpoint>func parseAMQPEndpoint</div><div class=info><a href=#s_fn_parseAMQPEndpoint>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/amqp.go</code>:</div><table class=listing><tr><td>110<td><code><pre>func parseAMQPEndpoint(conf *Conf) (result string) {</pre></code><tr><td>111<td><code><pre> hasUser := utils.IsStrNotBlank(conf.Endpoint.User)</pre></code><tr><td>112<td><code><pre> hasPassword := utils.IsStrNotBlank(conf.Endpoint.Password)</pre></code><tr><td>113<td><code><pre> if hasUser && hasPassword {</pre></code><tr><td>114<td><code><pre> addr := strings.TrimPrefix(conf.Endpoint.Addresses[0], "amqp://")</pre></code><tr><td>115<td><code><pre> result = fmt.Sprintf("amqp://%s:%s@%s", conf.Endpoint.User, conf.Endpoint.Password, addr)</pre></code><tr class=miss><td>116<td><code><pre> } else if hasUser {</pre></code><tr class=miss><td>117<td><code><pre> addr := strings.TrimPrefix(conf.Endpoint.Addresses[0], "amqp://")</pre></code><tr class=miss><td>118<td><code><pre> result = fmt.Sprintf("amqp://%s@%s", conf.Endpoint.User, addr)</pre></code><tr><td>119<td><code><pre> } else {</pre></code><tr class=miss><td>120<td><code><pre> addr := strings.TrimPrefix(conf.Endpoint.Addresses[0], "amqp://")</pre></code><tr class=miss><td>121<td><code><pre> result = fmt.Sprintf("amqp://%s", addr)</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre></pre></code><tr><td>124<td><code><pre> return</pre></code><tr><td>125<td><code><pre>}</pre></code></table><div class=funcname id=fn_@146:13>func @146:13</div><div class=info><a href=#s_fn_@146:13>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>146<td><code><pre>func() {</pre></code><tr><td>147<td><code><pre> defer close(msgCh)</pre></code><tr><td>148<td><code><pre> for {</pre></code><tr><td>149<td><code><pre> select {</pre></code><tr><td>150<td><code><pre> case wmsg, ok := <-ch:</pre></code><tr><td>151<td><code><pre> if !ok {</pre></code><tr class=miss><td>152<td><code><pre> return</pre></code><tr><td>153<td><code><pre> }</pre></code><tr><td>154<td><code><pre> msg := rawMessageConvertFrom(wmsg)</pre></code><tr><td>155<td><code><pre> select {</pre></code><tr><td>156<td><code><pre> case msgCh <- msg:</pre></code><tr><td>157<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>158<td><code><pre> msg.Nack()</pre></code><tr class=miss><td>159<td><code><pre> a.logger.Info(fmt.Sprintf(</pre></code><tr><td>160<td><code><pre> "raw subscriber %s exited with a message nacked when business ctx done", a.name),</pre></code><tr><td>161<td><code><pre> watermill.LogFields{watermill.ContextLogFieldKey: ctx})</pre></code><tr class=miss><td>162<td><code><pre> return</pre></code><tr><td>163<td><code><pre> case <-a.ctx.Done():</pre></code><tr class=miss><td>164<td><code><pre> msg.Nack()</pre></code><tr class=miss><td>165<td><code><pre> a.logger.Info(fmt.Sprintf(</pre></code><tr><td>166<td><code><pre> "raw subscriber %s exited with a message nacked when app ctx done", a.name),</pre></code><tr><td>167<td><code><pre> watermill.LogFields{watermill.ContextLogFieldKey: ctx})</pre></code><tr class=miss><td>168<td><code><pre> return</pre></code><tr><td>169<td><code><pre> }</pre></code><tr><td>170<td><code><pre> case <-ctx.Done():</pre></code><tr><td>171<td><code><pre> return</pre></code><tr><td>172<td><code><pre> case <-a.ctx.Done():</pre></code><tr class=miss><td>173<td><code><pre> return</pre></code><tr><td>174<td><code><pre> }</pre></code><tr><td>175<td><code><pre> }</pre></code><tr><td>176<td><code><pre> }</pre></code></table><div class=funcname id=fn_router.addHandler>func router.addHandler</div><div class=info><a href=#s_fn_router.addHandler>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>213<td><code><pre>func (r *router) addHandler(handlerName, consumerName string, hdr any, opt *routerOption) {</pre></code><tr><td>214<td><code><pre> switch fn := hdr.(type) {</pre></code><tr><td>215<td><code><pre> case HandlerFunc:</pre></code><tr class=miss><td>216<td><code><pre> r.Router.AddNoPublisherHandler(</pre></code><tr><td>217<td><code><pre> consumerName,</pre></code><tr><td>218<td><code><pre> r.sub.topic(),</pre></code><tr><td>219<td><code><pre> r.sub.watermillSubscriber(),</pre></code><tr><td>220<td><code><pre> func(wmsg *mw.Message) (err error) {</pre></code><tr><td>221<td><code><pre> msg, err := messageConvertFrom(wmsg, r.serializeType, r.compressType)</pre></code><tr><td>222<td><code><pre> if err != nil {</pre></code><tr><td>223<td><code><pre> return</pre></code><tr><td>224<td><code><pre> }</pre></code><tr><td>225<td><code><pre> return fn(msg)</pre></code><tr><td>226<td><code><pre> },</pre></code><tr><td>227<td><code><pre> )</pre></code><tr><td>228<td><code><pre> case mw.NoPublishHandlerFunc:</pre></code><tr class=miss><td>229<td><code><pre> r.Router.AddNoPublisherHandler(</pre></code><tr><td>230<td><code><pre> consumerName,</pre></code><tr><td>231<td><code><pre> r.sub.topic(),</pre></code><tr><td>232<td><code><pre> r.sub.watermillSubscriber(),</pre></code><tr><td>233<td><code><pre> fn,</pre></code><tr><td>234<td><code><pre> )</pre></code><tr><td>235<td><code><pre> case mw.HandlerFunc:</pre></code><tr class=miss><td>236<td><code><pre> r.Router.AddHandler(</pre></code><tr><td>237<td><code><pre> consumerName,</pre></code><tr><td>238<td><code><pre> r.sub.topic(),</pre></code><tr><td>239<td><code><pre> r.sub.watermillSubscriber(),</pre></code><tr><td>240<td><code><pre> r.pub.topic(),</pre></code><tr><td>241<td><code><pre> r.pub.watermillPublisher(),</pre></code><tr><td>242<td><code><pre> fn,</pre></code><tr><td>243<td><code><pre> )</pre></code><tr><td>244<td><code><pre> default:</pre></code><tr><td>245<td><code><pre> fnVal := reflect.ValueOf(hdr)</pre></code><tr><td>246<td><code><pre> switch {</pre></code><tr><td>247<td><code><pre> case fnVal.CanConvert(watermillHandlerFuncType):</pre></code><tr class=miss><td>248<td><code><pre> r.Router.AddNoPublisherHandler(</pre></code><tr><td>249<td><code><pre> consumerName,</pre></code><tr><td>250<td><code><pre> r.sub.topic(),</pre></code><tr><td>251<td><code><pre> r.sub.watermillSubscriber(),</pre></code><tr><td>252<td><code><pre> func(msg *mw.Message) error {</pre></code><tr><td>253<td><code><pre> rets := fnVal.Convert(watermillHandlerFuncType).Call(</pre></code><tr><td>254<td><code><pre> []reflect.Value{reflect.ValueOf(rawMessageConvertFrom(msg))},</pre></code><tr><td>255<td><code><pre> )</pre></code><tr><td>256<td><code><pre> return utils.ParseVariadicFuncResult[error](rets, 0)</pre></code><tr><td>257<td><code><pre> },</pre></code><tr><td>258<td><code><pre> )</pre></code><tr><td>259<td><code><pre> case fnVal.CanConvert(watermillNoPublishHandlerFuncType):</pre></code><tr class=miss><td>260<td><code><pre> r.Router.AddNoPublisherHandler(</pre></code><tr><td>261<td><code><pre> consumerName,</pre></code><tr><td>262<td><code><pre> r.sub.topic(),</pre></code><tr><td>263<td><code><pre> r.sub.watermillSubscriber(),</pre></code><tr><td>264<td><code><pre> func(msg *mw.Message) error {</pre></code><tr><td>265<td><code><pre> rets := fnVal.</pre></code><tr><td>266<td><code><pre> Convert(watermillNoPublishHandlerFuncType).</pre></code><tr><td>267<td><code><pre> Call([]reflect.Value{reflect.ValueOf(msg)})</pre></code><tr><td>268<td><code><pre> return utils.ParseVariadicFuncResult[error](rets, 0)</pre></code><tr><td>269<td><code><pre> },</pre></code><tr><td>270<td><code><pre> )</pre></code><tr><td>271<td><code><pre> case fnVal.CanConvert(handlerFuncType):</pre></code><tr><td>272<td><code><pre> r.Router.AddHandler(</pre></code><tr><td>273<td><code><pre> consumerName,</pre></code><tr><td>274<td><code><pre> r.sub.topic(),</pre></code><tr><td>275<td><code><pre> r.sub.watermillSubscriber(),</pre></code><tr><td>276<td><code><pre> r.pub.topic(),</pre></code><tr><td>277<td><code><pre> r.pub.watermillPublisher(),</pre></code><tr><td>278<td><code><pre> func(wmsg *mw.Message) (msgs []*mw.Message, err error) {</pre></code><tr><td>279<td><code><pre> msg, err := messageConvertFrom(wmsg, r.serializeType, r.compressType)</pre></code><tr><td>280<td><code><pre> if err != nil {</pre></code><tr><td>281<td><code><pre> return</pre></code><tr><td>282<td><code><pre> }</pre></code><tr><td>283<td><code><pre> rets := fnVal.Convert(handlerFuncType).Call([]reflect.Value{reflect.ValueOf(msg)})</pre></code><tr><td>284<td><code><pre> msgs = utils.ParseVariadicFuncResult[[]*mw.Message](rets, 0)</pre></code><tr><td>285<td><code><pre> err = utils.ParseVariadicFuncResult[error](rets, 0)</pre></code><tr><td>286<td><code><pre> return</pre></code><tr><td>287<td><code><pre> },</pre></code><tr><td>288<td><code><pre> )</pre></code><tr><td>289<td><code><pre> case isEventHandler(fnVal):</pre></code><tr><td>290<td><code><pre> r.handleEvent(handlerName, fnVal, opt)</pre></code><tr><td>291<td><code><pre> default:</pre></code><tr class=miss><td>292<td><code><pre> r.Router.AddNoPublisherHandler(</pre></code><tr><td>293<td><code><pre> consumerName,</pre></code><tr><td>294<td><code><pre> r.sub.topic(),</pre></code><tr><td>295<td><code><pre> r.sub.watermillSubscriber(),</pre></code><tr><td>296<td><code><pre> r.handle(hdr),</pre></code><tr><td>297<td><code><pre> )</pre></code><tr><td>298<td><code><pre> }</pre></code><tr><td>299<td><code><pre> }</pre></code><tr><td>300<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstractMQ.Publish>func abstractMQ.Publish</div><div class=info><a href=#s_fn_abstractMQ.Publish>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func (a *abstractMQ) Publish(ctx context.Context, opts ...utils.OptionExtender) (err error) {</pre></code><tr><td>53<td><code><pre> opt := utils.ApplyOptions[pubOption](opts...)</pre></code><tr><td>54<td><code><pre> msgs := opt.watermillMessages</pre></code><tr><td>55<td><code><pre> for _, msg := range opt.messages {</pre></code><tr class=miss><td>56<td><code><pre> msg, err := a.newMessage(ctx, msg, opt)</pre></code><tr class=miss><td>57<td><code><pre> if err != nil {</pre></code><tr class=miss><td>58<td><code><pre> return err</pre></code><tr><td>59<td><code><pre> }</pre></code><tr class=miss><td>60<td><code><pre> msgs = append(msgs, msg)</pre></code><tr><td>61<td><code><pre> }</pre></code><tr><td>62<td><code><pre> for _, object := range opt.objects {</pre></code><tr class=miss><td>63<td><code><pre> msg, err := a.newObjectMessage(ctx, object, opt)</pre></code><tr class=miss><td>64<td><code><pre> if err != nil {</pre></code><tr class=miss><td>65<td><code><pre> return err</pre></code><tr><td>66<td><code><pre> }</pre></code><tr class=miss><td>67<td><code><pre> msgs = append(msgs, msg)</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre> if len(msgs) == 0 {</pre></code><tr class=miss><td>70<td><code><pre> logInfo(ctx, a.logger, a.appName, a.name, "none messages to publish")</pre></code><tr class=miss><td>71<td><code><pre> return</pre></code><tr><td>72<td><code><pre> }</pre></code><tr><td>73<td><code><pre></pre></code><tr><td>74<td><code><pre> if !opt.async {</pre></code><tr><td>75<td><code><pre> return a.pub.Publish(ctx, a.conf.Topic, msgs...)</pre></code><tr><td>76<td><code><pre> }</pre></code><tr><td>77<td><code><pre></pre></code><tr class=miss><td>78<td><code><pre> routine.Goc(ctx, func() {</pre></code><tr><td>79<td><code><pre> idList := utils.SliceMapping(msgs, func(s *mw.Message) (id string) { return s.UUID })</pre></code><tr><td>80<td><code><pre> idList = utils.NewSet(idList...).Items()</pre></code><tr><td>81<td><code><pre> retryFunc := func(attempt uint) error {</pre></code><tr><td>82<td><code><pre> if attempt > 1 {</pre></code><tr><td>83<td><code><pre> logInfo(ctx, a.logger, a.appName, a.name,</pre></code><tr><td>84<td><code><pre> "retry to publish topic message [topic[%s] message%v[%v] attempt[%v]]",</pre></code><tr><td>85<td><code><pre> a.conf.Topic, idList, len(msgs), attempt-1)</pre></code><tr><td>86<td><code><pre> }</pre></code><tr><td>87<td><code><pre> return a.pub.Publish(ctx, a.conf.Topic, msgs...)</pre></code><tr><td>88<td><code><pre> }</pre></code><tr><td>89<td><code><pre></pre></code><tr><td>90<td><code><pre> if err = retry.Retry(retryFunc, opt.asyncStrategies...); err != nil {</pre></code><tr><td>91<td><code><pre> logError(ctx, a.logger, a.appName, a.name,</pre></code><tr><td>92<td><code><pre> "retry to publish topic message failed [err[%s] topic[%s] message%v[%v]]",</pre></code><tr><td>93<td><code><pre> err, a.conf.Topic, idList, len(msgs))</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre> }, routine.AppName(a.appName))</pre></code><tr class=miss><td>96<td><code><pre> return</pre></code><tr><td>97<td><code><pre>}</pre></code></table><div class=funcname id=fn_@129:26>func @129:26</div><div class=info><a href=#s_fn_@129:26>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>129<td><code><pre>func(ctx context.Context, event Event[T]) (msgs []Message, err error) {</pre></code><tr><td>130<td><code><pre> select {</pre></code><tr><td>131<td><code><pre> case out <- event:</pre></code><tr><td>132<td><code><pre> case <-r.Router.ClosingInProgressCh:</pre></code><tr class=miss><td>133<td><code><pre> event.Nack()</pre></code><tr class=miss><td>134<td><code><pre> e.logger.Info(fmt.Sprintf("event subscriber %s exited", e.name), nil)</pre></code><tr class=miss><td>135<td><code><pre> return</pre></code><tr><td>136<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>137<td><code><pre> event.Nack()</pre></code><tr class=miss><td>138<td><code><pre> e.logger.Info(fmt.Sprintf(</pre></code><tr><td>139<td><code><pre> "event subscriber %s exited with a message nacked when business ctx done", e.name),</pre></code><tr><td>140<td><code><pre> watermill.LogFields{watermill.ContextLogFieldKey: ctx})</pre></code><tr class=miss><td>141<td><code><pre> return</pre></code><tr><td>142<td><code><pre> case <-e.ctx.Done():</pre></code><tr class=miss><td>143<td><code><pre> event.Nack()</pre></code><tr class=miss><td>144<td><code><pre> e.logger.Info(fmt.Sprintf(</pre></code><tr><td>145<td><code><pre> "event subscriber %s exited with a message nacked when app ctx done", e.name),</pre></code><tr><td>146<td><code><pre> watermill.LogFields{watermill.ContextLogFieldKey: ctx})</pre></code><tr class=miss><td>147<td><code><pre> return</pre></code><tr><td>148<td><code><pre> }</pre></code><tr><td>149<td><code><pre></pre></code><tr><td>150<td><code><pre> msgs = append(msgs,</pre></code><tr><td>151<td><code><pre> &message{Message: &mw.Message{Metadata: mw.Metadata{watermill.MessageRouterAck: ""}}})</pre></code><tr><td>152<td><code><pre> return</pre></code><tr><td>153<td><code><pre> }</pre></code></table><div class=funcname id=fn_@188:13>func @188:13</div><div class=info><a href=#s_fn_@188:13>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>188<td><code><pre>func() {</pre></code><tr class=miss><td>189<td><code><pre> defer close(msgCh)</pre></code><tr class=miss><td>190<td><code><pre> for {</pre></code><tr class=miss><td>191<td><code><pre> select {</pre></code><tr><td>192<td><code><pre> case wmsg, ok := <-ch:</pre></code><tr class=miss><td>193<td><code><pre> if !ok {</pre></code><tr class=miss><td>194<td><code><pre> return</pre></code><tr><td>195<td><code><pre> }</pre></code><tr class=miss><td>196<td><code><pre> _, data, isRaw, err := pd.UnsealRaw(wmsg.Payload, pd.Compress(a.compressType))</pre></code><tr class=miss><td>197<td><code><pre> if err != nil {</pre></code><tr class=miss><td>198<td><code><pre> a.logger.Error("unseal message failed", err, watermill.LogFields{</pre></code><tr><td>199<td><code><pre> watermill.ContextLogFieldKey: ctx,</pre></code><tr><td>200<td><code><pre> })</pre></code><tr class=miss><td>201<td><code><pre> continue</pre></code><tr><td>202<td><code><pre> }</pre></code><tr class=miss><td>203<td><code><pre> wmsg.SetContext(fusCtx.New(fusCtx.Watermill(wmsg.Metadata)))</pre></code><tr class=miss><td>204<td><code><pre> msg := &message{Message: wmsg, payload: data}</pre></code><tr class=miss><td>205<td><code><pre> if !isRaw {</pre></code><tr class=miss><td>206<td><code><pre> _, msg.obj, _, err = pd.Unseal(wmsg.Payload,</pre></code><tr><td>207<td><code><pre> pd.Serialize(a.serializeType), pd.Compress(a.compressType))</pre></code><tr class=miss><td>208<td><code><pre> if err != nil {</pre></code><tr class=miss><td>209<td><code><pre> a.logger.Error("unseal message object failed", err, watermill.LogFields{</pre></code><tr><td>210<td><code><pre> watermill.ContextLogFieldKey: ctx,</pre></code><tr><td>211<td><code><pre> })</pre></code><tr class=miss><td>212<td><code><pre> continue</pre></code><tr><td>213<td><code><pre> }</pre></code><tr><td>214<td><code><pre> }</pre></code><tr class=miss><td>215<td><code><pre> select {</pre></code><tr><td>216<td><code><pre> case msgCh <- msg:</pre></code><tr><td>217<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>218<td><code><pre> msg.Nack()</pre></code><tr class=miss><td>219<td><code><pre> a.logger.Info(fmt.Sprintf(</pre></code><tr><td>220<td><code><pre> "subscriber %s exited with a message nacked when business ctx done", a.name),</pre></code><tr><td>221<td><code><pre> watermill.LogFields{watermill.ContextLogFieldKey: ctx})</pre></code><tr class=miss><td>222<td><code><pre> return</pre></code><tr><td>223<td><code><pre> case <-a.ctx.Done():</pre></code><tr class=miss><td>224<td><code><pre> msg.Nack()</pre></code><tr class=miss><td>225<td><code><pre> a.logger.Info(fmt.Sprintf(</pre></code><tr><td>226<td><code><pre> "subscriber %s exited with a message nacked when app ctx done", a.name),</pre></code><tr><td>227<td><code><pre> watermill.LogFields{watermill.ContextLogFieldKey: ctx})</pre></code><tr class=miss><td>228<td><code><pre> return</pre></code><tr><td>229<td><code><pre> }</pre></code><tr><td>230<td><code><pre></pre></code><tr><td>231<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>232<td><code><pre> return</pre></code><tr><td>233<td><code><pre> case <-a.ctx.Done():</pre></code><tr class=miss><td>234<td><code><pre> return</pre></code><tr><td>235<td><code><pre> }</pre></code><tr><td>236<td><code><pre> }</pre></code><tr><td>237<td><code><pre> }</pre></code></table><div class=funcname id=fn_setParams>func setParams</div><div class=info><a href=#s_fn_setParams>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/utils.go</code>:</div><table class=listing><tr><td>29<td><code><pre>func setParams(typ reflect.Type, embed bool, params ...any) (arg any) {</pre></code><tr class=miss><td>30<td><code><pre> if typ == nil {</pre></code><tr class=miss><td>31<td><code><pre> return</pre></code><tr><td>32<td><code><pre> }</pre></code><tr><td>33<td><code><pre></pre></code><tr class=miss><td>34<td><code><pre> argValPtr := reflect.New(typ)</pre></code><tr class=miss><td>35<td><code><pre> argVal := argValPtr.Elem()</pre></code><tr class=miss><td>36<td><code><pre> if !embed {</pre></code><tr class=miss><td>37<td><code><pre> if len(params) > 0 {</pre></code><tr class=miss><td>38<td><code><pre> argVal.Set(reflect.ValueOf(params[0]))</pre></code><tr><td>39<td><code><pre> }</pre></code><tr class=miss><td>40<td><code><pre> return argValPtr.Interface()</pre></code><tr><td>41<td><code><pre> }</pre></code><tr><td>42<td><code><pre></pre></code><tr class=miss><td>43<td><code><pre> for i := 0; i < len(params); i++ {</pre></code><tr class=miss><td>44<td><code><pre> ft := argVal.Field(i)</pre></code><tr class=miss><td>45<td><code><pre> ft.Set(reflect.ValueOf(params[i]).Convert(ft.Type()))</pre></code><tr><td>46<td><code><pre> }</pre></code><tr class=miss><td>47<td><code><pre> return argValPtr.Interface()</pre></code><tr><td>48<td><code><pre>}</pre></code></table><div class=funcname id=fn_formatFields>func formatFields</div><div class=info><a href=#s_fn_formatFields>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/log.go</code>:</div><table class=listing><tr><td>28<td><code><pre>func formatFields(ctx context.Context) (fs watermill.LogFields) {</pre></code><tr class=miss><td>29<td><code><pre> fs = make(watermill.LogFields, 4)</pre></code><tr class=miss><td>30<td><code><pre> if userID := fusCtx.GetUserID(ctx); utils.IsStrNotBlank(userID) {</pre></code><tr class=miss><td>31<td><code><pre> fs["user_id"] = userID</pre></code><tr><td>32<td><code><pre> }</pre></code><tr class=miss><td>33<td><code><pre> if traceID := fusCtx.GetTraceID(ctx); utils.IsStrNotBlank(traceID) {</pre></code><tr class=miss><td>34<td><code><pre> fs["trace_id"] = traceID</pre></code><tr><td>35<td><code><pre> }</pre></code><tr class=miss><td>36<td><code><pre> if taskID := fusCtx.GetCronTaskID(ctx); utils.IsStrNotBlank(taskID) {</pre></code><tr class=miss><td>37<td><code><pre> fs["cron_task_id"] = taskID</pre></code><tr><td>38<td><code><pre> }</pre></code><tr class=miss><td>39<td><code><pre> if taskName := fusCtx.GetCronTaskName(ctx); utils.IsStrNotBlank(taskName) {</pre></code><tr class=miss><td>40<td><code><pre> fs["cron_task_name"] = taskName</pre></code><tr><td>41<td><code><pre> }</pre></code><tr class=miss><td>42<td><code><pre> return</pre></code><tr><td>43<td><code><pre>}</pre></code></table><div class=funcname id=fn_sub>func sub</div><div class=info><a href=#s_fn_sub>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/construct.go</code>:</div><table class=listing><tr><td>184<td><code><pre>func sub(name string, opts ...utils.OptionExtender) Subscriber {</pre></code><tr class=miss><td>185<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>186<td><code><pre></pre></code><tr class=miss><td>187<td><code><pre> locker.RLock()</pre></code><tr class=miss><td>188<td><code><pre> defer locker.RUnlock()</pre></code><tr class=miss><td>189<td><code><pre> subscribers, ok := subscribers[opt.appName]</pre></code><tr class=miss><td>190<td><code><pre> if !ok {</pre></code><tr class=miss><td>191<td><code><pre> panic(errors.Errorf("mq subscriber instance not found for app: %s", opt.appName))</pre></code><tr><td>192<td><code><pre> }</pre></code><tr class=miss><td>193<td><code><pre> subscriber, ok := subscribers[name]</pre></code><tr class=miss><td>194<td><code><pre> if !ok {</pre></code><tr class=miss><td>195<td><code><pre> panic(errors.Errorf("mq subscriber instance not found for name: %s", name))</pre></code><tr><td>196<td><code><pre> }</pre></code><tr class=miss><td>197<td><code><pre> return subscriber</pre></code><tr><td>198<td><code><pre>}</pre></code></table><div class=funcname id=fn_router.Serve>func router.Serve</div><div class=info><a href=#s_fn_router.Serve>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>173<td><code><pre>func (r *router) Serve() (err error) {</pre></code><tr class=miss><td>174<td><code><pre> if r.isHandlerConflict() {</pre></code><tr class=miss><td>175<td><code><pre> panic(ErrEventHandlerConflict)</pre></code><tr><td>176<td><code><pre> }</pre></code><tr class=miss><td>177<td><code><pre> if len(r.eventHandlers) > 0 {</pre></code><tr class=miss><td>178<td><code><pre> r.runEventHandlers()</pre></code><tr><td>179<td><code><pre> }</pre></code><tr class=miss><td>180<td><code><pre> if err = r.run(); err != nil {</pre></code><tr class=miss><td>181<td><code><pre> return</pre></code><tr><td>182<td><code><pre> }</pre></code><tr class=miss><td>183<td><code><pre> <-r.Router.ClosedCh</pre></code><tr class=miss><td>184<td><code><pre> return</pre></code><tr><td>185<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstractMQ.newMessage>func abstractMQ.newMessage</div><div class=info><a href=#s_fn_abstractMQ.newMessage>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>247<td><code><pre>func (a *abstractMQ) newMessage(ctx context.Context, src Message, _ *pubOption) (</pre></code><tr><td>248<td><code><pre> msg *mw.Message, err error) {</pre></code><tr class=miss><td>249<td><code><pre> payload, err := pd.Seal(src.Payload(), pd.Compress(a.compressType))</pre></code><tr class=miss><td>250<td><code><pre> if err != nil {</pre></code><tr class=miss><td>251<td><code><pre> return</pre></code><tr><td>252<td><code><pre> }</pre></code><tr class=miss><td>253<td><code><pre> msg = mw.NewMessage(src.ID(), payload)</pre></code><tr class=miss><td>254<td><code><pre> msg.Metadata = fusCtx.WatermillMetadata(ctx)</pre></code><tr class=miss><td>255<td><code><pre> msg.SetContext(ctx)</pre></code><tr class=miss><td>256<td><code><pre> return</pre></code><tr><td>257<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstractMQ.Subscribe>func abstractMQ.Subscribe</div><div class=info><a href=#s_fn_abstractMQ.Subscribe>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>180<td><code><pre>func (a *abstractMQ) Subscribe(ctx context.Context, opts ...utils.OptionExtender) (dst <-chan Message, err error) {</pre></code><tr class=miss><td>181<td><code><pre> opt := utils.ApplyOptions[subOption](opts...)</pre></code><tr class=miss><td>182<td><code><pre> ch, err := a.sub.Subscribe(ctx, a.conf.Topic)</pre></code><tr class=miss><td>183<td><code><pre> if err != nil {</pre></code><tr class=miss><td>184<td><code><pre> return</pre></code><tr><td>185<td><code><pre> }</pre></code><tr><td>186<td><code><pre></pre></code><tr class=miss><td>187<td><code><pre> msgCh := make(chan Message, opt.channelLength)</pre></code><tr class=miss><td>188<td><code><pre> routine.Go(func() {</pre></code><tr><td>189<td><code><pre> defer close(msgCh)</pre></code><tr><td>190<td><code><pre> for {</pre></code><tr><td>191<td><code><pre> select {</pre></code><tr><td>192<td><code><pre> case wmsg, ok := <-ch:</pre></code><tr><td>193<td><code><pre> if !ok {</pre></code><tr><td>194<td><code><pre> return</pre></code><tr><td>195<td><code><pre> }</pre></code><tr><td>196<td><code><pre> _, data, isRaw, err := pd.UnsealRaw(wmsg.Payload, pd.Compress(a.compressType))</pre></code><tr><td>197<td><code><pre> if err != nil {</pre></code><tr><td>198<td><code><pre> a.logger.Error("unseal message failed", err, watermill.LogFields{</pre></code><tr><td>199<td><code><pre> watermill.ContextLogFieldKey: ctx,</pre></code><tr><td>200<td><code><pre> })</pre></code><tr><td>201<td><code><pre> continue</pre></code><tr><td>202<td><code><pre> }</pre></code><tr><td>203<td><code><pre> wmsg.SetContext(fusCtx.New(fusCtx.Watermill(wmsg.Metadata)))</pre></code><tr><td>204<td><code><pre> msg := &message{Message: wmsg, payload: data}</pre></code><tr><td>205<td><code><pre> if !isRaw {</pre></code><tr><td>206<td><code><pre> _, msg.obj, _, err = pd.Unseal(wmsg.Payload,</pre></code><tr><td>207<td><code><pre> pd.Serialize(a.serializeType), pd.Compress(a.compressType))</pre></code><tr><td>208<td><code><pre> if err != nil {</pre></code><tr><td>209<td><code><pre> a.logger.Error("unseal message object failed", err, watermill.LogFields{</pre></code><tr><td>210<td><code><pre> watermill.ContextLogFieldKey: ctx,</pre></code><tr><td>211<td><code><pre> })</pre></code><tr><td>212<td><code><pre> continue</pre></code><tr><td>213<td><code><pre> }</pre></code><tr><td>214<td><code><pre> }</pre></code><tr><td>215<td><code><pre> select {</pre></code><tr><td>216<td><code><pre> case msgCh <- msg:</pre></code><tr><td>217<td><code><pre> case <-ctx.Done():</pre></code><tr><td>218<td><code><pre> msg.Nack()</pre></code><tr><td>219<td><code><pre> a.logger.Info(fmt.Sprintf(</pre></code><tr><td>220<td><code><pre> "subscriber %s exited with a message nacked when business ctx done", a.name),</pre></code><tr><td>221<td><code><pre> watermill.LogFields{watermill.ContextLogFieldKey: ctx})</pre></code><tr><td>222<td><code><pre> return</pre></code><tr><td>223<td><code><pre> case <-a.ctx.Done():</pre></code><tr><td>224<td><code><pre> msg.Nack()</pre></code><tr><td>225<td><code><pre> a.logger.Info(fmt.Sprintf(</pre></code><tr><td>226<td><code><pre> "subscriber %s exited with a message nacked when app ctx done", a.name),</pre></code><tr><td>227<td><code><pre> watermill.LogFields{watermill.ContextLogFieldKey: ctx})</pre></code><tr><td>228<td><code><pre> return</pre></code><tr><td>229<td><code><pre> }</pre></code><tr><td>230<td><code><pre></pre></code><tr><td>231<td><code><pre> case <-ctx.Done():</pre></code><tr><td>232<td><code><pre> return</pre></code><tr><td>233<td><code><pre> case <-a.ctx.Done():</pre></code><tr><td>234<td><code><pre> return</pre></code><tr><td>235<td><code><pre> }</pre></code><tr><td>236<td><code><pre> }</pre></code><tr><td>237<td><code><pre> }, routine.AppName(a.appName))</pre></code><tr class=miss><td>238<td><code><pre> return msgCh, err</pre></code><tr><td>239<td><code><pre>}</pre></code></table><div class=funcname id=fn_wrapParams>func wrapParams</div><div class=info><a href=#s_fn_wrapParams>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/utils.go</code>:</div><table class=listing><tr><td>7<td><code><pre>func wrapParams(fn any) (argType reflect.Type) {</pre></code><tr class=miss><td>8<td><code><pre> typ := reflect.TypeOf(fn)</pre></code><tr><td>9<td><code><pre></pre></code><tr class=miss><td>10<td><code><pre> inLength := typ.NumIn()</pre></code><tr class=miss><td>11<td><code><pre> if inLength == 1 {</pre></code><tr class=miss><td>12<td><code><pre> return</pre></code><tr><td>13<td><code><pre> }</pre></code><tr class=miss><td>14<td><code><pre> if inLength >= 2 {</pre></code><tr class=miss><td>15<td><code><pre> return typ.In(1)</pre></code><tr><td>16<td><code><pre> }</pre></code><tr><td>17<td><code><pre></pre></code><tr class=miss><td>18<td><code><pre> return</pre></code><tr><td>19<td><code><pre>}</pre></code></table><div class=funcname id=fn_@340:9>func @340:9</div><div class=info><a href=#s_fn_@340:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>340<td><code><pre>func(msg *mw.Message) (err error) {</pre></code><tr class=miss><td>341<td><code><pre> _, data, _, err := pd.Unseal(msg.Payload,</pre></code><tr><td>342<td><code><pre> pd.Serialize(r.serializeType), pd.Compress(r.compressType), pd.Type(typ))</pre></code><tr class=miss><td>343<td><code><pre> if err != nil {</pre></code><tr class=miss><td>344<td><code><pre> return</pre></code><tr><td>345<td><code><pre> }</pre></code><tr class=miss><td>346<td><code><pre> params := unwrapParams(typ, data)</pre></code><tr class=miss><td>347<td><code><pre> ctx := fusCtx.New(fusCtx.Watermill(msg.Metadata))</pre></code><tr class=miss><td>348<td><code><pre> return fn(append([]any{ctx}, params...)...)</pre></code><tr><td>349<td><code><pre> }</pre></code></table><div class=funcname id=fn_@117:19>func @117:19</div><div class=info><a href=#s_fn_@117:19>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>117<td><code><pre>func() {</pre></code><tr class=miss><td>118<td><code><pre> idList := utils.SliceMapping(msgs, func(s *mw.Message) (id string) { return s.UUID })</pre></code><tr class=miss><td>119<td><code><pre> idList = utils.NewSet(idList...).Items()</pre></code><tr class=miss><td>120<td><code><pre> retryFunc := func(attempt uint) error {</pre></code><tr><td>121<td><code><pre> if attempt > 1 {</pre></code><tr><td>122<td><code><pre> logInfo(ctx, a.logger, a.appName, a.name,</pre></code><tr><td>123<td><code><pre> "retry to publish topic message [topic[%s] message%v[%v] attempt[%v]]",</pre></code><tr><td>124<td><code><pre> a.conf.Topic, idList, len(msgs), attempt-1)</pre></code><tr><td>125<td><code><pre> }</pre></code><tr><td>126<td><code><pre> return a.pub.Publish(ctx, a.conf.Topic, msgs...)</pre></code><tr><td>127<td><code><pre> }</pre></code><tr><td>128<td><code><pre></pre></code><tr class=miss><td>129<td><code><pre> if err = retry.Retry(retryFunc, opt.asyncStrategies...); err != nil {</pre></code><tr class=miss><td>130<td><code><pre> logError(ctx, a.logger, a.appName, a.name,</pre></code><tr><td>131<td><code><pre> "retry to publish topic message failed [err[%s] topic[%s] message%v[%v]]",</pre></code><tr><td>132<td><code><pre> err, a.conf.Topic, idList, len(msgs))</pre></code><tr><td>133<td><code><pre> }</pre></code><tr><td>134<td><code><pre> }</pre></code></table><div class=funcname id=fn_event[T].toTime>func event[T].toTime</div><div class=info><a href=#s_fn_event[T].toTime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>243<td><code><pre>func (e *event[T]) toTime(timestr, locationstr string) (t time.Time) {</pre></code><tr class=miss><td>244<td><code><pre> loc, err := time.LoadLocation(locationstr)</pre></code><tr class=miss><td>245<td><code><pre> if err != nil {</pre></code><tr class=miss><td>246<td><code><pre> loc = constant.DefaultLocation()</pre></code><tr><td>247<td><code><pre> }</pre></code><tr class=miss><td>248<td><code><pre> t, _ = time.ParseInLocation(time.RFC3339Nano, timestr, loc)</pre></code><tr class=miss><td>249<td><code><pre> return</pre></code><tr><td>250<td><code><pre>}</pre></code></table><div class=funcname id=fn_@113:18>func @113:18</div><div class=info><a href=#s_fn_@113:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>113<td><code><pre>func(counts gobreaker.Counts) bool {</pre></code><tr><td>114<td><code><pre> // fallback to default ready to trip expression</pre></code><tr class=miss><td>115<td><code><pre> if expr == nil {</pre></code><tr class=miss><td>116<td><code><pre> return counts.ConsecutiveFailures > 5</pre></code><tr><td>117<td><code><pre> }</pre></code><tr class=miss><td>118<td><code><pre> if ok, err := expr.EvalBool(ctx, map[string]uint32{</pre></code><tr><td>119<td><code><pre> "requests": counts.Requests,</pre></code><tr><td>120<td><code><pre> "total_successes": counts.TotalSuccesses,</pre></code><tr><td>121<td><code><pre> "total_failures": counts.TotalFailures,</pre></code><tr><td>122<td><code><pre> "consecutive_successes": counts.ConsecutiveSuccesses,</pre></code><tr><td>123<td><code><pre> "consecutive_failures": counts.ConsecutiveFailures,</pre></code><tr><td>124<td><code><pre> }); err == nil {</pre></code><tr class=miss><td>125<td><code><pre> return ok</pre></code><tr><td>126<td><code><pre> }</pre></code><tr><td>127<td><code><pre> // fallback to default ready to trip expression</pre></code><tr class=miss><td>128<td><code><pre> return counts.ConsecutiveFailures > 5</pre></code><tr><td>129<td><code><pre> }</pre></code></table><div class=funcname id=fn_@78:19>func @78:19</div><div class=info><a href=#s_fn_@78:19>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>78<td><code><pre>func() {</pre></code><tr class=miss><td>79<td><code><pre> idList := utils.SliceMapping(msgs, func(s *mw.Message) (id string) { return s.UUID })</pre></code><tr class=miss><td>80<td><code><pre> idList = utils.NewSet(idList...).Items()</pre></code><tr class=miss><td>81<td><code><pre> retryFunc := func(attempt uint) error {</pre></code><tr><td>82<td><code><pre> if attempt > 1 {</pre></code><tr><td>83<td><code><pre> logInfo(ctx, a.logger, a.appName, a.name,</pre></code><tr><td>84<td><code><pre> "retry to publish topic message [topic[%s] message%v[%v] attempt[%v]]",</pre></code><tr><td>85<td><code><pre> a.conf.Topic, idList, len(msgs), attempt-1)</pre></code><tr><td>86<td><code><pre> }</pre></code><tr><td>87<td><code><pre> return a.pub.Publish(ctx, a.conf.Topic, msgs...)</pre></code><tr><td>88<td><code><pre> }</pre></code><tr><td>89<td><code><pre></pre></code><tr class=miss><td>90<td><code><pre> if err = retry.Retry(retryFunc, opt.asyncStrategies...); err != nil {</pre></code><tr class=miss><td>91<td><code><pre> logError(ctx, a.logger, a.appName, a.name,</pre></code><tr><td>92<td><code><pre> "retry to publish topic message failed [err[%s] topic[%s] message%v[%v]]",</pre></code><tr><td>93<td><code><pre> err, a.conf.Topic, idList, len(msgs))</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre> }</pre></code></table><div class=funcname id=fn_@220:4>func @220:4</div><div class=info><a href=#s_fn_@220:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>220<td><code><pre>func(wmsg *mw.Message) (err error) {</pre></code><tr class=miss><td>221<td><code><pre> msg, err := messageConvertFrom(wmsg, r.serializeType, r.compressType)</pre></code><tr class=miss><td>222<td><code><pre> if err != nil {</pre></code><tr class=miss><td>223<td><code><pre> return</pre></code><tr><td>224<td><code><pre> }</pre></code><tr class=miss><td>225<td><code><pre> return fn(msg)</pre></code><tr><td>226<td><code><pre> }</pre></code></table><div class=funcname id=fn_unwrapParams>func unwrapParams</div><div class=info><a href=#s_fn_unwrapParams>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/utils.go</code>:</div><table class=listing><tr><td>21<td><code><pre>func unwrapParams(typ reflect.Type, arg any) (params []any) {</pre></code><tr class=miss><td>22<td><code><pre> if typ == nil {</pre></code><tr class=miss><td>23<td><code><pre> return</pre></code><tr><td>24<td><code><pre> }</pre></code><tr><td>25<td><code><pre></pre></code><tr class=miss><td>26<td><code><pre> return []any{arg}</pre></code><tr><td>27<td><code><pre>}</pre></code></table><div class=funcname id=fn_@150:9>func @150:9</div><div class=info><a href=#s_fn_@150:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>150<td><code><pre>func(o *pubOption) {</pre></code><tr class=miss><td>151<td><code><pre> o.objects = objects</pre></code><tr class=miss><td>152<td><code><pre> if objectUUIDGenFunc != nil {</pre></code><tr class=miss><td>153<td><code><pre> o.objectUUIDGenFunc = reflect.ValueOf(objectUUIDGenFunc)</pre></code><tr><td>154<td><code><pre> }</pre></code><tr><td>155<td><code><pre> }</pre></code></table><div class=funcname id=fn_event[T].Nack>func event[T].Nack</div><div class=info><a href=#s_fn_event[T].Nack>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>236<td><code><pre>func (e *event[T]) Nack() bool {</pre></code><tr class=miss><td>237<td><code><pre> if e.nackfn != nil {</pre></code><tr class=miss><td>238<td><code><pre> return e.nackfn()</pre></code><tr><td>239<td><code><pre> }</pre></code><tr class=miss><td>240<td><code><pre> return true</pre></code><tr><td>241<td><code><pre>}</pre></code></table><div class=funcname id=fn_@120:16>func @120:16</div><div class=info><a href=#s_fn_@120:16>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>120<td><code><pre>func(attempt uint) error {</pre></code><tr class=miss><td>121<td><code><pre> if attempt > 1 {</pre></code><tr class=miss><td>122<td><code><pre> logInfo(ctx, a.logger, a.appName, a.name,</pre></code><tr><td>123<td><code><pre> "retry to publish topic message [topic[%s] message%v[%v] attempt[%v]]",</pre></code><tr><td>124<td><code><pre> a.conf.Topic, idList, len(msgs), attempt-1)</pre></code><tr><td>125<td><code><pre> }</pre></code><tr class=miss><td>126<td><code><pre> return a.pub.Publish(ctx, a.conf.Topic, msgs...)</pre></code><tr><td>127<td><code><pre> }</pre></code></table><div class=funcname id=fn_@81:16>func @81:16</div><div class=info><a href=#s_fn_@81:16>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr><td>81<td><code><pre>func(attempt uint) error {</pre></code><tr class=miss><td>82<td><code><pre> if attempt > 1 {</pre></code><tr class=miss><td>83<td><code><pre> logInfo(ctx, a.logger, a.appName, a.name,</pre></code><tr><td>84<td><code><pre> "retry to publish topic message [topic[%s] message%v[%v] attempt[%v]]",</pre></code><tr><td>85<td><code><pre> a.conf.Topic, idList, len(msgs), attempt-1)</pre></code><tr><td>86<td><code><pre> }</pre></code><tr class=miss><td>87<td><code><pre> return a.pub.Publish(ctx, a.conf.Topic, msgs...)</pre></code><tr><td>88<td><code><pre> }</pre></code></table><div class=funcname id=fn_router.handle>func router.handle</div><div class=info><a href=#s_fn_router.handle>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>337<td><code><pre>func (r *router) handle(hdr any) mw.NoPublishHandlerFunc {</pre></code><tr class=miss><td>338<td><code><pre> typ := wrapParams(hdr)</pre></code><tr class=miss><td>339<td><code><pre> fn := utils.WrapFunc1[error](hdr)</pre></code><tr class=miss><td>340<td><code><pre> return func(msg *mw.Message) (err error) {</pre></code><tr><td>341<td><code><pre> _, data, _, err := pd.Unseal(msg.Payload,</pre></code><tr><td>342<td><code><pre> pd.Serialize(r.serializeType), pd.Compress(r.compressType), pd.Type(typ))</pre></code><tr><td>343<td><code><pre> if err != nil {</pre></code><tr><td>344<td><code><pre> return</pre></code><tr><td>345<td><code><pre> }</pre></code><tr><td>346<td><code><pre> params := unwrapParams(typ, data)</pre></code><tr><td>347<td><code><pre> ctx := fusCtx.New(fusCtx.Watermill(msg.Metadata))</pre></code><tr><td>348<td><code><pre> return fn(append([]any{ctx}, params...)...)</pre></code><tr><td>349<td><code><pre> }</pre></code><tr><td>350<td><code><pre>}</pre></code></table><div class=funcname id=fn_@166:9>func @166:9</div><div class=info><a href=#s_fn_@166:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>166<td><code><pre>func(o *pubOption) {</pre></code><tr class=miss><td>167<td><code><pre> o.async = true</pre></code><tr class=miss><td>168<td><code><pre> o.asyncStrategies = strategies</pre></code><tr><td>169<td><code><pre> }</pre></code></table><div class=funcname id=fn_formatLogMsg>func formatLogMsg</div><div class=info><a href=#s_fn_formatLogMsg>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/log.go</code>:</div><table class=listing><tr><td>45<td><code><pre>func formatLogMsg(app, n, src string, args ...any) (dst string) {</pre></code><tr class=miss><td>46<td><code><pre> appName := config.Use(app).AppName()</pre></code><tr class=miss><td>47<td><code><pre> return fmt.Sprintf("%v [Gofusion] %s %s %s %s",</pre></code><tr><td>48<td><code><pre> syscall.Getpid(), appName, config.ComponentMessageQueue, n, fmt.Sprintf(src, args...))</pre></code><tr><td>49<td><code><pre>}</pre></code></table><div class=funcname id=fn_@252:5>func @252:5</div><div class=info><a href=#s_fn_@252:5>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>252<td><code><pre>func(msg *mw.Message) error {</pre></code><tr class=miss><td>253<td><code><pre> rets := fnVal.Convert(watermillHandlerFuncType).Call(</pre></code><tr><td>254<td><code><pre> []reflect.Value{reflect.ValueOf(rawMessageConvertFrom(msg))},</pre></code><tr><td>255<td><code><pre> )</pre></code><tr class=miss><td>256<td><code><pre> return utils.ParseVariadicFuncResult[error](rets, 0)</pre></code><tr><td>257<td><code><pre> }</pre></code></table><div class=funcname id=fn_@264:5>func @264:5</div><div class=info><a href=#s_fn_@264:5>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>264<td><code><pre>func(msg *mw.Message) error {</pre></code><tr class=miss><td>265<td><code><pre> rets := fnVal.</pre></code><tr><td>266<td><code><pre> Convert(watermillNoPublishHandlerFuncType).</pre></code><tr><td>267<td><code><pre> Call([]reflect.Value{reflect.ValueOf(msg)})</pre></code><tr class=miss><td>268<td><code><pre> return utils.ParseVariadicFuncResult[error](rets, 0)</pre></code><tr><td>269<td><code><pre> }</pre></code></table><div class=funcname id=fn_logInfo>func logInfo</div><div class=info><a href=#s_fn_logInfo>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/log.go</code>:</div><table class=listing><tr><td>18<td><code><pre>func logInfo(ctx context.Context, l watermill.LoggerAdapter, app, n, m string, args ...any) {</pre></code><tr class=miss><td>19<td><code><pre> l.Info(formatLogMsg(app, n, m, args...), formatFields(ctx))</pre></code><tr><td>20<td><code><pre>}</pre></code></table><div class=funcname id=fn_logDebug>func logDebug</div><div class=info><a href=#s_fn_logDebug>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/log.go</code>:</div><table class=listing><tr><td>21<td><code><pre>func logDebug(ctx context.Context, l watermill.LoggerAdapter, app, n, m string, args ...any) {</pre></code><tr class=miss><td>22<td><code><pre> l.Debug(formatLogMsg(app, n, m, args...), formatFields(ctx))</pre></code><tr><td>23<td><code><pre>}</pre></code></table><div class=funcname id=fn_logError>func logError</div><div class=info><a href=#s_fn_logError>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/log.go</code>:</div><table class=listing><tr><td>15<td><code><pre>func logError(ctx context.Context, l watermill.LoggerAdapter, app, n, m string, args ...any) {</pre></code><tr class=miss><td>16<td><code><pre> l.Error(formatLogMsg(app, n, m, args...), nil, formatFields(ctx))</pre></code><tr><td>17<td><code><pre>}</pre></code></table><div class=funcname id=fn_@102:9>func @102:9</div><div class=info><a href=#s_fn_@102:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>102<td><code><pre>func() EventSubscriber[T] {</pre></code><tr class=miss><td>103<td><code><pre> return NewEventSubscriber[T](name, opts...)</pre></code><tr><td>104<td><code><pre> }</pre></code></table><div class=funcname id=fn_NewEventSubscriberDI>func NewEventSubscriberDI</div><div class=info><a href=#s_fn_NewEventSubscriberDI>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>101<td><code><pre>func NewEventSubscriberDI[T eventual](name string, opts ...utils.OptionExtender) func() EventSubscriber[T] {</pre></code><tr class=miss><td>102<td><code><pre> return func() EventSubscriber[T] {</pre></code><tr><td>103<td><code><pre> return NewEventSubscriber[T](name, opts...)</pre></code><tr><td>104<td><code><pre> }</pre></code><tr><td>105<td><code><pre>}</pre></code></table><div class=funcname id=fn_logTrace>func logTrace</div><div class=info><a href=#s_fn_logTrace>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/log.go</code>:</div><table class=listing><tr><td>24<td><code><pre>func logTrace(ctx context.Context, l watermill.LoggerAdapter, app, n, m string, args ...any) {</pre></code><tr class=miss><td>25<td><code><pre> l.Trace(formatLogMsg(app, n, m, args...), formatFields(ctx))</pre></code><tr><td>26<td><code><pre>}</pre></code></table><div class=funcname id=fn_event[T].UpdatedAt>func event[T].UpdatedAt</div><div class=info><a href=#s_fn_event[T].UpdatedAt>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr class=miss><td>227<td><code><pre>func (e *event[T]) UpdatedAt() time.Time { return e.toTime(e.pd.U, e.pd.UL) }</pre></code></table><div class=funcname id=fn_kafkaOAuthProvider.Token>func kafkaOAuthProvider.Token</div><div class=info><a href=#s_fn_kafkaOAuthProvider.Token>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/kafka.go</code>:</div><table class=listing><tr><td>137<td><code><pre>func (k *kafkaOAuthProvider) Token() (*sarama.AccessToken, error) {</pre></code><tr class=miss><td>138<td><code><pre> return &sarama.AccessToken{Token: k.token}, nil</pre></code><tr><td>139<td><code><pre>}</pre></code></table><div class=funcname id=fn_@150:17>func @150:17</div><div class=info><a href=#s_fn_@150:17>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/construct.go</code>:</div><table class=listing><tr class=miss><td>150<td><code><pre>func() IRouter { return Use(name, AppName(opt.AppName)) }</pre></code></table><div class=funcname id=fn_Objects>func Objects</div><div class=info><a href=#s_fn_Objects>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>149<td><code><pre>func Objects[T any](objectUUIDGenFunc func(T) string, objects ...any) utils.OptionFunc[pubOption] {</pre></code><tr class=miss><td>150<td><code><pre> return func(o *pubOption) {</pre></code><tr><td>151<td><code><pre> o.objects = objects</pre></code><tr><td>152<td><code><pre> if objectUUIDGenFunc != nil {</pre></code><tr><td>153<td><code><pre> o.objectUUIDGenFunc = reflect.ValueOf(objectUUIDGenFunc)</pre></code><tr><td>154<td><code><pre> }</pre></code><tr><td>155<td><code><pre> }</pre></code><tr><td>156<td><code><pre>}</pre></code></table><div class=funcname id=fn_@62:9>func @62:9</div><div class=info><a href=#s_fn_@62:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>62<td><code><pre>func() EventPublisher[T] {</pre></code><tr class=miss><td>63<td><code><pre> return NewEventPublisher[T](name, opts...)</pre></code><tr><td>64<td><code><pre> }</pre></code></table><div class=funcname id=fn_NewEventPublisherDI>func NewEventPublisherDI</div><div class=info><a href=#s_fn_NewEventPublisherDI>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>61<td><code><pre>func NewEventPublisherDI[T eventual](name string, opts ...utils.OptionExtender) func() EventPublisher[T] {</pre></code><tr class=miss><td>62<td><code><pre> return func() EventPublisher[T] {</pre></code><tr><td>63<td><code><pre> return NewEventPublisher[T](name, opts...)</pre></code><tr><td>64<td><code><pre> }</pre></code><tr><td>65<td><code><pre>}</pre></code></table><div class=funcname id=fn_abstractMQ.watermillLogger>func abstractMQ.watermillLogger</div><div class=info><a href=#s_fn_abstractMQ.watermillLogger>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr class=miss><td>245<td><code><pre>func (a *abstractMQ) watermillLogger() watermill.LoggerAdapter { return a.logger }</pre></code></table><div class=funcname id=fn_EventDeleted>func EventDeleted</div><div class=info><a href=#s_fn_EventDeleted>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>184<td><code><pre>func EventDeleted[T eventual](id string, deletedAt time.Time, payload T) Event[T] {</pre></code><tr class=miss><td>185<td><code><pre> return newEvent[T](id, time.Time{}, time.Time{}, deletedAt, payload)</pre></code><tr><td>186<td><code><pre>}</pre></code></table><div class=funcname id=fn_@133:19>func @133:19</div><div class=info><a href=#s_fn_@133:19>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr class=miss><td>133<td><code><pre>func(err error) bool { return err == nil }</pre></code></table><div class=funcname id=fn_Async>func Async</div><div class=info><a href=#s_fn_Async>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr><td>165<td><code><pre>func Async(strategies ...strategy.Strategy) utils.OptionFunc[pubOption] {</pre></code><tr class=miss><td>166<td><code><pre> return func(o *pubOption) {</pre></code><tr><td>167<td><code><pre> o.async = true</pre></code><tr><td>168<td><code><pre> o.asyncStrategies = strategies</pre></code><tr><td>169<td><code><pre> }</pre></code><tr><td>170<td><code><pre>}</pre></code></table><div class=funcname id=fn_@130:20>func @130:20</div><div class=info><a href=#s_fn_@130:20>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>130<td><code><pre>func(name string, from gobreaker.State, to gobreaker.State) {</pre></code><tr class=miss><td>131<td><code><pre> logInfo(ctx, logger, appName, name, "circuit breaker state changed: %s -> %s", from, to)</pre></code><tr><td>132<td><code><pre> }</pre></code></table><div class=funcname id=fn_@93:29>func @93:29</div><div class=info><a href=#s_fn_@93:29>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr class=miss><td>93<td><code><pre>func(err error) bool { return err != nil }</pre></code></table><div class=funcname id=fn_@169:23>func @169:23</div><div class=info><a href=#s_fn_@169:23>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/construct.go</code>:</div><table class=listing><tr class=miss><td>169<td><code><pre>func() Publisher { return Pub(name, AppName(opt.AppName)) }</pre></code></table><div class=funcname id=fn_abstractMQ.close>func abstractMQ.close</div><div class=info><a href=#s_fn_abstractMQ.close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr class=miss><td>241<td><code><pre>func (a *abstractMQ) close() error { panic(ErrNotImplement) }</pre></code></table><div class=funcname id=fn_@149:17>func @149:17</div><div class=info><a href=#s_fn_@149:17>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/construct.go</code>:</div><table class=listing><tr class=miss><td>149<td><code><pre>func() Subscriber { return sub(name, AppName(opt.AppName)) }</pre></code></table><div class=funcname id=fn_@77:18>func @77:18</div><div class=info><a href=#s_fn_@77:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/router.go</code>:</div><table class=listing><tr><td>77<td><code><pre>func(attempt int, delay time.Duration) {</pre></code><tr class=miss><td>78<td><code><pre> logTrace(ctx, logger, appName, name,</pre></code><tr><td>79<td><code><pre> "retry to consume message [attempt[%v] delay[%s]]", attempt, delay)</pre></code><tr><td>80<td><code><pre> }</pre></code></table><div class=funcname id=fn_NewEvent>func NewEvent</div><div class=info><a href=#s_fn_NewEvent>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>172<td><code><pre>func NewEvent[T eventual](id string, createdAt, updatedAt, deletedAt time.Time, payload T) Event[T] {</pre></code><tr class=miss><td>173<td><code><pre> return newEvent[T](id, createdAt, updatedAt, deletedAt, payload)</pre></code><tr><td>174<td><code><pre>}</pre></code></table><div class=funcname id=fn_@118:38>func @118:38</div><div class=info><a href=#s_fn_@118:38>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr class=miss><td>118<td><code><pre>func(s *mw.Message) (id string) { return s.UUID }</pre></code></table><div class=funcname id=fn_event[T].DeletedAt>func event[T].DeletedAt</div><div class=info><a href=#s_fn_event[T].DeletedAt>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr class=miss><td>228<td><code><pre>func (e *event[T]) DeletedAt() time.Time { return e.toTime(e.pd.D, e.pd.DL) }</pre></code></table><div class=funcname id=fn_EventCreated>func EventCreated</div><div class=info><a href=#s_fn_EventCreated>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>178<td><code><pre>func EventCreated[T eventual](id string, createdAt time.Time, payload T) Event[T] {</pre></code><tr class=miss><td>179<td><code><pre> return newEvent[T](id, createdAt, time.Time{}, time.Time{}, payload)</pre></code><tr><td>180<td><code><pre>}</pre></code></table><div class=funcname id=fn_message.RawMessage>func message.RawMessage</div><div class=info><a href=#s_fn_message.RawMessage>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr class=miss><td>209<td><code><pre>func (m *message) RawMessage() any { return m.Message }</pre></code></table><div class=funcname id=fn_message.Object>func message.Object</div><div class=info><a href=#s_fn_message.Object>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/types.go</code>:</div><table class=listing><tr class=miss><td>210<td><code><pre>func (m *message) Object() any { return m.obj }</pre></code></table><div class=funcname id=fn_event[T].CreatedAt>func event[T].CreatedAt</div><div class=info><a href=#s_fn_event[T].CreatedAt>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr class=miss><td>226<td><code><pre>func (e *event[T]) CreatedAt() time.Time { return e.toTime(e.pd.C, e.pd.CL) }</pre></code></table><div class=funcname id=fn_EventUpdated>func EventUpdated</div><div class=info><a href=#s_fn_EventUpdated>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/event.go</code>:</div><table class=listing><tr><td>181<td><code><pre>func EventUpdated[T eventual](id string, updatedAt time.Time, payload T) Event[T] {</pre></code><tr class=miss><td>182<td><code><pre> return newEvent[T](id, time.Time{}, updatedAt, time.Time{}, payload)</pre></code><tr><td>183<td><code><pre>}</pre></code></table><div class=funcname id=fn_@79:38>func @79:38</div><div class=info><a href=#s_fn_@79:38>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/mq/mq.go</code>:</div><table class=listing><tr class=miss><td>79<td><code><pre>func(s *mw.Message) (id string) { return s.UUID }</pre></code></table><div id=pkg_github.com/wfusion/gofusion/redis class=funcname>Package Overview: github.com/wfusion/gofusion/redis 42 <span class=packageTotal>23.6%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_startDaemonRoutines><td><code><a href=#fn_startDaemonRoutines>startDaemonRoutines(...)</a></code><td><code>github.com/wfusion/gofusion/redis/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>10/10</code><tr id=s_fn_Construct><td><code><a href=#fn_Construct>Construct(...)</a></code><td><code>github.com/wfusion/gofusion/redis/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>7/7</code><tr id=s_fn_instance.XAdd><td><code><a href=#fn_instance.XAdd>instance.XAdd(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.Subscribe><td><code><a href=#fn_instance.Subscribe>instance.Subscribe(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/redis/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/redis/flag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.MGet><td><code><a href=#fn_instance.MGet>instance.MGet(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.Set><td><code><a href=#fn_instance.Set>instance.Set(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.SetNX><td><code><a href=#fn_instance.SetNX>instance.SetNX(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.Del><td><code><a href=#fn_instance.Del>instance.Del(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.XReadGroup><td><code><a href=#fn_instance.XReadGroup>instance.XReadGroup(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.GetProxy><td><code><a href=#fn_instance.GetProxy>instance.GetProxy(...)</a></code><td><code>github.com/wfusion/gofusion/redis/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_AppName><td><code><a href=#fn_AppName>AppName(...)</a></code><td><code>github.com/wfusion/gofusion/redis/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@39:9><td><code><a href=#fn_@39:9>@39:9(...)</a></code><td><code>github.com/wfusion/gofusion/redis/redis.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.SAdd><td><code><a href=#fn_instance.SAdd>instance.SAdd(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.Pipeline><td><code><a href=#fn_instance.Pipeline>instance.Pipeline(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.Get><td><code><a href=#fn_instance.Get>instance.Get(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.Eval><td><code><a href=#fn_instance.Eval>instance.Eval(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.ZRem><td><code><a href=#fn_instance.ZRem>instance.ZRem(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.ZAdd><td><code><a href=#fn_instance.ZAdd>instance.ZAdd(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.XClaim><td><code><a href=#fn_instance.XClaim>instance.XClaim(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.XPendingExt><td><code><a href=#fn_instance.XPendingExt>instance.XPendingExt(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.XAck><td><code><a href=#fn_instance.XAck>instance.XAck(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.XGroupCreateMkStream><td><code><a href=#fn_instance.XGroupCreateMkStream>instance.XGroupCreateMkStream(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.EvalSha><td><code><a href=#fn_instance.EvalSha>instance.EvalSha(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_instance.Keys><td><code><a href=#fn_instance.Keys>instance.Keys(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_addInstance><td><code><a href=#fn_addInstance>addInstance(...)</a></code><td><code>github.com/wfusion/gofusion/redis/construct.go</code><td class=percent><code>91.3%</code><td class=linecount><code>21/23</code><tr id=s_fn_@31:9><td><code><a href=#fn_@31:9>@31:9(...)</a></code><td><code>github.com/wfusion/gofusion/redis/construct.go</code><td class=percent><code>88.9%</code><td class=linecount><code>8/9</code><tr id=s_fn_Use><td><code><a href=#fn_Use>Use(...)</a></code><td><code>github.com/wfusion/gofusion/redis/redis.go</code><td class=percent><code>80.0%</code><td class=linecount><code>8/10</code><tr id=s_fn_metricRedisLatency><td><code><a href=#fn_metricRedisLatency>metricRedisLatency(...)</a></code><td><code>github.com/wfusion/gofusion/redis/metrics.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_metricRedisStats><td><code><a href=#fn_metricRedisStats>metricRedisStats(...)</a></code><td><code>github.com/wfusion/gofusion/redis/metrics.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_@60:21><td><code><a href=#fn_@60:21>@60:21(...)</a></code><td><code>github.com/wfusion/gofusion/redis/metrics.go</code><td class=percent><code>51.6%</code><td class=linecount><code>16/31</code><tr id=s_fn_@113:21><td><code><a href=#fn_@113:21>@113:21(...)</a></code><td><code>github.com/wfusion/gofusion/redis/metrics.go</code><td class=percent><code>50.0%</code><td class=linecount><code>10/20</code><tr id=s_fn_instance.ObjectIdleTime><td><code><a href=#fn_instance.ObjectIdleTime>instance.ObjectIdleTime(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ExpireNX><td><code><a href=#fn_instance.ExpireNX>instance.ExpireNX(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ExpireXX><td><code><a href=#fn_instance.ExpireXX>instance.ExpireXX(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ExpireGT><td><code><a href=#fn_instance.ExpireGT>instance.ExpireGT(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ExpireLT><td><code><a href=#fn_instance.ExpireLT>instance.ExpireLT(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ExpireTime><td><code><a href=#fn_instance.ExpireTime>instance.ExpireTime(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Migrate><td><code><a href=#fn_instance.Migrate>instance.Migrate(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Move><td><code><a href=#fn_instance.Move>instance.Move(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ObjectRefCount><td><code><a href=#fn_instance.ObjectRefCount>instance.ObjectRefCount(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ObjectEncoding><td><code><a href=#fn_instance.ObjectEncoding>instance.ObjectEncoding(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ExpireAt><td><code><a href=#fn_instance.ExpireAt>instance.ExpireAt(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Persist><td><code><a href=#fn_instance.Persist>instance.Persist(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.PExpire><td><code><a href=#fn_instance.PExpire>instance.PExpire(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.PExpireAt><td><code><a href=#fn_instance.PExpireAt>instance.PExpireAt(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.PExpireTime><td><code><a href=#fn_instance.PExpireTime>instance.PExpireTime(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.PTTL><td><code><a href=#fn_instance.PTTL>instance.PTTL(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.RandomKey><td><code><a href=#fn_instance.RandomKey>instance.RandomKey(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Rename><td><code><a href=#fn_instance.Rename>instance.Rename(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.RenameNX><td><code><a href=#fn_instance.RenameNX>instance.RenameNX(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Restore><td><code><a href=#fn_instance.Restore>instance.Restore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.RestoreReplace><td><code><a href=#fn_instance.RestoreReplace>instance.RestoreReplace(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Sort><td><code><a href=#fn_instance.Sort>instance.Sort(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SortRO><td><code><a href=#fn_instance.SortRO>instance.SortRO(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SortStore><td><code><a href=#fn_instance.SortStore>instance.SortStore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SortInterfaces><td><code><a href=#fn_instance.SortInterfaces>instance.SortInterfaces(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Touch><td><code><a href=#fn_instance.Touch>instance.Touch(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.TTL><td><code><a href=#fn_instance.TTL>instance.TTL(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Type><td><code><a href=#fn_instance.Type>instance.Type(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Append><td><code><a href=#fn_instance.Append>instance.Append(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Decr><td><code><a href=#fn_instance.Decr>instance.Decr(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.DecrBy><td><code><a href=#fn_instance.DecrBy>instance.DecrBy(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Expire><td><code><a href=#fn_instance.Expire>instance.Expire(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.GetRange><td><code><a href=#fn_instance.GetRange>instance.GetRange(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.GetSet><td><code><a href=#fn_instance.GetSet>instance.GetSet(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.GetEx><td><code><a href=#fn_instance.GetEx>instance.GetEx(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.GetDel><td><code><a href=#fn_instance.GetDel>instance.GetDel(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Incr><td><code><a href=#fn_instance.Incr>instance.Incr(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.IncrBy><td><code><a href=#fn_instance.IncrBy>instance.IncrBy(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.IncrByFloat><td><code><a href=#fn_instance.IncrByFloat>instance.IncrByFloat(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Exists><td><code><a href=#fn_instance.Exists>instance.Exists(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.MSet><td><code><a href=#fn_instance.MSet>instance.MSet(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.MSetNX><td><code><a href=#fn_instance.MSetNX>instance.MSetNX(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Dump><td><code><a href=#fn_instance.Dump>instance.Dump(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SetArgs><td><code><a href=#fn_instance.SetArgs>instance.SetArgs(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SetEx><td><code><a href=#fn_instance.SetEx>instance.SetEx(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Unlink><td><code><a href=#fn_instance.Unlink>instance.Unlink(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SetXX><td><code><a href=#fn_instance.SetXX>instance.SetXX(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SetRange><td><code><a href=#fn_instance.SetRange>instance.SetRange(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.StrLen><td><code><a href=#fn_instance.StrLen>instance.StrLen(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Copy><td><code><a href=#fn_instance.Copy>instance.Copy(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.GetBit><td><code><a href=#fn_instance.GetBit>instance.GetBit(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SetBit><td><code><a href=#fn_instance.SetBit>instance.SetBit(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BitCount><td><code><a href=#fn_instance.BitCount>instance.BitCount(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BitOpAnd><td><code><a href=#fn_instance.BitOpAnd>instance.BitOpAnd(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BitOpOr><td><code><a href=#fn_instance.BitOpOr>instance.BitOpOr(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BitOpXor><td><code><a href=#fn_instance.BitOpXor>instance.BitOpXor(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BitOpNot><td><code><a href=#fn_instance.BitOpNot>instance.BitOpNot(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BitPos><td><code><a href=#fn_instance.BitPos>instance.BitPos(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BitPosSpan><td><code><a href=#fn_instance.BitPosSpan>instance.BitPosSpan(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BitField><td><code><a href=#fn_instance.BitField>instance.BitField(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Scan><td><code><a href=#fn_instance.Scan>instance.Scan(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ScanType><td><code><a href=#fn_instance.ScanType>instance.ScanType(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SScan><td><code><a href=#fn_instance.SScan>instance.SScan(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.HScan><td><code><a href=#fn_instance.HScan>instance.HScan(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZScan><td><code><a href=#fn_instance.ZScan>instance.ZScan(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.HDel><td><code><a href=#fn_instance.HDel>instance.HDel(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.HExists><td><code><a href=#fn_instance.HExists>instance.HExists(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.HGet><td><code><a href=#fn_instance.HGet>instance.HGet(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.HGetAll><td><code><a href=#fn_instance.HGetAll>instance.HGetAll(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.HIncrBy><td><code><a href=#fn_instance.HIncrBy>instance.HIncrBy(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.HIncrByFloat><td><code><a href=#fn_instance.HIncrByFloat>instance.HIncrByFloat(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.HKeys><td><code><a href=#fn_instance.HKeys>instance.HKeys(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.HLen><td><code><a href=#fn_instance.HLen>instance.HLen(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.HMGet><td><code><a href=#fn_instance.HMGet>instance.HMGet(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.HSet><td><code><a href=#fn_instance.HSet>instance.HSet(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.HMSet><td><code><a href=#fn_instance.HMSet>instance.HMSet(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.HSetNX><td><code><a href=#fn_instance.HSetNX>instance.HSetNX(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.HVals><td><code><a href=#fn_instance.HVals>instance.HVals(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.HRandField><td><code><a href=#fn_instance.HRandField>instance.HRandField(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.HRandFieldWithValues><td><code><a href=#fn_instance.HRandFieldWithValues>instance.HRandFieldWithValues(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BLPop><td><code><a href=#fn_instance.BLPop>instance.BLPop(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BLMPop><td><code><a href=#fn_instance.BLMPop>instance.BLMPop(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BRPop><td><code><a href=#fn_instance.BRPop>instance.BRPop(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BRPopLPush><td><code><a href=#fn_instance.BRPopLPush>instance.BRPopLPush(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LCS><td><code><a href=#fn_instance.LCS>instance.LCS(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LIndex><td><code><a href=#fn_instance.LIndex>instance.LIndex(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LMPop><td><code><a href=#fn_instance.LMPop>instance.LMPop(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LInsert><td><code><a href=#fn_instance.LInsert>instance.LInsert(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LInsertBefore><td><code><a href=#fn_instance.LInsertBefore>instance.LInsertBefore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LInsertAfter><td><code><a href=#fn_instance.LInsertAfter>instance.LInsertAfter(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LLen><td><code><a href=#fn_instance.LLen>instance.LLen(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LPop><td><code><a href=#fn_instance.LPop>instance.LPop(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LPopCount><td><code><a href=#fn_instance.LPopCount>instance.LPopCount(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LPos><td><code><a href=#fn_instance.LPos>instance.LPos(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LPosCount><td><code><a href=#fn_instance.LPosCount>instance.LPosCount(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LPush><td><code><a href=#fn_instance.LPush>instance.LPush(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LPushX><td><code><a href=#fn_instance.LPushX>instance.LPushX(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LRange><td><code><a href=#fn_instance.LRange>instance.LRange(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LRem><td><code><a href=#fn_instance.LRem>instance.LRem(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Quit><td><code><a href=#fn_instance.Quit>instance.Quit(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LTrim><td><code><a href=#fn_instance.LTrim>instance.LTrim(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.RPop><td><code><a href=#fn_instance.RPop>instance.RPop(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.RPopCount><td><code><a href=#fn_instance.RPopCount>instance.RPopCount(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.RPopLPush><td><code><a href=#fn_instance.RPopLPush>instance.RPopLPush(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.RPush><td><code><a href=#fn_instance.RPush>instance.RPush(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.RPushX><td><code><a href=#fn_instance.RPushX>instance.RPushX(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LMove><td><code><a href=#fn_instance.LMove>instance.LMove(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BLMove><td><code><a href=#fn_instance.BLMove>instance.BLMove(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Ping><td><code><a href=#fn_instance.Ping>instance.Ping(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SCard><td><code><a href=#fn_instance.SCard>instance.SCard(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SDiff><td><code><a href=#fn_instance.SDiff>instance.SDiff(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SDiffStore><td><code><a href=#fn_instance.SDiffStore>instance.SDiffStore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SInter><td><code><a href=#fn_instance.SInter>instance.SInter(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SInterCard><td><code><a href=#fn_instance.SInterCard>instance.SInterCard(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SInterStore><td><code><a href=#fn_instance.SInterStore>instance.SInterStore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SIsMember><td><code><a href=#fn_instance.SIsMember>instance.SIsMember(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SMIsMember><td><code><a href=#fn_instance.SMIsMember>instance.SMIsMember(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SMembers><td><code><a href=#fn_instance.SMembers>instance.SMembers(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SMembersMap><td><code><a href=#fn_instance.SMembersMap>instance.SMembersMap(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SMove><td><code><a href=#fn_instance.SMove>instance.SMove(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SPop><td><code><a href=#fn_instance.SPop>instance.SPop(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SPopN><td><code><a href=#fn_instance.SPopN>instance.SPopN(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SRandMember><td><code><a href=#fn_instance.SRandMember>instance.SRandMember(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SRandMemberN><td><code><a href=#fn_instance.SRandMemberN>instance.SRandMemberN(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SRem><td><code><a href=#fn_instance.SRem>instance.SRem(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SUnion><td><code><a href=#fn_instance.SUnion>instance.SUnion(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SUnionStore><td><code><a href=#fn_instance.SUnionStore>instance.SUnionStore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Echo><td><code><a href=#fn_instance.Echo>instance.Echo(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XDel><td><code><a href=#fn_instance.XDel>instance.XDel(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XLen><td><code><a href=#fn_instance.XLen>instance.XLen(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XRange><td><code><a href=#fn_instance.XRange>instance.XRange(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XRangeN><td><code><a href=#fn_instance.XRangeN>instance.XRangeN(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XRevRange><td><code><a href=#fn_instance.XRevRange>instance.XRevRange(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XRevRangeN><td><code><a href=#fn_instance.XRevRangeN>instance.XRevRangeN(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XRead><td><code><a href=#fn_instance.XRead>instance.XRead(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XReadStreams><td><code><a href=#fn_instance.XReadStreams>instance.XReadStreams(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XGroupCreate><td><code><a href=#fn_instance.XGroupCreate>instance.XGroupCreate(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClientGetName><td><code><a href=#fn_instance.ClientGetName>instance.ClientGetName(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XGroupSetID><td><code><a href=#fn_instance.XGroupSetID>instance.XGroupSetID(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XGroupDestroy><td><code><a href=#fn_instance.XGroupDestroy>instance.XGroupDestroy(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XGroupCreateConsumer><td><code><a href=#fn_instance.XGroupCreateConsumer>instance.XGroupCreateConsumer(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XGroupDelConsumer><td><code><a href=#fn_instance.XGroupDelConsumer>instance.XGroupDelConsumer(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LSet><td><code><a href=#fn_instance.LSet>instance.LSet(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.CommandGetKeysAndFlags><td><code><a href=#fn_instance.CommandGetKeysAndFlags>instance.CommandGetKeysAndFlags(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XPending><td><code><a href=#fn_instance.XPending>instance.XPending(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.CommandGetKeys><td><code><a href=#fn_instance.CommandGetKeys>instance.CommandGetKeys(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.CommandList><td><code><a href=#fn_instance.CommandList>instance.CommandList(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XClaimJustID><td><code><a href=#fn_instance.XClaimJustID>instance.XClaimJustID(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XAutoClaim><td><code><a href=#fn_instance.XAutoClaim>instance.XAutoClaim(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XAutoClaimJustID><td><code><a href=#fn_instance.XAutoClaimJustID>instance.XAutoClaimJustID(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XTrimMaxLen><td><code><a href=#fn_instance.XTrimMaxLen>instance.XTrimMaxLen(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XTrimMaxLenApprox><td><code><a href=#fn_instance.XTrimMaxLenApprox>instance.XTrimMaxLenApprox(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XTrimMinID><td><code><a href=#fn_instance.XTrimMinID>instance.XTrimMinID(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XTrimMinIDApprox><td><code><a href=#fn_instance.XTrimMinIDApprox>instance.XTrimMinIDApprox(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XInfoGroups><td><code><a href=#fn_instance.XInfoGroups>instance.XInfoGroups(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XInfoStream><td><code><a href=#fn_instance.XInfoStream>instance.XInfoStream(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XInfoStreamFull><td><code><a href=#fn_instance.XInfoStreamFull>instance.XInfoStreamFull(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.XInfoConsumers><td><code><a href=#fn_instance.XInfoConsumers>instance.XInfoConsumers(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BZPopMax><td><code><a href=#fn_instance.BZPopMax>instance.BZPopMax(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BZPopMin><td><code><a href=#fn_instance.BZPopMin>instance.BZPopMin(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BZMPop><td><code><a href=#fn_instance.BZMPop>instance.BZMPop(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Command><td><code><a href=#fn_instance.Command>instance.Command(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZAddLT><td><code><a href=#fn_instance.ZAddLT>instance.ZAddLT(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZAddGT><td><code><a href=#fn_instance.ZAddGT>instance.ZAddGT(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZAddNX><td><code><a href=#fn_instance.ZAddNX>instance.ZAddNX(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZAddXX><td><code><a href=#fn_instance.ZAddXX>instance.ZAddXX(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZAddArgs><td><code><a href=#fn_instance.ZAddArgs>instance.ZAddArgs(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZAddArgsIncr><td><code><a href=#fn_instance.ZAddArgsIncr>instance.ZAddArgsIncr(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZCard><td><code><a href=#fn_instance.ZCard>instance.ZCard(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZCount><td><code><a href=#fn_instance.ZCount>instance.ZCount(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZLexCount><td><code><a href=#fn_instance.ZLexCount>instance.ZLexCount(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZIncrBy><td><code><a href=#fn_instance.ZIncrBy>instance.ZIncrBy(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZInter><td><code><a href=#fn_instance.ZInter>instance.ZInter(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZInterWithScores><td><code><a href=#fn_instance.ZInterWithScores>instance.ZInterWithScores(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZInterCard><td><code><a href=#fn_instance.ZInterCard>instance.ZInterCard(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZInterStore><td><code><a href=#fn_instance.ZInterStore>instance.ZInterStore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZMPop><td><code><a href=#fn_instance.ZMPop>instance.ZMPop(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZMScore><td><code><a href=#fn_instance.ZMScore>instance.ZMScore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZPopMax><td><code><a href=#fn_instance.ZPopMax>instance.ZPopMax(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZPopMin><td><code><a href=#fn_instance.ZPopMin>instance.ZPopMin(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRange><td><code><a href=#fn_instance.ZRange>instance.ZRange(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRangeWithScores><td><code><a href=#fn_instance.ZRangeWithScores>instance.ZRangeWithScores(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRangeByScore><td><code><a href=#fn_instance.ZRangeByScore>instance.ZRangeByScore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRangeByLex><td><code><a href=#fn_instance.ZRangeByLex>instance.ZRangeByLex(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRangeByScoreWithScores><td><code><a href=#fn_instance.ZRangeByScoreWithScores>instance.ZRangeByScoreWithScores(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRangeArgs><td><code><a href=#fn_instance.ZRangeArgs>instance.ZRangeArgs(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRangeArgsWithScores><td><code><a href=#fn_instance.ZRangeArgsWithScores>instance.ZRangeArgsWithScores(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRangeStore><td><code><a href=#fn_instance.ZRangeStore>instance.ZRangeStore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRank><td><code><a href=#fn_instance.ZRank>instance.ZRank(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRankWithScore><td><code><a href=#fn_instance.ZRankWithScore>instance.ZRankWithScore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.TxPipeline><td><code><a href=#fn_instance.TxPipeline>instance.TxPipeline(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRemRangeByRank><td><code><a href=#fn_instance.ZRemRangeByRank>instance.ZRemRangeByRank(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRemRangeByScore><td><code><a href=#fn_instance.ZRemRangeByScore>instance.ZRemRangeByScore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRemRangeByLex><td><code><a href=#fn_instance.ZRemRangeByLex>instance.ZRemRangeByLex(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRevRange><td><code><a href=#fn_instance.ZRevRange>instance.ZRevRange(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRevRangeWithScores><td><code><a href=#fn_instance.ZRevRangeWithScores>instance.ZRevRangeWithScores(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRevRangeByScore><td><code><a href=#fn_instance.ZRevRangeByScore>instance.ZRevRangeByScore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRevRangeByLex><td><code><a href=#fn_instance.ZRevRangeByLex>instance.ZRevRangeByLex(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRevRangeByScoreWithScores><td><code><a href=#fn_instance.ZRevRangeByScoreWithScores>instance.ZRevRangeByScoreWithScores(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRevRank><td><code><a href=#fn_instance.ZRevRank>instance.ZRevRank(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRevRankWithScore><td><code><a href=#fn_instance.ZRevRankWithScore>instance.ZRevRankWithScore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZScore><td><code><a href=#fn_instance.ZScore>instance.ZScore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZUnionStore><td><code><a href=#fn_instance.ZUnionStore>instance.ZUnionStore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRandMember><td><code><a href=#fn_instance.ZRandMember>instance.ZRandMember(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZRandMemberWithScores><td><code><a href=#fn_instance.ZRandMemberWithScores>instance.ZRandMemberWithScores(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZUnion><td><code><a href=#fn_instance.ZUnion>instance.ZUnion(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZUnionWithScores><td><code><a href=#fn_instance.ZUnionWithScores>instance.ZUnionWithScores(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZDiff><td><code><a href=#fn_instance.ZDiff>instance.ZDiff(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZDiffWithScores><td><code><a href=#fn_instance.ZDiffWithScores>instance.ZDiffWithScores(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ZDiffStore><td><code><a href=#fn_instance.ZDiffStore>instance.ZDiffStore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.PFAdd><td><code><a href=#fn_instance.PFAdd>instance.PFAdd(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.PFCount><td><code><a href=#fn_instance.PFCount>instance.PFCount(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.PFMerge><td><code><a href=#fn_instance.PFMerge>instance.PFMerge(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BgRewriteAOF><td><code><a href=#fn_instance.BgRewriteAOF>instance.BgRewriteAOF(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.BgSave><td><code><a href=#fn_instance.BgSave>instance.BgSave(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClientKill><td><code><a href=#fn_instance.ClientKill>instance.ClientKill(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClientKillByFilter><td><code><a href=#fn_instance.ClientKillByFilter>instance.ClientKillByFilter(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClientList><td><code><a href=#fn_instance.ClientList>instance.ClientList(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClientPause><td><code><a href=#fn_instance.ClientPause>instance.ClientPause(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClientUnpause><td><code><a href=#fn_instance.ClientUnpause>instance.ClientUnpause(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClientID><td><code><a href=#fn_instance.ClientID>instance.ClientID(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClientUnblock><td><code><a href=#fn_instance.ClientUnblock>instance.ClientUnblock(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClientUnblockWithError><td><code><a href=#fn_instance.ClientUnblockWithError>instance.ClientUnblockWithError(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClientInfo><td><code><a href=#fn_instance.ClientInfo>instance.ClientInfo(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ConfigGet><td><code><a href=#fn_instance.ConfigGet>instance.ConfigGet(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ConfigResetStat><td><code><a href=#fn_instance.ConfigResetStat>instance.ConfigResetStat(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ConfigSet><td><code><a href=#fn_instance.ConfigSet>instance.ConfigSet(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ConfigRewrite><td><code><a href=#fn_instance.ConfigRewrite>instance.ConfigRewrite(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.DBSize><td><code><a href=#fn_instance.DBSize>instance.DBSize(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FlushAll><td><code><a href=#fn_instance.FlushAll>instance.FlushAll(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FlushAllAsync><td><code><a href=#fn_instance.FlushAllAsync>instance.FlushAllAsync(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FlushDB><td><code><a href=#fn_instance.FlushDB>instance.FlushDB(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FlushDBAsync><td><code><a href=#fn_instance.FlushDBAsync>instance.FlushDBAsync(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Info><td><code><a href=#fn_instance.Info>instance.Info(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.LastSave><td><code><a href=#fn_instance.LastSave>instance.LastSave(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Save><td><code><a href=#fn_instance.Save>instance.Save(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Shutdown><td><code><a href=#fn_instance.Shutdown>instance.Shutdown(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ShutdownSave><td><code><a href=#fn_instance.ShutdownSave>instance.ShutdownSave(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ShutdownNoSave><td><code><a href=#fn_instance.ShutdownNoSave>instance.ShutdownNoSave(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SlaveOf><td><code><a href=#fn_instance.SlaveOf>instance.SlaveOf(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SlowLogGet><td><code><a href=#fn_instance.SlowLogGet>instance.SlowLogGet(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Time><td><code><a href=#fn_instance.Time>instance.Time(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.DebugObject><td><code><a href=#fn_instance.DebugObject>instance.DebugObject(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ReadOnly><td><code><a href=#fn_instance.ReadOnly>instance.ReadOnly(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ReadWrite><td><code><a href=#fn_instance.ReadWrite>instance.ReadWrite(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.MemoryUsage><td><code><a href=#fn_instance.MemoryUsage>instance.MemoryUsage(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.TxPipelined><td><code><a href=#fn_instance.TxPipelined>instance.TxPipelined(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Pipelined><td><code><a href=#fn_instance.Pipelined>instance.Pipelined(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.EvalRO><td><code><a href=#fn_instance.EvalRO>instance.EvalRO(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.EvalShaRO><td><code><a href=#fn_instance.EvalShaRO>instance.EvalShaRO(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ScriptExists><td><code><a href=#fn_instance.ScriptExists>instance.ScriptExists(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ScriptFlush><td><code><a href=#fn_instance.ScriptFlush>instance.ScriptFlush(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ScriptKill><td><code><a href=#fn_instance.ScriptKill>instance.ScriptKill(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ScriptLoad><td><code><a href=#fn_instance.ScriptLoad>instance.ScriptLoad(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FunctionLoad><td><code><a href=#fn_instance.FunctionLoad>instance.FunctionLoad(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FunctionLoadReplace><td><code><a href=#fn_instance.FunctionLoadReplace>instance.FunctionLoadReplace(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FunctionDelete><td><code><a href=#fn_instance.FunctionDelete>instance.FunctionDelete(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FunctionFlush><td><code><a href=#fn_instance.FunctionFlush>instance.FunctionFlush(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FunctionKill><td><code><a href=#fn_instance.FunctionKill>instance.FunctionKill(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FunctionFlushAsync><td><code><a href=#fn_instance.FunctionFlushAsync>instance.FunctionFlushAsync(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FunctionList><td><code><a href=#fn_instance.FunctionList>instance.FunctionList(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FunctionDump><td><code><a href=#fn_instance.FunctionDump>instance.FunctionDump(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FunctionRestore><td><code><a href=#fn_instance.FunctionRestore>instance.FunctionRestore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FunctionStats><td><code><a href=#fn_instance.FunctionStats>instance.FunctionStats(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FCall><td><code><a href=#fn_instance.FCall>instance.FCall(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FCallRo><td><code><a href=#fn_instance.FCallRo>instance.FCallRo(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.FCallRO><td><code><a href=#fn_instance.FCallRO>instance.FCallRO(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Publish><td><code><a href=#fn_instance.Publish>instance.Publish(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SPublish><td><code><a href=#fn_instance.SPublish>instance.SPublish(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.PubSubChannels><td><code><a href=#fn_instance.PubSubChannels>instance.PubSubChannels(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.PubSubNumSub><td><code><a href=#fn_instance.PubSubNumSub>instance.PubSubNumSub(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.PubSubNumPat><td><code><a href=#fn_instance.PubSubNumPat>instance.PubSubNumPat(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.PubSubShardChannels><td><code><a href=#fn_instance.PubSubShardChannels>instance.PubSubShardChannels(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.PubSubShardNumSub><td><code><a href=#fn_instance.PubSubShardNumSub>instance.PubSubShardNumSub(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterMyShardID><td><code><a href=#fn_instance.ClusterMyShardID>instance.ClusterMyShardID(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterSlots><td><code><a href=#fn_instance.ClusterSlots>instance.ClusterSlots(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterShards><td><code><a href=#fn_instance.ClusterShards>instance.ClusterShards(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterLinks><td><code><a href=#fn_instance.ClusterLinks>instance.ClusterLinks(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterNodes><td><code><a href=#fn_instance.ClusterNodes>instance.ClusterNodes(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterMeet><td><code><a href=#fn_instance.ClusterMeet>instance.ClusterMeet(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterForget><td><code><a href=#fn_instance.ClusterForget>instance.ClusterForget(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterReplicate><td><code><a href=#fn_instance.ClusterReplicate>instance.ClusterReplicate(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterResetSoft><td><code><a href=#fn_instance.ClusterResetSoft>instance.ClusterResetSoft(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterResetHard><td><code><a href=#fn_instance.ClusterResetHard>instance.ClusterResetHard(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterInfo><td><code><a href=#fn_instance.ClusterInfo>instance.ClusterInfo(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterKeySlot><td><code><a href=#fn_instance.ClusterKeySlot>instance.ClusterKeySlot(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterGetKeysInSlot><td><code><a href=#fn_instance.ClusterGetKeysInSlot>instance.ClusterGetKeysInSlot(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterCountFailureReports><td><code><a href=#fn_instance.ClusterCountFailureReports>instance.ClusterCountFailureReports(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterCountKeysInSlot><td><code><a href=#fn_instance.ClusterCountKeysInSlot>instance.ClusterCountKeysInSlot(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterDelSlots><td><code><a href=#fn_instance.ClusterDelSlots>instance.ClusterDelSlots(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterDelSlotsRange><td><code><a href=#fn_instance.ClusterDelSlotsRange>instance.ClusterDelSlotsRange(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterSaveConfig><td><code><a href=#fn_instance.ClusterSaveConfig>instance.ClusterSaveConfig(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterSlaves><td><code><a href=#fn_instance.ClusterSlaves>instance.ClusterSlaves(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterFailover><td><code><a href=#fn_instance.ClusterFailover>instance.ClusterFailover(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterAddSlots><td><code><a href=#fn_instance.ClusterAddSlots>instance.ClusterAddSlots(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ClusterAddSlotsRange><td><code><a href=#fn_instance.ClusterAddSlotsRange>instance.ClusterAddSlotsRange(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.GeoAdd><td><code><a href=#fn_instance.GeoAdd>instance.GeoAdd(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.GeoPos><td><code><a href=#fn_instance.GeoPos>instance.GeoPos(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.GeoRadius><td><code><a href=#fn_instance.GeoRadius>instance.GeoRadius(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.GeoRadiusStore><td><code><a href=#fn_instance.GeoRadiusStore>instance.GeoRadiusStore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.GeoRadiusByMember><td><code><a href=#fn_instance.GeoRadiusByMember>instance.GeoRadiusByMember(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.GeoRadiusByMemberStore><td><code><a href=#fn_instance.GeoRadiusByMemberStore>instance.GeoRadiusByMemberStore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.GeoSearch><td><code><a href=#fn_instance.GeoSearch>instance.GeoSearch(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.GeoSearchLocation><td><code><a href=#fn_instance.GeoSearchLocation>instance.GeoSearchLocation(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.GeoSearchStore><td><code><a href=#fn_instance.GeoSearchStore>instance.GeoSearchStore(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.GeoDist><td><code><a href=#fn_instance.GeoDist>instance.GeoDist(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.GeoHash><td><code><a href=#fn_instance.GeoHash>instance.GeoHash(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ACLDryRun><td><code><a href=#fn_instance.ACLDryRun>instance.ACLDryRun(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.ModuleLoadex><td><code><a href=#fn_instance.ModuleLoadex>instance.ModuleLoadex(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.AddHook><td><code><a href=#fn_instance.AddHook>instance.AddHook(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Watch><td><code><a href=#fn_instance.Watch>instance.Watch(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Do><td><code><a href=#fn_instance.Do>instance.Do(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Process><td><code><a href=#fn_instance.Process>instance.Process(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@83:22><td><code><a href=#fn_@83:22>@83:22(...)</a></code><td><code>github.com/wfusion/gofusion/redis/construct.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.PSubscribe><td><code><a href=#fn_instance.PSubscribe>instance.PSubscribe(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.SSubscribe><td><code><a href=#fn_instance.SSubscribe>instance.SSubscribe(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.Close><td><code><a href=#fn_instance.Close>instance.Close(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_instance.PoolStats><td><code><a href=#fn_instance.PoolStats>instance.PoolStats(...)</a></code><td><code>github.com/wfusion/gofusion/redis/wrap.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_startDaemonRoutines>func startDaemonRoutines</div><div class=info><a href=#s_fn_startDaemonRoutines>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/metrics.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func startDaemonRoutines(ctx context.Context, appName, name string, conf *Conf) {</pre></code><tr><td>32<td><code><pre> ticker := time.Tick(time.Second * 5)</pre></code><tr><td>33<td><code><pre> app := config.Use(appName).AppName()</pre></code><tr><td>34<td><code><pre> labels := []metrics.Label{</pre></code><tr><td>35<td><code><pre> {Key: "config", Value: name},</pre></code><tr><td>36<td><code><pre> {Key: "database", Value: cast.ToString(conf.DB)},</pre></code><tr><td>37<td><code><pre> }</pre></code><tr><td>38<td><code><pre></pre></code><tr><td>39<td><code><pre> log.Printf("%v [Gofusion] %s %s %s metrics start", syscall.Getpid(), app, config.ComponentRedis, name)</pre></code><tr><td>40<td><code><pre> for {</pre></code><tr><td>41<td><code><pre> select {</pre></code><tr><td>42<td><code><pre> case <-ctx.Done():</pre></code><tr><td>43<td><code><pre> log.Printf("%v [Gofusion] %s %s %s metrics exited",</pre></code><tr><td>44<td><code><pre> syscall.Getpid(), app, config.ComponentRedis, name)</pre></code><tr><td>45<td><code><pre> return</pre></code><tr><td>46<td><code><pre> case <-ticker:</pre></code><tr><td>47<td><code><pre> go metricRedisStats(ctx, appName, name, labels)</pre></code><tr><td>48<td><code><pre> go metricRedisLatency(ctx, appName, name, labels)</pre></code><tr><td>49<td><code><pre> }</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre>}</pre></code></table><div class=funcname id=fn_Construct>func Construct</div><div class=info><a href=#s_fn_Construct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/construct.go</code>:</div><table class=listing><tr><td>21<td><code><pre>func Construct(ctx context.Context, confs map[string]*Conf, opts ...utils.OptionExtender) func() {</pre></code><tr><td>22<td><code><pre> opt := utils.ApplyOptions[config.InitOption](opts...)</pre></code><tr><td>23<td><code><pre> optU := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>24<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>25<td><code><pre> opt.AppName = optU.appName</pre></code><tr><td>26<td><code><pre> }</pre></code><tr><td>27<td><code><pre></pre></code><tr><td>28<td><code><pre> for name, conf := range confs {</pre></code><tr><td>29<td><code><pre> addInstance(ctx, name, conf, opt)</pre></code><tr><td>30<td><code><pre> }</pre></code><tr><td>31<td><code><pre> return func() {</pre></code><tr><td>32<td><code><pre> rwlock.Lock()</pre></code><tr><td>33<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>34<td><code><pre></pre></code><tr><td>35<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>36<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>37<td><code><pre> if appInstances != nil {</pre></code><tr><td>38<td><code><pre> for name, instance := range appInstances[opt.AppName] {</pre></code><tr><td>39<td><code><pre> if err := instance.GetProxy().Close(); err != nil {</pre></code><tr><td>40<td><code><pre> log.Printf("%v [Gofusion] %s %s %s close error: %s",</pre></code><tr><td>41<td><code><pre> pid, app, config.ComponentRedis, name, err)</pre></code><tr><td>42<td><code><pre> }</pre></code><tr><td>43<td><code><pre> }</pre></code><tr><td>44<td><code><pre> delete(appInstances, opt.AppName)</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XAdd>func instance.XAdd</div><div class=info><a href=#s_fn_instance.XAdd>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>452<td><code><pre>func (i *instance) XAdd(ctx context.Context, a *rdsDrv.XAddArgs) *rdsDrv.StringCmd {</pre></code><tr><td>453<td><code><pre> return i.GetProxy().XAdd(ctx, a)</pre></code><tr><td>454<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Subscribe>func instance.Subscribe</div><div class=info><a href=#s_fn_instance.Subscribe>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>1015<td><code><pre>func (i *instance) Subscribe(ctx context.Context, channels ...string) *rdsDrv.PubSub {</pre></code><tr><td>1016<td><code><pre> return i.GetProxy().Subscribe(ctx, channels...)</pre></code><tr><td>1017<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/construct.go</code>:</div><table class=listing><tr><td>89<td><code><pre>func init() {</pre></code><tr><td>90<td><code><pre> config.AddComponent(config.ComponentRedis, Construct, config.WithFlag(&flagString))</pre></code><tr><td>91<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/flag.go</code>:</div><table class=listing><tr><td>7<td><code><pre>func init() {</pre></code><tr><td>8<td><code><pre> pflag.StringVarP(&flagString, "redis-config", "", "", "json string for redis config")</pre></code><tr><td>9<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.MGet>func instance.MGet</div><div class=info><a href=#s_fn_instance.MGet>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>182<td><code><pre>func (i *instance) MGet(ctx context.Context, keys ...string) *rdsDrv.SliceCmd {</pre></code><tr><td>183<td><code><pre> return i.GetProxy().MGet(ctx, keys...)</pre></code><tr><td>184<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Set>func instance.Set</div><div class=info><a href=#s_fn_instance.Set>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>191<td><code><pre>func (i *instance) Set(ctx context.Context, key string, value any, expiration time.Duration) *rdsDrv.StatusCmd {</pre></code><tr><td>192<td><code><pre> return i.GetProxy().Set(ctx, key, value, expiration)</pre></code><tr><td>193<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SetNX>func instance.SetNX</div><div class=info><a href=#s_fn_instance.SetNX>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>201<td><code><pre>func (i *instance) SetNX(ctx context.Context, key string, value any, expiration time.Duration) *rdsDrv.BoolCmd {</pre></code><tr><td>202<td><code><pre> return i.GetProxy().SetNX(ctx, key, value, expiration)</pre></code><tr><td>203<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Del>func instance.Del</div><div class=info><a href=#s_fn_instance.Del>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>46<td><code><pre>func (i *instance) Del(ctx context.Context, keys ...string) *rdsDrv.IntCmd {</pre></code><tr><td>47<td><code><pre> return i.GetProxy().Del(ctx, keys...)</pre></code><tr><td>48<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XReadGroup>func instance.XReadGroup</div><div class=info><a href=#s_fn_instance.XReadGroup>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>498<td><code><pre>func (i *instance) XReadGroup(ctx context.Context, a *rdsDrv.XReadGroupArgs) *rdsDrv.XStreamSliceCmd {</pre></code><tr><td>499<td><code><pre> return i.GetProxy().XReadGroup(ctx, a)</pre></code><tr><td>500<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GetProxy>func instance.GetProxy</div><div class=info><a href=#s_fn_instance.GetProxy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/redis.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func (i *instance) GetProxy() rdsDrv.UniversalClient {</pre></code><tr><td>26<td><code><pre> return i.redis.GetProxy()</pre></code><tr><td>27<td><code><pre>}</pre></code></table><div class=funcname id=fn_AppName>func AppName</div><div class=info><a href=#s_fn_AppName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/redis.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func AppName(name string) utils.OptionFunc[useOption] {</pre></code><tr><td>39<td><code><pre> return func(o *useOption) {</pre></code><tr><td>40<td><code><pre> o.appName = name</pre></code><tr><td>41<td><code><pre> }</pre></code><tr><td>42<td><code><pre>}</pre></code></table><div class=funcname id=fn_@39:9>func @39:9</div><div class=info><a href=#s_fn_@39:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/redis.go</code>:</div><table class=listing><tr><td>39<td><code><pre>func(o *useOption) {</pre></code><tr><td>40<td><code><pre> o.appName = name</pre></code><tr><td>41<td><code><pre> }</pre></code></table><div class=funcname id=fn_instance.SAdd>func instance.SAdd</div><div class=info><a href=#s_fn_instance.SAdd>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>395<td><code><pre>func (i *instance) SAdd(ctx context.Context, key string, members ...any) *rdsDrv.IntCmd {</pre></code><tr><td>396<td><code><pre> return i.GetProxy().SAdd(ctx, key, members...)</pre></code><tr><td>397<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Pipeline>func instance.Pipeline</div><div class=info><a href=#s_fn_instance.Pipeline>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>10<td><code><pre>func (i *instance) Pipeline() rdsDrv.Pipeliner {</pre></code><tr><td>11<td><code><pre> return i.GetProxy().Pipeline()</pre></code><tr><td>12<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Get>func instance.Get</div><div class=info><a href=#s_fn_instance.Get>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>158<td><code><pre>func (i *instance) Get(ctx context.Context, key string) *rdsDrv.StringCmd {</pre></code><tr><td>159<td><code><pre> return i.GetProxy().Get(ctx, key)</pre></code><tr><td>160<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Eval>func instance.Eval</div><div class=info><a href=#s_fn_instance.Eval>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>808<td><code><pre>func (i *instance) Eval(ctx context.Context, script string, keys []string, args ...any) *rdsDrv.Cmd {</pre></code><tr><td>809<td><code><pre> return i.GetProxy().Eval(ctx, script, keys, args...)</pre></code><tr><td>810<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRem>func instance.ZRem</div><div class=info><a href=#s_fn_instance.ZRem>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>644<td><code><pre>func (i *instance) ZRem(ctx context.Context, key string, members ...any) *rdsDrv.IntCmd {</pre></code><tr><td>645<td><code><pre> return i.GetProxy().ZRem(ctx, key, members...)</pre></code><tr><td>646<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZAdd>func instance.ZAdd</div><div class=info><a href=#s_fn_instance.ZAdd>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>556<td><code><pre>func (i *instance) ZAdd(ctx context.Context, key string, members ...rdsDrv.Z) *rdsDrv.IntCmd {</pre></code><tr><td>557<td><code><pre> return i.GetProxy().ZAdd(ctx, key, members...)</pre></code><tr><td>558<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XClaim>func instance.XClaim</div><div class=info><a href=#s_fn_instance.XClaim>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>510<td><code><pre>func (i *instance) XClaim(ctx context.Context, a *rdsDrv.XClaimArgs) *rdsDrv.XMessageSliceCmd {</pre></code><tr><td>511<td><code><pre> return i.GetProxy().XClaim(ctx, a)</pre></code><tr><td>512<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XPendingExt>func instance.XPendingExt</div><div class=info><a href=#s_fn_instance.XPendingExt>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>507<td><code><pre>func (i *instance) XPendingExt(ctx context.Context, a *rdsDrv.XPendingExtArgs) *rdsDrv.XPendingExtCmd {</pre></code><tr><td>508<td><code><pre> return i.GetProxy().XPendingExt(ctx, a)</pre></code><tr><td>509<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XAck>func instance.XAck</div><div class=info><a href=#s_fn_instance.XAck>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>501<td><code><pre>func (i *instance) XAck(ctx context.Context, stream, group string, ids ...string) *rdsDrv.IntCmd {</pre></code><tr><td>502<td><code><pre> return i.GetProxy().XAck(ctx, stream, group, ids...)</pre></code><tr><td>503<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XGroupCreateMkStream>func instance.XGroupCreateMkStream</div><div class=info><a href=#s_fn_instance.XGroupCreateMkStream>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>483<td><code><pre>func (i *instance) XGroupCreateMkStream(ctx context.Context, stream, group, start string) *rdsDrv.StatusCmd {</pre></code><tr><td>484<td><code><pre> return i.GetProxy().XGroupCreateMkStream(ctx, stream, group, start)</pre></code><tr><td>485<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.EvalSha>func instance.EvalSha</div><div class=info><a href=#s_fn_instance.EvalSha>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>811<td><code><pre>func (i *instance) EvalSha(ctx context.Context, sha1 string, keys []string, args ...any) *rdsDrv.Cmd {</pre></code><tr><td>812<td><code><pre> return i.GetProxy().EvalSha(ctx, sha1, keys, args...)</pre></code><tr><td>813<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Keys>func instance.Keys</div><div class=info><a href=#s_fn_instance.Keys>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>79<td><code><pre>func (i *instance) Keys(ctx context.Context, pattern string) *rdsDrv.StringSliceCmd {</pre></code><tr><td>80<td><code><pre> return i.GetProxy().Keys(ctx, pattern)</pre></code><tr><td>81<td><code><pre>}</pre></code></table><div class=funcname id=fn_addInstance>func addInstance</div><div class=info><a href=#s_fn_addInstance>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/construct.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func addInstance(ctx context.Context, name string, conf *Conf, opt *config.InitOption) {</pre></code><tr><td>50<td><code><pre> var hooks []rdsDrv.Hook</pre></code><tr><td>51<td><code><pre> for _, hookLoc := range conf.Hooks {</pre></code><tr><td>52<td><code><pre> if hookType := inspect.TypeOf(hookLoc); hookType != nil {</pre></code><tr><td>53<td><code><pre> hookValue := reflect.New(hookType)</pre></code><tr><td>54<td><code><pre> if hookValue.Type().Implements(customLoggerType) {</pre></code><tr><td>55<td><code><pre> logger := fusLog.Use(conf.LogInstance, fusLog.AppName(opt.AppName))</pre></code><tr><td>56<td><code><pre> hookValue.Interface().(customLogger).Init(logger, opt.AppName, name)</pre></code><tr><td>57<td><code><pre> }</pre></code><tr><td>58<td><code><pre></pre></code><tr><td>59<td><code><pre> hooks = append(hooks, hookValue.Interface().(rdsDrv.Hook))</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre> }</pre></code><tr><td>62<td><code><pre></pre></code><tr><td>63<td><code><pre> // conf.Option.Password = config.CryptoDecryptFunc()(conf.Option.Password)</pre></code><tr><td>64<td><code><pre> rdsCli, err := redis.Default.New(ctx, conf.Option, redis.WithHook(hooks))</pre></code><tr><td>65<td><code><pre> if err != nil {</pre></code><tr class=miss><td>66<td><code><pre> panic(err)</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre></pre></code><tr><td>69<td><code><pre> rwlock.Lock()</pre></code><tr><td>70<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>71<td><code><pre> if appInstances == nil {</pre></code><tr><td>72<td><code><pre> appInstances = make(map[string]map[string]*instance)</pre></code><tr><td>73<td><code><pre> }</pre></code><tr><td>74<td><code><pre> if appInstances[opt.AppName] == nil {</pre></code><tr><td>75<td><code><pre> appInstances[opt.AppName] = make(map[string]*instance)</pre></code><tr><td>76<td><code><pre> }</pre></code><tr><td>77<td><code><pre> if _, ok := appInstances[opt.AppName][name]; ok {</pre></code><tr class=miss><td>78<td><code><pre> panic(ErrDuplicatedName)</pre></code><tr><td>79<td><code><pre> }</pre></code><tr><td>80<td><code><pre> appInstances[opt.AppName][name] = &instance{name: name, redis: rdsCli}</pre></code><tr><td>81<td><code><pre></pre></code><tr><td>82<td><code><pre> if opt.DI != nil {</pre></code><tr><td>83<td><code><pre> opt.DI.MustProvide(func() rdsDrv.UniversalClient { return Use(ctx, name, AppName(opt.AppName)) }, di.Name(name))</pre></code><tr><td>84<td><code><pre> }</pre></code><tr><td>85<td><code><pre></pre></code><tr><td>86<td><code><pre> go startDaemonRoutines(ctx, opt.AppName, name, conf)</pre></code><tr><td>87<td><code><pre>}</pre></code></table><div class=funcname id=fn_@31:9>func @31:9</div><div class=info><a href=#s_fn_@31:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/construct.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func() {</pre></code><tr><td>32<td><code><pre> rwlock.Lock()</pre></code><tr><td>33<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>34<td><code><pre></pre></code><tr><td>35<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>36<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>37<td><code><pre> if appInstances != nil {</pre></code><tr><td>38<td><code><pre> for name, instance := range appInstances[opt.AppName] {</pre></code><tr><td>39<td><code><pre> if err := instance.GetProxy().Close(); err != nil {</pre></code><tr class=miss><td>40<td><code><pre> log.Printf("%v [Gofusion] %s %s %s close error: %s",</pre></code><tr><td>41<td><code><pre> pid, app, config.ComponentRedis, name, err)</pre></code><tr><td>42<td><code><pre> }</pre></code><tr><td>43<td><code><pre> }</pre></code><tr><td>44<td><code><pre> delete(appInstances, opt.AppName)</pre></code><tr><td>45<td><code><pre> }</pre></code><tr><td>46<td><code><pre> }</pre></code></table><div class=funcname id=fn_Use>func Use</div><div class=info><a href=#s_fn_Use>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/redis.go</code>:</div><table class=listing><tr><td>44<td><code><pre>func Use(ctx context.Context, name string, opts ...utils.OptionExtender) rdsDrv.UniversalClient {</pre></code><tr><td>45<td><code><pre> opt := utils.ApplyOptions[useOption](opts...)</pre></code><tr><td>46<td><code><pre></pre></code><tr><td>47<td><code><pre> rwlock.RLock()</pre></code><tr><td>48<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>49<td><code><pre> instances, ok := appInstances[opt.appName]</pre></code><tr><td>50<td><code><pre> if !ok {</pre></code><tr class=miss><td>51<td><code><pre> panic(errors.Errorf("redis instance not found for app: %s", opt.appName))</pre></code><tr><td>52<td><code><pre> }</pre></code><tr><td>53<td><code><pre> instance, ok := instances[name]</pre></code><tr><td>54<td><code><pre> if !ok {</pre></code><tr class=miss><td>55<td><code><pre> panic(errors.Errorf("redis instance not found for name: %s", name))</pre></code><tr><td>56<td><code><pre> }</pre></code><tr><td>57<td><code><pre> return &Redis{UniversalClient: instance, Name: name}</pre></code><tr><td>58<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricRedisLatency>func metricRedisLatency</div><div class=info><a href=#s_fn_metricRedisLatency>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/metrics.go</code>:</div><table class=listing><tr><td>105<td><code><pre>func metricRedisLatency(ctx context.Context, appName, name string, labels []metrics.Label) {</pre></code><tr><td>106<td><code><pre> select {</pre></code><tr><td>107<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>108<td><code><pre> return</pre></code><tr><td>109<td><code><pre> default:</pre></code><tr><td>110<td><code><pre></pre></code><tr><td>111<td><code><pre> }</pre></code><tr><td>112<td><code><pre></pre></code><tr><td>113<td><code><pre> _, _ = utils.Catch(func() {</pre></code><tr><td>114<td><code><pre> rwlock.RLock()</pre></code><tr><td>115<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>116<td><code><pre> instances, ok := appInstances[appName]</pre></code><tr><td>117<td><code><pre> if !ok {</pre></code><tr><td>118<td><code><pre> return</pre></code><tr><td>119<td><code><pre> }</pre></code><tr><td>120<td><code><pre> instance, ok := instances[name]</pre></code><tr><td>121<td><code><pre> if !ok {</pre></code><tr><td>122<td><code><pre> return</pre></code><tr><td>123<td><code><pre> }</pre></code><tr><td>124<td><code><pre></pre></code><tr><td>125<td><code><pre> rdsCli := instance.GetProxy()</pre></code><tr><td>126<td><code><pre> begin := time.Now()</pre></code><tr><td>127<td><code><pre> if err := rdsCli.Ping(ctx); err != nil {</pre></code><tr><td>128<td><code><pre> return</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre></pre></code><tr><td>131<td><code><pre> latency := float64(time.Since(begin)) / float64(time.Millisecond)</pre></code><tr><td>132<td><code><pre> latencyKey := append([]string{config.Use(appName).AppName()}, metricsLatencyKey...)</pre></code><tr><td>133<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr><td>134<td><code><pre> select {</pre></code><tr><td>135<td><code><pre> case <-ctx.Done():</pre></code><tr><td>136<td><code><pre> return</pre></code><tr><td>137<td><code><pre> default:</pre></code><tr><td>138<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr><td>139<td><code><pre> m.AddSample(ctx, latencyKey, latency,</pre></code><tr><td>140<td><code><pre> metrics.Labels(labels),</pre></code><tr><td>141<td><code><pre> metrics.PrometheusBuckets(metricsLatencyBuckets),</pre></code><tr><td>142<td><code><pre> )</pre></code><tr><td>143<td><code><pre> } else {</pre></code><tr><td>144<td><code><pre> m.AddSample(ctx, metricsLatencyKey, latency,</pre></code><tr><td>145<td><code><pre> metrics.Labels(labels),</pre></code><tr><td>146<td><code><pre> metrics.PrometheusBuckets(metricsLatencyBuckets),</pre></code><tr><td>147<td><code><pre> )</pre></code><tr><td>148<td><code><pre> }</pre></code><tr><td>149<td><code><pre> }</pre></code><tr><td>150<td><code><pre> }</pre></code><tr><td>151<td><code><pre> })</pre></code><tr><td>152<td><code><pre>}</pre></code></table><div class=funcname id=fn_metricRedisStats>func metricRedisStats</div><div class=info><a href=#s_fn_metricRedisStats>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/metrics.go</code>:</div><table class=listing><tr><td>53<td><code><pre>func metricRedisStats(ctx context.Context, appName, name string, labels []metrics.Label) {</pre></code><tr><td>54<td><code><pre> select {</pre></code><tr><td>55<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>56<td><code><pre> return</pre></code><tr><td>57<td><code><pre> default:</pre></code><tr><td>58<td><code><pre> }</pre></code><tr><td>59<td><code><pre></pre></code><tr><td>60<td><code><pre> _, _ = utils.Catch(func() {</pre></code><tr><td>61<td><code><pre> rwlock.RLock()</pre></code><tr><td>62<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>63<td><code><pre> _ = appInstances[appName][name].GetProxy()</pre></code><tr><td>64<td><code><pre> instances, ok := appInstances[appName]</pre></code><tr><td>65<td><code><pre> if !ok {</pre></code><tr><td>66<td><code><pre> return</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre> instance, ok := instances[name]</pre></code><tr><td>69<td><code><pre> if !ok {</pre></code><tr><td>70<td><code><pre> return</pre></code><tr><td>71<td><code><pre> }</pre></code><tr><td>72<td><code><pre></pre></code><tr><td>73<td><code><pre> app := config.Use(appName).AppName()</pre></code><tr><td>74<td><code><pre> idleKey := append([]string{app}, metricsPoolIdleKey...)</pre></code><tr><td>75<td><code><pre> staleKey := append([]string{app}, metricsPoolStaleKey...)</pre></code><tr><td>76<td><code><pre> totalKey := append([]string{app}, metricsPoolTotalKey...)</pre></code><tr><td>77<td><code><pre> hitsKey := append([]string{app}, metricsPoolHitsKey...)</pre></code><tr><td>78<td><code><pre> missesKey := append([]string{app}, metricsPoolMissesKey...)</pre></code><tr><td>79<td><code><pre></pre></code><tr><td>80<td><code><pre> rdsCli := instance.GetProxy()</pre></code><tr><td>81<td><code><pre> stats := rdsCli.PoolStats()</pre></code><tr><td>82<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr><td>83<td><code><pre> select {</pre></code><tr><td>84<td><code><pre> case <-ctx.Done():</pre></code><tr><td>85<td><code><pre> return</pre></code><tr><td>86<td><code><pre> default:</pre></code><tr><td>87<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr><td>88<td><code><pre> m.SetGauge(ctx, idleKey, float64(stats.IdleConns), metrics.Labels(labels))</pre></code><tr><td>89<td><code><pre> m.SetGauge(ctx, staleKey, float64(stats.StaleConns), metrics.Labels(labels))</pre></code><tr><td>90<td><code><pre> m.SetGauge(ctx, totalKey, float64(stats.TotalConns), metrics.Labels(labels))</pre></code><tr><td>91<td><code><pre> m.SetGauge(ctx, hitsKey, float64(stats.Hits), metrics.Labels(labels))</pre></code><tr><td>92<td><code><pre> m.SetGauge(ctx, missesKey, float64(stats.Misses), metrics.Labels(labels))</pre></code><tr><td>93<td><code><pre> } else {</pre></code><tr><td>94<td><code><pre> m.SetGauge(ctx, metricsPoolIdleKey, float64(stats.IdleConns), metrics.Labels(labels))</pre></code><tr><td>95<td><code><pre> m.SetGauge(ctx, metricsPoolStaleKey, float64(stats.StaleConns), metrics.Labels(labels))</pre></code><tr><td>96<td><code><pre> m.SetGauge(ctx, metricsPoolTotalKey, float64(stats.TotalConns), metrics.Labels(labels))</pre></code><tr><td>97<td><code><pre> m.SetGauge(ctx, metricsPoolHitsKey, float64(stats.Hits), metrics.Labels(labels))</pre></code><tr><td>98<td><code><pre> m.SetGauge(ctx, metricsPoolMissesKey, float64(stats.Misses), metrics.Labels(labels))</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre> }</pre></code><tr><td>102<td><code><pre> })</pre></code><tr><td>103<td><code><pre>}</pre></code></table><div class=funcname id=fn_@60:21>func @60:21</div><div class=info><a href=#s_fn_@60:21>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/metrics.go</code>:</div><table class=listing><tr><td>60<td><code><pre>func() {</pre></code><tr><td>61<td><code><pre> rwlock.RLock()</pre></code><tr><td>62<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>63<td><code><pre> _ = appInstances[appName][name].GetProxy()</pre></code><tr><td>64<td><code><pre> instances, ok := appInstances[appName]</pre></code><tr><td>65<td><code><pre> if !ok {</pre></code><tr class=miss><td>66<td><code><pre> return</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre> instance, ok := instances[name]</pre></code><tr><td>69<td><code><pre> if !ok {</pre></code><tr class=miss><td>70<td><code><pre> return</pre></code><tr><td>71<td><code><pre> }</pre></code><tr><td>72<td><code><pre></pre></code><tr><td>73<td><code><pre> app := config.Use(appName).AppName()</pre></code><tr><td>74<td><code><pre> idleKey := append([]string{app}, metricsPoolIdleKey...)</pre></code><tr><td>75<td><code><pre> staleKey := append([]string{app}, metricsPoolStaleKey...)</pre></code><tr><td>76<td><code><pre> totalKey := append([]string{app}, metricsPoolTotalKey...)</pre></code><tr><td>77<td><code><pre> hitsKey := append([]string{app}, metricsPoolHitsKey...)</pre></code><tr><td>78<td><code><pre> missesKey := append([]string{app}, metricsPoolMissesKey...)</pre></code><tr><td>79<td><code><pre></pre></code><tr><td>80<td><code><pre> rdsCli := instance.GetProxy()</pre></code><tr><td>81<td><code><pre> stats := rdsCli.PoolStats()</pre></code><tr><td>82<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr class=miss><td>83<td><code><pre> select {</pre></code><tr><td>84<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>85<td><code><pre> return</pre></code><tr><td>86<td><code><pre> default:</pre></code><tr class=miss><td>87<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr class=miss><td>88<td><code><pre> m.SetGauge(ctx, idleKey, float64(stats.IdleConns), metrics.Labels(labels))</pre></code><tr class=miss><td>89<td><code><pre> m.SetGauge(ctx, staleKey, float64(stats.StaleConns), metrics.Labels(labels))</pre></code><tr class=miss><td>90<td><code><pre> m.SetGauge(ctx, totalKey, float64(stats.TotalConns), metrics.Labels(labels))</pre></code><tr class=miss><td>91<td><code><pre> m.SetGauge(ctx, hitsKey, float64(stats.Hits), metrics.Labels(labels))</pre></code><tr class=miss><td>92<td><code><pre> m.SetGauge(ctx, missesKey, float64(stats.Misses), metrics.Labels(labels))</pre></code><tr><td>93<td><code><pre> } else {</pre></code><tr class=miss><td>94<td><code><pre> m.SetGauge(ctx, metricsPoolIdleKey, float64(stats.IdleConns), metrics.Labels(labels))</pre></code><tr class=miss><td>95<td><code><pre> m.SetGauge(ctx, metricsPoolStaleKey, float64(stats.StaleConns), metrics.Labels(labels))</pre></code><tr class=miss><td>96<td><code><pre> m.SetGauge(ctx, metricsPoolTotalKey, float64(stats.TotalConns), metrics.Labels(labels))</pre></code><tr class=miss><td>97<td><code><pre> m.SetGauge(ctx, metricsPoolHitsKey, float64(stats.Hits), metrics.Labels(labels))</pre></code><tr class=miss><td>98<td><code><pre> m.SetGauge(ctx, metricsPoolMissesKey, float64(stats.Misses), metrics.Labels(labels))</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre> }</pre></code><tr><td>101<td><code><pre> }</pre></code><tr><td>102<td><code><pre> }</pre></code></table><div class=funcname id=fn_@113:21>func @113:21</div><div class=info><a href=#s_fn_@113:21>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/metrics.go</code>:</div><table class=listing><tr><td>113<td><code><pre>func() {</pre></code><tr><td>114<td><code><pre> rwlock.RLock()</pre></code><tr><td>115<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>116<td><code><pre> instances, ok := appInstances[appName]</pre></code><tr><td>117<td><code><pre> if !ok {</pre></code><tr class=miss><td>118<td><code><pre> return</pre></code><tr><td>119<td><code><pre> }</pre></code><tr><td>120<td><code><pre> instance, ok := instances[name]</pre></code><tr><td>121<td><code><pre> if !ok {</pre></code><tr class=miss><td>122<td><code><pre> return</pre></code><tr><td>123<td><code><pre> }</pre></code><tr><td>124<td><code><pre></pre></code><tr><td>125<td><code><pre> rdsCli := instance.GetProxy()</pre></code><tr><td>126<td><code><pre> begin := time.Now()</pre></code><tr><td>127<td><code><pre> if err := rdsCli.Ping(ctx); err != nil {</pre></code><tr><td>128<td><code><pre> return</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre></pre></code><tr class=miss><td>131<td><code><pre> latency := float64(time.Since(begin)) / float64(time.Millisecond)</pre></code><tr class=miss><td>132<td><code><pre> latencyKey := append([]string{config.Use(appName).AppName()}, metricsLatencyKey...)</pre></code><tr class=miss><td>133<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr class=miss><td>134<td><code><pre> select {</pre></code><tr><td>135<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>136<td><code><pre> return</pre></code><tr><td>137<td><code><pre> default:</pre></code><tr class=miss><td>138<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr class=miss><td>139<td><code><pre> m.AddSample(ctx, latencyKey, latency,</pre></code><tr><td>140<td><code><pre> metrics.Labels(labels),</pre></code><tr><td>141<td><code><pre> metrics.PrometheusBuckets(metricsLatencyBuckets),</pre></code><tr><td>142<td><code><pre> )</pre></code><tr><td>143<td><code><pre> } else {</pre></code><tr class=miss><td>144<td><code><pre> m.AddSample(ctx, metricsLatencyKey, latency,</pre></code><tr><td>145<td><code><pre> metrics.Labels(labels),</pre></code><tr><td>146<td><code><pre> metrics.PrometheusBuckets(metricsLatencyBuckets),</pre></code><tr><td>147<td><code><pre> )</pre></code><tr><td>148<td><code><pre> }</pre></code><tr><td>149<td><code><pre> }</pre></code><tr><td>150<td><code><pre> }</pre></code><tr><td>151<td><code><pre> }</pre></code></table><div class=funcname id=fn_instance.ObjectIdleTime>func instance.ObjectIdleTime</div><div class=info><a href=#s_fn_instance.ObjectIdleTime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>95<td><code><pre>func (i *instance) ObjectIdleTime(ctx context.Context, key string) *rdsDrv.DurationCmd {</pre></code><tr class=miss><td>96<td><code><pre> return i.GetProxy().ObjectIdleTime(ctx, key)</pre></code><tr><td>97<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ExpireNX>func instance.ExpireNX</div><div class=info><a href=#s_fn_instance.ExpireNX>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>67<td><code><pre>func (i *instance) ExpireNX(ctx context.Context, key string, expiration time.Duration) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>68<td><code><pre> return i.GetProxy().ExpireNX(ctx, key, expiration)</pre></code><tr><td>69<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ExpireXX>func instance.ExpireXX</div><div class=info><a href=#s_fn_instance.ExpireXX>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>70<td><code><pre>func (i *instance) ExpireXX(ctx context.Context, key string, expiration time.Duration) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>71<td><code><pre> return i.GetProxy().ExpireXX(ctx, key, expiration)</pre></code><tr><td>72<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ExpireGT>func instance.ExpireGT</div><div class=info><a href=#s_fn_instance.ExpireGT>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>73<td><code><pre>func (i *instance) ExpireGT(ctx context.Context, key string, expiration time.Duration) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>74<td><code><pre> return i.GetProxy().ExpireGT(ctx, key, expiration)</pre></code><tr><td>75<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ExpireLT>func instance.ExpireLT</div><div class=info><a href=#s_fn_instance.ExpireLT>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>76<td><code><pre>func (i *instance) ExpireLT(ctx context.Context, key string, expiration time.Duration) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>77<td><code><pre> return i.GetProxy().ExpireLT(ctx, key, expiration)</pre></code><tr><td>78<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ExpireTime>func instance.ExpireTime</div><div class=info><a href=#s_fn_instance.ExpireTime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>64<td><code><pre>func (i *instance) ExpireTime(ctx context.Context, key string) *rdsDrv.DurationCmd {</pre></code><tr class=miss><td>65<td><code><pre> return i.GetProxy().ExpireTime(ctx, key)</pre></code><tr><td>66<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Migrate>func instance.Migrate</div><div class=info><a href=#s_fn_instance.Migrate>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>82<td><code><pre>func (i *instance) Migrate(ctx context.Context, host, port, key string, db int,</pre></code><tr><td>83<td><code><pre> timeout time.Duration) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>84<td><code><pre> return i.GetProxy().Migrate(ctx, host, port, key, db, timeout)</pre></code><tr><td>85<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Move>func instance.Move</div><div class=info><a href=#s_fn_instance.Move>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>86<td><code><pre>func (i *instance) Move(ctx context.Context, key string, db int) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>87<td><code><pre> return i.GetProxy().Move(ctx, key, db)</pre></code><tr><td>88<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ObjectRefCount>func instance.ObjectRefCount</div><div class=info><a href=#s_fn_instance.ObjectRefCount>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>89<td><code><pre>func (i *instance) ObjectRefCount(ctx context.Context, key string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>90<td><code><pre> return i.GetProxy().ObjectRefCount(ctx, key)</pre></code><tr><td>91<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ObjectEncoding>func instance.ObjectEncoding</div><div class=info><a href=#s_fn_instance.ObjectEncoding>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>92<td><code><pre>func (i *instance) ObjectEncoding(ctx context.Context, key string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>93<td><code><pre> return i.GetProxy().ObjectEncoding(ctx, key)</pre></code><tr><td>94<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ExpireAt>func instance.ExpireAt</div><div class=info><a href=#s_fn_instance.ExpireAt>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>61<td><code><pre>func (i *instance) ExpireAt(ctx context.Context, key string, tm time.Time) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>62<td><code><pre> return i.GetProxy().ExpireAt(ctx, key, tm)</pre></code><tr><td>63<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Persist>func instance.Persist</div><div class=info><a href=#s_fn_instance.Persist>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>98<td><code><pre>func (i *instance) Persist(ctx context.Context, key string) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>99<td><code><pre> return i.GetProxy().Persist(ctx, key)</pre></code><tr><td>100<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.PExpire>func instance.PExpire</div><div class=info><a href=#s_fn_instance.PExpire>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>101<td><code><pre>func (i *instance) PExpire(ctx context.Context, key string, expiration time.Duration) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>102<td><code><pre> return i.GetProxy().PExpire(ctx, key, expiration)</pre></code><tr><td>103<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.PExpireAt>func instance.PExpireAt</div><div class=info><a href=#s_fn_instance.PExpireAt>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>104<td><code><pre>func (i *instance) PExpireAt(ctx context.Context, key string, tm time.Time) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>105<td><code><pre> return i.GetProxy().PExpireAt(ctx, key, tm)</pre></code><tr><td>106<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.PExpireTime>func instance.PExpireTime</div><div class=info><a href=#s_fn_instance.PExpireTime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>107<td><code><pre>func (i *instance) PExpireTime(ctx context.Context, key string) *rdsDrv.DurationCmd {</pre></code><tr class=miss><td>108<td><code><pre> return i.GetProxy().PExpireTime(ctx, key)</pre></code><tr><td>109<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.PTTL>func instance.PTTL</div><div class=info><a href=#s_fn_instance.PTTL>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>110<td><code><pre>func (i *instance) PTTL(ctx context.Context, key string) *rdsDrv.DurationCmd {</pre></code><tr class=miss><td>111<td><code><pre> return i.GetProxy().PTTL(ctx, key)</pre></code><tr><td>112<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.RandomKey>func instance.RandomKey</div><div class=info><a href=#s_fn_instance.RandomKey>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>113<td><code><pre>func (i *instance) RandomKey(ctx context.Context) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>114<td><code><pre> return i.GetProxy().RandomKey(ctx)</pre></code><tr><td>115<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Rename>func instance.Rename</div><div class=info><a href=#s_fn_instance.Rename>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>116<td><code><pre>func (i *instance) Rename(ctx context.Context, key, newkey string) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>117<td><code><pre> return i.GetProxy().Rename(ctx, key, newkey)</pre></code><tr><td>118<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.RenameNX>func instance.RenameNX</div><div class=info><a href=#s_fn_instance.RenameNX>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>119<td><code><pre>func (i *instance) RenameNX(ctx context.Context, key, newkey string) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>120<td><code><pre> return i.GetProxy().RenameNX(ctx, key, newkey)</pre></code><tr><td>121<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Restore>func instance.Restore</div><div class=info><a href=#s_fn_instance.Restore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>122<td><code><pre>func (i *instance) Restore(ctx context.Context, key string, ttl time.Duration, value string) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>123<td><code><pre> return i.GetProxy().Restore(ctx, key, ttl, value)</pre></code><tr><td>124<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.RestoreReplace>func instance.RestoreReplace</div><div class=info><a href=#s_fn_instance.RestoreReplace>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>125<td><code><pre>func (i *instance) RestoreReplace(ctx context.Context, key string, ttl time.Duration, value string) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>126<td><code><pre> return i.GetProxy().RestoreReplace(ctx, key, ttl, value)</pre></code><tr><td>127<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Sort>func instance.Sort</div><div class=info><a href=#s_fn_instance.Sort>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>128<td><code><pre>func (i *instance) Sort(ctx context.Context, key string, sort *rdsDrv.Sort) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>129<td><code><pre> return i.GetProxy().Sort(ctx, key, sort)</pre></code><tr><td>130<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SortRO>func instance.SortRO</div><div class=info><a href=#s_fn_instance.SortRO>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>131<td><code><pre>func (i *instance) SortRO(ctx context.Context, key string, sort *rdsDrv.Sort) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>132<td><code><pre> return i.GetProxy().SortRO(ctx, key, sort)</pre></code><tr><td>133<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SortStore>func instance.SortStore</div><div class=info><a href=#s_fn_instance.SortStore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>134<td><code><pre>func (i *instance) SortStore(ctx context.Context, key, store string, sort *rdsDrv.Sort) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>135<td><code><pre> return i.GetProxy().SortStore(ctx, key, store, sort)</pre></code><tr><td>136<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SortInterfaces>func instance.SortInterfaces</div><div class=info><a href=#s_fn_instance.SortInterfaces>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>137<td><code><pre>func (i *instance) SortInterfaces(ctx context.Context, key string, sort *rdsDrv.Sort) *rdsDrv.SliceCmd {</pre></code><tr class=miss><td>138<td><code><pre> return i.GetProxy().SortInterfaces(ctx, key, sort)</pre></code><tr><td>139<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Touch>func instance.Touch</div><div class=info><a href=#s_fn_instance.Touch>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>140<td><code><pre>func (i *instance) Touch(ctx context.Context, keys ...string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>141<td><code><pre> return i.GetProxy().Touch(ctx, keys...)</pre></code><tr><td>142<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.TTL>func instance.TTL</div><div class=info><a href=#s_fn_instance.TTL>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>143<td><code><pre>func (i *instance) TTL(ctx context.Context, key string) *rdsDrv.DurationCmd {</pre></code><tr class=miss><td>144<td><code><pre> return i.GetProxy().TTL(ctx, key)</pre></code><tr><td>145<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Type>func instance.Type</div><div class=info><a href=#s_fn_instance.Type>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>146<td><code><pre>func (i *instance) Type(ctx context.Context, key string) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>147<td><code><pre> return i.GetProxy().Type(ctx, key)</pre></code><tr><td>148<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Append>func instance.Append</div><div class=info><a href=#s_fn_instance.Append>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>149<td><code><pre>func (i *instance) Append(ctx context.Context, key, value string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>150<td><code><pre> return i.GetProxy().Append(ctx, key, value)</pre></code><tr><td>151<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Decr>func instance.Decr</div><div class=info><a href=#s_fn_instance.Decr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>152<td><code><pre>func (i *instance) Decr(ctx context.Context, key string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>153<td><code><pre> return i.GetProxy().Decr(ctx, key)</pre></code><tr><td>154<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.DecrBy>func instance.DecrBy</div><div class=info><a href=#s_fn_instance.DecrBy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>155<td><code><pre>func (i *instance) DecrBy(ctx context.Context, key string, decrement int64) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>156<td><code><pre> return i.GetProxy().DecrBy(ctx, key, decrement)</pre></code><tr><td>157<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Expire>func instance.Expire</div><div class=info><a href=#s_fn_instance.Expire>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>58<td><code><pre>func (i *instance) Expire(ctx context.Context, key string, expiration time.Duration) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>59<td><code><pre> return i.GetProxy().Expire(ctx, key, expiration)</pre></code><tr><td>60<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GetRange>func instance.GetRange</div><div class=info><a href=#s_fn_instance.GetRange>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>161<td><code><pre>func (i *instance) GetRange(ctx context.Context, key string, start, end int64) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>162<td><code><pre> return i.GetProxy().GetRange(ctx, key, start, end)</pre></code><tr><td>163<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GetSet>func instance.GetSet</div><div class=info><a href=#s_fn_instance.GetSet>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>164<td><code><pre>func (i *instance) GetSet(ctx context.Context, key string, value any) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>165<td><code><pre> return i.GetProxy().GetSet(ctx, key, value)</pre></code><tr><td>166<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GetEx>func instance.GetEx</div><div class=info><a href=#s_fn_instance.GetEx>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>167<td><code><pre>func (i *instance) GetEx(ctx context.Context, key string, expiration time.Duration) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>168<td><code><pre> return i.GetProxy().GetEx(ctx, key, expiration)</pre></code><tr><td>169<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GetDel>func instance.GetDel</div><div class=info><a href=#s_fn_instance.GetDel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>170<td><code><pre>func (i *instance) GetDel(ctx context.Context, key string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>171<td><code><pre> return i.GetProxy().GetDel(ctx, key)</pre></code><tr><td>172<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Incr>func instance.Incr</div><div class=info><a href=#s_fn_instance.Incr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>173<td><code><pre>func (i *instance) Incr(ctx context.Context, key string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>174<td><code><pre> return i.GetProxy().Incr(ctx, key)</pre></code><tr><td>175<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.IncrBy>func instance.IncrBy</div><div class=info><a href=#s_fn_instance.IncrBy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>176<td><code><pre>func (i *instance) IncrBy(ctx context.Context, key string, value int64) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>177<td><code><pre> return i.GetProxy().IncrBy(ctx, key, value)</pre></code><tr><td>178<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.IncrByFloat>func instance.IncrByFloat</div><div class=info><a href=#s_fn_instance.IncrByFloat>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>179<td><code><pre>func (i *instance) IncrByFloat(ctx context.Context, key string, value float64) *rdsDrv.FloatCmd {</pre></code><tr class=miss><td>180<td><code><pre> return i.GetProxy().IncrByFloat(ctx, key, value)</pre></code><tr><td>181<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Exists>func instance.Exists</div><div class=info><a href=#s_fn_instance.Exists>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>55<td><code><pre>func (i *instance) Exists(ctx context.Context, keys ...string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>56<td><code><pre> return i.GetProxy().Exists(ctx, keys...)</pre></code><tr><td>57<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.MSet>func instance.MSet</div><div class=info><a href=#s_fn_instance.MSet>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>185<td><code><pre>func (i *instance) MSet(ctx context.Context, values ...any) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>186<td><code><pre> return i.GetProxy().MSet(ctx, values...)</pre></code><tr><td>187<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.MSetNX>func instance.MSetNX</div><div class=info><a href=#s_fn_instance.MSetNX>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>188<td><code><pre>func (i *instance) MSetNX(ctx context.Context, values ...any) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>189<td><code><pre> return i.GetProxy().MSetNX(ctx, values...)</pre></code><tr><td>190<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Dump>func instance.Dump</div><div class=info><a href=#s_fn_instance.Dump>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func (i *instance) Dump(ctx context.Context, key string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>53<td><code><pre> return i.GetProxy().Dump(ctx, key)</pre></code><tr><td>54<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SetArgs>func instance.SetArgs</div><div class=info><a href=#s_fn_instance.SetArgs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>194<td><code><pre>func (i *instance) SetArgs(ctx context.Context, key string, value any, a rdsDrv.SetArgs) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>195<td><code><pre> return i.GetProxy().SetArgs(ctx, key, value, a)</pre></code><tr><td>196<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SetEx>func instance.SetEx</div><div class=info><a href=#s_fn_instance.SetEx>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>197<td><code><pre>func (i *instance) SetEx(ctx context.Context, key string, value any,</pre></code><tr><td>198<td><code><pre> expiration time.Duration) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>199<td><code><pre> return i.GetProxy().SetEx(ctx, key, value, expiration)</pre></code><tr><td>200<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Unlink>func instance.Unlink</div><div class=info><a href=#s_fn_instance.Unlink>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func (i *instance) Unlink(ctx context.Context, keys ...string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>50<td><code><pre> return i.GetProxy().Unlink(ctx, keys...)</pre></code><tr><td>51<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SetXX>func instance.SetXX</div><div class=info><a href=#s_fn_instance.SetXX>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>204<td><code><pre>func (i *instance) SetXX(ctx context.Context, key string, value any, expiration time.Duration) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>205<td><code><pre> return i.GetProxy().SetXX(ctx, key, value, expiration)</pre></code><tr><td>206<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SetRange>func instance.SetRange</div><div class=info><a href=#s_fn_instance.SetRange>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>207<td><code><pre>func (i *instance) SetRange(ctx context.Context, key string, offset int64, value string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>208<td><code><pre> return i.GetProxy().SetRange(ctx, key, offset, value)</pre></code><tr><td>209<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.StrLen>func instance.StrLen</div><div class=info><a href=#s_fn_instance.StrLen>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>210<td><code><pre>func (i *instance) StrLen(ctx context.Context, key string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>211<td><code><pre> return i.GetProxy().StrLen(ctx, key)</pre></code><tr><td>212<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Copy>func instance.Copy</div><div class=info><a href=#s_fn_instance.Copy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>213<td><code><pre>func (i *instance) Copy(ctx context.Context, sourceKey string, destKey string, db int, replace bool) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>214<td><code><pre> return i.GetProxy().Copy(ctx, sourceKey, destKey, db, replace)</pre></code><tr><td>215<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GetBit>func instance.GetBit</div><div class=info><a href=#s_fn_instance.GetBit>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>216<td><code><pre>func (i *instance) GetBit(ctx context.Context, key string, offset int64) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>217<td><code><pre> return i.GetProxy().GetBit(ctx, key, offset)</pre></code><tr><td>218<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SetBit>func instance.SetBit</div><div class=info><a href=#s_fn_instance.SetBit>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>219<td><code><pre>func (i *instance) SetBit(ctx context.Context, key string, offset int64, value int) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>220<td><code><pre> return i.GetProxy().SetBit(ctx, key, offset, value)</pre></code><tr><td>221<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BitCount>func instance.BitCount</div><div class=info><a href=#s_fn_instance.BitCount>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>222<td><code><pre>func (i *instance) BitCount(ctx context.Context, key string, bitCount *rdsDrv.BitCount) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>223<td><code><pre> return i.GetProxy().BitCount(ctx, key, bitCount)</pre></code><tr><td>224<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BitOpAnd>func instance.BitOpAnd</div><div class=info><a href=#s_fn_instance.BitOpAnd>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>225<td><code><pre>func (i *instance) BitOpAnd(ctx context.Context, destKey string, keys ...string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>226<td><code><pre> return i.GetProxy().BitOpAnd(ctx, destKey, keys...)</pre></code><tr><td>227<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BitOpOr>func instance.BitOpOr</div><div class=info><a href=#s_fn_instance.BitOpOr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>228<td><code><pre>func (i *instance) BitOpOr(ctx context.Context, destKey string, keys ...string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>229<td><code><pre> return i.GetProxy().BitOpOr(ctx, destKey, keys...)</pre></code><tr><td>230<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BitOpXor>func instance.BitOpXor</div><div class=info><a href=#s_fn_instance.BitOpXor>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>231<td><code><pre>func (i *instance) BitOpXor(ctx context.Context, destKey string, keys ...string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>232<td><code><pre> return i.GetProxy().BitOpXor(ctx, destKey, keys...)</pre></code><tr><td>233<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BitOpNot>func instance.BitOpNot</div><div class=info><a href=#s_fn_instance.BitOpNot>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>234<td><code><pre>func (i *instance) BitOpNot(ctx context.Context, destKey string, key string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>235<td><code><pre> return i.GetProxy().BitOpNot(ctx, destKey, key)</pre></code><tr><td>236<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BitPos>func instance.BitPos</div><div class=info><a href=#s_fn_instance.BitPos>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>237<td><code><pre>func (i *instance) BitPos(ctx context.Context, key string, bit int64, pos ...int64) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>238<td><code><pre> return i.GetProxy().BitPos(ctx, key, bit, pos...)</pre></code><tr><td>239<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BitPosSpan>func instance.BitPosSpan</div><div class=info><a href=#s_fn_instance.BitPosSpan>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>240<td><code><pre>func (i *instance) BitPosSpan(ctx context.Context, key string, bit int8, start, end int64, span string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>241<td><code><pre> return i.GetProxy().BitPosSpan(ctx, key, bit, start, end, span)</pre></code><tr><td>242<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BitField>func instance.BitField</div><div class=info><a href=#s_fn_instance.BitField>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>243<td><code><pre>func (i *instance) BitField(ctx context.Context, key string, args ...any) *rdsDrv.IntSliceCmd {</pre></code><tr class=miss><td>244<td><code><pre> return i.GetProxy().BitField(ctx, key, args...)</pre></code><tr><td>245<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Scan>func instance.Scan</div><div class=info><a href=#s_fn_instance.Scan>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>246<td><code><pre>func (i *instance) Scan(ctx context.Context, cursor uint64, match string, count int64) *rdsDrv.ScanCmd {</pre></code><tr class=miss><td>247<td><code><pre> return i.GetProxy().Scan(ctx, cursor, match, count)</pre></code><tr><td>248<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ScanType>func instance.ScanType</div><div class=info><a href=#s_fn_instance.ScanType>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>249<td><code><pre>func (i *instance) ScanType(ctx context.Context, cursor uint64, match string, count int64,</pre></code><tr><td>250<td><code><pre> keyType string) *rdsDrv.ScanCmd {</pre></code><tr class=miss><td>251<td><code><pre> return i.GetProxy().ScanType(ctx, cursor, match, count, keyType)</pre></code><tr><td>252<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SScan>func instance.SScan</div><div class=info><a href=#s_fn_instance.SScan>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>253<td><code><pre>func (i *instance) SScan(ctx context.Context, key string, cursor uint64, match string, count int64) *rdsDrv.ScanCmd {</pre></code><tr class=miss><td>254<td><code><pre> return i.GetProxy().SScan(ctx, key, cursor, match, count)</pre></code><tr><td>255<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.HScan>func instance.HScan</div><div class=info><a href=#s_fn_instance.HScan>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>256<td><code><pre>func (i *instance) HScan(ctx context.Context, key string, cursor uint64, match string, count int64) *rdsDrv.ScanCmd {</pre></code><tr class=miss><td>257<td><code><pre> return i.GetProxy().HScan(ctx, key, cursor, match, count)</pre></code><tr><td>258<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZScan>func instance.ZScan</div><div class=info><a href=#s_fn_instance.ZScan>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>259<td><code><pre>func (i *instance) ZScan(ctx context.Context, key string, cursor uint64, match string, count int64) *rdsDrv.ScanCmd {</pre></code><tr class=miss><td>260<td><code><pre> return i.GetProxy().ZScan(ctx, key, cursor, match, count)</pre></code><tr><td>261<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.HDel>func instance.HDel</div><div class=info><a href=#s_fn_instance.HDel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>262<td><code><pre>func (i *instance) HDel(ctx context.Context, key string, fields ...string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>263<td><code><pre> return i.GetProxy().HDel(ctx, key, fields...)</pre></code><tr><td>264<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.HExists>func instance.HExists</div><div class=info><a href=#s_fn_instance.HExists>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>265<td><code><pre>func (i *instance) HExists(ctx context.Context, key, field string) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>266<td><code><pre> return i.GetProxy().HExists(ctx, key, field)</pre></code><tr><td>267<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.HGet>func instance.HGet</div><div class=info><a href=#s_fn_instance.HGet>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>268<td><code><pre>func (i *instance) HGet(ctx context.Context, key, field string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>269<td><code><pre> return i.GetProxy().HGet(ctx, key, field)</pre></code><tr><td>270<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.HGetAll>func instance.HGetAll</div><div class=info><a href=#s_fn_instance.HGetAll>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>271<td><code><pre>func (i *instance) HGetAll(ctx context.Context, key string) *rdsDrv.MapStringStringCmd {</pre></code><tr class=miss><td>272<td><code><pre> return i.GetProxy().HGetAll(ctx, key)</pre></code><tr><td>273<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.HIncrBy>func instance.HIncrBy</div><div class=info><a href=#s_fn_instance.HIncrBy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>274<td><code><pre>func (i *instance) HIncrBy(ctx context.Context, key, field string, incr int64) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>275<td><code><pre> return i.GetProxy().HIncrBy(ctx, key, field, incr)</pre></code><tr><td>276<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.HIncrByFloat>func instance.HIncrByFloat</div><div class=info><a href=#s_fn_instance.HIncrByFloat>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>277<td><code><pre>func (i *instance) HIncrByFloat(ctx context.Context, key, field string, incr float64) *rdsDrv.FloatCmd {</pre></code><tr class=miss><td>278<td><code><pre> return i.GetProxy().HIncrByFloat(ctx, key, field, incr)</pre></code><tr><td>279<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.HKeys>func instance.HKeys</div><div class=info><a href=#s_fn_instance.HKeys>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>280<td><code><pre>func (i *instance) HKeys(ctx context.Context, key string) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>281<td><code><pre> return i.GetProxy().HKeys(ctx, key)</pre></code><tr><td>282<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.HLen>func instance.HLen</div><div class=info><a href=#s_fn_instance.HLen>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>283<td><code><pre>func (i *instance) HLen(ctx context.Context, key string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>284<td><code><pre> return i.GetProxy().HLen(ctx, key)</pre></code><tr><td>285<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.HMGet>func instance.HMGet</div><div class=info><a href=#s_fn_instance.HMGet>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>286<td><code><pre>func (i *instance) HMGet(ctx context.Context, key string, fields ...string) *rdsDrv.SliceCmd {</pre></code><tr class=miss><td>287<td><code><pre> return i.GetProxy().HMGet(ctx, key, fields...)</pre></code><tr><td>288<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.HSet>func instance.HSet</div><div class=info><a href=#s_fn_instance.HSet>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>289<td><code><pre>func (i *instance) HSet(ctx context.Context, key string, values ...any) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>290<td><code><pre> return i.GetProxy().HSet(ctx, key, values...)</pre></code><tr><td>291<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.HMSet>func instance.HMSet</div><div class=info><a href=#s_fn_instance.HMSet>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>292<td><code><pre>func (i *instance) HMSet(ctx context.Context, key string, values ...any) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>293<td><code><pre> return i.GetProxy().HMSet(ctx, key, values...)</pre></code><tr><td>294<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.HSetNX>func instance.HSetNX</div><div class=info><a href=#s_fn_instance.HSetNX>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>295<td><code><pre>func (i *instance) HSetNX(ctx context.Context, key, field string, value any) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>296<td><code><pre> return i.GetProxy().HSetNX(ctx, key, field, value)</pre></code><tr><td>297<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.HVals>func instance.HVals</div><div class=info><a href=#s_fn_instance.HVals>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>298<td><code><pre>func (i *instance) HVals(ctx context.Context, key string) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>299<td><code><pre> return i.GetProxy().HVals(ctx, key)</pre></code><tr><td>300<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.HRandField>func instance.HRandField</div><div class=info><a href=#s_fn_instance.HRandField>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>301<td><code><pre>func (i *instance) HRandField(ctx context.Context, key string, count int) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>302<td><code><pre> return i.GetProxy().HRandField(ctx, key, count)</pre></code><tr><td>303<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.HRandFieldWithValues>func instance.HRandFieldWithValues</div><div class=info><a href=#s_fn_instance.HRandFieldWithValues>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>304<td><code><pre>func (i *instance) HRandFieldWithValues(ctx context.Context, key string, count int) *rdsDrv.KeyValueSliceCmd {</pre></code><tr class=miss><td>305<td><code><pre> return i.GetProxy().HRandFieldWithValues(ctx, key, count)</pre></code><tr><td>306<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BLPop>func instance.BLPop</div><div class=info><a href=#s_fn_instance.BLPop>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>307<td><code><pre>func (i *instance) BLPop(ctx context.Context, timeout time.Duration, keys ...string) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>308<td><code><pre> return i.GetProxy().BLPop(ctx, timeout, keys...)</pre></code><tr><td>309<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BLMPop>func instance.BLMPop</div><div class=info><a href=#s_fn_instance.BLMPop>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>310<td><code><pre>func (i *instance) BLMPop(ctx context.Context, timeout time.Duration, direction string,</pre></code><tr><td>311<td><code><pre> count int64, keys ...string) *rdsDrv.KeyValuesCmd {</pre></code><tr class=miss><td>312<td><code><pre> return i.GetProxy().BLMPop(ctx, timeout, direction, count, keys...)</pre></code><tr><td>313<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BRPop>func instance.BRPop</div><div class=info><a href=#s_fn_instance.BRPop>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>314<td><code><pre>func (i *instance) BRPop(ctx context.Context, timeout time.Duration, keys ...string) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>315<td><code><pre> return i.GetProxy().BRPop(ctx, timeout, keys...)</pre></code><tr><td>316<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BRPopLPush>func instance.BRPopLPush</div><div class=info><a href=#s_fn_instance.BRPopLPush>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>317<td><code><pre>func (i *instance) BRPopLPush(ctx context.Context, source, destination string,</pre></code><tr><td>318<td><code><pre> timeout time.Duration) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>319<td><code><pre> return i.GetProxy().BRPopLPush(ctx, source, destination, timeout)</pre></code><tr><td>320<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LCS>func instance.LCS</div><div class=info><a href=#s_fn_instance.LCS>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>321<td><code><pre>func (i *instance) LCS(ctx context.Context, q *rdsDrv.LCSQuery) *rdsDrv.LCSCmd {</pre></code><tr class=miss><td>322<td><code><pre> return i.GetProxy().LCS(ctx, q)</pre></code><tr><td>323<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LIndex>func instance.LIndex</div><div class=info><a href=#s_fn_instance.LIndex>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>324<td><code><pre>func (i *instance) LIndex(ctx context.Context, key string, index int64) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>325<td><code><pre> return i.GetProxy().LIndex(ctx, key, index)</pre></code><tr><td>326<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LMPop>func instance.LMPop</div><div class=info><a href=#s_fn_instance.LMPop>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>327<td><code><pre>func (i *instance) LMPop(ctx context.Context, direction string, count int64, keys ...string) *rdsDrv.KeyValuesCmd {</pre></code><tr class=miss><td>328<td><code><pre> return i.GetProxy().LMPop(ctx, direction, count, keys...)</pre></code><tr><td>329<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LInsert>func instance.LInsert</div><div class=info><a href=#s_fn_instance.LInsert>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>330<td><code><pre>func (i *instance) LInsert(ctx context.Context, key, op string, pivot, value any) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>331<td><code><pre> return i.GetProxy().LInsert(ctx, key, op, pivot, value)</pre></code><tr><td>332<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LInsertBefore>func instance.LInsertBefore</div><div class=info><a href=#s_fn_instance.LInsertBefore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>333<td><code><pre>func (i *instance) LInsertBefore(ctx context.Context, key string, pivot, value any) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>334<td><code><pre> return i.GetProxy().LInsertBefore(ctx, key, pivot, value)</pre></code><tr><td>335<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LInsertAfter>func instance.LInsertAfter</div><div class=info><a href=#s_fn_instance.LInsertAfter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>336<td><code><pre>func (i *instance) LInsertAfter(ctx context.Context, key string, pivot, value any) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>337<td><code><pre> return i.GetProxy().LInsertAfter(ctx, key, pivot, value)</pre></code><tr><td>338<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LLen>func instance.LLen</div><div class=info><a href=#s_fn_instance.LLen>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>339<td><code><pre>func (i *instance) LLen(ctx context.Context, key string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>340<td><code><pre> return i.GetProxy().LLen(ctx, key)</pre></code><tr><td>341<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LPop>func instance.LPop</div><div class=info><a href=#s_fn_instance.LPop>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>342<td><code><pre>func (i *instance) LPop(ctx context.Context, key string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>343<td><code><pre> return i.GetProxy().LPop(ctx, key)</pre></code><tr><td>344<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LPopCount>func instance.LPopCount</div><div class=info><a href=#s_fn_instance.LPopCount>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>345<td><code><pre>func (i *instance) LPopCount(ctx context.Context, key string, count int) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>346<td><code><pre> return i.GetProxy().LPopCount(ctx, key, count)</pre></code><tr><td>347<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LPos>func instance.LPos</div><div class=info><a href=#s_fn_instance.LPos>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>348<td><code><pre>func (i *instance) LPos(ctx context.Context, key string, value string, args rdsDrv.LPosArgs) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>349<td><code><pre> return i.GetProxy().LPos(ctx, key, value, args)</pre></code><tr><td>350<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LPosCount>func instance.LPosCount</div><div class=info><a href=#s_fn_instance.LPosCount>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>351<td><code><pre>func (i *instance) LPosCount(ctx context.Context, key string, value string, count int64,</pre></code><tr><td>352<td><code><pre> args rdsDrv.LPosArgs) *rdsDrv.IntSliceCmd {</pre></code><tr class=miss><td>353<td><code><pre> return i.GetProxy().LPosCount(ctx, key, value, count, args)</pre></code><tr><td>354<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LPush>func instance.LPush</div><div class=info><a href=#s_fn_instance.LPush>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>355<td><code><pre>func (i *instance) LPush(ctx context.Context, key string, values ...any) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>356<td><code><pre> return i.GetProxy().LPush(ctx, key, values...)</pre></code><tr><td>357<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LPushX>func instance.LPushX</div><div class=info><a href=#s_fn_instance.LPushX>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>358<td><code><pre>func (i *instance) LPushX(ctx context.Context, key string, values ...any) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>359<td><code><pre> return i.GetProxy().LPushX(ctx, key, values...)</pre></code><tr><td>360<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LRange>func instance.LRange</div><div class=info><a href=#s_fn_instance.LRange>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>361<td><code><pre>func (i *instance) LRange(ctx context.Context, key string, start, stop int64) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>362<td><code><pre> return i.GetProxy().LRange(ctx, key, start, stop)</pre></code><tr><td>363<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LRem>func instance.LRem</div><div class=info><a href=#s_fn_instance.LRem>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>364<td><code><pre>func (i *instance) LRem(ctx context.Context, key string, count int64, value any) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>365<td><code><pre> return i.GetProxy().LRem(ctx, key, count, value)</pre></code><tr><td>366<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Quit>func instance.Quit</div><div class=info><a href=#s_fn_instance.Quit>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func (i *instance) Quit(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>44<td><code><pre> return i.GetProxy().Quit(ctx)</pre></code><tr><td>45<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LTrim>func instance.LTrim</div><div class=info><a href=#s_fn_instance.LTrim>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>370<td><code><pre>func (i *instance) LTrim(ctx context.Context, key string, start, stop int64) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>371<td><code><pre> return i.GetProxy().LTrim(ctx, key, start, stop)</pre></code><tr><td>372<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.RPop>func instance.RPop</div><div class=info><a href=#s_fn_instance.RPop>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>373<td><code><pre>func (i *instance) RPop(ctx context.Context, key string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>374<td><code><pre> return i.GetProxy().RPop(ctx, key)</pre></code><tr><td>375<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.RPopCount>func instance.RPopCount</div><div class=info><a href=#s_fn_instance.RPopCount>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>376<td><code><pre>func (i *instance) RPopCount(ctx context.Context, key string, count int) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>377<td><code><pre> return i.GetProxy().RPopCount(ctx, key, count)</pre></code><tr><td>378<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.RPopLPush>func instance.RPopLPush</div><div class=info><a href=#s_fn_instance.RPopLPush>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>379<td><code><pre>func (i *instance) RPopLPush(ctx context.Context, source, destination string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>380<td><code><pre> return i.GetProxy().RPopLPush(ctx, source, destination)</pre></code><tr><td>381<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.RPush>func instance.RPush</div><div class=info><a href=#s_fn_instance.RPush>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>382<td><code><pre>func (i *instance) RPush(ctx context.Context, key string, values ...any) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>383<td><code><pre> return i.GetProxy().RPush(ctx, key, values...)</pre></code><tr><td>384<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.RPushX>func instance.RPushX</div><div class=info><a href=#s_fn_instance.RPushX>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>385<td><code><pre>func (i *instance) RPushX(ctx context.Context, key string, values ...any) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>386<td><code><pre> return i.GetProxy().RPushX(ctx, key, values...)</pre></code><tr><td>387<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LMove>func instance.LMove</div><div class=info><a href=#s_fn_instance.LMove>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>388<td><code><pre>func (i *instance) LMove(ctx context.Context, source, destination, srcpos, destpos string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>389<td><code><pre> return i.GetProxy().LMove(ctx, source, destination, srcpos, destpos)</pre></code><tr><td>390<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BLMove>func instance.BLMove</div><div class=info><a href=#s_fn_instance.BLMove>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>391<td><code><pre>func (i *instance) BLMove(ctx context.Context, source, destination, srcpos, destpos string,</pre></code><tr><td>392<td><code><pre> timeout time.Duration) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>393<td><code><pre> return i.GetProxy().BLMove(ctx, source, destination, srcpos, destpos, timeout)</pre></code><tr><td>394<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Ping>func instance.Ping</div><div class=info><a href=#s_fn_instance.Ping>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>40<td><code><pre>func (i *instance) Ping(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>41<td><code><pre> return i.GetProxy().Ping(ctx)</pre></code><tr><td>42<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SCard>func instance.SCard</div><div class=info><a href=#s_fn_instance.SCard>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>398<td><code><pre>func (i *instance) SCard(ctx context.Context, key string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>399<td><code><pre> return i.GetProxy().SCard(ctx, key)</pre></code><tr><td>400<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SDiff>func instance.SDiff</div><div class=info><a href=#s_fn_instance.SDiff>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>401<td><code><pre>func (i *instance) SDiff(ctx context.Context, keys ...string) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>402<td><code><pre> return i.GetProxy().SDiff(ctx, keys...)</pre></code><tr><td>403<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SDiffStore>func instance.SDiffStore</div><div class=info><a href=#s_fn_instance.SDiffStore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>404<td><code><pre>func (i *instance) SDiffStore(ctx context.Context, destination string, keys ...string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>405<td><code><pre> return i.GetProxy().SDiffStore(ctx, destination, keys...)</pre></code><tr><td>406<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SInter>func instance.SInter</div><div class=info><a href=#s_fn_instance.SInter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>407<td><code><pre>func (i *instance) SInter(ctx context.Context, keys ...string) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>408<td><code><pre> return i.GetProxy().SInter(ctx, keys...)</pre></code><tr><td>409<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SInterCard>func instance.SInterCard</div><div class=info><a href=#s_fn_instance.SInterCard>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>410<td><code><pre>func (i *instance) SInterCard(ctx context.Context, limit int64, keys ...string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>411<td><code><pre> return i.GetProxy().SInterCard(ctx, limit, keys...)</pre></code><tr><td>412<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SInterStore>func instance.SInterStore</div><div class=info><a href=#s_fn_instance.SInterStore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>413<td><code><pre>func (i *instance) SInterStore(ctx context.Context, destination string, keys ...string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>414<td><code><pre> return i.GetProxy().SInterStore(ctx, destination, keys...)</pre></code><tr><td>415<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SIsMember>func instance.SIsMember</div><div class=info><a href=#s_fn_instance.SIsMember>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>416<td><code><pre>func (i *instance) SIsMember(ctx context.Context, key string, member any) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>417<td><code><pre> return i.GetProxy().SIsMember(ctx, key, member)</pre></code><tr><td>418<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SMIsMember>func instance.SMIsMember</div><div class=info><a href=#s_fn_instance.SMIsMember>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>419<td><code><pre>func (i *instance) SMIsMember(ctx context.Context, key string, members ...any) *rdsDrv.BoolSliceCmd {</pre></code><tr class=miss><td>420<td><code><pre> return i.GetProxy().SMIsMember(ctx, key, members...)</pre></code><tr><td>421<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SMembers>func instance.SMembers</div><div class=info><a href=#s_fn_instance.SMembers>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>422<td><code><pre>func (i *instance) SMembers(ctx context.Context, key string) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>423<td><code><pre> return i.GetProxy().SMembers(ctx, key)</pre></code><tr><td>424<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SMembersMap>func instance.SMembersMap</div><div class=info><a href=#s_fn_instance.SMembersMap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>425<td><code><pre>func (i *instance) SMembersMap(ctx context.Context, key string) *rdsDrv.StringStructMapCmd {</pre></code><tr class=miss><td>426<td><code><pre> return i.GetProxy().SMembersMap(ctx, key)</pre></code><tr><td>427<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SMove>func instance.SMove</div><div class=info><a href=#s_fn_instance.SMove>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>428<td><code><pre>func (i *instance) SMove(ctx context.Context, source, destination string, member any) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>429<td><code><pre> return i.GetProxy().SMove(ctx, source, destination, member)</pre></code><tr><td>430<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SPop>func instance.SPop</div><div class=info><a href=#s_fn_instance.SPop>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>431<td><code><pre>func (i *instance) SPop(ctx context.Context, key string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>432<td><code><pre> return i.GetProxy().SPop(ctx, key)</pre></code><tr><td>433<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SPopN>func instance.SPopN</div><div class=info><a href=#s_fn_instance.SPopN>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>434<td><code><pre>func (i *instance) SPopN(ctx context.Context, key string, count int64) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>435<td><code><pre> return i.GetProxy().SPopN(ctx, key, count)</pre></code><tr><td>436<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SRandMember>func instance.SRandMember</div><div class=info><a href=#s_fn_instance.SRandMember>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>437<td><code><pre>func (i *instance) SRandMember(ctx context.Context, key string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>438<td><code><pre> return i.GetProxy().SRandMember(ctx, key)</pre></code><tr><td>439<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SRandMemberN>func instance.SRandMemberN</div><div class=info><a href=#s_fn_instance.SRandMemberN>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>440<td><code><pre>func (i *instance) SRandMemberN(ctx context.Context, key string, count int64) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>441<td><code><pre> return i.GetProxy().SRandMemberN(ctx, key, count)</pre></code><tr><td>442<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SRem>func instance.SRem</div><div class=info><a href=#s_fn_instance.SRem>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>443<td><code><pre>func (i *instance) SRem(ctx context.Context, key string, members ...any) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>444<td><code><pre> return i.GetProxy().SRem(ctx, key, members...)</pre></code><tr><td>445<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SUnion>func instance.SUnion</div><div class=info><a href=#s_fn_instance.SUnion>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>446<td><code><pre>func (i *instance) SUnion(ctx context.Context, keys ...string) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>447<td><code><pre> return i.GetProxy().SUnion(ctx, keys...)</pre></code><tr><td>448<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SUnionStore>func instance.SUnionStore</div><div class=info><a href=#s_fn_instance.SUnionStore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>449<td><code><pre>func (i *instance) SUnionStore(ctx context.Context, destination string, keys ...string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>450<td><code><pre> return i.GetProxy().SUnionStore(ctx, destination, keys...)</pre></code><tr><td>451<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Echo>func instance.Echo</div><div class=info><a href=#s_fn_instance.Echo>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>37<td><code><pre>func (i *instance) Echo(ctx context.Context, message any) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>38<td><code><pre> return i.GetProxy().Echo(ctx, message)</pre></code><tr><td>39<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XDel>func instance.XDel</div><div class=info><a href=#s_fn_instance.XDel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>455<td><code><pre>func (i *instance) XDel(ctx context.Context, stream string, ids ...string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>456<td><code><pre> return i.GetProxy().XDel(ctx, stream, ids...)</pre></code><tr><td>457<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XLen>func instance.XLen</div><div class=info><a href=#s_fn_instance.XLen>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>458<td><code><pre>func (i *instance) XLen(ctx context.Context, stream string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>459<td><code><pre> return i.GetProxy().XLen(ctx, stream)</pre></code><tr><td>460<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XRange>func instance.XRange</div><div class=info><a href=#s_fn_instance.XRange>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>461<td><code><pre>func (i *instance) XRange(ctx context.Context, stream, start, stop string) *rdsDrv.XMessageSliceCmd {</pre></code><tr class=miss><td>462<td><code><pre> return i.GetProxy().XRange(ctx, stream, start, stop)</pre></code><tr><td>463<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XRangeN>func instance.XRangeN</div><div class=info><a href=#s_fn_instance.XRangeN>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>464<td><code><pre>func (i *instance) XRangeN(ctx context.Context, stream, start, stop string, count int64) *rdsDrv.XMessageSliceCmd {</pre></code><tr class=miss><td>465<td><code><pre> return i.GetProxy().XRangeN(ctx, stream, start, stop, count)</pre></code><tr><td>466<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XRevRange>func instance.XRevRange</div><div class=info><a href=#s_fn_instance.XRevRange>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>467<td><code><pre>func (i *instance) XRevRange(ctx context.Context, stream string, start, stop string) *rdsDrv.XMessageSliceCmd {</pre></code><tr class=miss><td>468<td><code><pre> return i.GetProxy().XRevRange(ctx, stream, start, stop)</pre></code><tr><td>469<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XRevRangeN>func instance.XRevRangeN</div><div class=info><a href=#s_fn_instance.XRevRangeN>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>470<td><code><pre>func (i *instance) XRevRangeN(ctx context.Context, stream string,</pre></code><tr><td>471<td><code><pre> start, stop string, count int64) *rdsDrv.XMessageSliceCmd {</pre></code><tr class=miss><td>472<td><code><pre> return i.GetProxy().XRevRangeN(ctx, stream, start, stop, count)</pre></code><tr><td>473<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XRead>func instance.XRead</div><div class=info><a href=#s_fn_instance.XRead>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>474<td><code><pre>func (i *instance) XRead(ctx context.Context, a *rdsDrv.XReadArgs) *rdsDrv.XStreamSliceCmd {</pre></code><tr class=miss><td>475<td><code><pre> return i.GetProxy().XRead(ctx, a)</pre></code><tr><td>476<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XReadStreams>func instance.XReadStreams</div><div class=info><a href=#s_fn_instance.XReadStreams>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>477<td><code><pre>func (i *instance) XReadStreams(ctx context.Context, streams ...string) *rdsDrv.XStreamSliceCmd {</pre></code><tr class=miss><td>478<td><code><pre> return i.GetProxy().XReadStreams(ctx, streams...)</pre></code><tr><td>479<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XGroupCreate>func instance.XGroupCreate</div><div class=info><a href=#s_fn_instance.XGroupCreate>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>480<td><code><pre>func (i *instance) XGroupCreate(ctx context.Context, stream, group, start string) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>481<td><code><pre> return i.GetProxy().XGroupCreate(ctx, stream, group, start)</pre></code><tr><td>482<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClientGetName>func instance.ClientGetName</div><div class=info><a href=#s_fn_instance.ClientGetName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>34<td><code><pre>func (i *instance) ClientGetName(ctx context.Context) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>35<td><code><pre> return i.GetProxy().ClientGetName(ctx)</pre></code><tr><td>36<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XGroupSetID>func instance.XGroupSetID</div><div class=info><a href=#s_fn_instance.XGroupSetID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>486<td><code><pre>func (i *instance) XGroupSetID(ctx context.Context, stream, group, start string) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>487<td><code><pre> return i.GetProxy().XGroupSetID(ctx, stream, group, start)</pre></code><tr><td>488<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XGroupDestroy>func instance.XGroupDestroy</div><div class=info><a href=#s_fn_instance.XGroupDestroy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>489<td><code><pre>func (i *instance) XGroupDestroy(ctx context.Context, stream, group string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>490<td><code><pre> return i.GetProxy().XGroupDestroy(ctx, stream, group)</pre></code><tr><td>491<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XGroupCreateConsumer>func instance.XGroupCreateConsumer</div><div class=info><a href=#s_fn_instance.XGroupCreateConsumer>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>492<td><code><pre>func (i *instance) XGroupCreateConsumer(ctx context.Context, stream, group, consumer string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>493<td><code><pre> return i.GetProxy().XGroupCreateConsumer(ctx, stream, group, consumer)</pre></code><tr><td>494<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XGroupDelConsumer>func instance.XGroupDelConsumer</div><div class=info><a href=#s_fn_instance.XGroupDelConsumer>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>495<td><code><pre>func (i *instance) XGroupDelConsumer(ctx context.Context, stream, group, consumer string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>496<td><code><pre> return i.GetProxy().XGroupDelConsumer(ctx, stream, group, consumer)</pre></code><tr><td>497<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LSet>func instance.LSet</div><div class=info><a href=#s_fn_instance.LSet>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>367<td><code><pre>func (i *instance) LSet(ctx context.Context, key string, index int64, value any) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>368<td><code><pre> return i.GetProxy().LSet(ctx, key, index, value)</pre></code><tr><td>369<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.CommandGetKeysAndFlags>func instance.CommandGetKeysAndFlags</div><div class=info><a href=#s_fn_instance.CommandGetKeysAndFlags>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func (i *instance) CommandGetKeysAndFlags(ctx context.Context, commands ...any) *rdsDrv.KeyFlagsCmd {</pre></code><tr class=miss><td>32<td><code><pre> return i.GetProxy().CommandGetKeysAndFlags(ctx, commands...)</pre></code><tr><td>33<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XPending>func instance.XPending</div><div class=info><a href=#s_fn_instance.XPending>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>504<td><code><pre>func (i *instance) XPending(ctx context.Context, stream, group string) *rdsDrv.XPendingCmd {</pre></code><tr class=miss><td>505<td><code><pre> return i.GetProxy().XPending(ctx, stream, group)</pre></code><tr><td>506<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.CommandGetKeys>func instance.CommandGetKeys</div><div class=info><a href=#s_fn_instance.CommandGetKeys>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>28<td><code><pre>func (i *instance) CommandGetKeys(ctx context.Context, commands ...any) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>29<td><code><pre> return i.GetProxy().CommandGetKeys(ctx, commands...)</pre></code><tr><td>30<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.CommandList>func instance.CommandList</div><div class=info><a href=#s_fn_instance.CommandList>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func (i *instance) CommandList(ctx context.Context, filter *rdsDrv.FilterBy) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>26<td><code><pre> return i.GetProxy().CommandList(ctx, filter)</pre></code><tr><td>27<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XClaimJustID>func instance.XClaimJustID</div><div class=info><a href=#s_fn_instance.XClaimJustID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>513<td><code><pre>func (i *instance) XClaimJustID(ctx context.Context, a *rdsDrv.XClaimArgs) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>514<td><code><pre> return i.GetProxy().XClaimJustID(ctx, a)</pre></code><tr><td>515<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XAutoClaim>func instance.XAutoClaim</div><div class=info><a href=#s_fn_instance.XAutoClaim>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>516<td><code><pre>func (i *instance) XAutoClaim(ctx context.Context, a *rdsDrv.XAutoClaimArgs) *rdsDrv.XAutoClaimCmd {</pre></code><tr class=miss><td>517<td><code><pre> return i.GetProxy().XAutoClaim(ctx, a)</pre></code><tr><td>518<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XAutoClaimJustID>func instance.XAutoClaimJustID</div><div class=info><a href=#s_fn_instance.XAutoClaimJustID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>519<td><code><pre>func (i *instance) XAutoClaimJustID(ctx context.Context, a *rdsDrv.XAutoClaimArgs) *rdsDrv.XAutoClaimJustIDCmd {</pre></code><tr class=miss><td>520<td><code><pre> return i.GetProxy().XAutoClaimJustID(ctx, a)</pre></code><tr><td>521<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XTrimMaxLen>func instance.XTrimMaxLen</div><div class=info><a href=#s_fn_instance.XTrimMaxLen>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>522<td><code><pre>func (i *instance) XTrimMaxLen(ctx context.Context, key string, maxLen int64) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>523<td><code><pre> return i.GetProxy().XTrimMaxLen(ctx, key, maxLen)</pre></code><tr><td>524<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XTrimMaxLenApprox>func instance.XTrimMaxLenApprox</div><div class=info><a href=#s_fn_instance.XTrimMaxLenApprox>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>525<td><code><pre>func (i *instance) XTrimMaxLenApprox(ctx context.Context, key string, maxLen, limit int64) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>526<td><code><pre> return i.GetProxy().XTrimMaxLenApprox(ctx, key, maxLen, limit)</pre></code><tr><td>527<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XTrimMinID>func instance.XTrimMinID</div><div class=info><a href=#s_fn_instance.XTrimMinID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>528<td><code><pre>func (i *instance) XTrimMinID(ctx context.Context, key string, minID string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>529<td><code><pre> return i.GetProxy().XTrimMinID(ctx, key, minID)</pre></code><tr><td>530<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XTrimMinIDApprox>func instance.XTrimMinIDApprox</div><div class=info><a href=#s_fn_instance.XTrimMinIDApprox>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>531<td><code><pre>func (i *instance) XTrimMinIDApprox(ctx context.Context, key string, minID string, limit int64) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>532<td><code><pre> return i.GetProxy().XTrimMinIDApprox(ctx, key, minID, limit)</pre></code><tr><td>533<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XInfoGroups>func instance.XInfoGroups</div><div class=info><a href=#s_fn_instance.XInfoGroups>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>534<td><code><pre>func (i *instance) XInfoGroups(ctx context.Context, key string) *rdsDrv.XInfoGroupsCmd {</pre></code><tr class=miss><td>535<td><code><pre> return i.GetProxy().XInfoGroups(ctx, key)</pre></code><tr><td>536<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XInfoStream>func instance.XInfoStream</div><div class=info><a href=#s_fn_instance.XInfoStream>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>537<td><code><pre>func (i *instance) XInfoStream(ctx context.Context, key string) *rdsDrv.XInfoStreamCmd {</pre></code><tr class=miss><td>538<td><code><pre> return i.GetProxy().XInfoStream(ctx, key)</pre></code><tr><td>539<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XInfoStreamFull>func instance.XInfoStreamFull</div><div class=info><a href=#s_fn_instance.XInfoStreamFull>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>540<td><code><pre>func (i *instance) XInfoStreamFull(ctx context.Context, key string, count int) *rdsDrv.XInfoStreamFullCmd {</pre></code><tr class=miss><td>541<td><code><pre> return i.GetProxy().XInfoStreamFull(ctx, key, count)</pre></code><tr><td>542<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.XInfoConsumers>func instance.XInfoConsumers</div><div class=info><a href=#s_fn_instance.XInfoConsumers>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>543<td><code><pre>func (i *instance) XInfoConsumers(ctx context.Context, key string, group string) *rdsDrv.XInfoConsumersCmd {</pre></code><tr class=miss><td>544<td><code><pre> return i.GetProxy().XInfoConsumers(ctx, key, group)</pre></code><tr><td>545<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BZPopMax>func instance.BZPopMax</div><div class=info><a href=#s_fn_instance.BZPopMax>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>546<td><code><pre>func (i *instance) BZPopMax(ctx context.Context, timeout time.Duration, keys ...string) *rdsDrv.ZWithKeyCmd {</pre></code><tr class=miss><td>547<td><code><pre> return i.GetProxy().BZPopMax(ctx, timeout, keys...)</pre></code><tr><td>548<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BZPopMin>func instance.BZPopMin</div><div class=info><a href=#s_fn_instance.BZPopMin>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>549<td><code><pre>func (i *instance) BZPopMin(ctx context.Context, timeout time.Duration, keys ...string) *rdsDrv.ZWithKeyCmd {</pre></code><tr class=miss><td>550<td><code><pre> return i.GetProxy().BZPopMin(ctx, timeout, keys...)</pre></code><tr><td>551<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BZMPop>func instance.BZMPop</div><div class=info><a href=#s_fn_instance.BZMPop>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>552<td><code><pre>func (i *instance) BZMPop(ctx context.Context, timeout time.Duration, order string,</pre></code><tr><td>553<td><code><pre> count int64, keys ...string) *rdsDrv.ZSliceWithKeyCmd {</pre></code><tr class=miss><td>554<td><code><pre> return i.GetProxy().BZMPop(ctx, timeout, order, count, keys...)</pre></code><tr><td>555<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Command>func instance.Command</div><div class=info><a href=#s_fn_instance.Command>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>22<td><code><pre>func (i *instance) Command(ctx context.Context) *rdsDrv.CommandsInfoCmd {</pre></code><tr class=miss><td>23<td><code><pre> return i.GetProxy().Command(ctx)</pre></code><tr><td>24<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZAddLT>func instance.ZAddLT</div><div class=info><a href=#s_fn_instance.ZAddLT>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>559<td><code><pre>func (i *instance) ZAddLT(ctx context.Context, key string, members ...rdsDrv.Z) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>560<td><code><pre> return i.GetProxy().ZAddLT(ctx, key, members...)</pre></code><tr><td>561<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZAddGT>func instance.ZAddGT</div><div class=info><a href=#s_fn_instance.ZAddGT>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>562<td><code><pre>func (i *instance) ZAddGT(ctx context.Context, key string, members ...rdsDrv.Z) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>563<td><code><pre> return i.GetProxy().ZAddGT(ctx, key, members...)</pre></code><tr><td>564<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZAddNX>func instance.ZAddNX</div><div class=info><a href=#s_fn_instance.ZAddNX>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>565<td><code><pre>func (i *instance) ZAddNX(ctx context.Context, key string, members ...rdsDrv.Z) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>566<td><code><pre> return i.GetProxy().ZAddNX(ctx, key, members...)</pre></code><tr><td>567<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZAddXX>func instance.ZAddXX</div><div class=info><a href=#s_fn_instance.ZAddXX>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>568<td><code><pre>func (i *instance) ZAddXX(ctx context.Context, key string, members ...rdsDrv.Z) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>569<td><code><pre> return i.GetProxy().ZAddXX(ctx, key, members...)</pre></code><tr><td>570<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZAddArgs>func instance.ZAddArgs</div><div class=info><a href=#s_fn_instance.ZAddArgs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>571<td><code><pre>func (i *instance) ZAddArgs(ctx context.Context, key string, args rdsDrv.ZAddArgs) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>572<td><code><pre> return i.GetProxy().ZAddArgs(ctx, key, args)</pre></code><tr><td>573<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZAddArgsIncr>func instance.ZAddArgsIncr</div><div class=info><a href=#s_fn_instance.ZAddArgsIncr>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>574<td><code><pre>func (i *instance) ZAddArgsIncr(ctx context.Context, key string, args rdsDrv.ZAddArgs) *rdsDrv.FloatCmd {</pre></code><tr class=miss><td>575<td><code><pre> return i.GetProxy().ZAddArgsIncr(ctx, key, args)</pre></code><tr><td>576<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZCard>func instance.ZCard</div><div class=info><a href=#s_fn_instance.ZCard>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>577<td><code><pre>func (i *instance) ZCard(ctx context.Context, key string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>578<td><code><pre> return i.GetProxy().ZCard(ctx, key)</pre></code><tr><td>579<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZCount>func instance.ZCount</div><div class=info><a href=#s_fn_instance.ZCount>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>580<td><code><pre>func (i *instance) ZCount(ctx context.Context, key, min, max string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>581<td><code><pre> return i.GetProxy().ZCount(ctx, key, min, max)</pre></code><tr><td>582<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZLexCount>func instance.ZLexCount</div><div class=info><a href=#s_fn_instance.ZLexCount>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>583<td><code><pre>func (i *instance) ZLexCount(ctx context.Context, key, min, max string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>584<td><code><pre> return i.GetProxy().ZLexCount(ctx, key, min, max)</pre></code><tr><td>585<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZIncrBy>func instance.ZIncrBy</div><div class=info><a href=#s_fn_instance.ZIncrBy>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>586<td><code><pre>func (i *instance) ZIncrBy(ctx context.Context, key string, increment float64, member string) *rdsDrv.FloatCmd {</pre></code><tr class=miss><td>587<td><code><pre> return i.GetProxy().ZIncrBy(ctx, key, increment, member)</pre></code><tr><td>588<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZInter>func instance.ZInter</div><div class=info><a href=#s_fn_instance.ZInter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>589<td><code><pre>func (i *instance) ZInter(ctx context.Context, store *rdsDrv.ZStore) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>590<td><code><pre> return i.GetProxy().ZInter(ctx, store)</pre></code><tr><td>591<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZInterWithScores>func instance.ZInterWithScores</div><div class=info><a href=#s_fn_instance.ZInterWithScores>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>592<td><code><pre>func (i *instance) ZInterWithScores(ctx context.Context, store *rdsDrv.ZStore) *rdsDrv.ZSliceCmd {</pre></code><tr class=miss><td>593<td><code><pre> return i.GetProxy().ZInterWithScores(ctx, store)</pre></code><tr><td>594<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZInterCard>func instance.ZInterCard</div><div class=info><a href=#s_fn_instance.ZInterCard>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>595<td><code><pre>func (i *instance) ZInterCard(ctx context.Context, limit int64, keys ...string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>596<td><code><pre> return i.GetProxy().ZInterCard(ctx, limit, keys...)</pre></code><tr><td>597<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZInterStore>func instance.ZInterStore</div><div class=info><a href=#s_fn_instance.ZInterStore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>598<td><code><pre>func (i *instance) ZInterStore(ctx context.Context, destination string, store *rdsDrv.ZStore) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>599<td><code><pre> return i.GetProxy().ZInterStore(ctx, destination, store)</pre></code><tr><td>600<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZMPop>func instance.ZMPop</div><div class=info><a href=#s_fn_instance.ZMPop>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>601<td><code><pre>func (i *instance) ZMPop(ctx context.Context, order string, count int64, keys ...string) *rdsDrv.ZSliceWithKeyCmd {</pre></code><tr class=miss><td>602<td><code><pre> return i.GetProxy().ZMPop(ctx, order, count, keys...)</pre></code><tr><td>603<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZMScore>func instance.ZMScore</div><div class=info><a href=#s_fn_instance.ZMScore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>604<td><code><pre>func (i *instance) ZMScore(ctx context.Context, key string, members ...string) *rdsDrv.FloatSliceCmd {</pre></code><tr class=miss><td>605<td><code><pre> return i.GetProxy().ZMScore(ctx, key, members...)</pre></code><tr><td>606<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZPopMax>func instance.ZPopMax</div><div class=info><a href=#s_fn_instance.ZPopMax>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>607<td><code><pre>func (i *instance) ZPopMax(ctx context.Context, key string, count ...int64) *rdsDrv.ZSliceCmd {</pre></code><tr class=miss><td>608<td><code><pre> return i.GetProxy().ZPopMax(ctx, key, count...)</pre></code><tr><td>609<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZPopMin>func instance.ZPopMin</div><div class=info><a href=#s_fn_instance.ZPopMin>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>610<td><code><pre>func (i *instance) ZPopMin(ctx context.Context, key string, count ...int64) *rdsDrv.ZSliceCmd {</pre></code><tr class=miss><td>611<td><code><pre> return i.GetProxy().ZPopMin(ctx, key, count...)</pre></code><tr><td>612<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRange>func instance.ZRange</div><div class=info><a href=#s_fn_instance.ZRange>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>613<td><code><pre>func (i *instance) ZRange(ctx context.Context, key string, start, stop int64) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>614<td><code><pre> return i.GetProxy().ZRange(ctx, key, start, stop)</pre></code><tr><td>615<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRangeWithScores>func instance.ZRangeWithScores</div><div class=info><a href=#s_fn_instance.ZRangeWithScores>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>616<td><code><pre>func (i *instance) ZRangeWithScores(ctx context.Context, key string, start, stop int64) *rdsDrv.ZSliceCmd {</pre></code><tr class=miss><td>617<td><code><pre> return i.GetProxy().ZRangeWithScores(ctx, key, start, stop)</pre></code><tr><td>618<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRangeByScore>func instance.ZRangeByScore</div><div class=info><a href=#s_fn_instance.ZRangeByScore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>619<td><code><pre>func (i *instance) ZRangeByScore(ctx context.Context, key string, opt *rdsDrv.ZRangeBy) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>620<td><code><pre> return i.GetProxy().ZRangeByScore(ctx, key, opt)</pre></code><tr><td>621<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRangeByLex>func instance.ZRangeByLex</div><div class=info><a href=#s_fn_instance.ZRangeByLex>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>622<td><code><pre>func (i *instance) ZRangeByLex(ctx context.Context, key string, opt *rdsDrv.ZRangeBy) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>623<td><code><pre> return i.GetProxy().ZRangeByLex(ctx, key, opt)</pre></code><tr><td>624<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRangeByScoreWithScores>func instance.ZRangeByScoreWithScores</div><div class=info><a href=#s_fn_instance.ZRangeByScoreWithScores>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>625<td><code><pre>func (i *instance) ZRangeByScoreWithScores(ctx context.Context, key string, opt *rdsDrv.ZRangeBy) *rdsDrv.ZSliceCmd {</pre></code><tr class=miss><td>626<td><code><pre> return i.GetProxy().ZRangeByScoreWithScores(ctx, key, opt)</pre></code><tr><td>627<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRangeArgs>func instance.ZRangeArgs</div><div class=info><a href=#s_fn_instance.ZRangeArgs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>628<td><code><pre>func (i *instance) ZRangeArgs(ctx context.Context, z rdsDrv.ZRangeArgs) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>629<td><code><pre> return i.GetProxy().ZRangeArgs(ctx, z)</pre></code><tr><td>630<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRangeArgsWithScores>func instance.ZRangeArgsWithScores</div><div class=info><a href=#s_fn_instance.ZRangeArgsWithScores>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>631<td><code><pre>func (i *instance) ZRangeArgsWithScores(ctx context.Context, z rdsDrv.ZRangeArgs) *rdsDrv.ZSliceCmd {</pre></code><tr class=miss><td>632<td><code><pre> return i.GetProxy().ZRangeArgsWithScores(ctx, z)</pre></code><tr><td>633<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRangeStore>func instance.ZRangeStore</div><div class=info><a href=#s_fn_instance.ZRangeStore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>634<td><code><pre>func (i *instance) ZRangeStore(ctx context.Context, dst string, z rdsDrv.ZRangeArgs) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>635<td><code><pre> return i.GetProxy().ZRangeStore(ctx, dst, z)</pre></code><tr><td>636<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRank>func instance.ZRank</div><div class=info><a href=#s_fn_instance.ZRank>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>637<td><code><pre>func (i *instance) ZRank(ctx context.Context, key, member string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>638<td><code><pre> return i.GetProxy().ZRank(ctx, key, member)</pre></code><tr><td>639<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRankWithScore>func instance.ZRankWithScore</div><div class=info><a href=#s_fn_instance.ZRankWithScore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>640<td><code><pre>func (i *instance) ZRankWithScore(ctx context.Context, key, member string) *rdsDrv.RankWithScoreCmd {</pre></code><tr class=miss><td>641<td><code><pre> return i.GetProxy().ZRankWithScore(ctx, key, member)</pre></code><tr><td>642<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.TxPipeline>func instance.TxPipeline</div><div class=info><a href=#s_fn_instance.TxPipeline>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func (i *instance) TxPipeline() rdsDrv.Pipeliner {</pre></code><tr class=miss><td>20<td><code><pre> return i.GetProxy().TxPipeline()</pre></code><tr><td>21<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRemRangeByRank>func instance.ZRemRangeByRank</div><div class=info><a href=#s_fn_instance.ZRemRangeByRank>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>647<td><code><pre>func (i *instance) ZRemRangeByRank(ctx context.Context, key string, start, stop int64) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>648<td><code><pre> return i.GetProxy().ZRemRangeByRank(ctx, key, start, stop)</pre></code><tr><td>649<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRemRangeByScore>func instance.ZRemRangeByScore</div><div class=info><a href=#s_fn_instance.ZRemRangeByScore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>650<td><code><pre>func (i *instance) ZRemRangeByScore(ctx context.Context, key, min, max string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>651<td><code><pre> return i.GetProxy().ZRemRangeByScore(ctx, key, min, max)</pre></code><tr><td>652<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRemRangeByLex>func instance.ZRemRangeByLex</div><div class=info><a href=#s_fn_instance.ZRemRangeByLex>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>653<td><code><pre>func (i *instance) ZRemRangeByLex(ctx context.Context, key, min, max string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>654<td><code><pre> return i.GetProxy().ZRemRangeByLex(ctx, key, min, max)</pre></code><tr><td>655<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRevRange>func instance.ZRevRange</div><div class=info><a href=#s_fn_instance.ZRevRange>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>656<td><code><pre>func (i *instance) ZRevRange(ctx context.Context, key string, start, stop int64) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>657<td><code><pre> return i.GetProxy().ZRevRange(ctx, key, start, stop)</pre></code><tr><td>658<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRevRangeWithScores>func instance.ZRevRangeWithScores</div><div class=info><a href=#s_fn_instance.ZRevRangeWithScores>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>659<td><code><pre>func (i *instance) ZRevRangeWithScores(ctx context.Context, key string, start, stop int64) *rdsDrv.ZSliceCmd {</pre></code><tr class=miss><td>660<td><code><pre> return i.GetProxy().ZRevRangeWithScores(ctx, key, start, stop)</pre></code><tr><td>661<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRevRangeByScore>func instance.ZRevRangeByScore</div><div class=info><a href=#s_fn_instance.ZRevRangeByScore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>662<td><code><pre>func (i *instance) ZRevRangeByScore(ctx context.Context, key string, opt *rdsDrv.ZRangeBy) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>663<td><code><pre> return i.GetProxy().ZRevRangeByScore(ctx, key, opt)</pre></code><tr><td>664<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRevRangeByLex>func instance.ZRevRangeByLex</div><div class=info><a href=#s_fn_instance.ZRevRangeByLex>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>665<td><code><pre>func (i *instance) ZRevRangeByLex(ctx context.Context, key string, opt *rdsDrv.ZRangeBy) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>666<td><code><pre> return i.GetProxy().ZRevRangeByLex(ctx, key, opt)</pre></code><tr><td>667<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRevRangeByScoreWithScores>func instance.ZRevRangeByScoreWithScores</div><div class=info><a href=#s_fn_instance.ZRevRangeByScoreWithScores>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>668<td><code><pre>func (i *instance) ZRevRangeByScoreWithScores(ctx context.Context, key string, opt *rdsDrv.ZRangeBy) *rdsDrv.ZSliceCmd {</pre></code><tr class=miss><td>669<td><code><pre> return i.GetProxy().ZRevRangeByScoreWithScores(ctx, key, opt)</pre></code><tr><td>670<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRevRank>func instance.ZRevRank</div><div class=info><a href=#s_fn_instance.ZRevRank>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>671<td><code><pre>func (i *instance) ZRevRank(ctx context.Context, key, member string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>672<td><code><pre> return i.GetProxy().ZRevRank(ctx, key, member)</pre></code><tr><td>673<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRevRankWithScore>func instance.ZRevRankWithScore</div><div class=info><a href=#s_fn_instance.ZRevRankWithScore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>674<td><code><pre>func (i *instance) ZRevRankWithScore(ctx context.Context, key, member string) *rdsDrv.RankWithScoreCmd {</pre></code><tr class=miss><td>675<td><code><pre> return i.GetProxy().ZRevRankWithScore(ctx, key, member)</pre></code><tr><td>676<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZScore>func instance.ZScore</div><div class=info><a href=#s_fn_instance.ZScore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>677<td><code><pre>func (i *instance) ZScore(ctx context.Context, key, member string) *rdsDrv.FloatCmd {</pre></code><tr class=miss><td>678<td><code><pre> return i.GetProxy().ZScore(ctx, key, member)</pre></code><tr><td>679<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZUnionStore>func instance.ZUnionStore</div><div class=info><a href=#s_fn_instance.ZUnionStore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>680<td><code><pre>func (i *instance) ZUnionStore(ctx context.Context, dest string, store *rdsDrv.ZStore) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>681<td><code><pre> return i.GetProxy().ZUnionStore(ctx, dest, store)</pre></code><tr><td>682<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRandMember>func instance.ZRandMember</div><div class=info><a href=#s_fn_instance.ZRandMember>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>683<td><code><pre>func (i *instance) ZRandMember(ctx context.Context, key string, count int) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>684<td><code><pre> return i.GetProxy().ZRandMember(ctx, key, count)</pre></code><tr><td>685<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZRandMemberWithScores>func instance.ZRandMemberWithScores</div><div class=info><a href=#s_fn_instance.ZRandMemberWithScores>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>686<td><code><pre>func (i *instance) ZRandMemberWithScores(ctx context.Context, key string, count int) *rdsDrv.ZSliceCmd {</pre></code><tr class=miss><td>687<td><code><pre> return i.GetProxy().ZRandMemberWithScores(ctx, key, count)</pre></code><tr><td>688<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZUnion>func instance.ZUnion</div><div class=info><a href=#s_fn_instance.ZUnion>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>689<td><code><pre>func (i *instance) ZUnion(ctx context.Context, store rdsDrv.ZStore) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>690<td><code><pre> return i.GetProxy().ZUnion(ctx, store)</pre></code><tr><td>691<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZUnionWithScores>func instance.ZUnionWithScores</div><div class=info><a href=#s_fn_instance.ZUnionWithScores>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>692<td><code><pre>func (i *instance) ZUnionWithScores(ctx context.Context, store rdsDrv.ZStore) *rdsDrv.ZSliceCmd {</pre></code><tr class=miss><td>693<td><code><pre> return i.GetProxy().ZUnionWithScores(ctx, store)</pre></code><tr><td>694<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZDiff>func instance.ZDiff</div><div class=info><a href=#s_fn_instance.ZDiff>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>695<td><code><pre>func (i *instance) ZDiff(ctx context.Context, keys ...string) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>696<td><code><pre> return i.GetProxy().ZDiff(ctx, keys...)</pre></code><tr><td>697<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZDiffWithScores>func instance.ZDiffWithScores</div><div class=info><a href=#s_fn_instance.ZDiffWithScores>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>698<td><code><pre>func (i *instance) ZDiffWithScores(ctx context.Context, keys ...string) *rdsDrv.ZSliceCmd {</pre></code><tr class=miss><td>699<td><code><pre> return i.GetProxy().ZDiffWithScores(ctx, keys...)</pre></code><tr><td>700<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ZDiffStore>func instance.ZDiffStore</div><div class=info><a href=#s_fn_instance.ZDiffStore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>701<td><code><pre>func (i *instance) ZDiffStore(ctx context.Context, destination string, keys ...string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>702<td><code><pre> return i.GetProxy().ZDiffStore(ctx, destination, keys...)</pre></code><tr><td>703<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.PFAdd>func instance.PFAdd</div><div class=info><a href=#s_fn_instance.PFAdd>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>704<td><code><pre>func (i *instance) PFAdd(ctx context.Context, key string, els ...any) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>705<td><code><pre> return i.GetProxy().PFAdd(ctx, key, els...)</pre></code><tr><td>706<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.PFCount>func instance.PFCount</div><div class=info><a href=#s_fn_instance.PFCount>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>707<td><code><pre>func (i *instance) PFCount(ctx context.Context, keys ...string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>708<td><code><pre> return i.GetProxy().PFCount(ctx, keys...)</pre></code><tr><td>709<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.PFMerge>func instance.PFMerge</div><div class=info><a href=#s_fn_instance.PFMerge>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>710<td><code><pre>func (i *instance) PFMerge(ctx context.Context, dest string, keys ...string) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>711<td><code><pre> return i.GetProxy().PFMerge(ctx, dest, keys...)</pre></code><tr><td>712<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BgRewriteAOF>func instance.BgRewriteAOF</div><div class=info><a href=#s_fn_instance.BgRewriteAOF>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>713<td><code><pre>func (i *instance) BgRewriteAOF(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>714<td><code><pre> return i.GetProxy().BgRewriteAOF(ctx)</pre></code><tr><td>715<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.BgSave>func instance.BgSave</div><div class=info><a href=#s_fn_instance.BgSave>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>716<td><code><pre>func (i *instance) BgSave(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>717<td><code><pre> return i.GetProxy().BgSave(ctx)</pre></code><tr><td>718<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClientKill>func instance.ClientKill</div><div class=info><a href=#s_fn_instance.ClientKill>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>719<td><code><pre>func (i *instance) ClientKill(ctx context.Context, ipPort string) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>720<td><code><pre> return i.GetProxy().ClientKill(ctx, ipPort)</pre></code><tr><td>721<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClientKillByFilter>func instance.ClientKillByFilter</div><div class=info><a href=#s_fn_instance.ClientKillByFilter>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>722<td><code><pre>func (i *instance) ClientKillByFilter(ctx context.Context, keys ...string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>723<td><code><pre> return i.GetProxy().ClientKillByFilter(ctx, keys...)</pre></code><tr><td>724<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClientList>func instance.ClientList</div><div class=info><a href=#s_fn_instance.ClientList>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>725<td><code><pre>func (i *instance) ClientList(ctx context.Context) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>726<td><code><pre> return i.GetProxy().ClientList(ctx)</pre></code><tr><td>727<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClientPause>func instance.ClientPause</div><div class=info><a href=#s_fn_instance.ClientPause>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>728<td><code><pre>func (i *instance) ClientPause(ctx context.Context, dur time.Duration) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>729<td><code><pre> return i.GetProxy().ClientPause(ctx, dur)</pre></code><tr><td>730<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClientUnpause>func instance.ClientUnpause</div><div class=info><a href=#s_fn_instance.ClientUnpause>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>731<td><code><pre>func (i *instance) ClientUnpause(ctx context.Context) *rdsDrv.BoolCmd {</pre></code><tr class=miss><td>732<td><code><pre> return i.GetProxy().ClientUnpause(ctx)</pre></code><tr><td>733<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClientID>func instance.ClientID</div><div class=info><a href=#s_fn_instance.ClientID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>734<td><code><pre>func (i *instance) ClientID(ctx context.Context) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>735<td><code><pre> return i.GetProxy().ClientID(ctx)</pre></code><tr><td>736<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClientUnblock>func instance.ClientUnblock</div><div class=info><a href=#s_fn_instance.ClientUnblock>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>737<td><code><pre>func (i *instance) ClientUnblock(ctx context.Context, id int64) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>738<td><code><pre> return i.GetProxy().ClientUnblock(ctx, id)</pre></code><tr><td>739<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClientUnblockWithError>func instance.ClientUnblockWithError</div><div class=info><a href=#s_fn_instance.ClientUnblockWithError>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>740<td><code><pre>func (i *instance) ClientUnblockWithError(ctx context.Context, id int64) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>741<td><code><pre> return i.GetProxy().ClientUnblockWithError(ctx, id)</pre></code><tr><td>742<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClientInfo>func instance.ClientInfo</div><div class=info><a href=#s_fn_instance.ClientInfo>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>743<td><code><pre>func (i *instance) ClientInfo(ctx context.Context) *rdsDrv.ClientInfoCmd {</pre></code><tr class=miss><td>744<td><code><pre> return i.GetProxy().ClientInfo(ctx)</pre></code><tr><td>745<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ConfigGet>func instance.ConfigGet</div><div class=info><a href=#s_fn_instance.ConfigGet>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>746<td><code><pre>func (i *instance) ConfigGet(ctx context.Context, parameter string) *rdsDrv.MapStringStringCmd {</pre></code><tr class=miss><td>747<td><code><pre> return i.GetProxy().ConfigGet(ctx, parameter)</pre></code><tr><td>748<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ConfigResetStat>func instance.ConfigResetStat</div><div class=info><a href=#s_fn_instance.ConfigResetStat>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>749<td><code><pre>func (i *instance) ConfigResetStat(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>750<td><code><pre> return i.GetProxy().ConfigResetStat(ctx)</pre></code><tr><td>751<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ConfigSet>func instance.ConfigSet</div><div class=info><a href=#s_fn_instance.ConfigSet>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>752<td><code><pre>func (i *instance) ConfigSet(ctx context.Context, parameter, value string) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>753<td><code><pre> return i.GetProxy().ConfigSet(ctx, parameter, value)</pre></code><tr><td>754<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ConfigRewrite>func instance.ConfigRewrite</div><div class=info><a href=#s_fn_instance.ConfigRewrite>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>755<td><code><pre>func (i *instance) ConfigRewrite(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>756<td><code><pre> return i.GetProxy().ConfigRewrite(ctx)</pre></code><tr><td>757<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.DBSize>func instance.DBSize</div><div class=info><a href=#s_fn_instance.DBSize>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>758<td><code><pre>func (i *instance) DBSize(ctx context.Context) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>759<td><code><pre> return i.GetProxy().DBSize(ctx)</pre></code><tr><td>760<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FlushAll>func instance.FlushAll</div><div class=info><a href=#s_fn_instance.FlushAll>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>761<td><code><pre>func (i *instance) FlushAll(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>762<td><code><pre> return i.GetProxy().FlushAll(ctx)</pre></code><tr><td>763<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FlushAllAsync>func instance.FlushAllAsync</div><div class=info><a href=#s_fn_instance.FlushAllAsync>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>764<td><code><pre>func (i *instance) FlushAllAsync(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>765<td><code><pre> return i.GetProxy().FlushAllAsync(ctx)</pre></code><tr><td>766<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FlushDB>func instance.FlushDB</div><div class=info><a href=#s_fn_instance.FlushDB>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>767<td><code><pre>func (i *instance) FlushDB(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>768<td><code><pre> return i.GetProxy().FlushDB(ctx)</pre></code><tr><td>769<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FlushDBAsync>func instance.FlushDBAsync</div><div class=info><a href=#s_fn_instance.FlushDBAsync>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>770<td><code><pre>func (i *instance) FlushDBAsync(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>771<td><code><pre> return i.GetProxy().FlushDBAsync(ctx)</pre></code><tr><td>772<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Info>func instance.Info</div><div class=info><a href=#s_fn_instance.Info>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>773<td><code><pre>func (i *instance) Info(ctx context.Context, section ...string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>774<td><code><pre> return i.GetProxy().Info(ctx, section...)</pre></code><tr><td>775<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.LastSave>func instance.LastSave</div><div class=info><a href=#s_fn_instance.LastSave>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>776<td><code><pre>func (i *instance) LastSave(ctx context.Context) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>777<td><code><pre> return i.GetProxy().LastSave(ctx)</pre></code><tr><td>778<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Save>func instance.Save</div><div class=info><a href=#s_fn_instance.Save>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>779<td><code><pre>func (i *instance) Save(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>780<td><code><pre> return i.GetProxy().Save(ctx)</pre></code><tr><td>781<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Shutdown>func instance.Shutdown</div><div class=info><a href=#s_fn_instance.Shutdown>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>782<td><code><pre>func (i *instance) Shutdown(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>783<td><code><pre> return i.GetProxy().Shutdown(ctx)</pre></code><tr><td>784<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ShutdownSave>func instance.ShutdownSave</div><div class=info><a href=#s_fn_instance.ShutdownSave>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>785<td><code><pre>func (i *instance) ShutdownSave(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>786<td><code><pre> return i.GetProxy().ShutdownSave(ctx)</pre></code><tr><td>787<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ShutdownNoSave>func instance.ShutdownNoSave</div><div class=info><a href=#s_fn_instance.ShutdownNoSave>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>788<td><code><pre>func (i *instance) ShutdownNoSave(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>789<td><code><pre> return i.GetProxy().ShutdownNoSave(ctx)</pre></code><tr><td>790<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SlaveOf>func instance.SlaveOf</div><div class=info><a href=#s_fn_instance.SlaveOf>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>791<td><code><pre>func (i *instance) SlaveOf(ctx context.Context, host, port string) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>792<td><code><pre> return i.GetProxy().SlaveOf(ctx, host, port)</pre></code><tr><td>793<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SlowLogGet>func instance.SlowLogGet</div><div class=info><a href=#s_fn_instance.SlowLogGet>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>794<td><code><pre>func (i *instance) SlowLogGet(ctx context.Context, num int64) *rdsDrv.SlowLogCmd {</pre></code><tr class=miss><td>795<td><code><pre> return i.GetProxy().SlowLogGet(ctx, num)</pre></code><tr><td>796<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Time>func instance.Time</div><div class=info><a href=#s_fn_instance.Time>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr class=miss><td>797<td><code><pre>func (i *instance) Time(ctx context.Context) *rdsDrv.TimeCmd { return i.GetProxy().Time(ctx) }</pre></code></table><div class=funcname id=fn_instance.DebugObject>func instance.DebugObject</div><div class=info><a href=#s_fn_instance.DebugObject>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>798<td><code><pre>func (i *instance) DebugObject(ctx context.Context, key string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>799<td><code><pre> return i.GetProxy().DebugObject(ctx, key)</pre></code><tr><td>800<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ReadOnly>func instance.ReadOnly</div><div class=info><a href=#s_fn_instance.ReadOnly>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr class=miss><td>801<td><code><pre>func (i *instance) ReadOnly(ctx context.Context) *rdsDrv.StatusCmd { return i.GetProxy().ReadOnly(ctx) }</pre></code></table><div class=funcname id=fn_instance.ReadWrite>func instance.ReadWrite</div><div class=info><a href=#s_fn_instance.ReadWrite>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>802<td><code><pre>func (i *instance) ReadWrite(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>803<td><code><pre> return i.GetProxy().ReadWrite(ctx)</pre></code><tr><td>804<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.MemoryUsage>func instance.MemoryUsage</div><div class=info><a href=#s_fn_instance.MemoryUsage>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>805<td><code><pre>func (i *instance) MemoryUsage(ctx context.Context, key string, samples ...int) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>806<td><code><pre> return i.GetProxy().MemoryUsage(ctx, key, samples...)</pre></code><tr><td>807<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.TxPipelined>func instance.TxPipelined</div><div class=info><a href=#s_fn_instance.TxPipelined>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func (i *instance) TxPipelined(ctx context.Context, fn func(rdsDrv.Pipeliner) error) ([]rdsDrv.Cmder, error) {</pre></code><tr class=miss><td>17<td><code><pre> return i.GetProxy().TxPipelined(ctx, fn)</pre></code><tr><td>18<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Pipelined>func instance.Pipelined</div><div class=info><a href=#s_fn_instance.Pipelined>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>13<td><code><pre>func (i *instance) Pipelined(ctx context.Context, fn func(rdsDrv.Pipeliner) error) ([]rdsDrv.Cmder, error) {</pre></code><tr class=miss><td>14<td><code><pre> return i.GetProxy().Pipelined(ctx, fn)</pre></code><tr><td>15<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.EvalRO>func instance.EvalRO</div><div class=info><a href=#s_fn_instance.EvalRO>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>814<td><code><pre>func (i *instance) EvalRO(ctx context.Context, script string, keys []string, args ...any) *rdsDrv.Cmd {</pre></code><tr class=miss><td>815<td><code><pre> return i.GetProxy().EvalRO(ctx, script, keys, args...)</pre></code><tr><td>816<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.EvalShaRO>func instance.EvalShaRO</div><div class=info><a href=#s_fn_instance.EvalShaRO>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>817<td><code><pre>func (i *instance) EvalShaRO(ctx context.Context, sha1 string, keys []string, args ...any) *rdsDrv.Cmd {</pre></code><tr class=miss><td>818<td><code><pre> return i.GetProxy().EvalShaRO(ctx, sha1, keys, args...)</pre></code><tr><td>819<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ScriptExists>func instance.ScriptExists</div><div class=info><a href=#s_fn_instance.ScriptExists>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>820<td><code><pre>func (i *instance) ScriptExists(ctx context.Context, hashes ...string) *rdsDrv.BoolSliceCmd {</pre></code><tr class=miss><td>821<td><code><pre> return i.GetProxy().ScriptExists(ctx, hashes...)</pre></code><tr><td>822<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ScriptFlush>func instance.ScriptFlush</div><div class=info><a href=#s_fn_instance.ScriptFlush>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>823<td><code><pre>func (i *instance) ScriptFlush(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>824<td><code><pre> return i.GetProxy().ScriptFlush(ctx)</pre></code><tr><td>825<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ScriptKill>func instance.ScriptKill</div><div class=info><a href=#s_fn_instance.ScriptKill>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>826<td><code><pre>func (i *instance) ScriptKill(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>827<td><code><pre> return i.GetProxy().ScriptKill(ctx)</pre></code><tr><td>828<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ScriptLoad>func instance.ScriptLoad</div><div class=info><a href=#s_fn_instance.ScriptLoad>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>829<td><code><pre>func (i *instance) ScriptLoad(ctx context.Context, script string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>830<td><code><pre> return i.GetProxy().ScriptLoad(ctx, script)</pre></code><tr><td>831<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FunctionLoad>func instance.FunctionLoad</div><div class=info><a href=#s_fn_instance.FunctionLoad>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>832<td><code><pre>func (i *instance) FunctionLoad(ctx context.Context, code string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>833<td><code><pre> return i.GetProxy().FunctionLoad(ctx, code)</pre></code><tr><td>834<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FunctionLoadReplace>func instance.FunctionLoadReplace</div><div class=info><a href=#s_fn_instance.FunctionLoadReplace>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>835<td><code><pre>func (i *instance) FunctionLoadReplace(ctx context.Context, code string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>836<td><code><pre> return i.GetProxy().FunctionLoadReplace(ctx, code)</pre></code><tr><td>837<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FunctionDelete>func instance.FunctionDelete</div><div class=info><a href=#s_fn_instance.FunctionDelete>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>838<td><code><pre>func (i *instance) FunctionDelete(ctx context.Context, libName string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>839<td><code><pre> return i.GetProxy().FunctionDelete(ctx, libName)</pre></code><tr><td>840<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FunctionFlush>func instance.FunctionFlush</div><div class=info><a href=#s_fn_instance.FunctionFlush>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>841<td><code><pre>func (i *instance) FunctionFlush(ctx context.Context) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>842<td><code><pre> return i.GetProxy().FunctionFlush(ctx)</pre></code><tr><td>843<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FunctionKill>func instance.FunctionKill</div><div class=info><a href=#s_fn_instance.FunctionKill>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>844<td><code><pre>func (i *instance) FunctionKill(ctx context.Context) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>845<td><code><pre> return i.GetProxy().FunctionKill(ctx)</pre></code><tr><td>846<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FunctionFlushAsync>func instance.FunctionFlushAsync</div><div class=info><a href=#s_fn_instance.FunctionFlushAsync>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>847<td><code><pre>func (i *instance) FunctionFlushAsync(ctx context.Context) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>848<td><code><pre> return i.GetProxy().FunctionFlushAsync(ctx)</pre></code><tr><td>849<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FunctionList>func instance.FunctionList</div><div class=info><a href=#s_fn_instance.FunctionList>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>850<td><code><pre>func (i *instance) FunctionList(ctx context.Context, q rdsDrv.FunctionListQuery) *rdsDrv.FunctionListCmd {</pre></code><tr class=miss><td>851<td><code><pre> return i.GetProxy().FunctionList(ctx, q)</pre></code><tr><td>852<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FunctionDump>func instance.FunctionDump</div><div class=info><a href=#s_fn_instance.FunctionDump>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>853<td><code><pre>func (i *instance) FunctionDump(ctx context.Context) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>854<td><code><pre> return i.GetProxy().FunctionDump(ctx)</pre></code><tr><td>855<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FunctionRestore>func instance.FunctionRestore</div><div class=info><a href=#s_fn_instance.FunctionRestore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>856<td><code><pre>func (i *instance) FunctionRestore(ctx context.Context, libDump string) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>857<td><code><pre> return i.GetProxy().FunctionRestore(ctx, libDump)</pre></code><tr><td>858<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FunctionStats>func instance.FunctionStats</div><div class=info><a href=#s_fn_instance.FunctionStats>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>859<td><code><pre>func (i *instance) FunctionStats(ctx context.Context) *rdsDrv.FunctionStatsCmd {</pre></code><tr class=miss><td>860<td><code><pre> return i.GetProxy().FunctionStats(ctx)</pre></code><tr><td>861<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FCall>func instance.FCall</div><div class=info><a href=#s_fn_instance.FCall>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>862<td><code><pre>func (i *instance) FCall(ctx context.Context, function string, keys []string, args ...any) *rdsDrv.Cmd {</pre></code><tr class=miss><td>863<td><code><pre> return i.GetProxy().FCall(ctx, function, keys, args...)</pre></code><tr><td>864<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FCallRo>func instance.FCallRo</div><div class=info><a href=#s_fn_instance.FCallRo>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>865<td><code><pre>func (i *instance) FCallRo(ctx context.Context, function string, keys []string, args ...any) *rdsDrv.Cmd {</pre></code><tr class=miss><td>866<td><code><pre> return i.GetProxy().FCallRo(ctx, function, keys, args...)</pre></code><tr><td>867<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.FCallRO>func instance.FCallRO</div><div class=info><a href=#s_fn_instance.FCallRO>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>868<td><code><pre>func (i *instance) FCallRO(ctx context.Context, function string, keys []string, args ...interface{}) *rdsDrv.Cmd {</pre></code><tr class=miss><td>869<td><code><pre> return i.GetProxy().FCallRO(ctx, function, keys, args...)</pre></code><tr><td>870<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Publish>func instance.Publish</div><div class=info><a href=#s_fn_instance.Publish>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>871<td><code><pre>func (i *instance) Publish(ctx context.Context, channel string, message any) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>872<td><code><pre> return i.GetProxy().Publish(ctx, channel, message)</pre></code><tr><td>873<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SPublish>func instance.SPublish</div><div class=info><a href=#s_fn_instance.SPublish>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>874<td><code><pre>func (i *instance) SPublish(ctx context.Context, channel string, message any) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>875<td><code><pre> return i.GetProxy().SPublish(ctx, channel, message)</pre></code><tr><td>876<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.PubSubChannels>func instance.PubSubChannels</div><div class=info><a href=#s_fn_instance.PubSubChannels>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>877<td><code><pre>func (i *instance) PubSubChannels(ctx context.Context, pattern string) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>878<td><code><pre> return i.GetProxy().PubSubChannels(ctx, pattern)</pre></code><tr><td>879<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.PubSubNumSub>func instance.PubSubNumSub</div><div class=info><a href=#s_fn_instance.PubSubNumSub>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>880<td><code><pre>func (i *instance) PubSubNumSub(ctx context.Context, channels ...string) *rdsDrv.MapStringIntCmd {</pre></code><tr class=miss><td>881<td><code><pre> return i.GetProxy().PubSubNumSub(ctx, channels...)</pre></code><tr><td>882<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.PubSubNumPat>func instance.PubSubNumPat</div><div class=info><a href=#s_fn_instance.PubSubNumPat>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>883<td><code><pre>func (i *instance) PubSubNumPat(ctx context.Context) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>884<td><code><pre> return i.GetProxy().PubSubNumPat(ctx)</pre></code><tr><td>885<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.PubSubShardChannels>func instance.PubSubShardChannels</div><div class=info><a href=#s_fn_instance.PubSubShardChannels>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>886<td><code><pre>func (i *instance) PubSubShardChannels(ctx context.Context, pattern string) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>887<td><code><pre> return i.GetProxy().PubSubShardChannels(ctx, pattern)</pre></code><tr><td>888<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.PubSubShardNumSub>func instance.PubSubShardNumSub</div><div class=info><a href=#s_fn_instance.PubSubShardNumSub>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>889<td><code><pre>func (i *instance) PubSubShardNumSub(ctx context.Context, channels ...string) *rdsDrv.MapStringIntCmd {</pre></code><tr class=miss><td>890<td><code><pre> return i.GetProxy().PubSubShardNumSub(ctx, channels...)</pre></code><tr><td>891<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterMyShardID>func instance.ClusterMyShardID</div><div class=info><a href=#s_fn_instance.ClusterMyShardID>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>892<td><code><pre>func (i *instance) ClusterMyShardID(ctx context.Context) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>893<td><code><pre> return i.GetProxy().ClusterMyShardID(ctx)</pre></code><tr><td>894<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterSlots>func instance.ClusterSlots</div><div class=info><a href=#s_fn_instance.ClusterSlots>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>895<td><code><pre>func (i *instance) ClusterSlots(ctx context.Context) *rdsDrv.ClusterSlotsCmd {</pre></code><tr class=miss><td>896<td><code><pre> return i.GetProxy().ClusterSlots(ctx)</pre></code><tr><td>897<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterShards>func instance.ClusterShards</div><div class=info><a href=#s_fn_instance.ClusterShards>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>898<td><code><pre>func (i *instance) ClusterShards(ctx context.Context) *rdsDrv.ClusterShardsCmd {</pre></code><tr class=miss><td>899<td><code><pre> return i.GetProxy().ClusterShards(ctx)</pre></code><tr><td>900<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterLinks>func instance.ClusterLinks</div><div class=info><a href=#s_fn_instance.ClusterLinks>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>901<td><code><pre>func (i *instance) ClusterLinks(ctx context.Context) *rdsDrv.ClusterLinksCmd {</pre></code><tr class=miss><td>902<td><code><pre> return i.GetProxy().ClusterLinks(ctx)</pre></code><tr><td>903<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterNodes>func instance.ClusterNodes</div><div class=info><a href=#s_fn_instance.ClusterNodes>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>904<td><code><pre>func (i *instance) ClusterNodes(ctx context.Context) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>905<td><code><pre> return i.GetProxy().ClusterNodes(ctx)</pre></code><tr><td>906<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterMeet>func instance.ClusterMeet</div><div class=info><a href=#s_fn_instance.ClusterMeet>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>907<td><code><pre>func (i *instance) ClusterMeet(ctx context.Context, host, port string) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>908<td><code><pre> return i.GetProxy().ClusterMeet(ctx, host, port)</pre></code><tr><td>909<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterForget>func instance.ClusterForget</div><div class=info><a href=#s_fn_instance.ClusterForget>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>910<td><code><pre>func (i *instance) ClusterForget(ctx context.Context, nodeID string) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>911<td><code><pre> return i.GetProxy().ClusterForget(ctx, nodeID)</pre></code><tr><td>912<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterReplicate>func instance.ClusterReplicate</div><div class=info><a href=#s_fn_instance.ClusterReplicate>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>913<td><code><pre>func (i *instance) ClusterReplicate(ctx context.Context, nodeID string) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>914<td><code><pre> return i.GetProxy().ClusterReplicate(ctx, nodeID)</pre></code><tr><td>915<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterResetSoft>func instance.ClusterResetSoft</div><div class=info><a href=#s_fn_instance.ClusterResetSoft>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>916<td><code><pre>func (i *instance) ClusterResetSoft(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>917<td><code><pre> return i.GetProxy().ClusterResetSoft(ctx)</pre></code><tr><td>918<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterResetHard>func instance.ClusterResetHard</div><div class=info><a href=#s_fn_instance.ClusterResetHard>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>919<td><code><pre>func (i *instance) ClusterResetHard(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>920<td><code><pre> return i.GetProxy().ClusterResetHard(ctx)</pre></code><tr><td>921<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterInfo>func instance.ClusterInfo</div><div class=info><a href=#s_fn_instance.ClusterInfo>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>922<td><code><pre>func (i *instance) ClusterInfo(ctx context.Context) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>923<td><code><pre> return i.GetProxy().ClusterInfo(ctx)</pre></code><tr><td>924<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterKeySlot>func instance.ClusterKeySlot</div><div class=info><a href=#s_fn_instance.ClusterKeySlot>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>925<td><code><pre>func (i *instance) ClusterKeySlot(ctx context.Context, key string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>926<td><code><pre> return i.GetProxy().ClusterKeySlot(ctx, key)</pre></code><tr><td>927<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterGetKeysInSlot>func instance.ClusterGetKeysInSlot</div><div class=info><a href=#s_fn_instance.ClusterGetKeysInSlot>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>928<td><code><pre>func (i *instance) ClusterGetKeysInSlot(ctx context.Context, slot int, count int) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>929<td><code><pre> return i.GetProxy().ClusterGetKeysInSlot(ctx, slot, count)</pre></code><tr><td>930<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterCountFailureReports>func instance.ClusterCountFailureReports</div><div class=info><a href=#s_fn_instance.ClusterCountFailureReports>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>931<td><code><pre>func (i *instance) ClusterCountFailureReports(ctx context.Context, nodeID string) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>932<td><code><pre> return i.GetProxy().ClusterCountFailureReports(ctx, nodeID)</pre></code><tr><td>933<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterCountKeysInSlot>func instance.ClusterCountKeysInSlot</div><div class=info><a href=#s_fn_instance.ClusterCountKeysInSlot>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>934<td><code><pre>func (i *instance) ClusterCountKeysInSlot(ctx context.Context, slot int) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>935<td><code><pre> return i.GetProxy().ClusterCountKeysInSlot(ctx, slot)</pre></code><tr><td>936<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterDelSlots>func instance.ClusterDelSlots</div><div class=info><a href=#s_fn_instance.ClusterDelSlots>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>937<td><code><pre>func (i *instance) ClusterDelSlots(ctx context.Context, slots ...int) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>938<td><code><pre> return i.GetProxy().ClusterDelSlots(ctx, slots...)</pre></code><tr><td>939<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterDelSlotsRange>func instance.ClusterDelSlotsRange</div><div class=info><a href=#s_fn_instance.ClusterDelSlotsRange>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>940<td><code><pre>func (i *instance) ClusterDelSlotsRange(ctx context.Context, min, max int) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>941<td><code><pre> return i.GetProxy().ClusterDelSlotsRange(ctx, min, max)</pre></code><tr><td>942<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterSaveConfig>func instance.ClusterSaveConfig</div><div class=info><a href=#s_fn_instance.ClusterSaveConfig>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>943<td><code><pre>func (i *instance) ClusterSaveConfig(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>944<td><code><pre> return i.GetProxy().ClusterSaveConfig(ctx)</pre></code><tr><td>945<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterSlaves>func instance.ClusterSlaves</div><div class=info><a href=#s_fn_instance.ClusterSlaves>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>946<td><code><pre>func (i *instance) ClusterSlaves(ctx context.Context, nodeID string) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>947<td><code><pre> return i.GetProxy().ClusterSlaves(ctx, nodeID)</pre></code><tr><td>948<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterFailover>func instance.ClusterFailover</div><div class=info><a href=#s_fn_instance.ClusterFailover>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>949<td><code><pre>func (i *instance) ClusterFailover(ctx context.Context) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>950<td><code><pre> return i.GetProxy().ClusterFailover(ctx)</pre></code><tr><td>951<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterAddSlots>func instance.ClusterAddSlots</div><div class=info><a href=#s_fn_instance.ClusterAddSlots>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>952<td><code><pre>func (i *instance) ClusterAddSlots(ctx context.Context, slots ...int) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>953<td><code><pre> return i.GetProxy().ClusterAddSlots(ctx, slots...)</pre></code><tr><td>954<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ClusterAddSlotsRange>func instance.ClusterAddSlotsRange</div><div class=info><a href=#s_fn_instance.ClusterAddSlotsRange>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>955<td><code><pre>func (i *instance) ClusterAddSlotsRange(ctx context.Context, min, max int) *rdsDrv.StatusCmd {</pre></code><tr class=miss><td>956<td><code><pre> return i.GetProxy().ClusterAddSlotsRange(ctx, min, max)</pre></code><tr><td>957<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GeoAdd>func instance.GeoAdd</div><div class=info><a href=#s_fn_instance.GeoAdd>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>958<td><code><pre>func (i *instance) GeoAdd(ctx context.Context, key string, geoLocation ...*rdsDrv.GeoLocation) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>959<td><code><pre> return i.GetProxy().GeoAdd(ctx, key, geoLocation...)</pre></code><tr><td>960<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GeoPos>func instance.GeoPos</div><div class=info><a href=#s_fn_instance.GeoPos>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>961<td><code><pre>func (i *instance) GeoPos(ctx context.Context, key string, members ...string) *rdsDrv.GeoPosCmd {</pre></code><tr class=miss><td>962<td><code><pre> return i.GetProxy().GeoPos(ctx, key, members...)</pre></code><tr><td>963<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GeoRadius>func instance.GeoRadius</div><div class=info><a href=#s_fn_instance.GeoRadius>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>964<td><code><pre>func (i *instance) GeoRadius(ctx context.Context, key string, longitude, latitude float64,</pre></code><tr><td>965<td><code><pre> query *rdsDrv.GeoRadiusQuery) *rdsDrv.GeoLocationCmd {</pre></code><tr class=miss><td>966<td><code><pre> return i.GetProxy().GeoRadius(ctx, key, longitude, latitude, query)</pre></code><tr><td>967<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GeoRadiusStore>func instance.GeoRadiusStore</div><div class=info><a href=#s_fn_instance.GeoRadiusStore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>968<td><code><pre>func (i *instance) GeoRadiusStore(ctx context.Context, key string, longitude, latitude float64,</pre></code><tr><td>969<td><code><pre> query *rdsDrv.GeoRadiusQuery) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>970<td><code><pre> return i.GetProxy().GeoRadiusStore(ctx, key, longitude, latitude, query)</pre></code><tr><td>971<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GeoRadiusByMember>func instance.GeoRadiusByMember</div><div class=info><a href=#s_fn_instance.GeoRadiusByMember>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>972<td><code><pre>func (i *instance) GeoRadiusByMember(ctx context.Context, key, member string,</pre></code><tr><td>973<td><code><pre> query *rdsDrv.GeoRadiusQuery) *rdsDrv.GeoLocationCmd {</pre></code><tr class=miss><td>974<td><code><pre> return i.GetProxy().GeoRadiusByMember(ctx, key, member, query)</pre></code><tr><td>975<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GeoRadiusByMemberStore>func instance.GeoRadiusByMemberStore</div><div class=info><a href=#s_fn_instance.GeoRadiusByMemberStore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>976<td><code><pre>func (i *instance) GeoRadiusByMemberStore(ctx context.Context, key, member string,</pre></code><tr><td>977<td><code><pre> query *rdsDrv.GeoRadiusQuery) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>978<td><code><pre> return i.GetProxy().GeoRadiusByMemberStore(ctx, key, member, query)</pre></code><tr><td>979<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GeoSearch>func instance.GeoSearch</div><div class=info><a href=#s_fn_instance.GeoSearch>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>980<td><code><pre>func (i *instance) GeoSearch(ctx context.Context, key string, q *rdsDrv.GeoSearchQuery) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>981<td><code><pre> return i.GetProxy().GeoSearch(ctx, key, q)</pre></code><tr><td>982<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GeoSearchLocation>func instance.GeoSearchLocation</div><div class=info><a href=#s_fn_instance.GeoSearchLocation>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>983<td><code><pre>func (i *instance) GeoSearchLocation(ctx context.Context, key string,</pre></code><tr><td>984<td><code><pre> q *rdsDrv.GeoSearchLocationQuery) *rdsDrv.GeoSearchLocationCmd {</pre></code><tr class=miss><td>985<td><code><pre> return i.GetProxy().GeoSearchLocation(ctx, key, q)</pre></code><tr><td>986<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GeoSearchStore>func instance.GeoSearchStore</div><div class=info><a href=#s_fn_instance.GeoSearchStore>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>987<td><code><pre>func (i *instance) GeoSearchStore(ctx context.Context, key, store string,</pre></code><tr><td>988<td><code><pre> q *rdsDrv.GeoSearchStoreQuery) *rdsDrv.IntCmd {</pre></code><tr class=miss><td>989<td><code><pre> return i.GetProxy().GeoSearchStore(ctx, key, store, q)</pre></code><tr><td>990<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GeoDist>func instance.GeoDist</div><div class=info><a href=#s_fn_instance.GeoDist>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>991<td><code><pre>func (i *instance) GeoDist(ctx context.Context, key string, member1, member2, unit string) *rdsDrv.FloatCmd {</pre></code><tr class=miss><td>992<td><code><pre> return i.GetProxy().GeoDist(ctx, key, member1, member2, unit)</pre></code><tr><td>993<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.GeoHash>func instance.GeoHash</div><div class=info><a href=#s_fn_instance.GeoHash>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>994<td><code><pre>func (i *instance) GeoHash(ctx context.Context, key string, members ...string) *rdsDrv.StringSliceCmd {</pre></code><tr class=miss><td>995<td><code><pre> return i.GetProxy().GeoHash(ctx, key, members...)</pre></code><tr><td>996<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ACLDryRun>func instance.ACLDryRun</div><div class=info><a href=#s_fn_instance.ACLDryRun>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>997<td><code><pre>func (i *instance) ACLDryRun(ctx context.Context, username string, command ...any) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>998<td><code><pre> return i.GetProxy().ACLDryRun(ctx, username, command...)</pre></code><tr><td>999<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.ModuleLoadex>func instance.ModuleLoadex</div><div class=info><a href=#s_fn_instance.ModuleLoadex>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>1000<td><code><pre>func (i *instance) ModuleLoadex(ctx context.Context, conf *rdsDrv.ModuleLoadexConfig) *rdsDrv.StringCmd {</pre></code><tr class=miss><td>1001<td><code><pre> return i.GetProxy().ModuleLoadex(ctx, conf)</pre></code><tr><td>1002<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.AddHook>func instance.AddHook</div><div class=info><a href=#s_fn_instance.AddHook>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>1003<td><code><pre>func (i *instance) AddHook(hk rdsDrv.Hook) {</pre></code><tr class=miss><td>1004<td><code><pre> i.GetProxy().AddHook(hk)</pre></code><tr><td>1005<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Watch>func instance.Watch</div><div class=info><a href=#s_fn_instance.Watch>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>1006<td><code><pre>func (i *instance) Watch(ctx context.Context, fn func(*rdsDrv.Tx) error, keys ...string) error {</pre></code><tr class=miss><td>1007<td><code><pre> return i.GetProxy().Watch(ctx, fn, keys...)</pre></code><tr><td>1008<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Do>func instance.Do</div><div class=info><a href=#s_fn_instance.Do>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>1009<td><code><pre>func (i *instance) Do(ctx context.Context, args ...any) *rdsDrv.Cmd {</pre></code><tr class=miss><td>1010<td><code><pre> return i.GetProxy().Do(ctx, args...)</pre></code><tr><td>1011<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Process>func instance.Process</div><div class=info><a href=#s_fn_instance.Process>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>1012<td><code><pre>func (i *instance) Process(ctx context.Context, cmd rdsDrv.Cmder) error {</pre></code><tr class=miss><td>1013<td><code><pre> return i.GetProxy().Process(ctx, cmd)</pre></code><tr><td>1014<td><code><pre>}</pre></code></table><div class=funcname id=fn_@83:22>func @83:22</div><div class=info><a href=#s_fn_@83:22>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/construct.go</code>:</div><table class=listing><tr class=miss><td>83<td><code><pre>func() rdsDrv.UniversalClient { return Use(ctx, name, AppName(opt.AppName)) }</pre></code></table><div class=funcname id=fn_instance.PSubscribe>func instance.PSubscribe</div><div class=info><a href=#s_fn_instance.PSubscribe>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>1018<td><code><pre>func (i *instance) PSubscribe(ctx context.Context, channels ...string) *rdsDrv.PubSub {</pre></code><tr class=miss><td>1019<td><code><pre> return i.GetProxy().PSubscribe(ctx, channels...)</pre></code><tr><td>1020<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.SSubscribe>func instance.SSubscribe</div><div class=info><a href=#s_fn_instance.SSubscribe>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>1021<td><code><pre>func (i *instance) SSubscribe(ctx context.Context, channels ...string) *rdsDrv.PubSub {</pre></code><tr class=miss><td>1022<td><code><pre> return i.GetProxy().SSubscribe(ctx, channels...)</pre></code><tr><td>1023<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.Close>func instance.Close</div><div class=info><a href=#s_fn_instance.Close>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>1024<td><code><pre>func (i *instance) Close() error {</pre></code><tr class=miss><td>1025<td><code><pre> return i.GetProxy().Close()</pre></code><tr><td>1026<td><code><pre>}</pre></code></table><div class=funcname id=fn_instance.PoolStats>func instance.PoolStats</div><div class=info><a href=#s_fn_instance.PoolStats>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/redis/wrap.go</code>:</div><table class=listing><tr><td>1027<td><code><pre>func (i *instance) PoolStats() *rdsDrv.PoolStats {</pre></code><tr class=miss><td>1028<td><code><pre> return i.GetProxy().PoolStats()</pre></code><tr><td>1029<td><code><pre>}</pre></code></table><div id=pkg_github.com/wfusion/gofusion/routine class=funcname>Package Overview: github.com/wfusion/gofusion/routine 43 <span class=packageTotal>54.1%</span></div><p>Please select a function to see what's left for testing.<table class=overview><tr id=s_fn_Construct><td><code><a href=#fn_Construct>Construct(...)</a></code><td><code>github.com/wfusion/gofusion/routine/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>32/32</code><tr id=s_fn_startDaemonRoutines><td><code><a href=#fn_startDaemonRoutines>startDaemonRoutines(...)</a></code><td><code>github.com/wfusion/gofusion/routine/metrics.go</code><td class=percent><code>100.0%</code><td class=linecount><code>10/10</code><tr id=s_fn_@470:6><td><code><a href=#fn_@470:6>@470:6(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_addRoutine><td><code><a href=#fn_addRoutine>addRoutine(...)</a></code><td><code>github.com/wfusion/gofusion/routine/types.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_@102:9><td><code><a href=#fn_@102:9>@102:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_@62:9><td><code><a href=#fn_@62:9>@62:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>5/5</code><tr id=s_fn_Loop><td><code><a href=#fn_Loop>Loop(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_Promise><td><code><a href=#fn_Promise>Promise(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>4/4</code><tr id=s_fn_@101:10><td><code><a href=#fn_@101:10>@101:10(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_Future.GetChan><td><code><a href=#fn_Future.GetChan>Future.GetChan(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@143:9><td><code><a href=#fn_@143:9>@143:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@61:10><td><code><a href=#fn_@61:10>@61:10(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_addPool><td><code><a href=#fn_addPool>addPool(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@481:17><td><code><a href=#fn_@481:17>@481:17(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_NewPromise><td><code><a href=#fn_NewPromise>NewPromise(...)</a></code><td><code>github.com/wfusion/gofusion/routine/promise.go</code><td class=percent><code>100.0%</code><td class=linecount><code>3/3</code><tr id=s_fn_@329:8><td><code><a href=#fn_@329:8>@329:8(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_Future.OnComplete><td><code><a href=#fn_Future.OnComplete>Future.OnComplete(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_Future.OnCancel><td><code><a href=#fn_Future.OnCancel>Future.OnCancel(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@115:14><td><code><a href=#fn_@115:14>@115:14(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@97:10><td><code><a href=#fn_@97:10>@97:10(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_Future.loadResult><td><code><a href=#fn_Future.loadResult>Future.loadResult(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@142:10><td><code><a href=#fn_@142:10>@142:10(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@240:3><td><code><a href=#fn_@240:3>@240:3(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_configs><td><code><a href=#fn_configs>configs(...)</a></code><td><code>github.com/wfusion/gofusion/routine/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@99:10><td><code><a href=#fn_@99:10>@99:10(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_Future.loadVal><td><code><a href=#fn_Future.loadVal>Future.loadVal(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_@80:15><td><code><a href=#fn_@80:15>@80:15(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_Future.Get><td><code><a href=#fn_Future.Get>Future.Get(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_pool.Release><td><code><a href=#fn_pool.Release>pool.Release(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_Future.OnSuccess><td><code><a href=#fn_Future.OnSuccess>Future.OnSuccess(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_forSlice><td><code><a href=#fn_forSlice>forSlice(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_Future.OnFailure><td><code><a href=#fn_Future.OnFailure>Future.OnFailure(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>100.0%</code><td class=linecount><code>2/2</code><tr id=s_fn_WithoutTimeout><td><code><a href=#fn_WithoutTimeout>WithoutTimeout(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/routine/flag.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@227:9><td><code><a href=#fn_@227:9>@227:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@124:15><td><code><a href=#fn_@124:15>@124:15(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_promise.Resolve><td><code><a href=#fn_promise.Resolve>promise.Resolve(...)</a></code><td><code>github.com/wfusion/gofusion/routine/promise.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_forceSync><td><code><a href=#fn_forceSync>forceSync(...)</a></code><td><code>github.com/wfusion/gofusion/routine/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@80:16><td><code><a href=#fn_@80:16>@80:16(...)</a></code><td><code>github.com/wfusion/gofusion/routine/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@96:9><td><code><a href=#fn_@96:9>@96:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_ignoreRecycled><td><code><a href=#fn_ignoreRecycled>ignoreRecycled(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@230:11><td><code><a href=#fn_@230:11>@230:11(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_AppName><td><code><a href=#fn_AppName>AppName(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@38:24><td><code><a href=#fn_@38:24>@38:24(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Args><td><code><a href=#fn_Args>Args(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@231:15><td><code><a href=#fn_@231:15>@231:15(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@50:9><td><code><a href=#fn_@50:9>@50:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_FuncName><td><code><a href=#fn_FuncName>FuncName(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@44:9><td><code><a href=#fn_@44:9>@44:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@38:9><td><code><a href=#fn_@38:9>@38:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_Channel><td><code><a href=#fn_Channel>Channel(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@32:9><td><code><a href=#fn_@32:9>@32:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_WaitGroup><td><code><a href=#fn_WaitGroup>WaitGroup(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_@26:9><td><code><a href=#fn_@26:9>@26:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_promise.Reject><td><code><a href=#fn_promise.Reject>promise.Reject(...)</a></code><td><code>github.com/wfusion/gofusion/routine/promise.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_init><td><code><a href=#fn_init>init(...)</a></code><td><code>github.com/wfusion/gofusion/routine/construct.go</code><td class=percent><code>100.0%</code><td class=linecount><code>1/1</code><tr id=s_fn_NewPool><td><code><a href=#fn_NewPool>NewPool(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>91.7%</code><td class=linecount><code>11/12</code><tr id=s_fn_whenAllFuture><td><code><a href=#fn_whenAllFuture>whenAllFuture(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>90.0%</code><td class=linecount><code>9/10</code><tr id=s_fn_allocate><td><code><a href=#fn_allocate>allocate(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>89.5%</code><td class=linecount><code>17/19</code><tr id=s_fn_Goc><td><code><a href=#fn_Goc>Goc(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>88.9%</code><td class=linecount><code>8/9</code><tr id=s_fn_Go><td><code><a href=#fn_Go>Go(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>88.9%</code><td class=linecount><code>8/9</code><tr id=s_fn_WhenAll><td><code><a href=#fn_WhenAll>WhenAll(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>88.2%</code><td class=linecount><code>15/17</code><tr id=s_fn_Future.setResult><td><code><a href=#fn_Future.setResult>Future.setResult(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>88.2%</code><td class=linecount><code>15/17</code><tr id=s_fn_release><td><code><a href=#fn_release>release(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>87.5%</code><td class=linecount><code>14/16</code><tr id=s_fn_start><td><code><a href=#fn_start>start(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>86.7%</code><td class=linecount><code>13/15</code><tr id=s_fn_delRoutine><td><code><a href=#fn_delRoutine>delRoutine(...)</a></code><td><code>github.com/wfusion/gofusion/routine/types.go</code><td class=percent><code>83.3%</code><td class=linecount><code>5/6</code><tr id=s_fn_Future.addCallback><td><code><a href=#fn_Future.addCallback>Future.addCallback(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>81.5%</code><td class=linecount><code>22/27</code><tr id=s_fn_@132:6><td><code><a href=#fn_@132:6>@132:6(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_pool.Submit><td><code><a href=#fn_pool.Submit>pool.Submit(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>80.0%</code><td class=linecount><code>4/5</code><tr id=s_fn_@74:9><td><code><a href=#fn_@74:9>@74:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/construct.go</code><td class=percent><code>77.8%</code><td class=linecount><code>14/18</code><tr id=s_fn_wrapPromise><td><code><a href=#fn_wrapPromise>wrapPromise(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>77.8%</code><td class=linecount><code>7/9</code><tr id=s_fn_validate><td><code><a href=#fn_validate>validate(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_Future.IsCancelled><td><code><a href=#fn_Future.IsCancelled>Future.IsCancelled(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>75.0%</code><td class=linecount><code>3/4</code><tr id=s_fn_@91:21><td><code><a href=#fn_@91:21>@91:21(...)</a></code><td><code>github.com/wfusion/gofusion/routine/metrics.go</code><td class=percent><code>69.2%</code><td class=linecount><code>74/107</code><tr id=s_fn_Future.GetOrTimeout><td><code><a href=#fn_Future.GetOrTimeout>Future.GetOrTimeout(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>66.7%</code><td class=linecount><code>6/9</code><tr id=s_fn_@555:7><td><code><a href=#fn_@555:7>@555:7(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>66.7%</code><td class=linecount><code>4/6</code><tr id=s_fn_metricsRuntime><td><code><a href=#fn_metricsRuntime>metricsRuntime(...)</a></code><td><code>github.com/wfusion/gofusion/routine/metrics.go</code><td class=percent><code>66.7%</code><td class=linecount><code>2/3</code><tr id=s_fn_execCallback><td><code><a href=#fn_execCallback>execCallback(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>63.6%</code><td class=linecount><code>7/11</code><tr id=s_fn_getAct><td><code><a href=#fn_getAct>getAct(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>50.0%</code><td class=linecount><code>12/24</code><tr id=s_fn_getFutureReturnVal><td><code><a href=#fn_getFutureReturnVal>getFutureReturnVal(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>50.0%</code><td class=linecount><code>2/4</code><tr id=s_fn_@471:10><td><code><a href=#fn_@471:10>@471:10(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>50.0%</code><td class=linecount><code>1/2</code><tr id=s_fn_@122:15><td><code><a href=#fn_@122:15>@122:15(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>50.0%</code><td class=linecount><code>1/2</code><tr id=s_fn_@157:15><td><code><a href=#fn_@157:15>@157:15(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>50.0%</code><td class=linecount><code>1/2</code><tr id=s_fn_@202:8><td><code><a href=#fn_@202:8>@202:8(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>50.0%</code><td class=linecount><code>1/2</code><tr id=s_fn_@133:9><td><code><a href=#fn_@133:9>@133:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>50.0%</code><td class=linecount><code>1/2</code><tr id=s_fn_@73:14><td><code><a href=#fn_@73:14>@73:14(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>50.0%</code><td class=linecount><code>1/2</code><tr id=s_fn_@215:14><td><code><a href=#fn_@215:14>@215:14(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>50.0%</code><td class=linecount><code>1/2</code><tr id=s_fn_@241:10><td><code><a href=#fn_@241:10>@241:10(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>33.3%</code><td class=linecount><code>1/3</code><tr id=s_fn_@303:8><td><code><a href=#fn_@303:8>@303:8(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>33.3%</code><td class=linecount><code>1/3</code><tr id=s_fn_@330:12><td><code><a href=#fn_@330:12>@330:12(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>33.3%</code><td class=linecount><code>1/3</code><tr id=s_fn_getError><td><code><a href=#fn_getError>getError(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>25.0%</code><td class=linecount><code>2/8</code><tr id=s_fn_Future.Pipe><td><code><a href=#fn_Future.Pipe>Future.Pipe(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/35</code><tr id=s_fn_WhenAnyMatched><td><code><a href=#fn_WhenAnyMatched>WhenAnyMatched(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/28</code><tr id=s_fn_@366:6><td><code><a href=#fn_@366:6>@366:6(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/20</code><tr id=s_fn_AggregateError.Error><td><code><a href=#fn_AggregateError.Error>AggregateError.Error(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/14</code><tr id=s_fn_newErrorWithStacks><td><code><a href=#fn_newErrorWithStacks>newErrorWithStacks(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/11</code><tr id=s_fn_@233:9><td><code><a href=#fn_@233:9>@233:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/8</code><tr id=s_fn_WrapFuture><td><code><a href=#fn_WrapFuture>WrapFuture(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/7</code><tr id=s_fn_showRoutine><td><code><a href=#fn_showRoutine>showRoutine(...)</a></code><td><code>github.com/wfusion/gofusion/routine/types.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/6</code><tr id=s_fn_@104:5><td><code><a href=#fn_@104:5>@104:5(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/5</code><tr id=s_fn_@342:8><td><code><a href=#fn_@342:8>@342:8(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_@367:10><td><code><a href=#fn_@367:10>@367:10(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_@486:18><td><code><a href=#fn_@486:18>@486:18(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_Loopc><td><code><a href=#fn_Loopc>Loopc(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_NoMatchedError.HasError><td><code><a href=#fn_NoMatchedError.HasError>NoMatchedError.HasError(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_@324:9><td><code><a href=#fn_@324:9>@324:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_Future.SetTimeout><td><code><a href=#fn_Future.SetTimeout>Future.SetTimeout(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_@323:5><td><code><a href=#fn_@323:5>@323:5(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/4</code><tr id=s_fn_@496:17><td><code><a href=#fn_@496:17>@496:17(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@105:9><td><code><a href=#fn_@105:9>@105:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@171:9><td><code><a href=#fn_@171:9>@171:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_pipe.getPipe><td><code><a href=#fn_pipe.getPipe>pipe.getPipe(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_startPipe><td><code><a href=#fn_startPipe>startPipe(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@211:11><td><code><a href=#fn_@211:11>@211:11(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@343:12><td><code><a href=#fn_@343:12>@343:12(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_@462:19><td><code><a href=#fn_@462:19>@462:19(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/3</code><tr id=s_fn_writeStrings><td><code><a href=#fn_writeStrings>writeStrings(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@208:13><td><code><a href=#fn_@208:13>@208:13(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_promise.OnSuccess><td><code><a href=#fn_promise.OnSuccess>promise.OnSuccess(...)</a></code><td><code>github.com/wfusion/gofusion/routine/promise.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@318:15><td><code><a href=#fn_@318:15>@318:15(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@187:15><td><code><a href=#fn_@187:15>@187:15(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@231:18><td><code><a href=#fn_@231:18>@231:18(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@180:14><td><code><a href=#fn_@180:14>@180:14(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_pool.ReleaseTimeout><td><code><a href=#fn_pool.ReleaseTimeout>pool.ReleaseTimeout(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_promise.OnFailure><td><code><a href=#fn_promise.OnFailure>promise.OnFailure(...)</a></code><td><code>github.com/wfusion/gofusion/routine/promise.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@244:18><td><code><a href=#fn_@244:18>@244:18(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@104:10><td><code><a href=#fn_@104:10>@104:10(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@107:10><td><code><a href=#fn_@107:10>@107:10(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_promise.OnComplete><td><code><a href=#fn_promise.OnComplete>promise.OnComplete(...)</a></code><td><code>github.com/wfusion/gofusion/routine/promise.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@337:17><td><code><a href=#fn_@337:17>@337:17(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_promise.OnCancel><td><code><a href=#fn_promise.OnCancel>promise.OnCancel(...)</a></code><td><code>github.com/wfusion/gofusion/routine/promise.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@170:10><td><code><a href=#fn_@170:10>@170:10(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@150:14><td><code><a href=#fn_@150:14>@150:14(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@210:4><td><code><a href=#fn_@210:4>@210:4(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@334:16><td><code><a href=#fn_@334:16>@334:16(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@340:16><td><code><a href=#fn_@340:16>@340:16(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/2</code><tr id=s_fn_@237:12><td><code><a href=#fn_@237:12>@237:12(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@338:11><td><code><a href=#fn_@338:11>@338:11(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@335:11><td><code><a href=#fn_@335:11>@335:11(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@341:11><td><code><a href=#fn_@341:11>@341:11(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_pool.Running><td><code><a href=#fn_pool.Running>pool.Running(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_pool.Free><td><code><a href=#fn_pool.Free>pool.Free(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_pool.Waiting><td><code><a href=#fn_pool.Waiting>pool.Waiting(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_pool.Cap><td><code><a href=#fn_pool.Cap>pool.Cap(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_pool.IsClosed><td><code><a href=#fn_pool.IsClosed>pool.IsClosed(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@243:12><td><code><a href=#fn_@243:12>@243:12(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@238:18><td><code><a href=#fn_@238:18>@238:18(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@230:12><td><code><a href=#fn_@230:12>@230:12(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@319:9><td><code><a href=#fn_@319:9>@319:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@225:18><td><code><a href=#fn_@225:18>@225:18(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_ignoreMutex><td><code><a href=#fn_ignoreMutex>ignoreMutex(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@102:9><td><code><a href=#fn_@102:9>@102:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@296:15><td><code><a href=#fn_@296:15>@296:15(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_newAggregateError1><td><code><a href=#fn_newAggregateError1>newAggregateError1(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_WhenAny><td><code><a href=#fn_WhenAny>WhenAny(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@224:12><td><code><a href=#fn_@224:12>@224:12(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Timeout><td><code><a href=#fn_Timeout>Timeout(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@221:9><td><code><a href=#fn_@221:9>@221:9(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@220:12><td><code><a href=#fn_@220:12>@220:12(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_NoMatchedError.Error><td><code><a href=#fn_NoMatchedError.Error>NoMatchedError.Error(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Options><td><code><a href=#fn_Options>Options(...)</a></code><td><code>github.com/wfusion/gofusion/routine/pool.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_newNoMatchedError><td><code><a href=#fn_newNoMatchedError>newNoMatchedError(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_CancelledError.Error><td><code><a href=#fn_CancelledError.Error>CancelledError.Error(...)</a></code><td><code>github.com/wfusion/gofusion/routine/promise.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_newNoMatchedError1><td><code><a href=#fn_newNoMatchedError1>newNoMatchedError1(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Future.Cancel><td><code><a href=#fn_Future.Cancel>Future.Cancel(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_canceller.IsCancelled><td><code><a href=#fn_canceller.IsCancelled>canceller.IsCancelled(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@126:14><td><code><a href=#fn_@126:14>@126:14(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@101:10><td><code><a href=#fn_@101:10>@101:10(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_Future.Canceller><td><code><a href=#fn_Future.Canceller>Future.Canceller(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_canceller.Cancel><td><code><a href=#fn_canceller.Cancel>canceller.Cancel(...)</a></code><td><code>github.com/wfusion/gofusion/routine/future.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@110:10><td><code><a href=#fn_@110:10>@110:10(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@182:15><td><code><a href=#fn_@182:15>@182:15(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_@184:16><td><code><a href=#fn_@184:16>@184:16(...)</a></code><td><code>github.com/wfusion/gofusion/routine/candy_utils.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code><tr id=s_fn_promise.Cancel><td><code><a href=#fn_promise.Cancel>promise.Cancel(...)</a></code><td><code>github.com/wfusion/gofusion/routine/promise.go</code><td class=percent><code>0.0%</code><td class=linecount><code>0/1</code></table><div class=funcname id=fn_Construct>func Construct</div><div class=info><a href=#s_fn_Construct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/construct.go</code>:</div><table class=listing><tr><td>26<td><code><pre>func Construct(ctx context.Context, conf Conf, opts ...utils.OptionExtender) func() {</pre></code><tr><td>27<td><code><pre> opt := utils.ApplyOptions[config.InitOption](opts...)</pre></code><tr><td>28<td><code><pre> optU := utils.ApplyOptions[candyOption](opts...)</pre></code><tr><td>29<td><code><pre> if opt.AppName == "" {</pre></code><tr><td>30<td><code><pre> opt.AppName = optU.appName</pre></code><tr><td>31<td><code><pre> }</pre></code><tr><td>32<td><code><pre></pre></code><tr><td>33<td><code><pre> if conf.MaxRoutineAmount <= 0 {</pre></code><tr><td>34<td><code><pre> conf.MaxRoutineAmount = defaultMaxPoolSize</pre></code><tr><td>35<td><code><pre> }</pre></code><tr><td>36<td><code><pre></pre></code><tr><td>37<td><code><pre> rwlock.Lock()</pre></code><tr><td>38<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>39<td><code><pre> if pools == nil {</pre></code><tr><td>40<td><code><pre> pools = make(map[string]map[string]Pool)</pre></code><tr><td>41<td><code><pre> }</pre></code><tr><td>42<td><code><pre> if pools[opt.AppName] == nil {</pre></code><tr><td>43<td><code><pre> pools[opt.AppName] = make(map[string]Pool)</pre></code><tr><td>44<td><code><pre> }</pre></code><tr><td>45<td><code><pre> if ignored == nil {</pre></code><tr><td>46<td><code><pre> ignored = make(map[string]*atomic.Int64)</pre></code><tr><td>47<td><code><pre> }</pre></code><tr><td>48<td><code><pre> if ignored[opt.AppName] == nil {</pre></code><tr><td>49<td><code><pre> ignored[opt.AppName] = atomic.NewInt64(0)</pre></code><tr><td>50<td><code><pre> }</pre></code><tr><td>51<td><code><pre> if idles == nil {</pre></code><tr><td>52<td><code><pre> idles = make(map[string]*atomic.Int64)</pre></code><tr><td>53<td><code><pre> }</pre></code><tr><td>54<td><code><pre> if idles[opt.AppName] == nil {</pre></code><tr><td>55<td><code><pre> idles[opt.AppName] = atomic.NewInt64(int64(conf.MaxRoutineAmount))</pre></code><tr><td>56<td><code><pre> }</pre></code><tr><td>57<td><code><pre> if utils.IsStrNotBlank(conf.Logger) {</pre></code><tr><td>58<td><code><pre> if defaultLogger == nil {</pre></code><tr><td>59<td><code><pre> defaultLogger = make(map[string]ants.Logger)</pre></code><tr><td>60<td><code><pre> }</pre></code><tr><td>61<td><code><pre> if defaultLogger[opt.AppName] == nil {</pre></code><tr><td>62<td><code><pre> logger := reflect.New(inspect.TypeOf(conf.Logger)).Interface().(ants.Logger)</pre></code><tr><td>63<td><code><pre> defaultLogger[opt.AppName] = logger</pre></code><tr><td>64<td><code><pre> if custom, ok := logger.(customLogger); ok {</pre></code><tr><td>65<td><code><pre> l := fusLog.Use(conf.LogInstance, fusLog.AppName(opt.AppName))</pre></code><tr><td>66<td><code><pre> custom.Init(l, opt.AppName)</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre> }</pre></code><tr><td>69<td><code><pre> }</pre></code><tr><td>70<td><code><pre> maxReleaseTime := utils.Must(time.ParseDuration(conf.MaxReleaseTimePerPool))</pre></code><tr><td>71<td><code><pre></pre></code><tr><td>72<td><code><pre> go startDaemonRoutines(ctx, opt.AppName, &conf)</pre></code><tr><td>73<td><code><pre></pre></code><tr><td>74<td><code><pre> return func() {</pre></code><tr><td>75<td><code><pre> rwlock.Lock()</pre></code><tr><td>76<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>77<td><code><pre></pre></code><tr><td>78<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>79<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>80<td><code><pre> allExited := func() bool {</pre></code><tr><td>81<td><code><pre> return idles[opt.AppName].Load() == int64(conf.MaxRoutineAmount)-ignored[opt.AppName].Load()</pre></code><tr><td>82<td><code><pre> }</pre></code><tr><td>83<td><code><pre></pre></code><tr><td>84<td><code><pre> // waiting for pool</pre></code><tr><td>85<td><code><pre> if pools != nil {</pre></code><tr><td>86<td><code><pre> for name, pool := range pools[opt.AppName] {</pre></code><tr><td>87<td><code><pre> if err := pool.ReleaseTimeout(maxReleaseTime, ignoreMutex()); err != nil {</pre></code><tr><td>88<td><code><pre> log.Printf("%v [Gofusion] %s %s exit with releasing pool %s failed because %s",</pre></code><tr><td>89<td><code><pre> pid, app, config.ComponentGoroutinePool, name, err)</pre></code><tr><td>90<td><code><pre> }</pre></code><tr><td>91<td><code><pre> delete(pools[opt.AppName], name)</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre> }</pre></code><tr><td>94<td><code><pre></pre></code><tr><td>95<td><code><pre> log.Printf("%v [Gofusion] %s %s pool routines are recycled", pid, app, config.ComponentGoroutinePool)</pre></code><tr><td>96<td><code><pre></pre></code><tr><td>97<td><code><pre> // waiting for go</pre></code><tr><td>98<td><code><pre> utils.Timeout(maxReleaseTime, utils.TimeoutWg(&wg))</pre></code><tr><td>99<td><code><pre> log.Printf("%v [Gofusion] %s %s go routines are recycled", pid, app, config.ComponentGoroutinePool)</pre></code><tr><td>100<td><code><pre></pre></code><tr><td>101<td><code><pre> if !allExited() {</pre></code><tr><td>102<td><code><pre> log.Printf("%v [Gofusion] %s %s exit without all goroutines recycled [exists%v]",</pre></code><tr><td>103<td><code><pre> pid, app, config.ComponentGoroutinePool, showRoutine(opt.AppName))</pre></code><tr><td>104<td><code><pre> }</pre></code><tr><td>105<td><code><pre></pre></code><tr><td>106<td><code><pre> delete(ignored, opt.AppName)</pre></code><tr><td>107<td><code><pre> delete(idles, opt.AppName)</pre></code><tr><td>108<td><code><pre> delete(routines, opt.AppName)</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre>}</pre></code></table><div class=funcname id=fn_startDaemonRoutines>func startDaemonRoutines</div><div class=info><a href=#s_fn_startDaemonRoutines>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/metrics.go</code>:</div><table class=listing><tr><td>65<td><code><pre>func startDaemonRoutines(ctx context.Context, appName string, conf *Conf) {</pre></code><tr><td>66<td><code><pre> ticker := time.Tick(time.Second * 5)</pre></code><tr><td>67<td><code><pre> app := config.Use(appName).AppName()</pre></code><tr><td>68<td><code><pre> labels := make([]metrics.Label, 0)</pre></code><tr><td>69<td><code><pre> lastNumGc := atomic.NewUint32(0)</pre></code><tr><td>70<td><code><pre></pre></code><tr><td>71<td><code><pre> log.Printf("%v [Gofusion] %s %s metrics start", syscall.Getpid(), app, config.ComponentGoroutinePool)</pre></code><tr><td>72<td><code><pre> for {</pre></code><tr><td>73<td><code><pre> select {</pre></code><tr><td>74<td><code><pre> case <-ctx.Done():</pre></code><tr><td>75<td><code><pre> log.Printf("%v [Gofusion] %s %s metrics exited",</pre></code><tr><td>76<td><code><pre> syscall.Getpid(), app, config.ComponentGoroutinePool)</pre></code><tr><td>77<td><code><pre> return</pre></code><tr><td>78<td><code><pre> case <-ticker:</pre></code><tr><td>79<td><code><pre> go metricsRuntime(ctx, appName, lastNumGc, conf, labels)</pre></code><tr><td>80<td><code><pre> }</pre></code><tr><td>81<td><code><pre> }</pre></code><tr><td>82<td><code><pre>}</pre></code></table><div class=funcname id=fn_@470:6>func @470:6</div><div class=info><a href=#s_fn_@470:6>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>470<td><code><pre>func() {</pre></code><tr><td>471<td><code><pre> defer func() {</pre></code><tr><td>472<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>473<td><code><pre> _ = wf.Reject(newErrorWithStacks(e))</pre></code><tr><td>474<td><code><pre> }</pre></code><tr><td>475<td><code><pre> }()</pre></code><tr><td>476<td><code><pre></pre></code><tr><td>477<td><code><pre> isCancelled := int32(0)</pre></code><tr><td>478<td><code><pre> for i, f := range fs {</pre></code><tr><td>479<td><code><pre> j := i</pre></code><tr><td>480<td><code><pre></pre></code><tr><td>481<td><code><pre> f.OnSuccess(func(v any) {</pre></code><tr><td>482<td><code><pre> rs[j] = v</pre></code><tr><td>483<td><code><pre> if atomic.AddInt32(&n, -1) == 0 {</pre></code><tr><td>484<td><code><pre> _ = wf.Resolve(rs)</pre></code><tr><td>485<td><code><pre> }</pre></code><tr><td>486<td><code><pre> }).OnFailure(func(v any) {</pre></code><tr><td>487<td><code><pre> if atomic.CompareAndSwapInt32(&isCancelled, 0, 1) {</pre></code><tr><td>488<td><code><pre> // try to cancel all futures</pre></code><tr><td>489<td><code><pre> cancelOthers(j)</pre></code><tr><td>490<td><code><pre></pre></code><tr><td>491<td><code><pre> // errs := make([]error, 0, 1)</pre></code><tr><td>492<td><code><pre> // errs = append(errs, v.(error))</pre></code><tr><td>493<td><code><pre> e := newAggregateError1("error appears in WhenAll:", v)</pre></code><tr><td>494<td><code><pre> _ = wf.Reject(e)</pre></code><tr><td>495<td><code><pre> }</pre></code><tr><td>496<td><code><pre> }).OnCancel(func() {</pre></code><tr><td>497<td><code><pre> if atomic.CompareAndSwapInt32(&isCancelled, 0, 1) {</pre></code><tr><td>498<td><code><pre> // try to cancel all futures</pre></code><tr><td>499<td><code><pre> cancelOthers(j)</pre></code><tr><td>500<td><code><pre></pre></code><tr><td>501<td><code><pre> _ = wf.Cancel()</pre></code><tr><td>502<td><code><pre> }</pre></code><tr><td>503<td><code><pre> })</pre></code><tr><td>504<td><code><pre> }</pre></code><tr><td>505<td><code><pre> }</pre></code></table><div class=funcname id=fn_addRoutine>func addRoutine</div><div class=info><a href=#s_fn_addRoutine>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/types.go</code>:</div><table class=listing><tr><td>55<td><code><pre>func addRoutine(appName, name string) {</pre></code><tr><td>56<td><code><pre> locker.Lock()</pre></code><tr><td>57<td><code><pre> defer locker.Unlock()</pre></code><tr><td>58<td><code><pre></pre></code><tr><td>59<td><code><pre> if _, ok := routines[appName]; !ok {</pre></code><tr><td>60<td><code><pre> routines[appName] = make(map[string]int)</pre></code><tr><td>61<td><code><pre> }</pre></code><tr><td>62<td><code><pre> routines[appName][name]++</pre></code><tr><td>63<td><code><pre>}</pre></code></table><div class=funcname id=fn_@102:9>func @102:9</div><div class=info><a href=#s_fn_@102:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>102<td><code><pre>func() {</pre></code><tr><td>103<td><code><pre> release(opt.appName, nil, nil)</pre></code><tr><td>104<td><code><pre> delRoutine(opt.appName, opt.funcName)</pre></code><tr><td>105<td><code><pre> if opt.wg != nil {</pre></code><tr><td>106<td><code><pre> opt.wg.Done()</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre> wg.Done()</pre></code><tr><td>109<td><code><pre> }</pre></code></table><div class=funcname id=fn_@62:9>func @62:9</div><div class=info><a href=#s_fn_@62:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>62<td><code><pre>func() {</pre></code><tr><td>63<td><code><pre> release(opt.appName, nil, nil)</pre></code><tr><td>64<td><code><pre> delRoutine(opt.appName, opt.funcName)</pre></code><tr><td>65<td><code><pre> if opt.wg != nil {</pre></code><tr><td>66<td><code><pre> opt.wg.Done()</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre> wg.Done()</pre></code><tr><td>69<td><code><pre> }</pre></code></table><div class=funcname id=fn_Loop>func Loop</div><div class=info><a href=#s_fn_Loop>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>139<td><code><pre>func Loop(task any, opts ...utils.OptionExtender) {</pre></code><tr><td>140<td><code><pre> opt := utils.ApplyOptions[candyOption](opts...)</pre></code><tr><td>141<td><code><pre> allocate(opt.appName, 1, &NewPoolOption{ApplyTimeout: -1}, ignoreRecycled())</pre></code><tr><td>142<td><code><pre> exec := func() {</pre></code><tr><td>143<td><code><pre> defer func() {</pre></code><tr><td>144<td><code><pre> release(opt.appName, nil, ignoreRecycled())</pre></code><tr><td>145<td><code><pre> if opt.wg != nil {</pre></code><tr><td>146<td><code><pre> opt.wg.Done()</pre></code><tr><td>147<td><code><pre> }</pre></code><tr><td>148<td><code><pre> }()</pre></code><tr><td>149<td><code><pre> wrapPromise(task, false, opts...).</pre></code><tr><td>150<td><code><pre> OnFailure(func(v any) {</pre></code><tr><td>151<td><code><pre> if opt.ch == nil {</pre></code><tr><td>152<td><code><pre> log.Printf("[Gofusion] %s catches an error in routine.Loop function: \n"+</pre></code><tr><td>153<td><code><pre> "error: %s\nfunc: %s\nfunc signature: %T",</pre></code><tr><td>154<td><code><pre> config.ComponentGoroutinePool, v, utils.GetFuncName(task), task)</pre></code><tr><td>155<td><code><pre> }</pre></code><tr><td>156<td><code><pre> }).</pre></code><tr><td>157<td><code><pre> OnComplete(func(v any) {</pre></code><tr><td>158<td><code><pre> if opt.ch != nil {</pre></code><tr><td>159<td><code><pre> opt.ch <- v</pre></code><tr><td>160<td><code><pre> }</pre></code><tr><td>161<td><code><pre> })</pre></code><tr><td>162<td><code><pre> }</pre></code><tr><td>163<td><code><pre></pre></code><tr><td>164<td><code><pre> go exec()</pre></code><tr><td>165<td><code><pre>}</pre></code></table><div class=funcname id=fn_Promise>func Promise</div><div class=info><a href=#s_fn_Promise>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>199<td><code><pre>func Promise(fn any, async bool, opts ...utils.OptionExtender) *Future {</pre></code><tr><td>200<td><code><pre> opt := utils.ApplyOptions[candyOption](opts...)</pre></code><tr><td>201<td><code><pre> async = async && !forceSync(opt.appName)</pre></code><tr><td>202<td><code><pre> defer func() {</pre></code><tr><td>203<td><code><pre> if !async && opt.wg != nil {</pre></code><tr><td>204<td><code><pre> opt.wg.Done()</pre></code><tr><td>205<td><code><pre> }</pre></code><tr><td>206<td><code><pre> }()</pre></code><tr><td>207<td><code><pre> return wrapPromise(fn, async, append(opts, FuncName(utils.GetFuncName(fn)))...).</pre></code><tr><td>208<td><code><pre> OnFailure(func(v any) {</pre></code><tr><td>209<td><code><pre> if opt.ch == nil {</pre></code><tr><td>210<td><code><pre> log.Printf("[Gofusion] %s catches an error in routine.Loop function: \n"+</pre></code><tr><td>211<td><code><pre> "error: %s\nfunc: %s\nfunc signature: %T",</pre></code><tr><td>212<td><code><pre> config.ComponentGoroutinePool, v, utils.GetFuncName(fn), fn)</pre></code><tr><td>213<td><code><pre> }</pre></code><tr><td>214<td><code><pre> }).</pre></code><tr><td>215<td><code><pre> OnComplete(func(v any) {</pre></code><tr><td>216<td><code><pre> if opt.ch != nil {</pre></code><tr><td>217<td><code><pre> opt.ch <- v</pre></code><tr><td>218<td><code><pre> }</pre></code><tr><td>219<td><code><pre> })</pre></code><tr><td>220<td><code><pre>}</pre></code></table><div class=funcname id=fn_@101:10>func @101:10</div><div class=info><a href=#s_fn_@101:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>101<td><code><pre>func() {</pre></code><tr><td>102<td><code><pre> defer func() {</pre></code><tr><td>103<td><code><pre> release(opt.appName, nil, nil)</pre></code><tr><td>104<td><code><pre> delRoutine(opt.appName, opt.funcName)</pre></code><tr><td>105<td><code><pre> if opt.wg != nil {</pre></code><tr><td>106<td><code><pre> opt.wg.Done()</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre> wg.Done()</pre></code><tr><td>109<td><code><pre> }()</pre></code><tr><td>110<td><code><pre></pre></code><tr><td>111<td><code><pre> addRoutine(opt.appName, opt.funcName)</pre></code><tr><td>112<td><code><pre> select {</pre></code><tr><td>113<td><code><pre> case <-ctx.Done():</pre></code><tr><td>114<td><code><pre> case <-wrapPromise(task, false, opts...).</pre></code><tr><td>115<td><code><pre> OnFailure(func(v any) {</pre></code><tr><td>116<td><code><pre> if opt.ch == nil {</pre></code><tr><td>117<td><code><pre> log.Printf("[Gofusion] %s catches an error in routine.Goc function: \n"+</pre></code><tr><td>118<td><code><pre> "error: %s\nfunc: %s\nfunc signature: %T",</pre></code><tr><td>119<td><code><pre> config.ComponentGoroutinePool, v, utils.GetFuncName(task), task)</pre></code><tr><td>120<td><code><pre> }</pre></code><tr><td>121<td><code><pre> }).</pre></code><tr><td>122<td><code><pre> OnComplete(func(v any) {</pre></code><tr><td>123<td><code><pre> if opt.ch != nil {</pre></code><tr><td>124<td><code><pre> opt.ch <- v</pre></code><tr><td>125<td><code><pre> }</pre></code><tr><td>126<td><code><pre> }).</pre></code><tr><td>127<td><code><pre> GetChan():</pre></code><tr><td>128<td><code><pre> }</pre></code><tr><td>129<td><code><pre> }</pre></code></table><div class=funcname id=fn_Future.GetChan>func Future.GetChan</div><div class=info><a href=#s_fn_Future.GetChan>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>122<td><code><pre>func (f *Future) GetChan() <-chan *Result {</pre></code><tr><td>123<td><code><pre> c := make(chan *Result, 1)</pre></code><tr><td>124<td><code><pre> f.OnComplete(func(v any) {</pre></code><tr><td>125<td><code><pre> c <- f.loadResult()</pre></code><tr><td>126<td><code><pre> }).OnCancel(func() {</pre></code><tr><td>127<td><code><pre> c <- f.loadResult()</pre></code><tr><td>128<td><code><pre> })</pre></code><tr><td>129<td><code><pre> return c</pre></code><tr><td>130<td><code><pre>}</pre></code></table><div class=funcname id=fn_@143:9>func @143:9</div><div class=info><a href=#s_fn_@143:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>143<td><code><pre>func() {</pre></code><tr><td>144<td><code><pre> release(opt.appName, nil, ignoreRecycled())</pre></code><tr><td>145<td><code><pre> if opt.wg != nil {</pre></code><tr><td>146<td><code><pre> opt.wg.Done()</pre></code><tr><td>147<td><code><pre> }</pre></code><tr><td>148<td><code><pre> }</pre></code></table><div class=funcname id=fn_@61:10>func @61:10</div><div class=info><a href=#s_fn_@61:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>61<td><code><pre>func() {</pre></code><tr><td>62<td><code><pre> defer func() {</pre></code><tr><td>63<td><code><pre> release(opt.appName, nil, nil)</pre></code><tr><td>64<td><code><pre> delRoutine(opt.appName, opt.funcName)</pre></code><tr><td>65<td><code><pre> if opt.wg != nil {</pre></code><tr><td>66<td><code><pre> opt.wg.Done()</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre> wg.Done()</pre></code><tr><td>69<td><code><pre> }()</pre></code><tr><td>70<td><code><pre></pre></code><tr><td>71<td><code><pre> addRoutine(opt.appName, opt.funcName)</pre></code><tr><td>72<td><code><pre> wrapPromise(task, false, opts...).</pre></code><tr><td>73<td><code><pre> OnFailure(func(v any) {</pre></code><tr><td>74<td><code><pre> if opt.ch == nil {</pre></code><tr><td>75<td><code><pre> log.Printf("[Gofusion] %s catches an error in routine.Go function: \n"+</pre></code><tr><td>76<td><code><pre> "error: %s\nfunc: %s\nfunc signature: %T",</pre></code><tr><td>77<td><code><pre> config.ComponentGoroutinePool, v, utils.GetFuncName(task), task)</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre> }).</pre></code><tr><td>80<td><code><pre> OnComplete(func(v any) {</pre></code><tr><td>81<td><code><pre> if opt.ch != nil {</pre></code><tr><td>82<td><code><pre> opt.ch <- v</pre></code><tr><td>83<td><code><pre> }</pre></code><tr><td>84<td><code><pre> })</pre></code><tr><td>85<td><code><pre> }</pre></code></table><div class=funcname id=fn_addPool>func addPool</div><div class=info><a href=#s_fn_addPool>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>167<td><code><pre>func addPool(appName, name string, pool Pool) {</pre></code><tr><td>168<td><code><pre> rwlock.Lock()</pre></code><tr><td>169<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>170<td><code><pre> pools[appName][name] = pool</pre></code><tr><td>171<td><code><pre>}</pre></code></table><div class=funcname id=fn_@481:17>func @481:17</div><div class=info><a href=#s_fn_@481:17>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>481<td><code><pre>func(v any) {</pre></code><tr><td>482<td><code><pre> rs[j] = v</pre></code><tr><td>483<td><code><pre> if atomic.AddInt32(&n, -1) == 0 {</pre></code><tr><td>484<td><code><pre> _ = wf.Resolve(rs)</pre></code><tr><td>485<td><code><pre> }</pre></code><tr><td>486<td><code><pre> }</pre></code></table><div class=funcname id=fn_NewPromise>func NewPromise</div><div class=info><a href=#s_fn_NewPromise>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/promise.go</code>:</div><table class=listing><tr><td>100<td><code><pre>func NewPromise() *promise {</pre></code><tr><td>101<td><code><pre> val := &futureVal{</pre></code><tr><td>102<td><code><pre> dones: make([]func(v any), 0, 8),</pre></code><tr><td>103<td><code><pre> fails: make([]func(v any), 0, 8),</pre></code><tr><td>104<td><code><pre> always: make([]func(v any), 0, 4),</pre></code><tr><td>105<td><code><pre> cancels: make([]func(), 0, 2),</pre></code><tr><td>106<td><code><pre> pipes: make([]*pipe, 0, 4),</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre> f := &promise{</pre></code><tr><td>109<td><code><pre> Future: &Future{</pre></code><tr><td>110<td><code><pre> Id: rand.Int(),</pre></code><tr><td>111<td><code><pre> final: make(chan struct{}),</pre></code><tr><td>112<td><code><pre> val: unsafe.Pointer(val),</pre></code><tr><td>113<td><code><pre> },</pre></code><tr><td>114<td><code><pre> }</pre></code><tr><td>115<td><code><pre> return f</pre></code><tr><td>116<td><code><pre>}</pre></code></table><div class=funcname id=fn_@329:8>func @329:8</div><div class=info><a href=#s_fn_@329:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>329<td><code><pre>func() {</pre></code><tr><td>330<td><code><pre> defer func() {</pre></code><tr><td>331<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>332<td><code><pre> err := newErrorWithStacks(e)</pre></code><tr><td>333<td><code><pre> fmt.Println("error happens:\n ", err)</pre></code><tr><td>334<td><code><pre> }</pre></code><tr><td>335<td><code><pre> }()</pre></code><tr><td>336<td><code><pre> execCallback(r, v.dones, v.fails, v.always, v.cancels)</pre></code><tr><td>337<td><code><pre> }</pre></code></table><div class=funcname id=fn_Future.OnComplete>func Future.OnComplete</div><div class=info><a href=#s_fn_Future.OnComplete>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>190<td><code><pre>func (f *Future) OnComplete(callback func(v any)) *Future {</pre></code><tr><td>191<td><code><pre> f.addCallback(callback, CallbackAlways)</pre></code><tr><td>192<td><code><pre> return f</pre></code><tr><td>193<td><code><pre>}</pre></code></table><div class=funcname id=fn_Future.OnCancel>func Future.OnCancel</div><div class=info><a href=#s_fn_Future.OnCancel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>197<td><code><pre>func (f *Future) OnCancel(callback func()) *Future {</pre></code><tr><td>198<td><code><pre> f.addCallback(callback, CallbackCancel)</pre></code><tr><td>199<td><code><pre> return f</pre></code><tr><td>200<td><code><pre>}</pre></code></table><div class=funcname id=fn_@115:14>func @115:14</div><div class=info><a href=#s_fn_@115:14>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>115<td><code><pre>func(v any) {</pre></code><tr><td>116<td><code><pre> if opt.ch == nil {</pre></code><tr><td>117<td><code><pre> log.Printf("[Gofusion] %s catches an error in routine.Goc function: \n"+</pre></code><tr><td>118<td><code><pre> "error: %s\nfunc: %s\nfunc signature: %T",</pre></code><tr><td>119<td><code><pre> config.ComponentGoroutinePool, v, utils.GetFuncName(task), task)</pre></code><tr><td>120<td><code><pre> }</pre></code><tr><td>121<td><code><pre> }</pre></code></table><div class=funcname id=fn_@97:10>func @97:10</div><div class=info><a href=#s_fn_@97:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>97<td><code><pre>func(...any) (any, error) { v(); return nil, nil }</pre></code></table><div class=funcname id=fn_Future.loadResult>func Future.loadResult</div><div class=info><a href=#s_fn_Future.loadResult>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>290<td><code><pre>func (f *Future) loadResult() *Result {</pre></code><tr><td>291<td><code><pre> val := f.loadVal()</pre></code><tr><td>292<td><code><pre> return val.r</pre></code><tr><td>293<td><code><pre>}</pre></code></table><div class=funcname id=fn_@142:10>func @142:10</div><div class=info><a href=#s_fn_@142:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>142<td><code><pre>func() {</pre></code><tr><td>143<td><code><pre> defer func() {</pre></code><tr><td>144<td><code><pre> release(opt.appName, nil, ignoreRecycled())</pre></code><tr><td>145<td><code><pre> if opt.wg != nil {</pre></code><tr><td>146<td><code><pre> opt.wg.Done()</pre></code><tr><td>147<td><code><pre> }</pre></code><tr><td>148<td><code><pre> }()</pre></code><tr><td>149<td><code><pre> wrapPromise(task, false, opts...).</pre></code><tr><td>150<td><code><pre> OnFailure(func(v any) {</pre></code><tr><td>151<td><code><pre> if opt.ch == nil {</pre></code><tr><td>152<td><code><pre> log.Printf("[Gofusion] %s catches an error in routine.Loop function: \n"+</pre></code><tr><td>153<td><code><pre> "error: %s\nfunc: %s\nfunc signature: %T",</pre></code><tr><td>154<td><code><pre> config.ComponentGoroutinePool, v, utils.GetFuncName(task), task)</pre></code><tr><td>155<td><code><pre> }</pre></code><tr><td>156<td><code><pre> }).</pre></code><tr><td>157<td><code><pre> OnComplete(func(v any) {</pre></code><tr><td>158<td><code><pre> if opt.ch != nil {</pre></code><tr><td>159<td><code><pre> opt.ch <- v</pre></code><tr><td>160<td><code><pre> }</pre></code><tr><td>161<td><code><pre> })</pre></code><tr><td>162<td><code><pre> }</pre></code></table><div class=funcname id=fn_@240:3>func @240:3</div><div class=info><a href=#s_fn_@240:3>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>240<td><code><pre>func() {</pre></code><tr><td>241<td><code><pre> defer func() {</pre></code><tr><td>242<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>243<td><code><pre> err := newErrorWithStacks(e)</pre></code><tr><td>244<td><code><pre> fmt.Println("error happens:\n ", err)</pre></code><tr><td>245<td><code><pre> }</pre></code><tr><td>246<td><code><pre> }()</pre></code><tr><td>247<td><code><pre> f(e)</pre></code><tr><td>248<td><code><pre> }</pre></code></table><div class=funcname id=fn_configs>func configs</div><div class=info><a href=#s_fn_configs>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/construct.go</code>:</div><table class=listing><tr><td>112<td><code><pre>func configs(appName string) (conf Conf) {</pre></code><tr><td>113<td><code><pre> _ = config.Use(appName).LoadComponentConfig(config.ComponentGoroutinePool, &conf)</pre></code><tr><td>114<td><code><pre> return</pre></code><tr><td>115<td><code><pre>}</pre></code></table><div class=funcname id=fn_@99:10>func @99:10</div><div class=info><a href=#s_fn_@99:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>99<td><code><pre>func(...any) (any, error) { e := v(); return nil, e }</pre></code></table><div class=funcname id=fn_Future.loadVal>func Future.loadVal</div><div class=info><a href=#s_fn_Future.loadVal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>296<td><code><pre>func (f *Future) loadVal() *futureVal {</pre></code><tr><td>297<td><code><pre> r := atomic.LoadPointer(&f.val)</pre></code><tr><td>298<td><code><pre> return (*futureVal)(r)</pre></code><tr><td>299<td><code><pre>}</pre></code></table><div class=funcname id=fn_@80:15>func @80:15</div><div class=info><a href=#s_fn_@80:15>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>80<td><code><pre>func(v any) {</pre></code><tr><td>81<td><code><pre> if opt.ch != nil {</pre></code><tr><td>82<td><code><pre> opt.ch <- v</pre></code><tr><td>83<td><code><pre> }</pre></code><tr><td>84<td><code><pre> }</pre></code></table><div class=funcname id=fn_Future.Get>func Future.Get</div><div class=info><a href=#s_fn_Future.Get>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>136<td><code><pre>func (f *Future) Get() (val any, err error) {</pre></code><tr><td>137<td><code><pre> <-f.final</pre></code><tr><td>138<td><code><pre> return getFutureReturnVal(f.loadResult())</pre></code><tr><td>139<td><code><pre>}</pre></code></table><div class=funcname id=fn_pool.Release>func pool.Release</div><div class=info><a href=#s_fn_pool.Release>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>48<td><code><pre>func (p *pool) Release(opts ...utils.OptionExtender) {</pre></code><tr><td>49<td><code><pre> defer release(p.appName, p, opts...)</pre></code><tr><td>50<td><code><pre> p.pool.Release()</pre></code><tr><td>51<td><code><pre>}</pre></code></table><div class=funcname id=fn_Future.OnSuccess>func Future.OnSuccess</div><div class=info><a href=#s_fn_Future.OnSuccess>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>172<td><code><pre>func (f *Future) OnSuccess(callback func(v any)) *Future {</pre></code><tr><td>173<td><code><pre> f.addCallback(callback, CallbackDone)</pre></code><tr><td>174<td><code><pre> return f</pre></code><tr><td>175<td><code><pre>}</pre></code></table><div class=funcname id=fn_forSlice>func forSlice</div><div class=info><a href=#s_fn_forSlice>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>238<td><code><pre>func forSlice(s []func(v any), f func(func(v any))) {</pre></code><tr><td>239<td><code><pre> for _, e := range s {</pre></code><tr><td>240<td><code><pre> func() {</pre></code><tr><td>241<td><code><pre> defer func() {</pre></code><tr><td>242<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>243<td><code><pre> err := newErrorWithStacks(e)</pre></code><tr><td>244<td><code><pre> fmt.Println("error happens:\n ", err)</pre></code><tr><td>245<td><code><pre> }</pre></code><tr><td>246<td><code><pre> }()</pre></code><tr><td>247<td><code><pre> f(e)</pre></code><tr><td>248<td><code><pre> }()</pre></code><tr><td>249<td><code><pre> }</pre></code><tr><td>250<td><code><pre>}</pre></code></table><div class=funcname id=fn_Future.OnFailure>func Future.OnFailure</div><div class=info><a href=#s_fn_Future.OnFailure>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>180<td><code><pre>func (f *Future) OnFailure(callback func(v any)) *Future {</pre></code><tr><td>181<td><code><pre> f.addCallback(callback, CallbackFail)</pre></code><tr><td>182<td><code><pre> return f</pre></code><tr><td>183<td><code><pre>}</pre></code></table><div class=funcname id=fn_WithoutTimeout>func WithoutTimeout</div><div class=info><a href=#s_fn_WithoutTimeout>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>226<td><code><pre>func WithoutTimeout() utils.OptionFunc[NewPoolOption] {</pre></code><tr><td>227<td><code><pre> return func(o *NewPoolOption) {</pre></code><tr><td>228<td><code><pre> o.ApplyTimeout = -1</pre></code><tr><td>229<td><code><pre> }</pre></code><tr><td>230<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/flag.go</code>:</div><table class=listing><tr><td>7<td><code><pre>func init() {</pre></code><tr><td>8<td><code><pre> pflag.StringVarP(&flagString, "goroutine-config", "", "", "json string for goroutine config")</pre></code><tr><td>9<td><code><pre>}</pre></code></table><div class=funcname id=fn_@227:9>func @227:9</div><div class=info><a href=#s_fn_@227:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>227<td><code><pre>func(o *NewPoolOption) {</pre></code><tr><td>228<td><code><pre> o.ApplyTimeout = -1</pre></code><tr><td>229<td><code><pre> }</pre></code></table><div class=funcname id=fn_@124:15>func @124:15</div><div class=info><a href=#s_fn_@124:15>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>124<td><code><pre>func(v any) {</pre></code><tr><td>125<td><code><pre> c <- f.loadResult()</pre></code><tr><td>126<td><code><pre> }</pre></code></table><div class=funcname id=fn_promise.Resolve>func promise.Resolve</div><div class=info><a href=#s_fn_promise.Resolve>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/promise.go</code>:</div><table class=listing><tr><td>56<td><code><pre>func (p *promise) Resolve(v any) (e error) {</pre></code><tr><td>57<td><code><pre> return p.setResult(&Result{v, ResultSuccess})</pre></code><tr><td>58<td><code><pre>}</pre></code></table><div class=funcname id=fn_forceSync>func forceSync</div><div class=info><a href=#s_fn_forceSync>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/construct.go</code>:</div><table class=listing><tr><td>117<td><code><pre>func forceSync(appName string) bool {</pre></code><tr><td>118<td><code><pre> return configs(appName).ForceSync</pre></code><tr><td>119<td><code><pre>}</pre></code></table><div class=funcname id=fn_@80:16>func @80:16</div><div class=info><a href=#s_fn_@80:16>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/construct.go</code>:</div><table class=listing><tr><td>80<td><code><pre>func() bool {</pre></code><tr><td>81<td><code><pre> return idles[opt.AppName].Load() == int64(conf.MaxRoutineAmount)-ignored[opt.AppName].Load()</pre></code><tr><td>82<td><code><pre> }</pre></code></table><div class=funcname id=fn_@96:9>func @96:9</div><div class=info><a href=#s_fn_@96:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>96<td><code><pre>func(o *internalOption) {</pre></code><tr><td>97<td><code><pre> o.ignoreRecycled = true</pre></code><tr><td>98<td><code><pre> }</pre></code></table><div class=funcname id=fn_ignoreRecycled>func ignoreRecycled</div><div class=info><a href=#s_fn_ignoreRecycled>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>95<td><code><pre>func ignoreRecycled() utils.OptionFunc[internalOption] {</pre></code><tr><td>96<td><code><pre> return func(o *internalOption) {</pre></code><tr><td>97<td><code><pre> o.ignoreRecycled = true</pre></code><tr><td>98<td><code><pre> }</pre></code><tr><td>99<td><code><pre>}</pre></code></table><div class=funcname id=fn_@230:11>func @230:11</div><div class=info><a href=#s_fn_@230:11>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>230<td><code><pre>func(s []func(v any)) {</pre></code><tr><td>231<td><code><pre> forSlice(s, func(f func(v any)) { f(r.Result) })</pre></code><tr><td>232<td><code><pre> }</pre></code></table><div class=funcname id=fn_AppName>func AppName</div><div class=info><a href=#s_fn_AppName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>43<td><code><pre>func AppName(name string) utils.OptionFunc[candyOption] {</pre></code><tr><td>44<td><code><pre> return func(o *candyOption) {</pre></code><tr><td>45<td><code><pre> o.appName = name</pre></code><tr><td>46<td><code><pre> }</pre></code><tr><td>47<td><code><pre>}</pre></code></table><div class=funcname id=fn_@38:24>func @38:24</div><div class=info><a href=#s_fn_@38:24>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func() { e = wrapFn(opt.args...) }</pre></code></table><div class=funcname id=fn_Args>func Args</div><div class=info><a href=#s_fn_Args>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>25<td><code><pre>func Args(args ...any) utils.OptionFunc[candyOption] {</pre></code><tr><td>26<td><code><pre> return func(o *candyOption) {</pre></code><tr><td>27<td><code><pre> o.args = append(o.args, args...)</pre></code><tr><td>28<td><code><pre> }</pre></code><tr><td>29<td><code><pre>}</pre></code></table><div class=funcname id=fn_@231:15>func @231:15</div><div class=info><a href=#s_fn_@231:15>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>231<td><code><pre>func(f func(v any)) { f(r.Result) }</pre></code></table><div class=funcname id=fn_@50:9>func @50:9</div><div class=info><a href=#s_fn_@50:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>50<td><code><pre>func(o *candyOption) {</pre></code><tr><td>51<td><code><pre> o.funcName = name</pre></code><tr><td>52<td><code><pre> }</pre></code></table><div class=funcname id=fn_FuncName>func FuncName</div><div class=info><a href=#s_fn_FuncName>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>49<td><code><pre>func FuncName(name string) utils.OptionFunc[candyOption] {</pre></code><tr><td>50<td><code><pre> return func(o *candyOption) {</pre></code><tr><td>51<td><code><pre> o.funcName = name</pre></code><tr><td>52<td><code><pre> }</pre></code><tr><td>53<td><code><pre>}</pre></code></table><div class=funcname id=fn_@44:9>func @44:9</div><div class=info><a href=#s_fn_@44:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>44<td><code><pre>func(o *candyOption) {</pre></code><tr><td>45<td><code><pre> o.appName = name</pre></code><tr><td>46<td><code><pre> }</pre></code></table><div class=funcname id=fn_@38:9>func @38:9</div><div class=info><a href=#s_fn_@38:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>38<td><code><pre>func(o *candyOption) {</pre></code><tr><td>39<td><code><pre> o.ch = ch</pre></code><tr><td>40<td><code><pre> }</pre></code></table><div class=funcname id=fn_Channel>func Channel</div><div class=info><a href=#s_fn_Channel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>37<td><code><pre>func Channel(ch chan<- any) utils.OptionFunc[candyOption] {</pre></code><tr><td>38<td><code><pre> return func(o *candyOption) {</pre></code><tr><td>39<td><code><pre> o.ch = ch</pre></code><tr><td>40<td><code><pre> }</pre></code><tr><td>41<td><code><pre>}</pre></code></table><div class=funcname id=fn_@32:9>func @32:9</div><div class=info><a href=#s_fn_@32:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func(o *candyOption) {</pre></code><tr><td>33<td><code><pre> o.wg = wg</pre></code><tr><td>34<td><code><pre> }</pre></code></table><div class=funcname id=fn_WaitGroup>func WaitGroup</div><div class=info><a href=#s_fn_WaitGroup>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>31<td><code><pre>func WaitGroup(wg *sync.WaitGroup) utils.OptionFunc[candyOption] {</pre></code><tr><td>32<td><code><pre> return func(o *candyOption) {</pre></code><tr><td>33<td><code><pre> o.wg = wg</pre></code><tr><td>34<td><code><pre> }</pre></code><tr><td>35<td><code><pre>}</pre></code></table><div class=funcname id=fn_@26:9>func @26:9</div><div class=info><a href=#s_fn_@26:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>26<td><code><pre>func(o *candyOption) {</pre></code><tr><td>27<td><code><pre> o.args = append(o.args, args...)</pre></code><tr><td>28<td><code><pre> }</pre></code></table><div class=funcname id=fn_promise.Reject>func promise.Reject</div><div class=info><a href=#s_fn_promise.Reject>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/promise.go</code>:</div><table class=listing><tr><td>62<td><code><pre>func (p *promise) Reject(err error) (e error) {</pre></code><tr><td>63<td><code><pre> return p.setResult(&Result{err, ResultFailure})</pre></code><tr><td>64<td><code><pre>}</pre></code></table><div class=funcname id=fn_init>func init</div><div class=info><a href=#s_fn_init>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/construct.go</code>:</div><table class=listing><tr><td>121<td><code><pre>func init() {</pre></code><tr><td>122<td><code><pre> config.AddComponent(config.ComponentGoroutinePool, Construct, config.WithFlag(&flagString))</pre></code><tr><td>123<td><code><pre>}</pre></code></table><div class=funcname id=fn_NewPool>func NewPool</div><div class=info><a href=#s_fn_NewPool>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>57<td><code><pre>func NewPool(name string, size int, opts ...utils.OptionExtender) (p Pool) {</pre></code><tr><td>58<td><code><pre> o := utils.ApplyOptions[NewPoolOption](opts...)</pre></code><tr><td>59<td><code><pre> opt := utils.ApplyOptions[candyOption](opts...)</pre></code><tr><td>60<td><code><pre> if o.Logger == nil {</pre></code><tr><td>61<td><code><pre> o.Logger = defaultLogger[opt.appName]</pre></code><tr><td>62<td><code><pre> }</pre></code><tr><td>63<td><code><pre></pre></code><tr><td>64<td><code><pre> validate(opt.appName, name)</pre></code><tr><td>65<td><code><pre> allocate(opt.appName, size, o)</pre></code><tr><td>66<td><code><pre></pre></code><tr><td>67<td><code><pre> antsPool, err := ants.NewPool(size, ants.WithOptions(ants.Options{</pre></code><tr><td>68<td><code><pre> ExpiryDuration: o.ExpiryDuration,</pre></code><tr><td>69<td><code><pre> PreAlloc: o.PreAlloc,</pre></code><tr><td>70<td><code><pre> MaxBlockingTasks: o.MaxBlockingTasks,</pre></code><tr><td>71<td><code><pre> Nonblocking: o.Nonblocking,</pre></code><tr><td>72<td><code><pre> PanicHandler: o.PanicHandler,</pre></code><tr><td>73<td><code><pre> Logger: o.Logger,</pre></code><tr><td>74<td><code><pre> DisablePurge: o.DisablePurge,</pre></code><tr><td>75<td><code><pre> }))</pre></code><tr><td>76<td><code><pre> if err != nil {</pre></code><tr class=miss><td>77<td><code><pre> panic(err)</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre></pre></code><tr><td>80<td><code><pre> p = &pool{appName: opt.appName, name: name, pool: antsPool, option: o}</pre></code><tr><td>81<td><code><pre> addPool(opt.appName, name, p)</pre></code><tr><td>82<td><code><pre> return</pre></code><tr><td>83<td><code><pre>}</pre></code></table><div class=funcname id=fn_whenAllFuture>func whenAllFuture</div><div class=info><a href=#s_fn_whenAllFuture>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>452<td><code><pre>func whenAllFuture(fs []*Future, opts ...utils.OptionExtender) *Future {</pre></code><tr><td>453<td><code><pre> opt := utils.ApplyOptions[candyOption](opts...)</pre></code><tr><td>454<td><code><pre> wf := NewPromise()</pre></code><tr><td>455<td><code><pre> wf.AppName = opt.appName</pre></code><tr><td>456<td><code><pre> rs := make([]any, len(fs))</pre></code><tr><td>457<td><code><pre></pre></code><tr><td>458<td><code><pre> if len(fs) == 0 {</pre></code><tr class=miss><td>459<td><code><pre> _ = wf.Resolve([]any{})</pre></code><tr><td>460<td><code><pre> } else {</pre></code><tr><td>461<td><code><pre> n := int32(len(fs))</pre></code><tr><td>462<td><code><pre> cancelOthers := func(j int) {</pre></code><tr><td>463<td><code><pre> for k, f1 := range fs {</pre></code><tr><td>464<td><code><pre> if k != j {</pre></code><tr><td>465<td><code><pre> _ = f1.Cancel()</pre></code><tr><td>466<td><code><pre> }</pre></code><tr><td>467<td><code><pre> }</pre></code><tr><td>468<td><code><pre> }</pre></code><tr><td>469<td><code><pre></pre></code><tr><td>470<td><code><pre> go func() {</pre></code><tr><td>471<td><code><pre> defer func() {</pre></code><tr><td>472<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>473<td><code><pre> _ = wf.Reject(newErrorWithStacks(e))</pre></code><tr><td>474<td><code><pre> }</pre></code><tr><td>475<td><code><pre> }()</pre></code><tr><td>476<td><code><pre></pre></code><tr><td>477<td><code><pre> isCancelled := int32(0)</pre></code><tr><td>478<td><code><pre> for i, f := range fs {</pre></code><tr><td>479<td><code><pre> j := i</pre></code><tr><td>480<td><code><pre></pre></code><tr><td>481<td><code><pre> f.OnSuccess(func(v any) {</pre></code><tr><td>482<td><code><pre> rs[j] = v</pre></code><tr><td>483<td><code><pre> if atomic.AddInt32(&n, -1) == 0 {</pre></code><tr><td>484<td><code><pre> _ = wf.Resolve(rs)</pre></code><tr><td>485<td><code><pre> }</pre></code><tr><td>486<td><code><pre> }).OnFailure(func(v any) {</pre></code><tr><td>487<td><code><pre> if atomic.CompareAndSwapInt32(&isCancelled, 0, 1) {</pre></code><tr><td>488<td><code><pre> // try to cancel all futures</pre></code><tr><td>489<td><code><pre> cancelOthers(j)</pre></code><tr><td>490<td><code><pre></pre></code><tr><td>491<td><code><pre> // errs := make([]error, 0, 1)</pre></code><tr><td>492<td><code><pre> // errs = append(errs, v.(error))</pre></code><tr><td>493<td><code><pre> e := newAggregateError1("error appears in WhenAll:", v)</pre></code><tr><td>494<td><code><pre> _ = wf.Reject(e)</pre></code><tr><td>495<td><code><pre> }</pre></code><tr><td>496<td><code><pre> }).OnCancel(func() {</pre></code><tr><td>497<td><code><pre> if atomic.CompareAndSwapInt32(&isCancelled, 0, 1) {</pre></code><tr><td>498<td><code><pre> // try to cancel all futures</pre></code><tr><td>499<td><code><pre> cancelOthers(j)</pre></code><tr><td>500<td><code><pre></pre></code><tr><td>501<td><code><pre> _ = wf.Cancel()</pre></code><tr><td>502<td><code><pre> }</pre></code><tr><td>503<td><code><pre> })</pre></code><tr><td>504<td><code><pre> }</pre></code><tr><td>505<td><code><pre> }()</pre></code><tr><td>506<td><code><pre> }</pre></code><tr><td>507<td><code><pre></pre></code><tr><td>508<td><code><pre> return wf.Future</pre></code><tr><td>509<td><code><pre>}</pre></code></table><div class=funcname id=fn_allocate>func allocate</div><div class=info><a href=#s_fn_allocate>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>107<td><code><pre>func allocate(appName string, delta int, o *NewPoolOption, opts ...utils.OptionExtender) {</pre></code><tr><td>108<td><code><pre> oo := utils.ApplyOptions[internalOption](opts...)</pre></code><tr><td>109<td><code><pre> demands := int64(delta)</pre></code><tr><td>110<td><code><pre> rwlock.RLock()</pre></code><tr><td>111<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>112<td><code><pre> if idles[appName].Load()-demands < 0 && o.ApplyTimeout == 0 {</pre></code><tr class=miss><td>113<td><code><pre> panic(ErrPoolOverload)</pre></code><tr><td>114<td><code><pre> }</pre></code><tr><td>115<td><code><pre></pre></code><tr><td>116<td><code><pre> if o.ApplyTimeout < 0 {</pre></code><tr><td>117<td><code><pre> o.ApplyTimeout = math.MaxInt64</pre></code><tr><td>118<td><code><pre> }</pre></code><tr><td>119<td><code><pre></pre></code><tr><td>120<td><code><pre> t := time.NewTimer(o.ApplyTimeout)</pre></code><tr><td>121<td><code><pre> for {</pre></code><tr><td>122<td><code><pre> select {</pre></code><tr><td>123<td><code><pre> case <-t.C:</pre></code><tr class=miss><td>124<td><code><pre> panic(ErrTimeout)</pre></code><tr><td>125<td><code><pre> default:</pre></code><tr><td>126<td><code><pre> minuend := idles[appName].Load()</pre></code><tr><td>127<td><code><pre> diff := minuend - demands</pre></code><tr><td>128<td><code><pre> // main thread is a goroutine as well, so diff should be greater than 0</pre></code><tr><td>129<td><code><pre> if diff <= 0 || !idles[appName].CompareAndSwap(minuend, diff) {</pre></code><tr><td>130<td><code><pre> continue</pre></code><tr><td>131<td><code><pre> }</pre></code><tr><td>132<td><code><pre> if oo.ignoreRecycled {</pre></code><tr><td>133<td><code><pre> ignored[appName].Add(demands)</pre></code><tr><td>134<td><code><pre> }</pre></code><tr><td>135<td><code><pre></pre></code><tr><td>136<td><code><pre> return</pre></code><tr><td>137<td><code><pre> }</pre></code><tr><td>138<td><code><pre> }</pre></code><tr><td>139<td><code><pre>}</pre></code></table><div class=funcname id=fn_Goc>func Goc</div><div class=info><a href=#s_fn_Goc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>95<td><code><pre>func Goc(ctx context.Context, task any, opts ...utils.OptionExtender) {</pre></code><tr><td>96<td><code><pre> opt := utils.ApplyOptions[candyOption](opts...)</pre></code><tr><td>97<td><code><pre> if opt.funcName == "" {</pre></code><tr><td>98<td><code><pre> opt.funcName = utils.GetFuncName(task)</pre></code><tr><td>99<td><code><pre> }</pre></code><tr><td>100<td><code><pre> allocate(opt.appName, 1, &NewPoolOption{ApplyTimeout: -1})</pre></code><tr><td>101<td><code><pre> exec := func() {</pre></code><tr><td>102<td><code><pre> defer func() {</pre></code><tr><td>103<td><code><pre> release(opt.appName, nil, nil)</pre></code><tr><td>104<td><code><pre> delRoutine(opt.appName, opt.funcName)</pre></code><tr><td>105<td><code><pre> if opt.wg != nil {</pre></code><tr><td>106<td><code><pre> opt.wg.Done()</pre></code><tr><td>107<td><code><pre> }</pre></code><tr><td>108<td><code><pre> wg.Done()</pre></code><tr><td>109<td><code><pre> }()</pre></code><tr><td>110<td><code><pre></pre></code><tr><td>111<td><code><pre> addRoutine(opt.appName, opt.funcName)</pre></code><tr><td>112<td><code><pre> select {</pre></code><tr><td>113<td><code><pre> case <-ctx.Done():</pre></code><tr><td>114<td><code><pre> case <-wrapPromise(task, false, opts...).</pre></code><tr><td>115<td><code><pre> OnFailure(func(v any) {</pre></code><tr><td>116<td><code><pre> if opt.ch == nil {</pre></code><tr><td>117<td><code><pre> log.Printf("[Gofusion] %s catches an error in routine.Goc function: \n"+</pre></code><tr><td>118<td><code><pre> "error: %s\nfunc: %s\nfunc signature: %T",</pre></code><tr><td>119<td><code><pre> config.ComponentGoroutinePool, v, utils.GetFuncName(task), task)</pre></code><tr><td>120<td><code><pre> }</pre></code><tr><td>121<td><code><pre> }).</pre></code><tr><td>122<td><code><pre> OnComplete(func(v any) {</pre></code><tr><td>123<td><code><pre> if opt.ch != nil {</pre></code><tr><td>124<td><code><pre> opt.ch <- v</pre></code><tr><td>125<td><code><pre> }</pre></code><tr><td>126<td><code><pre> }).</pre></code><tr><td>127<td><code><pre> GetChan():</pre></code><tr><td>128<td><code><pre> }</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre></pre></code><tr><td>131<td><code><pre> wg.Add(1)</pre></code><tr><td>132<td><code><pre> if forceSync(opt.appName) {</pre></code><tr class=miss><td>133<td><code><pre> exec()</pre></code><tr><td>134<td><code><pre> } else {</pre></code><tr><td>135<td><code><pre> go exec()</pre></code><tr><td>136<td><code><pre> }</pre></code><tr><td>137<td><code><pre>}</pre></code></table><div class=funcname id=fn_Go>func Go</div><div class=info><a href=#s_fn_Go>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>55<td><code><pre>func Go(task any, opts ...utils.OptionExtender) {</pre></code><tr><td>56<td><code><pre> opt := utils.ApplyOptions[candyOption](opts...)</pre></code><tr><td>57<td><code><pre> if opt.funcName == "" {</pre></code><tr><td>58<td><code><pre> opt.funcName = utils.GetFuncName(task)</pre></code><tr><td>59<td><code><pre> }</pre></code><tr><td>60<td><code><pre> allocate(opt.appName, 1, &NewPoolOption{ApplyTimeout: -1})</pre></code><tr><td>61<td><code><pre> exec := func() {</pre></code><tr><td>62<td><code><pre> defer func() {</pre></code><tr><td>63<td><code><pre> release(opt.appName, nil, nil)</pre></code><tr><td>64<td><code><pre> delRoutine(opt.appName, opt.funcName)</pre></code><tr><td>65<td><code><pre> if opt.wg != nil {</pre></code><tr><td>66<td><code><pre> opt.wg.Done()</pre></code><tr><td>67<td><code><pre> }</pre></code><tr><td>68<td><code><pre> wg.Done()</pre></code><tr><td>69<td><code><pre> }()</pre></code><tr><td>70<td><code><pre></pre></code><tr><td>71<td><code><pre> addRoutine(opt.appName, opt.funcName)</pre></code><tr><td>72<td><code><pre> wrapPromise(task, false, opts...).</pre></code><tr><td>73<td><code><pre> OnFailure(func(v any) {</pre></code><tr><td>74<td><code><pre> if opt.ch == nil {</pre></code><tr><td>75<td><code><pre> log.Printf("[Gofusion] %s catches an error in routine.Go function: \n"+</pre></code><tr><td>76<td><code><pre> "error: %s\nfunc: %s\nfunc signature: %T",</pre></code><tr><td>77<td><code><pre> config.ComponentGoroutinePool, v, utils.GetFuncName(task), task)</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre> }).</pre></code><tr><td>80<td><code><pre> OnComplete(func(v any) {</pre></code><tr><td>81<td><code><pre> if opt.ch != nil {</pre></code><tr><td>82<td><code><pre> opt.ch <- v</pre></code><tr><td>83<td><code><pre> }</pre></code><tr><td>84<td><code><pre> })</pre></code><tr><td>85<td><code><pre> }</pre></code><tr><td>86<td><code><pre></pre></code><tr><td>87<td><code><pre> wg.Add(1)</pre></code><tr><td>88<td><code><pre> if forceSync(opt.appName) {</pre></code><tr class=miss><td>89<td><code><pre> exec()</pre></code><tr><td>90<td><code><pre> } else {</pre></code><tr><td>91<td><code><pre> go exec()</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre>}</pre></code></table><div class=funcname id=fn_WhenAll>func WhenAll</div><div class=info><a href=#s_fn_WhenAll>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>421<td><code><pre>func WhenAll(acts ...any) (fu *Future) {</pre></code><tr><td>422<td><code><pre> p := NewPromise()</pre></code><tr><td>423<td><code><pre> fu = p.Future</pre></code><tr><td>424<td><code><pre></pre></code><tr><td>425<td><code><pre> opts := make([]utils.OptionExtender, 0, len(acts))</pre></code><tr><td>426<td><code><pre> for i, act := range acts {</pre></code><tr><td>427<td><code><pre> if opt, ok := act.(utils.OptionExtender); ok {</pre></code><tr><td>428<td><code><pre> opts = append(opts, opt)</pre></code><tr><td>429<td><code><pre> acts = append(acts[:i], acts[i+1:]...)</pre></code><tr><td>430<td><code><pre> }</pre></code><tr><td>431<td><code><pre> }</pre></code><tr><td>432<td><code><pre> opt := utils.ApplyOptions[candyOption](opts...)</pre></code><tr><td>433<td><code><pre> p.AppName = opt.appName</pre></code><tr><td>434<td><code><pre> if len(acts) == 0 {</pre></code><tr class=miss><td>435<td><code><pre> _ = p.Resolve([]any{})</pre></code><tr class=miss><td>436<td><code><pre> return</pre></code><tr><td>437<td><code><pre> }</pre></code><tr><td>438<td><code><pre></pre></code><tr><td>439<td><code><pre> fs := make([]*Future, len(acts))</pre></code><tr><td>440<td><code><pre> for i, act := range acts {</pre></code><tr><td>441<td><code><pre> fs[i] = Promise(act, true, opts...)</pre></code><tr><td>442<td><code><pre> }</pre></code><tr><td>443<td><code><pre> fu = whenAllFuture(fs, opts...)</pre></code><tr><td>444<td><code><pre> return</pre></code><tr><td>445<td><code><pre>}</pre></code></table><div class=funcname id=fn_Future.setResult>func Future.setResult</div><div class=info><a href=#s_fn_Future.setResult>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>302<td><code><pre>func (f *Future) setResult(r *Result) (e error) {</pre></code><tr><td>303<td><code><pre> defer func() {</pre></code><tr><td>304<td><code><pre> if err := getError(recover()); err != nil {</pre></code><tr><td>305<td><code><pre> e = err</pre></code><tr><td>306<td><code><pre> fmt.Printf("\nerror in setResult(): %s\n%s\n", err, debug.Stack())</pre></code><tr><td>307<td><code><pre> }</pre></code><tr><td>308<td><code><pre> }()</pre></code><tr><td>309<td><code><pre></pre></code><tr><td>310<td><code><pre> e = errors.New("cannot resolve/reject/cancel more than once")</pre></code><tr><td>311<td><code><pre></pre></code><tr><td>312<td><code><pre> for {</pre></code><tr><td>313<td><code><pre> v := f.loadVal()</pre></code><tr><td>314<td><code><pre> if v.r != nil {</pre></code><tr class=miss><td>315<td><code><pre> return</pre></code><tr><td>316<td><code><pre> }</pre></code><tr><td>317<td><code><pre> newVal := *v</pre></code><tr><td>318<td><code><pre> newVal.r = r</pre></code><tr><td>319<td><code><pre></pre></code><tr><td>320<td><code><pre> // Use CAS operation to ensure that the state of promise isn't changed.</pre></code><tr><td>321<td><code><pre> // If the state is changed, must get the latest state and try to call CAS again.</pre></code><tr><td>322<td><code><pre> // No ABA issue in this case because address of all objects are different.</pre></code><tr><td>323<td><code><pre> if atomic.CompareAndSwapPointer(&f.val, unsafe.Pointer(v), unsafe.Pointer(&newVal)) {</pre></code><tr><td>324<td><code><pre> // Close chEnd then all Get() and GetOrTimeout() will be unblocked</pre></code><tr><td>325<td><code><pre> close(f.final)</pre></code><tr><td>326<td><code><pre></pre></code><tr><td>327<td><code><pre> // call callback functions and start the promise pipeline</pre></code><tr><td>328<td><code><pre> if len(v.dones) > 0 || len(v.fails) > 0 || len(v.always) > 0 || len(v.cancels) > 0 {</pre></code><tr><td>329<td><code><pre> go func() {</pre></code><tr><td>330<td><code><pre> defer func() {</pre></code><tr><td>331<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>332<td><code><pre> err := newErrorWithStacks(e)</pre></code><tr><td>333<td><code><pre> fmt.Println("error happens:\n ", err)</pre></code><tr><td>334<td><code><pre> }</pre></code><tr><td>335<td><code><pre> }()</pre></code><tr><td>336<td><code><pre> execCallback(r, v.dones, v.fails, v.always, v.cancels)</pre></code><tr><td>337<td><code><pre> }()</pre></code><tr><td>338<td><code><pre> }</pre></code><tr><td>339<td><code><pre></pre></code><tr><td>340<td><code><pre> // start the pipeline</pre></code><tr><td>341<td><code><pre> if len(v.pipes) > 0 {</pre></code><tr class=miss><td>342<td><code><pre> go func() {</pre></code><tr><td>343<td><code><pre> defer func() {</pre></code><tr><td>344<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>345<td><code><pre> err := newErrorWithStacks(e)</pre></code><tr><td>346<td><code><pre> fmt.Println("error happens:\n ", err)</pre></code><tr><td>347<td><code><pre> }</pre></code><tr><td>348<td><code><pre> }()</pre></code><tr><td>349<td><code><pre> for _, pipe := range v.pipes {</pre></code><tr><td>350<td><code><pre> pipeTask, pipePromise := pipe.getPipe(r.Typ == ResultSuccess)</pre></code><tr><td>351<td><code><pre> startPipe(r, pipeTask, pipePromise)</pre></code><tr><td>352<td><code><pre> }</pre></code><tr><td>353<td><code><pre> }()</pre></code><tr><td>354<td><code><pre> }</pre></code><tr><td>355<td><code><pre> e = nil</pre></code><tr><td>356<td><code><pre> break</pre></code><tr><td>357<td><code><pre> }</pre></code><tr><td>358<td><code><pre> }</pre></code><tr><td>359<td><code><pre> return</pre></code><tr><td>360<td><code><pre>}</pre></code></table><div class=funcname id=fn_release>func release</div><div class=info><a href=#s_fn_release>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>141<td><code><pre>func release(appName string, p *pool, opts ...utils.OptionExtender) {</pre></code><tr><td>142<td><code><pre> o := utils.ApplyOptions[internalOption](opts...)</pre></code><tr><td>143<td><code><pre> delta := int64(1)</pre></code><tr><td>144<td><code><pre> if pools == nil || pools[appName] == nil || idles == nil || idles[appName] == nil {</pre></code><tr class=miss><td>145<td><code><pre> return</pre></code><tr><td>146<td><code><pre> }</pre></code><tr><td>147<td><code><pre></pre></code><tr><td>148<td><code><pre> if p != nil {</pre></code><tr><td>149<td><code><pre> if !o.ignoreMutex {</pre></code><tr><td>150<td><code><pre> rwlock.Lock()</pre></code><tr><td>151<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>152<td><code><pre> }</pre></code><tr><td>153<td><code><pre> delete(pools[appName], p.name)</pre></code><tr><td>154<td><code><pre> delta = int64(p.pool.Cap())</pre></code><tr><td>155<td><code><pre> }</pre></code><tr><td>156<td><code><pre></pre></code><tr><td>157<td><code><pre> alloc := idles[appName]</pre></code><tr><td>158<td><code><pre> if alloc == nil {</pre></code><tr class=miss><td>159<td><code><pre> return</pre></code><tr><td>160<td><code><pre> }</pre></code><tr><td>161<td><code><pre> alloc.Add(delta)</pre></code><tr><td>162<td><code><pre> if o != nil && o.ignoreRecycled {</pre></code><tr><td>163<td><code><pre> alloc.Sub(delta)</pre></code><tr><td>164<td><code><pre> }</pre></code><tr><td>165<td><code><pre>}</pre></code></table><div class=funcname id=fn_start>func start</div><div class=info><a href=#s_fn_start>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>532<td><code><pre>func start(act any, async bool, opts ...utils.OptionExtender) *Future {</pre></code><tr><td>533<td><code><pre> if f, ok := act.(*Future); ok {</pre></code><tr class=miss><td>534<td><code><pre> return f</pre></code><tr><td>535<td><code><pre> }</pre></code><tr><td>536<td><code><pre></pre></code><tr><td>537<td><code><pre> opt := utils.ApplyOptions[candyOption](opts...)</pre></code><tr><td>538<td><code><pre> p := NewPromise()</pre></code><tr><td>539<td><code><pre> p.AppName = opt.appName</pre></code><tr><td>540<td><code><pre> if action := getAct(p, act); action != nil {</pre></code><tr><td>541<td><code><pre> if !async {</pre></code><tr><td>542<td><code><pre> // sync call</pre></code><tr><td>543<td><code><pre> r, err := action(opt)</pre></code><tr><td>544<td><code><pre> if p.IsCancelled() {</pre></code><tr class=miss><td>545<td><code><pre> _ = p.Cancel()</pre></code><tr><td>546<td><code><pre> } else {</pre></code><tr><td>547<td><code><pre> if err == nil {</pre></code><tr><td>548<td><code><pre> _ = p.Resolve(r)</pre></code><tr><td>549<td><code><pre> } else {</pre></code><tr><td>550<td><code><pre> _ = p.Reject(err)</pre></code><tr><td>551<td><code><pre> }</pre></code><tr><td>552<td><code><pre> }</pre></code><tr><td>553<td><code><pre> } else {</pre></code><tr><td>554<td><code><pre> // async call</pre></code><tr><td>555<td><code><pre> Go(func() {</pre></code><tr><td>556<td><code><pre> r, err := action(opt)</pre></code><tr><td>557<td><code><pre> if p.IsCancelled() {</pre></code><tr><td>558<td><code><pre> _ = p.Cancel()</pre></code><tr><td>559<td><code><pre> } else {</pre></code><tr><td>560<td><code><pre> if err == nil {</pre></code><tr><td>561<td><code><pre> _ = p.Resolve(r)</pre></code><tr><td>562<td><code><pre> } else {</pre></code><tr><td>563<td><code><pre> _ = p.Reject(err)</pre></code><tr><td>564<td><code><pre> }</pre></code><tr><td>565<td><code><pre> }</pre></code><tr><td>566<td><code><pre> }, opts...)</pre></code><tr><td>567<td><code><pre> }</pre></code><tr><td>568<td><code><pre> }</pre></code><tr><td>569<td><code><pre></pre></code><tr><td>570<td><code><pre> return p.Future</pre></code><tr><td>571<td><code><pre>}</pre></code></table><div class=funcname id=fn_delRoutine>func delRoutine</div><div class=info><a href=#s_fn_delRoutine>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/types.go</code>:</div><table class=listing><tr><td>65<td><code><pre>func delRoutine(appName, name string) {</pre></code><tr><td>66<td><code><pre> locker.Lock()</pre></code><tr><td>67<td><code><pre> defer locker.Unlock()</pre></code><tr><td>68<td><code><pre> if routines == nil || routines[appName] == nil {</pre></code><tr class=miss><td>69<td><code><pre> return</pre></code><tr><td>70<td><code><pre> }</pre></code><tr><td>71<td><code><pre></pre></code><tr><td>72<td><code><pre> if routines[appName][name]--; routines[appName][name] <= 0 {</pre></code><tr><td>73<td><code><pre> delete(routines, name)</pre></code><tr><td>74<td><code><pre> }</pre></code><tr><td>75<td><code><pre>}</pre></code></table><div class=funcname id=fn_Future.addCallback>func Future.addCallback</div><div class=info><a href=#s_fn_Future.addCallback>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>363<td><code><pre>func (f *Future) addCallback(callback any, t callbackType) {</pre></code><tr><td>364<td><code><pre> if callback == nil {</pre></code><tr class=miss><td>365<td><code><pre> return</pre></code><tr><td>366<td><code><pre> }</pre></code><tr><td>367<td><code><pre> if (t == CallbackDone) ||</pre></code><tr><td>368<td><code><pre> (t == CallbackFail) ||</pre></code><tr><td>369<td><code><pre> (t == CallbackAlways) {</pre></code><tr><td>370<td><code><pre> if _, ok := callback.(func(v any)); !ok {</pre></code><tr class=miss><td>371<td><code><pre> panic(errors.New("callback function spec must be func(v any)"))</pre></code><tr><td>372<td><code><pre> }</pre></code><tr><td>373<td><code><pre> } else if t == CallbackCancel {</pre></code><tr><td>374<td><code><pre> if _, ok := callback.(func()); !ok {</pre></code><tr class=miss><td>375<td><code><pre> panic(errors.New("callback function spec must be func()"))</pre></code><tr><td>376<td><code><pre> }</pre></code><tr><td>377<td><code><pre> }</pre></code><tr><td>378<td><code><pre></pre></code><tr><td>379<td><code><pre> for {</pre></code><tr><td>380<td><code><pre> v := f.loadVal()</pre></code><tr><td>381<td><code><pre> r := v.r</pre></code><tr><td>382<td><code><pre> if r == nil {</pre></code><tr><td>383<td><code><pre> newVal := *v</pre></code><tr><td>384<td><code><pre> switch t {</pre></code><tr><td>385<td><code><pre> case CallbackDone:</pre></code><tr><td>386<td><code><pre> newVal.dones = append(newVal.dones, callback.(func(v any)))</pre></code><tr><td>387<td><code><pre> case CallbackFail:</pre></code><tr><td>388<td><code><pre> newVal.fails = append(newVal.fails, callback.(func(v any)))</pre></code><tr><td>389<td><code><pre> case CallbackAlways:</pre></code><tr><td>390<td><code><pre> newVal.always = append(newVal.always, callback.(func(v any)))</pre></code><tr><td>391<td><code><pre> case CallbackCancel:</pre></code><tr><td>392<td><code><pre> newVal.cancels = append(newVal.cancels, callback.(func()))</pre></code><tr><td>393<td><code><pre> }</pre></code><tr><td>394<td><code><pre></pre></code><tr><td>395<td><code><pre> // use CAS to ensure that the state of Future is not changed,</pre></code><tr><td>396<td><code><pre> // if the state is changed, will retry CAS operation.</pre></code><tr><td>397<td><code><pre> if atomic.CompareAndSwapPointer(&f.val, unsafe.Pointer(v), unsafe.Pointer(&newVal)) {</pre></code><tr><td>398<td><code><pre> break</pre></code><tr><td>399<td><code><pre> }</pre></code><tr><td>400<td><code><pre> } else {</pre></code><tr><td>401<td><code><pre> if (t == CallbackDone && r.Typ == ResultSuccess) ||</pre></code><tr><td>402<td><code><pre> (t == CallbackFail && r.Typ == ResultFailure) ||</pre></code><tr><td>403<td><code><pre> (t == CallbackAlways && r.Typ != ResultCancelled) {</pre></code><tr><td>404<td><code><pre> callbackFunc := callback.(func(v any))</pre></code><tr><td>405<td><code><pre> callbackFunc(r.Result)</pre></code><tr><td>406<td><code><pre> } else if t == CallbackCancel && r.Typ == ResultCancelled {</pre></code><tr class=miss><td>407<td><code><pre> callbackFunc := callback.(func())</pre></code><tr class=miss><td>408<td><code><pre> callbackFunc()</pre></code><tr><td>409<td><code><pre> }</pre></code><tr><td>410<td><code><pre> break</pre></code><tr><td>411<td><code><pre> }</pre></code><tr><td>412<td><code><pre> }</pre></code><tr><td>413<td><code><pre>}</pre></code></table><div class=funcname id=fn_@132:6>func @132:6</div><div class=info><a href=#s_fn_@132:6>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>132<td><code><pre>func(opt *candyOption) (r any, err error) {</pre></code><tr><td>133<td><code><pre> defer func() {</pre></code><tr><td>134<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>135<td><code><pre> err = newErrorWithStacks(e)</pre></code><tr><td>136<td><code><pre> }</pre></code><tr><td>137<td><code><pre> }()</pre></code><tr><td>138<td><code><pre></pre></code><tr><td>139<td><code><pre> if canCancel {</pre></code><tr class=miss><td>140<td><code><pre> r, err = act2(canceller, opt.args...)</pre></code><tr><td>141<td><code><pre> } else {</pre></code><tr><td>142<td><code><pre> r, err = act1(opt.args...)</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre></pre></code><tr><td>145<td><code><pre> return</pre></code><tr><td>146<td><code><pre> }</pre></code></table><div class=funcname id=fn_pool.Submit>func pool.Submit</div><div class=info><a href=#s_fn_pool.Submit>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>34<td><code><pre>func (p *pool) Submit(task any, opts ...utils.OptionExtender) (e error) {</pre></code><tr><td>35<td><code><pre> opt := utils.ApplyOptions[candyOption](opts...)</pre></code><tr><td>36<td><code><pre> wrapFn := utils.WrapFunc1[error](task)</pre></code><tr><td>37<td><code><pre> if !forceSync(p.appName) {</pre></code><tr><td>38<td><code><pre> return p.pool.Submit(func() { e = wrapFn(opt.args...) })</pre></code><tr><td>39<td><code><pre> }</pre></code><tr><td>40<td><code><pre></pre></code><tr class=miss><td>41<td><code><pre> return wrapFn(opt.args...)</pre></code><tr><td>42<td><code><pre>}</pre></code></table><div class=funcname id=fn_@74:9>func @74:9</div><div class=info><a href=#s_fn_@74:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/construct.go</code>:</div><table class=listing><tr><td>74<td><code><pre>func() {</pre></code><tr><td>75<td><code><pre> rwlock.Lock()</pre></code><tr><td>76<td><code><pre> defer rwlock.Unlock()</pre></code><tr><td>77<td><code><pre></pre></code><tr><td>78<td><code><pre> pid := syscall.Getpid()</pre></code><tr><td>79<td><code><pre> app := config.Use(opt.AppName).AppName()</pre></code><tr><td>80<td><code><pre> allExited := func() bool {</pre></code><tr><td>81<td><code><pre> return idles[opt.AppName].Load() == int64(conf.MaxRoutineAmount)-ignored[opt.AppName].Load()</pre></code><tr><td>82<td><code><pre> }</pre></code><tr><td>83<td><code><pre></pre></code><tr><td>84<td><code><pre> // waiting for pool</pre></code><tr><td>85<td><code><pre> if pools != nil {</pre></code><tr><td>86<td><code><pre> for name, pool := range pools[opt.AppName] {</pre></code><tr class=miss><td>87<td><code><pre> if err := pool.ReleaseTimeout(maxReleaseTime, ignoreMutex()); err != nil {</pre></code><tr class=miss><td>88<td><code><pre> log.Printf("%v [Gofusion] %s %s exit with releasing pool %s failed because %s",</pre></code><tr><td>89<td><code><pre> pid, app, config.ComponentGoroutinePool, name, err)</pre></code><tr><td>90<td><code><pre> }</pre></code><tr class=miss><td>91<td><code><pre> delete(pools[opt.AppName], name)</pre></code><tr><td>92<td><code><pre> }</pre></code><tr><td>93<td><code><pre> }</pre></code><tr><td>94<td><code><pre></pre></code><tr><td>95<td><code><pre> log.Printf("%v [Gofusion] %s %s pool routines are recycled", pid, app, config.ComponentGoroutinePool)</pre></code><tr><td>96<td><code><pre></pre></code><tr><td>97<td><code><pre> // waiting for go</pre></code><tr><td>98<td><code><pre> utils.Timeout(maxReleaseTime, utils.TimeoutWg(&wg))</pre></code><tr><td>99<td><code><pre> log.Printf("%v [Gofusion] %s %s go routines are recycled", pid, app, config.ComponentGoroutinePool)</pre></code><tr><td>100<td><code><pre></pre></code><tr><td>101<td><code><pre> if !allExited() {</pre></code><tr class=miss><td>102<td><code><pre> log.Printf("%v [Gofusion] %s %s exit without all goroutines recycled [exists%v]",</pre></code><tr><td>103<td><code><pre> pid, app, config.ComponentGoroutinePool, showRoutine(opt.AppName))</pre></code><tr><td>104<td><code><pre> }</pre></code><tr><td>105<td><code><pre></pre></code><tr><td>106<td><code><pre> delete(ignored, opt.AppName)</pre></code><tr><td>107<td><code><pre> delete(idles, opt.AppName)</pre></code><tr><td>108<td><code><pre> delete(routines, opt.AppName)</pre></code><tr><td>109<td><code><pre> }</pre></code></table><div class=funcname id=fn_wrapPromise>func wrapPromise</div><div class=info><a href=#s_fn_wrapPromise>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>232<td><code><pre>func wrapPromise(fn any, async bool, opts ...utils.OptionExtender) *Future {</pre></code><tr><td>233<td><code><pre> // check supported function</pre></code><tr><td>234<td><code><pre> switch act := fn.(type) {</pre></code><tr><td>235<td><code><pre> case *Future:</pre></code><tr><td>236<td><code><pre> return act</pre></code><tr><td>237<td><code><pre></pre></code><tr><td>238<td><code><pre> case func(),</pre></code><tr><td>239<td><code><pre> func() error,</pre></code><tr><td>240<td><code><pre> func() (any, error),</pre></code><tr><td>241<td><code><pre> func(Canceller),</pre></code><tr><td>242<td><code><pre> func(Canceller) error,</pre></code><tr><td>243<td><code><pre> func(Canceller) (any, error):</pre></code><tr><td>244<td><code><pre></pre></code><tr><td>245<td><code><pre> return start(fn, async, opts...)</pre></code><tr><td>246<td><code><pre></pre></code><tr><td>247<td><code><pre> default:</pre></code><tr><td>248<td><code><pre> typ := reflect.TypeOf(fn)</pre></code><tr><td>249<td><code><pre> if typ.Kind() != reflect.Func {</pre></code><tr class=miss><td>250<td><code><pre> return WrapFuture(errors.Errorf("unsupported function type %T", fn), opts...)</pre></code><tr><td>251<td><code><pre> }</pre></code><tr><td>252<td><code><pre> if typ.NumOut() > 0 && (typ.NumOut() > 2 ||</pre></code><tr><td>253<td><code><pre> typ.Out(typ.NumOut()-1) != constant.ErrorType ||</pre></code><tr><td>254<td><code><pre> (typ.NumOut() == 2 && typ.Out(0) != constant.AnyType)) {</pre></code><tr class=miss><td>255<td><code><pre> return WrapFuture(errors.Errorf("unsupported function signature %T", fn), opts...)</pre></code><tr><td>256<td><code><pre> }</pre></code><tr><td>257<td><code><pre></pre></code><tr><td>258<td><code><pre> return start(fn, async, opts...)</pre></code><tr><td>259<td><code><pre> }</pre></code><tr><td>260<td><code><pre>}</pre></code></table><div class=funcname id=fn_validate>func validate</div><div class=info><a href=#s_fn_validate>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>173<td><code><pre>func validate(appName, name string) {</pre></code><tr><td>174<td><code><pre> rwlock.RLock()</pre></code><tr><td>175<td><code><pre> defer rwlock.RUnlock()</pre></code><tr><td>176<td><code><pre> if _, ok := pools[appName][name]; ok {</pre></code><tr class=miss><td>177<td><code><pre> panic(ErrDuplicatedName)</pre></code><tr><td>178<td><code><pre> }</pre></code><tr><td>179<td><code><pre>}</pre></code></table><div class=funcname id=fn_Future.IsCancelled>func Future.IsCancelled</div><div class=info><a href=#s_fn_Future.IsCancelled>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>87<td><code><pre>func (f *Future) IsCancelled() bool {</pre></code><tr><td>88<td><code><pre> val := f.loadVal()</pre></code><tr><td>89<td><code><pre></pre></code><tr><td>90<td><code><pre> if val != nil && val.r != nil && val.r.Typ == ResultCancelled {</pre></code><tr class=miss><td>91<td><code><pre> return true</pre></code><tr><td>92<td><code><pre> } else {</pre></code><tr><td>93<td><code><pre> return false</pre></code><tr><td>94<td><code><pre> }</pre></code><tr><td>95<td><code><pre>}</pre></code></table><div class=funcname id=fn_@91:21>func @91:21</div><div class=info><a href=#s_fn_@91:21>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/metrics.go</code>:</div><table class=listing><tr><td>91<td><code><pre>func() {</pre></code><tr><td>92<td><code><pre> var routineNum int64</pre></code><tr><td>93<td><code><pre> if idles != nil && idles[appName] != nil {</pre></code><tr><td>94<td><code><pre> routineNum = int64(conf.MaxRoutineAmount) - idles[appName].Load()</pre></code><tr><td>95<td><code><pre> }</pre></code><tr><td>96<td><code><pre></pre></code><tr><td>97<td><code><pre> // export number of Goroutines</pre></code><tr><td>98<td><code><pre> totalRoutineNum := runtime.NumGoroutine()</pre></code><tr><td>99<td><code><pre> totalCgoCallsNum := runtime.NumCgoCall()</pre></code><tr><td>100<td><code><pre></pre></code><tr><td>101<td><code><pre> // export memory stats</pre></code><tr><td>102<td><code><pre> var stats runtime.MemStats</pre></code><tr><td>103<td><code><pre> runtime.ReadMemStats(&stats)</pre></code><tr><td>104<td><code><pre></pre></code><tr><td>105<td><code><pre> // export info about the last few GC runs</pre></code><tr><td>106<td><code><pre> // handle wrap around</pre></code><tr><td>107<td><code><pre> if stats.NumGC < lastNumGc.Load() {</pre></code><tr class=miss><td>108<td><code><pre> lastNumGc.Store(0)</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre></pre></code><tr><td>111<td><code><pre> // ensure we don't scan more than 256</pre></code><tr><td>112<td><code><pre> if stats.NumGC-lastNumGc.Load() >= 256 {</pre></code><tr class=miss><td>113<td><code><pre> lastNumGc.Store(stats.NumGC - 255)</pre></code><tr><td>114<td><code><pre> }</pre></code><tr><td>115<td><code><pre></pre></code><tr><td>116<td><code><pre> app := config.Use(appName).AppName()</pre></code><tr><td>117<td><code><pre></pre></code><tr><td>118<td><code><pre> cpuGoRoutinesKey := append([]string{app}, metricsRuntimeCpuGoroutinesKey...)</pre></code><tr><td>119<td><code><pre> cpuCgoCallsKey := append([]string{app}, metricsRuntimeCpuCgoCallsKey...)</pre></code><tr><td>120<td><code><pre> fusGoroutineKey := append([]string{app}, metricsRuntimeFusGoroutinesKey...)</pre></code><tr><td>121<td><code><pre></pre></code><tr><td>122<td><code><pre> memAllocKey := append([]string{app}, metricsRuntimeMemAllocKey...)</pre></code><tr><td>123<td><code><pre> memTotalKey := append([]string{app}, metricsRuntimeMemTotalKey...)</pre></code><tr><td>124<td><code><pre> memSysKey := append([]string{app}, metricsRuntimeMemSysKey...)</pre></code><tr><td>125<td><code><pre> memLookupsKey := append([]string{app}, metricsRuntimeMemLookupsKey...)</pre></code><tr><td>126<td><code><pre> memMallocKey := append([]string{app}, metricsRuntimeMemMallocKey...)</pre></code><tr><td>127<td><code><pre> memFreesKey := append([]string{app}, metricsRuntimeMemFreesKey...)</pre></code><tr><td>128<td><code><pre></pre></code><tr><td>129<td><code><pre> heapAllocKey := append([]string{app}, metricsRuntimeHeapAllocKey...)</pre></code><tr><td>130<td><code><pre> heapSysKey := append([]string{app}, metricsRuntimeHeapSysKey...)</pre></code><tr><td>131<td><code><pre> heapIdleKey := append([]string{app}, metricsRuntimeHeapIdleKey...)</pre></code><tr><td>132<td><code><pre> heapInuseKey := append([]string{app}, metricsRuntimeHeapInuseKey...)</pre></code><tr><td>133<td><code><pre> heapReleasedKey := append([]string{app}, metricsRuntimeHeapReleasedKey...)</pre></code><tr><td>134<td><code><pre> heapObjectsKey := append([]string{app}, metricsRuntimeHeapObjectsKey...)</pre></code><tr><td>135<td><code><pre></pre></code><tr><td>136<td><code><pre> stackInuseKey := append([]string{app}, metricsRuntimeStackInuseKey...)</pre></code><tr><td>137<td><code><pre> stackSysKey := append([]string{app}, metricsRuntimeStackSysKey...)</pre></code><tr><td>138<td><code><pre> mspanInuseKey := append([]string{app}, metricsRuntimeMSpanInuseKey...)</pre></code><tr><td>139<td><code><pre> mspanSysKey := append([]string{app}, metricsRuntimeMSpanSysKey...)</pre></code><tr><td>140<td><code><pre> mcacheInuseKey := append([]string{app}, metricsRuntimeMCacheInuseKey...)</pre></code><tr><td>141<td><code><pre> mcacheSysKey := append([]string{app}, metricsRuntimeMCacheSysKey...)</pre></code><tr><td>142<td><code><pre></pre></code><tr><td>143<td><code><pre> otherSysKey := append([]string{app}, metricsRuntimeOtherSysKey...)</pre></code><tr><td>144<td><code><pre></pre></code><tr><td>145<td><code><pre> gcSysKey := append([]string{app}, metricsRuntimeGCSysKey...)</pre></code><tr><td>146<td><code><pre> gcNextKey := append([]string{app}, metricsRuntimeGCNextKey...)</pre></code><tr><td>147<td><code><pre> gcLastKey := append([]string{app}, metricsRuntimeGCLastKey...)</pre></code><tr><td>148<td><code><pre> gcCountKey := append([]string{app}, metricsRuntimeGCCountKey...)</pre></code><tr><td>149<td><code><pre> gcForceCountKey := append([]string{app}, metricsRuntimeGCForceCountKey...)</pre></code><tr><td>150<td><code><pre> gcPauseNSKey := append([]string{app}, metricsRuntimeGCPauseNSKey...)</pre></code><tr><td>151<td><code><pre> gcPauseTotalKey := append([]string{app}, metricsRuntimeGCPauseTotalKey...)</pre></code><tr><td>152<td><code><pre></pre></code><tr><td>153<td><code><pre> metricsLabels := metrics.Labels(labels)</pre></code><tr><td>154<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr><td>155<td><code><pre> select {</pre></code><tr><td>156<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>157<td><code><pre> return</pre></code><tr><td>158<td><code><pre> default:</pre></code><tr><td>159<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr><td>160<td><code><pre> m.SetGauge(ctx, cpuGoRoutinesKey, float64(totalRoutineNum), metricsLabels)</pre></code><tr><td>161<td><code><pre> m.SetGauge(ctx, cpuCgoCallsKey, float64(totalCgoCallsNum), metricsLabels)</pre></code><tr><td>162<td><code><pre> m.SetGauge(ctx, fusGoroutineKey, float64(routineNum), metricsLabels)</pre></code><tr><td>163<td><code><pre></pre></code><tr><td>164<td><code><pre> m.SetGauge(ctx, memAllocKey, float64(stats.Alloc), metricsLabels)</pre></code><tr><td>165<td><code><pre> m.SetGauge(ctx, memTotalKey, float64(stats.TotalAlloc), metricsLabels)</pre></code><tr><td>166<td><code><pre> m.SetGauge(ctx, memSysKey, float64(stats.Sys), metricsLabels)</pre></code><tr><td>167<td><code><pre> m.SetGauge(ctx, memLookupsKey, float64(stats.Lookups), metricsLabels)</pre></code><tr><td>168<td><code><pre> m.SetGauge(ctx, memMallocKey, float64(stats.Mallocs), metricsLabels)</pre></code><tr><td>169<td><code><pre> m.SetGauge(ctx, memFreesKey, float64(stats.Frees), metricsLabels)</pre></code><tr><td>170<td><code><pre></pre></code><tr><td>171<td><code><pre> m.SetGauge(ctx, heapAllocKey, float64(stats.HeapAlloc), metricsLabels)</pre></code><tr><td>172<td><code><pre> m.SetGauge(ctx, heapSysKey, float64(stats.HeapSys), metricsLabels)</pre></code><tr><td>173<td><code><pre> m.SetGauge(ctx, heapIdleKey, float64(stats.HeapIdle), metricsLabels)</pre></code><tr><td>174<td><code><pre> m.SetGauge(ctx, heapInuseKey, float64(stats.HeapInuse), metricsLabels)</pre></code><tr><td>175<td><code><pre> m.SetGauge(ctx, heapReleasedKey, float64(stats.HeapReleased), metricsLabels)</pre></code><tr><td>176<td><code><pre> m.SetGauge(ctx, heapObjectsKey, float64(stats.HeapObjects), metricsLabels)</pre></code><tr><td>177<td><code><pre></pre></code><tr><td>178<td><code><pre> m.SetGauge(ctx, stackInuseKey, float64(stats.StackInuse), metricsLabels)</pre></code><tr><td>179<td><code><pre> m.SetGauge(ctx, stackSysKey, float64(stats.StackSys), metricsLabels)</pre></code><tr><td>180<td><code><pre> m.SetGauge(ctx, mspanInuseKey, float64(stats.MSpanInuse), metricsLabels)</pre></code><tr><td>181<td><code><pre> m.SetGauge(ctx, mspanSysKey, float64(stats.MSpanSys), metricsLabels)</pre></code><tr><td>182<td><code><pre> m.SetGauge(ctx, mcacheInuseKey, float64(stats.MCacheInuse), metricsLabels)</pre></code><tr><td>183<td><code><pre> m.SetGauge(ctx, mcacheSysKey, float64(stats.MCacheSys), metricsLabels)</pre></code><tr><td>184<td><code><pre></pre></code><tr><td>185<td><code><pre> m.SetGauge(ctx, otherSysKey, float64(stats.OtherSys), metricsLabels)</pre></code><tr><td>186<td><code><pre></pre></code><tr><td>187<td><code><pre> m.SetGauge(ctx, gcSysKey, float64(stats.GCSys), metricsLabels)</pre></code><tr><td>188<td><code><pre> m.SetGauge(ctx, gcNextKey, float64(stats.NextGC), metricsLabels)</pre></code><tr><td>189<td><code><pre> m.SetGauge(ctx, gcLastKey, float64(stats.LastGC), metricsLabels)</pre></code><tr><td>190<td><code><pre> m.SetGauge(ctx, gcCountKey, float64(stats.NumGC), metricsLabels)</pre></code><tr><td>191<td><code><pre> m.SetGauge(ctx, gcForceCountKey, float64(stats.NumForcedGC), metricsLabels)</pre></code><tr><td>192<td><code><pre> m.SetGauge(ctx, gcPauseTotalKey, float64(stats.PauseTotalNs), metricsLabels)</pre></code><tr><td>193<td><code><pre> for i := lastNumGc.Load(); i < stats.NumGC; i++ {</pre></code><tr><td>194<td><code><pre> m.AddSample(ctx, gcPauseNSKey, float64(stats.PauseNs[i%256]),</pre></code><tr><td>195<td><code><pre> metricsLabels, metrics.PrometheusBuckets(metricsRuntimeGCPauseNSBuckets))</pre></code><tr><td>196<td><code><pre> }</pre></code><tr><td>197<td><code><pre> } else {</pre></code><tr class=miss><td>198<td><code><pre> m.SetGauge(ctx, metricsRuntimeCpuGoroutinesKey, float64(totalRoutineNum), metricsLabels)</pre></code><tr class=miss><td>199<td><code><pre> m.SetGauge(ctx, metricsRuntimeCpuCgoCallsKey, float64(totalCgoCallsNum), metricsLabels)</pre></code><tr class=miss><td>200<td><code><pre> m.SetGauge(ctx, metricsRuntimeFusGoroutinesKey, float64(routineNum), metricsLabels)</pre></code><tr><td>201<td><code><pre></pre></code><tr class=miss><td>202<td><code><pre> m.SetGauge(ctx, metricsRuntimeMemAllocKey, float64(stats.Alloc), metricsLabels)</pre></code><tr class=miss><td>203<td><code><pre> m.SetGauge(ctx, metricsRuntimeMemTotalKey, float64(stats.TotalAlloc), metricsLabels)</pre></code><tr class=miss><td>204<td><code><pre> m.SetGauge(ctx, metricsRuntimeMemSysKey, float64(stats.Sys), metricsLabels)</pre></code><tr class=miss><td>205<td><code><pre> m.SetGauge(ctx, metricsRuntimeMemLookupsKey, float64(stats.Lookups), metricsLabels)</pre></code><tr class=miss><td>206<td><code><pre> m.SetGauge(ctx, metricsRuntimeMemMallocKey, float64(stats.Mallocs), metricsLabels)</pre></code><tr class=miss><td>207<td><code><pre> m.SetGauge(ctx, metricsRuntimeMemFreesKey, float64(stats.Frees), metricsLabels)</pre></code><tr><td>208<td><code><pre></pre></code><tr class=miss><td>209<td><code><pre> m.SetGauge(ctx, metricsRuntimeHeapAllocKey, float64(stats.HeapAlloc), metricsLabels)</pre></code><tr class=miss><td>210<td><code><pre> m.SetGauge(ctx, metricsRuntimeHeapSysKey, float64(stats.HeapSys), metricsLabels)</pre></code><tr class=miss><td>211<td><code><pre> m.SetGauge(ctx, metricsRuntimeHeapIdleKey, float64(stats.HeapIdle), metricsLabels)</pre></code><tr class=miss><td>212<td><code><pre> m.SetGauge(ctx, metricsRuntimeHeapInuseKey, float64(stats.HeapInuse), metricsLabels)</pre></code><tr class=miss><td>213<td><code><pre> m.SetGauge(ctx, metricsRuntimeHeapReleasedKey, float64(stats.HeapReleased), metricsLabels)</pre></code><tr class=miss><td>214<td><code><pre> m.SetGauge(ctx, metricsRuntimeHeapObjectsKey, float64(stats.HeapObjects), metricsLabels)</pre></code><tr><td>215<td><code><pre></pre></code><tr class=miss><td>216<td><code><pre> m.SetGauge(ctx, metricsRuntimeStackInuseKey, float64(stats.StackInuse), metricsLabels)</pre></code><tr class=miss><td>217<td><code><pre> m.SetGauge(ctx, metricsRuntimeStackSysKey, float64(stats.StackSys), metricsLabels)</pre></code><tr class=miss><td>218<td><code><pre> m.SetGauge(ctx, metricsRuntimeMSpanInuseKey, float64(stats.MSpanInuse), metricsLabels)</pre></code><tr class=miss><td>219<td><code><pre> m.SetGauge(ctx, metricsRuntimeMSpanSysKey, float64(stats.MSpanSys), metricsLabels)</pre></code><tr class=miss><td>220<td><code><pre> m.SetGauge(ctx, metricsRuntimeMCacheInuseKey, float64(stats.MCacheInuse), metricsLabels)</pre></code><tr class=miss><td>221<td><code><pre> m.SetGauge(ctx, metricsRuntimeMCacheSysKey, float64(stats.MCacheSys), metricsLabels)</pre></code><tr><td>222<td><code><pre></pre></code><tr class=miss><td>223<td><code><pre> m.SetGauge(ctx, metricsRuntimeOtherSysKey, float64(stats.OtherSys), metricsLabels)</pre></code><tr><td>224<td><code><pre></pre></code><tr class=miss><td>225<td><code><pre> m.SetGauge(ctx, metricsRuntimeGCSysKey, float64(stats.GCSys), metricsLabels)</pre></code><tr class=miss><td>226<td><code><pre> m.SetGauge(ctx, metricsRuntimeGCNextKey, float64(stats.NextGC), metricsLabels)</pre></code><tr class=miss><td>227<td><code><pre> m.SetGauge(ctx, metricsRuntimeGCLastKey, float64(stats.LastGC), metricsLabels)</pre></code><tr class=miss><td>228<td><code><pre> m.SetGauge(ctx, metricsRuntimeGCCountKey, float64(stats.NumGC), metricsLabels)</pre></code><tr class=miss><td>229<td><code><pre> m.SetGauge(ctx, metricsRuntimeGCForceCountKey, float64(stats.NumForcedGC), metricsLabels)</pre></code><tr class=miss><td>230<td><code><pre> m.SetGauge(ctx, metricsRuntimeGCPauseTotalKey, float64(stats.PauseTotalNs), metricsLabels)</pre></code><tr class=miss><td>231<td><code><pre> for i := lastNumGc.Load(); i < stats.NumGC; i++ {</pre></code><tr class=miss><td>232<td><code><pre> m.AddSample(ctx, metricsRuntimeGCPauseNSKey, float64(stats.PauseNs[i%256]),</pre></code><tr><td>233<td><code><pre> metricsLabels,</pre></code><tr><td>234<td><code><pre> metrics.PrometheusBuckets(metricsRuntimeGCPauseNSBuckets),</pre></code><tr><td>235<td><code><pre> )</pre></code><tr><td>236<td><code><pre> }</pre></code><tr><td>237<td><code><pre> }</pre></code><tr><td>238<td><code><pre> }</pre></code><tr><td>239<td><code><pre> }</pre></code><tr><td>240<td><code><pre></pre></code><tr><td>241<td><code><pre> lastNumGc.Store(stats.NumGC)</pre></code><tr><td>242<td><code><pre> }</pre></code></table><div class=funcname id=fn_Future.GetOrTimeout>func Future.GetOrTimeout</div><div class=info><a href=#s_fn_Future.GetOrTimeout>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>144<td><code><pre>func (f *Future) GetOrTimeout(timeout time.Duration) (val any, timout bool, err error) {</pre></code><tr><td>145<td><code><pre> if timeout <= 0 {</pre></code><tr class=miss><td>146<td><code><pre> timeout = 10 * time.Nanosecond</pre></code><tr><td>147<td><code><pre> }</pre></code><tr><td>148<td><code><pre></pre></code><tr><td>149<td><code><pre> timer := time.NewTimer(timeout)</pre></code><tr><td>150<td><code><pre> defer timer.Stop()</pre></code><tr><td>151<td><code><pre></pre></code><tr><td>152<td><code><pre> select {</pre></code><tr><td>153<td><code><pre> case <-timer.C:</pre></code><tr class=miss><td>154<td><code><pre> _ = f.Cancel()</pre></code><tr class=miss><td>155<td><code><pre> return nil, true, nil</pre></code><tr><td>156<td><code><pre> case <-f.final:</pre></code><tr><td>157<td><code><pre> r, err := getFutureReturnVal(f.loadResult())</pre></code><tr><td>158<td><code><pre> return r, false, err</pre></code><tr><td>159<td><code><pre> }</pre></code><tr><td>160<td><code><pre>}</pre></code></table><div class=funcname id=fn_@555:7>func @555:7</div><div class=info><a href=#s_fn_@555:7>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>555<td><code><pre>func() {</pre></code><tr><td>556<td><code><pre> r, err := action(opt)</pre></code><tr><td>557<td><code><pre> if p.IsCancelled() {</pre></code><tr class=miss><td>558<td><code><pre> _ = p.Cancel()</pre></code><tr><td>559<td><code><pre> } else {</pre></code><tr><td>560<td><code><pre> if err == nil {</pre></code><tr><td>561<td><code><pre> _ = p.Resolve(r)</pre></code><tr><td>562<td><code><pre> } else {</pre></code><tr class=miss><td>563<td><code><pre> _ = p.Reject(err)</pre></code><tr><td>564<td><code><pre> }</pre></code><tr><td>565<td><code><pre> }</pre></code><tr><td>566<td><code><pre> }</pre></code></table><div class=funcname id=fn_metricsRuntime>func metricsRuntime</div><div class=info><a href=#s_fn_metricsRuntime>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/metrics.go</code>:</div><table class=listing><tr><td>84<td><code><pre>func metricsRuntime(ctx context.Context, appName string, lastNumGc *atomic.Uint32, conf *Conf, labels []metrics.Label) {</pre></code><tr><td>85<td><code><pre> select {</pre></code><tr><td>86<td><code><pre> case <-ctx.Done():</pre></code><tr class=miss><td>87<td><code><pre> return</pre></code><tr><td>88<td><code><pre> default:</pre></code><tr><td>89<td><code><pre> }</pre></code><tr><td>90<td><code><pre></pre></code><tr><td>91<td><code><pre> _, _ = utils.Catch(func() {</pre></code><tr><td>92<td><code><pre> var routineNum int64</pre></code><tr><td>93<td><code><pre> if idles != nil && idles[appName] != nil {</pre></code><tr><td>94<td><code><pre> routineNum = int64(conf.MaxRoutineAmount) - idles[appName].Load()</pre></code><tr><td>95<td><code><pre> }</pre></code><tr><td>96<td><code><pre></pre></code><tr><td>97<td><code><pre> // export number of Goroutines</pre></code><tr><td>98<td><code><pre> totalRoutineNum := runtime.NumGoroutine()</pre></code><tr><td>99<td><code><pre> totalCgoCallsNum := runtime.NumCgoCall()</pre></code><tr><td>100<td><code><pre></pre></code><tr><td>101<td><code><pre> // export memory stats</pre></code><tr><td>102<td><code><pre> var stats runtime.MemStats</pre></code><tr><td>103<td><code><pre> runtime.ReadMemStats(&stats)</pre></code><tr><td>104<td><code><pre></pre></code><tr><td>105<td><code><pre> // export info about the last few GC runs</pre></code><tr><td>106<td><code><pre> // handle wrap around</pre></code><tr><td>107<td><code><pre> if stats.NumGC < lastNumGc.Load() {</pre></code><tr><td>108<td><code><pre> lastNumGc.Store(0)</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre></pre></code><tr><td>111<td><code><pre> // ensure we don't scan more than 256</pre></code><tr><td>112<td><code><pre> if stats.NumGC-lastNumGc.Load() >= 256 {</pre></code><tr><td>113<td><code><pre> lastNumGc.Store(stats.NumGC - 255)</pre></code><tr><td>114<td><code><pre> }</pre></code><tr><td>115<td><code><pre></pre></code><tr><td>116<td><code><pre> app := config.Use(appName).AppName()</pre></code><tr><td>117<td><code><pre></pre></code><tr><td>118<td><code><pre> cpuGoRoutinesKey := append([]string{app}, metricsRuntimeCpuGoroutinesKey...)</pre></code><tr><td>119<td><code><pre> cpuCgoCallsKey := append([]string{app}, metricsRuntimeCpuCgoCallsKey...)</pre></code><tr><td>120<td><code><pre> fusGoroutineKey := append([]string{app}, metricsRuntimeFusGoroutinesKey...)</pre></code><tr><td>121<td><code><pre></pre></code><tr><td>122<td><code><pre> memAllocKey := append([]string{app}, metricsRuntimeMemAllocKey...)</pre></code><tr><td>123<td><code><pre> memTotalKey := append([]string{app}, metricsRuntimeMemTotalKey...)</pre></code><tr><td>124<td><code><pre> memSysKey := append([]string{app}, metricsRuntimeMemSysKey...)</pre></code><tr><td>125<td><code><pre> memLookupsKey := append([]string{app}, metricsRuntimeMemLookupsKey...)</pre></code><tr><td>126<td><code><pre> memMallocKey := append([]string{app}, metricsRuntimeMemMallocKey...)</pre></code><tr><td>127<td><code><pre> memFreesKey := append([]string{app}, metricsRuntimeMemFreesKey...)</pre></code><tr><td>128<td><code><pre></pre></code><tr><td>129<td><code><pre> heapAllocKey := append([]string{app}, metricsRuntimeHeapAllocKey...)</pre></code><tr><td>130<td><code><pre> heapSysKey := append([]string{app}, metricsRuntimeHeapSysKey...)</pre></code><tr><td>131<td><code><pre> heapIdleKey := append([]string{app}, metricsRuntimeHeapIdleKey...)</pre></code><tr><td>132<td><code><pre> heapInuseKey := append([]string{app}, metricsRuntimeHeapInuseKey...)</pre></code><tr><td>133<td><code><pre> heapReleasedKey := append([]string{app}, metricsRuntimeHeapReleasedKey...)</pre></code><tr><td>134<td><code><pre> heapObjectsKey := append([]string{app}, metricsRuntimeHeapObjectsKey...)</pre></code><tr><td>135<td><code><pre></pre></code><tr><td>136<td><code><pre> stackInuseKey := append([]string{app}, metricsRuntimeStackInuseKey...)</pre></code><tr><td>137<td><code><pre> stackSysKey := append([]string{app}, metricsRuntimeStackSysKey...)</pre></code><tr><td>138<td><code><pre> mspanInuseKey := append([]string{app}, metricsRuntimeMSpanInuseKey...)</pre></code><tr><td>139<td><code><pre> mspanSysKey := append([]string{app}, metricsRuntimeMSpanSysKey...)</pre></code><tr><td>140<td><code><pre> mcacheInuseKey := append([]string{app}, metricsRuntimeMCacheInuseKey...)</pre></code><tr><td>141<td><code><pre> mcacheSysKey := append([]string{app}, metricsRuntimeMCacheSysKey...)</pre></code><tr><td>142<td><code><pre></pre></code><tr><td>143<td><code><pre> otherSysKey := append([]string{app}, metricsRuntimeOtherSysKey...)</pre></code><tr><td>144<td><code><pre></pre></code><tr><td>145<td><code><pre> gcSysKey := append([]string{app}, metricsRuntimeGCSysKey...)</pre></code><tr><td>146<td><code><pre> gcNextKey := append([]string{app}, metricsRuntimeGCNextKey...)</pre></code><tr><td>147<td><code><pre> gcLastKey := append([]string{app}, metricsRuntimeGCLastKey...)</pre></code><tr><td>148<td><code><pre> gcCountKey := append([]string{app}, metricsRuntimeGCCountKey...)</pre></code><tr><td>149<td><code><pre> gcForceCountKey := append([]string{app}, metricsRuntimeGCForceCountKey...)</pre></code><tr><td>150<td><code><pre> gcPauseNSKey := append([]string{app}, metricsRuntimeGCPauseNSKey...)</pre></code><tr><td>151<td><code><pre> gcPauseTotalKey := append([]string{app}, metricsRuntimeGCPauseTotalKey...)</pre></code><tr><td>152<td><code><pre></pre></code><tr><td>153<td><code><pre> metricsLabels := metrics.Labels(labels)</pre></code><tr><td>154<td><code><pre> for _, m := range metrics.Internal(metrics.AppName(appName)) {</pre></code><tr><td>155<td><code><pre> select {</pre></code><tr><td>156<td><code><pre> case <-ctx.Done():</pre></code><tr><td>157<td><code><pre> return</pre></code><tr><td>158<td><code><pre> default:</pre></code><tr><td>159<td><code><pre> if m.IsEnableServiceLabel() {</pre></code><tr><td>160<td><code><pre> m.SetGauge(ctx, cpuGoRoutinesKey, float64(totalRoutineNum), metricsLabels)</pre></code><tr><td>161<td><code><pre> m.SetGauge(ctx, cpuCgoCallsKey, float64(totalCgoCallsNum), metricsLabels)</pre></code><tr><td>162<td><code><pre> m.SetGauge(ctx, fusGoroutineKey, float64(routineNum), metricsLabels)</pre></code><tr><td>163<td><code><pre></pre></code><tr><td>164<td><code><pre> m.SetGauge(ctx, memAllocKey, float64(stats.Alloc), metricsLabels)</pre></code><tr><td>165<td><code><pre> m.SetGauge(ctx, memTotalKey, float64(stats.TotalAlloc), metricsLabels)</pre></code><tr><td>166<td><code><pre> m.SetGauge(ctx, memSysKey, float64(stats.Sys), metricsLabels)</pre></code><tr><td>167<td><code><pre> m.SetGauge(ctx, memLookupsKey, float64(stats.Lookups), metricsLabels)</pre></code><tr><td>168<td><code><pre> m.SetGauge(ctx, memMallocKey, float64(stats.Mallocs), metricsLabels)</pre></code><tr><td>169<td><code><pre> m.SetGauge(ctx, memFreesKey, float64(stats.Frees), metricsLabels)</pre></code><tr><td>170<td><code><pre></pre></code><tr><td>171<td><code><pre> m.SetGauge(ctx, heapAllocKey, float64(stats.HeapAlloc), metricsLabels)</pre></code><tr><td>172<td><code><pre> m.SetGauge(ctx, heapSysKey, float64(stats.HeapSys), metricsLabels)</pre></code><tr><td>173<td><code><pre> m.SetGauge(ctx, heapIdleKey, float64(stats.HeapIdle), metricsLabels)</pre></code><tr><td>174<td><code><pre> m.SetGauge(ctx, heapInuseKey, float64(stats.HeapInuse), metricsLabels)</pre></code><tr><td>175<td><code><pre> m.SetGauge(ctx, heapReleasedKey, float64(stats.HeapReleased), metricsLabels)</pre></code><tr><td>176<td><code><pre> m.SetGauge(ctx, heapObjectsKey, float64(stats.HeapObjects), metricsLabels)</pre></code><tr><td>177<td><code><pre></pre></code><tr><td>178<td><code><pre> m.SetGauge(ctx, stackInuseKey, float64(stats.StackInuse), metricsLabels)</pre></code><tr><td>179<td><code><pre> m.SetGauge(ctx, stackSysKey, float64(stats.StackSys), metricsLabels)</pre></code><tr><td>180<td><code><pre> m.SetGauge(ctx, mspanInuseKey, float64(stats.MSpanInuse), metricsLabels)</pre></code><tr><td>181<td><code><pre> m.SetGauge(ctx, mspanSysKey, float64(stats.MSpanSys), metricsLabels)</pre></code><tr><td>182<td><code><pre> m.SetGauge(ctx, mcacheInuseKey, float64(stats.MCacheInuse), metricsLabels)</pre></code><tr><td>183<td><code><pre> m.SetGauge(ctx, mcacheSysKey, float64(stats.MCacheSys), metricsLabels)</pre></code><tr><td>184<td><code><pre></pre></code><tr><td>185<td><code><pre> m.SetGauge(ctx, otherSysKey, float64(stats.OtherSys), metricsLabels)</pre></code><tr><td>186<td><code><pre></pre></code><tr><td>187<td><code><pre> m.SetGauge(ctx, gcSysKey, float64(stats.GCSys), metricsLabels)</pre></code><tr><td>188<td><code><pre> m.SetGauge(ctx, gcNextKey, float64(stats.NextGC), metricsLabels)</pre></code><tr><td>189<td><code><pre> m.SetGauge(ctx, gcLastKey, float64(stats.LastGC), metricsLabels)</pre></code><tr><td>190<td><code><pre> m.SetGauge(ctx, gcCountKey, float64(stats.NumGC), metricsLabels)</pre></code><tr><td>191<td><code><pre> m.SetGauge(ctx, gcForceCountKey, float64(stats.NumForcedGC), metricsLabels)</pre></code><tr><td>192<td><code><pre> m.SetGauge(ctx, gcPauseTotalKey, float64(stats.PauseTotalNs), metricsLabels)</pre></code><tr><td>193<td><code><pre> for i := lastNumGc.Load(); i < stats.NumGC; i++ {</pre></code><tr><td>194<td><code><pre> m.AddSample(ctx, gcPauseNSKey, float64(stats.PauseNs[i%256]),</pre></code><tr><td>195<td><code><pre> metricsLabels, metrics.PrometheusBuckets(metricsRuntimeGCPauseNSBuckets))</pre></code><tr><td>196<td><code><pre> }</pre></code><tr><td>197<td><code><pre> } else {</pre></code><tr><td>198<td><code><pre> m.SetGauge(ctx, metricsRuntimeCpuGoroutinesKey, float64(totalRoutineNum), metricsLabels)</pre></code><tr><td>199<td><code><pre> m.SetGauge(ctx, metricsRuntimeCpuCgoCallsKey, float64(totalCgoCallsNum), metricsLabels)</pre></code><tr><td>200<td><code><pre> m.SetGauge(ctx, metricsRuntimeFusGoroutinesKey, float64(routineNum), metricsLabels)</pre></code><tr><td>201<td><code><pre></pre></code><tr><td>202<td><code><pre> m.SetGauge(ctx, metricsRuntimeMemAllocKey, float64(stats.Alloc), metricsLabels)</pre></code><tr><td>203<td><code><pre> m.SetGauge(ctx, metricsRuntimeMemTotalKey, float64(stats.TotalAlloc), metricsLabels)</pre></code><tr><td>204<td><code><pre> m.SetGauge(ctx, metricsRuntimeMemSysKey, float64(stats.Sys), metricsLabels)</pre></code><tr><td>205<td><code><pre> m.SetGauge(ctx, metricsRuntimeMemLookupsKey, float64(stats.Lookups), metricsLabels)</pre></code><tr><td>206<td><code><pre> m.SetGauge(ctx, metricsRuntimeMemMallocKey, float64(stats.Mallocs), metricsLabels)</pre></code><tr><td>207<td><code><pre> m.SetGauge(ctx, metricsRuntimeMemFreesKey, float64(stats.Frees), metricsLabels)</pre></code><tr><td>208<td><code><pre></pre></code><tr><td>209<td><code><pre> m.SetGauge(ctx, metricsRuntimeHeapAllocKey, float64(stats.HeapAlloc), metricsLabels)</pre></code><tr><td>210<td><code><pre> m.SetGauge(ctx, metricsRuntimeHeapSysKey, float64(stats.HeapSys), metricsLabels)</pre></code><tr><td>211<td><code><pre> m.SetGauge(ctx, metricsRuntimeHeapIdleKey, float64(stats.HeapIdle), metricsLabels)</pre></code><tr><td>212<td><code><pre> m.SetGauge(ctx, metricsRuntimeHeapInuseKey, float64(stats.HeapInuse), metricsLabels)</pre></code><tr><td>213<td><code><pre> m.SetGauge(ctx, metricsRuntimeHeapReleasedKey, float64(stats.HeapReleased), metricsLabels)</pre></code><tr><td>214<td><code><pre> m.SetGauge(ctx, metricsRuntimeHeapObjectsKey, float64(stats.HeapObjects), metricsLabels)</pre></code><tr><td>215<td><code><pre></pre></code><tr><td>216<td><code><pre> m.SetGauge(ctx, metricsRuntimeStackInuseKey, float64(stats.StackInuse), metricsLabels)</pre></code><tr><td>217<td><code><pre> m.SetGauge(ctx, metricsRuntimeStackSysKey, float64(stats.StackSys), metricsLabels)</pre></code><tr><td>218<td><code><pre> m.SetGauge(ctx, metricsRuntimeMSpanInuseKey, float64(stats.MSpanInuse), metricsLabels)</pre></code><tr><td>219<td><code><pre> m.SetGauge(ctx, metricsRuntimeMSpanSysKey, float64(stats.MSpanSys), metricsLabels)</pre></code><tr><td>220<td><code><pre> m.SetGauge(ctx, metricsRuntimeMCacheInuseKey, float64(stats.MCacheInuse), metricsLabels)</pre></code><tr><td>221<td><code><pre> m.SetGauge(ctx, metricsRuntimeMCacheSysKey, float64(stats.MCacheSys), metricsLabels)</pre></code><tr><td>222<td><code><pre></pre></code><tr><td>223<td><code><pre> m.SetGauge(ctx, metricsRuntimeOtherSysKey, float64(stats.OtherSys), metricsLabels)</pre></code><tr><td>224<td><code><pre></pre></code><tr><td>225<td><code><pre> m.SetGauge(ctx, metricsRuntimeGCSysKey, float64(stats.GCSys), metricsLabels)</pre></code><tr><td>226<td><code><pre> m.SetGauge(ctx, metricsRuntimeGCNextKey, float64(stats.NextGC), metricsLabels)</pre></code><tr><td>227<td><code><pre> m.SetGauge(ctx, metricsRuntimeGCLastKey, float64(stats.LastGC), metricsLabels)</pre></code><tr><td>228<td><code><pre> m.SetGauge(ctx, metricsRuntimeGCCountKey, float64(stats.NumGC), metricsLabels)</pre></code><tr><td>229<td><code><pre> m.SetGauge(ctx, metricsRuntimeGCForceCountKey, float64(stats.NumForcedGC), metricsLabels)</pre></code><tr><td>230<td><code><pre> m.SetGauge(ctx, metricsRuntimeGCPauseTotalKey, float64(stats.PauseTotalNs), metricsLabels)</pre></code><tr><td>231<td><code><pre> for i := lastNumGc.Load(); i < stats.NumGC; i++ {</pre></code><tr><td>232<td><code><pre> m.AddSample(ctx, metricsRuntimeGCPauseNSKey, float64(stats.PauseNs[i%256]),</pre></code><tr><td>233<td><code><pre> metricsLabels,</pre></code><tr><td>234<td><code><pre> metrics.PrometheusBuckets(metricsRuntimeGCPauseNSBuckets),</pre></code><tr><td>235<td><code><pre> )</pre></code><tr><td>236<td><code><pre> }</pre></code><tr><td>237<td><code><pre> }</pre></code><tr><td>238<td><code><pre> }</pre></code><tr><td>239<td><code><pre> }</pre></code><tr><td>240<td><code><pre></pre></code><tr><td>241<td><code><pre> lastNumGc.Store(stats.NumGC)</pre></code><tr><td>242<td><code><pre> })</pre></code><tr><td>243<td><code><pre>}</pre></code></table><div class=funcname id=fn_execCallback>func execCallback</div><div class=info><a href=#s_fn_execCallback>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>201<td><code><pre>func execCallback(</pre></code><tr><td>202<td><code><pre> r *Result,</pre></code><tr><td>203<td><code><pre> dones []func(v any),</pre></code><tr><td>204<td><code><pre> fails []func(v any),</pre></code><tr><td>205<td><code><pre> always []func(v any),</pre></code><tr><td>206<td><code><pre> cancels []func(),</pre></code><tr><td>207<td><code><pre>) {</pre></code><tr><td>208<td><code><pre> if r.Typ == ResultCancelled {</pre></code><tr class=miss><td>209<td><code><pre> for _, f := range cancels {</pre></code><tr class=miss><td>210<td><code><pre> func() {</pre></code><tr><td>211<td><code><pre> defer func() {</pre></code><tr><td>212<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>213<td><code><pre> err := newErrorWithStacks(e)</pre></code><tr><td>214<td><code><pre> fmt.Println("error happens:\n ", err)</pre></code><tr><td>215<td><code><pre> }</pre></code><tr><td>216<td><code><pre> }()</pre></code><tr><td>217<td><code><pre> f()</pre></code><tr><td>218<td><code><pre> }()</pre></code><tr><td>219<td><code><pre> }</pre></code><tr class=miss><td>220<td><code><pre> return</pre></code><tr><td>221<td><code><pre> }</pre></code><tr><td>222<td><code><pre></pre></code><tr><td>223<td><code><pre> var callbacks []func(v any)</pre></code><tr><td>224<td><code><pre> if r.Typ == ResultSuccess {</pre></code><tr><td>225<td><code><pre> callbacks = dones</pre></code><tr><td>226<td><code><pre> } else {</pre></code><tr class=miss><td>227<td><code><pre> callbacks = fails</pre></code><tr><td>228<td><code><pre> }</pre></code><tr><td>229<td><code><pre></pre></code><tr><td>230<td><code><pre> forFs := func(s []func(v any)) {</pre></code><tr><td>231<td><code><pre> forSlice(s, func(f func(v any)) { f(r.Result) })</pre></code><tr><td>232<td><code><pre> }</pre></code><tr><td>233<td><code><pre></pre></code><tr><td>234<td><code><pre> forFs(callbacks)</pre></code><tr><td>235<td><code><pre> forFs(always)</pre></code><tr><td>236<td><code><pre>}</pre></code></table><div class=funcname id=fn_getAct>func getAct</div><div class=info><a href=#s_fn_getAct>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>87<td><code><pre>func getAct(p *promise, act any) (f func(opt *candyOption) (r any, err error)) {</pre></code><tr><td>88<td><code><pre> var (</pre></code><tr><td>89<td><code><pre> act1 func(...any) (any, error)</pre></code><tr><td>90<td><code><pre> act2 func(Canceller, ...any) (any, error)</pre></code><tr><td>91<td><code><pre> )</pre></code><tr><td>92<td><code><pre> canCancel := false</pre></code><tr><td>93<td><code><pre></pre></code><tr><td>94<td><code><pre> // convert the act to the function that has return value and error if act function haven't return value and error</pre></code><tr><td>95<td><code><pre> switch v := act.(type) {</pre></code><tr><td>96<td><code><pre> case func():</pre></code><tr><td>97<td><code><pre> act1 = func(...any) (any, error) { v(); return nil, nil }</pre></code><tr><td>98<td><code><pre> case func() error:</pre></code><tr><td>99<td><code><pre> act1 = func(...any) (any, error) { e := v(); return nil, e }</pre></code><tr><td>100<td><code><pre> case func() (any, error):</pre></code><tr class=miss><td>101<td><code><pre> act1 = func(a ...any) (any, error) { return v() }</pre></code><tr><td>102<td><code><pre> case func(Canceller):</pre></code><tr class=miss><td>103<td><code><pre> canCancel = true</pre></code><tr class=miss><td>104<td><code><pre> act2 = func(canceller Canceller, a ...any) (any, error) { v(canceller); return nil, nil }</pre></code><tr><td>105<td><code><pre> case func(Canceller) error:</pre></code><tr class=miss><td>106<td><code><pre> canCancel = true</pre></code><tr class=miss><td>107<td><code><pre> act2 = func(canceller Canceller, a ...any) (any, error) { e := v(canceller); return nil, e }</pre></code><tr><td>108<td><code><pre> case func(Canceller) (any, error):</pre></code><tr class=miss><td>109<td><code><pre> canCancel = true</pre></code><tr class=miss><td>110<td><code><pre> act2 = func(canceller Canceller, a ...any) (any, error) { return v(canceller) }</pre></code><tr><td>111<td><code><pre> default:</pre></code><tr><td>112<td><code><pre> typ := reflect.TypeOf(v)</pre></code><tr><td>113<td><code><pre> if typ.Kind() == reflect.Func {</pre></code><tr><td>114<td><code><pre> act1 = utils.WrapFunc2[any, error](v)</pre></code><tr><td>115<td><code><pre> } else {</pre></code><tr class=miss><td>116<td><code><pre> if e, ok := v.(error); !ok {</pre></code><tr class=miss><td>117<td><code><pre> _ = p.Resolve(v)</pre></code><tr><td>118<td><code><pre> } else {</pre></code><tr class=miss><td>119<td><code><pre> _ = p.Reject(e)</pre></code><tr><td>120<td><code><pre> }</pre></code><tr class=miss><td>121<td><code><pre> return nil</pre></code><tr><td>122<td><code><pre> }</pre></code><tr><td>123<td><code><pre> }</pre></code><tr><td>124<td><code><pre></pre></code><tr><td>125<td><code><pre> // If parameters of act function has a Canceller interface, the Future will be cancelled.</pre></code><tr><td>126<td><code><pre> var canceller Canceller</pre></code><tr><td>127<td><code><pre> if p != nil && canCancel {</pre></code><tr class=miss><td>128<td><code><pre> canceller = p.Canceller()</pre></code><tr><td>129<td><code><pre> }</pre></code><tr><td>130<td><code><pre></pre></code><tr><td>131<td><code><pre> // return proxy function of act function</pre></code><tr><td>132<td><code><pre> f = func(opt *candyOption) (r any, err error) {</pre></code><tr><td>133<td><code><pre> defer func() {</pre></code><tr><td>134<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>135<td><code><pre> err = newErrorWithStacks(e)</pre></code><tr><td>136<td><code><pre> }</pre></code><tr><td>137<td><code><pre> }()</pre></code><tr><td>138<td><code><pre></pre></code><tr><td>139<td><code><pre> if canCancel {</pre></code><tr><td>140<td><code><pre> r, err = act2(canceller, opt.args...)</pre></code><tr><td>141<td><code><pre> } else {</pre></code><tr><td>142<td><code><pre> r, err = act1(opt.args...)</pre></code><tr><td>143<td><code><pre> }</pre></code><tr><td>144<td><code><pre></pre></code><tr><td>145<td><code><pre> return</pre></code><tr><td>146<td><code><pre> }</pre></code><tr><td>147<td><code><pre> return</pre></code><tr><td>148<td><code><pre>}</pre></code></table><div class=funcname id=fn_getFutureReturnVal>func getFutureReturnVal</div><div class=info><a href=#s_fn_getFutureReturnVal>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>190<td><code><pre>func getFutureReturnVal(r *Result) (any, error) {</pre></code><tr><td>191<td><code><pre> switch r.Typ {</pre></code><tr><td>192<td><code><pre> case ResultSuccess:</pre></code><tr><td>193<td><code><pre> return r.Result, nil</pre></code><tr><td>194<td><code><pre> case ResultFailure:</pre></code><tr class=miss><td>195<td><code><pre> return nil, getError(r.Result)</pre></code><tr><td>196<td><code><pre> default:</pre></code><tr class=miss><td>197<td><code><pre> return nil, getError(r.Result) // &CancelledError{}</pre></code><tr><td>198<td><code><pre> }</pre></code><tr><td>199<td><code><pre>}</pre></code></table><div class=funcname id=fn_@471:10>func @471:10</div><div class=info><a href=#s_fn_@471:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>471<td><code><pre>func() {</pre></code><tr><td>472<td><code><pre> if e := recover(); e != nil {</pre></code><tr class=miss><td>473<td><code><pre> _ = wf.Reject(newErrorWithStacks(e))</pre></code><tr><td>474<td><code><pre> }</pre></code><tr><td>475<td><code><pre> }</pre></code></table><div class=funcname id=fn_@122:15>func @122:15</div><div class=info><a href=#s_fn_@122:15>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>122<td><code><pre>func(v any) {</pre></code><tr><td>123<td><code><pre> if opt.ch != nil {</pre></code><tr class=miss><td>124<td><code><pre> opt.ch <- v</pre></code><tr><td>125<td><code><pre> }</pre></code><tr><td>126<td><code><pre> }</pre></code></table><div class=funcname id=fn_@157:15>func @157:15</div><div class=info><a href=#s_fn_@157:15>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>157<td><code><pre>func(v any) {</pre></code><tr><td>158<td><code><pre> if opt.ch != nil {</pre></code><tr class=miss><td>159<td><code><pre> opt.ch <- v</pre></code><tr><td>160<td><code><pre> }</pre></code><tr><td>161<td><code><pre> }</pre></code></table><div class=funcname id=fn_@202:8>func @202:8</div><div class=info><a href=#s_fn_@202:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>202<td><code><pre>func() {</pre></code><tr><td>203<td><code><pre> if !async && opt.wg != nil {</pre></code><tr class=miss><td>204<td><code><pre> opt.wg.Done()</pre></code><tr><td>205<td><code><pre> }</pre></code><tr><td>206<td><code><pre> }</pre></code></table><div class=funcname id=fn_@133:9>func @133:9</div><div class=info><a href=#s_fn_@133:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>133<td><code><pre>func() {</pre></code><tr><td>134<td><code><pre> if e := recover(); e != nil {</pre></code><tr class=miss><td>135<td><code><pre> err = newErrorWithStacks(e)</pre></code><tr><td>136<td><code><pre> }</pre></code><tr><td>137<td><code><pre> }</pre></code></table><div class=funcname id=fn_@73:14>func @73:14</div><div class=info><a href=#s_fn_@73:14>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>73<td><code><pre>func(v any) {</pre></code><tr><td>74<td><code><pre> if opt.ch == nil {</pre></code><tr class=miss><td>75<td><code><pre> log.Printf("[Gofusion] %s catches an error in routine.Go function: \n"+</pre></code><tr><td>76<td><code><pre> "error: %s\nfunc: %s\nfunc signature: %T",</pre></code><tr><td>77<td><code><pre> config.ComponentGoroutinePool, v, utils.GetFuncName(task), task)</pre></code><tr><td>78<td><code><pre> }</pre></code><tr><td>79<td><code><pre> }</pre></code></table><div class=funcname id=fn_@215:14>func @215:14</div><div class=info><a href=#s_fn_@215:14>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>215<td><code><pre>func(v any) {</pre></code><tr><td>216<td><code><pre> if opt.ch != nil {</pre></code><tr class=miss><td>217<td><code><pre> opt.ch <- v</pre></code><tr><td>218<td><code><pre> }</pre></code><tr><td>219<td><code><pre> }</pre></code></table><div class=funcname id=fn_@241:10>func @241:10</div><div class=info><a href=#s_fn_@241:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>241<td><code><pre>func() {</pre></code><tr><td>242<td><code><pre> if e := recover(); e != nil {</pre></code><tr class=miss><td>243<td><code><pre> err := newErrorWithStacks(e)</pre></code><tr class=miss><td>244<td><code><pre> fmt.Println("error happens:\n ", err)</pre></code><tr><td>245<td><code><pre> }</pre></code><tr><td>246<td><code><pre> }</pre></code></table><div class=funcname id=fn_@303:8>func @303:8</div><div class=info><a href=#s_fn_@303:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>303<td><code><pre>func() {</pre></code><tr><td>304<td><code><pre> if err := getError(recover()); err != nil {</pre></code><tr class=miss><td>305<td><code><pre> e = err</pre></code><tr class=miss><td>306<td><code><pre> fmt.Printf("\nerror in setResult(): %s\n%s\n", err, debug.Stack())</pre></code><tr><td>307<td><code><pre> }</pre></code><tr><td>308<td><code><pre> }</pre></code></table><div class=funcname id=fn_@330:12>func @330:12</div><div class=info><a href=#s_fn_@330:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>330<td><code><pre>func() {</pre></code><tr><td>331<td><code><pre> if e := recover(); e != nil {</pre></code><tr class=miss><td>332<td><code><pre> err := newErrorWithStacks(e)</pre></code><tr class=miss><td>333<td><code><pre> fmt.Println("error happens:\n ", err)</pre></code><tr><td>334<td><code><pre> }</pre></code><tr><td>335<td><code><pre> }</pre></code></table><div class=funcname id=fn_getError>func getError</div><div class=info><a href=#s_fn_getError>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>155<td><code><pre>func getError(i any) (e error) {</pre></code><tr><td>156<td><code><pre> if i != nil {</pre></code><tr class=miss><td>157<td><code><pre> switch v := i.(type) {</pre></code><tr><td>158<td><code><pre> case error:</pre></code><tr class=miss><td>159<td><code><pre> e = v</pre></code><tr><td>160<td><code><pre> case string:</pre></code><tr class=miss><td>161<td><code><pre> e = errors.New(v)</pre></code><tr><td>162<td><code><pre> default:</pre></code><tr class=miss><td>163<td><code><pre> if s, ok := i.(stringer); ok {</pre></code><tr class=miss><td>164<td><code><pre> e = errors.New(s.String())</pre></code><tr><td>165<td><code><pre> } else {</pre></code><tr class=miss><td>166<td><code><pre> e = fmt.Errorf("%v", i)</pre></code><tr><td>167<td><code><pre> }</pre></code><tr><td>168<td><code><pre> }</pre></code><tr><td>169<td><code><pre> }</pre></code><tr><td>170<td><code><pre> return</pre></code><tr><td>171<td><code><pre>}</pre></code></table><div class=funcname id=fn_Future.Pipe>func Future.Pipe</div><div class=info><a href=#s_fn_Future.Pipe>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>205<td><code><pre>func (f *Future) Pipe(callbacks ...any) (result *Future, ok bool) {</pre></code><tr class=miss><td>206<td><code><pre> if len(callbacks) == 0 ||</pre></code><tr><td>207<td><code><pre> (len(callbacks) == 1 && callbacks[0] == nil) ||</pre></code><tr><td>208<td><code><pre> (len(callbacks) > 1 && callbacks[0] == nil && callbacks[1] == nil) {</pre></code><tr class=miss><td>209<td><code><pre> result = f</pre></code><tr class=miss><td>210<td><code><pre> return</pre></code><tr><td>211<td><code><pre> }</pre></code><tr><td>212<td><code><pre></pre></code><tr><td>213<td><code><pre> // ensure all callback functions match the spec "func(v any) *Future"</pre></code><tr class=miss><td>214<td><code><pre> cs := make([]func(v any) *Future, len(callbacks))</pre></code><tr class=miss><td>215<td><code><pre> for i, callback := range callbacks {</pre></code><tr class=miss><td>216<td><code><pre> switch c := callback.(type) {</pre></code><tr><td>217<td><code><pre> case func(v any) *Future:</pre></code><tr class=miss><td>218<td><code><pre> cs[i] = c</pre></code><tr><td>219<td><code><pre> case func() *Future:</pre></code><tr class=miss><td>220<td><code><pre> cs[i] = func(v any) *Future {</pre></code><tr><td>221<td><code><pre> return c()</pre></code><tr><td>222<td><code><pre> }</pre></code><tr><td>223<td><code><pre> case func(v any):</pre></code><tr class=miss><td>224<td><code><pre> cs[i] = func(v any) *Future {</pre></code><tr><td>225<td><code><pre> return start(func() {</pre></code><tr><td>226<td><code><pre> c(v)</pre></code><tr><td>227<td><code><pre> }, true)</pre></code><tr><td>228<td><code><pre> }</pre></code><tr><td>229<td><code><pre> case func(v any) (r any, err error):</pre></code><tr class=miss><td>230<td><code><pre> cs[i] = func(v any) *Future {</pre></code><tr><td>231<td><code><pre> return start(func() (r any, err error) {</pre></code><tr><td>232<td><code><pre> r, err = c(v)</pre></code><tr><td>233<td><code><pre> return</pre></code><tr><td>234<td><code><pre> }, true)</pre></code><tr><td>235<td><code><pre> }</pre></code><tr><td>236<td><code><pre> case func():</pre></code><tr class=miss><td>237<td><code><pre> cs[i] = func(v any) *Future {</pre></code><tr><td>238<td><code><pre> return start(func() {</pre></code><tr><td>239<td><code><pre> c()</pre></code><tr><td>240<td><code><pre> }, true)</pre></code><tr><td>241<td><code><pre> }</pre></code><tr><td>242<td><code><pre> case func() (r any, err error):</pre></code><tr class=miss><td>243<td><code><pre> cs[i] = func(v any) *Future {</pre></code><tr><td>244<td><code><pre> return start(func() (r any, err error) {</pre></code><tr><td>245<td><code><pre> r, err = c()</pre></code><tr><td>246<td><code><pre> return</pre></code><tr><td>247<td><code><pre> }, true)</pre></code><tr><td>248<td><code><pre> }</pre></code><tr><td>249<td><code><pre> default:</pre></code><tr class=miss><td>250<td><code><pre> ok = false</pre></code><tr class=miss><td>251<td><code><pre> return</pre></code><tr><td>252<td><code><pre> }</pre></code><tr><td>253<td><code><pre> }</pre></code><tr><td>254<td><code><pre></pre></code><tr class=miss><td>255<td><code><pre> for {</pre></code><tr class=miss><td>256<td><code><pre> v := f.loadVal()</pre></code><tr class=miss><td>257<td><code><pre> r := v.r</pre></code><tr class=miss><td>258<td><code><pre> if r != nil {</pre></code><tr class=miss><td>259<td><code><pre> result = f</pre></code><tr class=miss><td>260<td><code><pre> if r.Typ == ResultSuccess && cs[0] != nil {</pre></code><tr class=miss><td>261<td><code><pre> result = cs[0](r.Result)</pre></code><tr class=miss><td>262<td><code><pre> } else if r.Typ == ResultFailure && len(cs) > 1 && cs[1] != nil {</pre></code><tr class=miss><td>263<td><code><pre> result = cs[1](r.Result)</pre></code><tr><td>264<td><code><pre> }</pre></code><tr><td>265<td><code><pre> } else {</pre></code><tr class=miss><td>266<td><code><pre> newPipe := &pipe{}</pre></code><tr class=miss><td>267<td><code><pre> newPipe.pipeDoneTask = cs[0]</pre></code><tr class=miss><td>268<td><code><pre> if len(cs) > 1 {</pre></code><tr class=miss><td>269<td><code><pre> newPipe.pipeFailTask = cs[1]</pre></code><tr><td>270<td><code><pre> }</pre></code><tr class=miss><td>271<td><code><pre> newPipe.pipePromise = NewPromise()</pre></code><tr><td>272<td><code><pre></pre></code><tr class=miss><td>273<td><code><pre> newVal := *v</pre></code><tr class=miss><td>274<td><code><pre> newVal.pipes = append(newVal.pipes, newPipe)</pre></code><tr><td>275<td><code><pre></pre></code><tr><td>276<td><code><pre> // use CAS to ensure that the state of Future is not changed,</pre></code><tr><td>277<td><code><pre> // if the state is changed, will retry CAS operation.</pre></code><tr class=miss><td>278<td><code><pre> if atomic.CompareAndSwapPointer(&f.val, unsafe.Pointer(v), unsafe.Pointer(&newVal)) {</pre></code><tr class=miss><td>279<td><code><pre> result = newPipe.pipePromise.Future</pre></code><tr class=miss><td>280<td><code><pre> break</pre></code><tr><td>281<td><code><pre> }</pre></code><tr><td>282<td><code><pre> }</pre></code><tr><td>283<td><code><pre> }</pre></code><tr><td>284<td><code><pre></pre></code><tr class=miss><td>285<td><code><pre> ok = true</pre></code><tr class=miss><td>286<td><code><pre> return</pre></code><tr><td>287<td><code><pre>}</pre></code></table><div class=funcname id=fn_WhenAnyMatched>func WhenAnyMatched</div><div class=info><a href=#s_fn_WhenAnyMatched>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>294<td><code><pre>func WhenAnyMatched(predicate func(any) bool, acts ...any) *Future {</pre></code><tr class=miss><td>295<td><code><pre> if predicate == nil {</pre></code><tr class=miss><td>296<td><code><pre> predicate = func(v any) bool { return true }</pre></code><tr><td>297<td><code><pre> }</pre></code><tr><td>298<td><code><pre></pre></code><tr class=miss><td>299<td><code><pre> opts := make([]utils.OptionExtender, 0, len(acts))</pre></code><tr class=miss><td>300<td><code><pre> for i, act := range acts {</pre></code><tr class=miss><td>301<td><code><pre> if opt, ok := act.(utils.OptionExtender); ok {</pre></code><tr class=miss><td>302<td><code><pre> opts = append(opts, opt)</pre></code><tr class=miss><td>303<td><code><pre> acts = append(acts[:i], acts[i+1:]...)</pre></code><tr><td>304<td><code><pre> }</pre></code><tr><td>305<td><code><pre> }</pre></code><tr class=miss><td>306<td><code><pre> fs := make([]*Future, len(acts))</pre></code><tr class=miss><td>307<td><code><pre> for i, act := range acts {</pre></code><tr class=miss><td>308<td><code><pre> fs[i] = Promise(act, true, opts...)</pre></code><tr><td>309<td><code><pre> }</pre></code><tr><td>310<td><code><pre></pre></code><tr class=miss><td>311<td><code><pre> nf, rs := NewPromise(), make([]any, len(fs))</pre></code><tr class=miss><td>312<td><code><pre> if len(acts) == 0 {</pre></code><tr class=miss><td>313<td><code><pre> _ = nf.Resolve(nil)</pre></code><tr><td>314<td><code><pre> }</pre></code><tr><td>315<td><code><pre></pre></code><tr class=miss><td>316<td><code><pre> chFails, chDones := make(chan anyPromiseResult), make(chan anyPromiseResult)</pre></code><tr><td>317<td><code><pre> // close the channel for avoid the sender be blocked</pre></code><tr class=miss><td>318<td><code><pre> closeChan := func(c chan anyPromiseResult) {</pre></code><tr><td>319<td><code><pre> defer func() { _ = recover() }()</pre></code><tr><td>320<td><code><pre> close(c)</pre></code><tr><td>321<td><code><pre> }</pre></code><tr><td>322<td><code><pre></pre></code><tr class=miss><td>323<td><code><pre> go func() {</pre></code><tr><td>324<td><code><pre> defer func() {</pre></code><tr><td>325<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>326<td><code><pre> _ = nf.Reject(newErrorWithStacks(e))</pre></code><tr><td>327<td><code><pre> }</pre></code><tr><td>328<td><code><pre> closeChan(chFails)</pre></code><tr><td>329<td><code><pre> closeChan(chDones)</pre></code><tr><td>330<td><code><pre> }()</pre></code><tr><td>331<td><code><pre></pre></code><tr><td>332<td><code><pre> for i, f := range fs {</pre></code><tr><td>333<td><code><pre> k := i</pre></code><tr><td>334<td><code><pre> f.OnSuccess(func(v any) {</pre></code><tr><td>335<td><code><pre> defer func() { _ = recover() }()</pre></code><tr><td>336<td><code><pre> chDones <- anyPromiseResult{result: v, i: k}</pre></code><tr><td>337<td><code><pre> }).OnFailure(func(v any) {</pre></code><tr><td>338<td><code><pre> defer func() { _ = recover() }()</pre></code><tr><td>339<td><code><pre> chFails <- anyPromiseResult{result: v, i: k}</pre></code><tr><td>340<td><code><pre> }).OnCancel(func() {</pre></code><tr><td>341<td><code><pre> defer func() { _ = recover() }()</pre></code><tr><td>342<td><code><pre> chFails <- anyPromiseResult{result: ErrCancelled, i: k}</pre></code><tr><td>343<td><code><pre> })</pre></code><tr><td>344<td><code><pre> }</pre></code><tr><td>345<td><code><pre> }()</pre></code><tr><td>346<td><code><pre></pre></code><tr class=miss><td>347<td><code><pre> if len(fs) == 1 {</pre></code><tr class=miss><td>348<td><code><pre> select {</pre></code><tr><td>349<td><code><pre> case r := <-chFails:</pre></code><tr class=miss><td>350<td><code><pre> if _, ok := r.result.(CancelledError); ok {</pre></code><tr class=miss><td>351<td><code><pre> _ = nf.Cancel()</pre></code><tr><td>352<td><code><pre> } else {</pre></code><tr class=miss><td>353<td><code><pre> _ = nf.Reject(newNoMatchedError1(r.result))</pre></code><tr><td>354<td><code><pre> }</pre></code><tr><td>355<td><code><pre> case r := <-chDones:</pre></code><tr class=miss><td>356<td><code><pre> if predicate(r.result) {</pre></code><tr class=miss><td>357<td><code><pre> _ = nf.Resolve(r.result)</pre></code><tr><td>358<td><code><pre> } else {</pre></code><tr class=miss><td>359<td><code><pre> _ = nf.Reject(newNoMatchedError1(r.result))</pre></code><tr><td>360<td><code><pre> }</pre></code><tr><td>361<td><code><pre> }</pre></code><tr><td>362<td><code><pre></pre></code><tr class=miss><td>363<td><code><pre> closeChan(chFails)</pre></code><tr class=miss><td>364<td><code><pre> closeChan(chDones)</pre></code><tr><td>365<td><code><pre> } else {</pre></code><tr class=miss><td>366<td><code><pre> go func() {</pre></code><tr><td>367<td><code><pre> defer func() {</pre></code><tr><td>368<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>369<td><code><pre> _ = nf.Reject(newErrorWithStacks(e))</pre></code><tr><td>370<td><code><pre> }</pre></code><tr><td>371<td><code><pre> closeChan(chFails)</pre></code><tr><td>372<td><code><pre> closeChan(chDones)</pre></code><tr><td>373<td><code><pre> }()</pre></code><tr><td>374<td><code><pre></pre></code><tr><td>375<td><code><pre> j := 0</pre></code><tr><td>376<td><code><pre> for {</pre></code><tr><td>377<td><code><pre> select {</pre></code><tr><td>378<td><code><pre> case r := <-chFails:</pre></code><tr><td>379<td><code><pre> rs[r.i] = getError(r.result)</pre></code><tr><td>380<td><code><pre> case r := <-chDones:</pre></code><tr><td>381<td><code><pre> if !predicate(r.result) {</pre></code><tr><td>382<td><code><pre> rs[r.i] = r.result</pre></code><tr><td>383<td><code><pre> } else {</pre></code><tr><td>384<td><code><pre> // try to cancel other futures</pre></code><tr><td>385<td><code><pre> for _, f := range fs {</pre></code><tr><td>386<td><code><pre> _ = f.Cancel()</pre></code><tr><td>387<td><code><pre> }</pre></code><tr><td>388<td><code><pre></pre></code><tr><td>389<td><code><pre> // resolve the future and return result</pre></code><tr><td>390<td><code><pre> _ = nf.Resolve(r.result)</pre></code><tr><td>391<td><code><pre> return</pre></code><tr><td>392<td><code><pre> }</pre></code><tr><td>393<td><code><pre> }</pre></code><tr><td>394<td><code><pre></pre></code><tr><td>395<td><code><pre> if j++; j == len(fs) {</pre></code><tr><td>396<td><code><pre> m := 0</pre></code><tr><td>397<td><code><pre> for _, r := range rs {</pre></code><tr><td>398<td><code><pre> switch r.(type) {</pre></code><tr><td>399<td><code><pre> case CancelledError:</pre></code><tr><td>400<td><code><pre> default:</pre></code><tr><td>401<td><code><pre> m++</pre></code><tr><td>402<td><code><pre> }</pre></code><tr><td>403<td><code><pre> }</pre></code><tr><td>404<td><code><pre> if m > 0 {</pre></code><tr><td>405<td><code><pre> _ = nf.Reject(newNoMatchedError(rs))</pre></code><tr><td>406<td><code><pre> } else {</pre></code><tr><td>407<td><code><pre> _ = nf.Cancel()</pre></code><tr><td>408<td><code><pre> }</pre></code><tr><td>409<td><code><pre> break</pre></code><tr><td>410<td><code><pre> }</pre></code><tr><td>411<td><code><pre> }</pre></code><tr><td>412<td><code><pre> }()</pre></code><tr><td>413<td><code><pre> }</pre></code><tr class=miss><td>414<td><code><pre> return nf.Future</pre></code><tr><td>415<td><code><pre>}</pre></code></table><div class=funcname id=fn_@366:6>func @366:6</div><div class=info><a href=#s_fn_@366:6>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>366<td><code><pre>func() {</pre></code><tr class=miss><td>367<td><code><pre> defer func() {</pre></code><tr><td>368<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>369<td><code><pre> _ = nf.Reject(newErrorWithStacks(e))</pre></code><tr><td>370<td><code><pre> }</pre></code><tr><td>371<td><code><pre> closeChan(chFails)</pre></code><tr><td>372<td><code><pre> closeChan(chDones)</pre></code><tr><td>373<td><code><pre> }()</pre></code><tr><td>374<td><code><pre></pre></code><tr class=miss><td>375<td><code><pre> j := 0</pre></code><tr class=miss><td>376<td><code><pre> for {</pre></code><tr class=miss><td>377<td><code><pre> select {</pre></code><tr><td>378<td><code><pre> case r := <-chFails:</pre></code><tr class=miss><td>379<td><code><pre> rs[r.i] = getError(r.result)</pre></code><tr><td>380<td><code><pre> case r := <-chDones:</pre></code><tr class=miss><td>381<td><code><pre> if !predicate(r.result) {</pre></code><tr class=miss><td>382<td><code><pre> rs[r.i] = r.result</pre></code><tr><td>383<td><code><pre> } else {</pre></code><tr><td>384<td><code><pre> // try to cancel other futures</pre></code><tr class=miss><td>385<td><code><pre> for _, f := range fs {</pre></code><tr class=miss><td>386<td><code><pre> _ = f.Cancel()</pre></code><tr><td>387<td><code><pre> }</pre></code><tr><td>388<td><code><pre></pre></code><tr><td>389<td><code><pre> // resolve the future and return result</pre></code><tr class=miss><td>390<td><code><pre> _ = nf.Resolve(r.result)</pre></code><tr class=miss><td>391<td><code><pre> return</pre></code><tr><td>392<td><code><pre> }</pre></code><tr><td>393<td><code><pre> }</pre></code><tr><td>394<td><code><pre></pre></code><tr class=miss><td>395<td><code><pre> if j++; j == len(fs) {</pre></code><tr class=miss><td>396<td><code><pre> m := 0</pre></code><tr class=miss><td>397<td><code><pre> for _, r := range rs {</pre></code><tr class=miss><td>398<td><code><pre> switch r.(type) {</pre></code><tr><td>399<td><code><pre> case CancelledError:</pre></code><tr><td>400<td><code><pre> default:</pre></code><tr class=miss><td>401<td><code><pre> m++</pre></code><tr><td>402<td><code><pre> }</pre></code><tr><td>403<td><code><pre> }</pre></code><tr class=miss><td>404<td><code><pre> if m > 0 {</pre></code><tr class=miss><td>405<td><code><pre> _ = nf.Reject(newNoMatchedError(rs))</pre></code><tr><td>406<td><code><pre> } else {</pre></code><tr class=miss><td>407<td><code><pre> _ = nf.Cancel()</pre></code><tr><td>408<td><code><pre> }</pre></code><tr class=miss><td>409<td><code><pre> break</pre></code><tr><td>410<td><code><pre> }</pre></code><tr><td>411<td><code><pre> }</pre></code><tr><td>412<td><code><pre> }</pre></code></table><div class=funcname id=fn_AggregateError.Error>func AggregateError.Error</div><div class=info><a href=#s_fn_AggregateError.Error>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>46<td><code><pre>func (e *AggregateError) Error() string {</pre></code><tr class=miss><td>47<td><code><pre> if e.InnerErrs == nil {</pre></code><tr class=miss><td>48<td><code><pre> return e.s</pre></code><tr><td>49<td><code><pre> } else {</pre></code><tr class=miss><td>50<td><code><pre> buf := bytes.NewBufferString(e.s)</pre></code><tr class=miss><td>51<td><code><pre> _, _ = buf.WriteString("\n\n")</pre></code><tr class=miss><td>52<td><code><pre> for i, ie := range e.InnerErrs {</pre></code><tr class=miss><td>53<td><code><pre> if ie == nil {</pre></code><tr class=miss><td>54<td><code><pre> continue</pre></code><tr><td>55<td><code><pre> }</pre></code><tr class=miss><td>56<td><code><pre> _, _ = buf.WriteString("error appears in Future ")</pre></code><tr class=miss><td>57<td><code><pre> _, _ = buf.WriteString(strconv.Itoa(i))</pre></code><tr class=miss><td>58<td><code><pre> _, _ = buf.WriteString(": ")</pre></code><tr class=miss><td>59<td><code><pre> _, _ = buf.WriteString(ie.Error())</pre></code><tr class=miss><td>60<td><code><pre> _, _ = buf.WriteString("\n")</pre></code><tr><td>61<td><code><pre> }</pre></code><tr class=miss><td>62<td><code><pre> _, _ = buf.WriteString("\n")</pre></code><tr class=miss><td>63<td><code><pre> return buf.String()</pre></code><tr><td>64<td><code><pre> }</pre></code><tr><td>65<td><code><pre>}</pre></code></table><div class=funcname id=fn_newErrorWithStacks>func newErrorWithStacks</div><div class=info><a href=#s_fn_newErrorWithStacks>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>71<td><code><pre>func newErrorWithStacks(i any) (e error) {</pre></code><tr class=miss><td>72<td><code><pre> err := getError(i)</pre></code><tr class=miss><td>73<td><code><pre> buf := bytes.NewBufferString(err.Error())</pre></code><tr class=miss><td>74<td><code><pre> _, _ = buf.WriteString("\n")</pre></code><tr><td>75<td><code><pre></pre></code><tr class=miss><td>76<td><code><pre> pcs := make([]uintptr, 50)</pre></code><tr class=miss><td>77<td><code><pre> num := runtime.Callers(2, pcs)</pre></code><tr class=miss><td>78<td><code><pre> for _, v := range pcs[0:num] {</pre></code><tr class=miss><td>79<td><code><pre> fun := runtime.FuncForPC(v)</pre></code><tr class=miss><td>80<td><code><pre> file, line := fun.FileLine(v)</pre></code><tr class=miss><td>81<td><code><pre> name := fun.Name()</pre></code><tr class=miss><td>82<td><code><pre> writeStrings(buf, []string{name, " ", file, ":", strconv.Itoa(line), "\n"})</pre></code><tr><td>83<td><code><pre> }</pre></code><tr class=miss><td>84<td><code><pre> return errors.New(buf.String())</pre></code><tr><td>85<td><code><pre>}</pre></code></table><div class=funcname id=fn_@233:9>func @233:9</div><div class=info><a href=#s_fn_@233:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>233<td><code><pre>func(o *NewPoolOption) {</pre></code><tr class=miss><td>234<td><code><pre> o.ApplyTimeout = in.ApplyTimeout</pre></code><tr class=miss><td>235<td><code><pre> o.ExpiryDuration = in.PoolOption.ExpiryDuration</pre></code><tr class=miss><td>236<td><code><pre> o.PreAlloc = in.PreAlloc</pre></code><tr class=miss><td>237<td><code><pre> o.MaxBlockingTasks = in.MaxBlockingTasks</pre></code><tr class=miss><td>238<td><code><pre> o.Nonblocking = in.Nonblocking</pre></code><tr class=miss><td>239<td><code><pre> o.PanicHandler = in.PanicHandler</pre></code><tr class=miss><td>240<td><code><pre> o.Logger = in.Logger</pre></code><tr class=miss><td>241<td><code><pre> o.DisablePurge = in.DisablePurge</pre></code><tr><td>242<td><code><pre> }</pre></code></table><div class=funcname id=fn_WrapFuture>func WrapFuture</div><div class=info><a href=#s_fn_WrapFuture>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>263<td><code><pre>func WrapFuture(value any, opts ...utils.OptionExtender) *Future {</pre></code><tr class=miss><td>264<td><code><pre> opt := utils.ApplyOptions[candyOption](opts...)</pre></code><tr class=miss><td>265<td><code><pre> p := NewPromise()</pre></code><tr class=miss><td>266<td><code><pre> p.AppName = opt.appName</pre></code><tr class=miss><td>267<td><code><pre> if e, ok := value.(error); !ok {</pre></code><tr class=miss><td>268<td><code><pre> _ = p.Resolve(value)</pre></code><tr><td>269<td><code><pre> } else {</pre></code><tr class=miss><td>270<td><code><pre> _ = p.Reject(e)</pre></code><tr><td>271<td><code><pre> }</pre></code><tr><td>272<td><code><pre></pre></code><tr class=miss><td>273<td><code><pre> return p.Future</pre></code><tr><td>274<td><code><pre>}</pre></code></table><div class=funcname id=fn_showRoutine>func showRoutine</div><div class=info><a href=#s_fn_showRoutine>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/types.go</code>:</div><table class=listing><tr><td>77<td><code><pre>func showRoutine(appName string) (r []string) {</pre></code><tr class=miss><td>78<td><code><pre> locker.RLock()</pre></code><tr class=miss><td>79<td><code><pre> defer locker.RUnlock()</pre></code><tr class=miss><td>80<td><code><pre> r = make([]string, 0, len(routines[appName]))</pre></code><tr class=miss><td>81<td><code><pre> for n, c := range routines[appName] {</pre></code><tr class=miss><td>82<td><code><pre> r = append(r, n+":"+strconv.Itoa(c))</pre></code><tr><td>83<td><code><pre> }</pre></code><tr class=miss><td>84<td><code><pre> return</pre></code><tr><td>85<td><code><pre>}</pre></code></table><div class=funcname id=fn_@104:5>func @104:5</div><div class=info><a href=#s_fn_@104:5>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>104<td><code><pre>func() {</pre></code><tr class=miss><td>105<td><code><pre> defer func() {</pre></code><tr><td>106<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>107<td><code><pre> err := newErrorWithStacks(e)</pre></code><tr><td>108<td><code><pre> fmt.Println("error happens:\n ", err)</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre> }()</pre></code><tr><td>111<td><code><pre></pre></code><tr class=miss><td>112<td><code><pre> timer := time.NewTimer(timeout)</pre></code><tr class=miss><td>113<td><code><pre> defer timer.Stop()</pre></code><tr class=miss><td>114<td><code><pre> <-timer.C</pre></code><tr><td>115<td><code><pre></pre></code><tr class=miss><td>116<td><code><pre> _ = f.Cancel()</pre></code><tr><td>117<td><code><pre> }</pre></code></table><div class=funcname id=fn_@342:8>func @342:8</div><div class=info><a href=#s_fn_@342:8>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>342<td><code><pre>func() {</pre></code><tr class=miss><td>343<td><code><pre> defer func() {</pre></code><tr><td>344<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>345<td><code><pre> err := newErrorWithStacks(e)</pre></code><tr><td>346<td><code><pre> fmt.Println("error happens:\n ", err)</pre></code><tr><td>347<td><code><pre> }</pre></code><tr><td>348<td><code><pre> }()</pre></code><tr class=miss><td>349<td><code><pre> for _, pipe := range v.pipes {</pre></code><tr class=miss><td>350<td><code><pre> pipeTask, pipePromise := pipe.getPipe(r.Typ == ResultSuccess)</pre></code><tr class=miss><td>351<td><code><pre> startPipe(r, pipeTask, pipePromise)</pre></code><tr><td>352<td><code><pre> }</pre></code><tr><td>353<td><code><pre> }</pre></code></table><div class=funcname id=fn_@367:10>func @367:10</div><div class=info><a href=#s_fn_@367:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>367<td><code><pre>func() {</pre></code><tr class=miss><td>368<td><code><pre> if e := recover(); e != nil {</pre></code><tr class=miss><td>369<td><code><pre> _ = nf.Reject(newErrorWithStacks(e))</pre></code><tr><td>370<td><code><pre> }</pre></code><tr class=miss><td>371<td><code><pre> closeChan(chFails)</pre></code><tr class=miss><td>372<td><code><pre> closeChan(chDones)</pre></code><tr><td>373<td><code><pre> }</pre></code></table><div class=funcname id=fn_@486:18>func @486:18</div><div class=info><a href=#s_fn_@486:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>486<td><code><pre>func(v any) {</pre></code><tr class=miss><td>487<td><code><pre> if atomic.CompareAndSwapInt32(&isCancelled, 0, 1) {</pre></code><tr><td>488<td><code><pre> // try to cancel all futures</pre></code><tr class=miss><td>489<td><code><pre> cancelOthers(j)</pre></code><tr><td>490<td><code><pre></pre></code><tr><td>491<td><code><pre> // errs := make([]error, 0, 1)</pre></code><tr><td>492<td><code><pre> // errs = append(errs, v.(error))</pre></code><tr class=miss><td>493<td><code><pre> e := newAggregateError1("error appears in WhenAll:", v)</pre></code><tr class=miss><td>494<td><code><pre> _ = wf.Reject(e)</pre></code><tr><td>495<td><code><pre> }</pre></code><tr><td>496<td><code><pre> }</pre></code></table><div class=funcname id=fn_Loopc>func Loopc</div><div class=info><a href=#s_fn_Loopc>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>167<td><code><pre>func Loopc(ctx context.Context, task any, opts ...utils.OptionExtender) {</pre></code><tr class=miss><td>168<td><code><pre> opt := utils.ApplyOptions[candyOption](opts...)</pre></code><tr class=miss><td>169<td><code><pre> allocate(opt.appName, 1, &NewPoolOption{ApplyTimeout: -1}, ignoreRecycled())</pre></code><tr class=miss><td>170<td><code><pre> exec := func() {</pre></code><tr><td>171<td><code><pre> defer func() {</pre></code><tr><td>172<td><code><pre> release(opt.appName, nil, ignoreRecycled())</pre></code><tr><td>173<td><code><pre> if opt.wg != nil {</pre></code><tr><td>174<td><code><pre> opt.wg.Done()</pre></code><tr><td>175<td><code><pre> }</pre></code><tr><td>176<td><code><pre> }()</pre></code><tr><td>177<td><code><pre> select {</pre></code><tr><td>178<td><code><pre> case <-ctx.Done():</pre></code><tr><td>179<td><code><pre> case <-wrapPromise(task, false, opts...).</pre></code><tr><td>180<td><code><pre> OnFailure(func(v any) {</pre></code><tr><td>181<td><code><pre> if opt.ch == nil {</pre></code><tr><td>182<td><code><pre> log.Printf("[Gofusion] %s catches an error in routine.Loopc function: \n"+</pre></code><tr><td>183<td><code><pre> "error: %s\nfunc: %s\nfunc signature: %T",</pre></code><tr><td>184<td><code><pre> config.ComponentGoroutinePool, v, utils.GetFuncName(task), task)</pre></code><tr><td>185<td><code><pre> }</pre></code><tr><td>186<td><code><pre> }).</pre></code><tr><td>187<td><code><pre> OnComplete(func(v any) {</pre></code><tr><td>188<td><code><pre> if opt.ch != nil {</pre></code><tr><td>189<td><code><pre> opt.ch <- v</pre></code><tr><td>190<td><code><pre> }</pre></code><tr><td>191<td><code><pre> }).</pre></code><tr><td>192<td><code><pre> GetChan():</pre></code><tr><td>193<td><code><pre> }</pre></code><tr><td>194<td><code><pre> }</pre></code><tr><td>195<td><code><pre></pre></code><tr class=miss><td>196<td><code><pre> go exec()</pre></code><tr><td>197<td><code><pre>}</pre></code></table><div class=funcname id=fn_NoMatchedError.HasError>func NoMatchedError.HasError</div><div class=info><a href=#s_fn_NoMatchedError.HasError>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>23<td><code><pre>func (e *NoMatchedError) HasError() bool {</pre></code><tr class=miss><td>24<td><code><pre> for _, ie := range e.Results {</pre></code><tr class=miss><td>25<td><code><pre> if _, ok1 := ie.(error); ok1 {</pre></code><tr class=miss><td>26<td><code><pre> return true</pre></code><tr><td>27<td><code><pre> }</pre></code><tr><td>28<td><code><pre> }</pre></code><tr class=miss><td>29<td><code><pre> return false</pre></code><tr><td>30<td><code><pre>}</pre></code></table><div class=funcname id=fn_@324:9>func @324:9</div><div class=info><a href=#s_fn_@324:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>324<td><code><pre>func() {</pre></code><tr class=miss><td>325<td><code><pre> if e := recover(); e != nil {</pre></code><tr class=miss><td>326<td><code><pre> _ = nf.Reject(newErrorWithStacks(e))</pre></code><tr><td>327<td><code><pre> }</pre></code><tr class=miss><td>328<td><code><pre> closeChan(chFails)</pre></code><tr class=miss><td>329<td><code><pre> closeChan(chDones)</pre></code><tr><td>330<td><code><pre> }</pre></code></table><div class=funcname id=fn_Future.SetTimeout>func Future.SetTimeout</div><div class=info><a href=#s_fn_Future.SetTimeout>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>99<td><code><pre>func (f *Future) SetTimeout(timeout time.Duration) *Future {</pre></code><tr class=miss><td>100<td><code><pre> if timeout <= 0 {</pre></code><tr class=miss><td>101<td><code><pre> timeout = 10 * time.Nanosecond</pre></code><tr><td>102<td><code><pre> }</pre></code><tr><td>103<td><code><pre></pre></code><tr class=miss><td>104<td><code><pre> go func() {</pre></code><tr><td>105<td><code><pre> defer func() {</pre></code><tr><td>106<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>107<td><code><pre> err := newErrorWithStacks(e)</pre></code><tr><td>108<td><code><pre> fmt.Println("error happens:\n ", err)</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre> }()</pre></code><tr><td>111<td><code><pre></pre></code><tr><td>112<td><code><pre> timer := time.NewTimer(timeout)</pre></code><tr><td>113<td><code><pre> defer timer.Stop()</pre></code><tr><td>114<td><code><pre> <-timer.C</pre></code><tr><td>115<td><code><pre></pre></code><tr><td>116<td><code><pre> _ = f.Cancel()</pre></code><tr><td>117<td><code><pre> }()</pre></code><tr class=miss><td>118<td><code><pre> return f</pre></code><tr><td>119<td><code><pre>}</pre></code></table><div class=funcname id=fn_@323:5>func @323:5</div><div class=info><a href=#s_fn_@323:5>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>323<td><code><pre>func() {</pre></code><tr class=miss><td>324<td><code><pre> defer func() {</pre></code><tr><td>325<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>326<td><code><pre> _ = nf.Reject(newErrorWithStacks(e))</pre></code><tr><td>327<td><code><pre> }</pre></code><tr><td>328<td><code><pre> closeChan(chFails)</pre></code><tr><td>329<td><code><pre> closeChan(chDones)</pre></code><tr><td>330<td><code><pre> }()</pre></code><tr><td>331<td><code><pre></pre></code><tr class=miss><td>332<td><code><pre> for i, f := range fs {</pre></code><tr class=miss><td>333<td><code><pre> k := i</pre></code><tr class=miss><td>334<td><code><pre> f.OnSuccess(func(v any) {</pre></code><tr><td>335<td><code><pre> defer func() { _ = recover() }()</pre></code><tr><td>336<td><code><pre> chDones <- anyPromiseResult{result: v, i: k}</pre></code><tr><td>337<td><code><pre> }).OnFailure(func(v any) {</pre></code><tr><td>338<td><code><pre> defer func() { _ = recover() }()</pre></code><tr><td>339<td><code><pre> chFails <- anyPromiseResult{result: v, i: k}</pre></code><tr><td>340<td><code><pre> }).OnCancel(func() {</pre></code><tr><td>341<td><code><pre> defer func() { _ = recover() }()</pre></code><tr><td>342<td><code><pre> chFails <- anyPromiseResult{result: ErrCancelled, i: k}</pre></code><tr><td>343<td><code><pre> })</pre></code><tr><td>344<td><code><pre> }</pre></code><tr><td>345<td><code><pre> }</pre></code></table><div class=funcname id=fn_@496:17>func @496:17</div><div class=info><a href=#s_fn_@496:17>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>496<td><code><pre>func() {</pre></code><tr class=miss><td>497<td><code><pre> if atomic.CompareAndSwapInt32(&isCancelled, 0, 1) {</pre></code><tr><td>498<td><code><pre> // try to cancel all futures</pre></code><tr class=miss><td>499<td><code><pre> cancelOthers(j)</pre></code><tr><td>500<td><code><pre></pre></code><tr class=miss><td>501<td><code><pre> _ = wf.Cancel()</pre></code><tr><td>502<td><code><pre> }</pre></code><tr><td>503<td><code><pre> }</pre></code></table><div class=funcname id=fn_@105:9>func @105:9</div><div class=info><a href=#s_fn_@105:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>105<td><code><pre>func() {</pre></code><tr class=miss><td>106<td><code><pre> if e := recover(); e != nil {</pre></code><tr class=miss><td>107<td><code><pre> err := newErrorWithStacks(e)</pre></code><tr class=miss><td>108<td><code><pre> fmt.Println("error happens:\n ", err)</pre></code><tr><td>109<td><code><pre> }</pre></code><tr><td>110<td><code><pre> }</pre></code></table><div class=funcname id=fn_@171:9>func @171:9</div><div class=info><a href=#s_fn_@171:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>171<td><code><pre>func() {</pre></code><tr class=miss><td>172<td><code><pre> release(opt.appName, nil, ignoreRecycled())</pre></code><tr class=miss><td>173<td><code><pre> if opt.wg != nil {</pre></code><tr class=miss><td>174<td><code><pre> opt.wg.Done()</pre></code><tr><td>175<td><code><pre> }</pre></code><tr><td>176<td><code><pre> }</pre></code></table><div class=funcname id=fn_pipe.getPipe>func pipe.getPipe</div><div class=info><a href=#s_fn_pipe.getPipe>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>28<td><code><pre>func (p *pipe) getPipe(isResolved bool) (func(v any) *Future, *promise) {</pre></code><tr class=miss><td>29<td><code><pre> if isResolved {</pre></code><tr class=miss><td>30<td><code><pre> return p.pipeDoneTask, p.pipePromise</pre></code><tr><td>31<td><code><pre> } else {</pre></code><tr class=miss><td>32<td><code><pre> return p.pipeFailTask, p.pipePromise</pre></code><tr><td>33<td><code><pre> }</pre></code><tr><td>34<td><code><pre>}</pre></code></table><div class=funcname id=fn_startPipe>func startPipe</div><div class=info><a href=#s_fn_startPipe>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>179<td><code><pre>func startPipe(r *Result, pipeTask func(v any) *Future, pipePromise *promise) {</pre></code><tr class=miss><td>180<td><code><pre> if pipeTask != nil {</pre></code><tr class=miss><td>181<td><code><pre> f := pipeTask(r.Result)</pre></code><tr class=miss><td>182<td><code><pre> f.OnSuccess(func(v any) {</pre></code><tr><td>183<td><code><pre> _ = pipePromise.Resolve(v)</pre></code><tr><td>184<td><code><pre> }).OnFailure(func(v any) {</pre></code><tr><td>185<td><code><pre> _ = pipePromise.Reject(getError(v))</pre></code><tr><td>186<td><code><pre> })</pre></code><tr><td>187<td><code><pre> }</pre></code><tr><td>188<td><code><pre>}</pre></code></table><div class=funcname id=fn_@211:11>func @211:11</div><div class=info><a href=#s_fn_@211:11>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>211<td><code><pre>func() {</pre></code><tr class=miss><td>212<td><code><pre> if e := recover(); e != nil {</pre></code><tr class=miss><td>213<td><code><pre> err := newErrorWithStacks(e)</pre></code><tr class=miss><td>214<td><code><pre> fmt.Println("error happens:\n ", err)</pre></code><tr><td>215<td><code><pre> }</pre></code><tr><td>216<td><code><pre> }</pre></code></table><div class=funcname id=fn_@343:12>func @343:12</div><div class=info><a href=#s_fn_@343:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>343<td><code><pre>func() {</pre></code><tr class=miss><td>344<td><code><pre> if e := recover(); e != nil {</pre></code><tr class=miss><td>345<td><code><pre> err := newErrorWithStacks(e)</pre></code><tr class=miss><td>346<td><code><pre> fmt.Println("error happens:\n ", err)</pre></code><tr><td>347<td><code><pre> }</pre></code><tr><td>348<td><code><pre> }</pre></code></table><div class=funcname id=fn_@462:19>func @462:19</div><div class=info><a href=#s_fn_@462:19>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>462<td><code><pre>func(j int) {</pre></code><tr class=miss><td>463<td><code><pre> for k, f1 := range fs {</pre></code><tr class=miss><td>464<td><code><pre> if k != j {</pre></code><tr class=miss><td>465<td><code><pre> _ = f1.Cancel()</pre></code><tr><td>466<td><code><pre> }</pre></code><tr><td>467<td><code><pre> }</pre></code><tr><td>468<td><code><pre> }</pre></code></table><div class=funcname id=fn_writeStrings>func writeStrings</div><div class=info><a href=#s_fn_writeStrings>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>173<td><code><pre>func writeStrings(buf *bytes.Buffer, strings []string) {</pre></code><tr class=miss><td>174<td><code><pre> for _, s := range strings {</pre></code><tr class=miss><td>175<td><code><pre> _, _ = buf.WriteString(s)</pre></code><tr><td>176<td><code><pre> }</pre></code><tr><td>177<td><code><pre>}</pre></code></table><div class=funcname id=fn_@208:13>func @208:13</div><div class=info><a href=#s_fn_@208:13>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>208<td><code><pre>func(v any) {</pre></code><tr class=miss><td>209<td><code><pre> if opt.ch == nil {</pre></code><tr class=miss><td>210<td><code><pre> log.Printf("[Gofusion] %s catches an error in routine.Loop function: \n"+</pre></code><tr><td>211<td><code><pre> "error: %s\nfunc: %s\nfunc signature: %T",</pre></code><tr><td>212<td><code><pre> config.ComponentGoroutinePool, v, utils.GetFuncName(fn), fn)</pre></code><tr><td>213<td><code><pre> }</pre></code><tr><td>214<td><code><pre> }</pre></code></table><div class=funcname id=fn_promise.OnSuccess>func promise.OnSuccess</div><div class=info><a href=#s_fn_promise.OnSuccess>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/promise.go</code>:</div><table class=listing><tr><td>69<td><code><pre>func (p *promise) OnSuccess(callback func(v any)) *promise {</pre></code><tr class=miss><td>70<td><code><pre> p.Future.OnSuccess(callback)</pre></code><tr class=miss><td>71<td><code><pre> return p</pre></code><tr><td>72<td><code><pre>}</pre></code></table><div class=funcname id=fn_@318:15>func @318:15</div><div class=info><a href=#s_fn_@318:15>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>318<td><code><pre>func(c chan anyPromiseResult) {</pre></code><tr class=miss><td>319<td><code><pre> defer func() { _ = recover() }()</pre></code><tr class=miss><td>320<td><code><pre> close(c)</pre></code><tr><td>321<td><code><pre> }</pre></code></table><div class=funcname id=fn_@187:15>func @187:15</div><div class=info><a href=#s_fn_@187:15>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>187<td><code><pre>func(v any) {</pre></code><tr class=miss><td>188<td><code><pre> if opt.ch != nil {</pre></code><tr class=miss><td>189<td><code><pre> opt.ch <- v</pre></code><tr><td>190<td><code><pre> }</pre></code><tr><td>191<td><code><pre> }</pre></code></table><div class=funcname id=fn_@231:18>func @231:18</div><div class=info><a href=#s_fn_@231:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>231<td><code><pre>func() (r any, err error) {</pre></code><tr class=miss><td>232<td><code><pre> r, err = c(v)</pre></code><tr class=miss><td>233<td><code><pre> return</pre></code><tr><td>234<td><code><pre> }</pre></code></table><div class=funcname id=fn_@180:14>func @180:14</div><div class=info><a href=#s_fn_@180:14>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>180<td><code><pre>func(v any) {</pre></code><tr class=miss><td>181<td><code><pre> if opt.ch == nil {</pre></code><tr class=miss><td>182<td><code><pre> log.Printf("[Gofusion] %s catches an error in routine.Loopc function: \n"+</pre></code><tr><td>183<td><code><pre> "error: %s\nfunc: %s\nfunc signature: %T",</pre></code><tr><td>184<td><code><pre> config.ComponentGoroutinePool, v, utils.GetFuncName(task), task)</pre></code><tr><td>185<td><code><pre> }</pre></code><tr><td>186<td><code><pre> }</pre></code></table><div class=funcname id=fn_pool.ReleaseTimeout>func pool.ReleaseTimeout</div><div class=info><a href=#s_fn_pool.ReleaseTimeout>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>52<td><code><pre>func (p *pool) ReleaseTimeout(timeout time.Duration, opts ...utils.OptionExtender) error {</pre></code><tr class=miss><td>53<td><code><pre> defer release(p.appName, p, opts...)</pre></code><tr class=miss><td>54<td><code><pre> return p.pool.ReleaseTimeout(timeout)</pre></code><tr><td>55<td><code><pre>}</pre></code></table><div class=funcname id=fn_promise.OnFailure>func promise.OnFailure</div><div class=info><a href=#s_fn_promise.OnFailure>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/promise.go</code>:</div><table class=listing><tr><td>77<td><code><pre>func (p *promise) OnFailure(callback func(v any)) *promise {</pre></code><tr class=miss><td>78<td><code><pre> p.Future.OnFailure(callback)</pre></code><tr class=miss><td>79<td><code><pre> return p</pre></code><tr><td>80<td><code><pre>}</pre></code></table><div class=funcname id=fn_@244:18>func @244:18</div><div class=info><a href=#s_fn_@244:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>244<td><code><pre>func() (r any, err error) {</pre></code><tr class=miss><td>245<td><code><pre> r, err = c()</pre></code><tr class=miss><td>246<td><code><pre> return</pre></code><tr><td>247<td><code><pre> }</pre></code></table><div class=funcname id=fn_@104:10>func @104:10</div><div class=info><a href=#s_fn_@104:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr class=miss><td>104<td><code><pre>func(canceller Canceller, a ...any) (any, error) { v(canceller); return nil, nil }</pre></code></table><div class=funcname id=fn_@107:10>func @107:10</div><div class=info><a href=#s_fn_@107:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr class=miss><td>107<td><code><pre>func(canceller Canceller, a ...any) (any, error) { e := v(canceller); return nil, e }</pre></code></table><div class=funcname id=fn_promise.OnComplete>func promise.OnComplete</div><div class=info><a href=#s_fn_promise.OnComplete>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/promise.go</code>:</div><table class=listing><tr><td>87<td><code><pre>func (p *promise) OnComplete(callback func(v any)) *promise {</pre></code><tr class=miss><td>88<td><code><pre> p.Future.OnComplete(callback)</pre></code><tr class=miss><td>89<td><code><pre> return p</pre></code><tr><td>90<td><code><pre>}</pre></code></table><div class=funcname id=fn_@337:17>func @337:17</div><div class=info><a href=#s_fn_@337:17>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>337<td><code><pre>func(v any) {</pre></code><tr class=miss><td>338<td><code><pre> defer func() { _ = recover() }()</pre></code><tr class=miss><td>339<td><code><pre> chFails <- anyPromiseResult{result: v, i: k}</pre></code><tr><td>340<td><code><pre> }</pre></code></table><div class=funcname id=fn_promise.OnCancel>func promise.OnCancel</div><div class=info><a href=#s_fn_promise.OnCancel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/promise.go</code>:</div><table class=listing><tr><td>94<td><code><pre>func (p *promise) OnCancel(callback func()) *promise {</pre></code><tr class=miss><td>95<td><code><pre> p.Future.OnCancel(callback)</pre></code><tr class=miss><td>96<td><code><pre> return p</pre></code><tr><td>97<td><code><pre>}</pre></code></table><div class=funcname id=fn_@170:10>func @170:10</div><div class=info><a href=#s_fn_@170:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>170<td><code><pre>func() {</pre></code><tr class=miss><td>171<td><code><pre> defer func() {</pre></code><tr><td>172<td><code><pre> release(opt.appName, nil, ignoreRecycled())</pre></code><tr><td>173<td><code><pre> if opt.wg != nil {</pre></code><tr><td>174<td><code><pre> opt.wg.Done()</pre></code><tr><td>175<td><code><pre> }</pre></code><tr><td>176<td><code><pre> }()</pre></code><tr class=miss><td>177<td><code><pre> select {</pre></code><tr><td>178<td><code><pre> case <-ctx.Done():</pre></code><tr><td>179<td><code><pre> case <-wrapPromise(task, false, opts...).</pre></code><tr><td>180<td><code><pre> OnFailure(func(v any) {</pre></code><tr><td>181<td><code><pre> if opt.ch == nil {</pre></code><tr><td>182<td><code><pre> log.Printf("[Gofusion] %s catches an error in routine.Loopc function: \n"+</pre></code><tr><td>183<td><code><pre> "error: %s\nfunc: %s\nfunc signature: %T",</pre></code><tr><td>184<td><code><pre> config.ComponentGoroutinePool, v, utils.GetFuncName(task), task)</pre></code><tr><td>185<td><code><pre> }</pre></code><tr><td>186<td><code><pre> }).</pre></code><tr><td>187<td><code><pre> OnComplete(func(v any) {</pre></code><tr><td>188<td><code><pre> if opt.ch != nil {</pre></code><tr><td>189<td><code><pre> opt.ch <- v</pre></code><tr><td>190<td><code><pre> }</pre></code><tr><td>191<td><code><pre> }).</pre></code><tr><td>192<td><code><pre> GetChan():</pre></code><tr><td>193<td><code><pre> }</pre></code><tr><td>194<td><code><pre> }</pre></code></table><div class=funcname id=fn_@150:14>func @150:14</div><div class=info><a href=#s_fn_@150:14>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>150<td><code><pre>func(v any) {</pre></code><tr class=miss><td>151<td><code><pre> if opt.ch == nil {</pre></code><tr class=miss><td>152<td><code><pre> log.Printf("[Gofusion] %s catches an error in routine.Loop function: \n"+</pre></code><tr><td>153<td><code><pre> "error: %s\nfunc: %s\nfunc signature: %T",</pre></code><tr><td>154<td><code><pre> config.ComponentGoroutinePool, v, utils.GetFuncName(task), task)</pre></code><tr><td>155<td><code><pre> }</pre></code><tr><td>156<td><code><pre> }</pre></code></table><div class=funcname id=fn_@210:4>func @210:4</div><div class=info><a href=#s_fn_@210:4>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>210<td><code><pre>func() {</pre></code><tr class=miss><td>211<td><code><pre> defer func() {</pre></code><tr><td>212<td><code><pre> if e := recover(); e != nil {</pre></code><tr><td>213<td><code><pre> err := newErrorWithStacks(e)</pre></code><tr><td>214<td><code><pre> fmt.Println("error happens:\n ", err)</pre></code><tr><td>215<td><code><pre> }</pre></code><tr><td>216<td><code><pre> }()</pre></code><tr class=miss><td>217<td><code><pre> f()</pre></code><tr><td>218<td><code><pre> }</pre></code></table><div class=funcname id=fn_@334:16>func @334:16</div><div class=info><a href=#s_fn_@334:16>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>334<td><code><pre>func(v any) {</pre></code><tr class=miss><td>335<td><code><pre> defer func() { _ = recover() }()</pre></code><tr class=miss><td>336<td><code><pre> chDones <- anyPromiseResult{result: v, i: k}</pre></code><tr><td>337<td><code><pre> }</pre></code></table><div class=funcname id=fn_@340:16>func @340:16</div><div class=info><a href=#s_fn_@340:16>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>340<td><code><pre>func() {</pre></code><tr class=miss><td>341<td><code><pre> defer func() { _ = recover() }()</pre></code><tr class=miss><td>342<td><code><pre> chFails <- anyPromiseResult{result: ErrCancelled, i: k}</pre></code><tr><td>343<td><code><pre> }</pre></code></table><div class=funcname id=fn_@237:12>func @237:12</div><div class=info><a href=#s_fn_@237:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>237<td><code><pre>func(v any) *Future {</pre></code><tr class=miss><td>238<td><code><pre> return start(func() {</pre></code><tr><td>239<td><code><pre> c()</pre></code><tr><td>240<td><code><pre> }, true)</pre></code><tr><td>241<td><code><pre> }</pre></code></table><div class=funcname id=fn_@338:11>func @338:11</div><div class=info><a href=#s_fn_@338:11>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr class=miss><td>338<td><code><pre>func() { _ = recover() }</pre></code></table><div class=funcname id=fn_@335:11>func @335:11</div><div class=info><a href=#s_fn_@335:11>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr class=miss><td>335<td><code><pre>func() { _ = recover() }</pre></code></table><div class=funcname id=fn_@341:11>func @341:11</div><div class=info><a href=#s_fn_@341:11>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr class=miss><td>341<td><code><pre>func() { _ = recover() }</pre></code></table><div class=funcname id=fn_pool.Running>func pool.Running</div><div class=info><a href=#s_fn_pool.Running>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr class=miss><td>43<td><code><pre>func (p *pool) Running() int { return p.pool.Running() }</pre></code></table><div class=funcname id=fn_pool.Free>func pool.Free</div><div class=info><a href=#s_fn_pool.Free>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr class=miss><td>44<td><code><pre>func (p *pool) Free() int { return p.pool.Free() }</pre></code></table><div class=funcname id=fn_pool.Waiting>func pool.Waiting</div><div class=info><a href=#s_fn_pool.Waiting>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr class=miss><td>45<td><code><pre>func (p *pool) Waiting() int { return p.pool.Waiting() }</pre></code></table><div class=funcname id=fn_pool.Cap>func pool.Cap</div><div class=info><a href=#s_fn_pool.Cap>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr class=miss><td>46<td><code><pre>func (p *pool) Cap() int { return p.pool.Cap() }</pre></code></table><div class=funcname id=fn_pool.IsClosed>func pool.IsClosed</div><div class=info><a href=#s_fn_pool.IsClosed>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr class=miss><td>47<td><code><pre>func (p *pool) IsClosed() bool { return p.pool.IsClosed() }</pre></code></table><div class=funcname id=fn_@243:12>func @243:12</div><div class=info><a href=#s_fn_@243:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>243<td><code><pre>func(v any) *Future {</pre></code><tr class=miss><td>244<td><code><pre> return start(func() (r any, err error) {</pre></code><tr><td>245<td><code><pre> r, err = c()</pre></code><tr><td>246<td><code><pre> return</pre></code><tr><td>247<td><code><pre> }, true)</pre></code><tr><td>248<td><code><pre> }</pre></code></table><div class=funcname id=fn_@238:18>func @238:18</div><div class=info><a href=#s_fn_@238:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>238<td><code><pre>func() {</pre></code><tr class=miss><td>239<td><code><pre> c()</pre></code><tr><td>240<td><code><pre> }</pre></code></table><div class=funcname id=fn_@230:12>func @230:12</div><div class=info><a href=#s_fn_@230:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>230<td><code><pre>func(v any) *Future {</pre></code><tr class=miss><td>231<td><code><pre> return start(func() (r any, err error) {</pre></code><tr><td>232<td><code><pre> r, err = c(v)</pre></code><tr><td>233<td><code><pre> return</pre></code><tr><td>234<td><code><pre> }, true)</pre></code><tr><td>235<td><code><pre> }</pre></code></table><div class=funcname id=fn_@319:9>func @319:9</div><div class=info><a href=#s_fn_@319:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr class=miss><td>319<td><code><pre>func() { _ = recover() }</pre></code></table><div class=funcname id=fn_@225:18>func @225:18</div><div class=info><a href=#s_fn_@225:18>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>225<td><code><pre>func() {</pre></code><tr class=miss><td>226<td><code><pre> c(v)</pre></code><tr><td>227<td><code><pre> }</pre></code></table><div class=funcname id=fn_ignoreMutex>func ignoreMutex</div><div class=info><a href=#s_fn_ignoreMutex>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>101<td><code><pre>func ignoreMutex() utils.OptionFunc[internalOption] {</pre></code><tr class=miss><td>102<td><code><pre> return func(o *internalOption) {</pre></code><tr><td>103<td><code><pre> o.ignoreMutex = true</pre></code><tr><td>104<td><code><pre> }</pre></code><tr><td>105<td><code><pre>}</pre></code></table><div class=funcname id=fn_@102:9>func @102:9</div><div class=info><a href=#s_fn_@102:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>102<td><code><pre>func(o *internalOption) {</pre></code><tr class=miss><td>103<td><code><pre> o.ignoreMutex = true</pre></code><tr><td>104<td><code><pre> }</pre></code></table><div class=funcname id=fn_@296:15>func @296:15</div><div class=info><a href=#s_fn_@296:15>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr class=miss><td>296<td><code><pre>func(v any) bool { return true }</pre></code></table><div class=funcname id=fn_newAggregateError1>func newAggregateError1</div><div class=info><a href=#s_fn_newAggregateError1>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>67<td><code><pre>func newAggregateError1(s string, e any) *AggregateError {</pre></code><tr class=miss><td>68<td><code><pre> return &AggregateError{newErrorWithStacks(s).Error(), []error{getError(e)}}</pre></code><tr><td>69<td><code><pre>}</pre></code></table><div class=funcname id=fn_WhenAny>func WhenAny</div><div class=info><a href=#s_fn_WhenAny>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy.go</code>:</div><table class=listing><tr><td>280<td><code><pre>func WhenAny(acts ...any) *Future {</pre></code><tr class=miss><td>281<td><code><pre> return WhenAnyMatched(nil, acts...)</pre></code><tr><td>282<td><code><pre>}</pre></code></table><div class=funcname id=fn_@224:12>func @224:12</div><div class=info><a href=#s_fn_@224:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>224<td><code><pre>func(v any) *Future {</pre></code><tr class=miss><td>225<td><code><pre> return start(func() {</pre></code><tr><td>226<td><code><pre> c(v)</pre></code><tr><td>227<td><code><pre> }, true)</pre></code><tr><td>228<td><code><pre> }</pre></code></table><div class=funcname id=fn_Timeout>func Timeout</div><div class=info><a href=#s_fn_Timeout>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>220<td><code><pre>func Timeout(t time.Duration) utils.OptionFunc[NewPoolOption] {</pre></code><tr class=miss><td>221<td><code><pre> return func(o *NewPoolOption) {</pre></code><tr><td>222<td><code><pre> o.ApplyTimeout = t</pre></code><tr><td>223<td><code><pre> }</pre></code><tr><td>224<td><code><pre>}</pre></code></table><div class=funcname id=fn_@221:9>func @221:9</div><div class=info><a href=#s_fn_@221:9>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>221<td><code><pre>func(o *NewPoolOption) {</pre></code><tr class=miss><td>222<td><code><pre> o.ApplyTimeout = t</pre></code><tr><td>223<td><code><pre> }</pre></code></table><div class=funcname id=fn_@220:12>func @220:12</div><div class=info><a href=#s_fn_@220:12>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>220<td><code><pre>func(v any) *Future {</pre></code><tr class=miss><td>221<td><code><pre> return c()</pre></code><tr><td>222<td><code><pre> }</pre></code></table><div class=funcname id=fn_NoMatchedError.Error>func NoMatchedError.Error</div><div class=info><a href=#s_fn_NoMatchedError.Error>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>19<td><code><pre>func (e *NoMatchedError) Error() string {</pre></code><tr class=miss><td>20<td><code><pre> return "No matched future"</pre></code><tr><td>21<td><code><pre>}</pre></code></table><div class=funcname id=fn_Options>func Options</div><div class=info><a href=#s_fn_Options>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/pool.go</code>:</div><table class=listing><tr><td>232<td><code><pre>func Options(in *NewPoolOption) utils.OptionFunc[NewPoolOption] {</pre></code><tr class=miss><td>233<td><code><pre> return func(o *NewPoolOption) {</pre></code><tr><td>234<td><code><pre> o.ApplyTimeout = in.ApplyTimeout</pre></code><tr><td>235<td><code><pre> o.ExpiryDuration = in.PoolOption.ExpiryDuration</pre></code><tr><td>236<td><code><pre> o.PreAlloc = in.PreAlloc</pre></code><tr><td>237<td><code><pre> o.MaxBlockingTasks = in.MaxBlockingTasks</pre></code><tr><td>238<td><code><pre> o.Nonblocking = in.Nonblocking</pre></code><tr><td>239<td><code><pre> o.PanicHandler = in.PanicHandler</pre></code><tr><td>240<td><code><pre> o.Logger = in.Logger</pre></code><tr><td>241<td><code><pre> o.DisablePurge = in.DisablePurge</pre></code><tr><td>242<td><code><pre> }</pre></code><tr><td>243<td><code><pre>}</pre></code></table><div class=funcname id=fn_newNoMatchedError>func newNoMatchedError</div><div class=info><a href=#s_fn_newNoMatchedError>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>32<td><code><pre>func newNoMatchedError(results []any) *NoMatchedError {</pre></code><tr class=miss><td>33<td><code><pre> return &NoMatchedError{results}</pre></code><tr><td>34<td><code><pre>}</pre></code></table><div class=funcname id=fn_CancelledError.Error>func CancelledError.Error</div><div class=info><a href=#s_fn_CancelledError.Error>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/promise.go</code>:</div><table class=listing><tr><td>16<td><code><pre>func (e *CancelledError) Error() string {</pre></code><tr class=miss><td>17<td><code><pre> return "Task be cancelled"</pre></code><tr><td>18<td><code><pre>}</pre></code></table><div class=funcname id=fn_newNoMatchedError1>func newNoMatchedError1</div><div class=info><a href=#s_fn_newNoMatchedError1>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>36<td><code><pre>func newNoMatchedError1(e any) *NoMatchedError {</pre></code><tr class=miss><td>37<td><code><pre> return &NoMatchedError{[]any{e}}</pre></code><tr><td>38<td><code><pre>}</pre></code></table><div class=funcname id=fn_Future.Cancel>func Future.Cancel</div><div class=info><a href=#s_fn_Future.Cancel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>165<td><code><pre>func (f *Future) Cancel() (e error) {</pre></code><tr class=miss><td>166<td><code><pre> return f.setResult(&Result{ErrCancelled, ResultCancelled})</pre></code><tr><td>167<td><code><pre>}</pre></code></table><div class=funcname id=fn_canceller.IsCancelled>func canceller.IsCancelled</div><div class=info><a href=#s_fn_canceller.IsCancelled>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>56<td><code><pre>func (c *canceller) IsCancelled() (r bool) {</pre></code><tr class=miss><td>57<td><code><pre> return c.f.IsCancelled()</pre></code><tr><td>58<td><code><pre>}</pre></code></table><div class=funcname id=fn_@126:14>func @126:14</div><div class=info><a href=#s_fn_@126:14>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>126<td><code><pre>func() {</pre></code><tr class=miss><td>127<td><code><pre> c <- f.loadResult()</pre></code><tr><td>128<td><code><pre> }</pre></code></table><div class=funcname id=fn_@101:10>func @101:10</div><div class=info><a href=#s_fn_@101:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr class=miss><td>101<td><code><pre>func(a ...any) (any, error) { return v() }</pre></code></table><div class=funcname id=fn_Future.Canceller>func Future.Canceller</div><div class=info><a href=#s_fn_Future.Canceller>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>82<td><code><pre>func (f *Future) Canceller() Canceller {</pre></code><tr class=miss><td>83<td><code><pre> return &canceller{f}</pre></code><tr><td>84<td><code><pre>}</pre></code></table><div class=funcname id=fn_canceller.Cancel>func canceller.Cancel</div><div class=info><a href=#s_fn_canceller.Cancel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/future.go</code>:</div><table class=listing><tr><td>51<td><code><pre>func (c *canceller) Cancel() {</pre></code><tr class=miss><td>52<td><code><pre> _ = c.f.Cancel()</pre></code><tr><td>53<td><code><pre>}</pre></code></table><div class=funcname id=fn_@110:10>func @110:10</div><div class=info><a href=#s_fn_@110:10>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr class=miss><td>110<td><code><pre>func(canceller Canceller, a ...any) (any, error) { return v(canceller) }</pre></code></table><div class=funcname id=fn_@182:15>func @182:15</div><div class=info><a href=#s_fn_@182:15>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>182<td><code><pre>func(v any) {</pre></code><tr class=miss><td>183<td><code><pre> _ = pipePromise.Resolve(v)</pre></code><tr><td>184<td><code><pre> }</pre></code></table><div class=funcname id=fn_@184:16>func @184:16</div><div class=info><a href=#s_fn_@184:16>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/candy_utils.go</code>:</div><table class=listing><tr><td>184<td><code><pre>func(v any) {</pre></code><tr class=miss><td>185<td><code><pre> _ = pipePromise.Reject(getError(v))</pre></code><tr><td>186<td><code><pre> }</pre></code></table><div class=funcname id=fn_promise.Cancel>func promise.Cancel</div><div class=info><a href=#s_fn_promise.Cancel>Back</a><p>In <code>/Users/windawings/gopath/src/github.com/wfusion/gofusion/routine/promise.go</code>:</div><table class=listing><tr><td>50<td><code><pre>func (p *promise) Cancel() (e error) {</pre></code><tr class=miss><td>51<td><code><pre> return p.Future.Cancel()</pre></code><tr><td>52<td><code><pre>}</pre></code></table><div id=summaryWrapper><div class=package>Report Total</div><div id=totalcov>60.1%</div></div>