我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

如何在视图中显示仅具有偶数索引的元素(使用Beego框架)?

So the problem is that I can not show even elements in my view file. I have the following code in my view file:

    {{range $i, $stream := .d}}
        {{if $i % 2 == 0}}
            {{$stream.Channel.Status}}
        {{end}}
    {{end}}

From the docs I've read that "You CANNOT use conditional expressions in if. Only boolean values are acceptable."

So how can I implement it?

Thanks in advance

近期文章

  • 带有字符串数据的POST golang请求
  • Golang和Martini代码块
  • 从Go程序内部调用源
  • 使用golang在mysql中创建数据库
  • 开始-即时修改JSON
  • 通过多个主机进行SSH
  • 使用封闭的网络连接
  • 如何将char *更改为Go等效项
  • GO UDP消息接收冻结
  • GoRelic-跟踪指标说明
  • SWIG + Go:动态符号不受支持的重定位
  • Golang,csv.writer。将20k行写入CSV将冻结我的PC
  • Go中的TCP连接
  • 如何在Go中接收具有多部分/表单数据边界的POSTed参数
  • Go中的闭包-声明以函数为参数的函数
  • godoc未找到匹配错误
  • Golang-MongoDB(mgo)检索插入的文件(BSON不是GridFS)
  • 如何在Windows 7上使用goconvey?
  • 连接到远程Golang服务器
  • docker命令行列表参数

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华