{"id":18877124,"url":"https://github.com/trpc-ecosystem/go-selector-dsn","last_synced_at":"2025-08-02T13:09:48.771Z","repository":{"id":200695619,"uuid":"677278307","full_name":"trpc-ecosystem/go-selector-dsn","owner":"trpc-ecosystem","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-16T11:38:46.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-15T19:31:05.184Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trpc-ecosystem.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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":"2023-08-11T07:08:28.000Z","updated_at":"2024-05-16T11:33:14.000Z","dependencies_parsed_at":"2025-03-15T19:28:42.141Z","dependency_job_id":"8857719d-5eee-454d-8c24-d52d1fb9dce7","html_url":"https://github.com/trpc-ecosystem/go-selector-dsn","commit_stats":null,"previous_names":["trpc-ecosystem/go-selector-dsn"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/trpc-ecosystem/go-selector-dsn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trpc-ecosystem%2Fgo-selector-dsn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trpc-ecosystem%2Fgo-selector-dsn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trpc-ecosystem%2Fgo-selector-dsn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trpc-ecosystem%2Fgo-selector-dsn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trpc-ecosystem","download_url":"https://codeload.github.com/trpc-ecosystem/go-selector-dsn/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trpc-ecosystem%2Fgo-selector-dsn/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268393956,"owners_count":24243326,"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-08-02T02:00:12.353Z","response_time":74,"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":[],"created_at":"2024-11-08T06:17:01.101Z","updated_at":"2025-08-02T13:09:48.763Z","avatar_url":"https://github.com/trpc-ecosystem.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"English | [中文](README.zh_CN.md)\n\n# Data Source Name Selector\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/trpc-ecosystem/go-selector-dsn.svg)](https://pkg.go.dev/github.com/trpc-ecosystem/go-selector-dsn)\n[![Go Report Card](https://goreportcard.com/badge/trpc.group/trpc-go/trpc-selector-dsn)](https://goreportcard.com/report/trpc.group/trpc-go/trpc-selector-dsn)\n[![LICENSE](https://img.shields.io/badge/license-Apache--2.0-green.svg)](https://github.com/trpc-ecosystem/go-selector-dsn/blob/main/LICENSE)\n[![Releases](https://img.shields.io/github/release/trpc-ecosystem/go-selector-dsn.svg?style=flat-square)](https://github.com/trpc-ecosystem/go-selector-dsn/releases)\n[![Tests](https://github.com/trpc-ecosystem/go-selector-dsn/actions/workflows/prc.yml/badge.svg)](https://github.com/trpc-ecosystem/go-selector-dsn/actions/workflows/prc.yml)\n[![Coverage](https://codecov.io/gh/trpc-ecosystem/go-selector-dsn/branch/main/graph/badge.svg)](https://app.codecov.io/gh/trpc-ecosystem/go-selector-dsn/tree/main)\n\nDSN(Data Source Name) Selector implements a selector for tRPC-Go, which uses the client's target as a data source name , and returns it in the Node's Address\n\n## client\n```\nclient:                                            # backend-config for client\n  service:                                         # backend's config\n    - name: trpc.dsn.xxx.xxx         \n      target: dsn://user:passwd@tcp(ip:port)/db      # select returns the address after \"://\"\n    - name: trpc.dsn.xxx.xxx1         \n      # dsn+polaris means that the host in target will be resolved by polaris, and the actual address will be replaced \n      # after the host, and the part after \"://\" will be returned\n      # polaris is specified when registering the selector, and can also be other selectors\n      target: dsn+polaris://user:passwd@tcp(host)/db\n```\n\n```\n// register selector\nfunc init() {\n    // use target as data source name or uri directly\n    selector.Register(\"dsn\", dsn.DefaultSelector)\n\n    // selector which supports address resolution, polaris is the name of the address resolution selector\n    // dsn.URIHostExtractor{} is the extractor to extract the key of polaris service from target\n    selector.Register(\"dsn+polaris\", dsn.NewResolvableSelector(\"polaris\", \u0026dsn.URIHostExtractor{}))\n}\n\n```\n\n## Copyright\n\nThe copyright notice pertaining to the Tencent code in this repo was previously in the name of “THL A29 Limited.”  That entity has now been de-registered.  You should treat all previously distributed copies of the code as if the copyright notice was in the name of “Tencent.”\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrpc-ecosystem%2Fgo-selector-dsn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrpc-ecosystem%2Fgo-selector-dsn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrpc-ecosystem%2Fgo-selector-dsn/lists"}