{"id":19750908,"url":"https://github.com/sheepla/go-urlbuilder","last_synced_at":"2025-04-30T10:31:10.359Z","repository":{"id":202851581,"uuid":"708269312","full_name":"sheepla/go-urlbuilder","owner":"sheepla","description":"🔗 A Go module to easily build URL string with concise syntax","archived":false,"fork":false,"pushed_at":"2023-10-26T11:30:45.000Z","size":19,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-17T00:27:48.119Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sheepla.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}},"created_at":"2023-10-22T03:17:16.000Z","updated_at":"2023-11-14T07:35:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"e7c8b994-d232-4d5b-80ef-4e37f4b52aad","html_url":"https://github.com/sheepla/go-urlbuilder","commit_stats":null,"previous_names":["sheepla/go-urlbuilder"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheepla%2Fgo-urlbuilder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheepla%2Fgo-urlbuilder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheepla%2Fgo-urlbuilder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheepla%2Fgo-urlbuilder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sheepla","download_url":"https://codeload.github.com/sheepla/go-urlbuilder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224208313,"owners_count":17273674,"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","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-12T02:40:41.281Z","updated_at":"2024-11-12T02:40:41.860Z","avatar_url":"https://github.com/sheepla.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# 🔗 go-urlbuilder\n\n\u003c/div\u003e\n\n**go-urlbuilder** is a Go module based on `net/url` standard module, aimed at safely constructing URL strings with a concise syntax.\n\n## Why?\n\nIt is a good idea to use the `net/url` standard module when safely constructing URL strings. \nHowever, if you use `net/url` as is, you often need to prepare temporary variables, and have to write non-declaretive code which I felt was a bit cumbersome when building complex URLs over and over again.\n\nThis module was created as a concise and easy way to construct URL strings based on `net/url`.\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"net/url\"\n\n\t\"github.com/sheepla/go-urlbuilder\"\n)\n\nvar sourceURL = \"https://localhost:8080/path/to/resource#helloworld?key1=value1\u0026key2=value2\"\n\nfunc main() {\n\tu := urlbuilder.MustParse(sourceURL)\n\n\tu.SetScheme(\"http\").\n\t\tSetHost(\"example.com:12345\").\n\t\tSetFragment(\"anotherFragment\").\n\t\tEditPath(func(elements []string) []string {\n\t\t\treturn append(elements, \"Go言語\")\n\t\t}).\n\t\tEditQuery(func(q url.Values) url.Values {\n\t\t\tq.Set(\"key1\", \"key1-edited\")\n\t\t\tq.Del(\"key2\")\n\t\t\tq.Add(\"key3\", \"value3\")\n\n\t\t\treturn q\n\t\t})\n\n\t// =\u003e http://example.com:12345/path/to/resource/Go%25E8%25A8%2580%25E8%25AA%259E?key1=key1-edited\u0026key3=value3#anotherFragment\n\tfmt.Println(u.MustString())\n}\n```\n\n## License\n\nMIT\n\n## Author\n\n[sheepla](https://github.com/sheepla)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheepla%2Fgo-urlbuilder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsheepla%2Fgo-urlbuilder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheepla%2Fgo-urlbuilder/lists"}