Skip to content

Commit

Permalink
improve example for package gpage
Browse files Browse the repository at this point in the history
  • Loading branch information
gqcn committed Mar 21, 2020
1 parent e2c1e11 commit 41a9e91
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .example/other/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import (
"github.com/gogf/gf/text/gstr"
)

const (
TraceIdName = "trace-id"
)

func main() {

type Sender struct {
Expand Down
2 changes: 1 addition & 1 deletion .example/util/gpage/gpage.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func main() {
s := ghttp.GetServer()
s := g.Server()
s.BindHandler("/page/demo", func(r *ghttp.Request) {
page := r.GetPage(100, 10)
buffer, _ := gview.ParseContent(`
Expand Down
2 changes: 1 addition & 1 deletion .example/util/gpage/gpage_ajax.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func main() {
s := ghttp.GetServer()
s := g.Server()
s.BindHandler("/page/ajax", func(r *ghttp.Request) {
page := r.GetPage(100, 10)
page.AjaxActionName = "DoAjax"
Expand Down
4 changes: 2 additions & 2 deletions .example/util/gpage/gpage_custom1.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/gogf/gf/util/gpage"
)

// 分页标签使用li标签包裹
// wrapContent wraps each of the page tag with html li and ul.
func wrapContent(page *gpage.Page) string {
content := page.GetContent(4)
content = gstr.ReplaceByMap(content, map[string]string{
Expand All @@ -21,7 +21,7 @@ func wrapContent(page *gpage.Page) string {
}

func main() {
s := ghttp.GetServer()
s := g.Server()
s.BindHandler("/page/custom1/*page", func(r *ghttp.Request) {
page := r.GetPage(100, 10)
content := wrapContent(page)
Expand Down
4 changes: 2 additions & 2 deletions .example/util/gpage/gpage_custom2.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/gogf/gf/util/gpage"
)

// 自定义分页名称
// pageContent customizes the page tag name.
func pageContent(page *gpage.Page) string {
page.NextPageTag = "NextPage"
page.PrevPageTag = "PrevPage"
Expand All @@ -22,7 +22,7 @@ func pageContent(page *gpage.Page) string {
}

func main() {
s := ghttp.GetServer()
s := g.Server()
s.BindHandler("/page/custom2/*page", func(r *ghttp.Request) {
page := r.GetPage(100, 10)
buffer, _ := gview.ParseContent(`
Expand Down
1 change: 0 additions & 1 deletion encoding/gbase64/gbase64_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ package gbase64_test

import (
"github.com/gogf/gf/debug/gdebug"
"github.com/gogf/gf/os/gfile"
"testing"

"github.com/gogf/gf/encoding/gbase64"
Expand Down
2 changes: 1 addition & 1 deletion net/ghttp/ghttp_request_param_page.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (r *Request) GetPage(totalSize, pageSize int) *gpage.Page {
values := url.Query()
values.Set(gpage.PAGE_NAME, gpage.PAGE_PLACE_HOLDER)
url.RawQuery = values.Encode()
// Replace the encodes "{.page}" to "{.page}".
// Replace the encoded "{.page}" to original "{.page}".
url.RawQuery = gstr.Replace(url.RawQuery, "%7B.page%7D", "{.page}")
}
if url.RawQuery != "" {
Expand Down
1 change: 0 additions & 1 deletion net/ghttp/ghttp_unit_middleware_basic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"fmt"
"github.com/gogf/gf/container/garray"
"github.com/gogf/gf/debug/gdebug"
"github.com/gogf/gf/os/gfile"
"net/http"
"testing"
"time"
Expand Down
1 change: 0 additions & 1 deletion net/ghttp/ghttp_unit_template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (

"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/net/ghttp"
"github.com/gogf/gf/os/gfile"
"github.com/gogf/gf/test/gtest"
)

Expand Down
1 change: 0 additions & 1 deletion os/gview/gview_unit_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ package gview_test
import (
"github.com/gogf/gf/debug/gdebug"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/os/gfile"
"github.com/gogf/gf/os/gview"
"github.com/gogf/gf/test/gtest"
"testing"
Expand Down

0 comments on commit 41a9e91

Please sign in to comment.