当前位置: 首页>>代码示例>>Golang>>正文


Golang Writer.N方法代码示例

本文整理汇总了Golang中github.com/valyala/quicktemplate.Writer.N方法的典型用法代码示例。如果您正苦于以下问题:Golang Writer.N方法的具体用法?Golang Writer.N怎么用?Golang Writer.N使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/valyala/quicktemplate.Writer的用法示例。


在下文中一共展示了Writer.N方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: StreamSimpleQtc

//line simple.qtpl:2
func StreamSimpleQtc(qw422016 *qt422016.Writer, u *model.User) {
	//line simple.qtpl:2
	qw422016.N().S(`
<html>
    <body>
        <h1>`)
	//line simple.qtpl:5
	qw422016.E().S(u.FirstName)
	//line simple.qtpl:5
	qw422016.N().S(`</h1>

        <p>Here's a list of your favorite colors:</p>
        <ul>
        `)
	//line simple.qtpl:9
	for _, colorName := range u.FavoriteColors {
		//line simple.qtpl:9
		qw422016.N().S(`
            <li>`)
		//line simple.qtpl:10
		qw422016.E().S(colorName)
		//line simple.qtpl:10
		qw422016.N().S(`</li>
        `)
		//line simple.qtpl:11
	}
	//line simple.qtpl:11
	qw422016.N().S(`
        </ul>
    </body>
</html>
`)
//line simple.qtpl:15
}
开发者ID:SlinSo,项目名称:goTemplateBenchmark,代码行数:35,代码来源:simple.qtpl.go

示例2: StreamNavigation

//line navigation.qtpl:2
func StreamNavigation(qw422016 *qt422016.Writer, nav []*model.Navigation) {
	//line navigation.qtpl:2
	qw422016.N().S(`
<ul class="navigation">
`)
	//line navigation.qtpl:4
	for _, item := range nav {
		//line navigation.qtpl:4
		qw422016.N().S(`
	<li><a href="`)
		//line navigation.qtpl:5
		qw422016.E().S(item.Link)
		//line navigation.qtpl:5
		qw422016.N().S(`">`)
		//line navigation.qtpl:5
		qw422016.E().S(item.Item)
		//line navigation.qtpl:5
		qw422016.N().S(`</a></li>
`)
		//line navigation.qtpl:6
	}
	//line navigation.qtpl:6
	qw422016.N().S(`
</ul>
`)
//line navigation.qtpl:8
}
开发者ID:SlinSo,项目名称:goTemplateBenchmark,代码行数:28,代码来源:navigation.qtpl.go

示例3: StreamFooter

//line footer.qtpl:1
func StreamFooter(qw422016 *qt422016.Writer) {
	//line footer.qtpl:1
	qw422016.N().S(`
<div class="footer">copyright 2016</div>
`)
//line footer.qtpl:3
}
开发者ID:SlinSo,项目名称:goTemplateBenchmark,代码行数:8,代码来源:footer.qtpl.go

示例4: StreamHeader

//line header.qtpl:1
func StreamHeader(qw422016 *qt422016.Writer, title string) {
	//line header.qtpl:1
	qw422016.N().S(`
<title>`)
	//line header.qtpl:2
	qw422016.E().S(title)
	//line header.qtpl:2
	qw422016.N().S(`'s Home Page</title>
<div class="header">Page Header</div>
`)
//line header.qtpl:4
}
开发者ID:SlinSo,项目名称:goTemplateBenchmark,代码行数:13,代码来源:header.qtpl.go

示例5: streambytesSeries

//line report/report.qtpl:222
func (p *Page) streambytesSeries(qw422016 *qt422016.Writer) {
	//line report/report.qtpl:222
	qw422016.N().S(`[{name: 'BytesWritten',data: [`)
	//line report/report.qtpl:225
	qw422016.N().S(float64SliceToString(rate(p.BytesWritten, p.Interval)))
	//line report/report.qtpl:225
	qw422016.N().S(`]},{name: 'BytesRead',data: [`)
	//line report/report.qtpl:228
	qw422016.N().S(float64SliceToString(rate(p.BytesRead, p.Interval)))
	//line report/report.qtpl:228
	qw422016.N().S(`]}]`)
//line report/report.qtpl:230
}
开发者ID:hagen1778,项目名称:fasthttploader,代码行数:14,代码来源:report.qtpl.go

示例6: StreamUpdateRequestDuration

//line report/report.qtpl:34
func (p *Page) StreamUpdateRequestDuration(qw422016 *qt422016.Writer, d map[float64]float64) {
	//line report/report.qtpl:34
	qw422016.N().S(`
	`)
	//line report/report.qtpl:36
	for k, v := range d {
		if _, ok := p.RequestDuration[k]; !ok {
			p.RequestDuration[k] = make([]float64, 0)
		}

		p.RequestDuration[k] = append(p.RequestDuration[k], v)
	}

	//line report/report.qtpl:43
	qw422016.N().S(`
`)
//line report/report.qtpl:44
}
开发者ID:hagen1778,项目名称:fasthttploader,代码行数:19,代码来源:report.qtpl.go

示例7: streamerrorSeries

//line report/report.qtpl:189
func (p *Page) streamerrorSeries(qw422016 *qt422016.Writer) {
	//line report/report.qtpl:189
	qw422016.N().S(`
	[{
		name: 'Errors',
		data: [`)
	//line report/report.qtpl:192
	qw422016.N().S(float64SliceToString(rate(p.Errors, p.Interval)))
	//line report/report.qtpl:192
	qw422016.N().S(`]
	},{
		name: 'Timeouts',
		data: [`)
	//line report/report.qtpl:195
	qw422016.N().S(float64SliceToString(rate(p.Timeouts, p.Interval)))
	//line report/report.qtpl:195
	qw422016.N().S(`]
	}]
`)
//line report/report.qtpl:197
}
开发者ID:hagen1778,项目名称:fasthttploader,代码行数:22,代码来源:report.qtpl.go

示例8: streamqpsSeries

//line report/report.qtpl:178
func (p *Page) streamqpsSeries(qw422016 *qt422016.Writer) {
	//line report/report.qtpl:178
	qw422016.N().S(`
	[{
		name: 'Load average',
		data: [`)
	//line report/report.qtpl:181
	qw422016.N().S(uint64SliceToString(p.Qps))
	//line report/report.qtpl:181
	qw422016.N().S(`]
	},
	{
		name: 'Req-per-second',
		data: [`)
	//line report/report.qtpl:185
	qw422016.N().S(float64SliceToString(rate(p.RequestSum, p.Interval)))
	//line report/report.qtpl:185
	qw422016.N().S(`]
	}]
`)
//line report/report.qtpl:187
}
开发者ID:hagen1778,项目名称:fasthttploader,代码行数:23,代码来源:report.qtpl.go

示例9: streamconnectionSeries

//line report/report.qtpl:171
func (p *Page) streamconnectionSeries(qw422016 *qt422016.Writer) {
	//line report/report.qtpl:171
	qw422016.N().S(`
	[{
		name: 'Connections',
		data: [`)
	//line report/report.qtpl:174
	qw422016.N().S(uint64SliceToString(p.Connections))
	//line report/report.qtpl:174
	qw422016.N().S(`]
	}]
`)
//line report/report.qtpl:176
}
开发者ID:hagen1778,项目名称:fasthttploader,代码行数:15,代码来源:report.qtpl.go

示例10: StreamIndex

//line index.qtpl:2
func StreamIndex(qw422016 *qt422016.Writer, u *model.User, nav []*model.Navigation, title string) {
	//line index.qtpl:2
	qw422016.N().S(`
<!DOCTYPE html>
<html>
<body>

<header>
`)
	//line index.qtpl:8
	StreamHeader(qw422016, title)
	//line index.qtpl:8
	qw422016.N().S(`
</header>

<nav>
`)
	//line index.qtpl:12
	StreamNavigation(qw422016, nav)
	//line index.qtpl:12
	qw422016.N().S(`
</nav>

<section>
<div class="content">
	<div class="welcome">
		<h4>Hello `)
	//line index.qtpl:18
	qw422016.E().S(u.FirstName)
	//line index.qtpl:18
	qw422016.N().S(`</h4>
		
		<div class="raw">`)
	//line index.qtpl:20
	qw422016.N().S(u.RawContent)
	//line index.qtpl:20
	qw422016.N().S(`</div>
		<div class="enc">`)
	//line index.qtpl:21
	qw422016.E().S(u.EscapedContent)
	//line index.qtpl:21
	qw422016.N().S(`</div>
	</div>

`)
	//line index.qtpl:24
	for i := 1; i <= 5; i++ {
		//line index.qtpl:24
		qw422016.N().S(`
		`)
		//line index.qtpl:25
		if i == 1 {
			//line index.qtpl:25
			qw422016.N().S(`
			<p>`)
			//line index.qtpl:26
			qw422016.E().S(u.FirstName)
			//line index.qtpl:26
			qw422016.N().S(` has `)
			//line index.qtpl:26
			qw422016.N().D(i)
			//line index.qtpl:26
			qw422016.N().S(` message</p>
		`)
			//line index.qtpl:27
		} else {
			//line index.qtpl:27
			qw422016.N().S(`
			<p>`)
			//line index.qtpl:28
			qw422016.E().S(u.FirstName)
			//line index.qtpl:28
			qw422016.N().S(` has `)
			//line index.qtpl:28
			qw422016.N().D(i)
			//line index.qtpl:28
			qw422016.N().S(` messages</p>
		`)
			//line index.qtpl:29
		}
		//line index.qtpl:29
		qw422016.N().S(`
`)
		//line index.qtpl:30
	}
	//line index.qtpl:30
	qw422016.N().S(`
</div>
</section>

<footer>
`)
	//line index.qtpl:35
	StreamFooter(qw422016)
	//line index.qtpl:35
	qw422016.N().S(`
</footer>

</body>
//.........这里部分代码省略.........
开发者ID:SlinSo,项目名称:goTemplateBenchmark,代码行数:101,代码来源:index.qtpl.go

示例11: StreamPrintPage

//line report/report.qtpl:46
func StreamPrintPage(qw422016 *qt422016.Writer, p *Page) {
	//line report/report.qtpl:46
	qw422016.N().S(`
<html>
	<head>
		<title>`)
	//line report/report.qtpl:49
	p.streamtitle(qw422016)
	//line report/report.qtpl:49
	qw422016.N().S(`</title>
		<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
		<script type="text/javascript" src="https://code.highcharts.com/highcharts.js"></script>
		<script type="text/javascript" src="https://code.highcharts.com/modules/exporting.js"></script>
		<script type="text/javascript">`)
	//line report/report.qtpl:53
	qw422016.N().Z(MustAsset("report/static/js/utils.js"))
	//line report/report.qtpl:53
	qw422016.N().S(`</script>
		<style>`)
	//line report/report.qtpl:54
	qw422016.N().Z(MustAsset("report/static/css/main.css"))
	//line report/report.qtpl:54
	qw422016.N().S(`</style>
	</head>
	 <body>
		`)
	//line report/report.qtpl:57
	p.streamsimpleChart(qw422016, "connections", p.connectionSeries)
	//line report/report.qtpl:57
	qw422016.N().S(`
		`)
	//line report/report.qtpl:58
	p.streamsimpleChart(qw422016, "qps", p.qpsSeries)
	//line report/report.qtpl:58
	qw422016.N().S(`
		`)
	//line report/report.qtpl:59
	p.streamsimpleChart(qw422016, "errors-vs-timeouts", p.errorSeries)
	//line report/report.qtpl:59
	qw422016.N().S(`
		`)
	//line report/report.qtpl:60
	p.streamsimpleChart(qw422016, "latency", p.durationSeries)
	//line report/report.qtpl:60
	qw422016.N().S(`
		`)
	//line report/report.qtpl:61
	p.streambytesChart(qw422016, "written-vs-read", p.bytesSeries)
	//line report/report.qtpl:61
	qw422016.N().S(`
		`)
	//line report/report.qtpl:62
	p.streampieChart(qw422016, "status-codes", p.statusCodesSeries)
	//line report/report.qtpl:62
	qw422016.N().S(`
		`)
	//line report/report.qtpl:63
	p.streamerrorMessagesTable(qw422016)
	//line report/report.qtpl:63
	qw422016.N().S(`
	</body>
</html>
`)
//line report/report.qtpl:66
}
开发者ID:hagen1778,项目名称:fasthttploader,代码行数:66,代码来源:report.qtpl.go

示例12: streamsimpleChart

//line report/report.qtpl:68
func (p *Page) streamsimpleChart(qw422016 *qt422016.Writer, title string, fn seriesFunc) {
	//line report/report.qtpl:68
	qw422016.N().S(`
	<script>
	$(function () {
    			$('#`)
	//line report/report.qtpl:71
	qw422016.N().S(title)
	//line report/report.qtpl:71
	qw422016.N().S(`').highcharts({
					title: {
						text: '`)
	//line report/report.qtpl:73
	qw422016.N().S(strings.Title(title))
	//line report/report.qtpl:73
	qw422016.N().S(`',
						x: -20 //center
					},
					xAxis: {
						type: 'linear',
					},
					legend: {
						layout: 'vertical',
						align: 'right',
						verticalAlign: 'middle',
						borderWidth: 0
					},
					plotOptions: {
						series: {
							pointStart: 0,
							pointInterval: `)
	//line report/report.qtpl:88
	qw422016.N().FPrec(p.Interval, 2)
	//line report/report.qtpl:88
	qw422016.N().S(`,
						}
					},
					series: `)
	//line report/report.qtpl:91
	qw422016.N().S(fn())
	//line report/report.qtpl:91
	qw422016.N().S(`
				});
    		});
    </script>
   	<div id="`)
	//line report/report.qtpl:95
	qw422016.N().S(title)
	//line report/report.qtpl:95
	qw422016.N().S(`" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
`)
//line report/report.qtpl:96
}
开发者ID:hagen1778,项目名称:fasthttploader,代码行数:54,代码来源:report.qtpl.go

示例13: streambytesChart

//line report/report.qtpl:98
func (p *Page) streambytesChart(qw422016 *qt422016.Writer, title string, fn seriesFunc) {
	//line report/report.qtpl:98
	qw422016.N().S(`
	<script>
	$(function () {
    			$('#`)
	//line report/report.qtpl:101
	qw422016.N().S(title)
	//line report/report.qtpl:101
	qw422016.N().S(`').highcharts({
					title: {
						text: '`)
	//line report/report.qtpl:103
	qw422016.N().S(strings.Title(title))
	//line report/report.qtpl:103
	qw422016.N().S(`',
						x: -20 //center
					},
					xAxis: {
						type: 'linear',
					},
					yAxis: {
						labels: {
							formatter: function() { return bytes(this.value, true); }
						},
						min: 0,
					},
					tooltip: {
						enabled: true,
						formatter: function() { return bytes(this.y, true);}
					},
					legend: {
						layout: 'vertical',
						align: 'right',
						verticalAlign: 'middle',
						borderWidth: 0
					},
					plotOptions: {
						series: {
							pointStart: 0,
							pointInterval: `)
	//line report/report.qtpl:128
	qw422016.N().FPrec(p.Interval, 2)
	//line report/report.qtpl:128
	qw422016.N().S(`,
						}
					},
					series: `)
	//line report/report.qtpl:131
	qw422016.N().S(fn())
	//line report/report.qtpl:131
	qw422016.N().S(`
				});
    		});
    </script>
   	<div id="`)
	//line report/report.qtpl:135
	qw422016.N().S(title)
	//line report/report.qtpl:135
	qw422016.N().S(`" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
`)
//line report/report.qtpl:136
}
开发者ID:hagen1778,项目名称:fasthttploader,代码行数:64,代码来源:report.qtpl.go

示例14: streamerrorMessagesTable

//line report/report.qtpl:250
func (p *Page) streamerrorMessagesTable(qw422016 *qt422016.Writer) {
	//line report/report.qtpl:250
	qw422016.N().S(`
	<div style = "float: left; width:50%; height: 400px;">
	 <!-- IE < 10 does not like giving a tbody a height.  The workaround here applies the scrolling to a wrapped <div>. -->
	 <!--[if lte IE 9]>
	 <div class="old_ie_wrapper">
	 <!--<![endif]-->
	 <p class = "title">Error distribution</p>
	 <table class="fixed_headers">
		 <thead>
			<tr>
				<td>Count</td>
				<td>Message</td>
			</tr>
		 </thead>
		 <tbody>
			`)
	//line report/report.qtpl:265
	for k, v := range p.ErrorMessages {
		//line report/report.qtpl:265
		qw422016.N().S(`
				<tr>
					<td>`)
		//line report/report.qtpl:267
		qw422016.N().D(v)
		//line report/report.qtpl:267
		qw422016.N().S(`</td>
					<td>`)
		//line report/report.qtpl:268
		qw422016.N().S(k)
		//line report/report.qtpl:268
		qw422016.N().S(`</td>
				</tr>
			`)
		//line report/report.qtpl:270
	}
	//line report/report.qtpl:270
	qw422016.N().S(`
			`)
	//line report/report.qtpl:271
	if len(p.ErrorMessages) == 0 {
		//line report/report.qtpl:271
		qw422016.N().S(`
			<tr>
				<td></td>
				<td>No error messages</td>
			</tr>
            `)
		//line report/report.qtpl:276
	}
	//line report/report.qtpl:276
	qw422016.N().S(`
		 </tbody>
	 </table>
	 <!--[if lte IE 9]>
     </div>
     <!--<![endif]-->
     </div>
`)
//line report/report.qtpl:283
}
开发者ID:hagen1778,项目名称:fasthttploader,代码行数:63,代码来源:report.qtpl.go

示例15: streamstatusCodesSeries

//line report/report.qtpl:234
func (p *Page) streamstatusCodesSeries(qw422016 *qt422016.Writer) {
	//line report/report.qtpl:234
	qw422016.N().S(`[{name: 'Status codes',colorByPoint: true,data: [`)
	//line report/report.qtpl:239
	for k, v := range p.StatusCodes {
		//line report/report.qtpl:239
		qw422016.N().S(`{name: '`)
		//line report/report.qtpl:241
		qw422016.N().S(k)
		//line report/report.qtpl:241
		qw422016.N().S(`',y:`)
		//line report/report.qtpl:242
		qw422016.N().FPrec(v, 2)
		//line report/report.qtpl:242
		qw422016.N().S(`},`)
		//line report/report.qtpl:244
	}
	//line report/report.qtpl:244
	qw422016.N().S(`]}]`)
//line report/report.qtpl:247
}
开发者ID:hagen1778,项目名称:fasthttploader,代码行数:22,代码来源:report.qtpl.go


注:本文中的github.com/valyala/quicktemplate.Writer.N方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。