Compare commits

...

372 Commits

Author SHA1 Message Date
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
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
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
1c71340719 gfcache test 20190704 15:00 2019-07-04 15:03:56 +08:00
363dede57c gvalid test 20190704 11:16 2019-07-04 11:19:59 +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
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
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
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
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
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
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
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
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
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
d74034e08e Update garray_z_unit_int_test.go 2019-06-18 23:20:46 +08:00
d41cc7c3b6 Merge pull request #32 from gogf/master
日常更新
2019-06-18 21:45:01 +08:00
3120d0bd7a Merge pull request #6 from gogf/master
同步主库
2019-06-18 17:58:47 +08:00
7bebf062be Improve gmlock unit testing. 2019-06-18 11:46:43 +08:00
6c657dff37 Merge pull request #5 from gogf/master
同步主库
2019-06-18 09:12:16 +08:00
5896dadaad Merge pull request #4 from gogf/master
同步主库
2019-06-17 09:20:58 +08:00
2026 changed files with 33087 additions and 547719 deletions

View File

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/container/garray"
"github.com/gogf/gf/container/garray"
)
func main() {

View File

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/container/garray"
"github.com/gogf/gf/container/garray"
)
func main() {

View File

@ -1,8 +1,8 @@
package main
import (
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/container/garray"
"github.com/gogf/gf/container/garray"
"github.com/gogf/gf/frame/g"
)
func main() {

View File

@ -1,8 +1,8 @@
package main
import (
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/container/garray"
"github.com/gogf/gf/container/garray"
"github.com/gogf/gf/frame/g"
)
func main() {

View File

@ -2,9 +2,10 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/container/garray"
"strings"
"github.com/gogf/gf/container/garray"
"github.com/gogf/gf/frame/g"
)
func main() {

View File

@ -2,13 +2,14 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/container/gmap"
"github.com/gogf/gf/container/gmap"
)
func main() {
// 创建一个默认的gmap对象
// 默认情况下该gmap对象支持并发安全特性
// 初始化时可以给定false参数关闭并发安全特性当做一个普通的map使用。
// 默认情况下该gmap对象支持并发安全特性,
// 初始化时可以给定true参数关闭并发安全特性当做一个普通的map使用。
m := gmap.New()
// 设置键值对

View File

@ -0,0 +1,24 @@
package main
import (
"encoding/json"
"fmt"
"github.com/gogf/gf/container/gmap"
)
func main() {
//m := gmap.New()
//m.Set("k", "v")
//m.Set("1", "2")
//b, err := json.Marshal(m)
//fmt.Println(err)
//fmt.Println(string(b))
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

@ -1,8 +1,8 @@
package main
import (
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/container/gmap"
"github.com/gogf/gf/container/gmap"
"github.com/gogf/gf/frame/g"
)
func main() {

View File

@ -2,9 +2,10 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/container/gmap"
"github.com/gogf/gf/g/util/gutil"
"github.com/gogf/gf/container/gmap"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gutil"
)
func main() {

View File

@ -2,8 +2,9 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/container/gmap"
"github.com/gogf/gf/g/util/gutil"
"github.com/gogf/gf/container/gmap"
"github.com/gogf/gf/util/gutil"
)
func main() {

View File

@ -2,8 +2,9 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/container/gpool"
"time"
"github.com/gogf/gf/container/gpool"
)
func main() {

View File

@ -2,10 +2,11 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/container/gpool"
"github.com/gogf/gf/g/net/gtcp"
"github.com/gogf/gf/g/os/glog"
"time"
"github.com/gogf/gf/container/gpool"
"github.com/gogf/gf/net/gtcp"
"github.com/gogf/gf/os/glog"
)
func main() {

View File

@ -2,10 +2,11 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/container/gqueue"
"github.com/gogf/gf/g/os/gtime"
"github.com/gogf/gf/g/os/gtimer"
"time"
"github.com/gogf/gf/container/gqueue"
"github.com/gogf/gf/os/gtime"
"github.com/gogf/gf/os/gtimer"
)
func main() {

View File

@ -2,9 +2,10 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/container/gqueue"
"github.com/gogf/gf/g/os/gtimer"
"time"
"github.com/gogf/gf/container/gqueue"
"github.com/gogf/gf/os/gtimer"
)
func main() {

View File

@ -2,10 +2,11 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/container/gqueue"
"github.com/gogf/gf/g/os/gtime"
"github.com/gogf/gf/g/os/gtimer"
"time"
"github.com/gogf/gf/container/gqueue"
"github.com/gogf/gf/os/gtime"
"github.com/gogf/gf/os/gtimer"
)
func main() {

View File

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/container/gring"
"github.com/gogf/gf/container/gring"
)
func main() {

View File

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/container/gring"
"github.com/gogf/gf/container/gring"
)
type Player struct {

View File

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/container/gset"
"github.com/gogf/gf/container/gset"
)
func main() {

View File

@ -2,8 +2,9 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/container/gset"
"github.com/gogf/gf/container/gset"
"github.com/gogf/gf/frame/g"
)
func main() {

View File

@ -2,8 +2,9 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/container/gtree"
"github.com/gogf/gf/g/util/gutil"
"github.com/gogf/gf/container/gtree"
"github.com/gogf/gf/util/gutil"
)
func main() {

View File

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/container/gtree"
"github.com/gogf/gf/container/gtree"
)
func main() {

View File

@ -2,8 +2,9 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/container/gtree"
"github.com/gogf/gf/g/util/gutil"
"github.com/gogf/gf/container/gtree"
"github.com/gogf/gf/util/gutil"
)
func main() {

View File

@ -1,7 +1,7 @@
package main
import (
"github.com/gogf/gf/g/container/gtree"
"github.com/gogf/gf/container/gtree"
)
func main() {

View File

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/container/gtype"
"github.com/gogf/gf/container/gtype"
)
func main() {

View File

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/frame/g"
)
func main() {

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

@ -3,9 +3,10 @@ package main
import (
"fmt"
"time"
//_ "github.com/denisenkom/go-mssqldb"
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/database/gdb"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/frame/g"
)
// 本文件用于gf框架的mssql数据库操作示例不作为单元测试使用
@ -26,7 +27,7 @@ func init() {
})
db, _ = gdb.New()
//gins.Config().SetPath("/home/john/Workspace/Go/GOPATH/src/github.com/gogf/gf/geg/frame")
//gins.Config().SetPath("/home/john/Workspace/Go/GOPATH/src/github.com/gogf/gf/.example/frame")
//db = g.Database()
//gdb.SetConfig(gdb.ConfigNode {
@ -49,7 +50,7 @@ func init() {
// Name : "test",
// Type : "mysql",
// Role : "master",
// Priority : 100,
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.2",
@ -59,7 +60,7 @@ func init() {
// Name : "test",
// Type : "mysql",
// Role : "master",
// Priority : 100,
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.3",
@ -69,7 +70,7 @@ func init() {
// Name : "test",
// Type : "mysql",
// Role : "master",
// Priority : 100,
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.4",
@ -79,7 +80,7 @@ func init() {
// Name : "test",
// Type : "mysql",
// Role : "master",
// Priority : 100,
// Weight : 100,
// },
// },
//})

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

@ -2,9 +2,10 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/database/gdb"
"time"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/frame/g"
)
// 本文件用于gf框架的mysql数据库操作示例不作为单元测试使用
@ -25,7 +26,7 @@ func init() {
})
db, _ = gdb.New()
//gins.Config().SetPath("/home/john/Workspace/Go/GOPATH/src/github.com/gogf/gf/geg/frame")
//gins.Config().SetPath("/home/john/Workspace/Go/GOPATH/src/github.com/gogf/gf/.example/frame")
//db = g.Database()
//gdb.SetConfig(gdb.ConfigNode {
@ -48,7 +49,7 @@ func init() {
// Name : "test",
// Type : "mysql",
// Role : "master",
// Priority : 100,
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.2",
@ -58,7 +59,7 @@ func init() {
// Name : "test",
// Type : "mysql",
// Role : "master",
// Priority : 100,
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.3",
@ -68,7 +69,7 @@ func init() {
// Name : "test",
// Type : "mysql",
// Role : "master",
// Priority : 100,
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.4",
@ -78,7 +79,7 @@ func init() {
// Name : "test",
// Type : "mysql",
// Role : "master",
// Priority : 100,
// Weight : 100,
// },
// },
//})

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

@ -2,9 +2,10 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/crypto/gaes"
"github.com/gogf/gf/g/database/gdb"
"github.com/gogf/gf/crypto/gaes"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/frame/g"
)
func main() {

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

@ -1,8 +1,8 @@
package main
import (
"github.com/gogf/gf/g/database/gdb"
"github.com/gogf/gf/g/util/gutil"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/util/gutil"
)
func main() {

View File

@ -2,11 +2,11 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/frame/g"
)
func main() {
g.Config().AddPath("/home/john/Workspace/Go/GOPATH/src/github.com/gogf/gf/geg/frame")
if r, err := g.DB().Table("user").Where("uid=?", 1).One(); err == nil {
fmt.Println(r["uid"].Int())
fmt.Println(r["name"].String())

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

@ -2,8 +2,9 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/os/gtime"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/os/gtime"
)
func main() {

View File

@ -3,9 +3,9 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/database/gdb"
"github.com/gogf/gf/g/os/glog"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/os/glog"
)
func main() {
@ -24,8 +24,7 @@ func main() {
panic(err)
}
db.SetDebug(true)
db.Table("user").Limit(2).Delete()
return
glog.SetPath("/tmp")
// 执行3条SQL查询

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

@ -2,8 +2,9 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"time"
"github.com/gogf/gf/frame/g"
)
func main() {

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

@ -2,9 +2,10 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/database/gdb"
"github.com/gogf/gf/g/encoding/gparser"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/encoding/gparser"
"github.com/gogf/gf/frame/g"
)
func main() {

View File

@ -1,8 +1,9 @@
package main
import (
"github.com/gogf/gf/g"
"time"
"github.com/gogf/gf/frame/g"
)
func main() {

View File

@ -3,7 +3,7 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/frame/g"
)
func main() {

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

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/frame/g"
)
func main() {

View File

@ -3,12 +3,11 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/frame/g"
)
func main() {
db := g.DB()
// 开启调试模式以便于记录所有执行的SQL
db.SetDebug(true)
r, e := db.Table("test").Where("id IN (?)", []interface{}{1, 2}).All()

View File

@ -3,9 +3,10 @@ package main
import (
"fmt"
"time"
//_ "github.com/mattn/go-oci8"
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/database/gdb"
"github.com/gogf/gf/database/gdb"
"github.com/gogf/gf/frame/g"
)
// 本文件用于gf框架的mysql数据库操作示例不作为单元测试使用
@ -25,7 +26,7 @@ func init() {
})
db, _ = gdb.New()
//gins.Config().SetPath("/home/john/Workspace/Go/GOPATH/src/github.com/gogf/gf/geg/frame")
//gins.Config().SetPath("/home/john/Workspace/Go/GOPATH/src/github.com/gogf/gf/.example/frame")
//db = g.Database()
//gdb.SetConfig(gdb.ConfigNode {
@ -48,7 +49,7 @@ func init() {
// Name : "test",
// Type : "mysql",
// Role : "master",
// Priority : 100,
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.2",
@ -58,7 +59,7 @@ func init() {
// Name : "test",
// Type : "mysql",
// Role : "master",
// Priority : 100,
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.3",
@ -68,7 +69,7 @@ func init() {
// Name : "test",
// Type : "mysql",
// Role : "master",
// Priority : 100,
// Weight : 100,
// },
// gdb.ConfigNode {
// Host : "127.0.0.4",
@ -78,7 +79,7 @@ func init() {
// Name : "test",
// Type : "mysql",
// Role : "master",
// Priority : 100,
// Weight : 100,
// },
// },
//})

View File

@ -1,9 +1,9 @@
package main
//import (
// _ "github.com/gogf/gf/third/github.com/mattn/go-sqlite3"
// "github.com/gogf/gf/g/database/gdb"
// "github.com/gogf/gf/g"
// _ "github.com/mattn/go-sqlite3"
// "github.com/gogf/gf/database/gdb"
// "github.com/gogf/gf/frame/g"
// "fmt"
//)
//

View File

@ -2,8 +2,9 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/database/gredis"
"github.com/gogf/gf/g/util/gconv"
"github.com/gogf/gf/database/gredis"
"github.com/gogf/gf/util/gconv"
)
// 使用原生gredis.New操作redis但是注意需要自己调用Close方法关闭redis链接池

View File

@ -2,8 +2,9 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/util/gconv"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gconv"
)
// 使用框架封装的g.Redis()方法获得redis操作对象单例不需要开发者显示调用Close方法

View File

@ -2,8 +2,9 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/util/gconv"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gconv"
)
func main() {

View File

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/frame/g"
)
func main() {

View File

@ -2,8 +2,9 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/util/gconv"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gconv"
)
func main() {

View File

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/frame/g"
)
func main() {

View File

@ -2,8 +2,9 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/util/gconv"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/util/gconv"
)
func main() {

View File

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/frame/g"
)
func main() {

View File

@ -0,0 +1,60 @@
package main
import (
"fmt"
"github.com/gogf/gf/util/gconv"
"github.com/gogf/gf/os/gcmd"
"github.com/gogf/gf/container/garray"
"github.com/gogf/gf/database/gredis"
"github.com/gogf/gf/frame/g"
)
func main() {
batchNumber := 1000
redis1Config, err := gredis.ConfigFromStr("im-redis-slave:6379,9")
if err != nil {
panic(err)
}
redis2Config, err := gredis.ConfigFromStr("r-bp1f0a5d4efd8744.redis.rds.aliyuncs.com:6379,9")
if err != nil {
panic(err)
}
gredis.SetConfig(redis1Config)
v, err := g.Redis().DoVar("keys", "*")
if err != nil {
panic(err)
}
array := garray.NewStrArrayFrom(v.Strings())
for {
slice := array.PopLefts(batchNumber)
if len(slice) > 0 {
// `migrate %s %d "" 0 2000 copy replace auth %s keys %s`,
params := g.Slice{
redis2Config.Host,
redis2Config.Port,
"",
redis2Config.Db,
2000,
"copy",
"replace",
"keys",
}
params = append(params, gconv.Interfaces(slice)...)
fmt.Println(params)
if gcmd.GetOpt("dryrun") == "0" {
if v, err := g.Redis().DoVar("migrate", params...); err != nil {
panic(err)
} else {
fmt.Println(v.String())
}
}
} else {
break
}
}
fmt.Println("done")
}

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

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/encoding/gbase64"
"github.com/gogf/gf/encoding/gbase64"
)
func main() {

View File

@ -2,8 +2,9 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/encoding/gbinary"
"github.com/gogf/gf/g/os/glog"
"github.com/gogf/gf/encoding/gbinary"
"github.com/gogf/gf/os/glog"
)
func main() {

View File

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/encoding/gbinary"
"github.com/gogf/gf/encoding/gbinary"
)
func main() {

View File

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/encoding/gbinary"
"github.com/gogf/gf/encoding/gbinary"
)
func main() {

View File

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g"
"github.com/gogf/gf/frame/g"
)
func main() {

View File

@ -2,7 +2,8 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/encoding/gcharset"
"github.com/gogf/gf/encoding/gcharset"
)
func main() {

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

@ -2,8 +2,9 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/encoding/ghash"
"strconv"
"github.com/gogf/gf/encoding/ghash"
)
func main() {

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

@ -2,9 +2,10 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/encoding/gjson"
"github.com/gogf/gf/g/os/glog"
"github.com/gogf/gf/g/os/gtime"
"github.com/gogf/gf/encoding/gjson"
"github.com/gogf/gf/os/glog"
"github.com/gogf/gf/os/gtime"
)
func getByPattern() {

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

@ -2,8 +2,9 @@ package main
import (
"fmt"
"github.com/gogf/gf/g/encoding/gparser"
"github.com/gogf/gf/g/os/glog"
"github.com/gogf/gf/encoding/gparser"
"github.com/gogf/gf/os/glog"
)
func getWithPattern1() {

View File

@ -1,6 +1,6 @@
package main
import "github.com/gogf/gf/g/encoding/gparser"
import "github.com/gogf/gf/encoding/gparser"
func main() {
xml := `<?xml version="1.0" encoding="GBK"?>

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 @@
# MySQL数据库配置
[database]
link = "mysql:root:12345678@tcp(127.0.0.1:3306)/test"

View File

@ -0,0 +1,13 @@
package main
import (
"github.com/gogf/gf/.example/frame/mvc/model/test"
"github.com/gogf/gf/frame/g"
)
func main() {
g.DB().SetDebug(true)
user, err := test.ModelUser().One()
g.Dump(err)
g.Dump(user)
}

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

@ -1,8 +1,8 @@
package demo
import (
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/net/ghttp"
"github.com/gogf/gf/frame/g"
"github.com/gogf/gf/net/ghttp"
)
func init() {

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