Compare commits

...

1371 Commits

Author SHA1 Message Date
cb7c3a9fa4 fix issue in index folder feature for ghttp.Server 2019-09-25 10:56:44 +08:00
b0f859cc91 improve example codes 2019-09-24 23:41:18 +08:00
6d4da529ee add websocket unit test case for ghttp 2019-09-24 21:08:28 +08:00
6c7e536eeb fix issue in gbase64/ghttp 2019-09-24 20:39:00 +08:00
36c2648be8 improve ghttp.Response; move gflock to new repo 2019-09-24 20:19:18 +08:00
a876b6133d fix issue in unit test case og grand 2019-09-23 23:24:36 +08:00
03ff358da8 update ci/readme/donator 2019-09-23 23:08:58 +08:00
037f74c549 Create FUNDING.yml 2019-09-23 22:32:31 +08:00
a8caf4ad21 RELEASE updates 2019-09-23 22:00:04 +08:00
51d9fe5253 add AllowDomain option for ghttp.CORS; add IsSubDomain function for gstr; improve grand.Intn 2019-09-23 19:25:03 +08:00
3218c89f17 improve gfile/gstr/ghttp 2019-09-23 16:21:19 +08:00
02e467fb57 rename MapStruct* functions to MapToMap* for gconv and according packags 2019-09-19 23:23:41 +08:00
ec994f3080 add more examples of middleware feature for ghttp.Server; release updates 2019-09-19 21:17:54 +08:00
1181ab499c improve error handling in hook feature for ghttp.Server 2019-09-19 20:25:01 +08:00
5424935fd9 rename AddMiddleware to BindMiddleWareDefault for ghttp.Server; add more unit test cases fpr gstr 2019-09-19 20:19:07 +08:00
b9fbfb91bd improve middleware feature of ghttp.Server; add MapStrAny function for gmap/gtree 2019-09-19 19:44:46 +08:00
62f66b4fec remove unnecessary stack trace of gf for stack printing 2019-09-19 13:13:39 +08:00
eef9da9a41 improve parameters parsing for ghttp.Server 2019-09-19 09:09:12 +08:00
7d32be3b6c improve perameter parsing for ghttp.Server 2019-09-18 23:20:45 +08:00
c2ad9f5fb9 fix issue in gyaml for invalid decoding result of type map[interface{}]interface{} 2019-09-17 20:53:20 +08:00
4847fecdaa Merge branch 'master' of https://github.com/gogf/gf 2019-09-17 19:48:19 +08:00
f75383e0c5 fix issue in quote word for gdb 2019-09-17 19:45:51 +08:00
f683dccb6f Merge pull request #335 from LetMyPplGo/master
added tests for gsmtp
2019-09-17 10:44:15 +08:00
6fb106b618 added tests for gsmtp 2019-09-17 00:06:46 +03:00
97956ad903 version/release update 2019-09-16 23:07:57 +08:00
5d72a5b5ae improve gcmd 2019-09-16 20:57:43 +08:00
1d7ded562c add quote support for table named with '.'; improve case conversion for strings named with '.' for gstr 2019-09-16 17:15:39 +08:00
0d87b601cc fix issue in data filter for gdb.Model 2019-09-16 16:54:52 +08:00
33fbedffb8 gix issue in Config variable for ghttp.Response.View 2019-09-16 15:49:31 +08:00
2cfcbc82e1 RELEASE updates 2019-09-16 11:10:38 +08:00
e1721cb1b6 add package gmode for release mode management 2019-09-16 11:08:41 +08:00
1d264a6545 add package gmode for release mode management; add error returning for template rendoring for gmvc.View/ghttp.Response 2019-09-16 10:44:07 +08:00
565e48f6f1 add more example for package gres; RELEASE updates 2019-09-15 21:47:47 +08:00
2b20c77bc0 improve example for gi18n 2019-09-15 13:47:44 +08:00
1665d92136 improve session expire algorithm for gsession 2019-09-15 12:17:44 +08:00
f128cb9f61 improve session storage interface for gsession 2019-09-15 11:30:38 +08:00
6d55b30b39 add example for group router of ghttp.Server 2019-09-14 23:36:02 +08:00
953ea55899 improve status handling for response of ghttp.Server 2019-09-14 22:57:57 +08:00
966c93af00 improve middleware and error logging for ghttp.Server 2019-09-14 22:53:28 +08:00
41a0b52939 RELEASE updates 2019-09-14 00:43:06 +08:00
8281d9cdd1 improve gfile.MainPkgPath; update RELEASE.MD 2019-09-14 00:17:49 +08:00
b0ece3bd8f Merge branch 'master' of https://github.com/gogf/gf 2019-09-13 22:14:08 +08:00
19a856549a improve codes details 2019-09-13 22:08:18 +08:00
65bd31bb65 Merge pull request #316 from LetMyPplGo/master 2019-09-13 21:16:16 +08:00
a3830f0820 Merge pull request #326 from wenzi1/master 2019-09-13 21:15:22 +08:00
5f8656eb41 Merge pull request #332 from hailaz/master
improve dbBase.doBatchInsert()
2019-09-13 21:14:38 +08:00
141bee9c49 add ConfigByMap function for ghttp.Server; improve gsession for file storage 2019-09-13 20:49:16 +08:00
aa44c0fb11 improve session for ghttp.Server; improve i18n for gview 2019-09-12 00:00:59 +08:00
79e2d30849 improve gsession for file storing 2019-09-11 23:26:38 +08:00
e8a9c7ac72 update comments for package gaes/gdes; update function names for gdes 2019-09-11 23:22:15 +08:00
006054d13a fix issue in session for ghttp.Server 2019-09-11 22:57:29 +08:00
b39d653fe9 add package gsession; mv gkvdb to new repo 2019-09-11 21:19:45 +08:00
d9e7d4249f improve dbBase.doBatchInsert() 2019-09-11 16:48:00 +08:00
34ad4ae166 Merge pull request #7 from gogf/master
sync master
2019-09-11 16:40:27 +08:00
69684f5023 improve gredis instance initialization for gins 2019-09-10 20:38:23 +08:00
2ed1854f0c improve gres with file separator replaced to / 2019-09-10 14:21:11 +08:00
09da0f7388 improving gview with ghttp for controller 2019-09-09 23:02:40 +08:00
7f943c6b5f improving gview with i18n 2019-09-09 22:56:54 +08:00
ed3fc529ed Failed to return when Gini file grammar error
Failed to return when Gini file grammar error
2019-09-08 23:25:45 +08:00
2eb0511ef5 Failed to return when Gini file grammar error
Failed to return when Gini file grammar error
2019-09-08 23:24:00 +08:00
8bc1f457c7 Merge pull request #1 from gogf/master
update
2019-09-08 22:58:40 +08:00
77a727e1d7 improve i18n with gview 2019-09-08 21:12:11 +08:00
16cc3c0fca fix issue in gredis unit test cases 2019-09-06 18:08:58 +08:00
96106ace92 remove deprecated functions and fix corresponding unit test cases 2019-09-06 17:59:55 +08:00
13e528abb6 remove deprecated functions and fix corresponding unit test cases 2019-09-06 16:59:38 +08:00
0d5dfe59b9 remove deprecated functions 2019-09-06 16:44:40 +08:00
8fd88307f7 add errors printing when i18n files loading failed for gi18n 2019-09-06 15:43:57 +08:00
57244a9553 added the example for gsmtp 2019-09-06 01:18:41 +03:00
fb8aac38dd server address verification
simple Email address check for from & to
default port=25 for server address
2019-09-06 00:53:23 +03:00
8f953dabe5 fix issue in ghttp.Session.GetMap* 2019-09-05 23:48:54 +08:00
d63c2882fd update unit test case for gfile.IsEmpty 2019-09-05 20:18:49 +08:00
952eb7df15 add Scan/Scanf functions for gcmd; improve gfile.IsEmpty 2019-09-05 20:00:01 +08:00
dfc76ddb76 add IsEmpty function for gfile 2019-09-05 19:22:11 +08:00
b0cddc29e4 add more functions for gcmd 2019-09-05 15:16:25 +08:00
dfc61cb273 rename StrArray to StrArray for garray 2019-09-05 14:26:08 +08:00
05922e4f21 add more common types for package g 2019-09-05 14:25:20 +08:00
6cf4bf81e5 improve gcmd with arguments parser 2019-09-05 11:38:36 +08:00
ad43989944 improve procedure of ghttp.Server 2019-09-04 20:22:31 +08:00
31e7037e3e add example for session handling of ghttp 2019-09-04 20:12:29 +08:00
425d45e502 improve error text for session saving error 2019-09-04 20:04:04 +08:00
9ddb148fcb fix issue in memory usage of gkvdb in unit test cases of ghttp 2019-09-04 19:44:13 +08:00
e4d34abd7e fix unit test cases for ghttp/gres 2019-09-04 19:23:19 +08:00
16103c43eb fix unit test cases for ghttp/gres 2019-09-04 19:10:15 +08:00
7fad4b686c improve gcompress/gres for packing files 2019-09-03 23:18:54 +08:00
cd00ac446b improve CORS feature for ghttp.Server 2019-09-03 17:18:16 +08:00
e2906fba0b improve type conversion for gdb 2019-09-03 00:06:24 +08:00
acd5e72f6c improve gdb for configiration 2019-09-02 20:35:29 +08:00
8f1fd259d4 Merge branch 'master' of https://github.com/gogf/gf 2019-09-02 19:06:53 +08:00
d9041da426 Merge branch 'develop' 2019-09-02 19:06:01 +08:00
269ddb04af fix issue in gfile.Replace* 2019-09-02 19:05:32 +08:00
b1c2b9f4e0 improve gconv.Bool for NO/YES; improve gdb for model generation 2019-09-02 15:48:25 +08:00
7e9fe8ea98 improve resource feature in ghttp.Server 2019-09-01 22:22:08 +08:00
af81bf2bde Merge branch 'develop' 2019-09-01 22:14:45 +08:00
55addaa8ea improve gres and add more unit test cases for gres 2019-09-01 22:14:31 +08:00
6ccc4d119f improve export data as hex for gres 2019-09-01 21:34:15 +08:00
c05a91cdc9 README update 2019-09-01 00:31:15 +08:00
077d8b9f48 Merge branch 'develop' 2019-09-01 00:30:19 +08:00
15a6680833 add package gi18n 2019-09-01 00:30:01 +08:00
6c61704e60 adding package gi18n 2019-08-31 18:04:12 +08:00
cfa0b99cd8 README update 2019-08-30 22:19:50 +08:00
c0bb8bef06 README update 2019-08-30 22:15:54 +08:00
86f9d5c39d README update 2019-08-30 22:15:13 +08:00
33f2ae5fc4 fix spell issue of const names for gproc 2019-08-30 21:07:46 +08:00
ea1277d76c add case functions for gstr and according unit test cases 2019-08-30 20:51:23 +08:00
ee89a06b3e improve model feature 2019-08-30 20:29:12 +08:00
a31108e753 fix issue in gring/ghttp 2019-08-26 23:51:01 +08:00
2bf9bc98a7 improve gkvdb, container 2019-08-26 23:35:44 +08:00
d67975249c fix issue in unit test case for gkvdb 2019-08-26 22:54:59 +08:00
d3a2bef9ba improve debug sql with arguments auto bound 2019-08-26 20:57:37 +08:00
b7f67e3162 add StackWithFilter function for glog, and improve gdb/ghttp 2019-08-26 20:09:24 +08:00
1a20edc0b0 improving gdb and glog 2019-08-26 19:39:04 +08:00
f80ba1473e fix issue in stack skip feature for glog; fix issue in slice parameter for gdb 2019-08-24 23:08:17 +08:00
89a8203949 comment update for gpage 2019-08-22 23:30:28 +08:00
fd6321e71b update donator; update unit test case for gdb; fix issue in bool convertion for []byte for gconv 2019-08-22 23:24:45 +08:00
7dffd9d1ff add package gkvdb; add kvdb storage feature for ghttp.Server 2019-08-22 21:04:30 +08:00
51a156420d improve gres for empty path passed 2019-08-19 22:54:37 +08:00
c92323c681 gofmt 2019-08-19 22:42:31 +08:00
10e03eef3b add resource feature for gcfg 2019-08-19 21:02:44 +08:00
e151055521 improve resource feature for ghttp/gview 2019-08-19 20:17:13 +08:00
1f8408b622 improve gdb 2019-08-19 19:21:27 +08:00
98ddadb131 Merge branch 'master' of https://github.com/gogf/gf into develop 2019-08-19 19:09:48 +08:00
a5ac12545a Merge pull request #286 from wenzi1/master 2019-08-19 19:07:46 +08:00
e58384d815 update example for gres 2019-08-16 00:37:12 +08:00
ab381dacfe add resource feature support for gview 2019-08-16 00:29:14 +08:00
9162fde14a improve resource feature for ghttp.Server 2019-08-15 19:27:32 +08:00
6cf1714a07 improve resource feature for ghttp.Server 2019-08-15 19:20:39 +08:00
c402e17605 修改mssql中的datetime类型的处理 2019-08-14 22:44:57 +08:00
25746e9844 adding gres 2019-08-14 22:18:31 +08:00
a8a8dbeab8 adding gres 2019-08-14 22:16:33 +08:00
6113df2b3e adding gres 2019-08-14 22:03:52 +08:00
8f7363df41 删除mssql中的convertValue方法。
修改测试案例中的datetime类型的字段在查到数据后做转换
2019-08-14 19:16:45 +08:00
dafc79bf80 adding gres 2019-08-14 00:13:42 +08:00
9ae537cafc adding gres 2019-08-13 21:06:11 +08:00
162df6b250 fix issue in number overflow from int64 to int for ghttp.Session/ghttp.Cookie/gcache 2019-08-13 20:15:09 +08:00
12f28dfc95 improving gtree/gres 2019-08-13 13:45:01 +08:00
5d7d8abbde add oracle/mssql/postgres unit test cases 2019-08-12 17:12:16 +08:00
b960faec45 to support automated testing of postgres 2019-08-12 16:57:08 +08:00
9a057b757d add package gini 2019-08-12 16:53:07 +08:00
296c4b750b add oracle/mssql/postgres unit test cases 2019-08-12 16:50:57 +08:00
7ecc47e127 adding gres package for resource feature 2019-08-10 23:36:38 +08:00
d03180ff4d Merge pull request #284 from pibigstar/master
feat(travis): exit ci when test failed
2019-08-10 21:17:16 +08:00
c1c52b072e feat(travis): exit ci when test failed 2019-08-10 19:55:01 +08:00
72be3803ec update unit test cases for ghttp 2019-08-10 18:07:24 +08:00
5cb4a8557d fix issue for unit test case of gutil 2019-08-10 17:59:34 +08:00
7787135549 improve status checks if there're middlewares registed for ghttp.Server 2019-08-10 17:46:11 +08:00
56368500a3 add header support for session feature of ghttp.Server 2019-08-10 16:39:46 +08:00
846c6a579e improve ghttp.RouterGroup 2019-08-10 14:10:47 +08:00
573179060e improve gjson 2019-08-09 20:33:21 +08:00
fda345577a add package gdebug; improve gconv/gfile/gset 2019-08-09 20:05:36 +08:00
8387710473 fix issue in gset.Pop; improve internal/debug 2019-08-09 09:51:56 +08:00
3af3fd1428 fix issue in gset.Pop; improve internal/debug 2019-08-09 09:51:52 +08:00
c7c6e2866e add Unsafe* functions for gconv 2019-08-09 09:14:48 +08:00
7172ae0232 fix issue in invalid error stacks for glog; improve internal/debug and gutil for stack printing 2019-08-08 22:58:49 +08:00
4eac97a7d8 add Master/Slave functions for gdb 2019-08-08 17:43:21 +08:00
352e4c088a improve gcfg: it returns all values if pattern is '.'; add more functions for gcfg 2019-08-07 16:58:01 +08:00
4d5814fc43 improve grand 2019-08-07 16:21:31 +08:00
6d13b91d37 improve grand 2019-08-07 16:20:19 +08:00
0376c99b5a update unit test cases for ghttp 2019-08-06 23:10:37 +08:00
77d9e472b7 add middleware feature for ghttp.Server; improve router group feature for ghttp.Server 2019-08-06 20:40:04 +08:00
2911ebb5d7 add middleware feature for ghttp.Server 2019-08-03 23:57:20 +08:00
f4d01f56c6 add middleware feature for ghttp.Server 2019-08-03 18:08:10 +08:00
878305fee3 add middleware feature for ghttp.Server 2019-08-03 17:14:54 +08:00
0460a53f53 add middleware feature for ghttp.Server 2019-08-03 15:54:12 +08:00
e622f6aff2 improve gconv to support struct field of interface{} conversion 2019-08-01 19:53:28 +08:00
9e96a30ea2 update unit test cases for garray/gparser 2019-08-01 17:31:48 +08:00
d188fbdf5a improve gyaml with gopkg.in/yaml.v3; update unit test cases for gfile/gyaml/gtime/garray 2019-08-01 17:12:58 +08:00
06c16bf560 remove thirdparty diectory, add go.mod for package dependences 2019-08-01 14:07:25 +08:00
29ea9e3237 travis updates 2019-08-01 11:42:51 +08:00
b01add2925 update project structure 2019-07-29 21:01:19 +08:00
a98ad9577b improve gjson/gparser/gcfg/gvar 2019-07-29 20:37:49 +08:00
ef8351151d merge master 2019-07-29 20:03:23 +08:00
f6bb3c848e Merge branch 'master' of https://github.com/gogf/gf 2019-07-29 19:52:24 +08:00
3fd4cbbbfd add MapStruct/MapStructDeep/MapStructs/MapStructsDeep functions for gconv 2019-07-29 19:52:05 +08:00
b102e0dbc5 add unit test cases for ghttp.RouterGroup 2019-07-28 17:58:43 +08:00
1c0e8f77c8 Merge branch 'develop' of https://github.com/gogf/gf into develop 2019-07-28 17:40:56 +08:00
bebcb70b14 merge master 2019-07-28 17:40:11 +08:00
165602ae0a improve default instance name handling 2019-07-28 17:37:13 +08:00
a36e00efeb improve ghttp for session storage with redis server 2019-07-28 13:10:34 +08:00
bd4d273e1c improve ghttp for session 2019-07-28 11:50:12 +08:00
216a928861 add IsEmpty for gvar; add CompareVersion for gstr 2019-07-27 15:36:52 +08:00
a157c3f940 add Map/Contains/Build functions for genv 2019-07-27 14:40:22 +08:00
5a23459b23 update unit test cases for gfile 2019-07-27 11:41:12 +08:00
538b282f43 improve internal/debug,glog,garray,gfile 2019-07-27 11:34:04 +08:00
86f51f1e4a improve gfile 2019-07-26 23:01:12 +08:00
622f76d5fb improve glog/gmd5/gcmd 2019-07-26 22:33:49 +08:00
65e06b12ae improve dir list for ghttp; add ISO8601/RFC822 functions for gtime 2019-07-25 23:25:30 +08:00
b714f7db69 add *Bytes functions for ghttp.Client; improve gcmd/gfile 2019-07-25 21:01:04 +08:00
1063922682 Merge branch 'master' of https://github.com/gogf/gf into develop 2019-07-24 22:49:48 +08:00
2c6168129a improve gfile/ghttp for file serving 2019-07-24 22:48:43 +08:00
45465c1bd1 version updates 2019-07-24 21:49:25 +08:00
8acecc88f9 improve internal/debug, gdb packages 2019-07-24 21:21:08 +08:00
575349929b improve gcompress 2019-07-24 15:58:56 +08:00
3913a89434 add Replace function for gfile 2019-07-24 15:29:10 +08:00
1bc8c9e3e2 add UnZipContent function for gcompress 2019-07-24 15:05:02 +08:00
b4a0cca9c4 add Name function for gfile; add ZipPath/UnZipFile functions for gcompress 2019-07-24 14:48:16 +08:00
78b13ef4e1 concurrent safety updates for unit test cases for internal/mutex,internal/rwmutex,grpool 2019-07-23 23:40:57 +08:00
a49df101cd change default value from unsafe to safe for garray/gmap/glist/gset/grong/gtree/gjson/gparser 2019-07-23 23:20:27 +08:00
7ff4a00063 Merge pull request #250 from hailaz/master 2019-07-23 21:51:17 +08:00
2636f8acf1 improve skip checks for internal/debug 2019-07-23 13:50:38 +08:00
9042a885fa version updates 2019-07-23 10:17:30 +08:00
ef837bd9c6 add quotes for tx for gdb 2019-07-22 23:51:47 +08:00
6a76725d64 add quotes for fields and table name for gdb 2019-07-22 23:48:39 +08:00
697dbdc604 add unit test case for types 2019-07-22 23:03:55 +08:00
86f98f3710 fix issue in gqueue in closing channel for limited queue 2019-07-22 21:57:17 +08:00
470c696976 Comment updates for gjson 2019-07-22 21:20:38 +08:00
e61bd174c8 fix issue in gcfg for config content loading 2019-07-22 21:03:54 +08:00
c71b9bc122 fix unit test cases 2019-07-22 15:31:35 +08:00
c5339cbbe7 fix unit test cases 2019-07-22 15:10:40 +08:00
29020b0ac0 improve gconv 2019-07-20 16:41:17 +08:00
0a0530af0a comment updates for gcache 2019-07-20 13:17:38 +08:00
a5783ab860 improve unit test case for gdb.Tx 2019-07-19 14:13:11 +08:00
ae2de91b4c improve gcmd 2019-07-19 14:10:02 +08:00
ceecbef586 fix issue in unit test cases for gdb.Tx; improve gcmd; add gfile.SelfName function 2019-07-19 13:32:44 +08:00
2fa558b25f improve gjson 2019-07-18 20:06:42 +08:00
f465b478d6 improve gstr/gjson/gconv 2019-07-18 18:59:49 +08:00
a4abac4916 improve unit test cases for gdb; add more functions for gjson; improve ghttp.Response.WriteStatus function 2019-07-17 23:24:27 +08:00
9f9cb097d9 修复gvalid.CheckStruct()的msgs覆盖tag的msg存在的bug。 2019-07-17 20:07:43 +08:00
5ab64e31fd improve benchmark test cases for gset/glist 2019-07-16 20:45:57 +08:00
ac6a8b9b74 improve benchmark test cases for gmap 2019-07-16 20:30:10 +08:00
f43d252d08 improve style for stack output for glog/gerror 2019-07-16 19:49:21 +08:00
185f9efb9c remove third/golang.org/x/text/encoding 2019-07-16 18:52:50 +08:00
47d423036f improve gjson 2019-07-16 17:27:21 +08:00
7fae21f255 improve gjson 2019-07-16 17:11:01 +08:00
3fce835da0 improve performance for gjson.Load* functions; add GetQueryVar/GetPostVar functions for ghttp.Request 2019-07-16 16:23:03 +08:00
0b62ccf941 improve gmutex 2019-07-16 10:25:10 +08:00
f7c5d7fc7f gvalid补充修代码注释,移除错误的代码修改。 2019-07-15 21:14:46 +08:00
e484685282 improve debug feature for gdb; add skip support for file line print for glog 2019-07-15 19:54:13 +08:00
9c857705ff Merge branch 'feature_1.8.0' 2019-07-15 17:41:27 +08:00
76f680de33 fix issue in debug for gdb 2019-07-15 17:40:21 +08:00
1181b6ae3a add MarshalJSON interface implements for garray/gmap/gtime/gvar/gtree 2019-07-13 17:48:16 +08:00
8a7f4ab156 RELEASE updates 2019-07-13 17:18:48 +08:00
99d43a7ddc comment updates for gmutex 2019-07-13 16:56:20 +08:00
bd97d7d94e improve gmutex 2019-07-13 16:41:23 +08:00
73235f1967 修复gvalid多条数据校验时,规则key没有对应校验数据导致校验异常的问题。 2019-07-13 15:20:41 +08:00
1ebc8092a6 Merge pull request #6 from gogf/master
sync master
2019-07-13 14:30:34 +08:00
edd93c39a3 improve gerror 2019-07-13 14:24:44 +08:00
88c43d1772 Merge pull request #5 from gogf/master
sync master
2019-07-13 12:35:33 +08:00
a0a8eb4700 TagMapField改回调用MapField 2019-07-13 11:47:20 +08:00
28e5c33e81 comment updates for gdb 2019-07-13 11:35:22 +08:00
f24847576d 先移除新增的两个gvalid的test文件。 2019-07-13 10:52:02 +08:00
dfaf27e9e5 先还原对gvalid.Check()的修改。 2019-07-13 10:50:01 +08:00
32d5b28423 先还原对gvalid.Check()的修改。 2019-07-13 10:48:46 +08:00
0b8ca3313e 矫正gvalid.CheckStruct()字段别名记录的注释。
优化gvalid.CheckStruct()中属性的tag解析循环。
2019-07-13 10:47:52 +08:00
e6bb5e82a3 version updates 2019-07-13 09:57:40 +08:00
a24b97b004 Merge branch 'feature_1.8.0' of https://github.com/gogf/gf 2019-07-13 09:57:10 +08:00
08eeff7f1c RELEASE updates 2019-07-13 09:55:10 +08:00
769f31e69a RELEASE updates 2019-07-13 09:53:53 +08:00
cdf92b64d6 Merge pull request #4 from gogf/master
sync master
2019-07-13 09:22:12 +08:00
6d1ca028e7 fix issue in unit test case for ghttp 2019-07-12 23:20:36 +08:00
a228356399 RELEASE updates 2019-07-12 22:57:40 +08:00
3521f1b641 add more unit test cases for gdb for slice parameter feature 2019-07-12 22:37:49 +08:00
1dedf3d83b RELEASE updates 2019-07-12 22:33:34 +08:00
da4c01c011 Merge branch 'master' of https://github.com/gogf/gf into feature_1.8.0 2019-07-12 22:02:16 +08:00
9cd445ad40 improve gvalid tag for gvalid package 2019-07-12 21:37:48 +08:00
ff4ef7e240 Merge pull request #247 from 2892931976/gf-chj 2019-07-12 21:02:19 +08:00
4de574ee86 auto create struct for ghttp.Request.GetToStruct 2019-07-12 20:56:45 +08:00
0481b4025b gvalid test 20190712 10:20 2019-07-12 10:23:28 +08:00
9495b858fd RELEASE updates 2019-07-11 21:28:06 +08:00
5576adbd0b update ghttp. 2019-07-11 19:47:15 +08:00
b8da86bce8 Merge pull request #243 from iReadX/dev 2019-07-11 19:45:49 +08:00
a926d3dadd merge master 2019-07-11 19:06:32 +08:00
a95624ab19 add big-endian support for gbinary; improve gdb for bit type support 2019-07-11 18:58:31 +08:00
cf745422f3 Fixed use cname in gvalid tag.
Added gvaild data type support for array, slice, map.
Added array, slice, map data test in gvaild unit test.
2019-07-11 15:41:10 +08:00
10e042454c fix issue in bit type conversion for mssql in gdb 2019-07-11 15:41:06 +08:00
yc
759be06ebc Function BuildParams add 'UnUrlEncode' param, default false. 2019-07-11 10:02:44 +08:00
aea37272ea merge master 2019-07-10 23:16:39 +08:00
2f17d37f7b add v tag for gvalid; add p tag for ghttp; add c tag for gconv 2019-07-10 23:04:04 +08:00
df8623c4e2 Merge pull request #3 from gogf/master
sync master
2019-07-10 10:30:21 +08:00
5c9766fb1b Merge pull request #235 from jroam/master 2019-07-09 21:04:37 +08:00
a3d2e03425 merge master 2019-07-09 15:49:09 +08:00
717dae8f5d improve unit test cases for gpool 2019-07-09 15:41:50 +08:00
373dbde42c version updates 2019-07-09 15:36:04 +08:00
125af33941 gvalid and gfcache test 20190709 15:06 2019-07-09 15:10:02 +08:00
b43e36a79d improve configuraion style for gdb 2019-07-09 15:08:26 +08:00
145fccdf6e improve configuraion style for gdb 2019-07-09 14:50:56 +08:00
f9c478f250 improve package feature for gtcp 2019-07-09 14:03:43 +08:00
5da822fdc4 add some garray unit tests 2019-07-09 13:41:38 +08:00
5abf1b5742 Merge branch 'feature_1.8.0' of https://github.com/gogf/gf into feature_1.8.0 2019-07-09 13:27:34 +08:00
9ac3841342 add time.Duration parameter support for gfcache 2019-07-09 13:19:28 +08:00
1f315c5b8d add time.Duration parameter support for gcache 2019-07-09 13:15:53 +08:00
b9440587d0 add Offset function for gdb.Model; improve schema changing feature for gdb 2019-07-09 12:50:38 +08:00
835a971f89 add slice parameter support for method operations for gdb 2019-07-09 12:04:24 +08:00
0bba2092af add one slice passing all parameters support for gdb.Model.Where 2019-07-09 11:34:45 +08:00
c3240218f8 merge master 2019-07-09 11:11:49 +08:00
9e392985b8 Merge branch 'feature_1.8.0' of https://github.com/gogf/gf into feature_1.8.0 2019-07-09 11:11:03 +08:00
a7d30dd1d5 improve gfile 2019-07-09 11:02:33 +08:00
fa96d881e1 Merge pull request #232 from skiy/feature-filecopy 2019-07-09 10:55:11 +08:00
9ca9d6c4bd add Cause function for gerror 2019-07-09 10:40:26 +08:00
7ad66db491 README updates 2019-07-09 10:27:47 +08:00
1dbda3872b README updates 2019-07-09 10:25:59 +08:00
3619a46f52 README updates 2019-07-09 10:23:25 +08:00
6a93d166c5 improve gjson/gparser/gvar/gcfg with adding more converting functions 2019-07-09 09:43:53 +08:00
c84e62febe add morte unit test cases for gdb.Model 2019-07-09 08:47:23 +08:00
8ff21d6936 adding support of slice parameters for gdb.Model.Where 2019-07-09 08:40:28 +08:00
3b0012ec30 fix issue in gbase64.Decode 2019-07-09 08:07:50 +08:00
62a3f1693d add some garray tests 2019-07-08 23:25:47 +08:00
ed6796dde0 Update garray_z_unit_string_test.go 2019-07-08 17:53:57 +08:00
46721d7552 update garray unit tests. 2019-07-08 17:34:32 +08:00
a9a5a78e02 Merge pull request #39 from gogf/master
日常更新
2019-07-08 16:04:20 +08:00
7c4431ceeb add copyfile & copydir test 2019-07-08 11:37:02 +08:00
8cfdc8f27f file and folder copy 2019-07-08 01:26:00 +08:00
691baf5c16 comment updates 2019-07-07 09:47:33 +08:00
8669057681 remove debug line 2019-07-06 21:44:31 +08:00
b439aedce5 RELEASE updates 2019-07-06 17:35:03 +08:00
2504e405a7 add sql.ErrNoRows feature for querying of gdb 2019-07-06 17:13:17 +08:00
6426409bf9 add debug configuration support for gdb 2019-07-06 16:51:50 +08:00
9cf4ea5c91 rename Priority to Weight for gdb 2019-07-06 16:14:45 +08:00
86343abcf8 merge master 2019-07-06 16:02:05 +08:00
d0fe2d2f75 fix issue in gdb.Model.Scan 2019-07-06 15:51:32 +08:00
49ef4fd266 add more example for gconv.Map 2019-07-06 15:02:02 +08:00
929a57ceb8 add Structs/StructsDeep function for gconv; add auto-creating struct/struct pointer for gconv.Struct function when parameter pointer is typeof **struct 2019-07-06 11:10:32 +08:00
c6f94ed95a Update garray_z_unit_string_test.go 2019-07-05 15:27:56 +08:00
949ac459fc Update garray_z_unit_string_test.go 2019-07-05 15:07:28 +08:00
32fc6868aa Merge pull request #2 from gogf/master
sync master
2019-07-05 08:58:19 +08:00
82394cd70e Update garray_z_unit_string_test.go 2019-07-04 22:49:50 +08:00
4670a5d2e2 TODO++; version updates 2019-07-04 19:22:11 +08:00
273d992493 fix issue in gfsnotify in recursive inotify watcher registering 2019-07-04 19:06:06 +08:00
1c71340719 gfcache test 20190704 15:00 2019-07-04 15:03:56 +08:00
ed61c2ee22 improve gconv.Map for priority tags 2019-07-04 14:27:43 +08:00
363dede57c gvalid test 20190704 11:16 2019-07-04 11:19:59 +08:00
b29c6add47 rename internal/structtag to internal/structs; add more feature for internal/structs; improve gvalid to support recursive validation for struct; improve gconv.Struct/Map functions 2019-07-04 11:11:41 +08:00
8d01e565c5 gfsnotify example updates 2019-07-03 22:27:50 +08:00
47e0fb95d5 add package internal/structtag; improve ghttp.Request.Get*ToStruct functions to support substruct with 'param' tag; improve gtest.compareMap; improve gconv.Map using internal/structtag 2019-07-03 22:09:35 +08:00
23d346b291 improve gdb.Model.Struct/Structs/Scan in error handling, it returns sql.ErrorNoRows if no records received after querying 2019-07-03 19:38:52 +08:00
105cdf6fe6 20190703 14:25 2019-07-03 14:28:20 +08:00
5135264d56 Merge branch 'develop' of https://github.com/gogf/gf into develop 2019-07-03 14:25:49 +08:00
c3ff1a3db3 merge master 2019-07-03 14:25:29 +08:00
d62c1dedf3 Merge pull request #1 from gogf/master
sync master
2019-07-03 11:03:54 +08:00
bd105a188f Merge pull request #38 from gogf/master
日常更新
2019-07-03 10:29:43 +08:00
09affd3981 update tests 2019-07-03 10:20:40 +08:00
8e7e18e22d update test 2019-07-03 10:17:17 +08:00
e03fd80fd4 sync gf master 2019-07-03 10:02:17 +08:00
adc3201dcf Update garray_z_unit_string_test.go 2019-07-03 09:39:16 +08:00
3a681e5b1a Update garray_z_unit_string_test.go 2019-07-03 09:21:37 +08:00
c90ed0d424 comment updates for gfsnotify 2019-07-02 23:57:49 +08:00
418cbb420b TODO updates; version updates 2019-07-02 23:48:38 +08:00
c948f0c287 improve gdb.Update/Delete feature to support orderby/limit features 2019-07-02 23:14:40 +08:00
285b45d19d Update garray_z_unit_string_test.go 2019-07-02 22:37:06 +08:00
783f1c8457 Update garray_z_unit_string_test.go 2019-07-02 22:27:31 +08:00
daa7f12994 Update garray_z_unit_string_test.go 2019-07-02 22:22:51 +08:00
e63e989d41 fix issue of dead lock in gcache.doSetWithLockCheck 2019-07-02 19:22:06 +08:00
31921905a9 update unit test cases for gaes because of changes of gbase64 2019-07-02 17:40:16 +08:00
5572ab858e improve gbase64 2019-07-02 17:30:18 +08:00
961ca0879d improve gbase64 2019-07-02 16:56:10 +08:00
5d464494b6 Update garray_z_unit_string_test.go 2019-07-01 22:26:20 +08:00
4ca2513d00 Merge pull request #37 from gogf/master
日常更新
2019-07-01 20:49:44 +08:00
15d69ed950 sync gf master 2019-07-01 20:41:13 +08:00
39bd2616c4 add go.sum to gitignore 2019-06-30 22:22:24 +08:00
6302789c41 improve package gerror; add support for gerror formating output in glog 2019-06-30 22:21:08 +08:00
0ff31012c8 donator updates 2019-06-30 19:31:18 +08:00
5c7b25c960 add some tests 2019-06-30 13:03:22 +08:00
10102f2db9 improving gerror 2019-06-30 12:54:06 +08:00
6f5b5e4dc2 Update garray_z_unit_int_test.go 2019-06-30 12:52:30 +08:00
007c8a7b64 Merge branch '完善garray测试' 2019-06-30 12:44:57 +08:00
009ce9063e improve gerror/glog 2019-06-29 23:35:32 +08:00
58a405bfa8 add package gerror; improve internal/debug,glog package 2019-06-29 18:17:33 +08:00
42214f17fc Update garray_z_unit_int_test.go 2019-06-29 18:16:40 +08:00
b5f117e932 Merge branch '完善garray测试' of https://github.com/jroam/gf into 完善garray测试 2019-06-29 17:58:24 +08:00
b0f158047c Update garray_z_unit_int_test.go 2019-06-29 17:48:44 +08:00
d5f7ca634d add package internal/debug; add gutil.Stack/PrintStack; rename Backtrace to Stack for glog 2019-06-29 10:45:50 +08:00
aa6110c619 Merge branch 'master' of https://github.com/gogf/gf 2019-06-27 14:33:57 +08:00
a9660fe9fa add valid tag for gvalid 2019-06-27 14:33:39 +08:00
0801245871 sync gf master 2019-06-27 10:35:56 +08:00
278fd3515f edit garray of tests 2019-06-27 10:21:49 +08:00
56588f3f7f add some garray unit tests 2019-06-26 23:29:47 +08:00
a5d01cb547 sync gf master 2019-06-26 23:08:36 +08:00
fabf5d1ad5 Update gmd5.go 2019-06-26 22:57:03 +08:00
ebae3a4929 Update gudp_conn.go 2019-06-26 22:55:19 +08:00
8e6640ed79 Merge pull request #199 from pibigstar/master 2019-06-26 22:50:43 +08:00
e4c42bde89 edit some imports 2019-06-26 22:42:05 +08:00
f7515edde9 Merge pull request #36 from gogf/master
improve ghttp.Client
2019-06-26 22:02:43 +08:00
2b0da75412 improve ghttp.Client 2019-06-26 13:55:23 +08:00
04c422c3af Merge branch 'master' into 完善garray测试 2019-06-26 10:00:40 +08:00
339ca74ff4 Merge branch 'master' of https://github.com/gogf/gf into gogf-master 2019-06-26 09:59:00 +08:00
741a13379a edit some garray inut tests 2019-06-26 09:53:41 +08:00
da907f35bd improve group router for ghttp 2019-06-25 23:26:47 +08:00
133531b6a0 README updates 2019-06-25 23:17:14 +08:00
5fa0f8dd7e up 2019-06-25 23:06:12 +08:00
7247413a48 Merge branch 'master' of https://github.com/gogf/gf 2019-06-25 23:03:39 +08:00
591158adc5 improve router registry for ghttp 2019-06-25 23:03:29 +08:00
5d83383105 Merge pull request #212 from hailaz/master 2019-06-25 23:02:06 +08:00
5ad809f49e vet the go format 2019-06-25 19:26:02 +08:00
56a62bb4c2 gofmt 2019-06-25 19:01:27 +08:00
afb4a233be Merge pull request #215 from 2892931976/gf-chj 2019-06-25 19:00:02 +08:00
c0aebe023c remove example codes for gcanner 2019-06-25 18:40:55 +08:00
055c6a668e add some garray tests 2019-06-25 18:17:10 +08:00
735c5fc7ed add some garray tests 2019-06-25 16:32:12 +08:00
c066fff971 仓库位置更改 2019-06-25 16:03:14 +08:00
89373ebcd6 增加代码风格检查 2019-06-25 16:03:14 +08:00
51cf232691 gutil test 20190615 15:47 2019-06-25 15:50:06 +08:00
3bfff2347f Merge branch 'master' into 完善garray测试 2019-06-25 09:34:17 +08:00
7d83604540 Merge branch 'pr/34' 2019-06-25 09:26:30 +08:00
f25571a0a9 Improve gmlock, gmutex, grpool, gmutex unit testing sleep time. 2019-06-24 19:34:53 +08:00
05c7ba5f29 improve ghttp.CORSDefault 2019-06-24 19:05:07 +08:00
dcf7772589 Improve gmlock, gmutex unit testing sleep time. 2019-06-24 18:04:35 +08:00
3806f9db07 Improve gflock unit testing. 2019-06-24 17:33:56 +08:00
0f14002b05 Improve gflock unit testing. 2019-06-24 17:17:24 +08:00
1bf53d8b89 Improve gflock unit testing. 2019-06-24 17:15:46 +08:00
8eb10a58ad Improve gflock. 2019-06-24 17:15:30 +08:00
9985378062 rename gmutex unit test file. 2019-06-24 15:04:33 +08:00
38ad5d457b Improve grpool unit testing. 2019-06-24 15:01:12 +08:00
ebed433dde Merge pull request #209 from guoyahao/master 2019-06-24 13:41:18 +08:00
2b02f7e210 Improve gmutex unit testing. 2019-06-24 12:50:00 +08:00
1434800982 Improve gmlock unit testing. 2019-06-24 09:27:31 +08:00
327e33b827 gutil test 20190623 20:41 2019-06-23 20:44:03 +08:00
d2a053c1d7 no message 2019-06-23 17:53:10 +08:00
abe14e049a gutil test 20190623 16:42 2019-06-23 16:45:30 +08:00
4b9db0c794 fix issue for gmd5/gcrc32 2019-06-22 23:06:44 +08:00
b118cd8f27 README updates 2019-06-22 22:06:39 +08:00
83669964f5 README updates 2019-06-22 22:06:13 +08:00
9248fd6b28 add internal/errors 2019-06-22 22:05:39 +08:00
bb935967ac add MarshalJSON function for gjson/gparser to implements the interface MarshalJSON for json.Marshal 2019-06-22 17:02:36 +08:00
b7e0f1f983 improve grpool 2019-06-22 15:05:15 +08:00
6ee6c007c5 update gmutex and its benchmark test cases 2019-06-22 14:42:27 +08:00
9a507b54d7 add Remove/Clear functions for gmlock 2019-06-22 11:45:58 +08:00
c88f516759 remove mutex usage from gflock 2019-06-22 11:29:51 +08:00
912b743a1e improve Range/SubSlice functions for garray 2019-06-22 11:03:50 +08:00
d546424f18 improve gmutex 2019-06-21 22:37:07 +08:00
fe179fff42 gofmt 2019-06-21 22:23:07 +08:00
adf2ddb510 继续完善garray的测试 2019-06-21 17:46:42 +08:00
f30c9020fa Merge branch 'master' into 完善garray测试 2019-06-21 14:08:54 +08:00
1b3073f3f9 Merge pull request #33 from gogf/master
日常更新
2019-06-21 14:05:46 +08:00
615161ac9d 继续增加garray测试 2019-06-21 14:04:52 +08:00
02e06e7c6e improve unit test cases for gmlock.Mutex 2019-06-20 09:20:41 +08:00
d15268eb22 improve codes 2019-06-20 00:04:06 +08:00
e48415d932 README updates 2019-06-19 23:58:50 +08:00
e5fa341f39 improve codes 2019-06-19 23:56:14 +08:00
234d734981 Merge pull request #201 from hailaz/master 2019-06-19 23:32:22 +08:00
d771ed9209 improve codes 2019-06-19 23:28:37 +08:00
37d72cb8b3 完善garray单元测试 2019-06-19 18:19:31 +08:00
1154f9601b Improve gmlock unit testing. 2019-06-19 17:50:50 +08:00
322513f99b Merge pull request #9 from gogf/master
同步主库
2019-06-19 15:14:58 +08:00
6e7ac60d4d README updates 2019-06-19 15:06:15 +08:00
405840607f fix issue in gmlock.Mutex.TryRLock 2019-06-19 15:04:50 +08:00
8417e7ef65 Merge branch 'gogf-master' 2019-06-19 11:44:17 +08:00
ac2fe44d8e 同步主库 2019-06-19 11:43:59 +08:00
3030d7f032 同步主库 2019-06-19 11:11:00 +08:00
dcf7138694 README updates 2019-06-19 09:09:13 +08:00
97df154b78 gofmt 2019-06-19 09:06:52 +08:00
d74034e08e Update garray_z_unit_int_test.go 2019-06-18 23:20:46 +08:00
674590e247 improve ghttp.RouterGroup 2019-06-18 22:04:17 +08:00
d41cc7c3b6 Merge pull request #32 from gogf/master
日常更新
2019-06-18 21:45:01 +08:00
ab48800401 improve gaes 2019-06-18 20:58:47 +08:00
ea456c5faa DONATOR updates 2019-06-18 20:52:24 +08:00
83d1442781 change strings.ReplaceAll to strings.Replace to adapt go1.11 2019-06-18 19:44:28 +08:00
5888b0e06a fix issue in gmlock 2019-06-18 19:19:43 +08:00
3120d0bd7a Merge pull request #6 from gogf/master
同步主库
2019-06-18 17:58:47 +08:00
a7dcc2c9c6 improve gmlock 2019-06-18 17:39:28 +08:00
17898cc747 improve gmlock 2019-06-18 17:31:48 +08:00
7bebf062be Improve gmlock unit testing. 2019-06-18 11:46:43 +08:00
048c3d5025 Merge pull request #195 from zseeker/master
gaes encryption and decryption add CFB mode
2019-06-18 11:44:54 +08:00
0adcdc6b4a Merge pull request #192 from jroam/master 2019-06-18 11:42:44 +08:00
19d7ad734b Update gqueue_unit_test.go 2019-06-18 11:20:10 +08:00
6c657dff37 Merge pull request #5 from gogf/master
同步主库
2019-06-18 09:12:16 +08:00
78ccbeac3b add Cas function for gtype; improve gmlock 2019-06-18 08:37:21 +08:00
2a0eae8975 gaes encryption and decryption add CFB mode 2019-06-18 04:07:35 +08:00
28d25e7812 Update gqueue_unit_test.go 2019-06-17 23:16:22 +08:00
fe795d49f3 fix gfile test of a bug
fix  gfile test of bug
2019-06-17 22:46:36 +08:00
9fad898ee3 Update gqueue_unit_test.go 2019-06-17 22:03:41 +08:00
9a42142ce7 Merge branch 'master' of https://github.com/gogf/gf into gogf-master2 2019-06-17 21:51:38 +08:00
9db8ed2dfc README updates 2019-06-17 20:34:45 +08:00
619a539f2e update unit test cases for gfpool 2019-06-17 20:21:41 +08:00
ae8eb4a1f1 Merge branch 'master' of https://github.com/gogf/gf into develop 2019-06-17 20:20:25 +08:00
9a469e64da Merge pull request #187 from goflyfox/master 2019-06-17 20:19:58 +08:00
f7d1613d62 improve gqueue 2019-06-17 19:54:00 +08:00
80655bce50 add gfpool test:delete error 2019-06-17 18:39:27 +08:00
b3b0ba775c update gfpool test:error 2019-06-17 18:09:56 +08:00
4713739d1a update gfpool test:delete err 2019-06-17 17:52:10 +08:00
53b5de330e Update gqueue_unit_test.go 2019-06-17 11:40:40 +08:00
fd4843c3a1 Update gqueue_unit_test.go 2019-06-17 11:31:03 +08:00
97d2b9e1f9 Update gqueue_unit_test.go 2019-06-17 11:04:56 +08:00
5896dadaad Merge pull request #4 from gogf/master
同步主库
2019-06-17 09:20:58 +08:00
0ab60cb770 Update gqueue_unit_test.go 2019-06-16 23:26:49 +08:00
5b71e92776 Update gqueue_unit_test.go 2019-06-16 23:24:03 +08:00
211678c7d3 Merge branch 'master' into 测试gqueue 2019-06-16 23:16:18 +08:00
d25793ed03 Merge pull request #30 from gogf/master
fix issue in gqueue.Close
2019-06-16 23:14:02 +08:00
98cae011a5 fix issue in gqueue.Close 2019-06-16 23:10:50 +08:00
59ae6f9c10 Merge pull request #29 from gogf/master
日常更新
2019-06-16 23:06:59 +08:00
474d1669d9 fix issue in gqueue.Close 2019-06-16 23:00:47 +08:00
563a1408ea fix issue in gqueue.Close 2019-06-16 23:00:00 +08:00
168c08a6f6 Create gqueue_unit_test.go 2019-06-16 22:55:07 +08:00
82783072ef Merge pull request #28 from gogf/master
fix issue in gqueue.Close
2019-06-16 22:22:12 +08:00
11972ef96c fix issue in gqueue.Close 2019-06-16 22:19:59 +08:00
468ba21283 Merge pull request #27 from gogf/master
日常更新
2019-06-16 22:06:39 +08:00
78b0cae892 先取消本地测试 2019-06-16 22:05:15 +08:00
866482a8e8 fix issue in gqueue.Close 2019-06-16 21:52:41 +08:00
c342310389 add example for garray/gchan/glist 2019-06-16 20:38:05 +08:00
0eb028f0b5 README updates 2019-06-16 20:25:08 +08:00
4ffe4f2262 add returned error for ghttp.ClientResponse.Close 2019-06-16 18:54:48 +08:00
677549ec15 add some gqueue tests 2019-06-16 16:41:12 +08:00
68d8e25bc4 update gfpool test2 2019-06-16 00:07:06 +08:00
4f007fdd44 update gfpool test 2019-06-16 00:04:46 +08:00
54392941f3 add gfpool normal test 2019-06-15 23:45:58 +08:00
ebdad47f2d Merge pull request #181 from goflyfox/master 2019-06-15 23:00:47 +08:00
cb4e36f591 update rwmutex test2 2019-06-15 22:19:37 +08:00
cd30efaaa1 update gcmd test 2019-06-15 22:11:08 +08:00
7c234e0437 golint for gvar 2019-06-15 22:06:47 +08:00
d973c5d5c7 improve communication feature for gproc 2019-06-15 21:41:20 +08:00
a7f15a4e00 change gqueue unit tests 2019-06-15 21:40:36 +08:00
6b5484bf55 Merge branch 'master' into develop 2019-06-15 20:42:48 +08:00
ab38b709b2 add gqueue tests 2019-06-15 18:44:22 +08:00
4118038198 Merge branch 'master' into 测试gqueue 2019-06-15 18:36:54 +08:00
142154c0df add gqueue unit tests 2019-06-15 18:35:36 +08:00
07ae90d64d Merge pull request #26 from gogf/master
日常更新
2019-06-15 18:34:50 +08:00
8a69fd09fc Merge pull request #185 from hailaz/master 2019-06-15 18:34:34 +08:00
c02f502bd8 fix issue in gqueue.Size 2019-06-15 18:30:09 +08:00
d5d6b8c303 comment unused gbtree.BTree.isFull function 2019-06-15 18:03:07 +08:00
5c592afebe Improve gtree unit testing. 2019-06-15 17:51:48 +08:00
8402a2b710 Merge pull request #3 from gogf/master
同步主库
2019-06-15 16:57:46 +08:00
fe152dfa63 comment updates for gtree; fix issue in gtree.AVLTree.Remove 2019-06-15 16:53:36 +08:00
e695983d4d improving gproc 2019-06-15 16:07:36 +08:00
a5ab2ba332 gutil test 2019 06 15 14:20 2019-06-15 14:23:28 +08:00
c6e5a52104 add test file 2019-06-14 23:47:00 +08:00
1b4a879eda Merge pull request #182 from jroam/master 2019-06-14 23:09:33 +08:00
c5aa493d24 README updates 2019-06-14 20:42:15 +08:00
a88363e34c Merge branch '测试glist' 2019-06-14 14:58:33 +08:00
0f1261d0e3 完成glist测试率 2019-06-14 14:58:00 +08:00
c41d11df9f Merge pull request #25 from gogf/master
fix更新
2019-06-14 10:50:05 +08:00
1e680c7a8b fix issue in gcache 2019-06-14 10:44:56 +08:00
e981143ead fix issue in gspath 2019-06-14 10:35:12 +08:00
3e2d5e0bdb update mutex test2 2019-06-14 10:28:24 +08:00
1f19ed71aa update mutex test 2019-06-14 10:20:15 +08:00
4de6881c89 Merge pull request #24 from gogf/master
日常更新
2019-06-14 10:00:18 +08:00
5baa82da8f add gcmd test 2019-06-14 00:35:18 +08:00
48f610a216 add mutex and rwmutex test 2019-06-14 00:03:13 +08:00
e4e58791a6 add empty test 2019-06-13 23:50:12 +08:00
46c42ec249 add unit test cases for cmdenv/gcmd 2019-06-13 22:58:58 +08:00
d068c1418e Merge branch 'master' into develop 2019-06-13 22:40:20 +08:00
41db3a32f4 Merge pull request #180 from jroam/master 2019-06-13 22:37:19 +08:00
b3a00becf3 sort_int恢复成主库代码 2019-06-13 22:18:45 +08:00
d1d8cd8482 用gofmt格式化代码 2019-06-13 21:44:14 +08:00
1228907d59 comment updates for internal 2019-06-13 21:14:46 +08:00
57b54414d6 merge master 2019-06-13 21:00:14 +08:00
548a0c47af README updates 2019-06-13 20:52:36 +08:00
4934564b7b Merge pull request #179 from hailaz/master 2019-06-13 20:32:07 +08:00
7348d14fef shut error printing in unit test cases for gcfg/gview 2019-06-13 20:29:40 +08:00
9cddb7ed9a improve unit test cases for gparser 2019-06-13 20:21:18 +08:00
8c84de3f73 improve unit test cases for gparser 2019-06-13 20:20:43 +08:00
96529a4c1c update unit test cases for gjson/gcfg/gcompress/gparser 2019-06-13 19:41:43 +08:00
c7a729fe06 Merge branch 'master' of https://github.com/gogf/gf 2019-06-13 19:29:19 +08:00
23d404f681 add glog.Expose for glog; add Trim operation for glog.Logger.Write; fix issue in gjson.Remove for slice 2019-06-13 19:29:09 +08:00
887aeee2d4 Merge pull request #178 from piaohao/master 2019-06-13 19:09:55 +08:00
622dbfda31 完成garray测试覆盖率,达90%. 2019-06-13 17:02:30 +08:00
80cf3e833b 非test文件 恢复 原样 2019-06-13 12:41:20 +08:00
d305d25935 gparse测试用例 2019-06-13 12:30:35 +08:00
81502cfb6d gjson,gredis测试用例编写 2019-06-13 11:58:43 +08:00
5950a3fcc3 gpool unit test. 2019-06-13 11:42:51 +08:00
55f5e6d7aa improve gcharset 2019-06-12 23:50:37 +08:00
e2070e785c Merge pull request #23 from gogf/master
bug更新
2019-06-12 22:58:08 +08:00
905d5abed6 Merge pull request #171 from hailaz/master 2019-06-12 22:56:39 +08:00
211e06d04d Merge branch 'master' of https://github.com/gogf/gf into gogf-master 2019-06-12 22:56:23 +08:00
7aaf9e9228 fix issue in garray.Contains/New*ArrayFromCopy 2019-06-12 22:45:13 +08:00
a901e7177c 添加garray测试未完成 2019-06-12 22:37:17 +08:00
afc2bcfb28 gjson测试用例完善 2019-06-12 22:14:31 +08:00
8da204fbd8 remove test file of gchan 2019-06-12 21:10:49 +08:00
5aa3212fe1 gofmt geg/third 2019-06-12 21:06:57 +08:00
17d49510c4 add example for gcharset; fix issue in gxml 2019-06-12 21:02:00 +08:00
4af8ae1470 Merge branch 'master' of https://github.com/gogf/gf 2019-06-12 20:50:27 +08:00
3a5c660693 refract gcharset 2019-06-12 20:49:40 +08:00
9e65100a06 gcompress,gcfg,gparser模块测试用例编写 2019-06-12 19:22:02 +08:00
399e47c548 修改测试 2019-06-12 18:14:54 +08:00
abdf8e696c gtype unit test use AssertEQ replace Assert. 2019-06-12 17:52:30 +08:00
4a2e217625 Merge pull request #175 from 2892931976/gf-chj 2019-06-12 17:47:54 +08:00
52d0280137 Merge pull request #157 from wenzi1/master 2019-06-12 17:42:11 +08:00
5be9765eb7 add TODO for gfile.Search 2019-06-12 17:40:50 +08:00
cdb9488752 edit tests 2019-06-12 17:14:08 +08:00
0388113870 Merge branch 'master' of https://github.com/gogf/gf into gogf-master 2019-06-12 17:04:11 +08:00
c6dfb4d4f8 add some test 2019-06-12 16:52:02 +08:00
4a40b58b63 框架中增加字符集转换的标准库 2019-06-12 12:12:00 +08:00
407068a0bf add ghash basic test 2019-06-12 11:33:30 +08:00
165330ec68 gchan unit test 2019-06-12 11:21:10 +08:00
6e7d08fbfb fix issue in garray.Search 2019-06-12 10:11:54 +08:00
1ae77f56e5 添加garray测试代码 2019-06-11 23:32:08 +08:00
fccac04980 donator updates 2019-06-11 21:19:32 +08:00
469f9c7ce5 comment update for gflock 2019-06-11 21:14:48 +08:00
d6d37248f6 框架中增加字符集转换的标准库 2019-06-11 21:09:03 +08:00
cb1084b770 Merge branch 'master' of https://github.com/gogf/gf into develop 2019-06-11 20:59:17 +08:00
e6d4459992 comment update for gcache 2019-06-11 20:57:43 +08:00
1afb5a4bc5 框架中增加字符集转换的标准库 2019-06-11 19:41:26 +08:00
c124f172b2 Merge pull request #170 from piaohao/master 2019-06-11 19:32:57 +08:00
dbd4a7c1d4 框架中增加字符集转换的标准库 2019-06-11 19:28:24 +08:00
a4d30ef206 Merge branch 'qiangg_comment' into develop 2019-06-11 18:40:56 +08:00
0a616173ef add hash function for gview.ParseContent to improve performance in consurrent usage 2019-06-11 18:39:54 +08:00
597f210f85 去掉自动版本号 2019-06-11 18:11:47 +08:00
24bd83feb0 添加一些garray测试代码。 2019-06-11 18:11:17 +08:00
3855786905 gtype unit test 2019-06-11 17:49:29 +08:00
1f670a1ab2 gspath模块及gview模块测试用例编写 2019-06-11 17:49:05 +08:00
d97fda794c 框架中增加字符集转换的标准库 2019-06-11 17:25:30 +08:00
c034d25299 gspath模块及gview模块测试用例编写 2019-06-11 17:24:26 +08:00
dd6152fe8a 使用encoding库做字符集转换 2019-06-11 16:03:09 +08:00
485fe572ff 完成gset模块测试覆盖率90%以上。 2019-06-11 10:51:00 +08:00
15bf5d9a4d Merge pull request #2 from gogf/master
同步主线
2019-06-11 10:37:53 +08:00
08aa7c4e4c comment update for gcache 2019-06-10 23:54:40 +08:00
442c658be0 增加gset的测试支持
覆盖率达到85.1%
2019-06-10 23:38:19 +08:00
5aa8ce1c6b Merge branch 'master' into qiangg_comment 2019-06-10 23:09:32 +08:00
ad8ece68c6 Merge pull request #166 from zhongdalu/master 2019-06-10 23:03:27 +08:00
74525ba8f7 Merge pull request #164 from goflyfox/master
add gregex,gaes,gcrc32 test
2019-06-10 23:01:26 +08:00
46d46afaaf add gaes test:update assert type 2019-06-10 22:42:46 +08:00
13eb1150a5 fix issue in gfile.MainPkgPath 2019-06-10 21:32:40 +08:00
f98db6d21c comments for gcache update 2019-06-10 21:23:49 +08:00
zdl
c695dfd92e delete go version 2019-06-10 20:52:06 +08:00
zdl
ffd78d76e1 添加 genv 测试 1 2019-06-10 20:44:30 +08:00
zdl
e479c41667 添加 genv 测试 2019-06-10 20:24:11 +08:00
9f8c481992 Merge pull request #167 from piaohao/master 2019-06-10 20:21:41 +08:00
3320d12994 gcache测试用例完善 2019-06-10 19:58:00 +08:00
be6f522cf3 add gaes test4:optimize Encrypt Decrypt test 2019-06-10 19:53:07 +08:00
zdl
b0b6871bbb 添加 genv 测试 2019-06-10 19:50:45 +08:00
59ae6217cd add gaes test3: add encrypt assert content 2019-06-10 19:37:02 +08:00
334cd7ad51 add gregex test 2019-06-10 18:59:42 +08:00
501c3680d9 add gaes test 2019-06-10 17:26:32 +08:00
ebcc81c1ee Merge pull request #19 from gogf/master
日常更新
2019-06-10 16:12:51 +08:00
6814372a89 add gcrc test2 2019-06-10 15:55:43 +08:00
zdl
d5d14b7efc test gset TestSet_New 2019-06-10 15:49:43 +08:00
3a72686774 add gcrc test 2019-06-10 15:05:11 +08:00
aa73c5ed53 version updates 2019-06-10 09:01:19 +08:00
cc0a385c22 RELEASE updates 2019-06-09 11:56:58 +08:00
0b8c9713e6 improve grpool 2019-06-09 10:37:35 +08:00
e400a94ffb improving grpool 2019-06-09 10:33:16 +08:00
136ad3b0b5 add more unit test cases for hook feature of ghttp.Server 2019-06-08 19:38:46 +08:00
f9826104d8 improve gconv 2019-06-08 19:25:20 +08:00
c0c97b76fb update lead string position for glog 2019-06-07 23:00:34 +08:00
a908e4d4b1 fix issue in session initialization for ghttp.Server 2019-06-07 22:27:37 +08:00
e5c255200c 框架中增加字符集转换的标准库 2019-06-06 15:19:18 +08:00
00db4f5ed9 优先使用标准库的左字符集转换,标准库不支持的使用mahonia做转换 2019-06-06 15:11:32 +08:00
29ead3ff3e Merge pull request #4 from gogf/master
update
2019-06-06 14:52:12 +08:00
055074246e add TryLockFunc/TryRLockFunc for gmlock.Mutex 2019-06-05 23:50:24 +08:00
4bbe51fb4b add Close function for gtcp.Server/gudp.Server 2019-06-05 22:12:22 +08:00
841224372b update comment for gmlock 2019-06-05 21:58:27 +08:00
d1f0fa1a47 fix issue in concurrent safety for gview.Parse; rename glog.*fln functions to glog.*f 2019-06-05 20:22:57 +08:00
6fecf8bb01 update example 2019-06-05 18:41:11 +08:00
6d44f02a38 fix issue in internal/empty 2019-06-05 18:40:26 +08:00
1458e486d7 v1.6.17 2019-06-04 23:39:33 +08:00
dc29822e69 improve gtcp; add tls support for gtcp 2019-06-04 23:33:46 +08:00
dae7722da1 Merge branch 'master' into develop 2019-06-04 18:35:06 +08:00
16d978dc58 fix issue in gfile.MainPkgPath 2019-06-04 18:30:02 +08:00
5d3c154b45 improve gtcp 2019-06-04 18:26:32 +08:00
00a8ef63b6 improve gtcp 2019-06-03 23:53:59 +08:00
6ac437a3a5 merge master 2019-06-03 21:33:16 +08:00
33b24eba01 Merge pull request #147 from jroam/master 2019-06-03 21:00:26 +08:00
3a99c6e5f5 improve TryCatch function for gutil 2019-06-03 20:58:30 +08:00
4c5d2839bd donators updates 2019-06-03 20:34:19 +08:00
85b104bafa update benchmark test cases for gregex 2019-06-03 16:59:33 +08:00
74e5d03a78 Modify documentation 2019-06-03 16:55:18 +08:00
cc43324ede modify some instructions. 2019-06-03 16:41:27 +08:00
e4f9e1000d fix issue in status handler for ghttp.Server 2019-06-03 16:39:45 +08:00
62829b0698 modify some instructions 2019-06-03 16:39:39 +08:00
2551e990cb add gtime formats of 'U' 2019-06-03 16:30:34 +08:00
45c34319b5 Merge pull request #18 from gogf/master
日常更新
2019-06-03 09:28:29 +08:00
75dcc566b3 improve grpool to ensure atomicity for function Add 2019-06-03 09:09:40 +08:00
4f1047e853 add KeepAlive configuration for ghttp.Server 2019-06-02 22:19:52 +08:00
79f765c961 update example for gconv 2019-06-02 16:34:31 +08:00
eead2fad2c version updates 2019-06-02 13:46:05 +08:00
455c9e09ab README updates 2019-06-02 13:45:21 +08:00
4665c3565c README updates 2019-06-02 13:44:24 +08:00
7456b4b4ad README updates 2019-06-02 13:43:11 +08:00
32a6454065 README updates 2019-06-02 13:40:42 +08:00
c52640c672 README updates 2019-06-02 13:32:03 +08:00
d62ef17290 improve glog 2019-06-01 22:36:12 +08:00
216af6a662 updates glog 2019-06-01 20:34:57 +08:00
35d860427e add GetLastSql function for gdb 2019-06-01 20:31:29 +08:00
9206574bae add json tag most priority for gjson.New 2019-06-01 20:01:45 +08:00
9c6f54131f updates unit test cases for gdb,grpool 2019-06-01 19:37:00 +08:00
d67b95c593 add async logging feature for glog 2019-06-01 19:34:03 +08:00
2bf2f1b822 improve grpool 2019-06-01 15:11:32 +08:00
9ad94eccad add json output support for glog 2019-06-01 11:01:57 +08:00
6e8a900f25 fix issue in gjson/gparser in loading xml content; add *time.Time support for gdb 2019-06-01 00:02:05 +08:00
d9aa9e4480 improve grpool 2019-05-31 22:54:57 +08:00
fe74818a37 Merge pull request #3 from gogf/master
update
2019-05-29 16:32:20 +08:00
7335126064 mark deprecated for *fln functions of glog; fix issue in gfile.MainPkgPath in Windows 2019-05-29 15:18:12 +08:00
945dd71251 TODO updates 2019-05-29 11:53:10 +08:00
652aa29370 Merge branch 'master' of https://github.com/gogf/gf into develop 2019-05-29 11:26:27 +08:00
7034e2015e add FormatTo/LayoutTo functions for gtime; use custom ExpireFunc to close poool items when pool is close for gpool 2019-05-29 11:25:11 +08:00
0a890ad871 Merge branch 'qiangg_gdb_struct_inherit' into develop 2019-05-28 21:41:23 +08:00
b52bb1124e Merge branch 'master' into develop 2019-05-28 21:41:08 +08:00
41f33af51b add gconv.StructDeep/MapDeep functions for gconv; add struct inherit converting support for gdb 2019-05-28 21:41:00 +08:00
6b4763c7da Update README.MD
README updates.
2019-05-27 11:00:04 +08:00
be07889a45 Merge branch 'develop' into qiangg_gdb_struct_inherit 2019-05-24 20:07:20 +08:00
1b3243c09c comment update for gfile/gaes/gcrc32/gdes/gmd5/gsha1 2019-05-24 19:59:08 +08:00
fee1c9eccf Create FUNDING.yml 2019-05-24 19:24:25 +08:00
084f6c31cb comment updates for gfile 2019-05-23 21:58:04 +08:00
592bf76eb0 add browser mode support for ghttp.Client.Post 2019-05-23 21:20:46 +08:00
6f0aee1cc5 version updates 2019-05-23 20:43:09 +08:00
3575e20137 update Writer feature of glog 2019-05-23 20:34:06 +08:00
f69f529258 Merge branch 'master' into develop 2019-05-23 19:14:19 +08:00
3e7416ca7d add Skip for glog 2019-05-23 19:14:16 +08:00
cf324c5d8c Merge pull request #2 from gogf/master
update
2019-05-23 13:05:52 +08:00
9da883a50c comment updates 2019-05-23 11:49:33 +08:00
ea3e03aaba example updates for glog 2019-05-23 09:26:37 +08:00
8d9fdfeafc change parameter to unnecssary for glog.Header/Stdout; version updates 2019-05-22 21:43:56 +08:00
b2a8285ecb remove unnecessary pkg gscanner; update comment for gsmtp 2019-05-22 21:20:17 +08:00
162e8f7e51 comment updates for glog 2019-05-22 20:31:14 +08:00
6c658813cd refract glog to improve performance 2019-05-22 09:19:21 +08:00
0839ea385f refract glog to improve performance; 2019-05-21 23:57:03 +08:00
68fa235412 add gjson.GetJsonMap; refract glog to improve performance; 2019-05-21 21:52:17 +08:00
417ce4b470 Merge branch 'master' into qiangg_gdb_struct_inherit 2019-05-20 18:33:45 +08:00
48deaa5f57 improving package feature for gtcp 2019-05-20 08:59:16 +08:00
e9f7b8bc0c README updates 2019-05-18 14:55:15 +08:00
e31861af2e README updates 2019-05-18 13:52:18 +08:00
1af482d950 improve gfile.MainPkgPath 2019-05-17 21:37:48 +08:00
dd2436925b remove package feature for gudp, considering UDP protocal has its own border for message handling 2019-05-17 00:17:45 +08:00
b92b69564b improve gfile.MainPkgPath 2019-05-16 23:41:09 +08:00
a4fa163333 Merge pull request #1 from gogf/master
update
2019-05-16 15:08:08 +08:00
635d228c86 adding inherit struct support for gdb 2019-05-16 13:56:49 +08:00
75725db6fb remove gmlock for print of glog; add time.Time support for gdb 2019-05-15 23:53:48 +08:00
5cd8475143 add time.Time support for convertParam function of gdb 2019-05-15 16:47:39 +08:00
5629f37939 version updates 2019-05-14 22:38:03 +08:00
08ec04d8b6 fix issue in unit test case of gredis 2019-05-14 22:37:13 +08:00
c0b46f364a version updates 2019-05-14 22:02:09 +08:00
303d03d43c Merge pull request #17 from gogf/master
日常更新。
2019-05-14 21:36:00 +08:00
8c5f74e8bb add DoVar/ReceiveVar function for gredis 2019-05-14 21:34:38 +08:00
94832262e3 version updates 2019-05-13 22:37:31 +08:00
aefbfd52e9 add more example for gtree 2019-05-13 22:37:05 +08:00
f3f0689bd4 rename LinkMap to ListMap for gmap 2019-05-13 22:26:39 +08:00
5198d4c5fc add unit test cases for gtree.AVLTree/BTree 2019-05-12 22:56:13 +08:00
123f2d3e4e remove return value from RLockFunc/LockFunc for gset 2019-05-12 21:26:01 +08:00
3c750c3c92 copy treemap logics to new file 2019-05-12 21:22:07 +08:00
17b29cd19f improve performance for Map/Keys/Values functions for gmap; add unit test cases for gtree.RedBlackTree 2019-05-12 21:11:26 +08:00
cf1077bec4 add LinkMap for gmap package 2019-05-12 20:43:52 +08:00
4e2e4e95e0 add gmap.HashMap/TreeMap/AnyAnyMap for gmap; add unit test cases for TreeMap 2019-05-11 20:47:25 +08:00
61d64e7ae4 remove gvar.VarRead 2019-05-11 18:47:35 +08:00
883797c495 fix issue in gconv 2019-05-11 18:03:49 +08:00
0113971877 version updates 2019-05-11 17:59:56 +08:00
664b0c06a6 gjson updates 2019-05-11 17:56:14 +08:00
bd4c75a98e add AVLTree container for gtee 2019-05-10 22:29:06 +08:00
d35840409b add BTree container for gtree package 2019-05-10 21:31:35 +08:00
abaef9ba87 add gtree.RedBlackTree container 2019-05-10 13:38:06 +08:00
b15d8bdd2e adding gtree.RedBlackTree 2019-05-09 22:53:42 +08:00
718997327a add default value for gcfg.Get* functions; rename gconv.TimeDuration to gconv.Duration, and do corresponding changes to caller packages 2019-05-09 17:14:24 +08:00
fdfefbb94d add default value feature for gjson/gparser; update default value type for ghttp.Request 2019-05-09 14:19:27 +08:00
2b865a55ac update gjson/gparser 2019-05-08 22:04:36 +08:00
8138215597 comments update 2019-05-08 21:03:04 +08:00
7cc0c7a1cc rename map type of gmap; rename BatchSet/BatchRemove to Sets/Removes for gmap/gcache 2019-05-08 17:21:18 +08:00
50f561dbd2 Merge pull request #16 from gogf/master
日常更新
2019-05-08 13:36:03 +08:00
4c647aaa19 refacting gmap 2019-05-07 22:28:34 +08:00
48b1d616c5 update code format for gtime 2019-05-07 10:22:50 +08:00
693c37d6d6 Merge pull request #116 from jroam/master
add some var flags gtime.format
2019-05-07 10:18:22 +08:00
d525c04826 公开几个常用功能方法 2019-05-06 15:03:14 +08:00
c170edbdfc add ghttp.Request.GetUrl to get current request URL 2019-05-06 13:52:34 +08:00
66e40155a9 add http/https scheme for log of ghttp.Server; add transport setting to ignore tls cert for ghttp.Client; version updates 2019-05-06 09:35:39 +08:00
59ad1a9b00 fix issue in incorrect every running logics of gcron.AddOnce 2019-05-05 22:57:13 +08:00
a5b536e218 去掉不常用参数e 2019-05-05 22:49:52 +08:00
0e6c2e790d copy mysql driver to third folder 2019-05-04 23:02:07 +08:00
5761e73061 优化一些参数性能 2019-05-04 18:14:05 +08:00
34c761e9db rename mysql driver from 'mysql' to 'gf-mysql' to avoid multiple imports error 2019-05-04 00:25:02 +08:00
87e3813636 remove go-sql-driver-mysql from third, add Register function to manually register 'mysql' driver 2019-05-04 00:10:02 +08:00
361ff0315c version updates 2019-05-03 17:04:42 +08:00
2bb227d058 update gtcp exxamples 2019-05-03 15:47:25 +08:00
99dc69e839 update gtcp exxamples 2019-05-03 13:28:27 +08:00
d78fde8099 edit a func's name 2019-04-30 22:31:52 +08:00
5d0c8956d6 edit some errs and fmt some codes 2019-04-30 11:45:26 +08:00
c9537af062 add package feature for gudp; gtcp updates 2019-04-29 23:54:47 +08:00
dfb5b3a8ce Merge pull request #15 from gogf/master
日常更新
2019-04-29 14:30:24 +08:00
a177e44583 edit some infos 2019-04-29 14:29:33 +08:00
7ae03729f3 add package support for gtcp 2019-04-28 23:55:23 +08:00
898ec21a25 del mod contents of 'go1.12' 2019-04-28 23:00:07 +08:00
6d7d8dec02 add var 'e' of gtime.format 2019-04-28 22:53:03 +08:00
ea7e2ec5ec remove go version limit in go.mod 2019-04-28 21:10:22 +08:00
a5b8e2aa2f add var 'w' of gtime.format 2019-04-28 18:12:43 +08:00
123333d9c2 edit some info 2019-04-27 22:59:06 +08:00
0c4fa1d96a fmt files 2019-04-27 22:50:44 +08:00
e5805e8c69 Merge branch 'master' of https://github.com/jroam/gf 2019-04-27 22:44:59 +08:00
bf2d45a012 add gtime.format var 't' 2019-04-27 22:37:36 +08:00
a7122788b1 add 'W' to gtime.format func(doing) 2019-04-26 17:52:45 +08:00
237c58f2b0 Merge branch 'master' of https://github.com/gogf/gf 2019-04-26 13:46:47 +08:00
efa23e4a1d README updates 2019-04-26 13:46:42 +08:00
c109cee7ef Merge pull request #115 from touzijiao/master
Merge pull request #115 from touzijiao/master
2019-04-26 13:44:51 +08:00
e111d39c54 测试文件 2019-04-26 10:38:27 +08:00
66306464e1 add Pop/Pops functions for gset 2019-04-26 08:57:48 +08:00
dd34ac1722 add build-in function 'eq/ne/lt/le/gt/ge' for gview to replace the same functions in stdlib 2019-04-25 23:23:24 +08:00
34cb222b33 remove temprary function map parameter for gview when parsing template file and content 2019-04-25 22:14:20 +08:00
a0276f7e81 add param 'z' to gtime.format func 2019-04-24 23:12:48 +08:00
d39ef156de garray updates 2019-04-24 22:23:32 +08:00
f464dc7fb8 add NewFrom/NewIntSetFrom/NewStringSetFrom functions for gset; add more example for gset 2019-04-24 18:52:24 +08:00
d29b27a5df add Merge/Sum functions for gset 2019-04-24 18:15:50 +08:00
5346ca9046 use golint checked 2019-04-24 18:08:10 +08:00
6d5b552bb7 add param of 'N','s' to gtime.format 2019-04-24 18:03:29 +08:00
aadc6aa504 Merge pull request #114 from proptypes/master
fix: #112
2019-04-24 14:07:37 +08:00
e8c3dfa13e fix: #112
closes #112
2019-04-24 11:31:13 +08:00
836d62f4aa Merge pull request #14 from gogf/master
日常更新
2019-04-24 09:34:50 +08:00
9eea93cc6e change param type from string to interface{} for ghttp.ClientRequest 2019-04-23 20:12:44 +08:00
308cb55b6b version updates 2019-04-23 19:44:28 +08:00
75ada78f8f remove parameter bind from ghttp.RouterGroup.Bind 2019-04-23 19:39:35 +08:00
ecd86e3a12 add layout example for package gview 2019-04-23 19:11:38 +08:00
c1aa5eb717 Merge pull request #98 from qq976739120/gmap-test
新增测试方法
2019-04-23 18:56:58 +08:00
d2fed1198b Merge pull request #110 from jroam/master
增加gtime包下,format方法能直接格式化星期的数字型的值
2019-04-23 18:54:43 +08:00
a9f9261dbd add gregex.ReplaceFuncMatch/ReplaceStringFuncMatch functions for package gregex 2019-04-23 14:15:12 +08:00
161e0d6e97 edit var name to "weekMap" 2019-04-23 09:59:13 +08:00
3efe511f42 优化星期英文值和数字值的格式化功能 2019-04-22 23:13:35 +08:00
5d04c2e50a fix issue in gfile.MainPkgPath 2019-04-22 22:33:11 +08:00
7b26b7ea4c fix issue in gstr.Chr 2019-04-22 21:37:11 +08:00
9d1063c6b2 Merge branch 'master' of https://github.com/gogf/gf 2019-04-22 15:48:16 +08:00
5ff7632d32 add support of layout feature for gview; fix issue in gstr.Chr 2019-04-22 15:47:59 +08:00
e6fb41504c 简写"w"参数的注释,增加周六值测试 2019-04-22 14:10:46 +08:00
a800f731dd 优化格式化星期值性能 2019-04-22 13:55:53 +08:00
f1a9fbb74e Merge branch 'master' of https://github.com/jroam/gf 2019-04-22 10:51:40 +08:00
cf81a73526 增加gtime包下,format能直接格式化星期的数字型的值 2019-04-22 10:51:24 +08:00
65036fffe8 Merge pull request #13 from gogf/master
日常更新
2019-04-22 10:49:28 +08:00
a69934a7e3 添加星期值的int形式 2019-04-21 19:36:06 +08:00
9400457bf2 Merge pull request #107 from wenzi1/master
add encoding package unit test
2019-04-19 18:29:11 +08:00
5060329721 Merge branch 'master' of https://github.com/wenzi1/gf 2019-04-19 17:11:10 +08:00
07ab1d60e8 add encoding package unit test 2019-04-19 17:04:43 +08:00
7377a82e19 Merge pull request #8 from gogf/master
Merge pull request #80 from wenzi1/master
2019-04-19 12:06:00 +08:00
f82e3ac808 Merge pull request #80 from wenzi1/master
增加gbinary单元测试
2019-04-18 22:50:24 +08:00
1a6cd1de04 Merge pull request #7 from gogf/master
update latest code
2019-04-18 20:22:17 +08:00
90e6f685b7 Merge pull request #12 from gogf/master
日常更新
2019-04-18 17:55:19 +08:00
0fc825dac1 add gcompress packge unit test 2019-04-18 12:34:01 +08:00
dbb27efe3e rename io to writer for glog.Logger 2019-04-18 09:11:14 +08:00
2d3d2e783e add default writer for glog to be integrated with other package; comments update for glog 2019-04-17 23:50:37 +08:00
6ae1defa35 Merge pull request #6 from gogf/master
pull
2019-04-17 16:56:18 +08:00
d55e77fb90 README updates 2019-04-17 09:50:57 +08:00
7fb9ae71e7 Merge pull request #103 from jroam/master
增加gfile模块的测试代码
2019-04-17 09:47:51 +08:00
9419555149 add BindFuncMap funtion for gview; README updates 2019-04-17 09:46:31 +08:00
ab634f8beb del some test code 2019-04-16 23:15:22 +08:00
9503b80d57 edit tempdir 2019-04-16 23:07:53 +08:00
bc870226e5 Merge pull request #11 from gogf/master
日常更新
2019-04-16 22:52:03 +08:00
7e106ae011 Merge pull request #81 from pibigstar/master
add the crypto test
2019-04-16 22:38:26 +08:00
958e00e231 fmt test code file 2019-04-16 22:14:42 +08:00
ab187d225d edit yml 2019-04-16 22:12:29 +08:00
9f5711d41d edit testpackage's name 2019-04-16 22:11:44 +08:00
cdb2773127 Merge branch 'master' into test_gfile 2019-04-16 18:35:25 +08:00
d12532ccc1 set a definite value for an assertion #66 2019-04-16 15:49:42 +08:00
53e9f05a10 make the details perfect #66 2019-04-16 15:49:42 +08:00
60e7ab95bc increase coverage for crypto #66 2019-04-16 15:49:42 +08:00
ae552e2b46 increase coverage for crypto #66 2019-04-16 15:49:42 +08:00
145b52f343 increase coverage for crypto #66 2019-04-16 15:49:42 +08:00
57b8fac0d5 add the crypto test 2019-04-16 15:49:42 +08:00
Jay
16a4a5ba46 Gmap测试修改 2019-04-16 14:28:25 +08:00
3d37c83532 Update TODO.MD 2019-04-15 23:49:47 +08:00
b02fa701b8 add test_gfile test of ci 2019-04-15 23:31:17 +08:00
37b7c82c64 Merge branch 'master' into test_gfile 2019-04-15 23:30:21 +08:00
1deb27df06 Merge branch 'master' of https://github.com/gogf/gf into gogf-master 2019-04-15 23:24:38 +08:00
84ed3d5767 add move and rename testfun 2019-04-15 23:14:48 +08:00
fc909a3db2 travis ci updates 2019-04-15 23:06:42 +08:00
2f7d4cd80d fix issue in Add function for gtype.Float32/Float64 2019-04-15 22:55:12 +08:00
03ccbf3613 edit TestStat fun 2019-04-15 22:52:19 +08:00
1868465319 edit TestTruncate fun 2019-04-15 22:47:09 +08:00
ff473e2fcc edit ci yml 2019-04-15 22:17:58 +08:00
a3c38eec86 edit ci yml 2019-04-15 22:12:28 +08:00
2015c847e8 fmt test file 2019-04-15 18:14:38 +08:00
1b583ed984 pull ci yml 2019-04-15 15:41:51 +08:00
11191c746a edit test 2019-04-15 15:34:35 +08:00
abedd3c5bf edit test 2019-04-15 15:30:44 +08:00
501ba5135b edit test 2019-04-15 15:27:49 +08:00
a76c98c348 暂时去掉search测试 2019-04-15 14:01:09 +08:00
9dcdc1a339 edit ci yml 2019-04-15 13:47:25 +08:00
6d1f386203 edit travis.yml 2019-04-15 11:49:07 +08:00
ff9bbf0a49 edit test 2019-04-15 11:41:05 +08:00
66e24c8d40 Merge branch 'master' into test_gfile 2019-04-15 11:26:11 +08:00
34f117c631 Merge pull request #9 from gogf/master
日常更新
2019-04-15 11:22:16 +08:00
21f2f16889 go test 2019-04-14 23:21:03 +08:00
f6fa7c422d 测试小调整 2019-04-14 22:41:11 +08:00
6903b84bb6 调整测试文件生成目录 2019-04-13 23:00:57 +08:00
0978b8fb4f 初步完成测试代码重构 2019-04-13 18:27:01 +08:00
d014583e88 重构测试代码中 2019-04-13 13:14:30 +08:00
a747f51b9d 重构测试代码 2019-04-12 18:15:31 +08:00
8300885ab6 Merge pull request #5 from gogf/master
update gtest
2019-04-12 17:59:02 +08:00
Jay
b489eed4ef 新增测试方法 2019-04-12 10:59:05 +08:00
0b57771d76 用fmt格式化代码 2019-04-12 09:47:55 +08:00
8a32a8271c fix issue in empty router group error of ghttp.Server 2019-04-12 00:19:15 +08:00
c3e716dafd Merge branch 'master' of https://github.com/gogf/gf 2019-04-11 23:07:28 +08:00
119a11eb8d README updates 2019-04-11 23:07:22 +08:00
e464d14842 Merge pull request #85 from qq976739120/gmap-test
Gmap 测试添加
2019-04-11 21:59:00 +08:00
Jay
905f46359a Gmap string-string 类型测试提交 2019-04-11 17:50:26 +08:00
Jay
8e7bf1f908 bug 修复 2019-04-11 17:46:19 +08:00
Jay
3a1524ae6d Gmap 初测完成 2019-04-11 17:33:52 +08:00
5c04befea3 edit ci yml file 2019-04-11 16:39:20 +08:00
ae3584cdff edit ci 2019-04-11 16:27:47 +08:00
a60578c82c edit ci 2019-04-11 16:23:29 +08:00
74558a500c edit c1 2019-04-11 16:17:44 +08:00
d963d8c8c1 testci 2019-04-11 16:13:56 +08:00
853892c24f config ci 2019-04-11 16:05:33 +08:00
641f939e3d edit test 2019-04-11 15:57:48 +08:00
af77504eaf 修改测试 2019-04-11 15:49:00 +08:00
62649d6468 config ci 2019-04-11 15:22:29 +08:00
bb914e605e 配置ci 2019-04-11 15:08:17 +08:00
62ee88bbfa Update .travis.yml 2019-04-11 14:45:47 +08:00
99c964bb4a 添加ci配置文 2019-04-11 11:02:43 +08:00
09ceaef3e9 配置ci 2019-04-11 10:59:53 +08:00
a82900af55 对分支添加ci检查 2019-04-11 10:03:47 +08:00
5ef589f31a Merge pull request #8 from gogf/master
合并前更新。
2019-04-11 09:56:01 +08:00
cd719f134d 测试率达到82.9% 2019-04-11 09:47:51 +08:00
f69eb219b5 version updates 2019-04-11 09:43:17 +08:00
0ffe17ee3d revert SearchArray/InArray functions for gstr 2019-04-11 09:26:52 +08:00
4ac647a215 gcmd updates 2019-04-11 09:05:27 +08:00
872536c035 Merge branch 'master' of https://github.com/gogf/gf 2019-04-10 23:09:59 +08:00
c7a6a6fff0 improve grand.Intn; README updates 2019-04-10 23:09:38 +08:00
2534655bc8 测试覆盖率达到76.3% 2019-04-10 22:16:16 +08:00
0cb82d70fd Merge pull request #96 from aloncn/master
update unit test for gring
2019-04-10 21:42:25 +08:00
acac5a2ad6 version updates 2019-04-10 18:33:51 +08:00
9ec15ad2ca fix issue in repeated rand value of grand.Intn 2019-04-10 18:33:12 +08:00
a9b7d56d0b 测试覆盖率达到63.1% 2019-04-10 17:54:28 +08:00
e9ca1eb538 完成第一遍功能测试 2019-04-10 16:45:33 +08:00
0532800895 添加测试代码 2019-04-10 16:22:29 +08:00
ad50ca6e60 update unit test for gring 2019-04-10 14:26:21 +08:00
c1ad999c25 添加测试 2019-04-10 13:45:42 +08:00
4accd1264d 添加内容测试 2019-04-10 13:39:36 +08:00
e1f3da3aa8 去掉mod设置的版本信息 2019-04-10 11:31:24 +08:00
4bf9a7950b Merge branch 'master' into test_gfile 2019-04-10 11:28:57 +08:00
8285c31bf1 Update unit test for gring 2019-04-10 10:44:40 +08:00
230be66fa9 update unit test for gring 2019-04-10 10:13:56 +08:00
428d7ec94a Merge pull request #1 from gogf/master
同步主库
2019-04-10 09:54:16 +08:00
2c53f934c9 Merge branch 'master' of https://github.com/gogf/gf 2019-04-10 09:50:29 +08:00
08785cb272 update unit test cases of gjson 2019-04-10 08:54:49 +08:00
bd0207c938 update unit test for gring 2019-04-10 01:16:45 +08:00
6fad737617 update unit test cases of gjson/gparser 2019-04-10 01:00:51 +08:00
af4148d985 Merge branch 'master' of github.com:aloncn/gf 2019-04-10 00:37:22 +08:00
922eaf4d42 Update unit test for gring 2019-04-10 00:37:06 +08:00
4b5153950f Add unit test for gring 2019-04-10 00:37:06 +08:00
78010d2bd7 Update unit test for gring 2019-04-10 00:22:10 +08:00
6cc0017826 测试空的断言。 2019-04-09 23:25:20 +08:00
8a9131c3dc Merge pull request #7 from gogf/master
日常更新
2019-04-09 23:16:18 +08:00
85c2ed1bf2 improve nil checks for gtest.Assert* 2019-04-09 23:12:22 +08:00
aca1df634d 添加测试文件内容相关函数。 2019-04-09 23:11:04 +08:00
053a3c1a53 add unit test 2019-04-09 19:12:48 +08:00
429aa90e0d Merge branch 'master' of github.com:aloncn/gf 2019-04-09 18:42:16 +08:00
4f792b347d Add unit test for gring 2019-04-09 18:40:48 +08:00
468c315087 Merge pull request #4 from gogf/master
update 1.6
2019-04-09 17:36:40 +08:00
6d8ced21b9 Add unit test for gring 2019-04-09 17:27:58 +08:00
b3d5fc149e add unit test 2019-04-09 17:27:11 +08:00
Jay
277b7a4536 测试修改 2019-04-09 15:06:12 +08:00
43886511b9 add unit test 2019-04-09 12:28:21 +08:00
8b3eb5b02d version&release updates 2019-04-09 00:15:48 +08:00
054ef87886 继续添加文件测试. 2019-04-08 23:13:28 +08:00
Jay
39c65d9e9a 测试添加 2019-04-08 17:49:15 +08:00
Jay
b97bbbfa3d 测试添加 2019-04-08 17:32:07 +08:00
Jay
ace6ba8096 Gmap 测试添加 2019-04-08 17:02:57 +08:00
a2b87d84e9 添加gfile测试代码,10% 2019-04-07 22:46:14 +08:00
b90d61b27c README updates 2019-04-07 22:03:04 +08:00
85606e3e7e README updates 2019-04-07 21:59:28 +08:00
1fc85d49bd gtime updates; README updates 2019-04-07 21:49:24 +08:00
a5cfb4e638 Merge pull request #82 from hailaz/master
Add gtime unit test
2019-04-07 21:27:29 +08:00
38754bf062 Merge pull request #78 from youyixiao/youyixiao_gogf
gregex_unit_test
2019-04-07 21:23:03 +08:00
f1818ed2ff 补充gtime_format的覆盖测试。 2019-04-06 23:53:06 +08:00
352ad17715 避免pr时造成gtime文件的更改。 2019-04-06 22:56:47 +08:00
e50b8d9632 移除gtime unit test中注释掉的函数。 2019-04-06 22:50:37 +08:00
2107061a46 Add gtime unit test 2019-04-06 22:48:47 +08:00
61f57b4895 update comments of gstr 2019-04-06 21:31:01 +08:00
d34273abff 同步master 2019-04-05 23:53:43 +08:00
0aff0f0362 同步master 2019-04-05 23:49:20 +08:00
68949b69bc update example of gtime 2019-04-05 23:31:14 +08:00
c56c77d3a1 fix issue in G&j char format 2019-04-05 23:13:47 +08:00
dc82ce395a comment updates for gcfg 2019-04-05 00:23:59 +08:00
fd63a2209b 增加单元测试 2019-04-04 23:31:17 +08:00
2a29483456 comment fix 2019-04-04 23:24:27 +08:00
4f10562980 remove limit for gdb.Model.One 2019-04-04 23:22:09 +08:00
a26ec37f59 Merge pull request #3 from gogf/master
更新
2019-04-04 23:17:09 +08:00
779ad93bcb 参数为nil时的特殊处理 2019-04-04 23:02:00 +08:00
1ec0219473 add gbinary unit tests 2019-04-04 23:00:21 +08:00
6863928b06 !18 限制下查询单条记录查询条数
Merge pull request !18 from 一墨染尽青衣颜/master
2019-04-04 22:55:13 +08:00
aa4dca11f0 fix issue in gtime; update comment for g/gtest 2019-04-04 22:52:56 +08:00
dc6ab820ce 修复解析日期函数(parseDateStr)对"02.jan.2006"格式日期解析异常的问题。
更正函数(isNumeric)的注释。
2019-04-04 17:57:17 +08:00
be0fa4d60b gregex_unit_test 2019-04-04 17:45:04 +08:00
a86d2272af gregex_unit_test 2019-04-04 16:15:50 +08:00
61a67892ac Merge pull request #6 from gogf/master
同步最新代码
2019-04-04 11:37:58 +08:00
388d5954cb Merge pull request #2 from gogf/master
update unit test
2019-04-04 10:56:01 +08:00
08550d413e update unit test cases for gcfg 2019-04-04 09:18:43 +08:00
b89294561b add gmap.SetIfNotExistFunc/SetIfNotExistFuncLock for gmap; update comment of gmap; update instance feature of gcfg 2019-04-03 23:39:31 +08:00
20977558cc Merge pull request #1 from gogf/master
更新代码
2019-04-03 16:47:16 +08:00
630d8fdb43 add Instance function for gcfg 2019-04-03 09:59:15 +08:00
c4c7e6caf4 gofmt 2019-04-03 00:03:46 +08:00
8a8fea1257 v1.5.23 2019-04-02 23:40:20 +08:00
0e0f297a3f add consurrent safety parameter for gjson.Load/LoadContent; fulfil data type auto-check logics for gjson.LoadConetnt; update comment of gjson/gparser 2019-04-02 23:33:27 +08:00
fd2c0f2b24 Merge pull request #59 from wenzi1/master
修复gxml字符集转换的并发安全问题
2019-04-02 17:43:19 +08:00
ecc6e3888d up 2019-04-02 17:10:21 +08:00
47c073aaf3 add Clear function for gcfg; mark Reload function of gcfg as deprecated; update unit test for gins 2019-04-02 16:08:46 +08:00
07476a4349 add instance management feature for gdb/gredis; add customized configuration content management feature for gcfg; update gjson for data content type check 2019-04-02 14:37:46 +08:00
817148f3a1 增加单元测试 2019-04-01 18:32:37 +08:00
bd4271cd8c 增加gxml的单元测试 2019-03-31 23:36:11 +08:00
b1804fc346 TODO updates; version updates 2019-03-31 21:13:11 +08:00
a3886c2179 fix issue in RemoteAddr of gudp.Conn 2019-03-31 20:58:31 +08:00
f258b5bf1c change logging level from error to debug in route regitsry for struct for ghttp package; handle possible overrange usage of r.URL.Path in ghttp.Server 2019-03-31 20:52:30 +08:00
a05361011f 修复并发安全问题,改为如果非UTF8字符集则先做字符集转换 2019-03-30 23:53:42 +08:00
6b34a77251 修复并发安全问题,改为如果非UTF8字符集则先做字符集转换 2019-03-30 23:39:07 +08:00
afb1adee3d version updates 2019-03-28 17:58:33 +08:00
22fa7a37f3 add UseNumber support for gjson; add more unit test cases for gjson 2019-03-28 17:51:05 +08:00
6a58bfc574 add stdout printing support for ghttp.Server logging 2019-03-28 09:34:16 +08:00
64124c60fc add fatal error when no router set or statis feature enabled for ghttp.Server 2019-03-27 16:23:35 +08:00
9a0066de62 add file/folder search support for gcfg/gview in order of envpath/pwdpath/binpath/mainpath; add gfile.Search function 2019-03-27 11:48:53 +08:00
22c7c7403b fix issue in basic http auth check for server side 2019-03-27 09:16:23 +08:00
83db8e4b15 add wss example for websocket 2019-03-22 17:26:39 +08:00
25f2e121e7 version updates 2019-03-22 15:09:22 +08:00
1325a145d8 fix issue in config auto reload of gcfg 2019-03-22 15:08:43 +08:00
9bc49c0b29 add logging for error in ghttp.Request 2019-03-22 14:31:02 +08:00
8e84e5b0f3 update comment of gredis 2019-03-22 11:22:03 +08:00
a42e6b0c45 ignore private attribute of struct in gconv/gvalid 2019-03-22 10:12:43 +08:00
51bb7a9854 ignore private attribute of struct in gconv/gvalid 2019-03-22 10:12:15 +08:00
62580b5719 add examples for gredis 2019-03-21 23:51:57 +08:00
15cfd5ce5c add g.Export 2019-03-21 18:21:53 +08:00
11c89c4090 fix issue in GetOrSetFuncLock of gmap/gcache; add gutil.IsEmpty/Export functions 2019-03-21 18:20:20 +08:00
4a12cb9f27 version updates 2019-03-21 10:52:12 +08:00
32f575eddd update unit test of gins 2019-03-21 10:36:24 +08:00
fbb4cb3b1c add more unit test cases for gredis 2019-03-21 10:04:53 +08:00
c9d2d5e8ab add configuration support for maxIdle/maxActive/idleTimeout/maxConnLifetime of gredis; update gjson.Append/Len functions; add more unit test cases for gredis/gins/gstr/gjson 2019-03-21 00:14:23 +08:00
93763192f2 version updates 2019-03-19 17:55:02 +08:00
80e0eae6b0 add TLSConfig support for ghttp.Server 2019-03-19 17:48:37 +08:00
4e3d735b90 add logging for gcron 2019-03-19 13:58:18 +08:00
60e5a7da28 add more unit test cases for grand/gstr 2019-03-18 23:52:25 +08:00
997b5ba889 README updates 2019-03-18 14:10:30 +08:00
b3e7ca1963 travis updates 2019-03-18 14:05:46 +08:00
5a82d695c1 mv greuseport to a new repo 2019-03-18 13:56:16 +08:00
64a0427150 travis updates 2019-03-18 13:34:51 +08:00
f6aafc1d6b Merge pull request #5 from gogf/master
更新数据库操作
2019-03-18 10:00:23 +08:00
bca5532df8 version updates 2019-03-17 22:36:58 +08:00
72eeadd9aa Merge branch 'master' into develop 2019-03-17 22:31:15 +08:00
0af55794f6 add more unit test cases for gdb 2019-03-17 22:26:41 +08:00
25a6c53533 add unit test cases for gfsnotify 2019-03-15 14:54:01 +08:00
9f9172c775 update unit test cases of package gconv 2019-03-15 09:05:56 +08:00
320e0db417 fix int-overflow issue in gconv.String when converting int64 to string; add more unit test cases for package gconv 2019-03-15 00:22:39 +08:00
cb8362d447 update unit test cases of package gins 2019-03-14 23:28:56 +08:00
45a83fc53c unit test cases update for package gins 2019-03-14 00:23:46 +08:00
3411bd1c1d merge master 2019-03-13 22:41:00 +08:00
6ab0a77364 add more defaulr searching paths for g.Config() 2019-03-13 22:12:59 +08:00
281bae4116 unit test cases update for package gins 2019-03-13 09:11:50 +08:00
218c692fe0 update unit test cases 2019-03-12 23:56:09 +08:00
fa69b581e1 update unit test cases 2019-03-12 23:50:30 +08:00
bd0baceeca update unit test cases 2019-03-12 23:47:27 +08:00
e71c837472 update unit test cases 2019-03-12 23:45:44 +08:00
782aaabd07 add more unit test cases for gins; update text/template for gview 2019-03-12 23:26:10 +08:00
9014325a7c test 2019-03-12 10:54:38 +08:00
8ae9276732 add disable cache feature option for package gspath 2019-03-12 00:24:31 +08:00
79a3aa5916 add more unit test cases for package gvalid 2019-03-11 22:58:21 +08:00
733c5db228 version updates 2019-03-11 22:33:43 +08:00
6171c621a7 fix issue in missing customed error messages in package gvalid 2019-03-11 22:33:20 +08:00
fc11856a28 Merge pull request #4 from gogf/master
日常更新
2019-03-11 17:43:06 +08:00
802568856c version updates 2019-03-11 16:35:44 +08:00
127fb67185 add session id check in session object initialzing 2019-03-11 16:33:51 +08:00
5db039bbce gdb.Model updates, rename Alterable function to Safe, change gdb.Model alterable in default, update Where function to support more cases when using map as its param, add more unit test cases for gdb.Model 2019-03-11 16:14:55 +08:00
b0726b9733 Merge pull request #3 from gogf/master
日常更新
2019-03-10 22:38:15 +08:00
8a3365d18e ghttp comment updates 2019-03-10 00:39:34 +08:00
2ae5b1a4f8 add more unit test cases for ghttp.Server 2019-03-10 00:35:03 +08:00
f9515d7126 version updates 2019-03-09 10:20:11 +08:00
b56679a97c revert g.Map to map[string]interface{}, add g.MapAnyAny 2019-03-09 10:17:21 +08:00
d1b123964a README updates 2019-03-08 21:07:18 +08:00
991f7c4958 ghttp.Response updates 2019-03-08 19:03:22 +08:00
770619c39e update unit test cases og gcron 2019-03-08 18:27:11 +08:00
4ad5450b80 gtest updates; remove one unit test case of gconv.Struct 2019-03-08 18:18:29 +08:00
49ce7fe885 fix data race issue of gqueue 2019-03-08 17:54:50 +08:00
e66f63262b add more unit test cases for ghttp.Server 2019-03-08 17:31:30 +08:00
94bd5da68a add map key operator support in Where function for gdb 2019-03-08 11:12:52 +08:00
3eee95caf2 VERSION updates 2019-03-08 10:35:35 +08:00
5c638c630a add select in support for slice type of arguments in Where function of gdb 2019-03-08 10:33:36 +08:00
a6ec9d7a1c update gdb.Model.Where, orverwrite args if multiple calls Where function 2019-03-08 10:18:38 +08:00
374c70c0e3 README updates 2019-03-08 09:03:32 +08:00
40771066d4 travis updates 2019-03-08 08:48:53 +08:00
22a7ef43ce Merge branch 'master' into develop 2019-03-08 00:21:52 +08:00
05f22d1cee README updates 2019-03-08 00:15:57 +08:00
ebf56a86ab add Alterable function for gdb.Model 2019-03-07 23:53:56 +08:00
2ba59e8943 fix issue in gtime convert in package gconv; add Structs/Scan functions for gdb.Model; add GetStructs/GetScan functions for gdb.Base and gdb.TX 2019-03-07 23:36:45 +08:00
4e4ea25e7f Merge pull request #2 from gogf/master
第一次同步
2019-03-07 17:35:22 +08:00
83be1de04c remove error returns from router registry functions of WebServer; add more unit test cases for WebServer 2019-03-06 15:21:00 +08:00
c8251ed82f g.Map updates 2019-03-06 10:38:50 +08:00
2335ea0c4d merge master 2019-03-05 21:07:54 +08:00
5d874e9063 add example code for gconv.Map; comment updates of gdb 2019-03-05 17:52:34 +08:00
f2c080d25f update ghttp.Response 2019-03-05 17:16:21 +08:00
975da97b4a fix issue in empty check for nil attribute of struct in package 'empty';add set-cookie support for 302 status in ghttp.Server 2019-03-05 17:06:37 +08:00
37617589a6 add more unit test cases for ghttp.Server 2019-03-04 23:51:44 +08:00
5c9f0db903 version updates 2019-03-04 23:37:01 +08:00
28abf0c175 add ReplaceI/ReplaceIByArray/ReplaceIByMap case-insensetive replacing functions for gstr 2019-03-04 23:35:06 +08:00
13749feab4 add json features '-' and 'omitempty' for gconv.Map, like package 'json' from stdlib; add internal package 'empty', to check empty variable 2019-03-04 22:59:29 +08:00
c1e77b7e09 update example of gtcp 2019-03-03 20:40:36 +08:00
962a5e93f7 update example of gtcp 2019-03-03 20:20:31 +08:00
c3b9b8d5ae gconv updates 2019-03-03 00:53:35 +08:00
1ad076c522 travis updates 2019-03-03 00:31:16 +08:00
b01777fcd1 travis updates 2019-03-03 00:28:32 +08:00
55a5532c2e gdb updates 2019-03-03 00:14:20 +08:00
adb928941a issue template updates 2019-03-02 00:02:05 +08:00
f92c1fc527 update CORS feature of ghttp.Response; add more unit cases for ghttp.Server 2019-03-01 23:45:55 +08:00
3ae7279ebc issue template updates 2019-03-01 14:01:05 +08:00
66287c2d0e update the admin feature and unit test cases of ghttp 2019-02-28 23:57:20 +08:00
5d37626981 hot fix issue in router registry 2019-02-28 14:07:00 +08:00
d0ed3b979d release updates 2019-02-28 10:28:09 +08:00
fa256aec9f add example for layout using template engine; fix issue with config error output in gview when no config used 2019-02-27 22:53:39 +08:00
86834c5a15 version and comment updates 2019-02-27 22:17:09 +08:00
c2046157d6 add ghttp.Request.GetRawString function 2019-02-27 21:17:56 +08:00
cdb2cc89c0 remove password for unit test of gdb 2019-02-27 12:51:48 +08:00
4964c09a77 add more unit test cases for gdb 2019-02-27 12:38:12 +08:00
ef34b2c9ce gdb updates, add batch operation support for Insert/Save/Replace, change list param type from List to interface{} for Batch* functions 2019-02-27 09:38:10 +08:00
9afe242293 Merge branch 'master' into qiangg_gdb_map 2019-02-27 08:52:50 +08:00
136d93d373 add donate for gitee 2019-02-26 23:39:09 +08:00
3102cec5b8 issue template updates 2019-02-26 23:06:14 +08:00
e28eb9da04 add issue template 2019-02-26 22:58:52 +08:00
754ed86dfb add issue template 2019-02-26 22:56:52 +08:00
e352b07055 add issue_template 2019-02-26 22:51:30 +08:00
fdea242b50 Merge branch 'master' into develop 2019-02-26 22:23:24 +08:00
7058e4f2c4 fix issue of router group in auto-adding 'index' router for controller and object 2019-02-26 22:21:57 +08:00
704a5dbd73 fix issue of "memory leaks" in gfpool 2019-02-26 17:52:50 +08:00
fbd4ce8c2e fulfil unit cases of ghttp.Cookie/Session 2019-02-26 17:17:11 +08:00
cb3ce71cdc fix issue in ghttp.Session 2019-02-26 14:33:01 +08:00
7f44f2f5e4 gdb updates 2019-02-26 14:23:29 +08:00
66efbe63f0 add struct support for *Insert/*Save/*Replace/*Update/Where/Data functions 2019-02-26 01:19:01 +08:00
49a1308875 ghttp.Session updates 2019-02-25 23:08:26 +08:00
4332580c01 disable build-in session variable in template parsing, when it's not necessary 2019-02-25 15:20:57 +08:00
72ecf2d2af TODO++ 2019-02-25 12:39:07 +08:00
0f854e46d8 refact Merge function for garray; add more frequently-used type alias for gf 2019-02-22 09:08:46 +08:00
4564f38e1a add PopRands/Rands functions for garray 2019-02-20 19:06:08 +08:00
7e06bf6705 Merge branch 'master' into qiangg_garray2 2019-02-20 16:28:24 +08:00
3dd8b6ad33 version updates 2019-02-20 16:24:44 +08:00
3e0a975a88 fix issue in gcron, allow special char '?' for day and week pattern 2019-02-20 16:24:05 +08:00
6aa1c5b1eb ghttp updates 2019-02-20 16:07:11 +08:00
d780cf64c2 garray updates 2019-02-20 14:18:11 +08:00
1fb5a8cd6f comments for glog update 2019-02-20 11:16:10 +08:00
8925460718 comment updates of gregex package 2019-02-19 11:19:23 +08:00
9797701881 remove Search/InArray functions from gstr package; update custom http status handling logics of web server 2019-02-18 16:12:59 +08:00
8a50b180c0 README updates 2019-02-18 09:25:05 +08:00
159190d187 version updates 2019-02-17 20:49:58 +08:00
989d543a1f fix issue with error response status code 200 of web server; ghttp request client updates 2019-02-17 20:45:35 +08:00
fcc3a1b2f6 README updates 2019-02-15 23:21:46 +08:00
cfdeb87093 gfile updates 2019-02-15 21:30:35 +08:00
74eef34ec2 gtest updates; TODO++ 2019-02-15 08:55:29 +08:00
2e87d5322f remove sarama-cluster 2019-02-14 19:30:58 +08:00
e89a49f39a remove gkafka 2019-02-14 19:24:45 +08:00
5d3fd91f0b remove sarama 2019-02-14 19:21:38 +08:00
f455d22893 move gkafka to new repo 2019-02-14 17:04:20 +08:00
c00f528098 remove reuseport in ghttp 2019-02-14 15:43:31 +08:00
6f02ad60eb hot fix issue in tpl auto update 2019-02-14 13:38:52 +08:00
ca6c0791ae fix issue with greuseport in windows 2019-02-03 21:41:32 +08:00
ee485dbfd8 README updates 2019-02-02 17:55:22 +08:00
2ecaa12647 travis updates 2019-02-02 16:54:04 +08:00
580e099cb7 update imports 2019-02-02 16:42:26 +08:00
83e50f0d38 update imports 2019-02-02 16:35:26 +08:00
48c770b475 update dependences 2019-02-02 16:31:34 +08:00
ba67101942 updates 2019-02-02 16:22:41 +08:00
72efde09b3 travis updates 2019-02-02 16:20:36 +08:00
76c49170bd change gitee.com/johng/gf -> github.com/gogf/gf 2019-02-02 16:18:25 +08:00
150aa7e2c2 comments update 2019-02-02 15:21:48 +08:00
0762fec696 comments update 2019-02-02 15:16:45 +08:00
1447496efa comments update 2019-02-02 14:22:32 +08:00
6fb9eafef0 garray updates 2019-02-02 09:07:40 +08:00
16bde5e9fc gmap updates 2019-02-01 22:25:58 +08:00
7b85c44444 add Clone for garray; comments of garray update 2019-02-01 22:00:58 +08:00
87d553fca2 greuseport updates 2019-02-01 21:05:56 +08:00
ba050d4c86 merge qiangg_reuseport 2019-02-01 20:51:02 +08:00
90cd7f49fd greuseport updates 2019-02-01 20:49:02 +08:00
29b42290c7 merge master 2019-02-01 20:46:53 +08:00
6c6c64bb3b rename category string to text 2019-02-01 20:45:11 +08:00
ae7db2cf9f gmap updates 2019-02-01 18:40:48 +08:00
1afab62dec fulfil unit test cases for garray 2019-02-01 18:33:53 +08:00
4171ca992e add reverse feature for function Sort of normal array; fulfil unit test cases for StringArray 2019-02-01 18:14:12 +08:00
e1166a8a80 Merge branch 'master' into develop 2019-02-01 17:55:06 +08:00
1dc6c799e1 version updates 2019-02-01 17:48:48 +08:00
ae1e075696 fix issue in binSearch of garray 2019-02-01 17:44:58 +08:00
74a7f71894 gset/gmap update 2019-02-01 17:30:23 +08:00
f2e149d3b3 fulfil unit test cases of gstr 2019-02-01 14:38:45 +08:00
92c0bf9cdc fix unit test cases of ghttp 2019-02-01 11:53:10 +08:00
020b050fb1 fix unit test cases for gstr/gconv/ghttp 2019-02-01 11:42:25 +08:00
08d71cede3 merge qiangg_php 2019-02-01 00:04:34 +08:00
be1f6cfbae Merge branch 'master' of https://gitee.com/johng/gf into develop 2019-02-01 00:02:17 +08:00
9aa5e139cf fulfil unit test cases of gstr 2019-02-01 00:02:01 +08:00
1d5c3d62dd fullfil unit test cases of gset 2019-01-31 21:15:39 +08:00
0e611ae94b merge master 2019-01-31 18:14:02 +08:00
104613b056 VERSION up 2019-01-31 13:58:35 +08:00
99577ad874 hot fix gfcache issue 2019-01-31 13:55:53 +08:00
908a46d27d gtest updates 2019-01-31 13:00:17 +08:00
85677b952f fulfil funcs of gstr/gset/garray; move gstr/gregex to the string category; move gtest to the test category 2019-01-30 21:27:03 +08:00
f4773ef1e4 add func ghttp.Group.Common for common http methods(GET/PUT/POST/DELETE) binding; fix issue #IRHB3,#IRHSJ; add more unit test cases for gvalid 2019-01-29 23:01:14 +08:00
5eaa6183b5 update benchmark test cases of gregex 2019-01-28 12:03:47 +08:00
4036d40c58 add batchSqlResult for gform; TODO++ 2019-01-27 19:44:05 +08:00
0b80cbb0dc merge master 2019-01-27 19:18:24 +08:00
79cb386d82 reuseport updates 2019-01-27 16:40:16 +08:00
09be68831b reuseport updates 2019-01-27 14:25:31 +08:00
0ac13c2b81 reuseport updates 2019-01-27 14:14:59 +08:00
94ef38e3cc reuseport updates 2019-01-27 03:28:55 +08:00
76882ac01c update golang.org/x/sys, add reuseport package 2019-01-27 03:13:20 +08:00
0d315218dd README updates 2019-01-25 12:48:22 +08:00
59945fbe91 README updates 2019-01-25 12:47:53 +08:00
c4962ec017 gfpool updates 2019-01-24 20:15:11 +08:00
58d60bc899 add json tag support for struct converting of gconv 2019-01-24 15:37:53 +08:00
5dd0a78423 ghttp updates 2019-01-24 14:03:48 +08:00
141ea7cc2d ghttp updates 2019-01-24 13:50:26 +08:00
a488d1dbf7 ghttp updates 2019-01-24 13:40:48 +08:00
ec130d0763 RELEASE updates 2019-01-23 21:30:02 +08:00
30729e3f93 README updates 2019-01-23 18:34:52 +08:00
241d7402cc README updates 2019-01-23 18:30:04 +08:00
3b14aba1a2 README updates 2019-01-23 17:33:51 +08:00
b02205f7cd gpool updates 2019-01-23 17:27:30 +08:00
c27bc0023f Merge branch 'master' of https://gitee.com/johng/gf 2019-01-23 15:01:29 +08:00
9698a7c5be gpool updates 2019-01-23 15:01:21 +08:00
071e2f8bb4 !17 修复where为空时不是1=1的bug
Merge pull request !17 from 张金富/master
2019-01-23 13:46:41 +08:00
726d3f7024 update unit tests of gtimer 2019-01-23 13:36:39 +08:00
3503aa43b4 gtimer, gmlock updates 2019-01-23 13:30:46 +08:00
e865b46304 add console and env values to change the default values of gtimer 2019-01-23 13:01:58 +08:00
494f96495e fulfil unit test cases of gtimer 2019-01-23 11:28:57 +08:00
7ed2081513 gcron, gtimer updates 2019-01-22 22:07:46 +08:00
5110313657 gcron, gtimer updates 2019-01-22 13:50:10 +08:00
24990e26c8 gcron, gtimer updates 2019-01-21 22:09:51 +08:00
3ca086bcec 修复where为空时不是1=1的bug 2019-01-21 16:26:47 +08:00
7d103c4ee8 gcron updates 2019-01-18 22:02:17 +08:00
5fed6f5681 update unit test case of gmlock 2019-01-18 15:14:05 +08:00
616539ecb0 update unit test cases of gmlock, concurrent safe reason 2019-01-18 15:03:45 +08:00
9e99e88d27 gmlock updates, add more unit test cases for gmlock 2019-01-18 11:30:52 +08:00
0e39400dd0 johng-cn/gf -> gogf/gf 2019-01-17 22:20:37 +08:00
2ba796de01 gconv examples update 2019-01-17 20:32:02 +08:00
efe2535977 README updates 2019-01-17 20:04:17 +08:00
c17352b8af travis updates 2019-01-17 16:37:26 +08:00
b1fc3ff17a travis updates 2019-01-17 16:06:56 +08:00
485dafb616 update grand.MeetProb, change param type from float64 to float32 2019-01-17 14:20:18 +08:00
bf25a3a601 gtimer updates; grand updates, change buffer slice type from uint64 to uint32 2019-01-17 14:15:23 +08:00
14fcd0b2f9 move gtime.SetTimeout&gtime.SetInterval to gtimer 2019-01-16 23:23:53 +08:00
cb24714faa gcron updates 2019-01-16 22:59:26 +08:00
36199334f0 gcron updates 2019-01-16 22:34:22 +08:00
72c7e65dfa gcron updates 2019-01-16 21:06:35 +08:00
a4ad301b44 fulfil logics of Exit* funcs of ghttp 2019-01-16 20:27:58 +08:00
72569321fa package comments update 2019-01-16 13:35:16 +08:00
1600a80124 comment updates 2019-01-16 13:02:59 +08:00
80c1a02377 pakage comments update 2019-01-16 09:00:23 +08:00
0c41909454 pakage comments updates 2019-01-15 23:27:47 +08:00
2b5d889bb9 fulfil unit test cases of gconv 2019-01-15 21:54:34 +08:00
2c2a71d429 fix issue in concurrent safe handling of gregex 2019-01-15 20:20:34 +08:00
f900414e38 add surport for field type auto detection in gform 2019-01-14 22:55:43 +08:00
1c72766c34 add new func Meet/MeetProb and alias N/Str/Digits/Letters for grand 2019-01-14 20:12:44 +08:00
302f3c1467 optimized package gconv, supported struct attr with ptr 2019-01-14 13:55:07 +08:00
9415419324 fix issue in gconv.Struct when given atrr of struct is nil time.Time 2019-01-14 09:00:31 +08:00
602592a354 TODO-- 2019-01-13 17:02:32 +08:00
1a4cba5fa5 VERSION updates 2019-01-13 00:47:23 +08:00
018853e976 optimize WebServer in hook priority handler and request exit mechanism 2019-01-13 00:43:36 +08:00
651bd33b73 add new 16x and 19x phone number validation for gvalid 2019-01-12 23:45:45 +08:00
f4644ce685 change func(xxx, safe...bool) to func(xxx, unsafe...bool); add new internal package mutex 2019-01-12 23:36:22 +08:00
0a422e9a89 rename go test funcs for gtimer 2019-01-12 22:47:07 +08:00
432c16c89f complete pckage gtimer development, a levelled timing wheel for interval/delayed jobs running and management 2019-01-12 22:41:12 +08:00
241706cbbf up 2019-01-12 20:20:30 +08:00
33dd0f9922 timing wheel up 2019-01-11 13:46:40 +08:00
ed8bb354e5 up 2019-01-09 18:47:11 +08:00
e373392f64 up 2019-01-09 13:26:59 +08:00
292fd2f39e up 2019-01-09 13:06:15 +08:00
1c9cb8286f up 2019-01-09 12:54:37 +08:00
8296061b64 up 2019-01-06 16:43:42 +08:00
bb5d84c29c up 2019-01-06 11:09:50 +08:00
eae857bcf7 merge master 2019-01-04 18:39:40 +08:00
d604d198ab hot fix 2019-01-04 15:43:56 +08:00
40b5162fdf up 2019-01-04 15:32:16 +08:00
7934ad6904 Merge branch 'develop' of https://gitee.com/johng/gf into develop 2019-01-03 19:12:08 +08:00
858b010caa up 2019-01-03 19:11:54 +08:00
36791d2f48 README updates 2019-01-02 21:43:17 +08:00
08f9cffed9 TODO++ 2019-01-02 21:38:26 +08:00
783c0ba846 updates kafka dependences 2019-01-02 21:35:48 +08:00
37cd2351e2 !16 增加ORACLE,SQL SERVER中获取指定表的所有字段名的方法
Merge pull request !16 from 蚊子/master
2019-01-02 21:11:30 +08:00
be1e250a6b 增加ORACLE,SQL SERVER中获取指定表的所有字段名的方法 2019-01-02 18:17:01 +08:00
f86896e5af Merge branch 'master' into develop 2019-01-02 12:42:36 +08:00
7ad4f61564 revert hot fix codes, waiting for next release to fix 2019-01-02 11:41:22 +08:00
adf06a2b0d thirdparty package kafka updated to date 2019-01-02 11:02:03 +08:00
d6aa2b2512 hot fix for gcache 2019-01-02 10:30:27 +08:00
a95b1f0dae add more unit test cases 2019-01-02 10:18:00 +08:00
0a8af94610 !15 打开文件没关闭
Merge pull request !15 from hello/master
2019-01-01 19:45:46 +08:00
f1c7b95b33 up 2019-01-01 19:43:31 +08:00
wgb
2c27c0f58a close file 2019-01-01 15:35:25 +08:00
e4a7e23c46 VERSION updates 2018-12-31 17:56:06 +08:00
6f15adf57f unit test cases++ 2018-12-31 17:46:04 +08:00
1966b40d01 ghttp.Client updates; add more unit test cases for web server 2018-12-31 00:50:55 +08:00
24ce4d098e ghttp.Client updates; add more unit test cases for web server 2018-12-31 00:22:18 +08:00
98619f9bc9 add more unit test cases for web server 2018-12-30 22:02:46 +08:00
1efeb2515d refract package 'gcron'; add package 'gtimew' for Time Wheel style job management 2018-12-30 18:56:21 +08:00
ccf837b2bf up 2018-12-30 14:53:16 +08:00
e558863743 up 2018-12-30 11:08:07 +08:00
43f21dfe92 Merge branch 'master' into qiangg_unit_test1 2018-12-29 13:07:32 +08:00
4172eae87e update default ConnMaxLifeTime to 30 seconds in gdb package 2018-12-28 22:02:21 +08:00
26f2c61068 update default ConnMaxLifeTime to 30 seconds in gdb package 2018-12-28 22:00:49 +08:00
f97bed2607 update default ConnMaxLifeTime to 10 seconds in gdb package 2018-12-28 21:56:27 +08:00
8ef7155c70 hot fix 2018-12-28 21:46:01 +08:00
f5b2556b70 up 2018-12-28 21:44:36 +08:00
2c6e8f88fb README updates, TODO++ 2018-12-27 20:47:13 +08:00
25068b1e83 README updates 2018-12-27 13:27:57 +08:00
1f36eb3a9a README updates 2018-12-27 13:27:04 +08:00
a9ed577d05 README updates 2018-12-27 09:59:56 +08:00
782d614082 README updates 2018-12-27 09:57:54 +08:00
0629c00b07 README updates 2018-12-27 09:49:50 +08:00
b90d5bb205 README updates 2018-12-27 09:46:53 +08:00
cbc824c80a README updates 2018-12-27 09:46:35 +08:00
0c9be40b86 README updates 2018-12-27 09:46:18 +08:00
c96abd706d README updates 2018-12-27 09:45:04 +08:00
0ae5872783 README updates 2018-12-27 09:22:07 +08:00
2cff10e0d2 fix issue in controller interface definition 2018-12-26 10:17:24 +08:00
cab78f557d fix issue in controller detection for object parameter, in router group of web server 2018-12-25 23:20:43 +08:00
04353aa1a5 RELEASE updates 2018-12-25 13:54:36 +08:00
35121a66e9 README updates 2018-12-22 21:50:47 +08:00
e726ed2c19 gdb.Model updates 2018-12-22 21:03:03 +08:00
503446afc7 fix issue of ghttp.Request.GetVar 2018-12-22 11:52:12 +08:00
2063f662d3 fix silly issue in binary search of garray package, and add unit-test file for garray 2018-12-20 21:55:05 +08:00
d7381399aa fix issue of grand.intn in x86 arch; add router group feature for WebServer 2018-12-20 21:04:43 +08:00
d05b497cdb Merge branch 'master' into qiangg_router_group 2018-12-19 18:58:47 +08:00
ef919be587 g.DB can use gdb's configurations, not to force using config.toml 2018-12-19 18:35:44 +08:00
fff31e0f4f add Charset support for mysql of gdb package; fix issue for glog for log writing failed when the folder path wa deleted 2018-12-19 18:15:22 +08:00
cdd6fc7c1e extend pid length from 16bit to 24bit in process communication of gproc package 2018-12-19 16:17:54 +08:00
74bc36a2dc remove gfile.MainPkgPath check in gcfg/gview default path 2018-12-19 14:51:09 +08:00
48328ae52c router group developing 2018-12-19 14:45:39 +08:00
a86f4f8e23 disable auto adding temp directory to gview/gcfg search path; disable backtrace feature in normal log print with glog; fix issue caused by fmt.Fprintf in gfsnotify 2018-12-18 20:03:23 +08:00
0a1e048268 add Model.Clone support for gdb package 2018-12-18 10:10:14 +08:00
6fc5efd6ba README updates 2018-12-17 20:51:49 +08:00
2d795b593d README updates 2018-12-17 20:44:38 +08:00
20628ec75c README updates 2018-12-17 19:50:35 +08:00
10d1ccb009 README updates 2018-12-17 19:41:08 +08:00
fcc37c9581 CI updates 2018-12-17 19:36:34 +08:00
43cd391543 CI updates 2018-12-17 19:29:03 +08:00
18d2df33f7 CI updates 2018-12-17 19:26:59 +08:00
a85daa5617 CI updates 2018-12-17 18:35:29 +08:00
48dc4ce3e2 travis updates 2018-12-17 14:01:43 +08:00
d07bac89a0 travis updates 2018-12-17 13:59:00 +08:00
5d32ad6bc4 travis updates 2018-12-17 13:57:15 +08:00
397b0a3e7e travis updates 2018-12-17 13:50:17 +08:00
259961632d travis updates 2018-12-17 13:46:06 +08:00
cb1d6382ec travis updates 2018-12-17 13:38:35 +08:00
8714a69a13 travis updates 2018-12-17 13:36:38 +08:00
3ae0ea2de7 travis updates 2018-12-17 13:32:35 +08:00
1879a9f4c7 README updates 2018-12-17 13:28:19 +08:00
3938717b04 travis updates 2018-12-17 13:24:53 +08:00
1208b688f1 add code helper 2018-12-17 13:08:32 +08:00
0ad7ee5a32 add code helper 2018-12-17 13:07:01 +08:00
7a4e68e6b9 add code helper 2018-12-17 13:06:58 +08:00
71222b247f add travis/goreport/golint/govet 2018-12-17 13:02:55 +08:00
95db811943 add travis/goreport/golint/govet 2018-12-17 13:02:18 +08:00
2dbc817132 VERSION updates 2018-12-17 11:24:58 +08:00
7a8bd96edc gdb: add support for slice argument in where statement 2018-12-17 10:52:44 +08:00
c5e9686a95 gdb updates, make priority=1 when no priority set 2018-12-16 23:11:15 +08:00
c914edf616 gdb comment updates 2018-12-16 22:27:04 +08:00
656bfcb6bd Merge branch 'qiangg_db2' into develop 2018-12-16 22:22:33 +08:00
7434dfe6fa done refacting gdb package 2018-12-16 22:22:07 +08:00
e67aa63a50 refract gdb package, add complete unit test cases, almost there 2018-12-15 15:50:39 +08:00
06fc786416 fix issue of gcache 2018-12-14 18:38:29 +08:00
d5e46f2b42 refracting gdb package 2018-12-14 18:35:51 +08:00
c003a92408 remove HANGUP signal handle of Web Server admin 2018-12-14 10:11:05 +08:00
09e6f10b60 new version of gdb developing 2018-12-14 10:09:45 +08:00
c961c22cd7 update gview: show empty string when the variable does not exist 2018-12-13 18:24:22 +08:00
105a821069 fix issue: database connection pool does not work expectly 2018-12-12 20:01:10 +08:00
670993f769 remove auto-adding main package path to search path of WebServer in develop environment 2018-12-11 19:30:38 +08:00
60a571f291 Fix issue: add mutex lock for method Remove of garray. 2018-12-11 09:56:58 +08:00
20a0cb2cd9 Merge branch 'master' of https://gitee.com/johng/gf 2018-12-10 20:24:24 +08:00
51e70be04d Add rewrite feature to WebServer; Add Unique for un sorted array of garray; Fix map conversion issue of gjson. 2018-12-10 20:24:20 +08:00
ac65b808c6 !14 修复mssql的OPEN方法BUG
Merge pull request !14 from 蚊子/master
2018-12-10 18:43:56 +08:00
eb9ddf3c47 修改mssql的open方法连接串 2018-12-10 18:14:51 +08:00
80993e9f77 Fix issue of gjson package in map conversion 2018-12-09 22:30:10 +08:00
b7a6d257d5 Fix binary decoding issue of gbinary package. 2018-12-08 18:18:05 +08:00
7022486e93 Package gview: build-in function 'date' supports printing current datetime. 2018-12-05 15:52:38 +08:00
83f5a9d34e Package gview: build-in function 'date' supports printing current datetime. 2018-12-05 15:48:15 +08:00
431e1051b8 Fix gdb.Model.Count method: Count with no fields checking 2018-12-05 13:52:34 +08:00
f8ab5c3842 VERSION updates 2018-12-04 20:29:32 +08:00
101d095f45 GF greets you. 2018-12-04 20:28:06 +08:00
8481de2b47 Add method for gcache package, to show all map datas of the cache. 2018-12-04 20:23:48 +08:00
c973f133de hot fix 2018-12-04 19:50:24 +08:00
d23cdcbe57 改进gcache,完善功能及基准测试;改进gconv.Map对struct转换时默认使用json tag作为键名 2018-12-04 19:26:46 +08:00
9a52175bd6 gredis增加GetConn方法获取原生redis连接对象 2018-12-01 11:28:47 +08:00
4275218841 README updates 2018-11-30 20:43:08 +08:00
663a2c2a16 README updates 2018-11-30 20:40:23 +08:00
da58a60ad5 README updates 2018-11-30 20:38:53 +08:00
2c26063f4b README updates 2018-11-30 20:37:28 +08:00
b19e47783b ghttp增加静态文件目录映射功能;改进gspath目录管理功能;改进gconv的slice转换功能,并增加gconv.Map方法 2018-11-30 09:48:57 +08:00
aee266eea0 WebServer改进 2018-11-28 20:19:28 +08:00
8304769953 代码修正 2018-11-27 20:37:57 +08:00
914a74bca9 完善代码示例 2018-11-26 09:33:45 +08:00
b965dbff70 gvar调用端改进,去掉不必要的并发安全参数;错误提示细节改进 2018-11-25 22:18:36 +08:00
9f9bcd2467 RELEASE updates 2018-11-24 17:21:30 +08:00
b3353afe3c WebServer添加RouterCacheExpire配置参数 2018-11-24 11:55:57 +08:00
4e3081afee ORM增加mysql datetime参数写入示例 2018-11-24 09:42:21 +08:00
578a6a2df3 改进随机数生成缓冲区 2018-11-24 08:43:39 +08:00
aa42ddd3f1 改进随机数生成缓冲区 2018-11-23 21:39:05 +08:00
69738c337f VERSION updates 2018-11-23 16:50:58 +08:00
12f099fd54 VERSION updates, TODO++ 2018-11-23 16:47:03 +08:00
38932f306d 改进gspath缓存数据结构 2018-11-23 16:45:30 +08:00
5e7e1077a1 性能改进 2018-11-23 09:20:45 +08:00
8f85311332 完善获取数据库配置失败时的错误提示 2018-11-21 00:02:29 +08:00
6eb2887a5a README updates 2018-11-20 23:26:58 +08:00
54f4fd3101 README updates 2018-11-20 10:15:23 +08:00
64a22acf84 WebServer允许同一HOOK事件被多次绑定注册,先注册的回调函数优先级更高 2018-11-19 23:13:12 +08:00
4e5877923d dev 2018-11-19 21:49:43 +08:00
ceaa1a4dd1 Merge branch 'develop' of https://gitee.com/johng/gf into develop 2018-11-19 21:12:21 +08:00
9e1ad46c90 改进ghttp.Request,增加SetParam/GetParam请求流程自定义变量方法;gvar模块增加VarRead只读接口 2018-11-19 21:11:43 +08:00
d5a3fefd8b !13 ORM新增对MSSQL的支持
Merge pull request !13 from 蚊子/master
2018-11-19 11:48:18 +08:00
d85332aca1 ORM新增对MSSQL的支持 2018-11-19 11:38:57 +08:00
10c3f6d85a 完善程序细节和测试 2018-11-18 22:22:44 +08:00
ea4764f1f9 当前工作目录为系统临时目录时,gcfg/gview/ghttp模块默认不添加工作目录到搜索路径 2018-11-18 19:45:04 +08:00
fe753b0bc8 当前工作目录为系统临时目录时,gcfg/gview/ghttp模块默认不添加工作目录到搜索路径 2018-11-18 19:37:42 +08:00
04608269fe 修复gspath模块是windows下搜索失效问题 2018-11-18 19:14:17 +08:00
6addd64cf0 glog模块日志前缀输出改进 2018-11-17 22:12:41 +08:00
3058 changed files with 100363 additions and 420550 deletions

View File

@ -0,0 +1,46 @@
package main
import (
"fmt"
"github.com/gogf/gf/container/garray"
)
func main() {
// Create a int array, which is concurrent-unsafe in default.
a := garray.NewIntArray()
// Appending items.
for i := 0; i < 10; i++ {
a.Append(i)
}
// Get the length of the array.
fmt.Println(a.Len())
// Get the slice of the array.
fmt.Println(a.Slice())
// Get the item of specified index.
fmt.Println(a.Get(6))
// Insert after/before specified index.
a.InsertAfter(9, 11)
a.InsertBefore(10, 10)
fmt.Println(a.Slice())
a.Set(0, 100)
fmt.Println(a.Slice())
// Searching the item and returning the index.
fmt.Println(a.Search(5))
// Remove item of specified index.
a.Remove(0)
fmt.Println(a.Slice())
// Clearing the array.
fmt.Println(a.Slice())
a.Clear()
fmt.Println(a.Slice())
}

View File

@ -0,0 +1,40 @@
package main
import (
"fmt"
"github.com/gogf/gf/container/garray"
)
func main() {
// 自定义排序数组,降序排序(SortedIntArray管理的数据是升序)
a := garray.NewSortedArray(func(v1, v2 interface{}) int {
if v1.(int) < v2.(int) {
return 1
}
if v1.(int) > v2.(int) {
return -1
}
return 0
})
// 添加数据
a.Add(2)
a.Add(3)
a.Add(1)
fmt.Println(a.Slice())
// 添加重复数据
a.Add(3)
fmt.Println(a.Slice())
// 检索数据,返回最后对比的索引位置,检索结果
// 检索结果0: 匹配; <0:参数小于对比值; >0:参数大于对比值
fmt.Println(a.Search(1))
// 设置不可重复
a.SetUnique(true)
fmt.Println(a.Slice())
a.Add(1)
fmt.Println(a.Slice())
}

View File

@ -0,0 +1,23 @@
package main
import (
"fmt"
"github.com/gogf/gf/container/garray"
)
func main() {
array := garray.NewSortedStrArray()
array.Add("9")
array.Add("8")
array.Add("7")
array.Add("6")
array.Add("5")
array.Add("4")
array.Add("3")
array.Add("2")
array.Add("1")
fmt.Println(array.Slice())
// output:
// [1 2 3 4 5 6 7 8 9]
}

View File

@ -0,0 +1,74 @@
package main
import (
"fmt"
"github.com/gogf/gf/container/gmap"
)
func main() {
// 创建一个默认的gmap对象
// 默认情况下该gmap对象不支持并发安全特性
// 初始化时可以给定true参数关闭并发安全特性当做一个普通的map使用。
m := gmap.New()
// 设置键值对
for i := 0; i < 10; i++ {
m.Set(i, i)
}
// 查询大小
fmt.Println(m.Size())
// 批量设置键值对(不同的数据类型对象参数不同)
m.Sets(map[interface{}]interface{}{
10: 10,
11: 11,
})
fmt.Println(m.Size())
// 查询是否存在
fmt.Println(m.Contains(1))
// 查询键值
fmt.Println(m.Get(1))
// 删除数据项
m.Remove(9)
fmt.Println(m.Size())
// 批量删除
m.Removes([]interface{}{10, 11})
fmt.Println(m.Size())
// 当前键名列表(随机排序)
fmt.Println(m.Keys())
// 当前键值列表(随机排序)
fmt.Println(m.Values())
// 查询键名,当键值不存在时,写入给定的默认值
fmt.Println(m.GetOrSet(100, 100))
// 删除键值对,并返回对应的键值
fmt.Println(m.Remove(100))
// 遍历map
m.Iterator(func(k interface{}, v interface{}) bool {
fmt.Printf("%v:%v ", k, v)
return true
})
// 自定义写锁操作
m.LockFunc(func(m map[interface{}]interface{}) {
m[99] = 99
})
// 自定义读锁操作
m.RLockFunc(func(m map[interface{}]interface{}) {
fmt.Println(m[99])
})
// 清空map
m.Clear()
// 判断map是否为空
fmt.Println(m.IsEmpty())
}

View File

@ -0,0 +1,17 @@
package main
import (
"encoding/json"
"fmt"
"github.com/gogf/gf/container/gmap"
)
func main() {
m := gmap.NewIntIntMap()
m.Set(1, 2)
m.Set(3, 4)
b, err := json.Marshal(m)
fmt.Println(err)
fmt.Println(string(b))
}

View File

@ -0,0 +1,26 @@
package main
import (
"github.com/gogf/gf/container/gmap"
"github.com/gogf/gf/frame/g"
)
func main() {
m1 := gmap.New()
m1.Set("1", "1")
m2 := m1.Map()
m2["2"] = "2"
g.Dump(m1.Clone())
g.Dump(m2)
//output:
//{
// "1": "1"
//}
//
//{
// "1": "1",
// "2": "2"
//}
}

View File

@ -0,0 +1,31 @@
package main
import (
"fmt"
"github.com/gogf/gf/container/gmap"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gutil"
)
func main() {
array := g.Slice{2, 3, 1, 5, 4, 6, 8, 7, 9}
hashMap := gmap.New()
linkMap := gmap.NewListMap()
treeMap := gmap.NewTreeMap(gutil.ComparatorInt)
for _, v := range array {
hashMap.Set(v, v)
}
for _, v := range array {
linkMap.Set(v, v)
}
for _, v := range array {
treeMap.Set(v, v)
}
fmt.Println("HashMap Keys:", hashMap.Keys())
fmt.Println("HashMap Values:", hashMap.Values())
fmt.Println("LinkMap Keys:", linkMap.Keys())
fmt.Println("LinkMap Values:", linkMap.Values())
fmt.Println("TreeMap Keys:", treeMap.Keys())
fmt.Println("TreeMap Values:", treeMap.Values())
}

View File

@ -0,0 +1,63 @@
package main
import (
"fmt"
"github.com/gogf/gf/container/gmap"
"github.com/gogf/gf/util/gutil"
)
func main() {
m := gmap.NewTreeMap(gutil.ComparatorInt)
// 设置键值对
for i := 0; i < 10; i++ {
m.Set(i, i)
}
// 查询大小
fmt.Println(m.Size())
// 批量设置键值对(不同的数据类型对象参数不同)
m.Sets(map[interface{}]interface{}{
10: 10,
11: 11,
})
fmt.Println(m.Size())
// 查询是否存在
fmt.Println(m.Contains(1))
// 查询键值
fmt.Println(m.Get(1))
// 删除数据项
m.Remove(9)
fmt.Println(m.Size())
// 批量删除
m.Removes([]interface{}{10, 11})
fmt.Println(m.Size())
// 当前键名列表(随机排序)
fmt.Println(m.Keys())
// 当前键值列表(随机排序)
fmt.Println(m.Values())
// 查询键名,当键值不存在时,写入给定的默认值
fmt.Println(m.GetOrSet(100, 100))
// 删除键值对,并返回对应的键值
fmt.Println(m.Remove(100))
// 遍历map
m.IteratorAsc(func(k interface{}, v interface{}) bool {
fmt.Printf("%v:%v ", k, v)
return true
})
fmt.Println()
// 清空map
m.Clear()
// 判断map是否为空
fmt.Println(m.IsEmpty())
}

View File

@ -0,0 +1,26 @@
package main
import (
"fmt"
"time"
"github.com/gogf/gf/container/gpool"
)
func main() {
// 创建一个对象池过期时间为1000毫秒
p := gpool.New(1000, nil)
// 从池中取一个对象返回nil及错误信息
fmt.Println(p.Get())
// 丢一个对象到池中
p.Put(1)
// 重新从池中取一个对象返回1
fmt.Println(p.Get())
// 等待1秒后重试发现对象已过期返回nil及错误信息
time.Sleep(time.Second)
fmt.Println(p.Get())
}

View File

@ -0,0 +1,33 @@
package main
import (
"fmt"
"time"
"github.com/gogf/gf/container/gpool"
"github.com/gogf/gf/net/gtcp"
"github.com/gogf/gf/os/glog"
)
func main() {
// 创建对象复用池对象过期时间为3000毫秒并给定创建及销毁方法
p := gpool.New(3000, func() (interface{}, error) {
return gtcp.NewConn("www.baidu.com:80")
}, func(i interface{}) {
glog.Println("expired")
i.(*gtcp.Conn).Close()
})
conn, err := p.Get()
if err != nil {
panic(err)
}
result, err := conn.(*gtcp.Conn).SendRecv([]byte("HEAD / HTTP/1.1\n\n"), -1)
if err != nil {
panic(err)
}
fmt.Println(string(result))
// 丢回池中以便重复使用
p.Put(conn)
// 等待一定时间观察过期方法调用
time.Sleep(4 * time.Second)
}

View File

@ -0,0 +1,34 @@
package main
import (
"fmt"
"time"
"github.com/gogf/gf/container/gqueue"
"github.com/gogf/gf/os/gtime"
"github.com/gogf/gf/os/gtimer"
)
func main() {
q := gqueue.New()
// 数据生产者每隔1秒往队列写数据
gtimer.SetInterval(time.Second, func() {
v := gtime.Now().String()
q.Push(v)
fmt.Println("Push:", v)
})
// 3秒后关闭队列
gtimer.SetTimeout(3*time.Second, func() {
q.Close()
})
// 消费者,不停读取队列数据并输出到终端
for {
if v := q.Pop(); v != nil {
fmt.Println(" Pop:", v)
} else {
break
}
}
}

View File

@ -0,0 +1,28 @@
package main
import (
"fmt"
"time"
"github.com/gogf/gf/container/gqueue"
"github.com/gogf/gf/os/gtimer"
)
func main() {
q := gqueue.New()
// 数据生产者每隔1秒往队列写数据
gtimer.SetInterval(time.Second, func() {
for i := 0; i < 10; i++ {
q.Push(i)
}
})
// 消费者,不停读取队列数据并输出到终端
for {
if v := q.Pop(); v != nil {
fmt.Println(" Pop:", v)
} else {
break
}
}
}

View File

@ -0,0 +1,30 @@
package main
import (
"fmt"
"time"
"github.com/gogf/gf/container/gqueue"
"github.com/gogf/gf/os/gtime"
"github.com/gogf/gf/os/gtimer"
)
func main() {
queue := gqueue.New()
// 数据生产者每隔1秒往队列写数据
gtimer.SetInterval(time.Second, func() {
queue.Push(gtime.Now().String())
})
// 消费者,不停读取队列数据并输出到终端
for {
select {
case v := <-queue.C:
if v != nil {
fmt.Println(v)
} else {
return
}
}
}
}

View File

@ -0,0 +1,28 @@
package main
import (
"fmt"
"github.com/gogf/gf/container/gring"
)
func main() {
r1 := gring.New(10)
for i := 0; i < 5; i++ {
r1.Set(i).Next()
}
fmt.Println("Len:", r1.Len())
fmt.Println("Cap:", r1.Cap())
fmt.Println(r1.SlicePrev())
fmt.Println(r1.SliceNext())
r2 := gring.New(10)
for i := 0; i < 10; i++ {
r2.Set(i).Next()
}
fmt.Println("Len:", r2.Len())
fmt.Println("Cap:", r2.Cap())
fmt.Println(r2.SlicePrev())
fmt.Println(r2.SliceNext())
}

View File

@ -0,0 +1,58 @@
package main
import (
"fmt"
"github.com/gogf/gf/container/gring"
)
type Player struct {
position int // 位置
alive bool // 是否存活
}
const (
playerCount = 41 // 玩家人数
startPos = 1 // 开始报数位置
)
var (
deadline = 3
)
func main() {
// 关闭并发安全,当前场景没有必要
r := gring.New(playerCount, false)
// 设置所有玩家初始值
for i := 1; i <= playerCount; i++ {
r.Put(&Player{i, true})
}
// 如果开始报数的位置不为1则设置开始位置
if startPos > 1 {
r.Move(startPos - 1)
}
counter := 1 // 报数从1开始因为下面的循环从第二个开始计算
deadCount := 0 // 死亡人数初始值为0
// 直到所有人都死亡,否则循环一直执行
for deadCount < playerCount {
// 跳到下一个人
r.Next()
// 如果是活着的人,则报数
if r.Val().(*Player).alive {
counter++
}
// 如果报数为deadline则此人淘汰出局
if counter == deadline {
r.Val().(*Player).alive = false
fmt.Printf("Player %d died!\n", r.Val().(*Player).position)
deadCount++
counter = 0
}
}
}

View File

@ -0,0 +1,53 @@
package main
import (
"fmt"
"github.com/gogf/gf/container/gset"
)
func main() {
// 创建一个非并发安全的集合对象
s := gset.New(true)
// 添加数据项
s.Add(1)
// 批量添加数据项
s.Add([]interface{}{1, 2, 3}...)
// 集合数据项大小
fmt.Println(s.Size())
// 集合中是否存在指定数据项
fmt.Println(s.Contains(2))
// 返回数据项slice
fmt.Println(s.Slice())
// 删除数据项
s.Remove(3)
// 遍历数据项
s.Iterator(func(v interface{}) bool {
fmt.Println("Iterator:", v)
return true
})
// 将集合转换为字符串
fmt.Println(s.String())
// 并发安全写锁操作
s.LockFunc(func(m map[interface{}]struct{}) {
m[4] = struct{}{}
})
// 并发安全读锁操作
s.RLockFunc(func(m map[interface{}]struct{}) {
fmt.Println(m)
})
// 清空集合
s.Clear()
fmt.Println(s.Size())
}

View File

@ -0,0 +1,23 @@
package main
import (
"fmt"
"github.com/gogf/gf/container/gset"
"github.com/gogf/gf/frame/g"
)
func main() {
s1 := gset.NewFrom(g.Slice{1, 2, 3})
s2 := gset.NewFrom(g.Slice{4, 5, 6})
s3 := gset.NewFrom(g.Slice{1, 2, 3, 4, 5, 6, 7})
// 交集
fmt.Println(s3.Intersect(s1).Slice())
// 差集
fmt.Println(s3.Diff(s1).Slice())
// 并集
fmt.Println(s1.Union(s2).Slice())
// 补集
fmt.Println(s1.Complement(s3).Slice())
}

View File

@ -0,0 +1,29 @@
package main
import (
"fmt"
"github.com/gogf/gf/container/gtree"
"github.com/gogf/gf/util/gutil"
)
func main() {
tree := gtree.NewAVLTree(gutil.ComparatorInt)
for i := 0; i < 10; i++ {
tree.Set(i, i*10)
}
// 打印树形
tree.Print()
// 前序遍历
fmt.Println("ASC:")
tree.IteratorAsc(func(key, value interface{}) bool {
fmt.Println(key, value)
return true
})
// 后续遍历
fmt.Println("DESC:")
tree.IteratorDesc(func(key, value interface{}) bool {
fmt.Println(key, value)
return true
})
}

View File

@ -0,0 +1,22 @@
package main
import (
"fmt"
"github.com/gogf/gf/container/gtree"
)
func main() {
tree := gtree.NewBTree(10, func(v1, v2 interface{}) int {
return v1.(int) - v2.(int)
})
for i := 0; i < 20; i++ {
tree.Set(i, i*10)
}
fmt.Println(tree.String())
tree.IteratorDesc(func(key, value interface{}) bool {
fmt.Println(key, value)
return true
})
}

View File

@ -0,0 +1,63 @@
package main
import (
"fmt"
"github.com/gogf/gf/container/gtree"
"github.com/gogf/gf/util/gutil"
)
func main() {
m := gtree.NewRedBlackTree(gutil.ComparatorInt)
// 设置键值对
for i := 0; i < 10; i++ {
m.Set(i, i*10)
}
// 查询大小
fmt.Println(m.Size())
// 批量设置键值对(不同的数据类型对象参数不同)
m.Sets(map[interface{}]interface{}{
10: 10,
11: 11,
})
fmt.Println(m.Size())
// 查询是否存在
fmt.Println(m.Contains(1))
// 查询键值
fmt.Println(m.Get(1))
// 删除数据项
m.Remove(9)
fmt.Println(m.Size())
// 批量删除
m.Removes([]interface{}{10, 11})
fmt.Println(m.Size())
// 当前键名列表(随机排序)
fmt.Println(m.Keys())
// 当前键值列表(随机排序)
fmt.Println(m.Values())
// 查询键名,当键值不存在时,写入给定的默认值
fmt.Println(m.GetOrSet(100, 100))
// 删除键值对,并返回对应的键值
fmt.Println(m.Remove(100))
// 遍历map
m.IteratorAsc(func(k interface{}, v interface{}) bool {
fmt.Printf("%v:%v ", k, v)
return true
})
fmt.Println()
// 清空map
m.Clear()
// 判断map是否为空
fmt.Println(m.IsEmpty())
}

View File

@ -0,0 +1,17 @@
package main
import (
"github.com/gogf/gf/container/gtree"
)
func main() {
tree := gtree.NewRedBlackTree(func(v1, v2 interface{}) int {
return v1.(int) - v2.(int)
})
for i := 0; i < 10; i++ {
tree.Set(i, i)
}
tree.Print()
tree.Flip()
tree.Print()
}

View File

@ -0,0 +1,21 @@
package main
import (
"fmt"
"github.com/gogf/gf/container/gtype"
)
func main() {
// 创建一个Int型的并发安全基本类型对象
i := gtype.NewInt()
// 设置值
i.Set(10)
// 获取值
fmt.Println(i.Val())
// (整型/浮点型有效)数值 增加/删除 delta
fmt.Println(i.Add(-1))
}

View File

@ -0,0 +1,33 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
)
func main() {
var v g.Var
v.Set("123")
fmt.Println(v.Val())
// 基本类型转换
fmt.Println(v.Int())
fmt.Println(v.Uint())
fmt.Println(v.Float64())
// slice转换
fmt.Println(v.Ints())
fmt.Println(v.Floats())
fmt.Println(v.Strings())
// struct转换
type Score struct {
Value int
}
s := new(Score)
v.Struct(s)
fmt.Println(s)
}

View File

@ -0,0 +1,8 @@
[database]
type = "mssql"
host = "127.0.0.1"
port = "1451"
user = "sa"
pass = "eno@123"
name = "frpc"

View File

@ -0,0 +1,14 @@
package main
import (
"fmt"
_ "github.com/denisenkom/go-mssqldb"
"github.com/gogf/gf/frame/g"
)
func main() {
r, err := g.DB().GetAll(`SELECT TOP 10 * FROM KF_PatInfo_Emergency`)
fmt.Println(err)
g.Dump(r.ToList())
}

View File

@ -0,0 +1,575 @@
package main
import (
"fmt"
"time"
//_ "github.com/denisenkom/go-mssqldb"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/frame/g"
)
// 本文件用于gf框架的mssql数据库操作示例不作为单元测试使用
var db gdb.DB
// 初始化配置及创建数据库
func init() {
gdb.AddDefaultConfigNode(gdb.ConfigNode{
Host: "127.0.0.1",
Port: "1433",
User: "sa",
Pass: "123456",
Name: "test",
Type: "mssql",
Role: "master",
Charset: "utf8",
})
db, _ = gdb.New()
//gins.Config().SetPath("/home/john/Workspace/Go/GOPATH/src/github.com/gogf/gf/.example/frame")
//db = g.Database()
//gdb.SetConfig(gdb.ConfigNode {
// Host : "127.0.0.1",
// Port : 3306,
// User : "root",
// Pass : "123456",
// Name : "test",
// Type : "mysql",
//})
//db, _ = gdb.Instance()
//gdb.SetConfig(gdb.Config {
// "default" : gdb.ConfigGroup {
// gdb.ConfigNode {
// Host : "127.0.0.1",
// Port : "3306",
// User : "root",
// Pass : "123456",
// Name : "test",
// Type : "mysql",
// Role : "master",
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.2",
// Port : "3306",
// User : "root",
// Pass : "123456",
// Name : "test",
// Type : "mysql",
// Role : "master",
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.3",
// Port : "3306",
// User : "root",
// Pass : "123456",
// Name : "test",
// Type : "mysql",
// Role : "master",
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.4",
// Port : "3306",
// User : "root",
// Pass : "123456",
// Name : "test",
// Type : "mysql",
// Role : "master",
// Weight : 100,
// },
// },
//})
//db, _ = gdb.Instance()
}
// 创建测试数据库
func create() error {
fmt.Println("drop table aa_user:")
_, err := db.Exec("drop table aa_user")
if err != nil {
fmt.Println("drop table aa_user error.", err)
}
s := `
CREATE TABLE aa_user (
id int not null,
name VARCHAR(60),
age int,
addr varchar(60),
PRIMARY KEY (id)
)
`
fmt.Println("create table aa_user:")
_, err = db.Exec(s)
if err != nil {
fmt.Println("create table error.", err)
return err
}
/*_, err = db.Exec("drop sequence id_seq")
if err != nil {
fmt.Println("drop sequence id_seq", err)
}
fmt.Println("create sequence id_seq")
_, err = db.Exec("create sequence id_seq increment by 1 start with 1 maxvalue 9999999999 cycle cache 10")
if err != nil {
fmt.Println("create sequence id_seq error.", err)
return err
}
s = `
CREATE TRIGGER id_trigger before insert on aa_user for each row
begin
select id_seq.nextval into :new.id from dual;
end;
`
_, err = db.Exec(s)
if err != nil {
fmt.Println("create trigger error.", err)
return err
}*/
_, err = db.Exec("drop table user_detail")
if err != nil {
fmt.Println("drop table user_detail", err)
}
s = `
CREATE TABLE user_detail (
id int not null,
site VARCHAR(255),
PRIMARY KEY (id)
)
`
fmt.Println("create table user_detail:")
_, err = db.Exec(s)
if err != nil {
fmt.Println("create table user_detail error.", err)
return err
}
fmt.Println("create table success.")
return nil
}
// 数据写入
func insert(id int) {
fmt.Println("insert:")
r, err := db.Insert("aa_user", gdb.Map{
"id": id,
"name": "john",
"age": id,
})
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
if err == nil {
r, err = db.Insert("user_detail", gdb.Map{
"id": id,
"site": "http://johng.cn",
})
if err == nil {
fmt.Printf("id: %d\n", id)
} else {
fmt.Println(err)
}
} else {
fmt.Println(err)
}
fmt.Println()
}
// 基本sql查询
func query() {
fmt.Println("query:")
list, err := db.GetAll("select * from aa_user where 1=1")
if err == nil {
fmt.Println(list)
} else {
fmt.Println(err)
}
list, err = db.Table("aa_user").OrderBy("id").Limit(0, 5).Select()
if err == nil {
fmt.Println(list)
} else {
fmt.Println(err)
}
fmt.Println()
}
// replace into
func replace() {
fmt.Println("replace:")
r, err := db.Save("aa_user", gdb.Map{
"id": 1,
"name": "john",
})
if err == nil {
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 数据保存
func save() {
fmt.Println("save:")
r, err := db.Save("aa_user", gdb.Map{
"id": 1,
"name": "john",
})
if err == nil {
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 批量写入
func batchInsert() {
fmt.Println("batchInsert:")
_, err := db.BatchInsert("aa_user", gdb.List{
{"id": 11, "name": "batchInsert_john_1", "age": 11},
{"id": 12, "name": "batchInsert_john_2", "age": 12},
{"id": 13, "name": "batchInsert_john_3", "age": 13},
{"id": 14, "name": "batchInsert_john_4", "age": 14},
}, 10)
if err != nil {
fmt.Println(err)
}
fmt.Println()
}
// 数据更新
func update1() {
fmt.Println("update1:")
r, err := db.Update("aa_user", gdb.Map{"name": "john1", "age": 1}, "id=?", 1)
if err == nil {
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 数据更新
func update2() {
fmt.Println("update2:")
r, err := db.Update("aa_user", gdb.Map{"name": "john6", "age": 6}, "id=?", 2)
if err == nil {
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 数据更新
func update3() {
fmt.Println("update3:")
r, err := db.Update("aa_user", "name=?", "id=?", "john2", 3)
if err == nil {
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式查询操作1
func linkopSelect1() {
fmt.Println("linkopSelect1:")
r, err := db.Table("aa_user u").LeftJoin("user_detail ud", "u.id=ud.id").Fields("u.*, ud.site").Where("u.id > ?", 1).Limit(3, 5).Select()
if err == nil {
fmt.Println(r)
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式查询操作2
func linkopSelect2() {
fmt.Println("linkopSelect2:")
r, err := db.Table("aa_user u").LeftJoin("user_detail ud", "u.id=ud.id").Fields("u.*,ud.site").Where("u.id=?", 1).One()
if err == nil {
fmt.Println(r)
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式查询操作3
func linkopSelect3() {
fmt.Println("linkopSelect3:")
r, err := db.Table("aa_user u").LeftJoin("user_detail ud", "u.id=ud.id").Fields("ud.site").Where("u.id=?", 1).Value()
if err == nil {
fmt.Println(r.String())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式查询数量1
func linkopCount1() {
fmt.Println("linkopCount1:")
r, err := db.Table("aa_user u").LeftJoin("user_detail ud", "u.id=ud.id").Where("name like ?", "john").Count()
if err == nil {
fmt.Println(r)
} else {
fmt.Println(err)
}
fmt.Println()
}
// 错误操作
func linkopUpdate1() {
fmt.Println("linkopUpdate1:")
r, err := db.Table("henghe_setting").Update()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println("error", err)
}
fmt.Println()
}
// 通过Map指针方式传参方式
func linkopUpdate2() {
fmt.Println("linkopUpdate2:")
r, err := db.Table("aa_user").Data(gdb.Map{"name": "john2"}).Where("name=?", "john").Update()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 通过字符串方式传参
func linkopUpdate3() {
fmt.Println("linkopUpdate3:")
r, err := db.Table("aa_user").Data("name='john3'").Where("name=?", "john2").Update()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// Where条件使用Map
func linkopUpdate4() {
fmt.Println("linkopUpdate4:")
r, err := db.Table("aa_user").Data(gdb.Map{"name": "john11111"}).Where(g.Map{"id": 1}).Update()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式批量写入
func linkopBatchInsert1() {
fmt.Println("linkopBatchInsert1:")
r, err := db.Table("aa_user").Filter().Data(gdb.List{
{"id": 21, "name": "linkopBatchInsert1_john_1", "amt": 21.21, "tt": "haha"},
{"id": 22, "name": "linkopBatchInsert1_john_2", "amt": 22.22, "cc": "hahacc"},
{"id": 23, "name": "linkopBatchInsert1_john_3", "amt": 23.23, "bb": "hahabb"},
{"id": 24, "name": "linkopBatchInsert1_john_4", "amt": 24.24, "aa": "hahaaa"},
}).Insert()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式批量写入,指定每批次写入的条数
func linkopBatchInsert2() {
fmt.Println("linkopBatchInsert2:")
r, err := db.Table("aa_user").Data(gdb.List{
{"id": 25, "name": "linkopBatchInsert2john_1"},
{"id": 26, "name": "linkopBatchInsert2john_2"},
{"id": 27, "name": "linkopBatchInsert2john_3"},
{"id": 28, "name": "linkopBatchInsert2john_4"},
}).Batch(2).Insert()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式批量保存
func linkopBatchSave() {
fmt.Println("linkopBatchSave:")
r, err := db.Table("aa_user").Data(gdb.List{
{"id": 1, "name": "john_1"},
{"id": 2, "name": "john_2"},
{"id": 3, "name": "john_3"},
{"id": 4, "name": "john_4"},
}).Save()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 事务操作示例1
func transaction1() {
fmt.Println("transaction1:")
if tx, err := db.Begin(); err == nil {
r, err := tx.Insert("aa_user", gdb.Map{
"id": 30,
"name": "transaction1",
})
tx.Rollback()
fmt.Println(r, err)
}
fmt.Println()
}
// 事务操作示例2
func transaction2() {
fmt.Println("transaction2:")
if tx, err := db.Begin(); err == nil {
r, err := tx.Table("user_detail").Data(gdb.Map{"id": 6, "site": "www.baidu.com哈哈哈*?''\"~!@#$%^&*()"}).Insert()
tx.Commit()
fmt.Println(r, err)
}
fmt.Println()
}
// 主从io复用测试在mysql中使用 show full processlist 查看链接信息
func keepPing() {
fmt.Println("keepPing:")
for i := 0; i < 30; i++ {
fmt.Println("ping...", i)
err := db.PingMaster()
if err != nil {
fmt.Println(err)
return
}
err = db.PingSlave()
if err != nil {
fmt.Println(err)
return
}
time.Sleep(1 * time.Second)
}
}
// like语句查询
func likeQuery() {
fmt.Println("likeQuery:")
if r, err := db.Table("aa_user").Where("name like ?", "%john%").Select(); err == nil {
fmt.Println(r)
} else {
fmt.Println(err)
}
}
// mapToStruct
func mapToStruct() {
type User struct {
Id int
Name string
Age int
Addr string
}
fmt.Println("mapToStruct:")
if r, err := db.Table("aa_user").Where("id=?", 1).One(); err == nil {
u := User{}
if err := r.ToStruct(&u); err == nil {
fmt.Println(r)
fmt.Println(u)
} else {
fmt.Println(err)
}
} else {
fmt.Println(err)
}
}
// getQueriedSqls
func getQueriedSqls() {
for k, v := range db.GetQueriedSqls() {
fmt.Println(k, ":")
fmt.Println("Sql :", v.Sql)
fmt.Println("Args :", v.Args)
fmt.Println("Error:", v.Error)
}
}
func main() {
db.PingMaster()
db.SetDebug(true)
/*err := create()
if err != nil {
return
}*/
//test1
/*for i := 1; i < 5; i++ {
insert(i)
}*/
//insert(2)
//query()
//batchInsert()
//query()
//replace()
//save()
/*update1()
update2()
update3()
*/
/*linkopSelect1()
linkopSelect2()
linkopSelect3()
linkopCount1()
*/
/*linkopUpdate1()
linkopUpdate2()
linkopUpdate3()
linkopUpdate4()
*/
linkopBatchInsert1()
query()
//linkopBatchInsert2()
//transaction1()
//transaction2()
//
//keepPing()
//likeQuery()
//mapToStruct()
//getQueriedSqls()
}

View File

@ -0,0 +1,5 @@
# MySQL数据库配置
[database]
link = "mysql:root:12345678@tcp(127.0.0.1:3306)/test"

View File

@ -0,0 +1,4 @@
# MySQL数据库配置
[database]
link = "mysql:root:8692651@tcp(192.168.1.11:3306)/test"

View File

@ -0,0 +1,7 @@
# MySQL数据库配置
[database]
[database.default]
link = "mysql:root:8692651@tcp(192.168.1.11:3306)/test"
[database.user]
link = "mysql:root:8692651@tcp(192.168.1.11:3306)/test"

View File

@ -0,0 +1,533 @@
package main
import (
"fmt"
"time"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/frame/g"
)
// 本文件用于gf框架的mysql数据库操作示例不作为单元测试使用
var db gdb.DB
// 初始化配置及创建数据库
func init() {
gdb.AddDefaultConfigNode(gdb.ConfigNode{
Host: "127.0.0.1",
Port: "3306",
User: "root",
Pass: "12345678",
Name: "test",
Type: "mysql",
Role: "master",
Charset: "utf8",
})
db, _ = gdb.New()
//gins.Config().SetPath("/home/john/Workspace/Go/GOPATH/src/github.com/gogf/gf/.example/frame")
//db = g.Database()
//gdb.SetConfig(gdb.ConfigNode {
// Host : "127.0.0.1",
// Port : 3306,
// User : "root",
// Pass : "123456",
// Name : "test",
// Type : "mysql",
//})
//db, _ = gdb.Instance()
//gdb.SetConfig(gdb.Config {
// "default" : gdb.ConfigGroup {
// gdb.ConfigNode {
// Host : "127.0.0.1",
// Port : "3306",
// User : "root",
// Pass : "123456",
// Name : "test",
// Type : "mysql",
// Role : "master",
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.2",
// Port : "3306",
// User : "root",
// Pass : "123456",
// Name : "test",
// Type : "mysql",
// Role : "master",
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.3",
// Port : "3306",
// User : "root",
// Pass : "123456",
// Name : "test",
// Type : "mysql",
// Role : "master",
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.4",
// Port : "3306",
// User : "root",
// Pass : "123456",
// Name : "test",
// Type : "mysql",
// Role : "master",
// Weight : 100,
// },
// },
//})
//db, _ = gdb.Instance()
}
// 创建测试数据库
func create() {
fmt.Println("create:")
_, err := db.Exec("CREATE DATABASE IF NOT EXISTS test")
if err != nil {
fmt.Println(err)
}
s := `
CREATE TABLE IF NOT EXISTS user (
uid INT(10) UNSIGNED AUTO_INCREMENT,
name VARCHAR(45),
PRIMARY KEY (uid)
)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
`
_, err = db.Exec(s)
if err != nil {
fmt.Println(err)
}
s = `
CREATE TABLE IF NOT EXISTS user_detail (
uid INT(10) UNSIGNED AUTO_INCREMENT,
site VARCHAR(255),
PRIMARY KEY (uid)
)
ENGINE = InnoDB
DEFAULT CHARACTER SET = utf8
`
_, err = db.Exec(s)
if err != nil {
fmt.Println(err)
}
fmt.Println()
}
// 数据写入
func insert() {
fmt.Println("insert:")
r, err := db.Insert("user", gdb.Map{
"name": "john",
})
if err == nil {
uid, err2 := r.LastInsertId()
if err2 == nil {
r, err = db.Insert("user_detail", gdb.Map{
"uid": uid,
"site": "http://johng.cn",
})
if err == nil {
fmt.Printf("uid: %d\n", uid)
} else {
fmt.Println(err)
}
} else {
fmt.Println(err2)
}
} else {
fmt.Println(err)
}
fmt.Println()
}
// 基本sql查询
func query() {
fmt.Println("query:")
list, err := db.GetAll("select * from user limit 2")
if err == nil {
fmt.Println(list)
} else {
fmt.Println(err)
}
fmt.Println()
}
// replace into
func replace() {
fmt.Println("replace:")
r, err := db.Save("user", gdb.Map{
"uid": 1,
"name": "john",
})
if err == nil {
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 数据保存
func save() {
fmt.Println("save:")
r, err := db.Save("user", gdb.Map{
"uid": 1,
"name": "john",
})
if err == nil {
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 批量写入
func batchInsert() {
fmt.Println("batchInsert:")
_, err := db.BatchInsert("user", gdb.List{
{"name": "john_1"},
{"name": "john_2"},
{"name": "john_3"},
{"name": "john_4"},
}, 10)
if err != nil {
fmt.Println(err)
}
fmt.Println()
}
// 数据更新
func update1() {
fmt.Println("update1:")
r, err := db.Update("user", gdb.Map{"name": "john1"}, "uid=?", 1)
if err == nil {
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 数据更新
func update2() {
fmt.Println("update2:")
r, err := db.Update("user", gdb.Map{"name": "john6"}, "uid=?", 1)
if err == nil {
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 数据更新
func update3() {
fmt.Println("update3:")
r, err := db.Update("user", "name=?", "uid=?", "john2", 1)
if err == nil {
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式查询操作1
func linkopSelect1() {
fmt.Println("linkopSelect1:")
r, err := db.Table("user u").LeftJoin("user_detail ud", "u.uid=ud.uid").Fields("u.*, ud.site").Where("u.uid > ?", 1).Limit(0, 2).Select()
if err == nil {
fmt.Println(r)
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式查询操作2
func linkopSelect2() {
fmt.Println("linkopSelect2:")
r, err := db.Table("user u").LeftJoin("user_detail ud", "u.uid=ud.uid").Fields("u.*,ud.site").Where("u.uid=?", 1).One()
if err == nil {
fmt.Println(r)
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式查询操作3
func linkopSelect3() {
fmt.Println("linkopSelect3:")
r, err := db.Table("user u").LeftJoin("user_detail ud", "u.uid=ud.uid").Fields("ud.site").Where("u.uid=?", 1).Value()
if err == nil {
fmt.Println(r.String())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式查询数量1
func linkopCount1() {
fmt.Println("linkopCount1:")
r, err := db.Table("user u").Fields("uid").LeftJoin("user_detail ud", "u.uid=ud.uid").Where("u.uid=?", 1).Count()
if err == nil {
fmt.Println(r)
} else {
fmt.Println(err)
}
fmt.Println()
}
// 错误操作
func linkopUpdate1() {
fmt.Println("linkopUpdate1:")
r, err := db.Table("henghe_setting").Update()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 通过Map指针方式传参方式
func linkopUpdate2() {
fmt.Println("linkopUpdate2:")
r, err := db.Table("user").Data(gdb.Map{"name": "john2"}).Where("name=?", "john_1").Update()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 通过字符串方式传参
func linkopUpdate3() {
fmt.Println("linkopUpdate3:")
r, err := db.Table("user").Data("name='john3'").Where("name=?", "john2").Update()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// Where条件使用Map
func linkopUpdate4() {
fmt.Println("linkopUpdate4:")
r, err := db.Table("user").Data(gdb.Map{"name": "john11111"}).Where(g.Map{"uid": 1}).Update()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式批量写入
func linkopBatchInsert1() {
fmt.Println("linkopBatchInsert1:")
r, err := db.Table("user").Data(gdb.List{
{"name": "john_1"},
{"name": "john_2"},
{"name": "john_3"},
{"name": "john_4"},
}).Insert()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式批量写入,指定每批次写入的条数
func linkopBatchInsert2() {
fmt.Println("linkopBatchInsert2:")
r, err := db.Table("user").Data(gdb.List{
{"name": "john_1"},
{"name": "john_2"},
{"name": "john_3"},
{"name": "john_4"},
}).Batch(2).Insert()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式批量保存
func linkopBatchSave() {
fmt.Println("linkopBatchSave:")
r, err := db.Table("user").Data(gdb.List{
{"uid": 1, "name": "john_1"},
{"uid": 2, "name": "john_2"},
{"uid": 3, "name": "john_3"},
{"uid": 4, "name": "john_4"},
}).Save()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 事务操作示例1
func transaction1() {
fmt.Println("transaction1:")
if tx, err := db.Begin(); err == nil {
r, err := tx.Save("user", gdb.Map{
"uid": 1,
"name": "john",
})
tx.Rollback()
fmt.Println(r, err)
}
fmt.Println()
}
// 事务操作示例2
func transaction2() {
fmt.Println("transaction2:")
if tx, err := db.Begin(); err == nil {
r, err := tx.Table("user").Data(gdb.Map{"uid": 1, "name": "john_1"}).Save()
tx.Commit()
fmt.Println(r, err)
}
fmt.Println()
}
// 主从io复用测试在mysql中使用 show full processlist 查看链接信息
func keepPing() {
fmt.Println("keepPing:")
for {
fmt.Println("ping...")
err := db.PingMaster()
if err != nil {
fmt.Println(err)
return
}
err = db.PingSlave()
if err != nil {
fmt.Println(err)
return
}
time.Sleep(1 * time.Second)
}
}
// like语句查询
func likeQuery() {
fmt.Println("likeQuery:")
if r, err := db.Table("user").Where("name like ?", "%john%").Select(); err == nil {
fmt.Println(r)
} else {
fmt.Println(err)
}
}
// mapToStruct
func mapToStruct() {
type User struct {
Uid int
Name string
}
fmt.Println("mapToStruct:")
if r, err := db.Table("user").Where("uid=?", 1).One(); err == nil {
u := User{}
if err := r.ToStruct(&u); err == nil {
fmt.Println(r)
fmt.Println(u)
} else {
fmt.Println(err)
}
} else {
fmt.Println(err)
}
}
// getQueriedSqls
func getQueriedSqls() {
for k, v := range db.GetQueriedSqls() {
fmt.Println(k, ":")
fmt.Println("Sql :", v.Sql)
fmt.Println("Args :", v.Args)
fmt.Println("Error:", v.Error)
fmt.Println("Func :", v.Func)
}
}
func main() {
//data := g.Map{
// "nickname" : "john",
//}
//db.SetDebug(true)
//r, err := db.Table("user").Where("id=1").Data(data).Update()
//fmt.Println(err)
//fmt.Println(r.RowsAffected())
//data2 := g.Map{
// "adsys1" : "ss",
//}
//db.SetDebug(true)
//r, err := db.Table("cd_adsys").Where("adsys0=1").Data(data2).Update()
//fmt.Println(err)
//fmt.Println(r.RowsAffected())
//return
//db.SetDebug(true)
//r, err := db.Table("test").Where("id=1").One()
//fmt.Println(r["datetime"])
//fmt.Println(r["datetime"].Time().Date())
//fmt.Println(err)
//create()
//create()
//insert()
//query()
//replace()
//save()
//batchInsert()
//update1()
//update2()
//update3()
linkopSelect1()
//linkopSelect2()
//linkopSelect3()
//linkopCount1()
//linkopUpdate1()
//linkopUpdate2()
//linkopUpdate3()
//linkopUpdate4()
//
//transaction1()
//transaction2()
//
//keepPing()
//likeQuery()
//mapToStruct()
//getQueriedSqls()
}

View File

@ -0,0 +1,21 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
)
func main() {
db := g.DB()
// 开启调试模式以便于记录所有执行的SQL
db.SetDebug(true)
r, e := db.Table("test").OrderBy("id asc").All()
if e != nil {
panic(e)
}
if r != nil {
fmt.Println(r.ToList())
}
}

View File

@ -0,0 +1,23 @@
package main
import (
"github.com/gogf/gf/frame/g"
)
func main() {
db := g.DB()
db.Table("user").Where("nickname like ? and passport like ?", g.Slice{"T3", "t3"}).OrderBy("id asc").All()
conditions := g.Map{
"nickname like ?": "%T%",
"id between ? and ?": g.Slice{1, 3},
"id >= ?": 1,
"create_time > ?": 0,
"id in(?)": g.Slice{1, 2, 3},
}
db.Table("user").Where(conditions).OrderBy("id asc").All()
var params []interface{}
db.Table("user").Where("1=1", params).OrderBy("id asc").All()
}

View File

@ -0,0 +1,51 @@
package main
import (
"fmt"
"github.com/gogf/gf/crypto/gaes"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/frame/g"
)
func main() {
gdb.AddDefaultConfigNode(gdb.ConfigNode{
Host: "127.0.0.1",
Port: "3306",
User: "root",
Pass: "123456",
Name: "test",
Type: "mysql",
Role: "master",
Charset: "utf8",
})
db, err := gdb.New()
if err != nil {
panic(err)
}
key := "0123456789123456"
name := "john"
encryptedName, err := gaes.Encrypt([]byte(name), []byte(key))
if err != nil {
fmt.Println(err)
}
// 写入
r, err := db.Table("user").Data(g.Map{
"uid": 1,
"name": encryptedName,
}).Save()
if err != nil {
fmt.Println(err)
}
fmt.Println(r.RowsAffected())
// 查询
one, err := db.Table("user").Where("name=?", encryptedName).One()
if err != nil {
fmt.Println(err)
}
fmt.Println(one.ToMap())
}

View File

@ -0,0 +1,20 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
)
func main() {
db := g.DB()
db.SetDebug(true)
r, e := db.Table("test").All()
if e != nil {
panic(e)
}
if r != nil {
fmt.Println(r.ToList())
}
}

View File

@ -0,0 +1,38 @@
package main
import (
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/util/gutil"
)
func main() {
gdb.AddDefaultConfigNode(gdb.ConfigNode{
Host: "127.0.0.1",
Port: "3306",
User: "root",
Pass: "123456",
Name: "test",
Type: "mysql",
Role: "master",
Charset: "utf8",
})
db, err := gdb.New()
if err != nil {
panic(err)
}
// 开启调试模式以便于记录所有执行的SQL
db.SetDebug(true)
// 执行2次查询并将查询结果缓存3秒并可执行缓存名称(可选)
for i := 0; i < 2; i++ {
r, _ := db.Table("user").Cache(3, "vip-user").Where("uid=?", 1).One()
gutil.Dump(r.ToMap())
}
// 执行更新操作,并清理指定名称的查询缓存
db.Table("user").Cache(-1, "vip-user").Data(gdb.Map{"name": "smith"}).Where("uid=?", 1).Update()
// 再次执行查询,启用查询缓存特性
r, _ := db.Table("user").Cache(3, "vip-user").Where("uid=?", 1).One()
gutil.Dump(r.ToMap())
}

View File

@ -0,0 +1,16 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
)
func main() {
if r, err := g.DB().Table("user").Where("uid=?", 1).One(); err == nil {
fmt.Println(r["uid"].Int())
fmt.Println(r["name"].String())
} else {
fmt.Println(err)
}
}

View File

@ -0,0 +1,17 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
)
func main() {
g.Config().SetFileName("config2.toml")
if r, err := g.DB().Table("user").Where("uid=?", 1).One(); err == nil {
fmt.Println(r["uid"].Int())
fmt.Println(r["name"].String())
} else {
fmt.Println(err)
}
}

View File

@ -0,0 +1,24 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
)
func main() {
g.Config().SetFileName("config3.toml")
if r, err := g.DB().Table("user").Where("uid=?", 1).One(); err == nil {
fmt.Println(r["uid"].Int())
fmt.Println(r["name"].String())
} else {
fmt.Println(err)
}
if r, err := g.DB("user").Table("user").Where("uid=?", 1).One(); err == nil {
fmt.Println(r["uid"].Int())
fmt.Println(r["name"].String())
} else {
fmt.Println(err)
}
}

View File

@ -0,0 +1,30 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/os/gtime"
)
func main() {
db := g.Database()
db.SetDebug(true)
//r, err := db.Table("user").Data("create_time", gtime.Now().String()).Insert()
//if err == nil {
// fmt.Println(r.LastInsertId())
//} else {
// panic(err)
//}
r, err := db.Table("user").Data(g.Map{
"name": "john",
"create_time": gtime.Now().String(),
}).Insert()
if err == nil {
fmt.Println(r.LastInsertId())
} else {
panic(err)
}
}

View File

@ -0,0 +1,42 @@
package main
import (
"fmt"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/os/glog"
)
func main() {
gdb.AddDefaultConfigNode(gdb.ConfigNode{
Host: "127.0.0.1",
Port: "3306",
User: "root",
Pass: "12345678",
Name: "test",
Type: "mysql",
Role: "master",
Charset: "utf8",
})
db, err := gdb.New()
if err != nil {
panic(err)
}
db.SetDebug(true)
glog.SetPath("/tmp")
// 执行3条SQL查询
for i := 1; i <= 3; i++ {
db.Table("user").Where("uid=?", i).One()
}
// 构造一条错误查询
db.Table("user").Where("no_such_field=?", "just_test").One()
db.Table("user").Data(g.Map{"name": "smith"}).Where("uid=?", 1).Save()
db.PrintQueriedSqls()
fmt.Println(db.GetLastSql())
}

View File

@ -0,0 +1,17 @@
package main
import (
"github.com/gogf/gf/frame/g"
)
func main() {
db := g.DB()
// 执行3条SQL查询
for i := 1; i <= 3; i++ {
db.Table("user").Where("id=?", i).One()
}
// 构造一条错误查询
db.Table("user").Where("no_such_field=?", "just_test").One()
db.Table("user").Data(g.Map{"name": "smith"}).Where("uid=?", 1).Save()
}

View File

@ -0,0 +1,27 @@
package main
import (
"fmt"
"time"
"github.com/gogf/gf/frame/g"
)
func main() {
db := g.DB()
// 开启调试模式以便于记录所有执行的SQL
db.SetDebug(true)
r, e := db.Table("user").Data(g.Map{
"passport": "1",
"password": "1",
"nickname": "1",
"create_time": time.Now(),
}).Insert()
if e != nil {
panic(e)
}
if r != nil {
fmt.Println(r.LastInsertId())
}
}

View File

@ -0,0 +1,50 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
)
var (
tableName = "orders"
dao = g.DB().Table(tableName).Safe()
)
type OrderServiceEntity struct {
GoodsPrice float64 `json:"goods_price" gvalid:"required"`
PayTo int8 `json:"payTo" gvalid:"required"`
PayStatus int8 `json:"payStatus" `
CreateTime string `json:"createTime" `
AppId string `json:"appId" gvalid:"required"`
PayUser string `json:"pay_user" gvalid:"required"`
QrUrl string `json:"qr_url" `
}
type Create struct {
Id int64 `json:"id" gconv:"id"`
GoodsPrice float64 `json:"goodsPrice" gconv:"goods_price"`
PayTo int8 `json:"payTo" gconv:"pay_to"`
PayStatus int8 `json:"payStatus" gconv:"pay_status"`
CreateTime string `json:"createTime" gconv:"create_time"`
UserId int `json:"user_id" `
PayUser string `json:"pay_user" `
QrUrl string `json:"qr_url" `
}
func main() {
g.DB().SetDebug(true)
userInfo := Create{
Id: 3,
}
orderService := OrderServiceEntity{
GoodsPrice: 0.1,
PayTo: 1,
}
size, err := dao.Where("user_id", userInfo.Id).
And("goods_price", float64(100.10)).
And("pay_status", 0).
And("pay_to", orderService.PayTo).Count()
fmt.Println(err)
fmt.Println(size)
}

View File

@ -0,0 +1,37 @@
package main
import (
"fmt"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/encoding/gparser"
"github.com/gogf/gf/frame/g"
)
func main() {
gdb.AddDefaultConfigNode(gdb.ConfigNode{
Host: "127.0.0.1",
Port: "3306",
User: "root",
Pass: "12345678",
Name: "test",
Type: "mysql",
Role: "master",
Charset: "utf8",
})
db := g.DB()
one, err := db.Table("user").Where("id=?", 1).One()
if err != nil {
panic(err)
}
// 使用内置方法转换为json/xml
fmt.Println(one.ToJson())
fmt.Println(one.ToXml())
// 自定义方法方法转换为json/xml
jsonContent, _ := gparser.VarToJson(one.ToMap())
fmt.Println(string(jsonContent))
xmlContent, _ := gparser.VarToXml(one.ToMap())
fmt.Println(string(xmlContent))
}

View File

@ -0,0 +1,25 @@
package main
import (
"time"
"github.com/gogf/gf/frame/g"
)
func main() {
db := g.DB()
db.SetMaxIdleConnCount(10)
db.SetMaxOpenConnCount(10)
db.SetMaxConnLifetime(time.Minute)
// 开启调试模式以便于记录所有执行的SQL
db.SetDebug(true)
for {
for i := 0; i < 10; i++ {
go db.Table("user").All()
}
time.Sleep(time.Second)
}
}

View File

@ -0,0 +1,23 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
)
func main() {
db := g.DB()
// 开启调试模式以便于记录所有执行的SQL
db.SetDebug(true)
type User struct {
Uid int
Name string
}
user := (*User)(nil)
fmt.Println(user)
err := db.Table("test").Where("id=1").Struct(&user)
fmt.Println(err)
fmt.Println(user)
}

View File

@ -0,0 +1,18 @@
package main
import (
"github.com/gogf/gf/frame/g"
)
func main() {
db := g.DB()
db.SetDebug(true)
tables, err := db.Tables()
if err != nil {
panic(err)
}
if tables != nil {
g.Dump(tables)
}
}

View File

@ -0,0 +1,25 @@
package main
import (
"github.com/gogf/gf/frame/g"
)
func main() {
db := g.DB()
db.SetDebug(true)
tables, e := db.Tables()
if e != nil {
panic(e)
}
if tables != nil {
g.Dump(tables)
for _, table := range tables {
fields, err := db.TableFields(table)
if err != nil {
panic(err)
}
g.Dump(fields)
}
}
}

View File

@ -0,0 +1,34 @@
package main
import (
"database/sql"
"github.com/gogf/gf/os/gfile"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g"
)
func main() {
db := g.DB()
table := "medicine_clinics_upload_yinchuan"
list, err := db.Table(table).All()
if err != nil && err != sql.ErrNoRows {
panic(err)
}
content := ""
for _, item := range list {
if j, err := gjson.DecodeToJson(item["upload_data"].String()); err != nil {
panic(err)
} else {
s, _ := j.ToJsonIndentString()
content += item["id"].String() + "\t" + item["medicine_clinic_id"].String() + "\t"
content += s
content += "\n\n"
//if _, err := db.Table(table).Data("data_decode", s).Where("id", item["id"].Int()).Update(); err != nil {
// panic(err)
//}
}
}
gfile.PutContents("/Users/john/Temp/medicine_clinics_upload_yinchuan.txt", content)
}

View File

@ -0,0 +1,17 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
)
func main() {
db := g.DB()
db.SetDebug(true)
result, err := db.Table("pw_passageway m,pw_template t").Data("t.status", 99).Where("m.templateId=t.id AND m.status = 0").Update()
if err != nil {
panic(err)
}
fmt.Println(result.RowsAffected())
}

View File

@ -0,0 +1,20 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
)
func main() {
db := g.DB()
db.SetDebug(true)
r, e := db.Table("test").Where("id IN (?)", []interface{}{1, 2}).All()
if e != nil {
panic(e)
}
if r != nil {
fmt.Println(r.ToList())
}
}

View File

@ -0,0 +1,575 @@
package main
import (
"fmt"
"time"
//_ "github.com/mattn/go-oci8"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/frame/g"
)
// 本文件用于gf框架的mysql数据库操作示例不作为单元测试使用
var db gdb.DB
// 初始化配置及创建数据库
func init() {
gdb.AddDefaultConfigNode(gdb.ConfigNode{
Host: "192.168.146.0",
Port: "1521",
User: "test",
Pass: "test",
Name: "orcl",
Type: "oracle",
Role: "master",
})
db, _ = gdb.New()
//gins.Config().SetPath("/home/john/Workspace/Go/GOPATH/src/github.com/gogf/gf/.example/frame")
//db = g.Database()
//gdb.SetConfig(gdb.ConfigNode {
// Host : "127.0.0.1",
// Port : 3306,
// User : "root",
// Pass : "123456",
// Name : "test",
// Type : "mysql",
//})
//db, _ = gdb.Instance()
//gdb.SetConfig(gdb.Config {
// "default" : gdb.ConfigGroup {
// gdb.ConfigNode {
// Host : "127.0.0.1",
// Port : "3306",
// User : "root",
// Pass : "123456",
// Name : "test",
// Type : "mysql",
// Role : "master",
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.2",
// Port : "3306",
// User : "root",
// Pass : "123456",
// Name : "test",
// Type : "mysql",
// Role : "master",
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.3",
// Port : "3306",
// User : "root",
// Pass : "123456",
// Name : "test",
// Type : "mysql",
// Role : "master",
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.4",
// Port : "3306",
// User : "root",
// Pass : "123456",
// Name : "test",
// Type : "mysql",
// Role : "master",
// Weight : 100,
// },
// },
//})
//db, _ = gdb.Instance()
}
// 创建测试数据库
func create() error {
fmt.Println("drop table aa_user:")
_, err := db.Exec("drop table aa_user")
if err != nil {
fmt.Println("drop table aa_user error.", err)
}
s := `
CREATE TABLE aa_user (
id number(10) not null,
name VARCHAR2(45),
age number(8),
addr varchar2(60),
amt number(12,2),
PRIMARY KEY (id)
)
`
fmt.Println("create table aa_user:")
_, err = db.Exec(s)
if err != nil {
fmt.Println("create table error.", err)
return err
}
_, err = db.Exec("drop sequence id_seq")
if err != nil {
fmt.Println("drop sequence id_seq", err)
}
/*fmt.Println("create sequence id_seq")
_, err = db.Exec("create sequence id_seq increment by 1 start with 1 maxvalue 9999999999 cycle cache 10")
if err != nil {
fmt.Println("create sequence id_seq error.", err)
return err
}
s = `
CREATE TRIGGER id_trigger before insert on aa_user for each row
begin
select id_seq.nextval into :new.id from dual;
end;
`
_, err = db.Exec(s)
if err != nil {
fmt.Println("create trigger error.", err)
return err
}*/
_, err = db.Exec("drop table user_detail")
if err != nil {
fmt.Println("drop table user_detail", err)
}
s = `
CREATE TABLE user_detail (
id number(10) not null,
site VARCHAR2(255),
PRIMARY KEY (id)
)
`
fmt.Println("create table user_detail:")
_, err = db.Exec(s)
if err != nil {
fmt.Println("create table user_detail error.", err)
return err
}
fmt.Println("create table success.")
return nil
}
// 数据写入
func insert(id int) {
fmt.Println("insert:")
r, err := db.Insert("aa_user", gdb.Map{
"id": id,
"name": "john",
"age": id,
})
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
if err == nil {
r, err = db.Insert("user_detail", gdb.Map{
"id": id,
"site": "http://johng.cn",
})
if err == nil {
fmt.Printf("id: %d\n", id)
} else {
fmt.Println(err)
}
} else {
fmt.Println(err)
}
fmt.Println()
}
// 基本sql查询
func query() {
fmt.Println("query:")
list, err := db.GetAll("select * from aa_user")
if err == nil {
fmt.Println(list)
} else {
fmt.Println(err)
}
list, err = db.Table("aa_user").OrderBy("id").Limit(0, 2).Select()
if err == nil {
fmt.Println(list)
} else {
fmt.Println(err)
}
fmt.Println()
}
// replace into
func replace() {
fmt.Println("replace:")
r, err := db.Save("aa_user", gdb.Map{
"id": 1,
"name": "john",
})
if err == nil {
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 数据保存
func save() {
fmt.Println("save:")
r, err := db.Save("aa_user", gdb.Map{
"id": 1,
"name": "john",
})
if err == nil {
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 批量写入
func batchInsert() {
fmt.Println("batchInsert:")
_, err := db.BatchInsert("aa_user", gdb.List{
{"id": 11, "name": "batchInsert_john_1", "age": 11, "amt": 11.11},
{"id": 12, "name": "batchInsert_john_2", "age": 12, "amt": 12.12},
{"id": 13, "name": "batchInsert_john_3", "age": 13, "amt": 13.13},
{"id": 14, "name": "batchInsert_john_4", "age": 14, "amt": 14.14},
}, 10)
if err != nil {
fmt.Println(err)
}
fmt.Println()
}
// 数据更新
func update1() {
fmt.Println("update1:")
r, err := db.Update("aa_user", gdb.Map{"name": "john1", "age": 1}, "id=?", 1)
if err == nil {
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 数据更新
func update2() {
fmt.Println("update2:")
r, err := db.Update("aa_user", gdb.Map{"name": "john6", "age": 6}, "id=?", 2)
if err == nil {
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 数据更新
func update3() {
fmt.Println("update3:")
r, err := db.Update("aa_user", "name=?", "id=?", "john2", 3)
if err == nil {
fmt.Println(r.LastInsertId())
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式查询操作1
func linkopSelect1() {
fmt.Println("linkopSelect1:")
r, err := db.Table("aa_user u").LeftJoin("user_detail ud", "u.id=ud.id").Fields("u.*, ud.site").Where("u.id > ?", 1).Limit(0, 2).Select()
if err == nil {
fmt.Println(r)
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式查询操作2
func linkopSelect2() {
fmt.Println("linkopSelect2:")
r, err := db.Table("aa_user u").LeftJoin("user_detail ud", "u.id=ud.id").Fields("u.*,ud.site").Where("u.id=?", 1).One()
if err == nil {
fmt.Println(r)
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式查询操作3
func linkopSelect3() {
fmt.Println("linkopSelect3:")
r, err := db.Table("aa_user u").LeftJoin("user_detail ud", "u.id=ud.id").Fields("ud.site").Where("u.id=?", 1).Value()
if err == nil {
fmt.Println(r.String())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式查询数量1
func linkopCount1() {
fmt.Println("linkopCount1:")
r, err := db.Table("aa_user u").LeftJoin("user_detail ud", "u.id=ud.id").Where("name like ?", "john").Count()
if err == nil {
fmt.Println(r)
} else {
fmt.Println(err)
}
fmt.Println()
}
// 错误操作
func linkopUpdate1() {
fmt.Println("linkopUpdate1:")
r, err := db.Table("henghe_setting").Update()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println("error", err)
}
fmt.Println()
}
// 通过Map指针方式传参方式
func linkopUpdate2() {
fmt.Println("linkopUpdate2:")
r, err := db.Table("aa_user").Data(gdb.Map{"name": "john2"}).Where("name=?", "john").Update()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 通过字符串方式传参
func linkopUpdate3() {
fmt.Println("linkopUpdate3:")
r, err := db.Table("aa_user").Data("name='john3'").Where("name=?", "john2").Update()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// Where条件使用Map
func linkopUpdate4() {
fmt.Println("linkopUpdate4:")
r, err := db.Table("aa_user").Data(gdb.Map{"name": "john11111"}).Where(g.Map{"id": 1}).Update()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式批量写入
func linkopBatchInsert1() {
fmt.Println("linkopBatchInsert1:")
r, err := db.Table("aa_user").Filter().Data(gdb.List{
{"id": 21, "name": "linkopBatchInsert1_john_1", "amt": 21.21, "tt": "haha"},
{"id": 22, "name": "linkopBatchInsert1_john_2", "amt": 22.22, "cc": "hahacc"},
{"id": 23, "name": "linkopBatchInsert1_john_3", "amt": 23.23, "bb": "hahabb"},
{"id": 24, "name": "linkopBatchInsert1_john_4", "amt": 24.24, "aa": "hahaaa"},
}).Insert()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式批量写入,指定每批次写入的条数
func linkopBatchInsert2() {
fmt.Println("linkopBatchInsert2:")
r, err := db.Table("aa_user").Data(gdb.List{
{"id": 25, "name": "linkopBatchInsert2john_1"},
{"id": 26, "name": "linkopBatchInsert2john_2"},
{"id": 27, "name": "linkopBatchInsert2john_3"},
{"id": 28, "name": "linkopBatchInsert2john_4"},
}).Batch(2).Insert()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 链式批量保存
func linkopBatchSave() {
fmt.Println("linkopBatchSave:")
r, err := db.Table("aa_user").Data(gdb.List{
{"id": 1, "name": "john_1"},
{"id": 2, "name": "john_2"},
{"id": 3, "name": "john_3"},
{"id": 4, "name": "john_4"},
}).Save()
if err == nil {
fmt.Println(r.RowsAffected())
} else {
fmt.Println(err)
}
fmt.Println()
}
// 事务操作示例1
func transaction1() {
fmt.Println("transaction1:")
if tx, err := db.Begin(); err == nil {
r, err := tx.Insert("aa_user", gdb.Map{
"id": 30,
"name": "transaction1",
})
tx.Rollback()
fmt.Println(r, err)
}
fmt.Println()
}
// 事务操作示例2
func transaction2() {
fmt.Println("transaction2:")
if tx, err := db.Begin(); err == nil {
r, err := tx.Table("user_detail").Data(gdb.Map{"id": 5, "site": "www.baidu.com哈哈哈*?~!@#$%^&*()"}).Insert()
tx.Commit()
fmt.Println(r, err)
}
fmt.Println()
}
// 主从io复用测试在mysql中使用 show full processlist 查看链接信息
func keepPing() {
fmt.Println("keepPing:")
for i := 0; i < 30; i++ {
fmt.Println("ping...", i)
err := db.PingMaster()
if err != nil {
fmt.Println(err)
return
}
err = db.PingSlave()
if err != nil {
fmt.Println(err)
return
}
time.Sleep(1 * time.Second)
}
}
// like语句查询
func likeQuery() {
fmt.Println("likeQuery:")
if r, err := db.Table("aa_user").Where("name like ?", "%john%").Select(); err == nil {
fmt.Println(r)
} else {
fmt.Println(err)
}
}
// mapToStruct
func mapToStruct() {
type User struct {
Id int
Name string
Age int
Addr string
}
fmt.Println("mapToStruct:")
if r, err := db.Table("aa_user").Where("id=?", 1).One(); err == nil {
u := User{}
if err := r.ToStruct(&u); err == nil {
fmt.Println(r)
fmt.Println(u)
} else {
fmt.Println(err)
}
} else {
fmt.Println(err)
}
}
// getQueriedSqls
func getQueriedSqls() {
for k, v := range db.GetQueriedSqls() {
fmt.Println(k, ":")
fmt.Println("Sql :", v.Sql)
fmt.Println("Args :", v.Args)
fmt.Println("Error:", v.Error)
}
}
func main() {
db.PingMaster()
db.SetDebug(true)
/*err := create()
if err != nil {
return
}*/
//test1
/*for i := 1; i < 5; i++ {
insert(i)
}
query()
*/
//batchInsert()
//query()
//replace()
//save()
//update1()
//update2()
//update3()
/*linkopSelect1()
linkopSelect2()
linkopSelect3()
linkopCount1()
*/
/*linkopUpdate1()
linkopUpdate2()
linkopUpdate3()
linkopUpdate4()
*/
linkopBatchInsert1()
query()
//linkopBatchInsert2()
//transaction1()
//transaction2()
//
//keepPing()
//likeQuery()
//mapToStruct()
//getQueriedSqls()
}

View File

@ -0,0 +1,47 @@
package main
import (
"fmt"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/frame/g"
_ "github.com/mattn/go-sqlite3"
)
func main() {
gdb.SetConfig(gdb.Config{
"default": gdb.ConfigGroup{
gdb.ConfigNode{
Name: "/tmp/my.db",
Type: "sqlite",
},
},
})
db := g.DB()
if db == nil {
panic("db create failed")
}
// 创建表
sql := `CREATE TABLE user (
uid INT PRIMARY KEY NOT NULL,
name VARCHAR(30) NOT NULL
);`
if _, err := db.Exec(sql); err != nil {
fmt.Println(err)
}
// 写入数据
result, err := db.Table("user").Data(g.Map{"uid": 1, "name": "john"}).Save()
if err == nil {
fmt.Println(result.RowsAffected())
} else {
fmt.Println(err)
}
// 删除表
sql = `DROP TABLE user;`
if _, err := db.Exec(sql); err != nil {
fmt.Println(err)
}
}

View File

@ -0,0 +1,20 @@
package main
import (
"fmt"
"github.com/gogf/gf/database/gredis"
"github.com/gogf/gf/util/gconv"
)
// 使用原生gredis.New操作redis但是注意需要自己调用Close方法关闭redis链接池
func main() {
redis := gredis.New(gredis.Config{
Host: "127.0.0.1",
Port: 6379,
})
defer redis.Close()
redis.Do("SET", "k", "v")
v, _ := redis.Do("GET", "k")
fmt.Println(gconv.String(v))
}

View File

@ -0,0 +1,15 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gconv"
)
// 使用框架封装的g.Redis()方法获得redis操作对象单例不需要开发者显示调用Close方法
func main() {
g.Redis().Do("SET", "k", "v")
v, _ := g.Redis().Do("GET", "k")
fmt.Println(gconv.String(v))
}

View File

@ -0,0 +1,16 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gconv"
)
func main() {
conn := g.Redis().Conn()
defer conn.Close()
conn.Do("SET", "k", "v")
v, _ := conn.Do("GET", "k")
fmt.Println(gconv.String(v))
}

View File

@ -0,0 +1,17 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
)
func main() {
conn := g.Redis().Conn()
defer conn.Close()
if _, err := conn.Do("SET", "k", "v"); err != nil {
panic(err)
}
v, _ := conn.DoVar("GET", "k")
fmt.Println(v.String())
}

View File

@ -0,0 +1,21 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gconv"
)
func main() {
conn := g.Redis().Conn()
defer conn.Close()
conn.Send("SET", "foo", "bar")
conn.Send("GET", "foo")
conn.Flush()
// reply from SET
conn.Receive()
// reply from GET
v, _ := conn.Receive()
fmt.Println(gconv.String(v))
}

View File

@ -0,0 +1,20 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
)
func main() {
conn := g.Redis().Conn()
defer conn.Close()
conn.Send("SET", "foo", "bar")
conn.Send("GET", "foo")
conn.Flush()
// reply from SET
conn.Receive()
// reply from GET
v, _ := conn.ReceiveVar()
fmt.Println(v.String())
}

View File

@ -0,0 +1,24 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gconv"
)
func main() {
conn := g.Redis().Conn()
defer conn.Close()
_, err := conn.Do("SUBSCRIBE", "channel")
if err != nil {
panic(err)
}
for {
reply, err := conn.Receive()
if err != nil {
panic(err)
}
fmt.Println(gconv.Strings(reply))
}
}

View File

@ -0,0 +1,23 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
)
func main() {
conn := g.Redis().Conn()
defer conn.Close()
_, err := conn.Do("SUBSCRIBE", "channel")
if err != nil {
panic(err)
}
for {
reply, err := conn.ReceiveVar()
if err != nil {
panic(err)
}
fmt.Println(reply.Strings())
}
}

View File

@ -0,0 +1,11 @@
package main
import (
"fmt"
"github.com/gogf/gf/debug/gdebug"
)
func main() {
fmt.Println(gdebug.CallerPackage())
fmt.Println(gdebug.CallerFunction())
}

View File

@ -0,0 +1,16 @@
package gbase64
import (
"fmt"
"github.com/gogf/gf/encoding/gbase64"
)
func main() {
s := "john"
b := gbase64.Encode(s)
c, e := gbase64.Decode(b)
fmt.Println(b)
fmt.Println(c)
fmt.Println(e)
}

View File

@ -0,0 +1,55 @@
package main
import (
"fmt"
"github.com/gogf/gf/encoding/gbinary"
"github.com/gogf/gf/os/glog"
)
func main() {
// 使用gbinary.Encoded对基本数据类型进行二进制打包
fmt.Println(gbinary.Encode(18, 300, 1.01))
// 使用gbinary.Decode对整形二进制解包注意第二个及其后参数为字长确定的整形变量的指针地址字长确定的类型
// 例如int8/16/32/64、uint8/16/32/64、float32/64
// 这里的1.01默认为float64类型(64位系统下)
buffer := gbinary.Encode(18, 300, 1.01)
var i1 int8
var i2 int16
var f3 float64
if err := gbinary.Decode(buffer, &i1, &i2, &f3); err != nil {
glog.Error(err)
} else {
fmt.Println(i1, i2, f3)
}
// 编码/解析 int自动识别变量长度
fmt.Println(gbinary.DecodeToInt(gbinary.EncodeInt(1)))
fmt.Println(gbinary.DecodeToInt(gbinary.EncodeInt(300)))
fmt.Println(gbinary.DecodeToInt(gbinary.EncodeInt(70000)))
fmt.Println(gbinary.DecodeToInt(gbinary.EncodeInt(2000000000)))
fmt.Println(gbinary.DecodeToInt(gbinary.EncodeInt(500000000000)))
// 编码/解析 uint自动识别变量长度
fmt.Println(gbinary.DecodeToUint(gbinary.EncodeUint(1)))
fmt.Println(gbinary.DecodeToUint(gbinary.EncodeUint(300)))
fmt.Println(gbinary.DecodeToUint(gbinary.EncodeUint(70000)))
fmt.Println(gbinary.DecodeToUint(gbinary.EncodeUint(2000000000)))
fmt.Println(gbinary.DecodeToUint(gbinary.EncodeUint(500000000000)))
// 编码/解析 int8/16/32/64
fmt.Println(gbinary.DecodeToInt8(gbinary.EncodeInt8(int8(100))))
fmt.Println(gbinary.DecodeToInt16(gbinary.EncodeInt16(int16(100))))
fmt.Println(gbinary.DecodeToInt32(gbinary.EncodeInt32(int32(100))))
fmt.Println(gbinary.DecodeToInt64(gbinary.EncodeInt64(int64(100))))
// 编码/解析 uint8/16/32/64
fmt.Println(gbinary.DecodeToUint8(gbinary.EncodeUint8(uint8(100))))
fmt.Println(gbinary.DecodeToUint16(gbinary.EncodeUint16(uint16(100))))
fmt.Println(gbinary.DecodeToUint32(gbinary.EncodeUint32(uint32(100))))
fmt.Println(gbinary.DecodeToUint64(gbinary.EncodeUint64(uint64(100))))
// 编码/解析 string
fmt.Println(gbinary.DecodeToString(gbinary.EncodeString("I'm string!")))
}

View File

@ -0,0 +1,33 @@
package main
import (
"fmt"
"github.com/gogf/gf/encoding/gbinary"
)
func main() {
// 传感器状态0:已下线, 1:开启, 2:关闭, 3:待机
count := 100
status := 1
// 网关编码
bits := make([]gbinary.Bit, 0)
for i := 0; i < count; i++ {
bits = gbinary.EncodeBits(bits, status, 2)
}
buffer := gbinary.EncodeBitsToBytes(bits)
fmt.Println("buffer length:", len(buffer))
/* 上报过程忽略,这里只展示编码/解码示例 */
// 平台解码
alivecount := 0
sensorbits := gbinary.DecodeBytesToBits(buffer)
for i := 0; i < len(sensorbits); i += 2 {
if gbinary.DecodeBits(sensorbits[i:i+2]) == 1 {
alivecount++
}
}
fmt.Println("alived sensor:", alivecount)
}

View File

@ -0,0 +1,33 @@
package main
import (
"fmt"
"github.com/gogf/gf/encoding/gbinary"
)
func main() {
// Meta元数据文件数据结构[键名哈希64(64bit,8byte) 键名长度(8bit,1byte) 键值长度(24bit,3byte) 数据文件偏移量(40bit,5byte)](变长)
hash := 521369841259754125
klen := 12
vlen := 35535
offset := 80000000
// 编码
bits := make([]gbinary.Bit, 0)
bits = gbinary.EncodeBits(bits, hash, 64)
bits = gbinary.EncodeBits(bits, klen, 8)
bits = gbinary.EncodeBits(bits, vlen, 24)
bits = gbinary.EncodeBits(bits, offset, 40)
buffer := gbinary.EncodeBitsToBytes(bits)
fmt.Println("meta length:", len(buffer))
/* 文件存储及数据查询过程忽略,这里只展示元数据编码/解码示例 */
// 解码
metabits := gbinary.DecodeBytesToBits(buffer)
fmt.Println("hash :", gbinary.DecodeBits(metabits[0:64]))
fmt.Println("klen :", gbinary.DecodeBits(metabits[64:72]))
fmt.Println("vlen :", gbinary.DecodeBits(metabits[72:96]))
fmt.Println("offset:", gbinary.DecodeBits(metabits[96:136]))
}

View File

@ -0,0 +1,20 @@
package main
import (
"fmt"
"github.com/gogf/gf/frame/g"
)
func main() {
fmt.Println(g.Config().Get("redis"))
type RedisConfig struct {
Disk string
Cache string
}
redisCfg := new(RedisConfig)
fmt.Println(g.Config().GetStruct("redis", redisCfg))
fmt.Println(redisCfg)
}

View File

@ -0,0 +1,20 @@
package main
import (
"fmt"
"github.com/gogf/gf/encoding/gcharset"
)
func main() {
src := "~{;(<dR;:x>F#,6@WCN^O`GW!#"
srcCharset := "GB2312"
dstCharset := "UTF-8"
str, err := gcharset.Convert(dstCharset, srcCharset, src)
if err != nil {
panic(err)
}
fmt.Println(str)
// output:
// 花间一壶酒,独酌无相亲。
}

View File

@ -0,0 +1,15 @@
package main
import (
"fmt"
"github.com/gogf/gf/encoding/gcompress"
)
func main() {
err := gcompress.UnZipFile(
`D:\Workspace\Go\GOPATH\src\github.com\gogf\gf\geg\encoding\gcompress\data.zip`,
`D:\Workspace\Go\GOPATH\src\github.com\gogf\gf\geg`,
)
fmt.Println(err)
}

View File

@ -0,0 +1,16 @@
package main
import (
"fmt"
"github.com/gogf/gf/encoding/gcompress"
"github.com/gogf/gf/os/gfile"
)
func main() {
err := gcompress.UnZipContent(
gfile.GetBytes(`D:\Workspace\Go\GOPATH\src\github.com\gogf\gf\geg\encoding\gcompress\data.zip`),
`D:\Workspace\Go\GOPATH\src\github.com\gogf\gf\geg`,
)
fmt.Println(err)
}

View File

@ -0,0 +1,16 @@
package main
import (
"fmt"
"github.com/gogf/gf/encoding/gcompress"
)
func main() {
err := gcompress.ZipPath(
`D:\Workspace\Go\GOPATH\src\github.com\gogf\gf\geg`,
`D:\Workspace\Go\GOPATH\src\github.com\gogf\gf\geg\encoding\gcompress\data.zip`,
"my-dir",
)
fmt.Println(err)
}

View File

@ -0,0 +1,20 @@
package main
import (
"fmt"
"strconv"
"github.com/gogf/gf/encoding/ghash"
)
func main() {
m := make(map[uint64]bool)
for i := 0; i < 100000000; i++ {
hash := ghash.BKDRHash64([]byte("key_" + strconv.Itoa(i)))
if _, ok := m[hash]; ok {
fmt.Printf("duplicated hash %d\n", hash)
} else {
m[hash] = true
}
}
}

View File

@ -0,0 +1,16 @@
package main
import (
"fmt"
"github.com/gogf/gf/encoding/gini"
)
func main() {
s := `
a = b
`
m, err := gini.Decode([]byte(s))
fmt.Println(err)
fmt.Println(m)
}

View File

@ -0,0 +1,155 @@
package main
import (
"fmt"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/os/glog"
"github.com/gogf/gf/os/gtime"
)
func getByPattern() {
data :=
`{
"users" : {
"count" : 100,
"list" : [
{"name" : "小明", "score" : 60},
{"name" : "John", "score" : 99.5}
]
}
}`
j, err := gjson.DecodeToJson([]byte(data))
if err != nil {
glog.Error(err)
} else {
fmt.Println("John Score:", j.GetFloat32("users.list.1.score"))
}
}
// 当键名存在"."号时,检索优先级:键名->层级,因此不会引起歧义
func testMultiDots() {
data :=
`{
"users" : {
"count" : 100
},
"users.count" : 101
}`
j, err := gjson.DecodeToJson([]byte(data))
if err != nil {
glog.Error(err)
} else {
fmt.Println("Users Count:", j.GetInt("users.count"))
}
}
// 设置数据
func testSet() {
data :=
`{
"users" : {
"count" : 100
}
}`
j, err := gjson.DecodeToJson([]byte(data))
if err != nil {
glog.Error(err)
} else {
j.Set("users.count", 1)
j.Set("users.list", []string{"John", "小明"})
c, _ := j.ToJson()
fmt.Println(string(c))
}
}
// 将Json数据转换为其他数据格式
func testConvert() {
data :=
`{
"users" : {
"count" : 100,
"list" : ["John", "小明"]
}
}`
j, err := gjson.DecodeToJson([]byte(data))
if err != nil {
glog.Error(err)
} else {
c, _ := j.ToJson()
fmt.Println("JSON:")
fmt.Println(string(c))
fmt.Println("======================")
fmt.Println("XML:")
c, _ = j.ToXmlIndent()
fmt.Println(string(c))
fmt.Println("======================")
fmt.Println("YAML:")
c, _ = j.ToYaml()
fmt.Println(string(c))
fmt.Println("======================")
fmt.Println("TOML:")
c, _ = j.ToToml()
fmt.Println(string(c))
}
}
func testSplitChar() {
var v interface{}
j := gjson.New(nil)
t1 := gtime.Nanosecond()
j.Set("a.b.c.d.e.f.g.h.i.j.k", 1)
t2 := gtime.Nanosecond()
fmt.Println(t2 - t1)
t5 := gtime.Nanosecond()
v = j.Get("a.b.c.d.e.f.g.h.i.j.k")
t6 := gtime.Nanosecond()
fmt.Println(v)
fmt.Println(t6 - t5)
j.SetSplitChar('#')
t7 := gtime.Nanosecond()
v = j.Get("a#b#c#d#e#f#g#h#i#j#k")
t8 := gtime.Nanosecond()
fmt.Println(v)
fmt.Println(t8 - t7)
}
func testViolenceCheck() {
j := gjson.New(nil)
t1 := gtime.Nanosecond()
j.Set("a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a", 1)
t2 := gtime.Nanosecond()
fmt.Println(t2 - t1)
t3 := gtime.Nanosecond()
j.Set("a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a", 1)
t4 := gtime.Nanosecond()
fmt.Println(t4 - t3)
t5 := gtime.Nanosecond()
j.Get("a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a")
t6 := gtime.Nanosecond()
fmt.Println(t6 - t5)
j.SetViolenceCheck(false)
t7 := gtime.Nanosecond()
j.Set("a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a", 1)
t8 := gtime.Nanosecond()
fmt.Println(t8 - t7)
t9 := gtime.Nanosecond()
j.Get("a.a.a.a.a.a.a.a.a.a.a.a.a.a.a.a")
t10 := gtime.Nanosecond()
fmt.Println(t10 - t9)
}
func main() {
testViolenceCheck()
}

View File

@ -0,0 +1,156 @@
package main
import (
"encoding/json"
"fmt"
"github.com/gogf/gf/encoding/gjson"
)
type XinYanModel struct {
Success bool `json:"success"`
Data Data `json:"data"`
ErrorCode interface{} `json:"errorCode"`
ErrorMsg interface{} `json:"errorMsg"`
}
type ApplyReportDetail struct {
ApplyScore string `json:"apply_score"`
ApplyCredibility string `json:"apply_credibility"`
QueryOrgCount string `json:"apply_query_org_count"`
QueryFinanceCount string `json:"apply_query_finance_count"`
QueryCashCount string `json:"apply_query_cash_count"`
QuerySumCount string `json:"apply_query_sum_count"`
LatestQueryTime string `json:"apply_latest_query_time"`
LatestOneMonth string `json:"apply_latest_one_month"`
LatestThreeMonth string `json:"apply_latest_three_month"`
LatestSixMonth string `json:"apply_latest_six_month"`
}
type BehaviorReportDetail struct {
LoansScore string `json:"behavior_report_detailloans_score"`
LoansCredibility string `json:"behavior_report_detailloans_credibility"`
LoansCount string `json:"behavior_report_detailloans_count"`
LoansSettleCount string `json:"behavior_report_detailloans_settle_count"`
LoansOverdueCount string `json:"behavior_report_detailloans_overdue_count"`
LoansOrgCount string `json:"behavior_report_detailloans_org_count"`
ConsfinOrgCount string `json:"behavior_report_detailconsfin_org_count"`
LoansCashCount string `json:"behavior_report_detailloans_cash_count"`
LatestOneMonth string `json:"behavior_report_detaillatest_one_month"`
LatestThreeMonth string `json:"behavior_report_detaillatest_three_month"`
LatestSixMonth string `json:"behavior_report_detaillatest_six_month"`
HistorySucFee string `json:"behavior_report_detailhistory_suc_fee"`
HistoryFailFee string `json:"behavior_report_detailhistory_fail_fee"`
LatestOneMonthSuc string `json:"behavior_report_detaillatest_one_month_suc"`
LatestOneMonthFail string `json:"behavior_report_detaillatest_one_month_fail"`
LoansLongTime string `json:"behavior_report_detailloans_long_time"`
LoansLatestTime string `json:"behavior_report_detailloans_latest_time"`
}
type CurrentReportDetail struct {
LoansCreditLimit string `json:"current_report_detailloans_credit_limit"`
LoansCredibility string `json:"current_report_detailloans_credibility"`
LoansOrgCount string `json:"current_report_detailloans_org_count"`
LoansProductCount string `json:"current_report_detailloans_product_count"`
LoansMaxLimit string `json:"current_report_detailloans_max_limit"`
LoansAvgLimit string `json:"current_report_detailloans_avg_limit"`
ConsfinCreditLimit string `json:"current_report_detailconsfin_credit_limit"`
ConsfinCredibility string `json:"current_report_detailconsfin_credibility"`
ConsfinOrgCount string `json:"current_report_detailconsfin_org_count"`
ConsfinProductCount string `json:"current_report_detailconsfin_product_count"`
ConsfinMaxLimit string `json:"current_report_detailconsfin_max_limit"`
ConsfinAvgLimit string `json:"current_report_detailconsfin_avg_limit"`
}
type ResultDetail struct {
ApplyReportDetail ApplyReportDetail `json:"apply_report_detail"`
BehaviorReportDetail BehaviorReportDetail `json:"behavior_report_detail"`
CurrentReportDetail CurrentReportDetail `json:"current_report_detail"`
}
type Data struct {
Code string `json:"code"`
Desc string `json:"desc1"`
TransID string `json:"trans_id"`
TradeNo string `json:"trade_no"`
Fee string `json:"fee"`
IDNo string `json:"id_no"`
IDName string `json:"id_name"`
Versions string `json:"versions"`
ResultDetail ResultDetail `json:"result_detail"`
}
var data = `{
"success": true,
"data": {
"code": "0",
"desc": "查询成功",
"trans_id": "14910304379231213",
"trade_no": "201704011507240100057329",
"fee": "Y",
"id_no": "0783231bcc39f4957e99907e02ae401c",
"id_name": "dd67a5943781369ddd7c594e231e9e70 ",
"versions": "1.0.0",
"result_detail":{
"apply_report_detail": {
"apply_score": "189",
"apply_credibility": "84",
"query_org_count": "7",
"query_finance_count": "2",
"query_cash_count": "2",
"query_sum_count": "13",
"latest_query_time": "2017-09-03",
"latest_one_month": "1",
"latest_three_month": "5",
"latest_six_month": "12"
},
"behavior_report_detail": {
"loans_score": "199",
"loans_credibility": "90",
"loans_count": "300",
"loans_settle_count": "280",
"loans_overdue_count": "20",
"loans_org_count": "5",
"consfin_org_count": "3",
"loans_cash_count": "2",
"latest_one_month": "3",
"latest_three_month": "20",
"latest_six_month": "23",
"history_suc_fee": "30",
"history_fail_fee": "25",
"latest_one_month_suc": "5",
"latest_one_month_fail": "20",
"loans_long_time": "130",
"loans_latest_time": "2017-09-16"
},
"current_report_detail": {
"loans_credit_limit": "1400",
"loans_credibility": "80",
"loans_org_count": "7",
"loans_product_count": "8",
"loans_max_limit": "2000",
"loans_avg_limit": "1000",
"consfin_credit_limit": "1500",
"consfin_credibility": "90",
"consfin_org_count": "8",
"consfin_product_count": "5",
"consfin_max_limit": "5000",
"consfin_avg_limit": "3000"
}
}
},
"errorCode": null,
"errorMsg": null
}`
func main() {
struct1 := new(XinYanModel)
err := json.Unmarshal([]byte(data), struct1)
fmt.Println(err)
fmt.Println(struct1)
fmt.Println()
struct2 := new(XinYanModel)
j, err := gjson.DecodeToJson(data)
fmt.Println(err)
fmt.Println(j.Get("data.desc"))
err = j.ToStruct(struct2)
fmt.Println(err)
fmt.Println(struct2)
}

View File

@ -0,0 +1,69 @@
package main
import (
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/os/glog"
)
type GameUser struct {
Uid int `json:"uid"`
Account string `json:"account"`
Tel string `json:"tel"`
Role string `json:"role"`
Vip int `json:"vip"`
GameLevel int `json:"gamelevel"`
Diamond int `json:"diamond"`
Coin int `json:"coin"`
Value int `json:"value"`
Area string `json:"area"`
ServerName string `json:"servername"`
Time int `json:"time"`
ClientInfo *ClientInfo `json:"client_info"`
}
type ClientInfo struct {
ClientGuid string `json:"client_guid"`
ClientType int `json:"client_type"`
ClientSDKVersion string `json:"client_sdk_version"`
ClientVersion string `json:"client_version"`
PackageId string `json:"packageid"`
PhoneType string `json:"phone_type"`
DevicesId string `json:"devices_id"`
ClientMac string `json:"client_mac"`
}
func main() {
s := `{
"uid":9527,
"account":"zhangsan",
"tel":"15248787",
"role":"test",
"vip":7,
"gamelevel":59,
"diamond ":59,
"coin ":59,
"value ":99,
"area":"s",
"servername":"灵动",
"time":15454878787,
"client_info": {
"client_guid": "aaaa",
"client_type": 1,
"client_sdk_version": "1.0.1",
"client_version": "1.0.1",
"packageid":"",
"phone_type": "vivi",
"devices_id":"",
"client_mac":""
}
}`
gameUser := &GameUser{}
err := gjson.DecodeTo(s, gameUser)
if err != nil {
glog.Error(err)
}
g.Dump(gameUser)
}

View File

@ -0,0 +1,44 @@
broker:
ip: "127.0.0.1"
tcpport: "4222"
httpport: "8222"
user: "alfxnats"
pwd: "alfxnats"
clusterid: "alfxnats"
database:
ip: "110.1.1.227"
port: "27017"
user: "alfxdev"
pwd: "alfxdev"
dbname: "alfxdev"
scheduler:
a2rparallel: 4
sleeptime: 300
worker:
name: "worker1"
domains:
officenet: 3
producnet: 3
free: 3
temppath: "/home/alfx/proc"
common:
filepath: "/home/alfx/file"
logpath: "home/alfx/log"
logdebug: true
logtrace: true
report:
localip: "127.0.0.1"
localport: ""

View File

@ -0,0 +1,217 @@
package main
import (
"fmt"
"github.com/gogf/gf/encoding/gparser"
"github.com/gogf/gf/os/glog"
)
func getWithPattern1() {
data :=
`{
"users" : {
"count" : 100,
"list" : [
{"name" : "Ming", "score" : 60},
{"name" : "John", "score" : 99.5}
]
}
}`
if p, e := gparser.LoadContent([]byte(data)); e != nil {
glog.Error(e)
} else {
fmt.Println("John Score:", p.GetFloat32("users.list.1.score"))
}
}
func getWithPattern2() {
data :=
`<?xml version="1.0" encoding="UTF-8"?>
<note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>
<body>Don't forget me this weekend!</body>
</note>`
if p, e := gparser.LoadContent([]byte(data)); e != nil {
glog.Error(e)
} else {
fmt.Println("Heading:", p.GetString("note.heading"))
}
}
// 当键名存在"."号时,检索优先级:键名->层级,因此不会引起歧义
func multiDots1() {
data :=
`{
"users" : {
"count" : 100
},
"users.count" : 101
}`
if p, e := gparser.LoadContent([]byte(data)); e != nil {
glog.Error(e)
} else {
fmt.Println("Users Count:", p.Get("users.count"))
}
}
func multiDots2() {
data :=
`{
"users" : {
"count" : {
"type1" : 1,
"type2" : 2
},
"count.type1" : 100
}
}`
if p, e := gparser.LoadContent([]byte(data)); e != nil {
glog.Error(e)
} else {
fmt.Println("Users Count:", p.Get("users.count.type1"))
fmt.Println("Users Count:", p.Get("users.count.type2"))
}
}
// 设置数据
func set1() {
data :=
`<?xml version="1.0" encoding="UTF-8"?>
<article>
<count>10</count>
<list><title>gf article1</title><content>gf content1</content></list>
<list><title>gf article2</title><content>gf content2</content></list>
<list><title>gf article3</title><content>gf content3</content></list>
</article>`
if p, e := gparser.LoadContent([]byte(data)); e != nil {
glog.Error(e)
} else {
p.Set("article.list.0", nil)
c, _ := p.ToJson()
fmt.Println(string(c))
// {"article":{"count":"10","list":[{"content":"gf content2","title":"gf article2"},{"content":"gf content3","title":"gf article3"}]}}
}
}
func set2() {
data :=
`{
"users" : {
"count" : 100
}
}`
if p, e := gparser.LoadContent([]byte(data)); e != nil {
glog.Error(e)
} else {
p.Set("users.count", 1)
p.Set("users.list", []string{"John", "小明"})
c, _ := p.ToJson()
fmt.Println(string(c))
}
}
func makeXml1() {
p := gparser.New(nil)
p.Set("name", "john")
p.Set("age", 18)
p.Set("scores", map[string]int{
"语文": 100,
"数学": 100,
"英语": 100,
})
c, _ := p.ToXmlIndent("simple-xml")
fmt.Println(string(c))
}
func makeJson1() {
type Order struct {
Id int `json:"id"`
Price float32 `json:"price"`
}
p := gparser.New(nil)
p.Set("orders.list.0", Order{1, 100})
p.Set("orders.list.1", Order{2, 666})
p.Set("orders.list.2", Order{3, 999.99})
fmt.Println("Order 1 Price:", p.Get("orders.list.1.price"))
c, _ := p.ToJson()
fmt.Println(string(c))
}
func makeJson2() {
p := gparser.New(map[string]string{
"k1": "v1",
"k2": "v2",
})
p.Set("k1.1", []int{1, 2, 3})
//p.Set("0.0.1", []int{1,2,3})
c, _ := p.ToJson()
fmt.Println(string(c))
}
func makeJson3() {
p := gparser.New([]string{"a"})
p.Set("0.0.0", []int{1, 2, 3})
c, _ := p.ToJson()
fmt.Println(string(c))
}
func toStruct1() {
type Info struct {
Name string
Url string
}
o := Info{}
p := gparser.New(map[string]string{
"Name": "gf",
"Url": "https://gitee.com/johng",
})
p.ToStruct(&o)
fmt.Println("Name:", o.Name)
fmt.Println("Url :", o.Url)
}
func convert() {
p := gparser.New(map[string]string{
"name": "gf",
"site": "https://gitee.com/johng",
})
c, _ := p.ToJson()
fmt.Println("JSON:")
fmt.Println(string(c))
fmt.Println("======================")
fmt.Println("XML:")
c, _ = p.ToXmlIndent()
fmt.Println(string(c))
fmt.Println("======================")
fmt.Println("YAML:")
c, _ = p.ToYaml()
fmt.Println(string(c))
fmt.Println("======================")
fmt.Println("TOML:")
c, _ = p.ToToml()
fmt.Println(string(c))
}
func remove1() {
p := gparser.New(map[string]string{
"k1": "v1",
"k2": "v2",
})
p.Set("0.0.0.0.0.0.0.0", []int{1, 2, 3})
p.Remove("0.0")
c, _ := p.ToJson()
fmt.Println(string(c))
}
func main() {
toStruct1()
}

View File

@ -0,0 +1,21 @@
package main
import "github.com/gogf/gf/encoding/gparser"
func main() {
xml := `<?xml version="1.0" encoding="GBK"?>
<Output type="o">
<itotalSize>0</itotalSize>
<ipageSize>1</ipageSize>
<ipageIndex>2</ipageIndex>
<itotalRecords>3</itotalRecords>
<nworkOrderDtos/>
<nworkOrderFrontXML/>
</Output>`
p, err := gparser.LoadContent([]byte(xml))
if err != nil {
panic(err)
}
p.Dump()
}

View File

@ -0,0 +1,77 @@
package main
import (
"fmt"
"github.com/gogf/gf/encoding/gparser"
)
type Conf struct {
Broker Broker
Database Database
Scheduler Scheduler
Worker Worker
Common Common
Report Report
}
type Broker struct {
Ip string
Tcport string
Httpport string
User string
Pwd string
Clusterid string
}
type Database struct {
Ip string
Port string
User string
Pwd string
Dbname string
}
type Scheduler struct {
SleepTime int
Pidfilepath string
A2rparallel int
}
type Worker struct {
Name string
Domains map[string]interface{}
Temppath string
Pidfilepath string
}
type Common struct {
Filepath string
Logpath string
Logdebug bool
Logtrace bool
}
type Report struct {
Localip string
Localport string //暂不启用
}
func main() {
_, err := gparser.Load("config.yaml")
if err != nil {
fmt.Println("oops,read config.yaml err:", err)
}
//fmt.Println("yaml.v3读取yaml文件")
//f, err := os.Open("config.yaml")
//if err != nil {
// panic(err)
//}
//var conf Conf
//err = yaml.NewDecoder(f).Decode(&conf)
//if err != nil {
// panic(err)
//}
//fmt.Println(conf)
}

View File

@ -0,0 +1,30 @@
package main
import (
"fmt"
"github.com/gogf/gf/encoding/gyaml"
)
func main() {
var yamlStr string = `
#即表示url属性值
url: http://www.wolfcode.cn
#即表示server.host属性的值
server:
host: http://www.wolfcode.cn
#数组即表示server为[a,b,c]
server:
- 120.168.117.21
- 120.168.117.22
- 120.168.117.23
#常量
pi: 3.14 #定义一个数值3.14
hasChild: true #定义一个boolean值
name: '你好YAML' #定义一个字符串
`
i, err := gyaml.Decode([]byte(yamlStr))
fmt.Println(err)
fmt.Println(i)
}

View File

@ -0,0 +1,25 @@
package main
import (
"errors"
"fmt"
"github.com/gogf/gf/errors/gerror"
)
func Error1() error {
return errors.New("test1")
}
func Error2() error {
return gerror.New("test2")
}
func main() {
err1 := Error1()
err2 := Error2()
fmt.Printf("%s, %-s, %+s\n", err1, err1, err1)
fmt.Printf("%v, %-v, %+v\n", err1, err1, err1)
fmt.Printf("%s, %-s, %+s\n", err2, err2, err2)
fmt.Printf("%v, %-v, %+v\n", err2, err2, err2)
}

View File

@ -0,0 +1,26 @@
package main
import (
"fmt"
"github.com/gogf/gf/errors/gerror"
)
func OpenFile() error {
return gerror.New("permission denied")
}
func OpenConfig() error {
return gerror.Wrap(OpenFile(), "configuration file opening failed")
}
func ReadConfig() error {
return gerror.Wrap(OpenConfig(), "reading configuration failed")
}
func main() {
//err := ReadConfig()
//glog.Printf("%s\n%+s", err, err)
//glog.Printf("%+v", err)
fmt.Printf("%+v", ReadConfig())
}

View File

@ -0,0 +1,23 @@
package main
import (
"errors"
"fmt"
"github.com/gogf/gf/errors/gerror"
)
func Error1() error {
return errors.New("test1")
}
func Error2() error {
return gerror.New("test2")
}
func main() {
err1 := Error1()
err2 := Error2()
fmt.Println("err1:\n", gerror.Stack(err1))
fmt.Println("err2:\n", gerror.Stack(err2))
}

View File

@ -0,0 +1,23 @@
package main
import (
"fmt"
"github.com/gogf/gf/errors/gerror"
)
func OpenFile() error {
return gerror.New("permission denied")
}
func OpenConfig() error {
return gerror.Wrap(OpenFile(), "configuration file opening failed")
}
func ReadConfig() error {
return gerror.Wrap(OpenConfig(), "reading configuration failed")
}
func main() {
fmt.Println(gerror.Cause(ReadConfig()))
}

View File

@ -0,0 +1,22 @@
package main
import (
"errors"
"github.com/gogf/gf/os/glog"
"github.com/gogf/gf/errors/gerror"
)
func Error1() error {
return errors.New("test1")
}
func Error2() error {
return gerror.New("test2")
}
func main() {
glog.Println(Error1())
glog.Println(Error2())
}

View File

@ -0,0 +1,4 @@
viewpath = "/home/www/templates"
[redis]
disk = "127.0.0.1:6379,0"
cache = "127.0.0.1:6379,1"

View File

@ -0,0 +1,25 @@
package demo
import (
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/net/ghttp"
)
func init() {
s := g.Server()
s.BindHandler("/apple", Apple)
s.BindHandler("/pen", Pen)
s.BindHandler("/apple-pen", ApplePen)
}
func Apple(r *ghttp.Request) {
r.Response.Write("Apple")
}
func Pen(r *ghttp.Request) {
r.Response.Write("Pen")
}
func ApplePen(r *ghttp.Request) {
r.Response.Write("Apple-Pen")
}

View File

@ -0,0 +1,16 @@
package demo
import (
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/net/ghttp"
)
type Order struct{}
func init() {
g.Server().BindObject("/{.struct}-{.method}", new(Order))
}
func (o *Order) List(r *ghttp.Request) {
r.Response.Write("List")
}

View File

@ -0,0 +1,12 @@
package demo
import (
"github.com/gogf/gf/frame/gins"
"github.com/gogf/gf/net/ghttp"
)
func init() {
ghttp.GetServer().BindHandler("/config", func(r *ghttp.Request) {
r.Response.Write(gins.Config().GetString("database.default.0.host"))
})
}

View File

@ -0,0 +1,16 @@
package demo
import (
"github.com/gogf/gf/net/ghttp"
"github.com/gogf/gf/os/gtime"
)
func init() {
ghttp.GetServer().BindHandler("/cookie", Cookie)
}
func Cookie(r *ghttp.Request) {
datetime := r.Cookie.Get("datetime")
r.Cookie.Set("datetime", gtime.Datetime())
r.Response.Write("datetime:" + datetime)
}

View File

@ -0,0 +1,20 @@
package demo
import (
"github.com/gogf/gf/net/ghttp"
)
type ControllerDomain struct{}
// 初始化控制器对象并绑定操作到Web Server
func init() {
// 只有localhost域名下才能访问该对象
// 对应URL为http://localhost:8199/test/show
// 通过该地址将无法访问到内容http://127.0.0.1:8199/test/show
ghttp.GetServer().Domain("localhost").BindObject("/domain", &ControllerDomain{})
}
// 用于对象映射
func (d *ControllerDomain) Show(r *ghttp.Request) {
r.Response.Write("It's show time bibi!")
}

View File

@ -0,0 +1,24 @@
package demo
import (
"github.com/gogf/gf/frame/gmvc"
"github.com/gogf/gf/net/ghttp"
)
type ControllerExit struct {
gmvc.Controller
}
func (c *ControllerExit) Init(r *ghttp.Request) {
c.Controller.Init(r)
c.Response.Write("exit, it will not print \"show\"")
c.Request.Exit()
}
func (c *ControllerExit) Show() {
c.Response.Write("show")
}
func init() {
ghttp.GetServer().BindController("/exit", &ControllerExit{})
}

View File

@ -0,0 +1,36 @@
package demo
import (
"fmt"
"github.com/gogf/gf/net/ghttp"
)
func Form(r *ghttp.Request) {
fmt.Println(r.GetPostMap())
fmt.Println(r.GetPostString("name"))
fmt.Println(r.GetPostString("age"))
}
func FormShow(r *ghttp.Request) {
r.Response.Write(`
<html>
<head>
<title>表单提交</title>
</head>
<body>
<form enctype="application/x-www-form-urlencoded" action="/form" method="post">
<input type="input" name="name" />
<input type="input" name="age" />
<input type="submit" value="submit" />
</form>
</body>
</html>
`)
}
func init() {
ghttp.GetServer().BindHandler("/form", Form)
ghttp.GetServer().BindHandler("/form/show", FormShow)
}

View File

@ -0,0 +1,9 @@
package demo
import "github.com/gogf/gf/net/ghttp"
func init() {
ghttp.GetServer().BindHandler("/", func(r *ghttp.Request) {
r.Response.Write("Hello World!")
})
}

Some files were not shown because too many files have changed in this diff Show More