From b3411a95b24ee6b91fc7a93a9b76ce1610585b17 Mon Sep 17 00:00:00 2001 From: John Date: Fri, 29 Dec 2017 16:03:30 +0800 Subject: [PATCH] MIT --- g/container/gbtree/gbtree.go | 2 +- g/container/glist/safelist.go | 7 + g/container/gmap/int_bool_map.go | 6 + g/container/gmap/int_int_map.go | 6 + g/container/gmap/int_interface_map.go | 6 + g/container/gmap/int_string_map.go | 6 + g/container/gmap/interface_interface_map.go | 6 + g/container/gmap/string_bool_map.go | 6 + g/container/gmap/string_int_map.go | 6 + g/container/gmap/string_interface_map.go | 6 + g/container/gmap/string_string_map.go | 6 + g/container/gmap/uint_interface_map.go | 6 + g/container/gset/int64_set.go | 6 + g/container/gset/int_set.go | 7 + g/container/gset/interface_set.go | 6 + g/container/gset/string_set.go | 6 + g/database/gdb/gdb.go | 6 + g/database/gdb/gdb_base.go | 6 + g/database/gdb/gdb_config.go | 5 + g/database/gdb/gdb_linkop.go | 5 + g/database/gdb/gdb_mysql.go | 6 + g/database/gdb/gdb_pgsql.go | 6 + g/encoding/gbase64/gbase64.go | 6 + g/encoding/gbinary/gbinary.go | 6 + g/encoding/gcompress/gcompress.go | 6 + g/encoding/gcrc32/gcrc32.go | 6 + g/encoding/ghash/ghash.go | 6 + g/encoding/ghtml/ghtml.go | 6 + g/encoding/gjson/gjson.go | 6 + g/encoding/gjson/internal/gjson.go | 6 + g/encoding/gmd5/gmd5.go | 6 + g/encoding/gsha1/gsha1.go | 6 + g/encoding/gurl/url.go | 6 + g/frame/gconfig/gconfig.go | 6 + g/frame/ginstance/ginstance.go | 6 + g/frame/gmvc/controller.go | 6 + g/frame/gmvc/model.go | 6 + g/frame/gmvc/view.go | 6 + g/net/ghttp/http_client.go | 5 + g/net/ghttp/http_client_request.go | 5 + g/net/ghttp/http_client_response.go | 5 + g/net/ghttp/http_controller.go | 6 + g/net/ghttp/http_server.go | 6 + g/net/ghttp/http_server_config.go | 6 + g/net/ghttp/http_server_cookie.go | 6 + g/net/ghttp/http_server_domain.go | 6 + g/net/ghttp/http_server_handler.go | 6 + g/net/ghttp/http_server_response.go | 6 + g/net/gipv4/gipv4.go | 6 + g/net/gipv6/gipv6.go | 6 + g/net/grouter/grouter.go | 6 + g/net/gscanner/scanner.go | 7 + g/net/gsession/gsession.go | 6 + g/net/gsmtp/smtp.go | 6 + g/net/gtcp/tcp.go | 6 + g/net/gtcp/tcp_server.go | 6 + g/net/gudp/udp.go | 6 + g/net/gudp/udp_server.go | 6 + g/os/gcache/gcache.go | 6 + g/os/gconsole/gconsole.go | 6 + g/os/genv/genv.go | 6 + g/os/gfile/gfile.go | 6 + g/os/gfilepool/gfilepool.go | 6 + g/os/gfilespace/gfilespace.go | 6 + g/os/gfilespace/gfilespace_api.go | 6 + g/os/glog/glog.go | 6 + g/os/gtime/time.go | 6 + g/os/gview/gview.go | 6 + g/util/gpage/page.go | 150 -------------------- g/util/grand/rand.go | 6 + g/util/gregx/regx.go | 6 + g/util/gutil/util.go | 6 + g/util/gvalid/gvalid.go | 6 + g/util/gvalid/gvalid_test.go | 5 + 74 files changed, 430 insertions(+), 151 deletions(-) delete mode 100644 g/util/gpage/page.go diff --git a/g/container/gbtree/gbtree.go b/g/container/gbtree/gbtree.go index e7da6dca5..1b06dba83 100644 --- a/g/container/gbtree/gbtree.go +++ b/g/container/gbtree/gbtree.go @@ -1,4 +1,4 @@ -// B+树,来源于:from https://github.com/google/btree +// from https://github.com/google/btree package gbtree import ( diff --git a/g/container/glist/safelist.go b/g/container/glist/safelist.go index 4e48cbea4..8bf55baf2 100644 --- a/g/container/glist/safelist.go +++ b/g/container/glist/safelist.go @@ -1,3 +1,10 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// +// package glist import ( diff --git a/g/container/gmap/int_bool_map.go b/g/container/gmap/int_bool_map.go index 5756c2ff6..954d71ded 100644 --- a/g/container/gmap/int_bool_map.go +++ b/g/container/gmap/int_bool_map.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// package gmap import ( diff --git a/g/container/gmap/int_int_map.go b/g/container/gmap/int_int_map.go index 8b2de2af1..1e1f5b23e 100644 --- a/g/container/gmap/int_int_map.go +++ b/g/container/gmap/int_int_map.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gmap import ( diff --git a/g/container/gmap/int_interface_map.go b/g/container/gmap/int_interface_map.go index 989637167..484927ec0 100644 --- a/g/container/gmap/int_interface_map.go +++ b/g/container/gmap/int_interface_map.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// package gmap import ( diff --git a/g/container/gmap/int_string_map.go b/g/container/gmap/int_string_map.go index a0a3d774a..e46570822 100644 --- a/g/container/gmap/int_string_map.go +++ b/g/container/gmap/int_string_map.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gmap import ( diff --git a/g/container/gmap/interface_interface_map.go b/g/container/gmap/interface_interface_map.go index 5a06c6e42..ccd6eef48 100644 --- a/g/container/gmap/interface_interface_map.go +++ b/g/container/gmap/interface_interface_map.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// package gmap import ( diff --git a/g/container/gmap/string_bool_map.go b/g/container/gmap/string_bool_map.go index 9aa08a9c6..4c29c2237 100644 --- a/g/container/gmap/string_bool_map.go +++ b/g/container/gmap/string_bool_map.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// package gmap import ( diff --git a/g/container/gmap/string_int_map.go b/g/container/gmap/string_int_map.go index 6854701f9..08a435711 100644 --- a/g/container/gmap/string_int_map.go +++ b/g/container/gmap/string_int_map.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// package gmap import ( diff --git a/g/container/gmap/string_interface_map.go b/g/container/gmap/string_interface_map.go index 194d0c508..5004ed81c 100644 --- a/g/container/gmap/string_interface_map.go +++ b/g/container/gmap/string_interface_map.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// package gmap import ( diff --git a/g/container/gmap/string_string_map.go b/g/container/gmap/string_string_map.go index 5db0ceff4..fdff08297 100644 --- a/g/container/gmap/string_string_map.go +++ b/g/container/gmap/string_string_map.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// package gmap import ( diff --git a/g/container/gmap/uint_interface_map.go b/g/container/gmap/uint_interface_map.go index df39ed189..645ce5e03 100644 --- a/g/container/gmap/uint_interface_map.go +++ b/g/container/gmap/uint_interface_map.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// package gmap import ( diff --git a/g/container/gset/int64_set.go b/g/container/gset/int64_set.go index a828b6ff2..b8da851fc 100644 --- a/g/container/gset/int64_set.go +++ b/g/container/gset/int64_set.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// package gset import ( diff --git a/g/container/gset/int_set.go b/g/container/gset/int_set.go index 643c26167..056f6d67f 100644 --- a/g/container/gset/int_set.go +++ b/g/container/gset/int_set.go @@ -1,3 +1,10 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// +// package gset import ( diff --git a/g/container/gset/interface_set.go b/g/container/gset/interface_set.go index d567d6625..e9f520232 100644 --- a/g/container/gset/interface_set.go +++ b/g/container/gset/interface_set.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// package gset import ( diff --git a/g/container/gset/string_set.go b/g/container/gset/string_set.go index 9e4780f06..172a49360 100644 --- a/g/container/gset/string_set.go +++ b/g/container/gset/string_set.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// package gset import ( diff --git a/g/database/gdb/gdb.go b/g/database/gdb/gdb.go index fffb97129..37ac9052c 100644 --- a/g/database/gdb/gdb.go +++ b/g/database/gdb/gdb.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// // 对常用关系数据库的封装管理包 package gdb diff --git a/g/database/gdb/gdb_base.go b/g/database/gdb/gdb_base.go index 3669aa35d..84881b48d 100644 --- a/g/database/gdb/gdb_base.go +++ b/g/database/gdb/gdb_base.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// package gdb import ( diff --git a/g/database/gdb/gdb_config.go b/g/database/gdb/gdb_config.go index 82a3eed3f..2a8c055e8 100644 --- a/g/database/gdb/gdb_config.go +++ b/g/database/gdb/gdb_config.go @@ -1,3 +1,8 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. // 对常用关系数据库的封装管理包 package gdb diff --git a/g/database/gdb/gdb_linkop.go b/g/database/gdb/gdb_linkop.go index aa8e8092b..693c87c67 100644 --- a/g/database/gdb/gdb_linkop.go +++ b/g/database/gdb/gdb_linkop.go @@ -1,3 +1,8 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. package gdb import ( diff --git a/g/database/gdb/gdb_mysql.go b/g/database/gdb/gdb_mysql.go index 5675859d0..9d939ee79 100644 --- a/g/database/gdb/gdb_mysql.go +++ b/g/database/gdb/gdb_mysql.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gdb import ( diff --git a/g/database/gdb/gdb_pgsql.go b/g/database/gdb/gdb_pgsql.go index 506dde82b..23b6689ab 100644 --- a/g/database/gdb/gdb_pgsql.go +++ b/g/database/gdb/gdb_pgsql.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gdb import ( diff --git a/g/encoding/gbase64/gbase64.go b/g/encoding/gbase64/gbase64.go index 5e902515e..b6e6cc1f0 100644 --- a/g/encoding/gbase64/gbase64.go +++ b/g/encoding/gbase64/gbase64.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gbase64 import ( diff --git a/g/encoding/gbinary/gbinary.go b/g/encoding/gbinary/gbinary.go index 4a839147f..16337e98f 100644 --- a/g/encoding/gbinary/gbinary.go +++ b/g/encoding/gbinary/gbinary.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + // 二进制及byte操作管理包 package gbinary diff --git a/g/encoding/gcompress/gcompress.go b/g/encoding/gcompress/gcompress.go index 6875399db..802ec2759 100644 --- a/g/encoding/gcompress/gcompress.go +++ b/g/encoding/gcompress/gcompress.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gcompress import ( diff --git a/g/encoding/gcrc32/gcrc32.go b/g/encoding/gcrc32/gcrc32.go index 470dbcc91..1b7b986cc 100644 --- a/g/encoding/gcrc32/gcrc32.go +++ b/g/encoding/gcrc32/gcrc32.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gcrc32 import ( diff --git a/g/encoding/ghash/ghash.go b/g/encoding/ghash/ghash.go index 78d5186aa..7f6152963 100644 --- a/g/encoding/ghash/ghash.go +++ b/g/encoding/ghash/ghash.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + // 封装常用的hash函数 package ghash diff --git a/g/encoding/ghtml/ghtml.go b/g/encoding/ghtml/ghtml.go index 5a4a84252..7950af09a 100644 --- a/g/encoding/ghtml/ghtml.go +++ b/g/encoding/ghtml/ghtml.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package ghtml import "strings" diff --git a/g/encoding/gjson/gjson.go b/g/encoding/gjson/gjson.go index 999119628..bcbc96406 100644 --- a/g/encoding/gjson/gjson.go +++ b/g/encoding/gjson/gjson.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gjson import ( diff --git a/g/encoding/gjson/internal/gjson.go b/g/encoding/gjson/internal/gjson.go index 3f81ff721..26d359dd5 100644 --- a/g/encoding/gjson/internal/gjson.go +++ b/g/encoding/gjson/internal/gjson.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package internal import ( diff --git a/g/encoding/gmd5/gmd5.go b/g/encoding/gmd5/gmd5.go index d3b5f3d68..74f97823d 100644 --- a/g/encoding/gmd5/gmd5.go +++ b/g/encoding/gmd5/gmd5.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gmd5 import ( diff --git a/g/encoding/gsha1/gsha1.go b/g/encoding/gsha1/gsha1.go index 3cfbf7aa7..0596aa6a7 100644 --- a/g/encoding/gsha1/gsha1.go +++ b/g/encoding/gsha1/gsha1.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gsha1 import ( diff --git a/g/encoding/gurl/url.go b/g/encoding/gurl/url.go index c71231966..82c5fa819 100644 --- a/g/encoding/gurl/url.go +++ b/g/encoding/gurl/url.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gurl import "net/url" diff --git a/g/frame/gconfig/gconfig.go b/g/frame/gconfig/gconfig.go index c014d144a..5aa928905 100644 --- a/g/frame/gconfig/gconfig.go +++ b/g/frame/gconfig/gconfig.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + // 全局配置管理对象 package gconfig diff --git a/g/frame/ginstance/ginstance.go b/g/frame/ginstance/ginstance.go index dca9c7b97..c81f564f4 100644 --- a/g/frame/ginstance/ginstance.go +++ b/g/frame/ginstance/ginstance.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + // 单例对象管理工具 // 框架内置了一些核心对象,并且可以通过Set和Get方法实现IoC以及对内置核心对象的自定义替换 package ginstance diff --git a/g/frame/gmvc/controller.go b/g/frame/gmvc/controller.go index 6ac97b33b..e0a26be25 100644 --- a/g/frame/gmvc/controller.go +++ b/g/frame/gmvc/controller.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + // MVC控制器基类 package gmvc diff --git a/g/frame/gmvc/model.go b/g/frame/gmvc/model.go index fe7a5c967..ad7f3b690 100644 --- a/g/frame/gmvc/model.go +++ b/g/frame/gmvc/model.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + // 模型基类 package gmvc diff --git a/g/frame/gmvc/view.go b/g/frame/gmvc/view.go index a97d99411..41b46ac4c 100644 --- a/g/frame/gmvc/view.go +++ b/g/frame/gmvc/view.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gmvc import ( diff --git a/g/net/ghttp/http_client.go b/g/net/ghttp/http_client.go index 0fd08e395..4e54c8563 100644 --- a/g/net/ghttp/http_client.go +++ b/g/net/ghttp/http_client.go @@ -1,3 +1,8 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. package ghttp import ( diff --git a/g/net/ghttp/http_client_request.go b/g/net/ghttp/http_client_request.go index 015e1a037..1d534b331 100644 --- a/g/net/ghttp/http_client_request.go +++ b/g/net/ghttp/http_client_request.go @@ -1,3 +1,8 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. package ghttp import ( diff --git a/g/net/ghttp/http_client_response.go b/g/net/ghttp/http_client_response.go index 4c615ad36..2757607d6 100644 --- a/g/net/ghttp/http_client_response.go +++ b/g/net/ghttp/http_client_response.go @@ -1,3 +1,8 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. package ghttp import ( diff --git a/g/net/ghttp/http_controller.go b/g/net/ghttp/http_controller.go index 18b8ead68..9edbc07fd 100644 --- a/g/net/ghttp/http_controller.go +++ b/g/net/ghttp/http_controller.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package ghttp diff --git a/g/net/ghttp/http_server.go b/g/net/ghttp/http_server.go index 687f002ee..ab377f7b3 100644 --- a/g/net/ghttp/http_server.go +++ b/g/net/ghttp/http_server.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package ghttp import ( diff --git a/g/net/ghttp/http_server_config.go b/g/net/ghttp/http_server_config.go index 97bce549a..a8815e298 100644 --- a/g/net/ghttp/http_server_config.go +++ b/g/net/ghttp/http_server_config.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package ghttp import ( diff --git a/g/net/ghttp/http_server_cookie.go b/g/net/ghttp/http_server_cookie.go index 642571a05..14a72c582 100644 --- a/g/net/ghttp/http_server_cookie.go +++ b/g/net/ghttp/http_server_cookie.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package ghttp import ( diff --git a/g/net/ghttp/http_server_domain.go b/g/net/ghttp/http_server_domain.go index e405c5374..99780e71f 100644 --- a/g/net/ghttp/http_server_domain.go +++ b/g/net/ghttp/http_server_domain.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// package ghttp import ( diff --git a/g/net/ghttp/http_server_handler.go b/g/net/ghttp/http_server_handler.go index 9b9d47ad8..5165bca56 100644 --- a/g/net/ghttp/http_server_handler.go +++ b/g/net/ghttp/http_server_handler.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// package ghttp import ( diff --git a/g/net/ghttp/http_server_response.go b/g/net/ghttp/http_server_response.go index 651bf13ab..6e600adbe 100644 --- a/g/net/ghttp/http_server_response.go +++ b/g/net/ghttp/http_server_response.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// package ghttp import ( diff --git a/g/net/gipv4/gipv4.go b/g/net/gipv4/gipv4.go index e15f39e76..ea1f805d5 100644 --- a/g/net/gipv4/gipv4.go +++ b/g/net/gipv4/gipv4.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// package gipv4 import ( diff --git a/g/net/gipv6/gipv6.go b/g/net/gipv6/gipv6.go index a9c099cea..b4b4e860a 100644 --- a/g/net/gipv6/gipv6.go +++ b/g/net/gipv6/gipv6.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gipv6 import "gitee.com/johng/gf/g/util/gregx" diff --git a/g/net/grouter/grouter.go b/g/net/grouter/grouter.go index eb3300c70..d6cec4cc4 100644 --- a/g/net/grouter/grouter.go +++ b/g/net/grouter/grouter.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package grouter import ( diff --git a/g/net/gscanner/scanner.go b/g/net/gscanner/scanner.go index acd63a908..527eb4b3b 100644 --- a/g/net/gscanner/scanner.go +++ b/g/net/gscanner/scanner.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + // 局域网端口扫描 package gscanner @@ -8,6 +14,7 @@ import ( "sync" "time" "gitee.com/johng/gf/g/net/gip" + "gitee.com/johng/gf/g/net/gipv4" ) type scanner struct { diff --git a/g/net/gsession/gsession.go b/g/net/gsession/gsession.go index 87a06dc36..bf5e362ea 100644 --- a/g/net/gsession/gsession.go +++ b/g/net/gsession/gsession.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gsession import ( diff --git a/g/net/gsmtp/smtp.go b/g/net/gsmtp/smtp.go index 18b79e724..0d8df6db1 100644 --- a/g/net/gsmtp/smtp.go +++ b/g/net/gsmtp/smtp.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gsmtp import ( diff --git a/g/net/gtcp/tcp.go b/g/net/gtcp/tcp.go index 0a583dc0e..f1a322140 100644 --- a/g/net/gtcp/tcp.go +++ b/g/net/gtcp/tcp.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gtcp import ( diff --git a/g/net/gtcp/tcp_server.go b/g/net/gtcp/tcp_server.go index 985724136..209a40500 100644 --- a/g/net/gtcp/tcp_server.go +++ b/g/net/gtcp/tcp_server.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gtcp import ( diff --git a/g/net/gudp/udp.go b/g/net/gudp/udp.go index ca7bbe39f..4be08d6dd 100644 --- a/g/net/gudp/udp.go +++ b/g/net/gudp/udp.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gudp import ( diff --git a/g/net/gudp/udp_server.go b/g/net/gudp/udp_server.go index 5a238c6f6..2deb06e9b 100644 --- a/g/net/gudp/udp_server.go +++ b/g/net/gudp/udp_server.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gudp import "gitee.com/johng/gf/g/os/glog" diff --git a/g/os/gcache/gcache.go b/g/os/gcache/gcache.go index e02be91de..b71a27a79 100644 --- a/g/os/gcache/gcache.go +++ b/g/os/gcache/gcache.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gcache import ( diff --git a/g/os/gconsole/gconsole.go b/g/os/gconsole/gconsole.go index 6a2e2bcf8..90fdbbb24 100644 --- a/g/os/gconsole/gconsole.go +++ b/g/os/gconsole/gconsole.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gconsole import ( diff --git a/g/os/genv/genv.go b/g/os/genv/genv.go index 08ee1e8cf..cef8d5a7f 100644 --- a/g/os/genv/genv.go +++ b/g/os/genv/genv.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package genv import "os" diff --git a/g/os/gfile/gfile.go b/g/os/gfile/gfile.go index 452ef2f16..ca4c1f355 100644 --- a/g/os/gfile/gfile.go +++ b/g/os/gfile/gfile.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gfile import ( diff --git a/g/os/gfilepool/gfilepool.go b/g/os/gfilepool/gfilepool.go index d06c51090..f3fb17ccd 100644 --- a/g/os/gfilepool/gfilepool.go +++ b/g/os/gfilepool/gfilepool.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gfilepool import ( diff --git a/g/os/gfilespace/gfilespace.go b/g/os/gfilespace/gfilespace.go index 01ea7f422..313158621 100644 --- a/g/os/gfilespace/gfilespace.go +++ b/g/os/gfilespace/gfilespace.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + // 文件空间管理, 可用于文件碎片空间维护及再利用,支持自动合并连续碎片空间 package gfilespace diff --git a/g/os/gfilespace/gfilespace_api.go b/g/os/gfilespace/gfilespace_api.go index f8de48844..4216d3673 100644 --- a/g/os/gfilespace/gfilespace_api.go +++ b/g/os/gfilespace/gfilespace_api.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gfilespace import ( diff --git a/g/os/glog/glog.go b/g/os/glog/glog.go index 51d4d60ca..e0b09f233 100644 --- a/g/os/glog/glog.go +++ b/g/os/glog/glog.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package glog import ( diff --git a/g/os/gtime/time.go b/g/os/gtime/time.go index 11c7d50ad..65a6454c4 100644 --- a/g/os/gtime/time.go +++ b/g/os/gtime/time.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gtime import ( diff --git a/g/os/gview/gview.go b/g/os/gview/gview.go index 55b047b3a..0dcc91896 100644 --- a/g/os/gview/gview.go +++ b/g/os/gview/gview.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gview import ( diff --git a/g/util/gpage/page.go b/g/util/gpage/page.go deleted file mode 100644 index f1c3e58cb..000000000 --- a/g/util/gpage/page.go +++ /dev/null @@ -1,150 +0,0 @@ -package gpage - -import ( - "math" - "net/http" - "net/url" - "strconv" -) - -type Paginator struct { - Request *http.Request - PerPageNums int - MaxPages int - - nums int64 - pageRange []int - pageNums int - page int -} - -func (p *Paginator) PageNums() int { - if p.pageNums != 0 { - return p.pageNums - } - pageNums := math.Ceil(float64(p.nums) / float64(p.PerPageNums)) - if p.MaxPages > 0 { - pageNums = math.Min(pageNums, float64(p.MaxPages)) - } - p.pageNums = int(pageNums) - return p.pageNums -} - -func (p *Paginator) Nums() int64 { - return p.nums -} - -func (p *Paginator) SetNums(nums interface{}) { - p.nums = int64(nums) -} - -func (p *Paginator) Page() int { - if p.page != 0 { - return p.page - } - if p.Request.Form == nil { - p.Request.ParseForm() - } - p.page, _ = strconv.Atoi(p.Request.Form.Get("p")) - if p.page > p.PageNums() { - p.page = p.PageNums() - } - if p.page <= 0 { - p.page = 1 - } - return p.page -} - -func (p *Paginator) Pages() []int { - if p.pageRange == nil && p.nums > 0 { - var pages []int - pageNums := p.PageNums() - page := p.Page() - switch { - case page >= pageNums-4 && pageNums > 9: - start := pageNums - 9 + 1 - pages = make([]int, 9) - for i, _ := range pages { - pages[i] = start + i - } - case page >= 5 && pageNums > 9: - start := page - 5 + 1 - pages = make([]int, int(math.Min(9, float64(page+4+1)))) - for i, _ := range pages { - pages[i] = start + i - } - default: - pages = make([]int, int(math.Min(9, float64(pageNums)))) - for i, _ := range pages { - pages[i] = i + 1 - } - } - p.pageRange = pages - } - return p.pageRange -} - -func (p *Paginator) PageLink(page int) string { - link, _ := url.ParseRequestURI(p.Request.RequestURI) - values := link.Query() - if page == 1 { - values.Del("p") - } else { - values.Set("p", strconv.Itoa(page)) - } - link.RawQuery = values.Encode() - return link.String() -} - -func (p *Paginator) PageLinkPrev() (link string) { - if p.HasPrev() { - link = p.PageLink(p.Page() - 1) - } - return -} - -func (p *Paginator) PageLinkNext() (link string) { - if p.HasNext() { - link = p.PageLink(p.Page() + 1) - } - return -} - -func (p *Paginator) PageLinkFirst() (link string) { - return p.PageLink(1) -} - -func (p *Paginator) PageLinkLast() (link string) { - return p.PageLink(p.PageNums()) -} - -func (p *Paginator) HasPrev() bool { - return p.Page() > 1 -} - -func (p *Paginator) HasNext() bool { - return p.Page() < p.PageNums() -} - -func (p *Paginator) IsActive(page int) bool { - return p.Page() == page -} - -func (p *Paginator) Offset() int { - return (p.Page() - 1) * p.PerPageNums -} - -func (p *Paginator) HasPages() bool { - return p.PageNums() > 1 -} - -func NewPaginator(req *http.Request, per int, nums interface{}) *Paginator { - p := Paginator{} - p.Request = req - if per <= 0 { - per = 10 - } - p.PerPageNums = per - p.SetNums(nums) - return &p -} \ No newline at end of file diff --git a/g/util/grand/rand.go b/g/util/grand/rand.go index aecd70f3d..8bc7eef24 100644 --- a/g/util/grand/rand.go +++ b/g/util/grand/rand.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package grand import ( diff --git a/g/util/gregx/regx.go b/g/util/gregx/regx.go index 8b78663d3..0ecc058fd 100644 --- a/g/util/gregx/regx.go +++ b/g/util/gregx/regx.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gregx import ( diff --git a/g/util/gutil/util.go b/g/util/gutil/util.go index 93d27716d..b8778430d 100644 --- a/g/util/gutil/util.go +++ b/g/util/gutil/util.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. + package gutil // 便利数组查找字符串索引位置,如果不存在则返回-1 diff --git a/g/util/gvalid/gvalid.go b/g/util/gvalid/gvalid.go index 7e7da3766..d0b52bd40 100644 --- a/g/util/gvalid/gvalid.go +++ b/g/util/gvalid/gvalid.go @@ -1,3 +1,9 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. +// // 通用数据验证工具 // 本来打算取名gvalidator的,名字太长了,缩写一下 /* diff --git a/g/util/gvalid/gvalid_test.go b/g/util/gvalid/gvalid_test.go index a930ca045..c91401e77 100644 --- a/g/util/gvalid/gvalid_test.go +++ b/g/util/gvalid/gvalid_test.go @@ -1,3 +1,8 @@ +// Copyright 2017 gf Author(https://gitee.com/johng/gf). All Rights Reserved. +// +// This Source Code Form is subject to the terms of the MIT License. +// If a copy of the MIT was not distributed with this file, +// You can obtain one at https://gitee.com/johng/gf. package gvalid_test import (