gobox中的分页操作

栏目: Go · 发布时间: 7年前

内容简介:今天来说下使用gobox中的分页操作分页也是我们开发时的一个常见需求,gobox中提供了page包做这个事情程序输出:

今天来说下使用gobox中的分页操作

说明

分页也是我们开发时的一个常见需求,gobox中提供了page包做这个事情

用法示例

package main

import (
	"github.com/goinbox/page"

	"fmt"
)

func main() {
	po, err := page.NewPageObj(2, 15, 2)
	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println("current pageObj is: ", po)

	fmt.Println("iterate: ")
	po.Rewind()
	fmt.Println(po)
	for po.Next() == nil {
		fmt.Println(po)
	}
}

程序输出:

current pageObj is:  &{2 15 8 2 2}
iterate: 
&{1 15 8 2 0}
&{2 15 8 2 2}
&{3 15 8 2 4}
&{4 15 8 2 6}
&{5 15 8 2 8}
&{6 15 8 2 10}
&{7 15 8 2 12}
&{8 15 8 1 14}

欢迎大家使用,使用中有遇到问题随时反馈,我们会尽快响应,谢谢!


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

How to Think About Algorithms

How to Think About Algorithms

Jeff Edmonds / Cambridge University Press / 2008-05-19 / USD 38.99

HOW TO THINK ABOUT ALGORITHMS There are many algorithm texts that provide lots of well-polished code and proofs of correctness. Instead, this one presents insights, notations, and analogies t......一起来看看 《How to Think About Algorithms》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

SHA 加密
SHA 加密

SHA 加密工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具