{"id":18893220,"url":"https://github.com/sado0823/go-kitx","last_synced_at":"2026-02-25T08:02:45.496Z","repository":{"id":39992065,"uuid":"480348813","full_name":"sado0823/go-kitx","owner":"sado0823","description":"micro service web framework including http and grpc. some practical tools、 algorithms written in Go","archived":false,"fork":false,"pushed_at":"2023-10-13T10:18:08.000Z","size":1251,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T00:55:35.084Z","etag":null,"topics":["golang","grpc","http","web"],"latest_commit_sha":null,"homepage":"https://sado0823.github.io","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sado0823.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-11T11:24:20.000Z","updated_at":"2023-09-22T21:34:49.000Z","dependencies_parsed_at":"2023-02-10T22:45:32.557Z","dependency_job_id":"b9e25902-3de9-471b-8a25-897ef705f521","html_url":"https://github.com/sado0823/go-kitx","commit_stats":{"total_commits":63,"total_committers":4,"mean_commits":15.75,"dds":0.5714285714285714,"last_synced_commit":"05c206a125e9c69698de83ef5538bd17c7ca192d"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/sado0823/go-kitx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sado0823%2Fgo-kitx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sado0823%2Fgo-kitx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sado0823%2Fgo-kitx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sado0823%2Fgo-kitx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sado0823","download_url":"https://codeload.github.com/sado0823/go-kitx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sado0823%2Fgo-kitx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278908466,"owners_count":26066880,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","grpc","http","web"],"created_at":"2024-11-08T08:12:32.883Z","updated_at":"2025-10-08T07:28:37.697Z","avatar_url":"https://github.com/sado0823.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-kitx\n\n\n\nSome practical tools、 algorithms written in Go\n\n\n## [**1) p2c grpc balancer**](https://github.com/sado0823/go-kitx/tree/master/grpc/balancer/p2c)\n```go\n// example\nfunc test() {\n    cc, err := grpc.Dial(r.Scheme()+\":///test.server\",\n        grpc.WithDefaultServiceConfig(fmt.Sprintf(`{\"loadBalancingConfig\": [{\"%s\":{}}]}`, p2c.Name)))\n    if err != nil {\n        t.Fatalf(\"failed to dial: %v\", err)\n    }\n    defer cc.Close()\n}\n```\n\n## [**2) ast rule engine**](https://github.com/sado0823/go-kitx/tree/master/kit/rule)\n\n__supported operator__\n\n* **comparator**: `\u003e` `\u003e=` `\u003c` `\u003c=` `==`\n\n* **bitwise**: `\u0026` `|` `^`\n\n* **bitwiseShift**: `\u003c\u003c` `\u003e\u003e`\n\n* **additive**: `+` `-`\n\n* **multiplicative**: `*` `/` `%`\n\n* **prefix**: `!`(NOT)  `-`(NEGATE)\n\n* **logic**: `\u0026\u0026` `||`\n\n* **func call**: `(` `)` `,` `func`(do func call with build in function and custom function)\n\n* **params type**: `Ident` `Number` `String` `Bool` `array`, `struct` (DO Not support `func` )\n\n* **recursive params call with `.`**: `map.mapKey.mapKey.arrayIndex.structFiledName` (foo.bar.2.Name)\n\n* Link\n  * [See Example Here](https://github.com/sado0823/go-kitx/blob/master/kit/rule/example_test.go)\n  * [See Unit Test Here](https://github.com/sado0823/go-kitx/blob/master/kit/rule/rule_params_test.go)\n\n```go\n// example\nimport (\n    . \"github.com/sado0823/go-kitx/kit/rule\"\n)\n\nfunc main(){\n\n    expr := `foo + 1 \u003e bar`\n\t\n    param := map[string]interface{}{\n        \"foo\": 5,\n        \"bar\": 6,\n    }\n\t\n    res, err := Do(context.Background(), expr, param)\n    if err != nil {\n        panic(err)\n    }\n}\n\n```\n\n\n## [**3) start app with http and grpc**](https://github.com/sado0823/go-kitx/tree/master)\n\n![img.png](docs/image/img.png)\n\n```go\nimport (\n    \"context\"\n    \"sync\"\n    \"testing\"\n    \"time\"\n\t\n    \"github.com/sado0823/go-kitx/transport/grpc\"\n    \"github.com/sado0823/go-kitx/transport/http\"\n)\n\nfunc Test_NewApp(t *testing.T) {\n\n\tvar wg sync.WaitGroup\n\n\twg.Add(1)\n\tgo func() {\n\t\ths := http.NewServer(http.WithServerAddress(\"0.0.0.0:7001\"))\n\t\tgs := grpc.NewServer(grpc.WithServerAddress(\"0.0.0.0:7002\"))\n\n\t\tapp := New(\n\t\t\tWithName(\"demo.app\"),\n\t\t\tWithVersion(\"v0.0.00001\"),\n\t\t\tWithMetadata(map[string]string{}),\n\t\t\tWithServer(hs, gs),\n\t\t)\n\n\t\twg.Done()\n\t\terr := app.Run()\n\t\tif err != nil {\n\t\t\tt.Log(err)\n\t\t\treturn\n\t\t}\n\t}()\n\twg.Wait()\n\ttime.Sleep(time.Second)\n\n\tclient, err := grpc.DialInsecure(context.Background(),\n\t\t//grpc.WithClientEndpoint(\"direct:///0.0.0.0:7002,0.0.0.0:7001\"),\n\t\t//grpc.WithClientEndpoint(\"discovery:///foo\"),\n\t\tgrpc.WithClientEndpoint(\"0.0.0.0:7002\"),\n\t)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tt.Log(client.Target())\n\n\terr = client.Invoke(context.Background(), \"/abc\", 1, map[string]interface{}{})\n\tt.Log(err)\n}\n```\n\n## [**4) kit**]()\n```go\n  1) consistent hash\n  2) bbr、token、period ratelimit\n  3) backoff and jitter retry func\n  4) redis, sql orm\n  5) log plugin\n  6) go ast rule engine\n```\n\n## [**5) CMD**](https://github.com/sado0823/go-kitx/tree/master/cmd)\n```shell\n❯ ./kitx -h   \n    \nNAME:\n   kitx - ⭐️ cli command for go-kitx\n\nUSAGE:\n   kitx [global options] command [command options] [arguments...]\n\nVERSION:\n   v0.0.1\n\nCOMMANDS:\n   upgrade, u   upgrade kitx tools\n   new, n       generate project from template\n   complete, c  complete a task on the list\n   help, h      Shows a list of commands or help for one command\n\nGLOBAL OPTIONS:\n   --help, -h     show help (default: false)\n   --version, -v  print the version (default: false)\n    \n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsado0823%2Fgo-kitx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsado0823%2Fgo-kitx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsado0823%2Fgo-kitx/lists"}