The response has been limited to 50k tokens of the smallest files in the repo. You can remove this limitation by
removing the max tokens filter.
├── .codecov.yml
├── .gitattributes
├── .gitee
└── ISSUE_TEMPLATE
├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── 00-bug.yml
│ ├── 01-enhance.yml
│ ├── 02-feature.yml
│ └── 03-question.yml
├── PULL_REQUEST_TEMPLATE.MD
├── logo.png
└── workflows
│ ├── apollo
│ ├── docker-compose.yml
│ └── sql
│ │ ├── apolloconfigdb.sql
│ │ └── apolloportaldb.sql
│ ├── ci-main.yml
│ ├── ci-sub.yml
│ ├── consul
│ ├── client.json
│ ├── docker-compose.yml
│ └── server.json
│ ├── format-code-on-push.yml
│ ├── gitee-sync.yml
│ ├── golangci-lint.yml
│ ├── issue-check-inactive.yml
│ ├── issue-close-inactive.yml
│ ├── issue-labeled.yml
│ ├── issue-remove-inactive.yml
│ ├── issue-remove-need-more-details.yml
│ ├── issue-translator.yml
│ ├── nacos
│ ├── docker-compose.yml
│ └── env
│ │ └── nacos.env
│ ├── redis
│ └── docker-compose.yml
│ ├── release.yml
│ ├── scripts
│ ├── before_script.sh
│ ├── ci-main.sh
│ ├── ci-sub.sh
│ └── replace_examples_gomod.sh
│ ├── sonarcloud.yaml
│ └── tag.yml
├── .gitignore
├── .gitmodules
├── .golangci.yml
├── .make_tidy.sh
├── .make_version.sh
├── CONTRIBUTING.md
├── LICENSE
├── Makefile
├── README.MD
├── cmd
└── gf
│ ├── LICENSE
│ ├── Makefile
│ ├── README.MD
│ ├── gfcmd
│ └── gfcmd.go
│ ├── go.mod
│ ├── go.sum
│ ├── go.work
│ ├── internal
│ ├── cmd
│ │ ├── cmd.go
│ │ ├── cmd_build.go
│ │ ├── cmd_doc.go
│ │ ├── cmd_docker.go
│ │ ├── cmd_env.go
│ │ ├── cmd_fix.go
│ │ ├── cmd_gen.go
│ │ ├── cmd_gen_ctrl.go
│ │ ├── cmd_gen_dao.go
│ │ ├── cmd_gen_enums.go
│ │ ├── cmd_gen_pb.go
│ │ ├── cmd_gen_pbentity.go
│ │ ├── cmd_gen_service.go
│ │ ├── cmd_init.go
│ │ ├── cmd_install.go
│ │ ├── cmd_pack.go
│ │ ├── cmd_run.go
│ │ ├── cmd_tpl.go
│ │ ├── cmd_up.go
│ │ ├── cmd_version.go
│ │ ├── cmd_z_init_test.go
│ │ ├── cmd_z_unit_build_test.go
│ │ ├── cmd_z_unit_fix_test.go
│ │ ├── cmd_z_unit_gen_ctrl_test.go
│ │ ├── cmd_z_unit_gen_dao_issue_test.go
│ │ ├── cmd_z_unit_gen_dao_sharding_test.go
│ │ ├── cmd_z_unit_gen_dao_test.go
│ │ ├── cmd_z_unit_gen_pb_test.go
│ │ ├── cmd_z_unit_gen_pbentity_test.go
│ │ ├── cmd_z_unit_gen_service_test.go
│ │ ├── genctrl
│ │ │ ├── genctrl.go
│ │ │ ├── genctrl_api_item.go
│ │ │ ├── genctrl_ast_parse.go
│ │ │ ├── genctrl_ast_parse_clear.go
│ │ │ ├── genctrl_calculate.go
│ │ │ ├── genctrl_generate_ctrl.go
│ │ │ ├── genctrl_generate_ctrl_clear.go
│ │ │ ├── genctrl_generate_interface.go
│ │ │ └── genctrl_generate_sdk.go
│ │ ├── gendao
│ │ │ ├── gendao.go
│ │ │ ├── gendao_clear.go
│ │ │ ├── gendao_dao.go
│ │ │ ├── gendao_do.go
│ │ │ ├── gendao_entity.go
│ │ │ ├── gendao_gen_item.go
│ │ │ ├── gendao_structure.go
│ │ │ └── gendao_tag.go
│ │ ├── genenums
│ │ │ ├── genenums.go
│ │ │ └── genenums_parser.go
│ │ ├── genpb
│ │ │ ├── genpb.go
│ │ │ ├── genpb_controller.go
│ │ │ └── genpb_tag.go
│ │ ├── genpbentity
│ │ │ └── genpbentity.go
│ │ ├── genservice
│ │ │ ├── genservice.go
│ │ │ ├── genservice_ast_parse.go
│ │ │ ├── genservice_ast_utils.go
│ │ │ ├── genservice_calculate.go
│ │ │ ├── genservice_generate.go
│ │ │ └── genservice_generate_template.go
│ │ └── testdata
│ │ │ ├── build
│ │ │ ├── multiple
│ │ │ │ └── multiple.go
│ │ │ ├── single
│ │ │ │ └── main.go
│ │ │ └── varmap
│ │ │ │ ├── go.mod
│ │ │ │ ├── go.sum
│ │ │ │ └── main.go
│ │ │ ├── fix
│ │ │ └── fix25_content.go
│ │ │ ├── genctrl-merge
│ │ │ ├── add_new_ctrl
│ │ │ │ ├── api
│ │ │ │ │ └── dict
│ │ │ │ │ │ ├── dict_add_new_ctrl_expect.gotest
│ │ │ │ │ │ ├── dict_expect.go
│ │ │ │ │ │ └── v1
│ │ │ │ │ │ └── dict_type.go
│ │ │ │ └── controller
│ │ │ │ │ └── dict
│ │ │ │ │ ├── dict.go
│ │ │ │ │ ├── dict_new.go
│ │ │ │ │ ├── dict_v1_dict_type.go
│ │ │ │ │ └── dict_v1_test_new.gotest
│ │ │ └── add_new_file
│ │ │ │ ├── api
│ │ │ │ └── dict
│ │ │ │ │ ├── dict_add_new_ctrl_expect.gotest
│ │ │ │ │ ├── dict_expect.go
│ │ │ │ │ └── v1
│ │ │ │ │ └── dict_type.go
│ │ │ │ └── controller
│ │ │ │ └── dict
│ │ │ │ ├── dict.go
│ │ │ │ ├── dict_new.go
│ │ │ │ ├── dict_v1_dict_type.go
│ │ │ │ └── dict_v1_test_new.gotest
│ │ │ ├── genctrl
│ │ │ ├── api
│ │ │ │ └── article
│ │ │ │ │ ├── article_expect.go
│ │ │ │ │ ├── v1
│ │ │ │ │ ├── edit.go
│ │ │ │ │ └── get.go
│ │ │ │ │ └── v2
│ │ │ │ │ └── edit.go
│ │ │ └── controller
│ │ │ │ └── article
│ │ │ │ ├── article.go
│ │ │ │ ├── article_new.go
│ │ │ │ ├── article_v1_create.go
│ │ │ │ ├── article_v1_get_list.go
│ │ │ │ ├── article_v1_get_one.go
│ │ │ │ ├── article_v1_update.go
│ │ │ │ ├── article_v2_create.go
│ │ │ │ └── article_v2_update.go
│ │ │ ├── gendao
│ │ │ ├── generated_user
│ │ │ │ ├── dao
│ │ │ │ │ ├── internal
│ │ │ │ │ │ └── table_user.go
│ │ │ │ │ └── table_user.go
│ │ │ │ └── model
│ │ │ │ │ ├── do
│ │ │ │ │ └── table_user.go
│ │ │ │ │ └── entity
│ │ │ │ │ └── table_user.go
│ │ │ ├── generated_user_field_mapping
│ │ │ │ ├── dao
│ │ │ │ │ ├── internal
│ │ │ │ │ │ └── table_user.go
│ │ │ │ │ └── table_user.go
│ │ │ │ └── model
│ │ │ │ │ ├── do
│ │ │ │ │ └── table_user.go
│ │ │ │ │ └── entity
│ │ │ │ │ └── table_user.go
│ │ │ ├── generated_user_sqlite3
│ │ │ │ ├── dao
│ │ │ │ │ ├── internal
│ │ │ │ │ │ └── table_user.go
│ │ │ │ │ └── table_user.go
│ │ │ │ └── model
│ │ │ │ │ ├── do
│ │ │ │ │ └── table_user.go
│ │ │ │ │ └── entity
│ │ │ │ │ └── table_user.go
│ │ │ ├── generated_user_type_mapping
│ │ │ │ ├── dao
│ │ │ │ │ ├── internal
│ │ │ │ │ │ └── table_user.go
│ │ │ │ │ └── table_user.go
│ │ │ │ └── model
│ │ │ │ │ ├── do
│ │ │ │ │ └── table_user.go
│ │ │ │ │ └── entity
│ │ │ │ │ └── table_user.go
│ │ │ ├── go.mod.txt
│ │ │ ├── sharding
│ │ │ │ └── sharding.sql
│ │ │ ├── sqlite3
│ │ │ │ └── user.sqlite3.sql
│ │ │ └── user.tpl.sql
│ │ │ ├── genpbentity
│ │ │ ├── generated
│ │ │ │ ├── table_user.proto
│ │ │ │ └── table_user_snake_screaming.proto
│ │ │ └── user.tpl.sql
│ │ │ ├── genservice
│ │ │ ├── logic
│ │ │ │ ├── article
│ │ │ │ │ ├── article.go
│ │ │ │ │ └── article_extra.go
│ │ │ │ ├── base
│ │ │ │ │ ├── base.go
│ │ │ │ │ ├── base_destory.go
│ │ │ │ │ └── sub
│ │ │ │ │ │ └── sub.go
│ │ │ │ ├── delivery
│ │ │ │ │ ├── delivery_app.go
│ │ │ │ │ └── delivery_cluster.go
│ │ │ │ ├── logic_expect.go
│ │ │ │ └── user
│ │ │ │ │ ├── supper_vip_user.go
│ │ │ │ │ ├── user.go
│ │ │ │ │ └── vip_user.go
│ │ │ └── service
│ │ │ │ ├── article.go
│ │ │ │ ├── base.go
│ │ │ │ ├── delivery.go
│ │ │ │ └── user.go
│ │ │ └── issue
│ │ │ ├── 2572
│ │ │ ├── config.yaml
│ │ │ ├── dao
│ │ │ │ ├── internal
│ │ │ │ │ ├── user_3.go
│ │ │ │ │ └── user_4.go
│ │ │ │ ├── user_3.go
│ │ │ │ └── user_4.go
│ │ │ ├── model
│ │ │ │ ├── do
│ │ │ │ │ ├── user_3.go
│ │ │ │ │ └── user_4.go
│ │ │ │ └── entity
│ │ │ │ │ ├── user_3.go
│ │ │ │ │ └── user_4.go
│ │ │ ├── sql1.sql
│ │ │ └── sql2.sql
│ │ │ ├── 2616
│ │ │ ├── config.yaml
│ │ │ ├── dao
│ │ │ │ ├── internal
│ │ │ │ │ ├── user_1.go
│ │ │ │ │ ├── user_2.go
│ │ │ │ │ ├── user_3.go
│ │ │ │ │ └── user_4.go
│ │ │ │ ├── user_1.go
│ │ │ │ ├── user_2.go
│ │ │ │ ├── user_3.go
│ │ │ │ └── user_4.go
│ │ │ ├── model
│ │ │ │ ├── do
│ │ │ │ │ ├── user_3.go
│ │ │ │ │ └── user_4.go
│ │ │ │ └── entity
│ │ │ │ │ ├── user_3.go
│ │ │ │ │ └── user_4.go
│ │ │ ├── sql1.sql
│ │ │ └── sql2.sql
│ │ │ ├── 2746
│ │ │ ├── issue_2746.go
│ │ │ └── sql.sql
│ │ │ ├── 3328
│ │ │ └── logic
│ │ │ │ └── .gitkeep
│ │ │ ├── 3459
│ │ │ └── config.yaml
│ │ │ ├── 3460
│ │ │ ├── api
│ │ │ │ └── hello
│ │ │ │ │ ├── hello.go
│ │ │ │ │ ├── v1
│ │ │ │ │ └── req.go
│ │ │ │ │ └── v2
│ │ │ │ │ └── req.go
│ │ │ └── controller
│ │ │ │ └── hello
│ │ │ │ ├── hello.go
│ │ │ │ ├── hello_new.go
│ │ │ │ ├── hello_v1_req.go
│ │ │ │ └── hello_v2_req.go
│ │ │ ├── 3545
│ │ │ └── table_user.proto
│ │ │ ├── 3685
│ │ │ ├── table_user.proto
│ │ │ └── user.tpl.sql
│ │ │ ├── 3749
│ │ │ ├── dao
│ │ │ │ ├── internal
│ │ │ │ │ └── table_user.go
│ │ │ │ └── table_user.go
│ │ │ ├── model
│ │ │ │ ├── do
│ │ │ │ │ └── table_user.go
│ │ │ │ └── entity
│ │ │ │ │ └── table_user.go
│ │ │ └── user.tpl.sql
│ │ │ ├── 3835
│ │ │ ├── logic
│ │ │ │ ├── issue3835
│ │ │ │ │ └── issue3835.go
│ │ │ │ └── logic.go
│ │ │ └── service
│ │ │ │ └── issue_3835.go
│ │ │ ├── 3882
│ │ │ └── issue3882.proto
│ │ │ └── 3953
│ │ │ └── issue3953.proto
│ ├── consts
│ │ ├── consts.go
│ │ ├── consts_gen_ctrl_template.go
│ │ ├── consts_gen_ctrl_template_sdk.go
│ │ ├── consts_gen_dao_template_dao.go
│ │ ├── consts_gen_dao_template_do.go
│ │ ├── consts_gen_dao_template_entity.go
│ │ ├── consts_gen_enums_template.go
│ │ ├── consts_gen_pbentity_template.go
│ │ ├── consts_gen_service_template.go
│ │ └── consts_gen_service_template_logic.go
│ ├── packed
│ │ ├── packed.go
│ │ ├── template-mono-app.go
│ │ ├── template-mono.go
│ │ └── template-single.go
│ ├── service
│ │ └── install.go
│ └── utility
│ │ ├── allyes
│ │ └── allyes.go
│ │ ├── mlog
│ │ └── mlog.go
│ │ └── utils
│ │ ├── utils.go
│ │ ├── utils_http_download.go
│ │ └── utils_test.go
│ ├── main.go
│ └── test
│ └── testdata
│ ├── tpls
│ ├── tpl1.yaml
│ └── tpl2.sql
│ └── values.json
├── container
├── garray
│ ├── garray.go
│ ├── garray_func.go
│ ├── garray_normal_any.go
│ ├── garray_normal_int.go
│ ├── garray_normal_str.go
│ ├── garray_sorted_any.go
│ ├── garray_sorted_int.go
│ ├── garray_sorted_str.go
│ ├── garray_z_bench_any_test.go
│ ├── garray_z_example_normal_any_test.go
│ ├── garray_z_example_normal_int_test.go
│ ├── garray_z_example_normal_str_test.go
│ ├── garray_z_example_sorted_str_test.go
│ ├── garray_z_unit_all_basic_test.go
│ ├── garray_z_unit_normal_any_test.go
│ ├── garray_z_unit_normal_int_test.go
│ ├── garray_z_unit_normal_str_test.go
│ ├── garray_z_unit_sorted_any_test.go
│ ├── garray_z_unit_sorted_int_test.go
│ └── garray_z_unit_sorted_str_test.go
├── glist
│ ├── glist.go
│ ├── glist_z_bench_test.go
│ ├── glist_z_example_test.go
│ └── glist_z_unit_test.go
├── gmap
│ ├── gmap.go
│ ├── gmap_hash_any_any_map.go
│ ├── gmap_hash_int_any_map.go
│ ├── gmap_hash_int_int_map.go
│ ├── gmap_hash_int_str_map.go
│ ├── gmap_hash_str_any_map.go
│ ├── gmap_hash_str_int_map.go
│ ├── gmap_hash_str_str_map.go
│ ├── gmap_list_map.go
│ ├── gmap_tree_map.go
│ ├── gmap_z_basic_test.go
│ ├── gmap_z_bench_maps_test.go
│ ├── gmap_z_bench_safe_test.go
│ ├── gmap_z_bench_syncmap_test.go
│ ├── gmap_z_bench_unsafe_test.go
│ ├── gmap_z_example_any_any_test.go
│ ├── gmap_z_example_int_any_test.go
│ ├── gmap_z_example_int_int_test.go
│ ├── gmap_z_example_list_test.go
│ ├── gmap_z_example_str_any_test.go
│ ├── gmap_z_example_str_int_test.go
│ ├── gmap_z_example_str_str_test.go
│ ├── gmap_z_example_test.go
│ ├── gmap_z_unit_hash_any_any_test.go
│ ├── gmap_z_unit_hash_int_any_test.go
│ ├── gmap_z_unit_hash_int_int_test.go
│ ├── gmap_z_unit_hash_int_str_test.go
│ ├── gmap_z_unit_hash_str_any_test.go
│ ├── gmap_z_unit_hash_str_int_test.go
│ ├── gmap_z_unit_hash_str_str_test.go
│ ├── gmap_z_unit_list_map_test.go
│ └── gmap_z_unit_tree_map_test.go
├── gpool
│ ├── gpool.go
│ ├── gpool_bench_test.go
│ ├── gpool_z_example_test.go
│ └── gpool_z_unit_test.go
├── gqueue
│ ├── gqueue.go
│ ├── gqueue_z_bench_test.go
│ ├── gqueue_z_example_test.go
│ └── gqueue_z_unit_test.go
├── gring
│ ├── gring.go
│ ├── gring_z_bench_test.go
│ ├── gring_z_example_test.go
│ └── gring_z_unit_test.go
├── gset
│ ├── gset_any_set.go
│ ├── gset_int_set.go
│ ├── gset_str_set.go
│ ├── gset_z_bench_test.go
│ ├── gset_z_example_any_test.go
│ ├── gset_z_example_int_test.go
│ ├── gset_z_example_str_test.go
│ ├── gset_z_unit_any_test.go
│ ├── gset_z_unit_int_test.go
│ └── gset_z_unit_str_test.go
├── gtree
│ ├── gtree.go
│ ├── gtree_avltree.go
│ ├── gtree_btree.go
│ ├── gtree_redblacktree.go
│ ├── gtree_z_avl_tree_test.go
│ ├── gtree_z_b_tree_test.go
│ ├── gtree_z_example_avltree_test.go
│ ├── gtree_z_example_btree_test.go
│ ├── gtree_z_example_redblacktree_test.go
│ ├── gtree_z_example_test.go
│ └── gtree_z_redblack_tree_test.go
├── gtype
│ ├── gtype.go
│ ├── gtype_any.go
│ ├── gtype_bool.go
│ ├── gtype_byte.go
│ ├── gtype_bytes.go
│ ├── gtype_float32.go
│ ├── gtype_float64.go
│ ├── gtype_int.go
│ ├── gtype_int32.go
│ ├── gtype_int64.go
│ ├── gtype_interface.go
│ ├── gtype_string.go
│ ├── gtype_uint.go
│ ├── gtype_uint32.go
│ ├── gtype_uint64.go
│ ├── gtype_z_bench_basic_test.go
│ ├── gtype_z_bench_json_test.go
│ ├── gtype_z_unit_any_test.go
│ ├── gtype_z_unit_bool_test.go
│ ├── gtype_z_unit_byte_test.go
│ ├── gtype_z_unit_bytes_test.go
│ ├── gtype_z_unit_float32_test.go
│ ├── gtype_z_unit_float64_test.go
│ ├── gtype_z_unit_int32_test.go
│ ├── gtype_z_unit_int64_test.go
│ ├── gtype_z_unit_int_test.go
│ ├── gtype_z_unit_interface_test.go
│ ├── gtype_z_unit_string_test.go
│ ├── gtype_z_unit_uint32_test.go
│ ├── gtype_z_unit_uint64_test.go
│ └── gtype_z_unit_uint_test.go
└── gvar
│ ├── gvar.go
│ ├── gvar_basic.go
│ ├── gvar_copy.go
│ ├── gvar_is.go
│ ├── gvar_list.go
│ ├── gvar_map.go
│ ├── gvar_scan.go
│ ├── gvar_set.go
│ ├── gvar_slice.go
│ ├── gvar_struct.go
│ ├── gvar_time.go
│ ├── gvar_vars.go
│ ├── gvar_z_bench_ptr_test.go
│ ├── gvar_z_example_test.go
│ ├── gvar_z_unit_basic_test.go
│ ├── gvar_z_unit_is_test.go
│ ├── gvar_z_unit_json_test.go
│ ├── gvar_z_unit_list_test.go
│ ├── gvar_z_unit_map_test.go
│ ├── gvar_z_unit_slice_test.go
│ ├── gvar_z_unit_struct_test.go
│ └── gvar_z_unit_vars_test.go
├── contrib
├── config
│ ├── README.MD
│ ├── apollo
│ │ ├── README.MD
│ │ ├── apollo.go
│ │ ├── apollo_test.go
│ │ ├── go.mod
│ │ └── go.sum
│ ├── consul
│ │ ├── README.md
│ │ ├── consul.go
│ │ ├── consul_test.go
│ │ ├── go.mod
│ │ └── go.sum
│ ├── kubecm
│ │ ├── README.MD
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── kubecm.go
│ │ ├── kubecm_kube.go
│ │ ├── kubecm_test.go
│ │ └── testdata
│ │ │ └── configmap.yaml
│ ├── nacos
│ │ ├── README.MD
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── nacos.go
│ │ └── nacos_test.go
│ └── polaris
│ │ ├── README.MD
│ │ ├── go.mod
│ │ ├── go.sum
│ │ └── polaris.go
├── drivers
│ ├── README.MD
│ ├── README.zh_CN.MD
│ ├── clickhouse
│ │ ├── clickhouse.go
│ │ ├── clickhouse_convert.go
│ │ ├── clickhouse_do_commit.go
│ │ ├── clickhouse_do_delete.go
│ │ ├── clickhouse_do_filter.go
│ │ ├── clickhouse_do_insert.go
│ │ ├── clickhouse_do_update.go
│ │ ├── clickhouse_insert.go
│ │ ├── clickhouse_open.go
│ │ ├── clickhouse_ping.go
│ │ ├── clickhouse_table_fields.go
│ │ ├── clickhouse_tables.go
│ │ ├── clickhouse_transaction.go
│ │ ├── clickhouse_z_unit_db_test.go
│ │ ├── clickhouse_z_unit_init_test.go
│ │ ├── clickhouse_z_unit_issue_test.go
│ │ ├── clickhouse_z_unit_model_test.go
│ │ ├── clickhouse_z_unit_test.go
│ │ ├── go.mod
│ │ └── go.sum
│ ├── dm
│ │ ├── dm.go
│ │ ├── dm_convert.go
│ │ ├── dm_do_filter.go
│ │ ├── dm_do_insert.go
│ │ ├── dm_do_query.go
│ │ ├── dm_open.go
│ │ ├── dm_table_fields.go
│ │ ├── dm_tables.go
│ │ ├── dm_z_unit_basic_test.go
│ │ ├── dm_z_unit_init_test.go
│ │ ├── dm_z_unit_issue_test.go
│ │ ├── go.mod
│ │ ├── go.sum
│ │ └── testdata
│ │ │ └── issue
│ │ │ └── 2594
│ │ │ └── sql.sql
│ ├── mssql
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── mssql.go
│ │ ├── mssql_do_commit.go
│ │ ├── mssql_do_filter.go
│ │ ├── mssql_do_filter_test.go
│ │ ├── mssql_do_insert.go
│ │ ├── mssql_open.go
│ │ ├── mssql_table_fields.go
│ │ ├── mssql_tables.go
│ │ ├── mssql_z_unit_basic_test.go
│ │ ├── mssql_z_unit_init_test.go
│ │ ├── mssql_z_unit_model_test.go
│ │ └── mssql_z_unit_transaction_test.go
│ ├── mysql
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── mysql.go
│ │ ├── mysql_do_filter.go
│ │ ├── mysql_open.go
│ │ ├── mysql_table_fields.go
│ │ ├── mysql_tables.go
│ │ ├── mysql_z_unit_basic_test.go
│ │ ├── mysql_z_unit_core_test.go
│ │ ├── mysql_z_unit_feature_ctx_test.go
│ │ ├── mysql_z_unit_feature_hook_test.go
│ │ ├── mysql_z_unit_feature_master_slave_test.go
│ │ ├── mysql_z_unit_feature_model_builder_test.go
│ │ ├── mysql_z_unit_feature_model_do_test.go
│ │ ├── mysql_z_unit_feature_model_join_test.go
│ │ ├── mysql_z_unit_feature_model_sharding_test.go
│ │ ├── mysql_z_unit_feature_model_struct_test.go
│ │ ├── mysql_z_unit_feature_model_subquery_test.go
│ │ ├── mysql_z_unit_feature_raw_type_test.go
│ │ ├── mysql_z_unit_feature_scanlist_test.go
│ │ ├── mysql_z_unit_feature_soft_time_test.go
│ │ ├── mysql_z_unit_feature_union_test.go
│ │ ├── mysql_z_unit_feature_with_test.go
│ │ ├── mysql_z_unit_init_test.go
│ │ ├── mysql_z_unit_internal_test.go
│ │ ├── mysql_z_unit_issue_test.go
│ │ ├── mysql_z_unit_model_test.go
│ │ ├── mysql_z_unit_model_where_test.go
│ │ ├── mysql_z_unit_transaction_test.go
│ │ └── testdata
│ │ │ ├── date_time_example.sql
│ │ │ ├── fix_gdb_join.sql
│ │ │ ├── fix_gdb_join_expect.sql
│ │ │ ├── fix_gdb_order_by.sql
│ │ │ ├── issues
│ │ │ ├── 1380.sql
│ │ │ ├── 1401.sql
│ │ │ ├── 1412.sql
│ │ │ ├── 2105.sql
│ │ │ ├── 2119.sql
│ │ │ ├── 2439.sql
│ │ │ ├── 2643.sql
│ │ │ ├── 3086.sql
│ │ │ ├── 3218.sql
│ │ │ ├── 3626.sql
│ │ │ ├── 3754.sql
│ │ │ ├── 3915.sql
│ │ │ ├── 4034.sql
│ │ │ └── 4086.sql
│ │ │ ├── reservedwords_table_tpl.sql
│ │ │ ├── table_with_prefix.sql
│ │ │ ├── with_multiple_depends.sql
│ │ │ ├── with_tpl_user.sql
│ │ │ ├── with_tpl_user_detail.sql
│ │ │ └── with_tpl_user_scores.sql
│ ├── oracle
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── oracle.go
│ │ ├── oracle_do_commit.go
│ │ ├── oracle_do_filter.go
│ │ ├── oracle_do_insert.go
│ │ ├── oracle_open.go
│ │ ├── oracle_order.go
│ │ ├── oracle_table_fields.go
│ │ ├── oracle_tables.go
│ │ ├── oracle_z_unit_basic_test.go
│ │ ├── oracle_z_unit_init_test.go
│ │ └── oracle_z_unit_model_test.go
│ ├── pgsql
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── pgsql.go
│ │ ├── pgsql_convert.go
│ │ ├── pgsql_do_exec.go
│ │ ├── pgsql_do_filter.go
│ │ ├── pgsql_do_insert.go
│ │ ├── pgsql_format_upsert.go
│ │ ├── pgsql_open.go
│ │ ├── pgsql_order.go
│ │ ├── pgsql_result.go
│ │ ├── pgsql_table_fields.go
│ │ ├── pgsql_tables.go
│ │ ├── pgsql_z_unit_db_test.go
│ │ ├── pgsql_z_unit_init_test.go
│ │ ├── pgsql_z_unit_issue_test.go
│ │ ├── pgsql_z_unit_model_test.go
│ │ ├── pgsql_z_unit_raw_test.go
│ │ ├── pgsql_z_unit_test.go
│ │ └── testdata
│ │ │ └── issues
│ │ │ ├── issue3632.sql
│ │ │ ├── issue3668.sql
│ │ │ ├── issue3671.sql
│ │ │ └── issue4033.sql
│ ├── sqlite
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── sqlite.go
│ │ ├── sqlite_do_filter.go
│ │ ├── sqlite_format_upsert.go
│ │ ├── sqlite_open.go
│ │ ├── sqlite_order.go
│ │ ├── sqlite_table_fields.go
│ │ ├── sqlite_tables.go
│ │ ├── sqlite_z_unit_core_test.go
│ │ ├── sqlite_z_unit_init_test.go
│ │ └── sqlite_z_unit_model_test.go
│ └── sqlitecgo
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── sqlite_format_upsert.go
│ │ ├── sqlitecgo.go
│ │ ├── sqlitecgo_do_filter.go
│ │ ├── sqlitecgo_open.go
│ │ ├── sqlitecgo_table_fields.go
│ │ ├── sqlitecgo_tables.go
│ │ ├── sqlitecgo_z_unit_core_test.go
│ │ ├── sqlitecgo_z_unit_init_test.go
│ │ └── sqlitecgo_z_unit_model_test.go
├── metric
│ └── otelmetric
│ │ ├── README.MD
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── otelmetric.go
│ │ ├── otelmetric_callback.go
│ │ ├── otelmetric_meter_counter_performer.go
│ │ ├── otelmetric_meter_histogram_performer.go
│ │ ├── otelmetric_meter_observable_counter_performer.go
│ │ ├── otelmetric_meter_observable_gauge_performer.go
│ │ ├── otelmetric_meter_observable_updown_counter_performer.go
│ │ ├── otelmetric_meter_performer.go
│ │ ├── otelmetric_meter_updown_counter_performer.go
│ │ ├── otelmetric_metric_callback.go
│ │ ├── otelmetric_option.go
│ │ ├── otelmetric_prometheus.go
│ │ ├── otelmetric_provider.go
│ │ ├── otelmetric_util.go
│ │ ├── otelmetric_z_unit_http_test.go
│ │ ├── otelmetric_z_unit_test.go
│ │ └── testdata
│ │ └── http.prometheus.metrics.txt
├── nosql
│ └── redis
│ │ ├── README.MD
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── redis.go
│ │ ├── redis_conn.go
│ │ ├── redis_func.go
│ │ ├── redis_group_generic.go
│ │ ├── redis_group_hash.go
│ │ ├── redis_group_list.go
│ │ ├── redis_group_pubsub.go
│ │ ├── redis_group_script.go
│ │ ├── redis_group_set.go
│ │ ├── redis_group_sorted_set.go
│ │ ├── redis_group_string.go
│ │ ├── redis_operation.go
│ │ ├── redis_test.go
│ │ ├── redis_z_func_test.go
│ │ ├── redis_z_group_generic_test.go
│ │ ├── redis_z_group_hash_test.go
│ │ ├── redis_z_group_list_test.go
│ │ ├── redis_z_group_pubsub_test.go
│ │ ├── redis_z_group_script_test.go
│ │ ├── redis_z_group_set_test.go
│ │ ├── redis_z_group_sorted_set_test.go
│ │ ├── redis_z_group_string_test.go
│ │ ├── redis_z_unit_config_test.go
│ │ ├── redis_z_unit_conn_sentinel_test.go
│ │ ├── redis_z_unit_conn_test.go
│ │ ├── redis_z_unit_gcache_adapter_test.go
│ │ ├── redis_z_unit_gins_redis_test.go
│ │ ├── redis_z_unit_test.go
│ │ └── testdata
│ │ └── redis
│ │ └── config.toml
├── registry
│ ├── README.MD
│ ├── consul
│ │ ├── README.MD
│ │ ├── consul.go
│ │ ├── consul_discovery.go
│ │ ├── consul_test.go
│ │ ├── consul_watcher.go
│ │ ├── go.mod
│ │ └── go.sum
│ ├── etcd
│ │ ├── README.MD
│ │ ├── etcd.go
│ │ ├── etcd_discovery.go
│ │ ├── etcd_registrar.go
│ │ ├── etcd_service.go
│ │ ├── etcd_watcher.go
│ │ ├── etcd_z_test.go
│ │ ├── go.mod
│ │ └── go.sum
│ ├── file
│ │ ├── README.MD
│ │ ├── file.go
│ │ ├── file_discovery.go
│ │ ├── file_registrar.go
│ │ ├── file_service.go
│ │ ├── file_watcher.go
│ │ ├── file_z_basic_test.go
│ │ ├── file_z_http_test.go
│ │ ├── go.mod
│ │ └── go.sum
│ ├── nacos
│ │ ├── README.MD
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── nacos.go
│ │ ├── nacos_discovery.go
│ │ ├── nacos_register.go
│ │ ├── nacos_service.go
│ │ ├── nacos_watcher.go
│ │ └── nacos_z_test.go
│ ├── polaris
│ │ ├── README.MD
│ │ ├── README_ZH.MD
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── polaris.go
│ │ ├── polaris_discovery.go
│ │ ├── polaris_registry.go
│ │ ├── polaris_service.go
│ │ ├── polaris_watcher.go
│ │ └── polaris_z_test.go
│ └── zookeeper
│ │ ├── README.MD
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── zookeeper.go
│ │ ├── zookeeper_discovery.go
│ │ ├── zookeeper_func.go
│ │ ├── zookeeper_registrar.go
│ │ ├── zookeeper_watcher.go
│ │ └── zookeeper_z_test.go
├── rpc
│ └── grpcx
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── grpcx.go
│ │ ├── grpcx_grpc_client.go
│ │ ├── grpcx_grpc_server.go
│ │ ├── grpcx_grpc_server_config.go
│ │ ├── grpcx_grpc_server_unary.go
│ │ ├── grpcx_interceptor_client.go
│ │ ├── grpcx_interceptor_server.go
│ │ ├── grpcx_registry_file.go
│ │ ├── grpcx_unit_z_ctx_test.go
│ │ ├── grpcx_unit_z_grpc_server_basic_test.go
│ │ ├── grpcx_unit_z_grpc_server_config_test.go
│ │ ├── grpcx_unit_z_issue_test.go
│ │ ├── internal
│ │ ├── balancer
│ │ │ ├── balancer.go
│ │ │ ├── balancer_builder.go
│ │ │ ├── balancer_node.go
│ │ │ └── balancer_picker.go
│ │ ├── grpcctx
│ │ │ └── grpcctx.go
│ │ ├── resolver
│ │ │ ├── resolver.go
│ │ │ ├── resolver_builder.go
│ │ │ ├── resolver_manager.go
│ │ │ └── resolver_resolver.go
│ │ ├── tracing
│ │ │ ├── tracing.go
│ │ │ ├── tracing_interceptor.go
│ │ │ ├── tracing_interceptor_client.go
│ │ │ └── tracing_interceptor_server.go
│ │ └── utils
│ │ │ └── utils.go
│ │ └── testdata
│ │ ├── configuration
│ │ └── config.yaml
│ │ ├── controller
│ │ └── helloworld.go
│ │ └── protobuf
│ │ ├── helloworld.pb.go
│ │ ├── helloworld.proto
│ │ └── helloworld_grpc.pb.go
├── sdk
│ └── httpclient
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── httpclient.go
│ │ ├── httpclient_config.go
│ │ ├── httpclient_handler.go
│ │ └── httpclient_z_unit_feature_handler_test.go
└── trace
│ ├── otlpgrpc
│ ├── go.mod
│ ├── go.sum
│ └── otlpgrpc.go
│ └── otlphttp
│ ├── go.mod
│ ├── go.sum
│ └── otlphttp.go
├── crypto
├── gaes
│ ├── gaes.go
│ └── gaes_z_unit_test.go
├── gcrc32
│ ├── gcrc32.go
│ └── gcrc32_z_unit_test.go
├── gdes
│ ├── gdes.go
│ └── gdes_z_unit_test.go
├── gmd5
│ ├── gmd5.go
│ └── gmd5_z_unit_test.go
└── gsha1
│ ├── gsha1.go
│ └── gsha1_z_unit_test.go
├── database
├── gdb
│ ├── gdb.go
│ ├── gdb_converter.go
│ ├── gdb_core.go
│ ├── gdb_core_config.go
│ ├── gdb_core_ctx.go
│ ├── gdb_core_link.go
│ ├── gdb_core_stats.go
│ ├── gdb_core_structure.go
│ ├── gdb_core_trace.go
│ ├── gdb_core_transaction.go
│ ├── gdb_core_txcore.go
│ ├── gdb_core_underlying.go
│ ├── gdb_core_utility.go
│ ├── gdb_driver_default.go
│ ├── gdb_driver_wrapper.go
│ ├── gdb_driver_wrapper_db.go
│ ├── gdb_func.go
│ ├── gdb_model.go
│ ├── gdb_model_builder.go
│ ├── gdb_model_builder_where.go
│ ├── gdb_model_builder_where_prefix.go
│ ├── gdb_model_builder_whereor.go
│ ├── gdb_model_builder_whereor_prefix.go
│ ├── gdb_model_cache.go
│ ├── gdb_model_delete.go
│ ├── gdb_model_fields.go
│ ├── gdb_model_hook.go
│ ├── gdb_model_insert.go
│ ├── gdb_model_join.go
│ ├── gdb_model_lock.go
│ ├── gdb_model_option.go
│ ├── gdb_model_order_group.go
│ ├── gdb_model_select.go
│ ├── gdb_model_sharding.go
│ ├── gdb_model_soft_time.go
│ ├── gdb_model_transaction.go
│ ├── gdb_model_update.go
│ ├── gdb_model_utility.go
│ ├── gdb_model_where.go
│ ├── gdb_model_where_prefix.go
│ ├── gdb_model_whereor.go
│ ├── gdb_model_whereor_prefix.go
│ ├── gdb_model_with.go
│ ├── gdb_result.go
│ ├── gdb_schema.go
│ ├── gdb_statement.go
│ ├── gdb_type_record.go
│ ├── gdb_type_result.go
│ ├── gdb_type_result_scanlist.go
│ ├── gdb_z_example_test.go
│ ├── gdb_z_mysql_internal_test.go
│ └── testdata
│ │ ├── issue1380.sql
│ │ ├── issue1401.sql
│ │ ├── issue1412.sql
│ │ ├── reservedwords_table_tpl.sql
│ │ └── with_multiple_depends.sql
└── gredis
│ ├── gredis.go
│ ├── gredis_adapter.go
│ ├── gredis_config.go
│ ├── gredis_instance.go
│ ├── gredis_redis.go
│ ├── gredis_redis_group_generic.go
│ ├── gredis_redis_group_hash.go
│ ├── gredis_redis_group_list.go
│ ├── gredis_redis_group_pubsub.go
│ ├── gredis_redis_group_script.go
│ ├── gredis_redis_group_set.go
│ ├── gredis_redis_group_sorted_set.go
│ └── gredis_redis_group_string.go
├── debug
└── gdebug
│ ├── gdebug.go
│ ├── gdebug_caller.go
│ ├── gdebug_grid.go
│ ├── gdebug_stack.go
│ ├── gdebug_version.go
│ ├── gdebug_z_bench_test.go
│ ├── gdebug_z_unit_internal_test.go
│ └── gdebug_z_unit_test.go
├── encoding
├── gbase64
│ ├── gbase64.go
│ ├── gbase64_z_unit_test.go
│ └── testdata
│ │ └── test
├── gbinary
│ ├── gbinary.go
│ ├── gbinary_be.go
│ ├── gbinary_bit.go
│ ├── gbinary_func.go
│ ├── gbinary_le.go
│ ├── gbinary_z_unit_be_test.go
│ ├── gbinary_z_unit_le_test.go
│ └── gbinary_z_unit_test.go
├── gcharset
│ ├── gcharset.go
│ └── gcharset_z_unit_test.go
├── gcompress
│ ├── gcompress.go
│ ├── gcompress_gzip.go
│ ├── gcompress_z_unit_gzip_test.go
│ ├── gcompress_z_unit_zip_test.go
│ ├── gcompress_z_unit_zlib_test.go
│ ├── gcompress_zip.go
│ ├── gcompress_zlib.go
│ └── testdata
│ │ ├── gzip
│ │ └── file.txt
│ │ └── zip
│ │ ├── path1
│ │ └── 1.txt
│ │ └── path2
│ │ └── 2.txt
├── ghash
│ ├── ghash.go
│ ├── ghash_ap.go
│ ├── ghash_bkdr.go
│ ├── ghash_djb.go
│ ├── ghash_elf.go
│ ├── ghash_jshash.go
│ ├── ghash_pjw.go
│ ├── ghash_rs.go
│ ├── ghash_sdbm.go
│ ├── ghash_z_bench_test.go
│ └── ghash_z_unit_test.go
├── ghtml
│ ├── ghtml.go
│ └── ghtml_z_unit_test.go
├── gini
│ ├── gini.go
│ └── gini_z_unit_test.go
├── gjson
│ ├── gjson.go
│ ├── gjson_api.go
│ ├── gjson_api_config.go
│ ├── gjson_api_encoding.go
│ ├── gjson_api_new_load.go
│ ├── gjson_api_new_load_content.go
│ ├── gjson_api_new_load_path.go
│ ├── gjson_implements.go
│ ├── gjson_stdlib_json_util.go
│ ├── gjson_z_bench_test.go
│ ├── gjson_z_example_conversion_test.go
│ ├── gjson_z_example_dataset_test.go
│ ├── gjson_z_example_load_test.go
│ ├── gjson_z_example_new_test.go
│ ├── gjson_z_example_pattern_test.go
│ ├── gjson_z_example_test.go
│ ├── gjson_z_unit_feature_json_test.go
│ ├── gjson_z_unit_feature_load_test.go
│ ├── gjson_z_unit_feature_new_test.go
│ ├── gjson_z_unit_feature_set_test.go
│ ├── gjson_z_unit_feature_struct_test.go
│ ├── gjson_z_unit_implements_test.go
│ ├── gjson_z_unit_internal_test.go
│ ├── gjson_z_unit_test.go
│ └── testdata
│ │ ├── json
│ │ └── data1.json
│ │ ├── properties
│ │ └── data1.properties
│ │ ├── toml
│ │ └── data1.toml
│ │ ├── xml
│ │ └── data1.xml
│ │ └── yaml
│ │ └── data1.yaml
├── gproperties
│ ├── gproperties.go
│ └── gproperties_z_unit_test.go
├── gtoml
│ ├── gtoml.go
│ └── gtoml_z_unit_test.go
├── gurl
│ ├── url.go
│ └── url_z_unit_test.go
├── gxml
│ ├── gxml.go
│ └── gxml_z_unit_test.go
└── gyaml
│ ├── gyaml.go
│ └── gyaml_z_unit_test.go
├── errors
├── gcode
│ ├── gcode.go
│ ├── gcode_local.go
│ └── gcode_z_unit_test.go
└── gerror
│ ├── gerror.go
│ ├── gerror_api.go
│ ├── gerror_api_code.go
│ ├── gerror_api_option.go
│ ├── gerror_api_stack.go
│ ├── gerror_error.go
│ ├── gerror_error_code.go
│ ├── gerror_error_format.go
│ ├── gerror_error_json.go
│ ├── gerror_error_stack.go
│ ├── gerror_z_bench_test.go
│ ├── gerror_z_example_test.go
│ └── gerror_z_unit_test.go
├── frame
├── g
│ ├── g.go
│ ├── g_func.go
│ ├── g_object.go
│ ├── g_setting.go
│ ├── g_z_example_test.go
│ └── g_z_unit_test.go
└── gins
│ ├── gins.go
│ ├── gins_config.go
│ ├── gins_database.go
│ ├── gins_httpclient.go
│ ├── gins_i18n.go
│ ├── gins_log.go
│ ├── gins_redis.go
│ ├── gins_resource.go
│ ├── gins_server.go
│ ├── gins_view.go
│ ├── gins_z_unit_config_test.go
│ ├── gins_z_unit_database_test.go
│ ├── gins_z_unit_httpclient_test.go
│ ├── gins_z_unit_server_test.go
│ ├── gins_z_unit_view_test.go
│ └── testdata
│ ├── config
│ └── config.toml
│ ├── database
│ └── config.toml
│ ├── redis
│ └── config.toml
│ ├── server
│ └── config.yaml
│ ├── view1
│ ├── config.toml
│ ├── test1.html
│ └── test2.html
│ └── view2
│ ├── config.toml
│ └── test.html
├── go.mod
├── go.sum
├── i18n
└── gi18n
│ ├── gi18n.go
│ ├── gi18n_ctx.go
│ ├── gi18n_instance.go
│ ├── gi18n_manager.go
│ ├── gi18n_z_unit_test.go
│ └── testdata
│ ├── i18n-dir
│ ├── en
│ │ ├── hello.toml
│ │ └── world.toml
│ ├── ja
│ │ ├── hello.yaml
│ │ └── world.yaml
│ ├── ru
│ │ ├── hello.ini
│ │ └── world.ini
│ ├── zh-CN
│ │ ├── hello.json
│ │ └── world.json
│ └── zh-TW
│ │ ├── hello.xml
│ │ └── world.xml
│ ├── i18n-file
│ ├── en.toml
│ ├── ja.yaml
│ ├── ru.ini
│ ├── zh-CN.json
│ └── zh-TW.xml
│ └── i18n
│ ├── en.toml
│ ├── ja.toml
│ ├── ru.toml
│ ├── zh-CN.json
│ └── zh-TW.toml
├── internal
├── command
│ └── command.go
├── consts
│ └── consts.go
├── deepcopy
│ ├── deepcopy.go
│ └── deepcopy_test.go
├── empty
│ ├── empty.go
│ └── empty_z_unit_test.go
├── errors
│ ├── errors.go
│ └── errors_test.go
├── fileinfo
│ └── fileinfo.go
├── httputil
│ ├── httputils.go
│ └── httputils_test.go
├── instance
│ ├── instance.go
│ └── instance_test.go
├── intlog
│ └── intlog.go
├── json
│ └── json.go
├── mutex
│ ├── mutex.go
│ ├── mutex_z_bench_test.go
│ └── mutex_z_unit_test.go
├── reflection
│ ├── reflection.go
│ └── reflection_test.go
├── rwmutex
│ ├── rwmutex.go
│ ├── rwmutex_z_bench_test.go
│ └── rwmutex_z_unit_test.go
├── tracing
│ └── tracing.go
└── utils
│ ├── utils.go
│ ├── utils_array.go
│ ├── utils_debug.go
│ ├── utils_io.go
│ ├── utils_is.go
│ ├── utils_list.go
│ ├── utils_map.go
│ ├── utils_reflect.go
│ ├── utils_str.go
│ ├── utils_z_bench_test.go
│ ├── utils_z_unit_is_test.go
│ └── utils_z_unit_test.go
├── net
├── gclient
│ ├── gclient.go
│ ├── gclient_bytes.go
│ ├── gclient_chain.go
│ ├── gclient_config.go
│ ├── gclient_content.go
│ ├── gclient_discovery.go
│ ├── gclient_dump.go
│ ├── gclient_metrics.go
│ ├── gclient_middleware.go
│ ├── gclient_observability.go
│ ├── gclient_request.go
│ ├── gclient_request_obj.go
│ ├── gclient_response.go
│ ├── gclient_tracer.go
│ ├── gclient_tracer_metrics.go
│ ├── gclient_tracer_noop.go
│ ├── gclient_tracer_tracing.go
│ ├── gclient_var.go
│ ├── gclient_websocket.go
│ ├── gclient_z_example_test.go
│ ├── gclient_z_unit_feature_trace_test.go
│ ├── gclient_z_unit_issue_test.go
│ ├── gclient_z_unit_request_obj_test.go
│ ├── gclient_z_unit_test.go
│ └── testdata
│ │ ├── server.crt
│ │ ├── server.key
│ │ └── upload
│ │ ├── file1.txt
│ │ └── file2.txt
├── ghttp
│ ├── ghttp.go
│ ├── ghttp_func.go
│ ├── ghttp_middleware_cors.go
│ ├── ghttp_middleware_gzip.go
│ ├── ghttp_middleware_handler_response.go
│ ├── ghttp_middleware_json_body.go
│ ├── ghttp_middleware_never_done_ctx.go
│ ├── ghttp_middleware_tracing.go
│ ├── ghttp_request.go
│ ├── ghttp_request_auth.go
│ ├── ghttp_request_middleware.go
│ ├── ghttp_request_param.go
│ ├── ghttp_request_param_ctx.go
│ ├── ghttp_request_param_file.go
│ ├── ghttp_request_param_form.go
│ ├── ghttp_request_param_handler.go
│ ├── ghttp_request_param_page.go
│ ├── ghttp_request_param_param.go
│ ├── ghttp_request_param_query.go
│ ├── ghttp_request_param_request.go
│ ├── ghttp_request_param_router.go
│ ├── ghttp_request_view.go
│ ├── ghttp_response.go
│ ├── ghttp_response_cors.go
│ ├── ghttp_response_view.go
│ ├── ghttp_response_write.go
│ ├── ghttp_server.go
│ ├── ghttp_server_admin.go
│ ├── ghttp_server_admin_process.go
│ ├── ghttp_server_admin_unix.go
│ ├── ghttp_server_admin_windows.go
│ ├── ghttp_server_config.go
│ ├── ghttp_server_config_api.go
│ ├── ghttp_server_config_cookie.go
│ ├── ghttp_server_config_logging.go
│ ├── ghttp_server_config_mess.go
│ ├── ghttp_server_config_route.go
│ ├── ghttp_server_config_session.go
│ ├── ghttp_server_config_static.go
│ ├── ghttp_server_cookie.go
│ ├── ghttp_server_domain.go
│ ├── ghttp_server_error_logger.go
│ ├── ghttp_server_graceful.go
│ ├── ghttp_server_handler.go
│ ├── ghttp_server_log.go
│ ├── ghttp_server_metric.go
│ ├── ghttp_server_openapi.go
│ ├── ghttp_server_plugin.go
│ ├── ghttp_server_pprof.go
│ ├── ghttp_server_registry.go
│ ├── ghttp_server_router.go
│ ├── ghttp_server_router_group.go
│ ├── ghttp_server_router_hook.go
│ ├── ghttp_server_router_middleware.go
│ ├── ghttp_server_router_serve.go
│ ├── ghttp_server_service_handler.go
│ ├── ghttp_server_service_object.go
│ ├── ghttp_server_session.go
│ ├── ghttp_server_status.go
│ ├── ghttp_server_swagger.go
│ ├── ghttp_server_util.go
│ ├── ghttp_server_websocket.go
│ ├── ghttp_z_bench_test.go
│ ├── ghttp_z_example_test.go
│ ├── ghttp_z_unit_feature_config_test.go
│ ├── ghttp_z_unit_feature_context_test.go
│ ├── ghttp_z_unit_feature_cookie_test.go
│ ├── ghttp_z_unit_feature_custom_listeners_test.go
│ ├── ghttp_z_unit_feature_error_code_test.go
│ ├── ghttp_z_unit_feature_https_test.go
│ ├── ghttp_z_unit_feature_ip_test.go
│ ├── ghttp_z_unit_feature_log_test.go
│ ├── ghttp_z_unit_feature_middleware_basic_test.go
│ ├── ghttp_z_unit_feature_middleware_cors_test.go
│ ├── ghttp_z_unit_feature_openapi_swagger_test.go
│ ├── ghttp_z_unit_feature_otel_test.go
│ ├── ghttp_z_unit_feature_pprof_test.go
│ ├── ghttp_z_unit_feature_request_ctx_test.go
│ ├── ghttp_z_unit_feature_request_file_test.go
│ ├── ghttp_z_unit_feature_request_json_test.go
│ ├── ghttp_z_unit_feature_request_page_test.go
│ ├── ghttp_z_unit_feature_request_param_test.go
│ ├── ghttp_z_unit_feature_request_struct_test.go
│ ├── ghttp_z_unit_feature_request_test.go
│ ├── ghttp_z_unit_feature_request_xml_test.go
│ ├── ghttp_z_unit_feature_response_test.go
│ ├── ghttp_z_unit_feature_router_basic_test.go
│ ├── ghttp_z_unit_feature_router_domain_basic_test.go
│ ├── ghttp_z_unit_feature_router_domain_object_rest_test.go
│ ├── ghttp_z_unit_feature_router_domain_object_test.go
│ ├── ghttp_z_unit_feature_router_exit_test.go
│ ├── ghttp_z_unit_feature_router_group_group_test.go
│ ├── ghttp_z_unit_feature_router_group_hook_test.go
│ ├── ghttp_z_unit_feature_router_group_rest_test.go
│ ├── ghttp_z_unit_feature_router_group_test.go
│ ├── ghttp_z_unit_feature_router_hook_test.go
│ ├── ghttp_z_unit_feature_router_names_test.go
│ ├── ghttp_z_unit_feature_router_object_rest1_test.go
│ ├── ghttp_z_unit_feature_router_object_rest2_test.go
│ ├── ghttp_z_unit_feature_router_object_test.go
│ ├── ghttp_z_unit_feature_router_standard_test.go
│ ├── ghttp_z_unit_feature_server_util_test.go
│ ├── ghttp_z_unit_feature_session_test.go
│ ├── ghttp_z_unit_feature_static_test.go
│ ├── ghttp_z_unit_feature_status_test.go
│ ├── ghttp_z_unit_feature_template_test.go
│ ├── ghttp_z_unit_feature_websocket_test.go
│ ├── ghttp_z_unit_issue_test.go
│ ├── ghttp_z_unit_middleware_gzip_test.go
│ ├── ghttp_z_unit_test.go
│ ├── internal
│ │ ├── graceful
│ │ │ └── graceful.go
│ │ ├── response
│ │ │ ├── response.go
│ │ │ ├── response_buffer_writer.go
│ │ │ └── response_writer.go
│ │ └── swaggerui
│ │ │ ├── swaggerui-redoc.go
│ │ │ └── swaggerui.go
│ └── testdata
│ │ ├── https
│ │ ├── files
│ │ │ ├── server.crt
│ │ │ └── server.key
│ │ └── packed
│ │ │ └── packed.go
│ │ ├── issue1611
│ │ ├── header.html
│ │ └── index
│ │ │ └── layout.html
│ │ ├── issue2963
│ │ ├── 1.txt
│ │ └── 中文G146(1)-icon.txt
│ │ ├── main.html
│ │ ├── static1
│ │ ├── index.html
│ │ └── test.html
│ │ ├── template
│ │ ├── basic
│ │ │ └── index.html
│ │ ├── layout1
│ │ │ ├── container.html
│ │ │ ├── footer.html
│ │ │ ├── header.html
│ │ │ └── layout.html
│ │ └── layout2
│ │ │ ├── footer.html
│ │ │ ├── header.html
│ │ │ ├── layout.html
│ │ │ └── main
│ │ │ ├── main1.html
│ │ │ └── main2.html
│ │ └── upload
│ │ ├── file1.txt
│ │ └── file2.txt
├── gipv4
│ ├── gipv4.go
│ ├── gipv4_convert.go
│ ├── gipv4_ip.go
│ ├── gipv4_lookup.go
│ ├── gipv4_mac.go
│ ├── gipv4_z_unit_convert_test.go
│ ├── gipv4_z_unit_ip_test.go
│ ├── gipv4_z_unit_lookup_test.go
│ ├── gipv4_z_unit_mac_test.go
│ └── gipv4_z_unit_test.go
├── gipv6
│ └── gipv6.go
├── goai
│ ├── goai.go
│ ├── goai_callback.go
│ ├── goai_components.go
│ ├── goai_config.go
│ ├── goai_example.go
│ ├── goai_external_docs.go
│ ├── goai_header.go
│ ├── goai_info.go
│ ├── goai_link.go
│ ├── goai_mediatype.go
│ ├── goai_operation.go
│ ├── goai_parameter.go
│ ├── goai_parameter_ref.go
│ ├── goai_path.go
│ ├── goai_requestbody.go
│ ├── goai_response.go
│ ├── goai_response_ref.go
│ ├── goai_security.go
│ ├── goai_server.go
│ ├── goai_shema.go
│ ├── goai_shema_ref.go
│ ├── goai_shemas.go
│ ├── goai_tags.go
│ ├── goai_xextensions.go
│ ├── goai_z_unit_issue_test.go
│ ├── goai_z_unit_test.go
│ └── testdata
│ │ ├── EmbeddedStructAttribute
│ │ └── expect.json
│ │ ├── Issue3889JsonFile
│ │ └── 201.json
│ │ ├── NameFromJsonTag
│ │ ├── expect1.json
│ │ └── expect2.json
│ │ ├── XExtension
│ │ └── expect.json
│ │ └── example.yaml
├── gsel
│ ├── gsel.go
│ ├── gsel_builder.go
│ ├── gsel_builder_least_connection.go
│ ├── gsel_builder_random.go
│ ├── gsel_builder_round_robin.go
│ ├── gsel_builder_weight.go
│ ├── gsel_selector_least_connection.go
│ ├── gsel_selector_random.go
│ ├── gsel_selector_round_robin.go
│ └── gsel_selector_weight.go
├── gsvc
│ ├── gsvc.go
│ ├── gsvc_discovery.go
│ ├── gsvc_endpoint.go
│ ├── gsvc_endpoints.go
│ ├── gsvc_metadata.go
│ ├── gsvc_registry.go
│ └── gsvc_service.go
├── gtcp
│ ├── gtcp.go
│ ├── gtcp_conn.go
│ ├── gtcp_conn_pkg.go
│ ├── gtcp_func.go
│ ├── gtcp_func_pkg.go
│ ├── gtcp_pool.go
│ ├── gtcp_pool_pkg.go
│ ├── gtcp_server.go
│ ├── gtcp_z_example_test.go
│ ├── gtcp_z_unit_conn_pkg_test.go
│ ├── gtcp_z_unit_pool_pkg_test.go
│ ├── gtcp_z_unit_pool_test.go
│ ├── gtcp_z_unit_test.go
│ └── testdata
│ │ ├── crtFile
│ │ ├── keyFile
│ │ ├── server.crt
│ │ └── server.key
├── gtrace
│ ├── gtrace.go
│ ├── gtrace_baggage.go
│ ├── gtrace_carrier.go
│ ├── gtrace_content.go
│ ├── gtrace_span.go
│ ├── gtrace_tracer.go
│ ├── gtrace_z_unit_carrier_test.go
│ ├── gtrace_z_unit_feature_http_test.go
│ ├── gtrace_z_unit_test.go
│ └── internal
│ │ └── provider
│ │ ├── provider.go
│ │ └── provider_idgenerator.go
└── gudp
│ ├── gudp.go
│ ├── gudp_conn.go
│ ├── gudp_conn_client_conn.go
│ ├── gudp_conn_server_conn.go
│ ├── gudp_func.go
│ ├── gudp_server.go
│ ├── gudp_z_example_test.go
│ └── gudp_z_unit_test.go
├── os
├── gbuild
│ ├── gbuild.go
│ └── gbuild_z_unit_test.go
├── gcache
│ ├── gcache.go
│ ├── gcache_adapter.go
│ ├── gcache_adapter_memory.go
│ ├── gcache_adapter_memory_data.go
│ ├── gcache_adapter_memory_expire_sets.go
│ ├── gcache_adapter_memory_expire_times.go
│ ├── gcache_adapter_memory_item.go
│ ├── gcache_adapter_memory_lru.go
│ ├── gcache_adapter_redis.go
│ ├── gcache_cache.go
│ ├── gcache_cache_must.go
│ ├── gcache_z_bench_test.go
│ ├── gcache_z_example_cache_test.go
│ └── gcache_z_unit_test.go
├── gcfg
│ ├── gcfg.go
│ ├── gcfg_adaper.go
│ ├── gcfg_adapter_content.go
│ ├── gcfg_adapter_file.go
│ ├── gcfg_adapter_file_content.go
│ ├── gcfg_adapter_file_path.go
│ ├── gcfg_z_example_test.go
│ ├── gcfg_z_unit_adapter_content_test.go
│ ├── gcfg_z_unit_adapter_file_test.go
│ ├── gcfg_z_unit_basic_test.go
│ ├── gcfg_z_unit_instance_test.go
│ ├── gcfg_z_unit_test.go
│ └── testdata
│ │ ├── c1.toml
│ │ ├── cfg-with-utf8-bom.toml
│ │ ├── default
│ │ ├── config.json
│ │ └── config.toml
│ │ ├── envfile
│ │ └── c6.json
│ │ ├── envpath
│ │ ├── c3.toml
│ │ └── c4.json
│ │ └── folder1
│ │ ├── c1.toml
│ │ └── c2.json
├── gcmd
│ ├── gcmd.go
│ ├── gcmd_command.go
│ ├── gcmd_command_help.go
│ ├── gcmd_command_object.go
│ ├── gcmd_command_run.go
│ ├── gcmd_parser.go
│ ├── gcmd_scan.go
│ ├── gcmd_z_example_test.go
│ ├── gcmd_z_unit_feature_object1_test.go
│ ├── gcmd_z_unit_feature_object2_test.go
│ ├── gcmd_z_unit_feature_object3_test.go
│ ├── gcmd_z_unit_feature_object4_test.go
│ ├── gcmd_z_unit_issue_test.go
│ ├── gcmd_z_unit_parser_test.go
│ └── gcmd_z_unit_test.go
├── gcron
│ ├── gcron.go
│ ├── gcron_cron.go
│ ├── gcron_entry.go
│ ├── gcron_schedule.go
│ ├── gcron_schedule_check.go
│ ├── gcron_schedule_fix.go
│ ├── gcron_schedule_next.go
│ ├── gcron_z_bench_test.go
│ ├── gcron_z_example_1_test.go
│ ├── gcron_z_unit_entry_test.go
│ ├── gcron_z_unit_schedule_test.go
│ └── gcron_z_unit_test.go
├── gctx
│ ├── gctx.go
│ ├── gctx_never_done.go
│ ├── gctx_z_unit_internal_test.go
│ └── gctx_z_unit_test.go
├── genv
│ ├── genv.go
│ ├── genv_must.go
│ └── genv_z_unit_test.go
├── gfile
│ ├── gfile.go
│ ├── gfile_cache.go
│ ├── gfile_contents.go
│ ├── gfile_copy.go
│ ├── gfile_home.go
│ ├── gfile_replace.go
│ ├── gfile_scan.go
│ ├── gfile_search.go
│ ├── gfile_size.go
│ ├── gfile_sort.go
│ ├── gfile_source.go
│ ├── gfile_time.go
│ ├── gfile_z_example_cache_test.go
│ ├── gfile_z_example_contents_test.go
│ ├── gfile_z_example_copy_test.go
│ ├── gfile_z_example_home_test.go
│ ├── gfile_z_example_replace_test.go
│ ├── gfile_z_example_scan_test.go
│ ├── gfile_z_example_search_test.go
│ ├── gfile_z_example_size_test.go
│ ├── gfile_z_example_sort_test.go
│ ├── gfile_z_example_time_test.go
│ ├── gfile_z_exmaple_basic_test.go
│ ├── gfile_z_unit_cache_test.go
│ ├── gfile_z_unit_contents_test.go
│ ├── gfile_z_unit_copy_test.go
│ ├── gfile_z_unit_scan_test.go
│ ├── gfile_z_unit_search_test.go
│ ├── gfile_z_unit_size_test.go
│ ├── gfile_z_unit_test.go
│ ├── gfile_z_unit_time_test.go
│ └── testdata
│ │ ├── dir1
│ │ └── file1
│ │ ├── dir2
│ │ └── file2
│ │ └── readline
│ │ └── file.log
├── gfpool
│ ├── gfpool.go
│ ├── gfpool_file.go
│ ├── gfpool_pool.go
│ ├── gfpool_z_bench_test.go
│ └── gfpool_z_unit_test.go
├── gfsnotify
│ ├── gfsnotify.go
│ ├── gfsnotify_event.go
│ ├── gfsnotify_filefunc.go
│ ├── gfsnotify_watcher.go
│ ├── gfsnotify_watcher_loop.go
│ └── gfsnotify_z_unit_test.go
├── glog
│ ├── glog.go
│ ├── glog_api.go
│ ├── glog_chaining.go
│ ├── glog_config.go
│ ├── glog_instance.go
│ ├── glog_logger.go
│ ├── glog_logger_api.go
│ ├── glog_logger_chaining.go
│ ├── glog_logger_color.go
│ ├── glog_logger_config.go
│ ├── glog_logger_handler.go
│ ├── glog_logger_handler_json.go
│ ├── glog_logger_handler_structure.go
│ ├── glog_logger_level.go
│ ├── glog_logger_rotate.go
│ ├── glog_logger_writer.go
│ ├── glog_z_example_test.go
│ ├── glog_z_unit_config_test.go
│ ├── glog_z_unit_internal_test.go
│ ├── glog_z_unit_logger_chaining_test.go
│ ├── glog_z_unit_logger_handler_test.go
│ ├── glog_z_unit_logger_rotate_test.go
│ └── glog_z_unit_test.go
├── gmetric
│ ├── gmetric.go
│ ├── gmetric_attribute.go
│ ├── gmetric_attribute_map.go
│ ├── gmetric_global_attributes.go
│ ├── gmetric_meter.go
│ ├── gmetric_meter_callback.go
│ ├── gmetric_meter_counter.go
│ ├── gmetric_meter_histogram.go
│ ├── gmetric_meter_metric_info.go
│ ├── gmetric_meter_metric_instrument.go
│ ├── gmetric_meter_observable_counter.go
│ ├── gmetric_meter_observable_gauge.go
│ ├── gmetric_meter_observable_updown_counter.go
│ ├── gmetric_meter_updown_counter.go
│ ├── gmetric_metric.go
│ ├── gmetric_noop_counter_performer.go
│ ├── gmetric_noop_histogram_performer.go
│ ├── gmetric_noop_observable_counter_performer.go
│ ├── gmetric_noop_observable_gauge_performer.go
│ ├── gmetric_noop_observable_updown_counter_performer.go
│ ├── gmetric_noop_updown_counter_performer.go
│ ├── gmetric_provider.go
│ ├── gmetric_z_unit_internal_test.go
│ └── gmetric_z_unit_test.go
├── gmlock
│ ├── gmlock.go
│ ├── gmlock_locker.go
│ ├── gmlock_z_bench_test.go
│ └── gmlock_z_unit_test.go
├── gmutex
│ ├── gmutex.go
│ ├── gmutex_mutex.go
│ ├── gmutex_rwmutex.go
│ ├── gmutex_z_bench_test.go
│ ├── gmutex_z_unit_mutex_test.go
│ └── gmutex_z_unit_rwmutex_test.go
├── gproc
│ ├── gproc.go
│ ├── gproc_comm.go
│ ├── gproc_comm_receive.go
│ ├── gproc_comm_send.go
│ ├── gproc_manager.go
│ ├── gproc_must.go
│ ├── gproc_process.go
│ ├── gproc_process_newprocess.go
│ ├── gproc_process_newprocess_windows.go
│ ├── gproc_shell.go
│ ├── gproc_signal.go
│ ├── gproc_z_signal_test.go
│ ├── gproc_z_unit_process_windows_test.go
│ ├── gproc_z_unit_shell_windows_test.go
│ ├── gproc_z_unit_test.go
│ └── testdata
│ │ ├── gobuild
│ │ └── main.go
│ │ └── shellexec
│ │ └── main.go
├── gres
│ ├── gres.go
│ ├── gres_file.go
│ ├── gres_func.go
│ ├── gres_func_zip.go
│ ├── gres_http_file.go
│ ├── gres_instance.go
│ ├── gres_resource.go
│ ├── gres_z_unit_test.go
│ └── testdata
│ │ ├── data
│ │ └── data.go
│ │ ├── example
│ │ ├── boot
│ │ │ └── data.go
│ │ └── files
│ │ │ ├── config
│ │ │ └── config.toml
│ │ │ ├── public
│ │ │ └── index.html
│ │ │ └── template
│ │ │ └── index.tpl
│ │ ├── files
│ │ ├── config-custom
│ │ │ ├── config.toml
│ │ │ └── my.ini
│ │ ├── config-res
│ │ │ ├── config.toml
│ │ │ └── my.ini
│ │ ├── dir1
│ │ │ ├── sub
│ │ │ │ └── sub-test1.txt
│ │ │ └── test1
│ │ ├── dir2
│ │ │ ├── sub
│ │ │ │ └── sub-test2.txt
│ │ │ └── test2
│ │ ├── i18n-dir
│ │ │ ├── en
│ │ │ │ ├── hello.toml
│ │ │ │ └── world.toml
│ │ │ ├── ja
│ │ │ │ ├── hello.yaml
│ │ │ │ └── world.yaml
│ │ │ ├── ru
│ │ │ │ ├── hello.ini
│ │ │ │ └── world.ini
│ │ │ ├── zh-CN
│ │ │ │ ├── hello.json
│ │ │ │ └── world.json
│ │ │ └── zh-TW
│ │ │ │ ├── hello.xml
│ │ │ │ └── world.xml
│ │ ├── i18n-file
│ │ │ ├── en.toml
│ │ │ ├── ja.yaml
│ │ │ ├── ru.ini
│ │ │ ├── zh-CN.json
│ │ │ └── zh-TW.xml
│ │ ├── i18n-res
│ │ │ ├── en.toml
│ │ │ ├── ja.toml
│ │ │ ├── ru.toml
│ │ │ ├── zh-CN.toml
│ │ │ └── zh-TW.toml
│ │ ├── root
│ │ │ ├── css
│ │ │ │ └── style.css
│ │ │ ├── image
│ │ │ │ └── logo.png
│ │ │ └── index.html
│ │ └── template-res
│ │ │ ├── index.html
│ │ │ ├── layout1
│ │ │ ├── container.html
│ │ │ ├── footer.html
│ │ │ ├── header.html
│ │ │ └── layout.html
│ │ │ └── layout2
│ │ │ ├── footer.html
│ │ │ ├── header.html
│ │ │ ├── layout.html
│ │ │ └── main
│ │ │ ├── main1.html
│ │ │ └── main2.html
│ │ ├── testdata.go
│ │ └── testdata.txt
├── grpool
│ ├── grpool.go
│ ├── grpool_pool.go
│ ├── grpool_supervisor.go
│ ├── grpool_z_bench_test.go
│ └── grpool_z_unit_test.go
├── gsession
│ ├── gsession.go
│ ├── gsession_manager.go
│ ├── gsession_session.go
│ ├── gsession_storage.go
│ ├── gsession_storage_base.go
│ ├── gsession_storage_file.go
│ ├── gsession_storage_memory.go
│ ├── gsession_storage_redis.go
│ ├── gsession_storage_redis_hashtable.go
│ ├── gsession_z_example_test.go
│ ├── gsession_z_unit_storage_file_test.go
│ ├── gsession_z_unit_storage_memory_test.go
│ └── gsession_z_unit_test.go
├── gspath
│ ├── gspath.go
│ ├── gspath_cache.go
│ └── gspath_z_unit_test.go
├── gstructs
│ ├── gstructs.go
│ ├── gstructs_field.go
│ ├── gstructs_field_tag.go
│ ├── gstructs_tag.go
│ ├── gstructs_type.go
│ ├── gstructs_z_bench_test.go
│ └── gstructs_z_unit_test.go
├── gtime
│ ├── gtime.go
│ ├── gtime_format.go
│ ├── gtime_sql.go
│ ├── gtime_time.go
│ ├── gtime_time_wrapper.go
│ ├── gtime_time_zone.go
│ ├── gtime_z_bench_test.go
│ ├── gtime_z_example_basic_test.go
│ ├── gtime_z_example_time_test.go
│ ├── gtime_z_unit_feature_json_test.go
│ ├── gtime_z_unit_feature_sql_test.go
│ ├── gtime_z_unit_format_test.go
│ ├── gtime_z_unit_issue_test.go
│ ├── gtime_z_unit_test.go
│ └── gtime_z_unit_time_test.go
├── gtimer
│ ├── gtimer.go
│ ├── gtimer_entry.go
│ ├── gtimer_exit.go
│ ├── gtimer_queue.go
│ ├── gtimer_queue_heap.go
│ ├── gtimer_timer.go
│ ├── gtimer_timer_loop.go
│ ├── gtimer_z_bench_test.go
│ ├── gtimer_z_example_test.go
│ ├── gtimer_z_unit_entry_test.go
│ ├── gtimer_z_unit_internal_test.go
│ ├── gtimer_z_unit_test.go
│ └── gtimer_z_unit_timer_test.go
└── gview
│ ├── gview.go
│ ├── gview_buildin.go
│ ├── gview_config.go
│ ├── gview_error.go
│ ├── gview_i18n.go
│ ├── gview_instance.go
│ ├── gview_parse.go
│ ├── gview_z_unit_config_test.go
│ ├── gview_z_unit_feature_encode_test.go
│ ├── gview_z_unit_i18n_test.go
│ ├── gview_z_unit_test.go
│ └── testdata
│ ├── config
│ └── test.html
│ ├── i18n
│ ├── en.toml
│ ├── ja.toml
│ ├── ru.toml
│ ├── zh-CN.toml
│ └── zh-TW.toml
│ ├── issue1416
│ ├── gview copy.tpl
│ └── gview.tpl
│ └── tpl
│ └── encode.tpl
├── sonar-project.properties
├── test
└── gtest
│ ├── gtest.go
│ ├── gtest_t.go
│ ├── gtest_util.go
│ ├── gtest_z_unit_test.go
│ └── testdata
│ └── testdata.txt
├── text
├── gregex
│ ├── gregex.go
│ ├── gregex_cache.go
│ ├── gregex_z_bench_test.go
│ ├── gregex_z_example_test.go
│ └── gregex_z_unit_test.go
└── gstr
│ ├── gstr.go
│ ├── gstr_array.go
│ ├── gstr_case.go
│ ├── gstr_compare.go
│ ├── gstr_contain.go
│ ├── gstr_convert.go
│ ├── gstr_count.go
│ ├── gstr_create.go
│ ├── gstr_domain.go
│ ├── gstr_is.go
│ ├── gstr_length.go
│ ├── gstr_list.go
│ ├── gstr_parse.go
│ ├── gstr_pos.go
│ ├── gstr_replace.go
│ ├── gstr_similar.go
│ ├── gstr_slashes.go
│ ├── gstr_split_join.go
│ ├── gstr_sub.go
│ ├── gstr_trim.go
│ ├── gstr_upper_lower.go
│ ├── gstr_version.go
│ ├── gstr_z_example_test.go
│ ├── gstr_z_unit_array_test.go
│ ├── gstr_z_unit_case_test.go
│ ├── gstr_z_unit_convert_test.go
│ ├── gstr_z_unit_domain_test.go
│ ├── gstr_z_unit_list_test.go
│ ├── gstr_z_unit_parse_test.go
│ ├── gstr_z_unit_pos_test.go
│ ├── gstr_z_unit_replace_test.go
│ ├── gstr_z_unit_test.go
│ ├── gstr_z_unit_trim_test.go
│ └── gstr_z_unit_version_test.go
├── util
├── gconv
│ ├── gconv.go
│ ├── gconv_basic.go
│ ├── gconv_convert.go
│ ├── gconv_float.go
│ ├── gconv_int.go
│ ├── gconv_map.go
│ ├── gconv_maps.go
│ ├── gconv_maptomap.go
│ ├── gconv_maptomaps.go
│ ├── gconv_ptr.go
│ ├── gconv_scan.go
│ ├── gconv_scan_list.go
│ ├── gconv_slice_any.go
│ ├── gconv_slice_float.go
│ ├── gconv_slice_int.go
│ ├── gconv_slice_str.go
│ ├── gconv_slice_uint.go
│ ├── gconv_struct.go
│ ├── gconv_structs.go
│ ├── gconv_time.go
│ ├── gconv_uint.go
│ ├── gconv_unsafe.go
│ ├── gconv_z_bench_bytes_test.go
│ ├── gconv_z_bench_float_test.go
│ ├── gconv_z_bench_int_test.go
│ ├── gconv_z_bench_reflect_test.go
│ ├── gconv_z_bench_str_test.go
│ ├── gconv_z_bench_struct_test.go
│ ├── gconv_z_unit_bool_test.go
│ ├── gconv_z_unit_byte_test.go
│ ├── gconv_z_unit_convert_test.go
│ ├── gconv_z_unit_converter_test.go
│ ├── gconv_z_unit_custom_base_type_test.go
│ ├── gconv_z_unit_float_test.go
│ ├── gconv_z_unit_int_test.go
│ ├── gconv_z_unit_interfaces_test.go
│ ├── gconv_z_unit_issue_test.go
│ ├── gconv_z_unit_map_test.go
│ ├── gconv_z_unit_ptr_test.go
│ ├── gconv_z_unit_rune_test.go
│ ├── gconv_z_unit_scan_basic_types_test.go
│ ├── gconv_z_unit_scan_list_test.go
│ ├── gconv_z_unit_scan_test.go
│ ├── gconv_z_unit_string_test.go
│ ├── gconv_z_unit_struct_marshal_unmarshal_test.go
│ ├── gconv_z_unit_struct_test.go
│ ├── gconv_z_unit_test.go
│ ├── gconv_z_unit_time_test.go
│ ├── gconv_z_unit_uint_test.go
│ ├── gconv_z_unit_unsafe_test.go
│ └── internal
│ │ ├── converter
│ │ ├── converter.go
│ │ ├── converter_bool.go
│ │ ├── converter_builtin.go
│ │ ├── converter_bytes.go
│ │ ├── converter_convert.go
│ │ ├── converter_float.go
│ │ ├── converter_int.go
│ │ ├── converter_map.go
│ │ ├── converter_maptomap.go
│ │ ├── converter_maptomaps.go
│ │ ├── converter_rune.go
│ │ ├── converter_scan.go
│ │ ├── converter_slice_any.go
│ │ ├── converter_slice_float.go
│ │ ├── converter_slice_int.go
│ │ ├── converter_slice_map.go
│ │ ├── converter_slice_str.go
│ │ ├── converter_slice_uint.go
│ │ ├── converter_string.go
│ │ ├── converter_struct.go
│ │ ├── converter_structs.go
│ │ ├── converter_time.go
│ │ └── converter_uint.go
│ │ ├── localinterface
│ │ └── localinterface.go
│ │ └── structcache
│ │ ├── structcache.go
│ │ ├── structcache_cached.go
│ │ ├── structcache_cached_field_info.go
│ │ ├── structcache_cached_struct_info.go
│ │ └── structcache_pool.go
├── gmeta
│ ├── gmeta.go
│ ├── gmeta_z_bench_test.go
│ └── gmeta_z_unit_test.go
├── gmode
│ ├── gmode.go
│ └── gmode_z_unit_test.go
├── gpage
│ ├── gpage.go
│ └── gpage_z_unit_test.go
├── grand
│ ├── grand.go
│ ├── grand_buffer.go
│ ├── grand_z_bench_test.go
│ └── grand_z_unit_test.go
├── gtag
│ ├── gtag.go
│ ├── gtag_enums.go
│ ├── gtag_func.go
│ ├── gtag_z_example_test.go
│ └── gtag_z_unit_test.go
├── guid
│ ├── guid.go
│ ├── guid_z_bench_test.go
│ └── guid_z_unit_test.go
├── gutil
│ ├── gutil.go
│ ├── gutil_comparator.go
│ ├── gutil_copy.go
│ ├── gutil_default.go
│ ├── gutil_dump.go
│ ├── gutil_goroutine.go
│ ├── gutil_is.go
│ ├── gutil_list.go
│ ├── gutil_map.go
│ ├── gutil_reflect.go
│ ├── gutil_slice.go
│ ├── gutil_struct.go
│ ├── gutil_try_catch.go
│ ├── gutil_z_bench_test.go
│ ├── gutil_z_example_test.go
│ ├── gutil_z_unit_comparator_test.go
│ ├── gutil_z_unit_copy_test.go
│ ├── gutil_z_unit_dump_test.go
│ ├── gutil_z_unit_goroutine_test.go
│ ├── gutil_z_unit_is_test.go
│ ├── gutil_z_unit_list_test.go
│ ├── gutil_z_unit_map_test.go
│ ├── gutil_z_unit_reflect_test.go
│ ├── gutil_z_unit_slice_test.go
│ ├── gutil_z_unit_struct_test.go
│ └── gutil_z_unit_test.go
└── gvalid
│ ├── gvalid.go
│ ├── gvalid_error.go
│ ├── gvalid_register.go
│ ├── gvalid_validator.go
│ ├── gvalid_validator_check_map.go
│ ├── gvalid_validator_check_struct.go
│ ├── gvalid_validator_check_value.go
│ ├── gvalid_validator_message.go
│ ├── gvalid_z_example_feature_rule_test.go
│ ├── gvalid_z_example_test.go
│ ├── gvalid_z_unit_feature_checkmap_test.go
│ ├── gvalid_z_unit_feature_checkstruct_test.go
│ ├── gvalid_z_unit_feature_ci_test.go
│ ├── gvalid_z_unit_feature_custom_error_test.go
│ ├── gvalid_z_unit_feature_custom_rule_test.go
│ ├── gvalid_z_unit_feature_i18n_test.go
│ ├── gvalid_z_unit_feature_meta_test.go
│ ├── gvalid_z_unit_feature_recursive_test.go
│ ├── gvalid_z_unit_feature_rule_test.go
│ ├── gvalid_z_unit_internal_test.go
│ ├── gvalid_z_unit_issue_test.go
│ ├── internal
│ └── builtin
│ │ ├── builtin.go
│ │ ├── builtin_after.go
│ │ ├── builtin_after_equal.go
│ │ ├── builtin_array.go
│ │ ├── builtin_bail.go
│ │ ├── builtin_bank_card.go
│ │ ├── builtin_before.go
│ │ ├── builtin_before_equal.go
│ │ ├── builtin_between.go
│ │ ├── builtin_boolean.go
│ │ ├── builtin_ci.go
│ │ ├── builtin_date.go
│ │ ├── builtin_date_format.go
│ │ ├── builtin_datetime.go
│ │ ├── builtin_different.go
│ │ ├── builtin_domain.go
│ │ ├── builtin_email.go
│ │ ├── builtin_enums.go
│ │ ├── builtin_eq.go
│ │ ├── builtin_float.go
│ │ ├── builtin_foreach.go
│ │ ├── builtin_gt.go
│ │ ├── builtin_gte.go
│ │ ├── builtin_in.go
│ │ ├── builtin_integer.go
│ │ ├── builtin_ip.go
│ │ ├── builtin_ipv4.go
│ │ ├── builtin_ipv6.go
│ │ ├── builtin_json.go
│ │ ├── builtin_length.go
│ │ ├── builtin_lt.go
│ │ ├── builtin_lte.go
│ │ ├── builtin_mac.go
│ │ ├── builtin_max.go
│ │ ├── builtin_max_length.go
│ │ ├── builtin_min.go
│ │ ├── builtin_min_length.go
│ │ ├── builtin_not_eq.go
│ │ ├── builtin_not_in.go
│ │ ├── builtin_not_regex.go
│ │ ├── builtin_passport.go
│ │ ├── builtin_password.go
│ │ ├── builtin_password2.go
│ │ ├── builtin_password3.go
│ │ ├── builtin_phone.go
│ │ ├── builtin_phone_loose.go
│ │ ├── builtin_postcode.go
│ │ ├── builtin_qq.go
│ │ ├── builtin_regex.go
│ │ ├── builtin_required.go
│ │ ├── builtin_required_if.go
│ │ ├── builtin_required_if_all.go
│ │ ├── builtin_required_unless.go
│ │ ├── builtin_required_with.go
│ │ ├── builtin_required_with_all.go
│ │ ├── builtin_required_without.go
│ │ ├── builtin_required_without_all.go
│ │ ├── builtin_resident_id.go
│ │ ├── builtin_same.go
│ │ ├── builtin_size.go
│ │ ├── builtin_telephone.go
│ │ └── builtin_url.go
│ └── testdata
│ └── i18n
│ ├── cn
│ └── validation.toml
│ └── en
│ └── validation.toml
└── version.go
/.codecov.yml:
--------------------------------------------------------------------------------
1 | ignore:
2 | - "cmd" # ignore cmd folders and all its contents
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | *.js linguist-language=GO
2 | *.css linguist-language=GO
3 | *.html linguist-language=GO
--------------------------------------------------------------------------------
/.gitee/ISSUE_TEMPLATE:
--------------------------------------------------------------------------------
1 | <!-- 为高效处理您的疑问,如果觉得是BUG类问题,请您务必提供可复现该问题的最小可运行代码! -->
2 | <!-- 为高效处理您的疑问,如果觉得是BUG类问题,请您务必提供可复现该问题的最小可运行代码! -->
3 | <!-- 为高效处理您的疑问,如果觉得是BUG类问题,请您务必提供可复现该问题的最小可运行代码! -->
4 | <!-- 重要的事情说三遍! -->
5 |
6 | ### 1. 您当前使用的`Go`版本,及系统版本、系统架构?
7 |
8 | <!-- 使用 `go version` 命令查看,期望的结果如:`go 1.12, linux/amd64` -->
9 |
10 |
11 | ### 2. 您当前使用的`GoFrame`框架版本?
12 |
13 | <!-- 框架版本可以查看自己项目下的 `go.mod`,或者框架文件 `version.go` -->
14 |
15 |
16 | ### 3. 更新到最新的框架版本是否能够解决问题?
17 |
18 | <!-- 务必检查是否相同问题已在新版本中已修复 -->
19 |
20 |
21 | ### 4. 问题描述?
22 |
23 | <!--
24 | 请您尽可能地提供一份最短的,可复现问题的代码。
25 | 代码尽可能地完整,最好是可以直接编译运行。
26 | -->
27 |
28 |
29 |
30 | ### 5. 您期望得到的结果?
31 |
32 |
33 |
34 | ### 6. 您实际得到的结果?
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [gogf] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: # custom
13 |
--------------------------------------------------------------------------------
/.github/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gogf/gf/5fa656d1cc924999519dd16a6770a80f01c24ecf/.github/logo.png
--------------------------------------------------------------------------------
/.github/workflows/consul/client.json:
--------------------------------------------------------------------------------
1 | {
2 | "node_name": "consul-client",
3 | "data_dir": "/consul/data",
4 | "retry_join":[
5 | "consul-server"
6 | ]
7 | }
--------------------------------------------------------------------------------
/.github/workflows/consul/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.7'
2 |
3 | services:
4 |
5 | consul-server:
6 | image: consul:1.15
7 | container_name: consul-server
8 | restart: always
9 | volumes:
10 | - ./server.json:/consul/config/server.json:ro
11 | networks:
12 | - consul
13 | ports:
14 | - "8500:8500"
15 | - "8600:8600/tcp"
16 | - "8600:8600/udp"
17 | command: "agent"
18 |
19 | consul-client:
20 | image: consul:1.15
21 | container_name: consul-client
22 | restart: always
23 | volumes:
24 | - ./client.json:/consul/config/client.json:ro
25 | networks:
26 | - consul
27 | command: "agent"
28 |
29 | networks:
30 | consul:
31 | driver: bridge
--------------------------------------------------------------------------------
/.github/workflows/consul/server.json:
--------------------------------------------------------------------------------
1 | {
2 | "node_name": "consul-server",
3 | "server": true,
4 | "bootstrap" : true,
5 | "ui_config": {
6 | "enabled" : true
7 | },
8 | "data_dir": "/consul/data",
9 | "addresses": {
10 | "http" : "0.0.0.0"
11 | }
12 | }
--------------------------------------------------------------------------------
/.github/workflows/gitee-sync.yml:
--------------------------------------------------------------------------------
1 | on:
2 | push:
3 | branches:
4 | - master
5 | tags:
6 | - "*"
7 |
8 | name: Sync to Gitee
9 | jobs:
10 | run:
11 | name: Run
12 | runs-on: ubuntu-latest
13 | steps:
14 | - name: Checkout source code
15 | uses: actions/checkout@v4
16 | - name: Mirror GitHub to Gitee
17 | uses: Yikun/hub-mirror-action@v1.4
18 | with:
19 | src: github/gogf
20 | dst: gitee/johng
21 | dst_key: ${{ secrets.GITEE_PRIVATE_KEY }}
22 | dst_token: ${{ secrets.GITEE_TOKEN }}
23 | src_account_type: org
24 | dst_account_type: user
25 | timeout: 600
26 | debug: true
27 | force_update: true
28 | static_list: "gf"
--------------------------------------------------------------------------------
/.github/workflows/issue-close-inactive.yml:
--------------------------------------------------------------------------------
1 | # RULE DESCRIPTION: EXECUTED ONCE A DAY AT 4 A.M. (GMT+8) TO CLOSE NON-BUG ISSUES THAT HAVE NOT BEEN ACTIVE IN THE LAST 30 DAYS
2 | name: Issue Close Inactive
3 |
4 | on:
5 | schedule:
6 | - cron: "0 20 * * *"
7 |
8 | env: # Set environment variables
9 | TZ: Asia/Shanghai #Time zone (setting the time zone allows the 'Last Updated' on the page to use the time zone)
10 |
11 | jobs:
12 | close-issues:
13 | runs-on: ubuntu-latest
14 | steps:
15 | - name: need close
16 | uses: actions-cool/issues-helper@v3
17 | with:
18 | actions: "close-issues"
19 | # token: ${{ secrets.GF_TOKEN }}
20 | labels: 'inactive'
21 | inactive-day: 30
22 | exclude-labels: 'bug,$exclude-empty'
23 | close-reason: 'not active'
--------------------------------------------------------------------------------
/.github/workflows/issue-translator.yml:
--------------------------------------------------------------------------------
1 | # https://github.com/usthe/issues-translate-action
2 | name: 'Issue Translator'
3 | on:
4 | issue_comment:
5 | types: [created]
6 | issues:
7 | types: [opened]
8 |
9 | jobs:
10 | build:
11 | runs-on: ubuntu-latest
12 | steps:
13 | - uses: usthe/issues-translate-action@v2.7
14 | with:
15 | IS_MODIFY_TITLE: true
16 | # not require, default false. Decide whether to modify the issue title
17 | # if true, the robot account @Issues-translate-bot must have modification permissions,
18 | # invite @Issues-translate-bot to your project or use your custom bot.
19 | CUSTOM_BOT_NOTE: Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
--------------------------------------------------------------------------------
/.github/workflows/nacos/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.8"
2 |
3 | services:
4 | nacos:
5 | image: nacos/nacos-server:v2.1.2
6 | container_name: nacos
7 | env_file:
8 | - ./env/nacos.env
9 | ports:
10 | - "8848:8848"
11 | - "9848:9848"
12 | - "9555:9555"
13 | healthcheck:
14 | test: [ "CMD", "curl" ,"http://localhost:8848/nacos" ]
15 | interval: 5s
16 | timeout: 3s
17 | retries: 10
18 |
19 | initializer:
20 | image: alpine/curl:latest
21 | depends_on:
22 | nacos:
23 | condition: service_healthy
24 | command: [ "sh", "-c", "curl -X POST 'http://nacos:8848/nacos/v1/cs/configs?dataId=config.toml&group=test&content=%5Bserver%5D%0A%09address%3D%22%3A8000%22'" ]
25 |
--------------------------------------------------------------------------------
/.github/workflows/nacos/env/nacos.env:
--------------------------------------------------------------------------------
1 | PREFER_HOST_MODE=hostname
2 | MODE=standalone
3 |
--------------------------------------------------------------------------------
/.github/workflows/scripts/ci-sub.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | coverage=$1
4 |
5 | # find all path that contains go.mod.
6 | for file in `find . -name go.mod`; do
7 | dirpath=$(dirname $file)
8 | echo $dirpath
9 |
10 | # package kuhecm needs golang >= v1.19
11 | if [ "kubecm" = $(basename $dirpath) ]; then
12 | if ! go version|grep -qE "go1.[2-9][0-9]"; then
13 | echo "ignore kubecm as go version: $(go version)"
14 | continue 1
15 | fi
16 | else
17 | continue 1
18 | fi
19 |
20 | cd $dirpath
21 |
22 | go mod tidy
23 | go build ./...
24 | go test ./... -race || exit 1
25 |
26 | cd -
27 | done
28 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .buildpath
2 | .hgignore.swp
3 | .project
4 | .orig
5 | .swp
6 | .idea/
7 | .settings/
8 | .vscode/
9 | vendor/
10 | bin/
11 | **/.DS_Store
12 | .test/
13 | cmd/gf/main
14 | cmd/gf/gf
15 | temp/
16 | example/log
17 | go.work
18 | go.work.sum
19 | !cmd/gf/go.work
20 | .windsurfrules
21 |
22 | # Ignore for docs
23 | node_modules
24 | .docusaurus
25 | output
26 | .example/
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "examples"]
2 | path = examples
3 | url = git@github.com:gogf/examples.git
4 |
--------------------------------------------------------------------------------
/.make_tidy.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | workdir=.
4 | echo "Prepare to tidy all go.mod files in the ${workdir} directory"
5 |
6 | # check find command support or not
7 | output=$(find "${workdir}" -name go.mod 2>&1)
8 | if [[ $? -ne 0 ]]; then
9 | echo "Error: please use bash or zsh to run!"
10 | exit 1
11 | fi
12 |
13 | for file in `find ${workdir} -name go.mod`; do
14 | goModPath=$(dirname $file)
15 | echo ""
16 | echo "processing dir: $goModPath"
17 |
18 | if [[ $goModPath =~ "/testdata/" ]]; then
19 | echo "ignore testdata path $goModPath"
20 | continue 1
21 | fi
22 |
23 | if [[ $goModPath =~ "/examples/" ]]; then
24 | echo "ignore examples path $goModPath"
25 | continue 1
26 | fi
27 |
28 | cd $goModPath
29 | go mod tidy
30 | # Remove toolchain line if exists
31 | sed -i '' '/^toolchain/d' go.mod
32 | cd - > /dev/null
33 | done
34 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing
2 |
3 | Thanks for taking the time to join our community and start contributing!
4 |
5 | ## With issues
6 | - Use the search tool before opening a new issue.
7 | - Please provide source code and commit sha if you found a bug.
8 | - Review existing issues and provide feedback or react to them.
9 |
10 | ## With pull requests
11 | - Open your pull request against `master`
12 | - Your pull request should have no more than two commits, if not you should squash them.
13 | - It should pass all tests in the available continuous integrations systems such as GitHub CI.
14 | - You should add/modify tests to cover your proposed code changes.
15 | - If your pull request contains a new feature, please document it on the README.
16 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/cmd_gen_ctrl.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package cmd
8 |
9 | import (
10 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/genctrl"
11 | )
12 |
13 | type (
14 | cGenCtrl = genctrl.CGenCtrl
15 | )
16 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/cmd_gen_enums.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package cmd
8 |
9 | import (
10 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/genenums"
11 | )
12 |
13 | type (
14 | cGenEnums = genenums.CGenEnums
15 | )
16 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/cmd_gen_pb.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package cmd
8 |
9 | import "github.com/gogf/gf/cmd/gf/v2/internal/cmd/genpb"
10 |
11 | type (
12 | cGenPb = genpb.CGenPb
13 | )
14 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/cmd_gen_pbentity.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package cmd
8 |
9 | import "github.com/gogf/gf/cmd/gf/v2/internal/cmd/genpbentity"
10 |
11 | type (
12 | cGenPbEntity = genpbentity.CGenPbEntity
13 | )
14 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/cmd_gen_service.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package cmd
8 |
9 | import (
10 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/genservice"
11 | )
12 |
13 | type (
14 | cGenService = genservice.CGenService
15 | )
16 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/cmd_z_unit_fix_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package cmd
8 |
9 | import (
10 | "testing"
11 |
12 | "github.com/gogf/gf/v2/test/gtest"
13 | )
14 |
15 | func Test_Fix_doFixV25Content(t *testing.T) {
16 | gtest.C(t, func(t *gtest.T) {
17 | var (
18 | content = gtest.DataContent(`fix`, `fix25_content.go`)
19 | f = cFix{}
20 | )
21 | _, err := f.doFixV25Content(content)
22 | t.AssertNil(err)
23 | })
24 | }
25 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/build/multiple/multiple.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | func main() {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/build/single/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | func main() {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/build/varmap/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/gogf/gf/cmd/gf/cmd/gf/testdata/vardump/v2
2 |
3 | go 1.22
4 |
5 | require github.com/gogf/gf/v2 v2.8.2
6 |
7 | require (
8 | go.opentelemetry.io/otel v1.32.0 // indirect
9 | go.opentelemetry.io/otel/trace v1.32.0 // indirect
10 | )
11 |
12 | replace github.com/gogf/gf/v2 => ../../../../../../../
13 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/build/varmap/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 |
6 | "github.com/gogf/gf/v2/os/gbuild"
7 | )
8 |
9 | func main() {
10 | for k, v := range gbuild.Data() {
11 | fmt.Printf("%s: %v\n", k, v)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/fix/fix25_content.go:
--------------------------------------------------------------------------------
1 | package testdata
2 |
3 | import (
4 | "fmt"
5 | "testing"
6 | "time"
7 |
8 | "github.com/gogf/gf/v2/frame/g"
9 | "github.com/gogf/gf/v2/net/ghttp"
10 | "github.com/gogf/gf/v2/test/gtest"
11 | "github.com/gogf/gf/v2/util/guid"
12 | )
13 |
14 | func Test_Router_Hook_Multi(t *testing.T) {
15 | s := g.Server(guid.S())
16 | s.BindHandler("/multi-hook", func(r *ghttp.Request) {
17 | r.Response.Write("show")
18 | })
19 |
20 | s.BindHookHandlerByMap("/multi-hook", map[string]ghttp.HandlerFunc{
21 | ghttp.HookBeforeServe: func(r *ghttp.Request) {
22 | r.Response.Write("1")
23 | },
24 | })
25 | s.BindHookHandlerByMap("/multi-hook/{id}", map[string]ghttp.HandlerFunc{
26 | ghttp.HookBeforeServe: func(r *ghttp.Request) {
27 | r.Response.Write("2")
28 | },
29 | })
30 | }
31 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/dict_add_new_ctrl_expect.gotest:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // =================================================================================
4 |
5 | package dict
6 |
7 | import (
8 | "context"
9 |
10 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/v1"
11 | )
12 |
13 | type IDictV1 interface {
14 | DictTypeAddPage(ctx context.Context, req *v1.DictTypeAddPageReq) (res *v1.DictTypeAddPageRes, err error)
15 | DictTypeAdd(ctx context.Context, req *v1.DictTypeAddReq) (res *v1.DictTypeAddRes, err error)
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/dict_expect.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // =================================================================================
4 |
5 | package dict
6 |
7 | import (
8 | "context"
9 |
10 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/v1"
11 | )
12 |
13 | type IDictV1 interface {
14 | DictTypeAddPage(ctx context.Context, req *v1.DictTypeAddPageReq) (res *v1.DictTypeAddPageRes, err error)
15 | }
16 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/v1/dict_type.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package v1
8 |
9 | import "github.com/gogf/gf/v2/frame/g"
10 |
11 | type DictTypeAddPageReq struct {
12 | g.Meta `path:"/dict/type/add" tags:"字典管理" method:"get" summary:"字典类型添加页面"`
13 | }
14 |
15 | type DictTypeAddPageRes struct {
16 | g.Meta `mime:"text/html" type:"string" example:"<html/>"`
17 | }
18 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
3 | // =================================================================================
4 |
5 | package dict
6 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict_new.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
3 | // =================================================================================
4 |
5 | package dict
6 |
7 | import (
8 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict"
9 | )
10 |
11 | type ControllerV1 struct{}
12 |
13 | func NewV1() dict.IDictV1 {
14 | return &ControllerV1{}
15 | }
16 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict_v1_dict_type.go:
--------------------------------------------------------------------------------
1 | package dict
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/gogf/gf/v2/errors/gcode"
7 | "github.com/gogf/gf/v2/errors/gerror"
8 |
9 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/v1"
10 | )
11 |
12 | func (c *ControllerV1) DictTypeAddPage(ctx context.Context, req *v1.DictTypeAddPageReq) (res *v1.DictTypeAddPageRes, err error) {
13 | return nil, gerror.NewCode(gcode.CodeNotImplemented)
14 | }
15 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict_v1_test_new.gotest:
--------------------------------------------------------------------------------
1 | package dict
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/gogf/gf/v2/errors/gcode"
7 | "github.com/gogf/gf/v2/errors/gerror"
8 |
9 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/v1"
10 | )
11 |
12 | func (c *ControllerV1) DictTypeAddPage(ctx context.Context, req *v1.DictTypeAddPageReq) (res *v1.DictTypeAddPageRes, err error) {
13 | return nil, gerror.NewCode(gcode.CodeNotImplemented)
14 | }
15 | func (c *ControllerV1) DictTypeAdd(ctx context.Context, req *v1.DictTypeAddReq) (res *v1.DictTypeAddRes, err error) {
16 | return nil, gerror.NewCode(gcode.CodeNotImplemented)
17 | }
18 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/dict_add_new_ctrl_expect.gotest:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // =================================================================================
4 |
5 | package dict
6 |
7 | import (
8 | "context"
9 |
10 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/v1"
11 | )
12 |
13 | type IDictV1 interface {
14 | DictTypeAddPage(ctx context.Context, req *v1.DictTypeAddPageReq) (res *v1.DictTypeAddPageRes, err error)
15 | DictTypeAdd(ctx context.Context, req *v1.DictTypeAddReq) (res *v1.DictTypeAddRes, err error)
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/dict_expect.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // =================================================================================
4 |
5 | package dict
6 |
7 | import (
8 | "context"
9 |
10 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/v1"
11 | )
12 |
13 | type IDictV1 interface {
14 | DictTypeAddPage(ctx context.Context, req *v1.DictTypeAddPageReq) (res *v1.DictTypeAddPageRes, err error)
15 | }
16 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/v1/dict_type.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package v1
8 |
9 | import "github.com/gogf/gf/v2/frame/g"
10 |
11 | type DictTypeAddPageReq struct {
12 | g.Meta `path:"/dict/type/add" tags:"字典管理" method:"get" summary:"字典类型添加页面"`
13 | }
14 |
15 | type DictTypeAddPageRes struct {
16 | g.Meta `mime:"text/html" type:"string" example:"<html/>"`
17 | }
18 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
3 | // =================================================================================
4 |
5 | package dict
6 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict_new.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
3 | // =================================================================================
4 |
5 | package dict
6 |
7 | import (
8 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict"
9 | )
10 |
11 | type ControllerV1 struct{}
12 |
13 | func NewV1() dict.IDictV1 {
14 | return &ControllerV1{}
15 | }
16 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict_v1_dict_type.go:
--------------------------------------------------------------------------------
1 | package dict
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/gogf/gf/v2/errors/gcode"
7 | "github.com/gogf/gf/v2/errors/gerror"
8 |
9 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/v1"
10 | )
11 |
12 | func (c *ControllerV1) DictTypeAddPage(ctx context.Context, req *v1.DictTypeAddPageReq) (res *v1.DictTypeAddPageRes, err error) {
13 | return nil, gerror.NewCode(gcode.CodeNotImplemented)
14 | }
15 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict_v1_test_new.gotest:
--------------------------------------------------------------------------------
1 | package dict
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/gogf/gf/v2/errors/gcode"
7 | "github.com/gogf/gf/v2/errors/gerror"
8 |
9 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/v1"
10 | )
11 |
12 | func (c *ControllerV1) DictTypeAdd(ctx context.Context, req *v1.DictTypeAddReq) (res *v1.DictTypeAddRes, err error) {
13 | return nil, gerror.NewCode(gcode.CodeNotImplemented)
14 | }
15 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl/api/article/v1/edit.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package v1
8 |
9 | import "github.com/gogf/gf/v2/frame/g"
10 |
11 | type (
12 | // CreateReq add title.
13 | CreateReq struct {
14 | g.Meta `path:"/article/create" method:"post" tags:"ArticleService"`
15 | Title string `v:"required"`
16 | }
17 |
18 | CreateRes struct{}
19 | )
20 |
21 | type (
22 | UpdateReq struct {
23 | g.Meta `path:"/article/update" method:"post" tags:"ArticleService"`
24 | Title string `v:"required"`
25 | }
26 |
27 | UpdateRes struct{}
28 | )
29 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl/api/article/v1/get.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package v1
8 |
9 | import "github.com/gogf/gf/v2/frame/g"
10 |
11 | type GetListReq struct {
12 | g.Meta `path:"/article/list" method:"get" tags:"ArticleService"`
13 | }
14 |
15 | type GetListRes struct {
16 | list []struct{}
17 | }
18 |
19 | type GetOneReq struct {
20 | g.Meta `path:"/article/one" method:"get" tags:"ArticleService"`
21 | }
22 |
23 | type GetOneRes struct {
24 | one struct{}
25 | }
26 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl/controller/article/article.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
3 | // =================================================================================
4 |
5 | package article
6 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl/controller/article/article_new.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
3 | // =================================================================================
4 |
5 | package article
6 |
7 | import (
8 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl/api/article"
9 | )
10 |
11 | type ControllerV1 struct{}
12 |
13 | func NewV1() article.IArticleV1 {
14 | return &ControllerV1{}
15 | }
16 |
17 | type ControllerV2 struct{}
18 |
19 | func NewV2() article.IArticleV2 {
20 | return &ControllerV2{}
21 | }
22 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl/controller/article/article_v1_create.go:
--------------------------------------------------------------------------------
1 | package article
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/gogf/gf/v2/errors/gcode"
7 | "github.com/gogf/gf/v2/errors/gerror"
8 |
9 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl/api/article/v1"
10 | )
11 |
12 | // Create add title.
13 | func (c *ControllerV1) Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error) {
14 | return nil, gerror.NewCode(gcode.CodeNotImplemented)
15 | }
16 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl/controller/article/article_v1_get_list.go:
--------------------------------------------------------------------------------
1 | package article
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/gogf/gf/v2/errors/gcode"
7 | "github.com/gogf/gf/v2/errors/gerror"
8 |
9 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl/api/article/v1"
10 | )
11 |
12 | func (c *ControllerV1) GetList(ctx context.Context, req *v1.GetListReq) (res *v1.GetListRes, err error) {
13 | return nil, gerror.NewCode(gcode.CodeNotImplemented)
14 | }
15 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl/controller/article/article_v1_get_one.go:
--------------------------------------------------------------------------------
1 | package article
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/gogf/gf/v2/errors/gcode"
7 | "github.com/gogf/gf/v2/errors/gerror"
8 |
9 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl/api/article/v1"
10 | )
11 |
12 | func (c *ControllerV1) GetOne(ctx context.Context, req *v1.GetOneReq) (res *v1.GetOneRes, err error) {
13 | return nil, gerror.NewCode(gcode.CodeNotImplemented)
14 | }
15 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl/controller/article/article_v1_update.go:
--------------------------------------------------------------------------------
1 | package article
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/gogf/gf/v2/errors/gcode"
7 | "github.com/gogf/gf/v2/errors/gerror"
8 |
9 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl/api/article/v1"
10 | )
11 |
12 | func (c *ControllerV1) Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error) {
13 | return nil, gerror.NewCode(gcode.CodeNotImplemented)
14 | }
15 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl/controller/article/article_v2_create.go:
--------------------------------------------------------------------------------
1 | package article
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/gogf/gf/v2/errors/gcode"
7 | "github.com/gogf/gf/v2/errors/gerror"
8 |
9 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl/api/article/v2"
10 | )
11 |
12 | func (c *ControllerV2) Create(ctx context.Context, req *v2.CreateReq) (res *v2.CreateRes, err error) {
13 | return nil, gerror.NewCode(gcode.CodeNotImplemented)
14 | }
15 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genctrl/controller/article/article_v2_update.go:
--------------------------------------------------------------------------------
1 | package article
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/gogf/gf/v2/errors/gcode"
7 | "github.com/gogf/gf/v2/errors/gerror"
8 |
9 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genctrl/api/article/v2"
10 | )
11 |
12 | func (c *ControllerV2) Update(ctx context.Context, req *v2.UpdateReq) (res *v2.UpdateRes, err error) {
13 | return nil, gerror.NewCode(gcode.CodeNotImplemented)
14 | }
15 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/gendao/generated_user/dao/table_user.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
3 | // =================================================================================
4 |
5 | package dao
6 |
7 | import (
8 | "for-gendao-test/pkg/dao/internal"
9 | )
10 |
11 | // tableUserDao is the data access object for the table table_user.
12 | // You can define custom methods on it to extend its functionality as needed.
13 | type tableUserDao struct {
14 | *internal.TableUserDao
15 | }
16 |
17 | var (
18 | // TableUser is a globally accessible object for table table_user operations.
19 | TableUser = tableUserDao{internal.NewTableUserDao()}
20 | )
21 |
22 | // Add your custom methods and functionality below.
23 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/gendao/generated_user/model/do/table_user.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // =================================================================================
4 |
5 | package do
6 |
7 | import (
8 | "github.com/gogf/gf/v2/frame/g"
9 | "github.com/gogf/gf/v2/os/gtime"
10 | )
11 |
12 | // TableUser is the golang structure of table table_user for DAO operations like Where/Data.
13 | type TableUser struct {
14 | g.Meta `orm:"table:table_user, do:true"`
15 | Id interface{} // User ID
16 | Passport interface{} // User Passport
17 | Password interface{} // User Password
18 | Nickname interface{} // User Nickname
19 | Score interface{} // Total score amount.
20 | CreateAt *gtime.Time // Created Time
21 | UpdateAt *gtime.Time // Updated Time
22 | }
23 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/table_user.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
3 | // =================================================================================
4 |
5 | package dao
6 |
7 | import (
8 | "for-gendao-test/pkg/dao/internal"
9 | )
10 |
11 | // tableUserDao is the data access object for the table table_user.
12 | // You can define custom methods on it to extend its functionality as needed.
13 | type tableUserDao struct {
14 | *internal.TableUserDao
15 | }
16 |
17 | var (
18 | // TableUser is a globally accessible object for table table_user operations.
19 | TableUser = tableUserDao{internal.NewTableUserDao()}
20 | )
21 |
22 | // Add your custom methods and functionality below.
23 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/gendao/generated_user_sqlite3/dao/table_user.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
3 | // =================================================================================
4 |
5 | package dao
6 |
7 | import (
8 | "for-gendao-test/pkg/dao/internal"
9 | )
10 |
11 | // tableUserDao is the data access object for the table table_user.
12 | // You can define custom methods on it to extend its functionality as needed.
13 | type tableUserDao struct {
14 | *internal.TableUserDao
15 | }
16 |
17 | var (
18 | // TableUser is a globally accessible object for table table_user operations.
19 | TableUser = tableUserDao{internal.NewTableUserDao()}
20 | )
21 |
22 | // Add your custom methods and functionality below.
23 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/gendao/generated_user_sqlite3/model/do/table_user.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // =================================================================================
4 |
5 | package do
6 |
7 | import (
8 | "github.com/gogf/gf/v2/frame/g"
9 | "github.com/gogf/gf/v2/os/gtime"
10 | )
11 |
12 | // TableUser is the golang structure of table table_user for DAO operations like Where/Data.
13 | type TableUser struct {
14 | g.Meta `orm:"table:table_user, do:true"`
15 | Id interface{} //
16 | Passport interface{} //
17 | Password interface{} //
18 | Nickname interface{} //
19 | CreatedAt *gtime.Time //
20 | UpdatedAt *gtime.Time //
21 | }
22 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/gendao/generated_user_sqlite3/model/entity/table_user.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // =================================================================================
4 |
5 | package entity
6 |
7 | import (
8 | "github.com/gogf/gf/v2/os/gtime"
9 | )
10 |
11 | // TableUser is the golang structure for table table_user.
12 | type TableUser struct {
13 | Id int `json:"id" orm:"id" ` //
14 | Passport string `json:"passport" orm:"passport" ` //
15 | Password string `json:"password" orm:"password" ` //
16 | Nickname string `json:"nickname" orm:"nickname" ` //
17 | CreatedAt *gtime.Time `json:"createdAt" orm:"created_at" ` //
18 | UpdatedAt *gtime.Time `json:"updatedAt" orm:"updated_at" ` //
19 | }
20 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/table_user.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
3 | // =================================================================================
4 |
5 | package dao
6 |
7 | import (
8 | "for-gendao-test/pkg/dao/internal"
9 | )
10 |
11 | // tableUserDao is the data access object for the table table_user.
12 | // You can define custom methods on it to extend its functionality as needed.
13 | type tableUserDao struct {
14 | *internal.TableUserDao
15 | }
16 |
17 | var (
18 | // TableUser is a globally accessible object for table table_user operations.
19 | TableUser = tableUserDao{internal.NewTableUserDao()}
20 | )
21 |
22 | // Add your custom methods and functionality below.
23 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/gendao/sqlite3/user.sqlite3.sql:
--------------------------------------------------------------------------------
1 | create table `%s`(
2 | id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE,
3 | passport VARCHAR(45) NOT NULL DEFAULT passport,
4 | password VARCHAR(128) NOT NULL DEFAULT password,
5 | nickname VARCHAR(45),
6 | created_at TIMESTAMP,
7 | updated_at TIMESTAMP
8 | )
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/gendao/user.tpl.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `%s` (
2 | `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID',
3 | `passport` varchar(45) NOT NULL COMMENT 'User Passport',
4 | `password` varchar(45) NOT NULL COMMENT 'User Password',
5 | `nickname` varchar(45) NOT NULL COMMENT 'User Nickname',
6 | `score` decimal(10,2) unsigned DEFAULT NULL COMMENT 'Total score amount.',
7 | `create_at` datetime DEFAULT NULL COMMENT 'Created Time',
8 | `update_at` datetime DEFAULT NULL COMMENT 'Updated Time',
9 | PRIMARY KEY (`id`)
10 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
11 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genpbentity/generated/table_user.proto:
--------------------------------------------------------------------------------
1 | // ==========================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // ==========================================================================
4 |
5 | syntax = "proto3";
6 |
7 | package unittest;
8 |
9 | option go_package = "unittest";
10 |
11 | import "google/protobuf/timestamp.proto";
12 |
13 | message TableUser {
14 | uint32 Id = 1; // User ID
15 | string Passport = 2; // User Passport
16 | string Password = 3; // User Password
17 | string Nickname = 4; // User Nickname
18 | string Score = 5; // Total score amount.
19 | google.protobuf.Timestamp CreateAt = 6; // Created Time
20 | google.protobuf.Timestamp UpdateAt = 7; // Updated Time
21 | }
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genpbentity/user.tpl.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `%s` (
2 | `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID',
3 | `passport` varchar(45) NOT NULL COMMENT 'User Passport',
4 | `password` varchar(45) NOT NULL COMMENT 'User Password',
5 | `nickname` varchar(45) NOT NULL COMMENT 'User Nickname',
6 | `score` decimal(10,2) unsigned DEFAULT NULL COMMENT 'Total score amount.',
7 | `create_at` datetime DEFAULT NULL COMMENT 'Created Time',
8 | `update_at` datetime DEFAULT NULL COMMENT 'Updated Time',
9 | PRIMARY KEY (`id`)
10 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
11 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genservice/logic/base/base.go:
--------------------------------------------------------------------------------
1 | package base
2 |
3 | type Base = sBase
4 |
5 | type sBase struct {
6 | baseDestory `gen:"extend"`
7 | }
8 |
9 | // sBase Init
10 | func (*sBase) Init() {
11 |
12 | }
13 |
14 | // sBase Destory
15 | func (*sBase) Destory() {
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genservice/logic/base/base_destory.go:
--------------------------------------------------------------------------------
1 | package base
2 |
3 | type baseDestory struct{}
4 |
5 | // baseDestory Destory
6 | func (baseDestory) Destory() {
7 |
8 | }
9 |
10 | // baseDestory BeforeDestory
11 | func (baseDestory) BeforeDestory() {
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genservice/logic/base/sub/sub.go:
--------------------------------------------------------------------------------
1 | package sub
2 |
3 | type SubBase struct {
4 | }
5 |
6 | // subbase init
7 | func (*SubBase) Init() {
8 |
9 | }
10 |
11 | // subbase GetSubBase
12 | func (*SubBase) GetSubBase() {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genservice/logic/logic_expect.go:
--------------------------------------------------------------------------------
1 | // ==========================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // ==========================================================================
4 |
5 | package logic
6 |
7 | import (
8 | _ "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genservice/logic/article"
9 | _ "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genservice/logic/base"
10 | _ "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genservice/logic/delivery"
11 | _ "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genservice/logic/user"
12 | )
13 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genservice/logic/user/supper_vip_user.go:
--------------------------------------------------------------------------------
1 | package user
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genservice/service"
7 | )
8 |
9 | func init() {
10 | service.RegisterSuperVipUser(&sSuperVipUser{
11 | sVipUser: &sVipUser{},
12 | })
13 | }
14 |
15 | type sSuperVipUser struct {
16 | *sVipUser `gen:"extend"`
17 | }
18 |
19 | // Get supper vip user level
20 | func (s sSuperVipUser) GetVipLevel(ctx context.Context) (vipLevel int, err error) {
21 | return 1, nil
22 | }
23 |
24 | // Set supper vip user level
25 | func (s *sSuperVipUser) SetVipLevel(ctx context.Context, id int, vipLevel int) (err error) {
26 | return nil
27 | }
28 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genservice/logic/user/vip_user.go:
--------------------------------------------------------------------------------
1 | package user
2 |
3 | import (
4 | "context"
5 |
6 | bbb "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genservice/logic/base"
7 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/genservice/service"
8 | )
9 |
10 | func init() {
11 | service.RegisterVipUser(&sVipUser{})
12 | }
13 |
14 | type mybase = bbb.Base
15 |
16 | type sVipUser struct {
17 | sUser `gen:"extend"`
18 | mybase `gen:"extend"`
19 | }
20 |
21 | // Create creates a new vip user.
22 | func (s *sVipUser) Create(ctx context.Context, name string, vipLevel int) (id int, err error) {
23 | return 0, nil
24 | }
25 |
26 | // Get vip user level
27 | func (s *sVipUser) GetVipLevel() (vipLevel int, err error) {
28 | return 1, nil
29 | }
30 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/genservice/service/base.go:
--------------------------------------------------------------------------------
1 | // ================================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // You can delete these comments if you wish manually maintain this interface file.
4 | // ================================================================================
5 |
6 | package service
7 |
8 | type (
9 | IBase interface {
10 | // sBase Init
11 | Init()
12 | // sBase Destory
13 | Destory()
14 | // baseDestory BeforeDestory
15 | BeforeDestory()
16 | }
17 | )
18 |
19 | var (
20 | localBase IBase
21 | )
22 |
23 | func Base() IBase {
24 | if localBase == nil {
25 | panic("implement not found for interface IBase, forgot register?")
26 | }
27 | return localBase
28 | }
29 |
30 | func RegisterBase(i IBase) {
31 | localBase = i
32 | }
33 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/2572/config.yaml:
--------------------------------------------------------------------------------
1 | gfcli:
2 | gen:
3 | dao:
4 | - link: "mysql:root:12345678@tcp(127.0.0.1:3306)/test"
5 | tables: "user1"
6 | descriptionTag: true
7 | noModelComment: true
8 | group: "sys"
9 | clear: true
10 | overwriteDao: true
11 | - link: "mysql:root:12345678@tcp(127.0.0.1:3306)/test"
12 | tables: "user2"
13 | descriptionTag: true
14 | noModelComment: true
15 | group: "book"
16 | clear: true
17 | overwriteDao: true
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/2572/model/do/user_3.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // =================================================================================
4 |
5 | package do
6 |
7 | import (
8 | "github.com/gogf/gf/v2/frame/g"
9 | "github.com/gogf/gf/v2/os/gtime"
10 | )
11 |
12 | // User1 is the golang structure of table user1 for DAO operations like Where/Data.
13 | type User1 struct {
14 | g.Meta `orm:"table:user1, do:true"`
15 | Id interface{} // User ID
16 | Passport interface{} // User Passport
17 | Password interface{} // User Password
18 | Nickname interface{} // User Nickname
19 | Score interface{} // Total score amount.
20 | CreateAt *gtime.Time // Created Time
21 | UpdateAt *gtime.Time // Updated Time
22 | }
23 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/2572/model/do/user_4.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // =================================================================================
4 |
5 | package do
6 |
7 | import (
8 | "github.com/gogf/gf/v2/frame/g"
9 | "github.com/gogf/gf/v2/os/gtime"
10 | )
11 |
12 | // User2 is the golang structure of table user2 for DAO operations like Where/Data.
13 | type User2 struct {
14 | g.Meta `orm:"table:user2, do:true"`
15 | Id interface{} // User ID
16 | Passport interface{} // User Passport
17 | Password interface{} // User Password
18 | Nickname interface{} // User Nickname
19 | Score interface{} // Total score amount.
20 | CreateAt *gtime.Time // Created Time
21 | UpdateAt *gtime.Time // Updated Time
22 | }
23 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/2572/sql1.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `user1` (
2 | `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID',
3 | `passport` varchar(45) NOT NULL COMMENT 'User Passport',
4 | `password` varchar(45) NOT NULL COMMENT 'User Password',
5 | `nickname` varchar(45) NOT NULL COMMENT 'User Nickname',
6 | `score` decimal(10,2) unsigned DEFAULT NULL COMMENT 'Total score amount.',
7 | `create_at` datetime DEFAULT NULL COMMENT 'Created Time',
8 | `update_at` datetime DEFAULT NULL COMMENT 'Updated Time',
9 | PRIMARY KEY (`id`)
10 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
11 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/2572/sql2.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `user2` (
2 | `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID',
3 | `passport` varchar(45) NOT NULL COMMENT 'User Passport',
4 | `password` varchar(45) NOT NULL COMMENT 'User Password',
5 | `nickname` varchar(45) NOT NULL COMMENT 'User Nickname',
6 | `score` decimal(10,2) unsigned DEFAULT NULL COMMENT 'Total score amount.',
7 | `create_at` datetime DEFAULT NULL COMMENT 'Created Time',
8 | `update_at` datetime DEFAULT NULL COMMENT 'Updated Time',
9 | PRIMARY KEY (`id`)
10 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
11 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/2616/config.yaml:
--------------------------------------------------------------------------------
1 | gfcli:
2 | gen:
3 | dao:
4 | - link: "mysql:root:12345678@tcp(127.0.0.1:3306)/test"
5 | tables: "user1"
6 | descriptionTag: true
7 | noModelComment: true
8 | group: "sys"
9 | clear: true
10 | overwriteDao: false
11 | - link: "mysql:root:12345678@tcp(127.0.0.1:3306)/test"
12 | tables: "user2"
13 | descriptionTag: true
14 | noModelComment: true
15 | group: "book"
16 | clear: true
17 | overwriteDao: true
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/2616/model/do/user_3.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // =================================================================================
4 |
5 | package do
6 |
7 | import (
8 | "github.com/gogf/gf/v2/frame/g"
9 | "github.com/gogf/gf/v2/os/gtime"
10 | )
11 |
12 | // User1 is the golang structure of table user1 for DAO operations like Where/Data.
13 | type User1 struct {
14 | g.Meta `orm:"table:user1, do:true"`
15 | Id interface{} // User ID
16 | Passport interface{} // User Passport
17 | Password interface{} // User Password
18 | Nickname interface{} // User Nickname
19 | Score interface{} // Total score amount.
20 | CreateAt *gtime.Time // Created Time
21 | UpdateAt *gtime.Time // Updated Time
22 | }
23 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/2616/model/do/user_4.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // =================================================================================
4 |
5 | package do
6 |
7 | import (
8 | "github.com/gogf/gf/v2/frame/g"
9 | "github.com/gogf/gf/v2/os/gtime"
10 | )
11 |
12 | // User2 is the golang structure of table user2 for DAO operations like Where/Data.
13 | type User2 struct {
14 | g.Meta `orm:"table:user2, do:true"`
15 | Id interface{} // User ID
16 | Passport interface{} // User Passport
17 | Password interface{} // User Password
18 | Nickname interface{} // User Nickname
19 | Score interface{} // Total score amount.
20 | CreateAt *gtime.Time // Created Time
21 | UpdateAt *gtime.Time // Updated Time
22 | }
23 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/2616/sql1.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `user1` (
2 | `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID',
3 | `passport` varchar(45) NOT NULL COMMENT 'User Passport',
4 | `password` varchar(45) NOT NULL COMMENT 'User Password',
5 | `nickname` varchar(45) NOT NULL COMMENT 'User Nickname',
6 | `score` decimal(10,2) unsigned DEFAULT NULL COMMENT 'Total score amount.',
7 | `create_at` datetime DEFAULT NULL COMMENT 'Created Time',
8 | `update_at` datetime DEFAULT NULL COMMENT 'Updated Time',
9 | PRIMARY KEY (`id`)
10 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
11 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/2616/sql2.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `user2` (
2 | `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID',
3 | `passport` varchar(45) NOT NULL COMMENT 'User Passport',
4 | `password` varchar(45) NOT NULL COMMENT 'User Password',
5 | `nickname` varchar(45) NOT NULL COMMENT 'User Nickname',
6 | `score` decimal(10,2) unsigned DEFAULT NULL COMMENT 'Total score amount.',
7 | `create_at` datetime DEFAULT NULL COMMENT 'Created Time',
8 | `update_at` datetime DEFAULT NULL COMMENT 'Updated Time',
9 | PRIMARY KEY (`id`)
10 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
11 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/2746/issue_2746.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // =================================================================================
4 |
5 | package entity
6 |
7 | import (
8 | "github.com/gogf/gf/v2/encoding/gjson"
9 | )
10 |
11 | // Issue2746 is the golang structure for table issue2746.
12 | type Issue2746 struct {
13 | Id uint `json:"ID" orm:"id" ` // User ID
14 | Nickname string `json:"NICKNAME" orm:"nickname" ` // User Nickname
15 | Tag *gjson.Json `json:"TAG" orm:"tag" ` //
16 | Info string `json:"INFO" orm:"info" ` //
17 | Tag2 *gjson.Json `json:"TAG_2" orm:"tag2" ` // Tag2
18 | }
19 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/2746/sql.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE %s (
2 | `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID',
3 | `nickname` varchar(45) NOT NULL COMMENT 'User Nickname',
4 | `tag` json NOT NULL,
5 | `info` longtext DEFAULT NULL,
6 | `tag2` json COMMENT 'Tag2',
7 | PRIMARY KEY (`id`)
8 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
9 |
10 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/3328/logic/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gogf/gf/5fa656d1cc924999519dd16a6770a80f01c24ecf/cmd/gf/internal/cmd/testdata/issue/3328/logic/.gitkeep
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/3459/config.yaml:
--------------------------------------------------------------------------------
1 | gfcli:
2 | gen:
3 | dao:
4 | - link: "pgsql:postgres:postgres@tcp(127.0.0.1:5432)/postgres"
5 | tablesEx: "ex_table1,ex_table2"
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
3 | // =================================================================================
4 |
5 | package hello
6 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/3460/controller/hello/hello_new.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
3 | // =================================================================================
4 |
5 | package hello
6 |
7 | import (
8 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/issue/3460/api/hello"
9 | )
10 |
11 | type ControllerV1 struct{}
12 |
13 | func NewV1() hello.IHelloV1 {
14 | return &ControllerV1{}
15 | }
16 |
17 | type ControllerV2 struct{}
18 |
19 | func NewV2() hello.IHelloV2 {
20 | return &ControllerV2{}
21 | }
22 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/3685/user.tpl.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `%s` (
2 | `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID',
3 | `passport` varchar(45) NOT NULL COMMENT 'User Passport',
4 | `password` varchar(45) NOT NULL COMMENT 'User Password',
5 | `nickname` varchar(45) NOT NULL COMMENT 'User Nickname',
6 | `score` decimal(10,2) unsigned DEFAULT NULL COMMENT 'Total score amount.',
7 | `data` json DEFAULT NULL COMMENT 'User Data',
8 | `create_at` datetime DEFAULT NULL COMMENT 'Created Time',
9 | `update_at` datetime DEFAULT NULL COMMENT 'Updated Time',
10 | PRIMARY KEY (`id`)
11 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/3749/dao/table_user.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // This file is auto-generated by the GoFrame CLI tool. You may modify it as needed.
3 | // =================================================================================
4 |
5 | package dao
6 |
7 | import (
8 | "for-gendao-test/pkg/dao/internal"
9 | )
10 |
11 | // tableUserDao is the data access object for the table table_user.
12 | // You can define custom methods on it to extend its functionality as needed.
13 | type tableUserDao struct {
14 | *internal.TableUserDao
15 | }
16 |
17 | var (
18 | // TableUser is a globally accessible object for table table_user operations.
19 | TableUser = tableUserDao{internal.NewTableUserDao()}
20 | )
21 |
22 | // Add your custom methods and functionality below.
23 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/3749/model/do/table_user.go:
--------------------------------------------------------------------------------
1 | // =================================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // =================================================================================
4 |
5 | package do
6 |
7 | import (
8 | "github.com/gogf/gf/v2/frame/g"
9 | "github.com/gogf/gf/v2/os/gtime"
10 | )
11 |
12 | // TableUser is the golang structure of table table_user for DAO operations like Where/Data.
13 | type TableUser struct {
14 | g.Meta `orm:"table:table_user, do:true"`
15 | Id interface{} // User ID
16 | ParentId interface{} //
17 | Passport interface{} // User Passport
18 | PassWord interface{} // User Password
19 | Nickname2 interface{} // User Nickname
20 | CreateAt *gtime.Time // Created Time
21 | UpdateAt *gtime.Time // Updated Time
22 | }
23 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/3749/user.tpl.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `%s` (
2 | `Id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID',
3 | `parentId` varchar(45) NOT NULL COMMENT '',
4 | `PASSPORT` varchar(45) NOT NULL COMMENT 'User Passport',
5 | `PASS_WORD` varchar(45) NOT NULL COMMENT 'User Password',
6 | `NICKNAME2` varchar(45) NOT NULL COMMENT 'User Nickname',
7 | `create_at` datetime DEFAULT NULL COMMENT 'Created Time',
8 | `update_at` datetime DEFAULT NULL COMMENT 'Updated Time',
9 | PRIMARY KEY (`id`)
10 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
11 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/3835/logic/issue3835/issue3835.go:
--------------------------------------------------------------------------------
1 | package issue3835
2 |
3 | import (
4 | "context"
5 |
6 | "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/issue/3835/service"
7 |
8 | "github.com/gogf/gf/contrib/drivers/mysql/v2"
9 | )
10 |
11 | func init() {
12 | service.RegisterItest(New())
13 | }
14 |
15 | type sItest struct {
16 | }
17 |
18 | func New() *sItest {
19 | return &sItest{}
20 | }
21 |
22 | func (s *sItest) F(ctx context.Context) (d mysql.Driver, err error) {
23 | return mysql.Driver{}, nil
24 | }
25 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/3835/logic/logic.go:
--------------------------------------------------------------------------------
1 | // ==========================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // ==========================================================================
4 |
5 | package logic
6 |
7 | import (
8 | _ "github.com/gogf/gf/cmd/gf/v2/internal/cmd/testdata/issue/3835/logic/issue3835"
9 | )
10 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/3835/service/issue_3835.go:
--------------------------------------------------------------------------------
1 | // ================================================================================
2 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
3 | // You can delete these comments if you wish manually maintain this interface file.
4 | // ================================================================================
5 |
6 | package service
7 |
8 | import (
9 | "context"
10 |
11 | "github.com/gogf/gf/contrib/drivers/mysql/v2"
12 | )
13 |
14 | type (
15 | IItest interface {
16 | F(ctx context.Context) (d mysql.Driver, err error)
17 | }
18 | )
19 |
20 | var (
21 | localItest IItest
22 | )
23 |
24 | func Itest() IItest {
25 | if localItest == nil {
26 | panic("implement not found for interface IItest, forgot register?")
27 | }
28 | return localItest
29 | }
30 |
31 | func RegisterItest(i IItest) {
32 | localItest = i
33 | }
34 |
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/3882/issue3882.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 |
3 | package test;
4 |
5 | option go_package = "github.com/gogf/gf/cmd/gf/test";
6 |
7 | message SomeMessage {
8 | // Some comment on field with "one" `two` 'three' in the comment.
9 | string field = 1;
10 | }
--------------------------------------------------------------------------------
/cmd/gf/internal/cmd/testdata/issue/3953/issue3953.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto3";
2 | package account;
3 |
4 | option go_package = "account/v1";
5 |
6 | service Account {
7 | rpc getUserByIds (Req) returns (Resp) {
8 | }
9 | }
10 |
11 | message Req {
12 | repeated int64 ids = 1; // v: required
13 | }
14 | message Resp {
15 | repeated string data = 1;
16 | }
17 |
--------------------------------------------------------------------------------
/cmd/gf/internal/consts/consts.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package consts
8 |
9 | const (
10 | // DoNotEditKey is used in generated files,
11 | // which marks the files will be overwritten by CLI tool.
12 | DoNotEditKey = `DO NOT EDIT`
13 | )
14 |
--------------------------------------------------------------------------------
/cmd/gf/internal/consts/consts_gen_dao_template_do.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package consts
8 |
9 | const TemplateGenDaoDoContent = `
10 | // =================================================================================
11 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. {{.TplCreatedAtDatetimeStr}}
12 | // =================================================================================
13 |
14 | package {{.TplPackageName}}
15 |
16 | {{.TplPackageImports}}
17 |
18 | // {{.TplTableNameCamelCase}} is the golang structure of table {{.TplTableName}} for DAO operations like Where/Data.
19 | {{.TplStructDefine}}
20 | `
21 |
--------------------------------------------------------------------------------
/cmd/gf/internal/consts/consts_gen_dao_template_entity.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package consts
8 |
9 | const TemplateGenDaoEntityContent = `
10 | // =================================================================================
11 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. {{.TplCreatedAtDatetimeStr}}
12 | // =================================================================================
13 |
14 | package {{.TplPackageName}}
15 |
16 | {{.TplPackageImports}}
17 |
18 | // {{.TplTableNameCamelCase}} is the golang structure for table {{.TplTableName}}.
19 | {{.TplStructDefine}}
20 | `
21 |
--------------------------------------------------------------------------------
/cmd/gf/internal/consts/consts_gen_enums_template.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package consts
8 |
9 | const TemplateGenEnums = `
10 | // ================================================================================
11 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
12 | // ================================================================================
13 |
14 | package {PackageName}
15 |
16 | import (
17 | "github.com/gogf/gf/v2/util/gtag"
18 | )
19 |
20 | func init() {
21 | gtag.SetGlobalEnums({EnumsJson})
22 | }
23 | `
24 |
--------------------------------------------------------------------------------
/cmd/gf/internal/consts/consts_gen_pbentity_template.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package consts
8 |
9 | const TemplatePbEntityMessageContent = `
10 | // ==========================================================================
11 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
12 | // ==========================================================================
13 |
14 | syntax = "proto3";
15 |
16 | package {PackageName};
17 |
18 | option go_package = "{GoPackage}";
19 | {OptionContent}
20 | {Imports}
21 |
22 | {EntityMessage}
23 | `
24 |
--------------------------------------------------------------------------------
/cmd/gf/internal/consts/consts_gen_service_template_logic.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package consts
8 |
9 | const TemplateGenServiceLogicContent = `
10 | // ==========================================================================
11 | // Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
12 | // ==========================================================================
13 |
14 | package {PackageName}
15 |
16 | import(
17 | {Imports}
18 | )
19 | `
20 |
--------------------------------------------------------------------------------
/cmd/gf/internal/packed/packed.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package packed
8 |
--------------------------------------------------------------------------------
/cmd/gf/internal/utility/allyes/allyes.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package allyes
8 |
9 | import (
10 | "github.com/gogf/gf/v2/os/gcmd"
11 | "github.com/gogf/gf/v2/os/genv"
12 | )
13 |
14 | const (
15 | EnvName = "GF_CLI_ALL_YES"
16 | )
17 |
18 | // Init initializes the package manually.
19 | func Init() {
20 | if gcmd.GetOpt("y") != nil {
21 | genv.MustSet(EnvName, "1")
22 | }
23 | }
24 |
25 | // Check checks whether option allow all yes for command.
26 | func Check() bool {
27 | return genv.Get(EnvName).String() == "1"
28 | }
29 |
--------------------------------------------------------------------------------
/cmd/gf/internal/utility/utils/utils_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package utils_test
8 |
9 | import (
10 | "fmt"
11 | "testing"
12 |
13 | "github.com/gogf/gf/v2/test/gtest"
14 |
15 | "github.com/gogf/gf/cmd/gf/v2/internal/utility/utils"
16 | )
17 |
18 | func Test_GetModPath(t *testing.T) {
19 | gtest.C(t, func(t *gtest.T) {
20 | goModPath := utils.GetModPath()
21 | fmt.Println(goModPath)
22 | })
23 | }
24 |
--------------------------------------------------------------------------------
/cmd/gf/main.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package main
8 |
9 | import (
10 | "github.com/gogf/gf/v2/errors/gerror"
11 | "github.com/gogf/gf/v2/os/gctx"
12 |
13 | "github.com/gogf/gf/cmd/gf/v2/gfcmd"
14 | "github.com/gogf/gf/cmd/gf/v2/internal/utility/mlog"
15 | )
16 |
17 | func main() {
18 | var (
19 | ctx = gctx.GetInitCtx()
20 | command, err = gfcmd.GetCommand(ctx)
21 | )
22 |
23 | if err != nil {
24 | mlog.Fatalf(`%+v`, err)
25 | }
26 | if command == nil {
27 | panic(gerror.New(`retrieve root command failed for "gf"`))
28 | }
29 | command.Run(ctx)
30 | }
31 |
--------------------------------------------------------------------------------
/cmd/gf/test/testdata/tpls/tpl1.yaml:
--------------------------------------------------------------------------------
1 | server:
2 | address: {{.server.address}}
--------------------------------------------------------------------------------
/cmd/gf/test/testdata/tpls/tpl2.sql:
--------------------------------------------------------------------------------
1 | insert into {{.sql.table}}
--------------------------------------------------------------------------------
/cmd/gf/test/testdata/values.json:
--------------------------------------------------------------------------------
1 | {
2 | "server": {
3 | "address": "https://goframe.org"
4 | },
5 | "sql":{
6 | "table": "table_name"
7 | }
8 | }
--------------------------------------------------------------------------------
/container/garray/garray.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // Package garray provides most commonly used array containers which also support concurrent-safe/unsafe switch feature.
8 | package garray
9 |
--------------------------------------------------------------------------------
/container/gtype/gtype.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // Package gtype provides high performance and concurrent-safe basic variable types.
8 | package gtype
9 |
10 | // New is alias of NewAny.
11 | // See NewAny, NewInterface.
12 | func New(value ...interface{}) *Any {
13 | return NewAny(value...)
14 | }
15 |
--------------------------------------------------------------------------------
/container/gtype/gtype_any.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gtype
8 |
9 | // Any is a struct for concurrent-safe operation for type any.
10 | type Any = Interface
11 |
12 | // NewAny creates and returns a concurrent-safe object for any type,
13 | // with given initial value `value`.
14 | func NewAny(value ...any) *Any {
15 | t := &Any{}
16 | if len(value) > 0 && value[0] != nil {
17 | t.value.Store(value[0])
18 | }
19 | return t
20 | }
21 |
--------------------------------------------------------------------------------
/container/gvar/gvar_scan.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gvar
8 |
9 | import (
10 | "github.com/gogf/gf/v2/util/gconv"
11 | )
12 |
13 | // Scan automatically checks the type of `pointer` and converts value of Var to `pointer`.
14 | //
15 | // See gconv.Scan.
16 | func (v *Var) Scan(pointer interface{}, mapping ...map[string]string) error {
17 | return gconv.Scan(v.Val(), pointer, mapping...)
18 | }
19 |
--------------------------------------------------------------------------------
/container/gvar/gvar_set.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gvar
8 |
9 | import (
10 | "github.com/gogf/gf/v2/container/gtype"
11 | )
12 |
13 | // Set sets `value` to `v`, and returns the old value.
14 | func (v *Var) Set(value interface{}) (old interface{}) {
15 | if v.safe {
16 | if t, ok := v.value.(*gtype.Interface); ok {
17 | old = t.Set(value)
18 | return
19 | }
20 | }
21 | old = v.value
22 | v.value = value
23 | return
24 | }
25 |
--------------------------------------------------------------------------------
/contrib/config/README.MD:
--------------------------------------------------------------------------------
1 | # Configuration center implements.
2 |
3 | Please refer to certain sub folder.
--------------------------------------------------------------------------------
/contrib/config/kubecm/testdata/configmap.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: ConfigMap
3 | metadata:
4 | name: test-configmap
5 | data:
6 | config.yaml: |
7 | # HTTP service.
8 | server:
9 | address: ":8888"
10 | openapiPath: "/api.json"
11 | swaggerPath: "/swagger"
12 | accessLogEnabled: true
13 |
14 | # Database configuration.
15 | database:
16 | logger:
17 | level: "all"
18 | stdout: true
19 | user:
20 | link: "mysql:root:12345678@tcp(mysql.default:3306)/user?loc=Local&parseTime=true"
21 | debug: true
22 | order:
23 | link: "mysql:root:12345678@tcp(mysql.default:3306)/order?loc=Local&parseTime=true"
24 | debug: true
25 |
26 | # Logger configuration.
27 | logger:
28 | level : "all"
29 | stdout: true
30 |
--------------------------------------------------------------------------------
/contrib/drivers/clickhouse/clickhouse_do_commit.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package clickhouse
8 |
9 | import (
10 | "context"
11 |
12 | "github.com/gogf/gf/v2/database/gdb"
13 | )
14 |
15 | // DoCommit commits current sql and arguments to underlying sql driver.
16 | func (d *Driver) DoCommit(ctx context.Context, in gdb.DoCommitInput) (out gdb.DoCommitOutput, err error) {
17 | ctx = d.InjectIgnoreResult(ctx)
18 | return d.Core.DoCommit(ctx, in)
19 | }
20 |
--------------------------------------------------------------------------------
/contrib/drivers/clickhouse/clickhouse_do_delete.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package clickhouse
8 |
9 | import (
10 | "context"
11 | "database/sql"
12 |
13 | "github.com/gogf/gf/v2/database/gdb"
14 | )
15 |
16 | // DoDelete does "DELETE FROM ... " statement for the table.
17 | func (d *Driver) DoDelete(ctx context.Context, link gdb.Link, table string, condition string, args ...interface{}) (result sql.Result, err error) {
18 | ctx = d.injectNeedParsedSql(ctx)
19 | return d.Core.DoDelete(ctx, link, table, condition, args...)
20 | }
21 |
--------------------------------------------------------------------------------
/contrib/drivers/clickhouse/clickhouse_do_update.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package clickhouse
8 |
9 | import (
10 | "context"
11 | "database/sql"
12 |
13 | "github.com/gogf/gf/v2/database/gdb"
14 | )
15 |
16 | // DoUpdate does "UPDATE ... " statement for the table.
17 | func (d *Driver) DoUpdate(ctx context.Context, link gdb.Link, table string, data interface{}, condition string, args ...interface{}) (result sql.Result, err error) {
18 | ctx = d.injectNeedParsedSql(ctx)
19 | return d.Core.DoUpdate(ctx, link, table, data, condition, args...)
20 | }
21 |
--------------------------------------------------------------------------------
/contrib/drivers/clickhouse/clickhouse_transaction.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package clickhouse
8 |
9 | import (
10 | "context"
11 |
12 | "github.com/gogf/gf/v2/database/gdb"
13 | )
14 |
15 | // Begin starts and returns the transaction object.
16 | func (d *Driver) Begin(ctx context.Context) (tx gdb.TX, err error) {
17 | return nil, errUnsupportedBegin
18 | }
19 |
20 | // Transaction wraps the transaction logic using function `f`.
21 | func (d *Driver) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) error {
22 | return errUnsupportedTransaction
23 | }
24 |
--------------------------------------------------------------------------------
/contrib/drivers/dm/testdata/issue/2594/sql.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE HANDLE_INFO (
2 | ID INT IDENTITY (1, 1) NOT NULL,
3 | SUB_PREFIX VARCHAR(128),
4 | PREFIX VARCHAR(256),
5 | HANDLE_NAME VARCHAR(1024) NOT NULL,
6 | CREATE_TIME TIMESTAMP,
7 | UPDATE_TIME TIMESTAMP,
8 | VALUE BLOB ,
9 | NOT CLUSTER PRIMARY KEY (ID)
10 | );
--------------------------------------------------------------------------------
/contrib/drivers/mssql/mssql_do_commit.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package mssql
8 |
9 | import (
10 | "context"
11 |
12 | "github.com/gogf/gf/v2/database/gdb"
13 | )
14 |
15 | // DoCommit commits current sql and arguments to underlying sql driver.
16 | func (d *Driver) DoCommit(ctx context.Context, in gdb.DoCommitInput) (out gdb.DoCommitOutput, err error) {
17 | out, err = d.Core.DoCommit(ctx, in)
18 | if err != nil {
19 | return
20 | }
21 | if len(out.Records) > 0 {
22 | // remove auto added field.
23 | for i, record := range out.Records {
24 | delete(record, rowNumberAliasForSelect)
25 | out.Records[i] = record
26 | }
27 | }
28 | return
29 | }
30 |
--------------------------------------------------------------------------------
/contrib/drivers/mysql/mysql_do_filter.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package mysql
8 |
9 | import (
10 | "context"
11 |
12 | "github.com/gogf/gf/v2/database/gdb"
13 | )
14 |
15 | // DoFilter handles the sql before posts it to database.
16 | func (d *Driver) DoFilter(
17 | ctx context.Context, link gdb.Link, sql string, args []interface{},
18 | ) (newSql string, newArgs []interface{}, err error) {
19 | return d.Core.DoFilter(ctx, link, sql, args)
20 | }
21 |
--------------------------------------------------------------------------------
/contrib/drivers/mysql/testdata/date_time_example.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `date_time_example` (
2 | `id` int unsigned NOT NULL AUTO_INCREMENT,
3 | `year` year DEFAULT NULL COMMENT 'year',
4 | `date` date DEFAULT NULL COMMENT 'Date',
5 | `time` time DEFAULT NULL COMMENT 'time',
6 | `datetime` datetime DEFAULT NULL COMMENT 'datetime',
7 | `timestamp` timestamp NULL DEFAULT NULL COMMENT 'Timestamp',
8 | PRIMARY KEY (`id`)
9 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
--------------------------------------------------------------------------------
/contrib/drivers/mysql/testdata/fix_gdb_order_by.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE IF NOT EXISTS `employee`
2 | (
3 | id BIGINT AUTO_INCREMENT PRIMARY KEY,
4 | name VARCHAR(255) NOT NULL,
5 | age INT NOT NULL
6 | );
7 |
8 | INSERT INTO employee(name, age) VALUES ('John', 30);
9 | INSERT INTO employee(name, age) VALUES ('Mary', 28);
--------------------------------------------------------------------------------
/contrib/drivers/mysql/testdata/issues/2105.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `issue2105` (
2 | `id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL,
3 | `json` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin,
4 | PRIMARY KEY (`id`)
5 | ) ENGINE=InnoDB;
6 |
7 |
8 | INSERT INTO `issue2105` VALUES ('1', NULL);
9 | INSERT INTO `issue2105` VALUES ('2', '[{\"Name\": \"任务类型\", \"Value\": \"高价值\"}, {\"Name\": \"优先级\", \"Value\": \"高\"}, {\"Name\": \"是否亮点功能\", \"Value\": \"是\"}]');
10 |
--------------------------------------------------------------------------------
/contrib/drivers/mysql/testdata/issues/2439.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `a` (
2 | `id` int(11) NOT NULL AUTO_INCREMENT,
3 | PRIMARY KEY (id) USING BTREE
4 | ) ENGINE = InnoDB;
5 | INSERT INTO `a` (`id`) VALUES ('2');
6 |
7 | CREATE TABLE `b` (
8 | `id` int(11) NOT NULL AUTO_INCREMENT,
9 | `name` varchar(255) NOT NULL ,
10 | PRIMARY KEY (`id`) USING BTREE
11 | ) ENGINE = InnoDB;
12 | INSERT INTO `b` (`id`, `name`) VALUES ('2', 'a');
13 | INSERT INTO `b` (`id`, `name`) VALUES ('3', 'b');
14 |
15 | CREATE TABLE `c` (
16 | `id` int(11) NOT NULL AUTO_INCREMENT,
17 | PRIMARY KEY (`id`) USING BTREE
18 | ) ENGINE = InnoDB;
19 | INSERT INTO `c` (`id`) VALUES ('2');
--------------------------------------------------------------------------------
/contrib/drivers/mysql/testdata/issues/2643.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `issue2643` (
2 | `id` INT(10) NULL DEFAULT NULL,
3 | `name` VARCHAR(50) NULL DEFAULT NULL,
4 | `value` INT(10) NULL DEFAULT NULL,
5 | `dept` VARCHAR(50) NULL DEFAULT NULL
6 | )
7 | ENGINE=InnoDB
--------------------------------------------------------------------------------
/contrib/drivers/mysql/testdata/issues/3086.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `issue3086_user`
2 | (
3 | `id` int(10) unsigned NOT NULL COMMENT 'User ID',
4 | `passport` varchar(45) NOT NULL COMMENT 'User Passport',
5 | `password` varchar(45) DEFAULT NULL COMMENT 'User Password',
6 | `nickname` varchar(45) DEFAULT NULL COMMENT 'User Nickname',
7 | `create_at` datetime DEFAULT NULL COMMENT 'Created Time',
8 | `update_at` datetime DEFAULT NULL COMMENT 'Updated Time',
9 | PRIMARY KEY (`id`)
10 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
11 |
--------------------------------------------------------------------------------
/contrib/drivers/mysql/testdata/issues/3626.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `issue3626` (
2 | id int(11) NOT NULL,
3 | name varchar(45) DEFAULT NULL,
4 | PRIMARY KEY (id)
5 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--------------------------------------------------------------------------------
/contrib/drivers/mysql/testdata/issues/3754.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `issue3754` (
2 | id int(11) NOT NULL,
3 | name varchar(45) DEFAULT NULL,
4 | create_at datetime(0) DEFAULT NULL,
5 | update_at datetime(0) DEFAULT NULL,
6 | delete_at datetime(0) DEFAULT NULL,
7 | PRIMARY KEY (id)
8 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--------------------------------------------------------------------------------
/contrib/drivers/mysql/testdata/issues/3915.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `issue3915` (
2 | `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'user id',
3 | `a` float DEFAULT NULL COMMENT 'user name',
4 | `b` float DEFAULT NULL COMMENT 'user status',
5 | PRIMARY KEY (`id`)
6 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
7 |
8 | INSERT INTO `issue3915` (`id`,`a`,`b`) VALUES (1,1,2);
9 | INSERT INTO `issue3915` (`id`,`a`,`b`) VALUES (2,5,4);
--------------------------------------------------------------------------------
/contrib/drivers/mysql/testdata/issues/4034.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE issue4034 (
2 | id INT PRIMARY KEY AUTO_INCREMENT,
3 | passport VARCHAR(255),
4 | password VARCHAR(255),
5 | nickname VARCHAR(255),
6 | created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
7 | updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
8 | );
--------------------------------------------------------------------------------
/contrib/drivers/mysql/testdata/issues/4086.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE IF EXISTS `issue4086`;
2 | CREATE TABLE `issue4086` (
3 | `proxy_id` bigint NOT NULL,
4 | `recommend_ids` json DEFAULT NULL,
5 | `photos` json DEFAULT NULL,
6 | PRIMARY KEY (`proxy_id`)
7 | ) ENGINE=InnoDB;
8 |
9 | INSERT INTO `issue4086` (`proxy_id`, `recommend_ids`, `photos`) VALUES (1, '[584, 585]', 'null');
10 | INSERT INTO `issue4086` (`proxy_id`, `recommend_ids`, `photos`) VALUES (2, '[]', NULL);
--------------------------------------------------------------------------------
/contrib/drivers/mysql/testdata/reservedwords_table_tpl.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE %s (
2 | `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
3 | `key` varchar(45) DEFAULT NULL,
4 | `category_id` int(10) unsigned NOT NULL,
5 | `user_id` int(10) unsigned NOT NULL,
6 | `title` varchar(255) NOT NULL,
7 | `content` mediumtext NOT NULL,
8 | `sort` int(10) unsigned DEFAULT '0',
9 | `brief` varchar(255) DEFAULT NULL,
10 | `thumb` varchar(255) DEFAULT NULL,
11 | `tags` varchar(900) DEFAULT NULL,
12 | `referer` varchar(255) DEFAULT NULL,
13 | `status` smallint(5) unsigned DEFAULT '0',
14 | `view_count` int(10) unsigned DEFAULT '0',
15 | `zan_count` int(10) unsigned DEFAULT NULL,
16 | `cai_count` int(10) unsigned DEFAULT NULL,
17 | `created_at` datetime DEFAULT NULL,
18 | `updated_at` datetime DEFAULT NULL,
19 | PRIMARY KEY (`id`)
20 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--------------------------------------------------------------------------------
/contrib/drivers/mysql/testdata/table_with_prefix.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE `instance` (
2 | `f_id` int(11) NOT NULL AUTO_INCREMENT,
3 | `name` varchar(255) NULL DEFAULT '',
4 | PRIMARY KEY (`f_id`) USING BTREE
5 | ) ENGINE = InnoDB;
6 |
7 | INSERT INTO `instance` VALUES (1, 'john');
--------------------------------------------------------------------------------
/contrib/drivers/mysql/testdata/with_tpl_user.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE IF NOT EXISTS %s (
2 | id int(10) unsigned NOT NULL AUTO_INCREMENT,
3 | name varchar(45) NOT NULL,
4 | PRIMARY KEY (id)
5 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--------------------------------------------------------------------------------
/contrib/drivers/mysql/testdata/with_tpl_user_detail.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE IF NOT EXISTS %s (
2 | uid int(10) unsigned NOT NULL AUTO_INCREMENT,
3 | address varchar(45) NOT NULL,
4 | PRIMARY KEY (uid)
5 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--------------------------------------------------------------------------------
/contrib/drivers/mysql/testdata/with_tpl_user_scores.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE IF NOT EXISTS %s (
2 | id int(10) unsigned NOT NULL AUTO_INCREMENT,
3 | uid int(10) unsigned NOT NULL,
4 | score int(10) unsigned NOT NULL,
5 | PRIMARY KEY (id)
6 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--------------------------------------------------------------------------------
/contrib/drivers/oracle/oracle_do_commit.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package oracle
8 |
9 | import (
10 | "context"
11 |
12 | "github.com/gogf/gf/v2/database/gdb"
13 | )
14 |
15 | // DoCommit commits current sql and arguments to underlying sql driver.
16 | func (d *Driver) DoCommit(ctx context.Context, in gdb.DoCommitInput) (out gdb.DoCommitOutput, err error) {
17 | out, err = d.Core.DoCommit(ctx, in)
18 | if err != nil {
19 | return
20 | }
21 | if len(out.Records) > 0 {
22 | // remove auto added field.
23 | for i, record := range out.Records {
24 | delete(record, rowNumberAliasForSelect)
25 | out.Records[i] = record
26 | }
27 | }
28 | return
29 | }
30 |
--------------------------------------------------------------------------------
/contrib/drivers/oracle/oracle_order.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package oracle
8 |
9 | // OrderRandomFunction returns the SQL function for random ordering.
10 | func (d *Driver) OrderRandomFunction() string {
11 | return "DBMS_RANDOM.VALUE()"
12 | }
13 |
--------------------------------------------------------------------------------
/contrib/drivers/pgsql/pgsql_order.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package pgsql
8 |
9 | // OrderRandomFunction returns the SQL function for random ordering.
10 | func (d *Driver) OrderRandomFunction() string {
11 | return "RANDOM()"
12 | }
13 |
--------------------------------------------------------------------------------
/contrib/drivers/pgsql/pgsql_result.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package pgsql
8 |
9 | import "database/sql"
10 |
11 | type Result struct {
12 | sql.Result
13 | affected int64
14 | lastInsertId int64
15 | lastInsertIdError error
16 | }
17 |
18 | func (pgr Result) RowsAffected() (int64, error) {
19 | return pgr.affected, nil
20 | }
21 |
22 | func (pgr Result) LastInsertId() (int64, error) {
23 | return pgr.lastInsertId, pgr.lastInsertIdError
24 | }
25 |
--------------------------------------------------------------------------------
/contrib/drivers/pgsql/testdata/issues/issue3632.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE "public"."%s" (
2 | "one" int8[] NOT NULL,
3 | "two" text[][] NOT NULL
4 | );
5 |
--------------------------------------------------------------------------------
/contrib/drivers/pgsql/testdata/issues/issue3668.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE "public"."%s" (
2 | "text" varchar(255) COLLATE "pg_catalog"."default",
3 | "number" int4
4 | );
5 |
--------------------------------------------------------------------------------
/contrib/drivers/pgsql/testdata/issues/issue3671.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE "public"."%s"
2 | (
3 | "one" int8[] NOT NULL,
4 | "two" text[][] NOT NULL,
5 | "three" jsonb,
6 | "four" json,
7 | "five" jsonb
8 | );
9 |
--------------------------------------------------------------------------------
/contrib/drivers/pgsql/testdata/issues/issue4033.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE test_enum (
2 | id int8 NOT NULL,
3 | status int2 DEFAULT 0 NOT NULL,
4 | CONSTRAINT test_enum_pk PRIMARY KEY (id)
5 | );
--------------------------------------------------------------------------------
/contrib/drivers/sqlite/sqlite_order.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package sqlite
8 |
9 | // OrderRandomFunction returns the SQL function for random ordering.
10 | func (d *Driver) OrderRandomFunction() string {
11 | return "RANDOM()"
12 | }
13 |
--------------------------------------------------------------------------------
/contrib/nosql/redis/README.MD:
--------------------------------------------------------------------------------
1 | # redis
2 | GoFrame `gredis.Adapter` implements using `go-redis`.
3 |
4 | # Installation
5 | ```
6 | go get -u github.com/gogf/gf/contrib/nosql/redis/v2
7 | ```
8 |
9 | Commonly imported at top of `main.go`:
10 | ```go
11 | package main
12 |
13 | import (
14 | _ "github.com/gogf/gf/contrib/nosql/redis/v2"
15 |
16 | // Other imported packages.
17 | )
18 |
19 | func main() {
20 | // Main logics.
21 | }
22 | ```
23 |
--------------------------------------------------------------------------------
/contrib/nosql/redis/redis_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package redis_test
8 |
9 | import (
10 | "github.com/gogf/gf/v2/database/gredis"
11 | "github.com/gogf/gf/v2/os/gctx"
12 | )
13 |
14 | var (
15 | ctx = gctx.GetInitCtx()
16 | config = &gredis.Config{
17 | Address: `:6379`,
18 | Db: 1,
19 | }
20 | redis, _ = gredis.New(config)
21 | )
22 |
--------------------------------------------------------------------------------
/contrib/registry/README.MD:
--------------------------------------------------------------------------------
1 | # Service registrar and discovery
2 |
3 | Please refer to certain sub folder.
--------------------------------------------------------------------------------
/contrib/registry/zookeeper/zookeeper_func.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package zookeeper
8 |
9 | import (
10 | "encoding/json"
11 | )
12 |
13 | func unmarshal(data []byte) (c *Content, err error) {
14 | err = json.Unmarshal(data, &c)
15 | return
16 | }
17 |
18 | func marshal(c *Content) ([]byte, error) {
19 | return json.Marshal(c)
20 | }
21 |
--------------------------------------------------------------------------------
/contrib/rpc/grpcx/internal/resolver/resolver_manager.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package resolver
8 |
9 | import (
10 | "google.golang.org/grpc/resolver"
11 |
12 | "github.com/gogf/gf/v2/net/gsvc"
13 | )
14 |
15 | // Manager for Builder creating.
16 | type Manager struct{}
17 |
18 | // New creates and returns a Builder.
19 | func (m Manager) New(discovery gsvc.Discovery) resolver.Builder {
20 | return NewBuilder(discovery)
21 | }
22 |
23 | // Register sets the default Registry implements as your own implemented interface.
24 | func (m Manager) Register(registry gsvc.Registry) {
25 | Register(registry)
26 | }
27 |
--------------------------------------------------------------------------------
/contrib/rpc/grpcx/testdata/configuration/config.yaml:
--------------------------------------------------------------------------------
1 | grpc:
2 | name: "demo" # 服务名称
3 | address: ":8000" # 自定义服务监听地址
4 | logPath: "./log" # 日志存储目录路径
5 | logStdout: true # 日志是否输出到终端
6 | errorLogEnabled: true # 是否开启错误日志记录
7 | accessLogEnabled: true # 是否开启访问日志记录
8 | errorStack: true # 当产生错误时,是否记录错误堆栈
9 | logger:
10 | path: "/tmp/log/" # 日志文件路径。默认为空,表示关闭,仅输出到终端
11 | file: "{Y-m-d}.log" # 日志文件格式。默认为"{Y-m-d}.log"
12 | prefix: "TestLogger" # 日志内容输出前缀。默认为空
13 | level: "all" # 日志输出级别
14 | stdout: false # 日志是否同时输出到终端。默认true
--------------------------------------------------------------------------------
/contrib/rpc/grpcx/testdata/protobuf/helloworld.proto:
--------------------------------------------------------------------------------
1 | // protoc --go_out=paths=source_relative:. --go-grpc_out=paths=source_relative:. *.proto
2 |
3 | syntax = "proto3";
4 |
5 | package protobuf;
6 |
7 | option go_package = "github.com/gogf/gf/grpc/example/helloworld/protobuf";
8 |
9 |
10 | // The greeting service definition.
11 | service Greeter {
12 | // Sends a greeting
13 | rpc SayHello (HelloRequest) returns (HelloReply) {}
14 | }
15 |
16 | // The request message containing the user's name.
17 | message HelloRequest {
18 | string name = 1;
19 | }
20 |
21 | // The response message containing the greetings
22 | message HelloReply {
23 | string message = 1;
24 | }
25 |
--------------------------------------------------------------------------------
/contrib/sdk/httpclient/httpclient_config.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package httpclient
8 |
9 | import (
10 | "github.com/gogf/gf/v2/net/gclient"
11 | "github.com/gogf/gf/v2/os/glog"
12 | )
13 |
14 | // Config is the configuration struct for SDK client.
15 | type Config struct {
16 | URL string `v:"required"` // Service address. Eg: user.svc.local, http://user.svc.local
17 | Client *gclient.Client // Custom underlying client.
18 | Handler Handler // Custom response handler.
19 | Logger *glog.Logger // Custom logger.
20 | RawDump bool // Whether auto dump request&response in stdout.
21 | }
22 |
--------------------------------------------------------------------------------
/crypto/gcrc32/gcrc32.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // Package gcrc32 provides useful API for CRC32 encryption algorithms.
8 | package gcrc32
9 |
10 | import (
11 | "hash/crc32"
12 |
13 | "github.com/gogf/gf/v2/util/gconv"
14 | )
15 |
16 | // Encrypt encrypts any type of variable using CRC32 algorithms.
17 | // It uses gconv package to convert `v` to its bytes type.
18 | func Encrypt(v interface{}) uint32 {
19 | return crc32.ChecksumIEEE(gconv.Bytes(v))
20 | }
21 |
--------------------------------------------------------------------------------
/database/gdb/gdb_model_lock.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gdb
8 |
9 | // LockUpdate sets the lock for update for current operation.
10 | func (m *Model) LockUpdate() *Model {
11 | model := m.getModel()
12 | model.lockInfo = "FOR UPDATE"
13 | return model
14 | }
15 |
16 | // LockShared sets the lock in share mode for current operation.
17 | func (m *Model) LockShared() *Model {
18 | model := m.getModel()
19 | model.lockInfo = "LOCK IN SHARE MODE"
20 | return model
21 | }
22 |
--------------------------------------------------------------------------------
/database/gdb/testdata/reservedwords_table_tpl.sql:
--------------------------------------------------------------------------------
1 | CREATE TABLE %s (
2 | `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
3 | `key` varchar(45) DEFAULT NULL,
4 | `category_id` int(10) unsigned NOT NULL,
5 | `user_id` int(10) unsigned NOT NULL,
6 | `title` varchar(255) NOT NULL,
7 | `content` mediumtext NOT NULL,
8 | `sort` int(10) unsigned DEFAULT '0',
9 | `brief` varchar(255) DEFAULT NULL,
10 | `thumb` varchar(255) DEFAULT NULL,
11 | `tags` varchar(900) DEFAULT NULL,
12 | `referer` varchar(255) DEFAULT NULL,
13 | `status` smallint(5) unsigned DEFAULT '0',
14 | `view_count` int(10) unsigned DEFAULT '0',
15 | `zan_count` int(10) unsigned DEFAULT NULL,
16 | `cai_count` int(10) unsigned DEFAULT NULL,
17 | `created_at` datetime DEFAULT NULL,
18 | `updated_at` datetime DEFAULT NULL,
19 | PRIMARY KEY (`id`)
20 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--------------------------------------------------------------------------------
/debug/gdebug/gdebug.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // Package gdebug contains facilities for programs to debug themselves while they are running.
8 | package gdebug
9 |
--------------------------------------------------------------------------------
/encoding/gbase64/testdata/test:
--------------------------------------------------------------------------------
1 | test
--------------------------------------------------------------------------------
/encoding/gbinary/gbinary_func.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gbinary
8 |
--------------------------------------------------------------------------------
/encoding/gcompress/gcompress.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // Package gcompress provides kinds of compression algorithms for binary/bytes data.
8 | package gcompress
9 |
--------------------------------------------------------------------------------
/encoding/gcompress/testdata/gzip/file.txt:
--------------------------------------------------------------------------------
1 | This is a test file for gzip compression.
--------------------------------------------------------------------------------
/encoding/gcompress/testdata/zip/path1/1.txt:
--------------------------------------------------------------------------------
1 | This is a test file for zip compression purpose.
--------------------------------------------------------------------------------
/encoding/gcompress/testdata/zip/path2/2.txt:
--------------------------------------------------------------------------------
1 | This is another test file for zip compression purpose.
--------------------------------------------------------------------------------
/encoding/ghash/ghash.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // Package ghash provides some classic hash functions(uint32/uint64) in go.
8 | package ghash
9 |
--------------------------------------------------------------------------------
/encoding/ghash/ghash_djb.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package ghash
8 |
9 | // DJB implements the classic DJB hash algorithm for 32 bits.
10 | func DJB(str []byte) uint32 {
11 | var hash uint32 = 5381
12 | for i := 0; i < len(str); i++ {
13 | hash += (hash << 5) + uint32(str[i])
14 | }
15 | return hash
16 | }
17 |
18 | // DJB64 implements the classic DJB hash algorithm for 64 bits.
19 | func DJB64(str []byte) uint64 {
20 | var hash uint64 = 5381
21 | for i := 0; i < len(str); i++ {
22 | hash += (hash << 5) + uint64(str[i])
23 | }
24 | return hash
25 | }
26 |
--------------------------------------------------------------------------------
/encoding/ghash/ghash_jshash.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package ghash
8 |
9 | // JS implements the classic JS hash algorithm for 32 bits.
10 | func JS(str []byte) uint32 {
11 | var hash uint32 = 1315423911
12 | for i := 0; i < len(str); i++ {
13 | hash ^= (hash << 5) + uint32(str[i]) + (hash >> 2)
14 | }
15 | return hash
16 | }
17 |
18 | // JS64 implements the classic JS hash algorithm for 64 bits.
19 | func JS64(str []byte) uint64 {
20 | var hash uint64 = 1315423911
21 | for i := 0; i < len(str); i++ {
22 | hash ^= (hash << 5) + uint64(str[i]) + (hash >> 2)
23 | }
24 | return hash
25 | }
26 |
--------------------------------------------------------------------------------
/encoding/gjson/gjson_api_config.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gjson
8 |
9 | // SetSplitChar sets the separator char for hierarchical data access.
10 | func (j *Json) SetSplitChar(char byte) {
11 | j.mu.Lock()
12 | j.c = char
13 | j.mu.Unlock()
14 | }
15 |
16 | // SetViolenceCheck enables/disables violence check for hierarchical data access.
17 | func (j *Json) SetViolenceCheck(enabled bool) {
18 | j.mu.Lock()
19 | j.vc = enabled
20 | j.mu.Unlock()
21 | }
22 |
--------------------------------------------------------------------------------
/encoding/gjson/testdata/json/data1.json:
--------------------------------------------------------------------------------
1 | {"name":"john", "score":"100"}
--------------------------------------------------------------------------------
/encoding/gjson/testdata/properties/data1.properties:
--------------------------------------------------------------------------------
1 | pr.name=john
2 | pr.score=100
3 | pr.sex=0
--------------------------------------------------------------------------------
/encoding/gjson/testdata/toml/data1.toml:
--------------------------------------------------------------------------------
1 | [base]
2 | name = "john"
3 | score = 100
--------------------------------------------------------------------------------
/encoding/gjson/testdata/xml/data1.xml:
--------------------------------------------------------------------------------
1 | <?xml version="1.0" encoding="UTF-8"?>
2 | <doc>
3 | <name>john</name>
4 | <score>100</score>
5 | </doc>
--------------------------------------------------------------------------------
/encoding/gjson/testdata/yaml/data1.yaml:
--------------------------------------------------------------------------------
1 | base:
2 | name: john
3 | score: 100
--------------------------------------------------------------------------------
/errors/gerror/gerror_error_code.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gerror
8 |
9 | import (
10 | "github.com/gogf/gf/v2/errors/gcode"
11 | )
12 |
13 | // Code returns the error code.
14 | // It returns CodeNil if it has no error code.
15 | func (err *Error) Code() gcode.Code {
16 | if err == nil {
17 | return gcode.CodeNil
18 | }
19 | if err.code == gcode.CodeNil {
20 | return Code(err.Unwrap())
21 | }
22 | return err.code
23 | }
24 |
25 | // SetCode updates the internal code with given code.
26 | func (err *Error) SetCode(code gcode.Code) {
27 | if err == nil {
28 | return
29 | }
30 | err.code = code
31 | }
32 |
--------------------------------------------------------------------------------
/errors/gerror/gerror_error_json.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gerror
8 |
9 | // MarshalJSON implements the interface MarshalJSON for json.Marshal.
10 | // Note that do not use pointer as its receiver here.
11 | func (err Error) MarshalJSON() ([]byte, error) {
12 | return []byte(`"` + err.Error() + `"`), nil
13 | }
14 |
--------------------------------------------------------------------------------
/frame/g/g_setting.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package g
8 |
9 | import (
10 | "github.com/gogf/gf/v2/internal/utils"
11 | )
12 |
13 | // SetDebug enables/disables the GoFrame internal logging manually.
14 | // Note that this function is not concurrent safe, be aware of the DATA RACE,
15 | // which means you should call this function in your boot but not the runtime.
16 | func SetDebug(enabled bool) {
17 | utils.SetDebugEnabled(enabled)
18 | }
19 |
--------------------------------------------------------------------------------
/frame/g/g_z_example_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package g_test
8 |
9 | import (
10 | "github.com/gogf/gf/v2/frame/g"
11 | "github.com/gogf/gf/v2/net/ghttp"
12 | )
13 |
14 | func ExampleServer() {
15 | // A hello world example.
16 | s := g.Server()
17 | s.BindHandler("/", func(r *ghttp.Request) {
18 | r.Response.Write("hello world")
19 | })
20 | s.SetPort(8999)
21 | s.Run()
22 | }
23 |
--------------------------------------------------------------------------------
/frame/gins/gins.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // Package gins provides instances and core components management.
8 | package gins
9 |
10 | const (
11 | frameCoreComponentNameViewer = "gf.core.component.viewer"
12 | frameCoreComponentNameDatabase = "gf.core.component.database"
13 | frameCoreComponentNameHttpClient = "gf.core.component.httpclient"
14 | frameCoreComponentNameLogger = "gf.core.component.logger"
15 | frameCoreComponentNameRedis = "gf.core.component.redis"
16 | frameCoreComponentNameServer = "gf.core.component.server"
17 | )
18 |
--------------------------------------------------------------------------------
/frame/gins/gins_config.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gins
8 |
9 | import (
10 | "github.com/gogf/gf/v2/os/gcfg"
11 | )
12 |
13 | // Config returns an instance of View with default settings.
14 | // The parameter `name` is the name for the instance.
15 | func Config(name ...string) *gcfg.Config {
16 | return gcfg.Instance(name...)
17 | }
18 |
--------------------------------------------------------------------------------
/frame/gins/gins_httpclient.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gins
8 |
9 | import (
10 | "fmt"
11 |
12 | "github.com/gogf/gf/v2/internal/instance"
13 | "github.com/gogf/gf/v2/net/gclient"
14 | )
15 |
16 | // HttpClient returns an instance of http client with specified name.
17 | func HttpClient(name ...interface{}) *gclient.Client {
18 | var instanceKey = fmt.Sprintf("%s.%v", frameCoreComponentNameHttpClient, name)
19 | return instance.GetOrSetFuncLock(instanceKey, func() interface{} {
20 | return gclient.New()
21 | }).(*gclient.Client)
22 | }
23 |
--------------------------------------------------------------------------------
/frame/gins/gins_i18n.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gins
8 |
9 | import (
10 | "github.com/gogf/gf/v2/i18n/gi18n"
11 | )
12 |
13 | // I18n returns an instance of gi18n.Manager.
14 | // The parameter `name` is the name for the instance.
15 | func I18n(name ...string) *gi18n.Manager {
16 | return gi18n.Instance(name...)
17 | }
18 |
--------------------------------------------------------------------------------
/frame/gins/gins_resource.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gins
8 |
9 | import (
10 | "github.com/gogf/gf/v2/os/gres"
11 | )
12 |
13 | // Resource returns an instance of Resource.
14 | // The parameter `name` is the name for the instance.
15 | func Resource(name ...string) *gres.Resource {
16 | return gres.Instance(name...)
17 | }
18 |
--------------------------------------------------------------------------------
/frame/gins/gins_z_unit_httpclient_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gins_test
8 |
9 | import (
10 | "fmt"
11 | "testing"
12 |
13 | "github.com/gogf/gf/v2/frame/gins"
14 | "github.com/gogf/gf/v2/test/gtest"
15 | )
16 |
17 | func Test_Client(t *testing.T) {
18 | gtest.C(t, func(t *gtest.T) {
19 | var (
20 | c = gins.HttpClient()
21 | c1 = gins.HttpClient("c1")
22 | c2 = gins.HttpClient("c2")
23 | )
24 | c.SetAgent("test1")
25 | c.SetAgent("test2")
26 | t.AssertNE(fmt.Sprintf(`%p`, c), fmt.Sprintf(`%p`, c1))
27 | t.AssertNE(fmt.Sprintf(`%p`, c), fmt.Sprintf(`%p`, c2))
28 | t.AssertNE(fmt.Sprintf(`%p`, c1), fmt.Sprintf(`%p`, c2))
29 | })
30 | }
31 |
--------------------------------------------------------------------------------
/frame/gins/testdata/server/config.yaml:
--------------------------------------------------------------------------------
1 | server:
2 | address: ":8000"
3 | tempByInstanceName:
4 | accessLogEnabled: false
--------------------------------------------------------------------------------
/frame/gins/testdata/view1/config.toml:
--------------------------------------------------------------------------------
1 |
2 |
3 | [viewer]
4 | [viewer.test1]
5 | defaultFile = "test1.html"
6 | delimiters = ["${", "}"]
7 | [viewer.test1.data]
8 | name = "test1"
9 | [viewer.test2]
10 | defaultFile = "test2.html"
11 | delimiters = ["#{", "}"]
12 | [viewer.test2.data]
13 | name = "test2"
14 |
15 |
--------------------------------------------------------------------------------
/frame/gins/testdata/view1/test1.html:
--------------------------------------------------------------------------------
1 | test1:${.name}
--------------------------------------------------------------------------------
/frame/gins/testdata/view1/test2.html:
--------------------------------------------------------------------------------
1 | test2:#{.name}
--------------------------------------------------------------------------------
/frame/gins/testdata/view2/config.toml:
--------------------------------------------------------------------------------
1 |
2 |
3 | [viewer]
4 | defaultFile = "test.html"
5 | delimiters = ["{", "}"]
6 | [viewer.data]
7 | name = "test"
8 |
9 |
--------------------------------------------------------------------------------
/frame/gins/testdata/view2/test.html:
--------------------------------------------------------------------------------
1 | test:{.name}
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n-dir/en/hello.toml:
--------------------------------------------------------------------------------
1 |
2 | hello = "Hello"
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n-dir/en/world.toml:
--------------------------------------------------------------------------------
1 |
2 | world = "World"
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n-dir/ja/hello.yaml:
--------------------------------------------------------------------------------
1 |
2 | hello: "こんにちは"
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n-dir/ja/world.yaml:
--------------------------------------------------------------------------------
1 | world: "世界"
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n-dir/ru/hello.ini:
--------------------------------------------------------------------------------
1 | hello = "Привет"
2 |
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n-dir/ru/world.ini:
--------------------------------------------------------------------------------
1 | world = "мир"
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n-dir/zh-CN/hello.json:
--------------------------------------------------------------------------------
1 | {
2 | "你好": "hello",
3 | "hello": "你好"
4 | }
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n-dir/zh-CN/world.json:
--------------------------------------------------------------------------------
1 | {
2 | "世界": "world",
3 | "world": "世界"
4 | }
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n-dir/zh-TW/hello.xml:
--------------------------------------------------------------------------------
1 | <?xml version="1.0" encoding="utf-8"?>
2 | <i18n>
3 | <hello>你好</hello>
4 | </i18n>
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n-dir/zh-TW/world.xml:
--------------------------------------------------------------------------------
1 | <?xml version="1.0" encoding="utf-8"?>
2 | <i18n>
3 | <world>世界</world>
4 | </i18n>
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n-file/en.toml:
--------------------------------------------------------------------------------
1 |
2 | hello = "Hello"
3 | world = "World"
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n-file/ja.yaml:
--------------------------------------------------------------------------------
1 |
2 | hello: "こんにちは"
3 | world: "世界"
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n-file/ru.ini:
--------------------------------------------------------------------------------
1 | hello = "Привет"
2 | world = "мир"
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n-file/zh-CN.json:
--------------------------------------------------------------------------------
1 | {
2 | "你好": "hello",
3 | "世界": "world",
4 | "hello": "你好",
5 | "world": "世界"
6 | }
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n-file/zh-TW.xml:
--------------------------------------------------------------------------------
1 | <?xml version="1.0" encoding="utf-8"?>
2 | <i18n>
3 | <hello>你好</hello>
4 | <world>世界</world>
5 | </i18n>
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n/en.toml:
--------------------------------------------------------------------------------
1 |
2 | hello = "Hello"
3 | world = "World"
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n/ja.toml:
--------------------------------------------------------------------------------
1 |
2 | hello = "こんにちは"
3 | world = "世界"
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n/ru.toml:
--------------------------------------------------------------------------------
1 |
2 | hello = "Привет"
3 | world = "мир"
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n/zh-CN.json:
--------------------------------------------------------------------------------
1 | {
2 | "你好": "hello",
3 | "世界": "world",
4 | "hello": "你好",
5 | "world": "世界"
6 | }
--------------------------------------------------------------------------------
/i18n/gi18n/testdata/i18n/zh-TW.toml:
--------------------------------------------------------------------------------
1 | hello = "你好"
2 | world = "世界"
--------------------------------------------------------------------------------
/internal/errors/errors_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package errors_test
8 |
9 | import (
10 | "testing"
11 |
12 | "github.com/gogf/gf/v2/internal/errors"
13 | "github.com/gogf/gf/v2/test/gtest"
14 | )
15 |
16 | func Test_IsStackModeBrief(t *testing.T) {
17 | gtest.C(t, func(t *gtest.T) {
18 | t.Assert(errors.IsStackModeBrief(), true)
19 | })
20 | }
21 |
--------------------------------------------------------------------------------
/internal/mutex/mutex_z_bench_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package mutex_test
8 |
9 | import (
10 | "testing"
11 |
12 | "github.com/gogf/gf/v2/internal/mutex"
13 | )
14 |
15 | var (
16 | safeLock = mutex.New(false)
17 | unsafeLock = mutex.New(true)
18 | )
19 |
20 | func Benchmark_Safe_LockUnlock(b *testing.B) {
21 | for i := 0; i < b.N; i++ {
22 | safeLock.Lock()
23 | safeLock.Unlock()
24 | }
25 | }
26 |
27 | func Benchmark_UnSafe_LockUnlock(b *testing.B) {
28 | for i := 0; i < b.N; i++ {
29 | unsafeLock.Lock()
30 | unsafeLock.Unlock()
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/internal/utils/utils.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // Package utils provides some utility functions for internal usage.
8 | package utils
9 |
--------------------------------------------------------------------------------
/internal/utils/utils_array.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package utils
8 |
9 | import "reflect"
10 |
11 | // IsArray checks whether given value is array/slice.
12 | // Note that it uses reflect internally implementing this feature.
13 | func IsArray(value interface{}) bool {
14 | rv := reflect.ValueOf(value)
15 | kind := rv.Kind()
16 | if kind == reflect.Ptr {
17 | rv = rv.Elem()
18 | kind = rv.Kind()
19 | }
20 | switch kind {
21 | case reflect.Array, reflect.Slice:
22 | return true
23 | default:
24 | return false
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/internal/utils/utils_reflect.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package utils
8 |
9 | import (
10 | "reflect"
11 | )
12 |
13 | // CanCallIsNil Can reflect.Value call reflect.Value.IsNil.
14 | // It can avoid reflect.Value.IsNil panics.
15 | func CanCallIsNil(v interface{}) bool {
16 | rv, ok := v.(reflect.Value)
17 | if !ok {
18 | return false
19 | }
20 | switch rv.Kind() {
21 | case reflect.Interface, reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.Slice, reflect.UnsafePointer:
22 | return true
23 | default:
24 | return false
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/internal/utils/utils_z_bench_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package utils_test
8 |
9 | import (
10 | "regexp"
11 | "testing"
12 |
13 | "github.com/gogf/gf/v2/internal/utils"
14 | )
15 |
16 | var (
17 | replaceCharReg, _ = regexp.Compile(`[\-\.\_\s]+`)
18 | )
19 |
20 | func Benchmark_RemoveSymbols(b *testing.B) {
21 | for i := 0; i < b.N; i++ {
22 | utils.RemoveSymbols(`-a-b._a c1!@#$%^&*()_+:";'.,'01`)
23 | }
24 | }
25 |
26 | func Benchmark_RegularReplaceChars(b *testing.B) {
27 | for i := 0; i < b.N; i++ {
28 | replaceCharReg.ReplaceAllString(`-a-b._a c1!@#$%^&*()_+:";'.,'01`, "")
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/net/gclient/testdata/upload/file1.txt:
--------------------------------------------------------------------------------
1 | file1.txt: This file is for uploading unit test case.
--------------------------------------------------------------------------------
/net/gclient/testdata/upload/file2.txt:
--------------------------------------------------------------------------------
1 | file2.txt: This file is for uploading unit test case.
--------------------------------------------------------------------------------
/net/ghttp/ghttp_middleware_cors.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package ghttp
8 |
9 | // MiddlewareCORS is a middleware handler for CORS with default options.
10 | func MiddlewareCORS(r *Request) {
11 | r.Response.CORSDefault()
12 | r.Middleware.Next()
13 | }
14 |
--------------------------------------------------------------------------------
/net/ghttp/ghttp_middleware_json_body.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package ghttp
8 |
9 | import (
10 | "github.com/gogf/gf/v2/internal/json"
11 | )
12 |
13 | // MiddlewareJsonBody validates and returns request body whether JSON format.
14 | func MiddlewareJsonBody(r *Request) {
15 | requestBody := r.GetBody()
16 | if len(requestBody) > 0 {
17 | if !json.Valid(requestBody) {
18 | r.SetError(ErrNeedJsonBody)
19 | return
20 | }
21 | }
22 | r.Middleware.Next()
23 | }
24 |
--------------------------------------------------------------------------------
/net/ghttp/ghttp_middleware_never_done_ctx.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package ghttp
8 |
9 | // MiddlewareNeverDoneCtx sets the context never done for current process.
10 | func MiddlewareNeverDoneCtx(r *Request) {
11 | r.SetCtx(r.GetNeverDoneCtx())
12 | r.Middleware.Next()
13 | }
14 |
--------------------------------------------------------------------------------
/net/ghttp/ghttp_request_param_handler.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package ghttp
8 |
9 | // GetHandlerResponse retrieves and returns the handler response object and its error.
10 | func (r *Request) GetHandlerResponse() interface{} {
11 | return r.handlerResponse
12 | }
13 |
14 | // GetServeHandler retrieves and returns the user defined handler used to serve this request.
15 | func (r *Request) GetServeHandler() *HandlerItemParsed {
16 | return r.serveHandler
17 | }
18 |
--------------------------------------------------------------------------------
/net/ghttp/ghttp_server_admin_windows.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | //go:build windows
8 | // +build windows
9 |
10 | package ghttp
11 |
12 | import (
13 | "context"
14 | "os"
15 |
16 | "github.com/gogf/gf/v2/os/gproc"
17 | )
18 |
19 | // handleProcessSignal handles all signals from system in blocking way.
20 | func handleProcessSignal() {
21 | var ctx = context.TODO()
22 | gproc.AddSigHandlerShutdown(func(sig os.Signal) {
23 | shutdownWebServersGracefully(ctx, sig)
24 | })
25 |
26 | gproc.Listen()
27 | }
28 |
--------------------------------------------------------------------------------
/net/ghttp/ghttp_server_config_route.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package ghttp
8 |
9 | // SetRewrite sets rewrites for static URI for server.
10 | func (s *Server) SetRewrite(uri string, rewrite string) {
11 | s.config.Rewrites[uri] = rewrite
12 | }
13 |
14 | // SetRewriteMap sets the rewritten map for server.
15 | func (s *Server) SetRewriteMap(rewrites map[string]string) {
16 | for k, v := range rewrites {
17 | s.config.Rewrites[k] = v
18 | }
19 | }
20 |
21 | // SetRouteOverWrite sets the RouteOverWrite for server.
22 | func (s *Server) SetRouteOverWrite(enabled bool) {
23 | s.config.RouteOverWrite = enabled
24 | }
25 |
--------------------------------------------------------------------------------
/net/ghttp/ghttp_server_error_logger.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package ghttp
8 |
9 | import (
10 | "bytes"
11 | "context"
12 |
13 | "github.com/gogf/gf/v2/os/glog"
14 | )
15 |
16 | // errorLogger is the error logging logger for underlying net/http.Server.
17 | type errorLogger struct {
18 | logger *glog.Logger
19 | }
20 |
21 | // Write implements the io.Writer interface.
22 | func (l *errorLogger) Write(p []byte) (n int, err error) {
23 | l.logger.Skip(1).Error(context.TODO(), string(bytes.TrimRight(p, "\r\n")))
24 | return len(p), nil
25 | }
26 |
--------------------------------------------------------------------------------
/net/ghttp/ghttp_server_session.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package ghttp
8 |
9 | import "github.com/gogf/gf/v2/os/gsession"
10 |
11 | // Session is actually an alias of gsession.Session,
12 | // which is bound to a single request.
13 | type Session = gsession.Session
14 |
--------------------------------------------------------------------------------
/net/ghttp/ghttp_server_util.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package ghttp
8 |
9 | import "net/http"
10 |
11 | // WrapF is a helper function for wrapping http.HandlerFunc and returns a ghttp.HandlerFunc.
12 | func WrapF(f http.HandlerFunc) HandlerFunc {
13 | return func(r *Request) {
14 | f(r.Response.Writer, r.Request)
15 | }
16 | }
17 |
18 | // WrapH is a helper function for wrapping http.Handler and returns a ghttp.HandlerFunc.
19 | func WrapH(h http.Handler) HandlerFunc {
20 | return func(r *Request) {
21 | h.ServeHTTP(r.Response.Writer, r.Request)
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/net/ghttp/internal/response/response.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // Package response provides wrapper for http.response.
8 | package response
9 |
--------------------------------------------------------------------------------
/net/ghttp/internal/swaggerui/swaggerui.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // Package swaggerui provides packed swagger ui static files using resource manager.
8 | //
9 | // Files from:
10 | // https://github.com/Redocly/redoc
11 | // https://www.jsdelivr.com/package/npm/redoc
12 | //
13 | // Pack command:
14 | // gf pack redoc.standalone.js swaggerui-redoc.go -n=swaggerui -p=/goframe/swaggerui
15 | package swaggerui
16 |
--------------------------------------------------------------------------------
/net/ghttp/testdata/issue1611/header.html:
--------------------------------------------------------------------------------
1 | {{define "header"}}
2 | <h1>{{.header}}</h1>
3 | {{end}}
--------------------------------------------------------------------------------
/net/ghttp/testdata/issue1611/index/layout.html:
--------------------------------------------------------------------------------
1 | <!DOCTYPE html>
2 | <html>
3 | <head>
4 | <title>GoFrame Layout</title>
5 | </head>
6 | <body>
7 | {{template "header" .}}
8 | </body>
9 | </html>
--------------------------------------------------------------------------------
/net/ghttp/testdata/issue2963/1.txt:
--------------------------------------------------------------------------------
1 | 1
--------------------------------------------------------------------------------
/net/ghttp/testdata/issue2963/中文G146(1)-icon.txt:
--------------------------------------------------------------------------------
1 | 中文G146(1)-icon
--------------------------------------------------------------------------------
/net/ghttp/testdata/main.html:
--------------------------------------------------------------------------------
1 | main
--------------------------------------------------------------------------------
/net/ghttp/testdata/static1/index.html:
--------------------------------------------------------------------------------
1 | index
--------------------------------------------------------------------------------
/net/ghttp/testdata/static1/test.html:
--------------------------------------------------------------------------------
1 | test
--------------------------------------------------------------------------------
/net/ghttp/testdata/template/basic/index.html:
--------------------------------------------------------------------------------
1 | Name:{{.name}}
--------------------------------------------------------------------------------
/net/ghttp/testdata/template/layout1/container.html:
--------------------------------------------------------------------------------
1 | {{define "container"}}2{{end}}
--------------------------------------------------------------------------------
/net/ghttp/testdata/template/layout1/footer.html:
--------------------------------------------------------------------------------
1 | {{define "footer"}}3{{end}}
--------------------------------------------------------------------------------
/net/ghttp/testdata/template/layout1/header.html:
--------------------------------------------------------------------------------
1 | {{define "header"}}1{{end}}
--------------------------------------------------------------------------------
/net/ghttp/testdata/template/layout1/layout.html:
--------------------------------------------------------------------------------
1 | {{template "header"}}{{template "container"}}{{template "footer"}}
--------------------------------------------------------------------------------
/net/ghttp/testdata/template/layout2/footer.html:
--------------------------------------------------------------------------------
1 | b
--------------------------------------------------------------------------------
/net/ghttp/testdata/template/layout2/header.html:
--------------------------------------------------------------------------------
1 | a
--------------------------------------------------------------------------------
/net/ghttp/testdata/template/layout2/layout.html:
--------------------------------------------------------------------------------
1 | {{include "header.html" .}}{{include .mainTpl .}}{{include "footer.html" .}}
--------------------------------------------------------------------------------
/net/ghttp/testdata/template/layout2/main/main1.html:
--------------------------------------------------------------------------------
1 | 1
--------------------------------------------------------------------------------
/net/ghttp/testdata/template/layout2/main/main2.html:
--------------------------------------------------------------------------------
1 | 2
--------------------------------------------------------------------------------
/net/ghttp/testdata/upload/file1.txt:
--------------------------------------------------------------------------------
1 | file1.txt: This file is for uploading unit test case.
--------------------------------------------------------------------------------
/net/ghttp/testdata/upload/file2.txt:
--------------------------------------------------------------------------------
1 | file2.txt: This file is for uploading unit test case.
--------------------------------------------------------------------------------
/net/gipv4/gipv4_z_unit_lookup_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gipv4_test
8 |
9 | import (
10 | "testing"
11 |
12 | "github.com/gogf/gf/v2/net/gipv4"
13 | "github.com/gogf/gf/v2/test/gtest"
14 | )
15 |
16 | func TestGetHostByName(t *testing.T) {
17 | gtest.C(t, func(t *gtest.T) {
18 | ip, err := gipv4.GetHostByName("localhost")
19 | t.AssertNil(err)
20 | t.Assert(ip, "127.0.0.1")
21 | })
22 | }
23 |
24 | func TestGetHostsByName(t *testing.T) {
25 | gtest.C(t, func(t *gtest.T) {
26 | ips, err := gipv4.GetHostsByName("localhost")
27 | t.AssertNil(err)
28 | t.AssertIN("127.0.0.1", ips)
29 | })
30 | }
31 |
--------------------------------------------------------------------------------
/net/gipv6/gipv6.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // Package gipv6 provides useful API for IPv6 address handling.
8 | package gipv6
9 |
10 | import "github.com/gogf/gf/v2/text/gregex"
11 |
12 | // Validate checks whether given `ip` a valid IPv6 address.
13 | func Validate(ip string) bool {
14 | return gregex.IsMatchString(`^([\da-fA-F]{1,4}:){7}[\da-fA-F]{1,4}$|^:((:[\da-fA-F]{1,4}){1,6}|:)$|^[\da-fA-F]{1,4}:((:[\da-fA-F]{1,4}){1,5}|:)$|^([\da-fA-F]{1,4}:){2}((:[\da-fA-F]{1,4}){1,4}|:)$|^([\da-fA-F]{1,4}:){3}((:[\da-fA-F]{1,4}){1,3}|:)$|^([\da-fA-F]{1,4}:){4}((:[\da-fA-F]{1,4}){1,2}|:)$|^([\da-fA-F]{1,4}:){5}:([\da-fA-F]{1,4})?$|^([\da-fA-F]{1,4}:){6}:
max tokens
The response has been limited to 50k tokens of the smallest files in the repo. You can remove this limitation by
removing the max tokens filter.
, ip)
15 | }
16 |
--------------------------------------------------------------------------------
/net/goai/goai_callback.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package goai
8 |
9 | import (
10 | "github.com/gogf/gf/v2/internal/json"
11 | )
12 |
13 | // Callback is specified by OpenAPI/Swagger standard version 3.0.
14 | type Callback map[string]*Path
15 |
16 | type Callbacks map[string]*CallbackRef
17 |
18 | type CallbackRef struct {
19 | Ref string
20 | Value *Callback
21 | }
22 |
23 | func (r CallbackRef) MarshalJSON() ([]byte, error) {
24 | if r.Ref != "" {
25 | return formatRefToBytes(r.Ref), nil
26 | }
27 | return json.Marshal(r.Value)
28 | }
29 |
--------------------------------------------------------------------------------
/net/goai/goai_header.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package goai
8 |
9 | import (
10 | "github.com/gogf/gf/v2/internal/json"
11 | )
12 |
13 | // Header is specified by OpenAPI/Swagger 3.0 standard.
14 | // See https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.0.md#headerObject
15 | type Header struct {
16 | Parameter
17 | }
18 |
19 | type Headers map[string]HeaderRef
20 |
21 | type HeaderRef struct {
22 | Ref string
23 | Value *Header
24 | }
25 |
26 | func (r HeaderRef) MarshalJSON() ([]byte, error) {
27 | if r.Ref != "" {
28 | return formatRefToBytes(r.Ref), nil
29 | }
30 | return json.Marshal(r.Value)
31 | }
32 |
--------------------------------------------------------------------------------
/net/goai/goai_tags.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package goai
8 |
9 | // Tags is specified by OpenAPI/Swagger 3.0 standard.
10 | type Tags []Tag
11 |
12 | // Tag is specified by OpenAPI/Swagger 3.0 standard.
13 | type Tag struct {
14 | Name string `json:"name,omitempty"`
15 | Description string `json:"description,omitempty"`
16 | ExternalDocs *ExternalDocs `json:"externalDocs,omitempty"`
17 | }
18 |
--------------------------------------------------------------------------------
/net/goai/goai_xextensions.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package goai
8 |
9 | import (
10 | "github.com/gogf/gf/v2/text/gstr"
11 | )
12 |
13 | // XExtensions stores the `x-` custom extensions.
14 | type XExtensions map[string]string
15 |
16 | func (oai *OpenApiV3) tagMapToXExtensions(tagMap map[string]string, extensions XExtensions) {
17 | for k, v := range tagMap {
18 | if gstr.HasPrefix(k, "x-") || gstr.HasPrefix(k, "X-") {
19 | extensions[k] = v
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/net/goai/testdata/EmbeddedStructAttribute/expect.json:
--------------------------------------------------------------------------------
1 | {"openapi":"3.0.0","components":{"schemas":{"github.com.gogf.gf.v2.net.goai_test.CreateResourceReq":{"properties":{"Name":{"description":"This is name.","format":"string","type":"string"},"Embedded":{"properties":{"Age":{"description":"This is embedded age.","format":"uint","type":"integer"}},"type":"object"}},"type":"object"}}},"info":{"title":"","version":""},"paths":null}
--------------------------------------------------------------------------------
/net/goai/testdata/Issue3889JsonFile/201.json:
--------------------------------------------------------------------------------
1 | {
2 | "code 1": {
3 | "code": 1,
4 | "message": "Aha, 201 - 1",
5 | "data": "Good"
6 | },
7 | "code 2": {
8 | "code": 2,
9 | "message": "Aha, 201 - 2",
10 | "data": "Not Bad"
11 | }
12 | }
--------------------------------------------------------------------------------
/net/goai/testdata/NameFromJsonTag/expect1.json:
--------------------------------------------------------------------------------
1 | {"openapi":"3.0.0","components":{"schemas":{"github.com.gogf.gf.v2.net.goai_test.CreateReq":{"properties":{"nick_name":{"format":"string","type":"string"}},"type":"object"}}},"info":{"title":"","version":""},"paths":null}
--------------------------------------------------------------------------------
/net/goai/testdata/NameFromJsonTag/expect2.json:
--------------------------------------------------------------------------------
1 | {"openapi":"3.0.0","components":{"schemas":{"github.com.gogf.gf.v2.net.goai_test.CreateReq":{"properties":{"nick_name":{"format":"string","type":"string"}},"type":"object"}}},"info":{"title":"","version":""},"paths":null}
--------------------------------------------------------------------------------
/net/goai/testdata/XExtension/expect.json:
--------------------------------------------------------------------------------
1 | {"openapi":"3.0.0","components":{"schemas":{"github.com.gogf.gf.v2.net.goai_test.GetListReq":{"properties":{"Page":{"default":1,"description":"Page number","format":"int","type":"integer","x-sort":"1"},"Size":{"default":10,"description":"Size for per page.","format":"int","type":"integer","x-sort":"2"}},"type":"object","x-group":"User/Info"}}},"info":{"title":"","version":""},"paths":null}
--------------------------------------------------------------------------------
/net/gsel/gsel_builder.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gsel
8 |
9 | // defaultBuilder is the default Builder for globally used purpose.
10 | var defaultBuilder = NewBuilderRoundRobin()
11 |
12 | // SetBuilder sets the default builder for globally used purpose.
13 | func SetBuilder(builder Builder) {
14 | defaultBuilder = builder
15 | }
16 |
17 | // GetBuilder returns the default builder for globally used purpose.
18 | func GetBuilder() Builder {
19 | return defaultBuilder
20 | }
21 |
--------------------------------------------------------------------------------
/net/gsel/gsel_builder_least_connection.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gsel
8 |
9 | type builderLeastConnection struct{}
10 |
11 | func NewBuilderLeastConnection() Builder {
12 | return &builderLeastConnection{}
13 | }
14 |
15 | func (*builderLeastConnection) Name() string {
16 | return "BalancerLeastConnection"
17 | }
18 |
19 | func (*builderLeastConnection) Build() Selector {
20 | return NewSelectorLeastConnection()
21 | }
22 |
--------------------------------------------------------------------------------
/net/gsel/gsel_builder_random.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gsel
8 |
9 | type builderRandom struct{}
10 |
11 | func NewBuilderRandom() Builder {
12 | return &builderRandom{}
13 | }
14 |
15 | func (*builderRandom) Name() string {
16 | return "BalancerRandom"
17 | }
18 |
19 | func (*builderRandom) Build() Selector {
20 | return NewSelectorRandom()
21 | }
22 |
--------------------------------------------------------------------------------
/net/gsel/gsel_builder_round_robin.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gsel
8 |
9 | type builderRoundRobin struct{}
10 |
11 | func NewBuilderRoundRobin() Builder {
12 | return &builderRoundRobin{}
13 | }
14 |
15 | func (*builderRoundRobin) Name() string {
16 | return "BalancerRoundRobin"
17 | }
18 |
19 | func (*builderRoundRobin) Build() Selector {
20 | return NewSelectorRoundRobin()
21 | }
22 |
--------------------------------------------------------------------------------
/net/gsel/gsel_builder_weight.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gsel
8 |
9 | type builderWeight struct{}
10 |
11 | func NewBuilderWeight() Builder {
12 | return &builderWeight{}
13 | }
14 |
15 | func (*builderWeight) Name() string {
16 | return "BalancerWeight"
17 | }
18 |
19 | func (*builderWeight) Build() Selector {
20 | return NewSelectorWeight()
21 | }
22 |
--------------------------------------------------------------------------------
/net/gtcp/gtcp.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // Package gtcp provides TCP server and client implementations.
8 | package gtcp
9 |
--------------------------------------------------------------------------------
/net/gtcp/gtcp_z_example_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gtcp_test
8 |
9 | import (
10 | "fmt"
11 |
12 | "github.com/gogf/gf/v2/net/gtcp"
13 | )
14 |
15 | func ExampleGetFreePort() {
16 | fmt.Println(gtcp.GetFreePort())
17 |
18 | // May Output:
19 | // 57429 <nil>
20 | }
21 |
22 | func ExampleGetFreePorts() {
23 | fmt.Println(gtcp.GetFreePorts(2))
24 |
25 | // May Output:
26 | // [57743 57744] <nil>
27 | }
28 |
--------------------------------------------------------------------------------
/net/gtcp/testdata/crtFile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gogf/gf/5fa656d1cc924999519dd16a6770a80f01c24ecf/net/gtcp/testdata/crtFile
--------------------------------------------------------------------------------
/net/gtcp/testdata/keyFile:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gogf/gf/5fa656d1cc924999519dd16a6770a80f01c24ecf/net/gtcp/testdata/keyFile
--------------------------------------------------------------------------------
/net/gtrace/gtrace_span.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gtrace
8 |
9 | import (
10 | "context"
11 |
12 | "go.opentelemetry.io/otel/trace"
13 | )
14 |
15 | // Span warps trace.Span for compatibility and extension.
16 | type Span struct {
17 | trace.Span
18 | }
19 |
20 | // NewSpan creates a span using default tracer.
21 | func NewSpan(ctx context.Context, spanName string, opts ...trace.SpanStartOption) (context.Context, *Span) {
22 | ctx, span := NewTracer().Start(ctx, spanName, opts...)
23 | return ctx, &Span{
24 | Span: span,
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/net/gtrace/gtrace_tracer.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gtrace
8 |
9 | import (
10 | "go.opentelemetry.io/otel"
11 | "go.opentelemetry.io/otel/trace"
12 | )
13 |
14 | // Tracer warps trace.Tracer for compatibility and extension.
15 | type Tracer struct {
16 | trace.Tracer
17 | }
18 |
19 | // NewTracer Tracer is a short function for retrieving Tracer.
20 | func NewTracer(name ...string) *Tracer {
21 | tracerName := ""
22 | if len(name) > 0 {
23 | tracerName = name[0]
24 | }
25 | return &Tracer{
26 | Tracer: otel.Tracer(tracerName),
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/net/gudp/gudp.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // Package gudp provides UDP server and client implementations.
8 | package gudp
9 |
--------------------------------------------------------------------------------
/net/gudp/gudp_z_example_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gudp_test
8 |
9 | import (
10 | "fmt"
11 |
12 | "github.com/gogf/gf/v2/net/gudp"
13 | )
14 |
15 | func ExampleGetFreePort() {
16 | fmt.Println(gudp.GetFreePort())
17 |
18 | // May Output:
19 | // 57429 <nil>
20 | }
21 |
22 | func ExampleGetFreePorts() {
23 | fmt.Println(gudp.GetFreePorts(2))
24 |
25 | // May Output:
26 | // [57743 57744] <nil>
27 | }
28 |
--------------------------------------------------------------------------------
/os/gcache/gcache_adapter_memory_item.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gcache
8 |
9 | import (
10 | "github.com/gogf/gf/v2/os/gtime"
11 | )
12 |
13 | // IsExpired checks whether `item` is expired.
14 | func (item *memoryDataItem) IsExpired() bool {
15 | // Note that it should use greater than or equal judgement here
16 | // imagining that the cache time is only 1 millisecond.
17 | return item.e < gtime.TimestampMilli()
18 | }
19 |
--------------------------------------------------------------------------------
/os/gcfg/gcfg_z_unit_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // go test *.go -bench=".*" -benchmem
8 |
9 | package gcfg_test
10 |
11 | import "context"
12 |
13 | var (
14 | ctx = context.TODO()
15 | )
16 |
--------------------------------------------------------------------------------
/os/gcfg/testdata/c1.toml:
--------------------------------------------------------------------------------
1 |
2 | my-config = "1"
--------------------------------------------------------------------------------
/os/gcfg/testdata/cfg-with-utf8-bom.toml:
--------------------------------------------------------------------------------
1 |
2 | [test]
3 | testInt=1
4 | testStr="test"
5 |
--------------------------------------------------------------------------------
/os/gcfg/testdata/default/config.json:
--------------------------------------------------------------------------------
1 | {"my-config": 2}
--------------------------------------------------------------------------------
/os/gcfg/testdata/default/config.toml:
--------------------------------------------------------------------------------
1 | my-config = "1"
--------------------------------------------------------------------------------
/os/gcfg/testdata/envfile/c6.json:
--------------------------------------------------------------------------------
1 |
2 | {"my-config": 6}
--------------------------------------------------------------------------------
/os/gcfg/testdata/envpath/c3.toml:
--------------------------------------------------------------------------------
1 |
2 | my-config = "3"
--------------------------------------------------------------------------------
/os/gcfg/testdata/envpath/c4.json:
--------------------------------------------------------------------------------
1 |
2 | {"my-config": 4}
--------------------------------------------------------------------------------
/os/gcfg/testdata/folder1/c1.toml:
--------------------------------------------------------------------------------
1 |
2 | my-config = "2"
--------------------------------------------------------------------------------
/os/gcfg/testdata/folder1/c2.json:
--------------------------------------------------------------------------------
1 |
2 | {"my-config": 2}
--------------------------------------------------------------------------------
/os/gcron/gcron_z_bench_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gcron_test
8 |
9 | import (
10 | "context"
11 | "testing"
12 |
13 | "github.com/gogf/gf/v2/os/gcron"
14 | )
15 |
16 | func Benchmark_Add(b *testing.B) {
17 | for i := 0; i < b.N; i++ {
18 | gcron.Add(ctx, "1 1 1 1 1 1", func(ctx context.Context) {
19 |
20 | })
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/os/genv/genv_must.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package genv
8 |
9 | // MustSet performs as Set, but it panics if any error occurs.
10 | func MustSet(key, value string) {
11 | if err := Set(key, value); err != nil {
12 | panic(err)
13 | }
14 | }
15 |
16 | // MustRemove performs as Remove, but it panics if any error occurs.
17 | func MustRemove(key ...string) {
18 | if err := Remove(key...); err != nil {
19 | panic(err)
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/os/gfile/gfile_z_example_home_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gfile_test
8 |
9 | import (
10 | "fmt"
11 |
12 | "github.com/gogf/gf/v2/os/gfile"
13 | )
14 |
15 | func ExampleHome() {
16 | // user's home directory
17 | homePath, _ := gfile.Home()
18 | fmt.Println(homePath)
19 |
20 | // May Output:
21 | // C:\Users\hailaz
22 | }
23 |
--------------------------------------------------------------------------------
/os/gfile/gfile_z_example_search_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gfile_test
8 |
9 | import (
10 | "fmt"
11 |
12 | "github.com/gogf/gf/v2/os/gfile"
13 | )
14 |
15 | func ExampleSearch() {
16 | // init
17 | var (
18 | fileName = "gfile_example.txt"
19 | tempDir = gfile.Temp("gfile_example_search")
20 | tempFile = gfile.Join(tempDir, fileName)
21 | )
22 |
23 | // write contents
24 | gfile.PutContents(tempFile, "goframe example content")
25 |
26 | // search file
27 | realPath, _ := gfile.Search(fileName, tempDir)
28 | fmt.Println(gfile.Basename(realPath))
29 |
30 | // Output:
31 | // gfile_example.txt
32 | }
33 |
--------------------------------------------------------------------------------
/os/gfile/gfile_z_example_sort_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gfile_test
8 |
9 | import (
10 | "fmt"
11 |
12 | "github.com/gogf/gf/v2/os/gfile"
13 | )
14 |
15 | func ExampleSortFiles() {
16 | files := []string{
17 | "/aaa/bbb/ccc.txt",
18 | "/aaa/bbb/",
19 | "/aaa/",
20 | "/aaa",
21 | "/aaa/ccc/ddd.txt",
22 | "/bbb",
23 | "/0123",
24 | "/ddd",
25 | "/ccc",
26 | }
27 | sortOut := gfile.SortFiles(files)
28 | fmt.Println(sortOut)
29 |
30 | // Output:
31 | // [/0123 /aaa /aaa/ /aaa/bbb/ /aaa/bbb/ccc.txt /aaa/ccc/ddd.txt /bbb /ccc /ddd]
32 | }
33 |
--------------------------------------------------------------------------------
/os/gfile/gfile_z_example_time_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gfile_test
8 |
9 | import (
10 | "fmt"
11 |
12 | "github.com/gogf/gf/v2/os/gfile"
13 | )
14 |
15 | func ExampleMTime() {
16 | t := gfile.MTime(gfile.Temp())
17 | fmt.Println(t)
18 |
19 | // May Output:
20 | // 2021-11-02 15:18:43.901141 +0800 CST
21 | }
22 |
23 | func ExampleMTimestamp() {
24 | t := gfile.MTimestamp(gfile.Temp())
25 | fmt.Println(t)
26 |
27 | // May Output:
28 | // 1635838398
29 | }
30 |
31 | func ExampleMTimestampMilli() {
32 | t := gfile.MTimestampMilli(gfile.Temp())
33 | fmt.Println(t)
34 |
35 | // May Output:
36 | // 1635838529330
37 | }
38 |
--------------------------------------------------------------------------------
/os/gfile/testdata/dir1/file1:
--------------------------------------------------------------------------------
1 | file1
--------------------------------------------------------------------------------
/os/gfile/testdata/dir2/file2:
--------------------------------------------------------------------------------
1 | file2
--------------------------------------------------------------------------------
/os/gfile/testdata/readline/file.log:
--------------------------------------------------------------------------------
1 | a
2 | b
3 | c
4 | d
5 | e
6 |
--------------------------------------------------------------------------------
/os/glog/glog_logger_writer.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package glog
8 |
9 | import (
10 | "bytes"
11 | "context"
12 | )
13 |
14 | // Write implements the io.Writer interface.
15 | // It just prints the content using Print.
16 | func (l *Logger) Write(p []byte) (n int, err error) {
17 | l.Header(false).Print(context.TODO(), string(bytes.TrimRight(p, "\r\n")))
18 | return len(p), nil
19 | }
20 |
--------------------------------------------------------------------------------
/os/glog/glog_z_example_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package glog_test
8 |
9 | import (
10 | "context"
11 |
12 | "github.com/gogf/gf/v2/frame/g"
13 | )
14 |
15 | func ExampleContext() {
16 | ctx := context.WithValue(context.Background(), "Trace-Id", "123456789")
17 | g.Log().Error(ctx, "runtime error")
18 |
19 | // May Output:
20 | // 2020-06-08 20:17:03.630 [ERRO] {Trace-Id: 123456789} runtime error
21 | // Stack:
22 | // ...
23 | }
24 |
--------------------------------------------------------------------------------
/os/gmetric/gmetric_noop_histogram_performer.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gmetric
8 |
9 | // noopHistogramPerformer is an implementer for interface HistogramPerformer with no truly operations.
10 | type noopHistogramPerformer struct{}
11 |
12 | // newNoopHistogramPerformer creates and returns a HistogramPerformer with no truly operations.
13 | func newNoopHistogramPerformer() HistogramPerformer {
14 | return noopHistogramPerformer{}
15 | }
16 |
17 | // Record adds a single value to the histogram. The value is usually positive or zero.
18 | func (noopHistogramPerformer) Record(increment float64, option ...Option) {}
19 |
--------------------------------------------------------------------------------
/os/gmetric/gmetric_noop_observable_counter_performer.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gmetric
8 |
9 | // noopObservableCounterPerformer is an implementer for interface ObservableCounterPerformer with no truly operations.
10 | type noopObservableCounterPerformer struct{}
11 |
12 | // newNoopObservableCounterPerformer creates and returns a ObservableCounterPerformer with no truly operations.
13 | func newNoopObservableCounterPerformer() ObservableCounterPerformer {
14 | return noopObservableCounterPerformer{}
15 | }
16 |
17 | func (noopObservableCounterPerformer) observable() {}
18 |
--------------------------------------------------------------------------------
/os/gmetric/gmetric_noop_observable_gauge_performer.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gmetric
8 |
9 | // noopObservableGaugePerformer is an implementer for interface ObservableGaugePerformer with no truly operations.
10 | type noopObservableGaugePerformer struct{}
11 |
12 | // newNoopObservableGaugePerformer creates and returns a ObservableGaugePerformer with no truly operations.
13 | func newNoopObservableGaugePerformer() ObservableGaugePerformer {
14 | return noopObservableGaugePerformer{}
15 | }
16 |
17 | func (noopObservableGaugePerformer) observable() {}
18 |
--------------------------------------------------------------------------------
/os/gmetric/gmetric_noop_observable_updown_counter_performer.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame gf Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gmetric
8 |
9 | // noopObservableUpDownCounterPerformer is an implementer for interface ObservableUpDownCounterPerformer
10 | // with no truly operations.
11 | type noopObservableUpDownCounterPerformer struct{}
12 |
13 | // newNoopObservableUpDownCounterPerformer creates and returns a ObservableUpDownCounterPerformer
14 | // with no truly operations.
15 | func newNoopObservableUpDownCounterPerformer() ObservableUpDownCounterPerformer {
16 | return noopObservableUpDownCounterPerformer{}
17 | }
18 |
19 | func (noopObservableUpDownCounterPerformer) observable() {}
20 |
--------------------------------------------------------------------------------
/os/gmutex/gmutex.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // Package gmutex inherits and extends sync.Mutex and sync.RWMutex with more futures.
8 | //
9 | // Note that, it is refracted using stdlib mutex of package sync from GoFrame version v2.5.2.
10 | package gmutex
11 |
12 | // New creates and returns a new mutex.
13 | // Deprecated: use Mutex or RWMutex instead.
14 | func New() *RWMutex {
15 | return &RWMutex{}
16 | }
17 |
--------------------------------------------------------------------------------
/os/gproc/gproc_process_newprocess.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | //go:build !windows
8 |
9 | package gproc
10 |
11 | // Do nothing, just set it on the Windows platform
12 | func joinProcessArgs(p *Process) {}
13 |
--------------------------------------------------------------------------------
/os/gproc/gproc_process_newprocess_windows.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | //go:build windows
8 |
9 | package gproc
10 |
11 | import (
12 | "syscall"
13 |
14 | "github.com/gogf/gf/v2/text/gstr"
15 | )
16 |
17 | // Set the underlying parameters directly on the Windows platform
18 | func joinProcessArgs(p *Process) {
19 | p.SysProcAttr = &syscall.SysProcAttr{}
20 | p.SysProcAttr.CmdLine = gstr.Join(p.Args, " ")
21 | }
22 |
--------------------------------------------------------------------------------
/os/gproc/testdata/gobuild/main.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package main
8 |
9 | var (
10 | TestString string
11 | )
12 |
13 | func main() {
14 | print(TestString)
15 | }
16 |
--------------------------------------------------------------------------------
/os/gproc/testdata/shellexec/main.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package main
8 |
9 | import (
10 | "flag"
11 | "fmt"
12 | "os"
13 | )
14 |
15 | func main() {
16 | var content string
17 | var output string
18 | flag.StringVar(&content, "c", "", "写入内容")
19 | flag.StringVar(&output, "o", "", "写入路径")
20 | flag.Parse()
21 | fmt.Println(os.Args)
22 | fmt.Println(content)
23 | fmt.Println(output)
24 | if output != "" {
25 | file, err := os.Create(output)
26 | if err != nil {
27 | panic("create file fail: " + err.Error())
28 | }
29 | defer file.Close()
30 | file.WriteString(content)
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/os/gres/testdata/example/files/config/config.toml:
--------------------------------------------------------------------------------
1 |
2 | [server]
3 | Address = ":8888"
4 | ServerRoot = "public"
5 |
6 | [viewer]
7 | DefaultFile = "index.tpl"
8 | Delimiters = ["${", "}"]
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/os/gres/testdata/example/files/public/index.html:
--------------------------------------------------------------------------------
1 | Hello!
--------------------------------------------------------------------------------
/os/gres/testdata/example/files/template/index.tpl:
--------------------------------------------------------------------------------
1 | Hello ${.name}!
--------------------------------------------------------------------------------
/os/gres/testdata/files/config-custom/config.toml:
--------------------------------------------------------------------------------
1 | viewpath = "/home/www/templates"
2 | [redis]
3 | disk = "127.0.0.1:6379,4"
4 | cache = "127.0.0.1:6379,5"
--------------------------------------------------------------------------------
/os/gres/testdata/files/config-custom/my.ini:
--------------------------------------------------------------------------------
1 | viewpath = "/home/www/templates"
2 | [redis]
3 | disk = "127.0.0.1:6379,6"
4 | cache = "127.0.0.1:6379,7"
--------------------------------------------------------------------------------
/os/gres/testdata/files/config-res/config.toml:
--------------------------------------------------------------------------------
1 | viewpath = "/home/www/templates"
2 | [redis]
3 | disk = "127.0.0.1:6379,0"
4 | cache = "127.0.0.1:6379,1"
--------------------------------------------------------------------------------
/os/gres/testdata/files/config-res/my.ini:
--------------------------------------------------------------------------------
1 | viewpath = "/home/www/templates"
2 | [redis]
3 | disk = "127.0.0.1:6379,2"
4 | cache = "127.0.0.1:6379,3"
--------------------------------------------------------------------------------
/os/gres/testdata/files/dir1/sub/sub-test1.txt:
--------------------------------------------------------------------------------
1 | sub-test1 content
--------------------------------------------------------------------------------
/os/gres/testdata/files/dir1/test1:
--------------------------------------------------------------------------------
1 | test1 content
--------------------------------------------------------------------------------
/os/gres/testdata/files/dir2/sub/sub-test2.txt:
--------------------------------------------------------------------------------
1 | sub-test2 content
--------------------------------------------------------------------------------
/os/gres/testdata/files/dir2/test2:
--------------------------------------------------------------------------------
1 | test2 content
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-dir/en/hello.toml:
--------------------------------------------------------------------------------
1 |
2 | hello = "Hello"
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-dir/en/world.toml:
--------------------------------------------------------------------------------
1 |
2 | world = "World"
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-dir/ja/hello.yaml:
--------------------------------------------------------------------------------
1 |
2 | hello: "こんにちは"
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-dir/ja/world.yaml:
--------------------------------------------------------------------------------
1 | world: "世界"
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-dir/ru/hello.ini:
--------------------------------------------------------------------------------
1 | hello = "Привет"
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-dir/ru/world.ini:
--------------------------------------------------------------------------------
1 | world = "мир"
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-dir/zh-CN/hello.json:
--------------------------------------------------------------------------------
1 | {
2 | "hello": "你好"
3 | }
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-dir/zh-CN/world.json:
--------------------------------------------------------------------------------
1 | {
2 | "world": "世界"
3 | }
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-dir/zh-TW/hello.xml:
--------------------------------------------------------------------------------
1 | <?xml version="1.0" encoding="utf-8"?>
2 | <i18n>
3 | <hello>你好</hello>
4 | </i18n>
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-dir/zh-TW/world.xml:
--------------------------------------------------------------------------------
1 | <?xml version="1.0" encoding="utf-8"?>
2 | <i18n>
3 | <world>世界</world>
4 | </i18n>
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-file/en.toml:
--------------------------------------------------------------------------------
1 |
2 | hello = "Hello"
3 | world = "World"
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-file/ja.yaml:
--------------------------------------------------------------------------------
1 |
2 | hello: "こんにちは"
3 | world: "世界"
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-file/ru.ini:
--------------------------------------------------------------------------------
1 | hello = "Привет"
2 | world = "мир"
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-file/zh-CN.json:
--------------------------------------------------------------------------------
1 | {
2 | "hello": "你好",
3 | "world": "世界"
4 | }
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-file/zh-TW.xml:
--------------------------------------------------------------------------------
1 | <?xml version="1.0" encoding="utf-8"?>
2 | <i18n>
3 | <hello>你好</hello>
4 | <world>世界</world>
5 | </i18n>
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-res/en.toml:
--------------------------------------------------------------------------------
1 |
2 | hello = "Hello"
3 | world = "World"
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-res/ja.toml:
--------------------------------------------------------------------------------
1 |
2 | hello = "こんにちは"
3 | world = "世界"
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-res/ru.toml:
--------------------------------------------------------------------------------
1 |
2 | hello = "Привет"
3 | world = "мир"
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-res/zh-CN.toml:
--------------------------------------------------------------------------------
1 | hello = "你好"
2 | world = "世界"
--------------------------------------------------------------------------------
/os/gres/testdata/files/i18n-res/zh-TW.toml:
--------------------------------------------------------------------------------
1 | hello = "你好"
2 | world = "世界"
--------------------------------------------------------------------------------
/os/gres/testdata/files/root/css/style.css:
--------------------------------------------------------------------------------
1 | * {
2 | font-size: 32px;
3 | text-align: center;
4 | }
--------------------------------------------------------------------------------
/os/gres/testdata/files/root/image/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/gogf/gf/5fa656d1cc924999519dd16a6770a80f01c24ecf/os/gres/testdata/files/root/image/logo.png
--------------------------------------------------------------------------------
/os/gres/testdata/files/root/index.html:
--------------------------------------------------------------------------------
1 | <html>
2 | <head>
3 | <link rel="stylesheet" href="css/style.css" type="text/css" />
4 | </head>
5 | <body>
6 | <div><img src="image/logo.png"></div>
7 | This is the index from gres.
8 | </body>
9 | </html>
--------------------------------------------------------------------------------
/os/gres/testdata/files/template-res/index.html:
--------------------------------------------------------------------------------
1 | It's the index template file.
--------------------------------------------------------------------------------
/os/gres/testdata/files/template-res/layout1/container.html:
--------------------------------------------------------------------------------
1 | {{define "container"}}
2 | <h1>CONTAINER</h1>
3 | {{end}}
--------------------------------------------------------------------------------
/os/gres/testdata/files/template-res/layout1/footer.html:
--------------------------------------------------------------------------------
1 | {{define "footer"}}
2 | <h1>FOOTER</h1>
3 | {{end}}
--------------------------------------------------------------------------------
/os/gres/testdata/files/template-res/layout1/header.html:
--------------------------------------------------------------------------------
1 | {{define "header"}}
2 | <h1>HEADER</h1>
3 | {{end}}
--------------------------------------------------------------------------------
/os/gres/testdata/files/template-res/layout1/layout.html:
--------------------------------------------------------------------------------
1 | <!DOCTYPE html>
2 | <html>
3 | <head>
4 | <title>GoFrame Layout</title>
5 | {{template "header"}}
6 | </head>
7 | <body>
8 | <div class="container">
9 | {{template "container"}}
10 | </div>
11 | <div class="footer">
12 | {{template "footer"}}
13 | </div>
14 | </body>
15 | </html>
--------------------------------------------------------------------------------
/os/gres/testdata/files/template-res/layout2/footer.html:
--------------------------------------------------------------------------------
1 | <h1>FOOTER</h1>
--------------------------------------------------------------------------------
/os/gres/testdata/files/template-res/layout2/header.html:
--------------------------------------------------------------------------------
1 | <h1>HEADER</h1>
--------------------------------------------------------------------------------
/os/gres/testdata/files/template-res/layout2/layout.html:
--------------------------------------------------------------------------------
1 | {{include "header.html" .}}
2 | {{include .mainTpl .}}
3 | {{include "footer.html" .}}
--------------------------------------------------------------------------------
/os/gres/testdata/files/template-res/layout2/main/main1.html:
--------------------------------------------------------------------------------
1 | <h1>MAIN1</h1>
--------------------------------------------------------------------------------
/os/gres/testdata/files/template-res/layout2/main/main2.html:
--------------------------------------------------------------------------------
1 | <h1>MAIN2</h1>
--------------------------------------------------------------------------------
/os/grpool/grpool_supervisor.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package grpool
8 |
9 | import (
10 | "context"
11 |
12 | "github.com/gogf/gf/v2/os/gtimer"
13 | )
14 |
15 | // supervisor checks the job list and fork new worker goroutine to handle the job
16 | // if there are jobs but no workers in pool.
17 | func (p *Pool) supervisor(_ context.Context) {
18 | if p.IsClosed() {
19 | gtimer.Exit()
20 | }
21 | if p.list.Size() > 0 && p.count.Val() == 0 {
22 | var number = p.list.Size()
23 | if p.limit > 0 {
24 | number = p.limit
25 | }
26 | for i := 0; i < number; i++ {
27 | p.checkAndForkNewGoroutineWorker()
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/os/gstructs/gstructs_type.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gstructs
8 |
9 | // Signature returns a unique string as this type.
10 | func (t Type) Signature() string {
11 | return t.PkgPath() + "/" + t.String()
12 | }
13 |
14 | // FieldKeys returns the keys of current struct/map.
15 | func (t Type) FieldKeys() []string {
16 | keys := make([]string, t.NumField())
17 | for i := 0; i < t.NumField(); i++ {
18 | keys[i] = t.Field(i).Name
19 | }
20 | return keys
21 | }
22 |
--------------------------------------------------------------------------------
/os/gtime/gtime_sql.go:
--------------------------------------------------------------------------------
1 | package gtime
2 |
3 | import (
4 | "database/sql/driver"
5 | )
6 |
7 | // Scan implements interface used by Scan in package database/sql for Scanning value
8 | // from database to local golang variable.
9 | func (t *Time) Scan(value interface{}) error {
10 | if t == nil {
11 | return nil
12 | }
13 | newTime := New(value)
14 | *t = *newTime
15 | return nil
16 | }
17 |
18 | // Value is the interface providing the Value method for package database/sql/driver
19 | // for retrieving value from golang variable to database.
20 | func (t *Time) Value() (driver.Value, error) {
21 | if t == nil {
22 | return nil, nil
23 | }
24 | if t.IsZero() {
25 | return nil, nil
26 | }
27 |
28 | if t.Year() == 0 {
29 | // Only time.
30 | return t.Format("15:04:05"), nil
31 | }
32 |
33 | return t.Time, nil
34 | }
35 |
--------------------------------------------------------------------------------
/os/gtime/gtime_time_wrapper.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gtime
8 |
9 | import (
10 | "time"
11 | )
12 |
13 | // wrapper is a wrapper for stdlib struct time.Time.
14 | // It's used for overwriting some functions of time.Time, for example: String.
15 | type wrapper struct {
16 | time.Time
17 | }
18 |
19 | // String overwrites the String function of time.Time.
20 | func (t wrapper) String() string {
21 | if t.IsZero() {
22 | return ""
23 | }
24 | if t.Year() == 0 {
25 | // Only time.
26 | return t.Format("15:04:05")
27 | }
28 | return t.Format("2006-01-02 15:04:05")
29 | }
30 |
--------------------------------------------------------------------------------
/os/gtimer/gtimer_exit.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gtimer
8 |
9 | // Exit is used in timing job internally, which exits and marks it closed from timer.
10 | // The timing job will be automatically removed from timer later. It uses "panic-recover"
11 | // mechanism internally implementing this feature, which is designed for simplification
12 | // and convenience.
13 | func Exit() {
14 | panic(panicExit)
15 | }
16 |
--------------------------------------------------------------------------------
/os/gtimer/gtimer_z_bench_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gtimer
8 |
9 | import (
10 | "context"
11 | "testing"
12 | "time"
13 | )
14 |
15 | var (
16 | ctx = context.TODO()
17 | timer = New()
18 | )
19 |
20 | func Benchmark_Add(b *testing.B) {
21 | for i := 0; i < b.N; i++ {
22 | timer.Add(ctx, time.Hour, func(ctx context.Context) {
23 |
24 | })
25 | }
26 | }
27 |
28 | func Benchmark_PriorityQueue_Pop(b *testing.B) {
29 | for i := 0; i < b.N; i++ {
30 | timer.queue.Pop()
31 | }
32 | }
33 |
34 | func Benchmark_StartStop(b *testing.B) {
35 | for i := 0; i < b.N; i++ {
36 | timer.Start()
37 | timer.Stop()
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/os/gtimer/gtimer_z_example_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gtimer_test
8 |
9 | import (
10 | "context"
11 | "fmt"
12 | "time"
13 |
14 | "github.com/gogf/gf/v2/os/gtimer"
15 | )
16 |
17 | func ExampleAdd() {
18 | var (
19 | ctx = context.Background()
20 | now = time.Now()
21 | interval = 1400 * time.Millisecond
22 | )
23 | gtimer.Add(ctx, interval, func(ctx context.Context) {
24 | fmt.Println(time.Now(), time.Duration(time.Now().UnixNano()-now.UnixNano()))
25 | now = time.Now()
26 | })
27 |
28 | select {}
29 | }
30 |
--------------------------------------------------------------------------------
/os/gview/gview_error.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gview
8 |
9 | import (
10 | "github.com/gogf/gf/v2/os/gcmd"
11 | )
12 |
13 | const (
14 | // commandEnvKeyForErrorPrint is used to specify the key controlling error printing to stdout.
15 | // This error is designed not to be returned by functions.
16 | commandEnvKeyForErrorPrint = "gf.gview.errorprint"
17 | )
18 |
19 | // errorPrint checks whether printing error to stdout.
20 | func errorPrint() bool {
21 | return gcmd.GetOptWithEnv(commandEnvKeyForErrorPrint, true).Bool()
22 | }
23 |
--------------------------------------------------------------------------------
/os/gview/testdata/config/test.html:
--------------------------------------------------------------------------------
1 | name:${.name}
--------------------------------------------------------------------------------
/os/gview/testdata/i18n/en.toml:
--------------------------------------------------------------------------------
1 |
2 | hello = "Hello"
3 | world = "World"
--------------------------------------------------------------------------------
/os/gview/testdata/i18n/ja.toml:
--------------------------------------------------------------------------------
1 |
2 | hello = "こんにちは"
3 | world = "世界"
--------------------------------------------------------------------------------
/os/gview/testdata/i18n/ru.toml:
--------------------------------------------------------------------------------
1 |
2 | hello = "Привет"
3 | world = "мир"
--------------------------------------------------------------------------------
/os/gview/testdata/i18n/zh-CN.toml:
--------------------------------------------------------------------------------
1 | hello = "你好"
2 | world = "世界"
--------------------------------------------------------------------------------
/os/gview/testdata/i18n/zh-TW.toml:
--------------------------------------------------------------------------------
1 | hello = "你好"
2 | world = "世界"
--------------------------------------------------------------------------------
/os/gview/testdata/issue1416/gview copy.tpl:
--------------------------------------------------------------------------------
1 | test.tpl content, vars: {{ hello }}
--------------------------------------------------------------------------------
/os/gview/testdata/issue1416/gview.tpl:
--------------------------------------------------------------------------------
1 | test.tpl content, vars: {{.hello}}
--------------------------------------------------------------------------------
/os/gview/testdata/tpl/encode.tpl:
--------------------------------------------------------------------------------
1 | <div>{{.title}}</div>
--------------------------------------------------------------------------------
/sonar-project.properties:
--------------------------------------------------------------------------------
1 | sonar.projectKey=gogf_gf
2 | sonar.organization=gogf
3 |
4 | sonar.sources=.
5 |
6 | sonar.sourceEncoding=UTF-8
7 |
8 | sonar.host.url=https://sonarcloud.io
9 |
--------------------------------------------------------------------------------
/test/gtest/gtest.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // Package gtest provides convenient test utilities for unit testing.
8 | package gtest
9 |
--------------------------------------------------------------------------------
/test/gtest/testdata/testdata.txt:
--------------------------------------------------------------------------------
1 | hello
--------------------------------------------------------------------------------
/text/gstr/gstr.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | // Package gstr provides functions for string handling.
8 | package gstr
9 |
10 | const (
11 | // NotFoundIndex is the position index for string not found in searching functions.
12 | NotFoundIndex = -1
13 | )
14 |
15 | const (
16 | defaultSuffixForStrLimit = "..."
17 | )
18 |
--------------------------------------------------------------------------------
/text/gstr/gstr_compare.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gstr
8 |
9 | import "strings"
10 |
11 | // Compare returns an integer comparing two strings lexicographically.
12 | // The result will be 0 if a==b, -1 if a < b, and +1 if a > b.
13 | func Compare(a, b string) int {
14 | return strings.Compare(a, b)
15 | }
16 |
17 | // Equal reports whether `a` and `b`, interpreted as UTF-8 strings,
18 | // are equal under Unicode case-folding, case-insensitively.
19 | func Equal(a, b string) bool {
20 | return strings.EqualFold(a, b)
21 | }
22 |
--------------------------------------------------------------------------------
/text/gstr/gstr_contain.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gstr
8 |
9 | import "strings"
10 |
11 | // Contains reports whether `substr` is within `str`, case-sensitively.
12 | func Contains(str, substr string) bool {
13 | return strings.Contains(str, substr)
14 | }
15 |
16 | // ContainsI reports whether substr is within str, case-insensitively.
17 | func ContainsI(str, substr string) bool {
18 | return PosI(str, substr) != -1
19 | }
20 |
21 | // ContainsAny reports whether any Unicode code points in `chars` are within `s`.
22 | func ContainsAny(s, chars string) bool {
23 | return strings.ContainsAny(s, chars)
24 | }
25 |
--------------------------------------------------------------------------------
/text/gstr/gstr_create.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gstr
8 |
9 | import "strings"
10 |
11 | // Repeat returns a new string consisting of multiplier copies of the string input.
12 | //
13 | // Example:
14 | // Repeat("a", 3) -> "aaa"
15 | func Repeat(input string, multiplier int) string {
16 | return strings.Repeat(input, multiplier)
17 | }
18 |
--------------------------------------------------------------------------------
/text/gstr/gstr_is.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gstr
8 |
9 | import "github.com/gogf/gf/v2/internal/utils"
10 |
11 | // IsNumeric tests whether the given string s is numeric.
12 | func IsNumeric(s string) bool {
13 | return utils.IsNumeric(s)
14 | }
15 |
--------------------------------------------------------------------------------
/text/gstr/gstr_length.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gstr
8 |
9 | import "unicode/utf8"
10 |
11 | // LenRune returns string length of unicode.
12 | func LenRune(str string) int {
13 | return utf8.RuneCountInString(str)
14 | }
15 |
--------------------------------------------------------------------------------
/util/gconv/gconv_float.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gconv
8 |
9 | // Float32 converts `any` to float32.
10 | func Float32(any any) float32 {
11 | v, _ := defaultConverter.Float32(any)
12 | return v
13 | }
14 |
15 | // Float64 converts `any` to float64.
16 | func Float64(any any) float64 {
17 | v, _ := defaultConverter.Float64(any)
18 | return v
19 | }
20 |
--------------------------------------------------------------------------------
/util/gconv/gconv_maptomap.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gconv
8 |
9 | // MapToMap converts any map type variable `params` to another map type variable `pointer`
10 | // using reflect.
11 | // See doMapToMap.
12 | func MapToMap(params any, pointer any, mapping ...map[string]string) error {
13 | return Scan(params, pointer, mapping...)
14 | }
15 |
--------------------------------------------------------------------------------
/util/gconv/gconv_maptomaps.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gconv
8 |
9 | // MapToMaps converts any slice type variable `params` to another map slice type variable `pointer`.
10 | // See doMapToMaps.
11 | func MapToMaps(params any, pointer any, mapping ...map[string]string) error {
12 | return Scan(params, pointer, mapping...)
13 | }
14 |
--------------------------------------------------------------------------------
/util/gconv/gconv_slice_any.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gconv
8 |
9 | // SliceAny is alias of Interfaces.
10 | func SliceAny(any interface{}) []interface{} {
11 | return Interfaces(any)
12 | }
13 |
14 | // Interfaces converts `any` to []interface{}.
15 | func Interfaces(any interface{}) []interface{} {
16 | result, _ := defaultConverter.SliceAny(any, SliceOption{
17 | ContinueOnError: true,
18 | })
19 | return result
20 | }
21 |
--------------------------------------------------------------------------------
/util/gconv/gconv_slice_str.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gconv
8 |
9 | // SliceStr is alias of Strings.
10 | func SliceStr(any interface{}) []string {
11 | return Strings(any)
12 | }
13 |
14 | // Strings converts `any` to []string.
15 | func Strings(any interface{}) []string {
16 | result, _ := defaultConverter.SliceStr(any, SliceOption{
17 | ContinueOnError: true,
18 | })
19 | return result
20 | }
21 |
--------------------------------------------------------------------------------
/util/gconv/gconv_z_unit_custom_base_type_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gconv_test
8 |
9 | type (
10 | myInt int
11 | myInt8 int8
12 | myInt16 int16
13 | myInt32 int32
14 | myInt64 int64
15 |
16 | myUint uint
17 | myUint8 uint8
18 | myUint16 uint16
19 | myUint32 uint32
20 | myUint64 uint64
21 |
22 | myFloat32 float32
23 | myFloat64 float64
24 |
25 | myBool bool
26 |
27 | myString string
28 | )
29 |
--------------------------------------------------------------------------------
/util/gconv/gconv_z_unit_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gconv_test
8 |
9 | import (
10 | "testing"
11 |
12 | "github.com/gogf/gf/v2/test/gtest"
13 | "github.com/gogf/gf/v2/util/gconv"
14 | )
15 |
16 | type impUnmarshalValue struct{}
17 |
18 | func (*impUnmarshalValue) UnmarshalValue(interface{}) error {
19 | return nil
20 | }
21 |
22 | func TestIUnmarshalValue(t *testing.T) {
23 | gtest.C(t, func(t *gtest.T) {
24 | var v any = &impUnmarshalValue{}
25 | _, ok := (v).(gconv.IUnmarshalValue)
26 | t.AssertEQ(ok, true)
27 | })
28 | }
29 |
--------------------------------------------------------------------------------
/util/gconv/gconv_z_unit_unsafe_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gconv_test
8 |
9 | import (
10 | "testing"
11 |
12 | "github.com/gogf/gf/v2/test/gtest"
13 | "github.com/gogf/gf/v2/util/gconv"
14 | )
15 |
16 | func TestUnsafeStrToBytes(t *testing.T) {
17 | gtest.C(t, func(t *gtest.T) {
18 | s := "equator"
19 | t.AssertEQ(gconv.UnsafeStrToBytes(s), []byte(s))
20 | })
21 | }
22 |
23 | func TestUnsafeBytesToStr(t *testing.T) {
24 | gtest.C(t, func(t *gtest.T) {
25 | b := []byte("ecliptic")
26 | t.AssertEQ(gconv.UnsafeBytesToStr(b), string(b))
27 | })
28 | }
29 |
--------------------------------------------------------------------------------
/util/gconv/internal/converter/converter_rune.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package converter
8 |
9 | // Rune converts `any` to rune.
10 | func (c *Converter) Rune(any any) (rune, error) {
11 | if v, ok := any.(rune); ok {
12 | return v, nil
13 | }
14 | v, err := c.Int32(any)
15 | if err != nil {
16 | return 0, err
17 | }
18 | return v, nil
19 | }
20 |
21 | // Runes converts `any` to []rune.
22 | func (c *Converter) Runes(any any) ([]rune, error) {
23 | if v, ok := any.([]rune); ok {
24 | return v, nil
25 | }
26 | s, err := c.String(any)
27 | if err != nil {
28 | return nil, err
29 | }
30 | return []rune(s), nil
31 | }
32 |
--------------------------------------------------------------------------------
/util/gtag/gtag_z_example_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gtag_test
8 |
9 | import (
10 | "fmt"
11 |
12 | "github.com/gogf/gf/v2/frame/g"
13 | "github.com/gogf/gf/v2/util/gmeta"
14 | "github.com/gogf/gf/v2/util/gtag"
15 | )
16 |
17 | func ExampleSet() {
18 | type User struct {
19 | g.Meta `name:"User Struct" description:"{UserDescription}"`
20 | }
21 | gtag.Sets(g.MapStrStr{
22 | `UserDescription`: `This is a demo struct named "User Struct"`,
23 | })
24 | fmt.Println(gmeta.Get(User{}, `description`))
25 |
26 | // Output:
27 | // This is a demo struct named "User Struct"
28 | }
29 |
--------------------------------------------------------------------------------
/util/gutil/gutil_copy.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gutil
8 |
9 | import (
10 | "github.com/gogf/gf/v2/internal/deepcopy"
11 | )
12 |
13 | // Copy returns a deep copy of v.
14 | //
15 | // Copy is unable to copy unexported fields in a struct (lowercase field names).
16 | // Unexported fields can't be reflected by the Go runtime and therefore
17 | // they can't perform any data copies.
18 | func Copy(src interface{}) (dst interface{}) {
19 | return deepcopy.Copy(src)
20 | }
21 |
--------------------------------------------------------------------------------
/util/gutil/gutil_is.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gutil
8 |
9 | import (
10 | "reflect"
11 |
12 | "github.com/gogf/gf/v2/internal/empty"
13 | )
14 |
15 | // IsEmpty checks given `value` empty or not.
16 | // It returns false if `value` is: integer(0), bool(false), slice/map(len=0), nil;
17 | // or else returns true.
18 | func IsEmpty(value interface{}) bool {
19 | return empty.IsEmpty(value)
20 | }
21 |
22 | // IsTypeOf checks and returns whether the type of `value` and `valueInExpectType` equal.
23 | func IsTypeOf(value, valueInExpectType interface{}) bool {
24 | return reflect.TypeOf(value) == reflect.TypeOf(valueInExpectType)
25 | }
26 |
--------------------------------------------------------------------------------
/util/gvalid/gvalid_z_unit_feature_ci_test.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package gvalid_test
8 |
9 | import (
10 | "testing"
11 |
12 | "github.com/gogf/gf/v2/frame/g"
13 | "github.com/gogf/gf/v2/test/gtest"
14 | )
15 |
16 | func Test_CI(t *testing.T) {
17 | gtest.C(t, func(t *gtest.T) {
18 | err := g.Validator().Data("id").Rules("in:Id,Name").Run(ctx)
19 | t.AssertNE(err, nil)
20 | })
21 | gtest.C(t, func(t *gtest.T) {
22 | err := g.Validator().Data("id").Rules("ci|in:Id,Name").Run(ctx)
23 | t.AssertNil(err)
24 | })
25 | gtest.C(t, func(t *gtest.T) {
26 | err := g.Validator().Ci().Rules("in:Id,Name").Data("id").Run(ctx)
27 | t.AssertNil(err)
28 | })
29 | }
30 |
--------------------------------------------------------------------------------
/util/gvalid/internal/builtin/builtin_bail.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package builtin
8 |
9 | // RuleBail implements `bail` rule:
10 | // Stop validating when this field's validation failed.
11 | //
12 | // Format: bail
13 | type RuleBail struct{}
14 |
15 | func init() {
16 | Register(RuleBail{})
17 | }
18 |
19 | func (r RuleBail) Name() string {
20 | return "bail"
21 | }
22 |
23 | func (r RuleBail) Message() string {
24 | return ""
25 | }
26 |
27 | func (r RuleBail) Run(in RunInput) error {
28 | return nil
29 | }
30 |
--------------------------------------------------------------------------------
/util/gvalid/internal/builtin/builtin_ci.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package builtin
8 |
9 | // RuleCi implements `ci` rule:
10 | // Case-Insensitive configuration for those rules that need value comparison like:
11 | // same, different, in, not-in, etc.
12 | //
13 | // Format: ci
14 | type RuleCi struct{}
15 |
16 | func init() {
17 | Register(RuleCi{})
18 | }
19 |
20 | func (r RuleCi) Name() string {
21 | return "ci"
22 | }
23 |
24 | func (r RuleCi) Message() string {
25 | return ""
26 | }
27 |
28 | func (r RuleCi) Run(in RunInput) error {
29 | return nil
30 | }
31 |
--------------------------------------------------------------------------------
/util/gvalid/internal/builtin/builtin_eq.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package builtin
8 |
9 | // RuleEq implements `eq` rule:
10 | // Value should be the same as value of field.
11 | //
12 | // This rule performs the same as rule `same`.
13 | //
14 | // Format: eq:field
15 | type RuleEq struct{}
16 |
17 | func init() {
18 | Register(RuleEq{})
19 | }
20 |
21 | func (r RuleEq) Name() string {
22 | return "eq"
23 | }
24 |
25 | func (r RuleEq) Message() string {
26 | return "The {field} value `{value}` must be equal to field {field1} value `{value1}`"
27 | }
28 |
29 | func (r RuleEq) Run(in RunInput) error {
30 | return RuleSame{}.Run(in)
31 | }
32 |
--------------------------------------------------------------------------------
/util/gvalid/internal/builtin/builtin_foreach.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package builtin
8 |
9 | // RuleForeach implements `foreach` rule:
10 | // It tells the next validation using current value as an array and validates each of its element.
11 | //
12 | // Format: foreach
13 | type RuleForeach struct{}
14 |
15 | func init() {
16 | Register(RuleForeach{})
17 | }
18 |
19 | func (r RuleForeach) Name() string {
20 | return "foreach"
21 | }
22 |
23 | func (r RuleForeach) Message() string {
24 | return ""
25 | }
26 |
27 | func (r RuleForeach) Run(in RunInput) error {
28 | return nil
29 | }
30 |
--------------------------------------------------------------------------------
/util/gvalid/internal/builtin/builtin_not_eq.go:
--------------------------------------------------------------------------------
1 | // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
2 | //
3 | // This Source Code Form is subject to the terms of the MIT License.
4 | // If a copy of the MIT was not distributed with this file,
5 | // You can obtain one at https://github.com/gogf/gf.
6 |
7 | package builtin
8 |
9 | // RuleNotEq implements `not-eq` rule:
10 | // Value should be different from value of field.
11 | //
12 | // Format: not-eq:field
13 | type RuleNotEq struct{}
14 |
15 | func init() {
16 | Register(RuleNotEq{})
17 | }
18 |
19 | func (r RuleNotEq) Name() string {
20 | return "not-eq"
21 | }
22 |
23 | func (r RuleNotEq) Message() string {
24 | return "The {field} value `{value}` must not be equal to field {field1} value `{value1}`"
25 | }
26 |
27 | func (r RuleNotEq) Run(in RunInput) error {
28 | return RuleDifferent{}.Run(in)
29 | }
30 |
--------------------------------------------------------------------------------
/version.go:
--------------------------------------------------------------------------------
1 | package gf
2 |
3 | const (
4 | // VERSION is the current GoFrame version.
5 | VERSION = "v2.9.0"
6 | )
7 |
--------------------------------------------------------------------------------