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

将int转换为int32

I am working on pulling in rows from the Db and storing the results in a Slice/Array

I need to calculate the totalRecords & totalPages.

pseudoCode :: 
perPage int32 := ( some number ) 
totalRecords := len(array)
totalPages := perPage/totalRecords

I keep getting this error.

terminal::
`invalid operation: perPage / totalRecords (mismatched types int32 and int)`

len(array) returns an int convert it to an int32 int32(len(array)) or convert perPage to an int

近期文章

  • 去语言网站框架设计线程明智
  • 从另一个函数追加到数组?
  • 追加切片循环
  • 为什么变量为零,尽管我在那里引用了对象
  • Golang中的模拟功能以进行测试
  • 单值上下文(net / url)中的多值url.Parse()
  • 使用URL下载zip文件[关闭]
  • 如何将Golang中的[] []字节发送到浏览器以将其解码为图像
  • 如何访问http客户端响应正文全局[关闭]
  • 我可以为每个要调用的函数获取函数ID并与之通信吗?
  • 向我解释执行时间的差异
  • 在什么情况下crypto / rand read()的两个返回值会有用?
  • 如何从pkcs12商店加载x509密钥对?
  • 使用未导入包中的类型的返回值
  • 如何在PostgreSQL数据库中创建东西
  • 使用切片在Go中实现简单队列
  • 我对发送者频道的影响有疑问
  • 如何在Go中检测单个字符串中的正则表达式的所有匹配项
  • 使用HTML模板:类似于Jinja2宏吗?
  • 转到:与goroutine混淆

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

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

友情链接:代码精华