{"id":17925946,"url":"https://github.com/shoenig/extractors","last_synced_at":"2025-03-24T03:31:16.642Z","repository":{"id":41622452,"uuid":"193140080","full_name":"shoenig/extractors","owner":"shoenig","description":"Go library for defining a schema to extract values from environment variables, URL paths, or html Forms","archived":true,"fork":false,"pushed_at":"2024-11-26T14:10:01.000Z","size":64,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-20T08:33:18.008Z","etag":null,"topics":["environment-variables","extract","extractor","extractors","go","golang","golang-library","html-form","url"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shoenig.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":"2019-06-21T17:58:38.000Z","updated_at":"2024-12-15T23:41:03.000Z","dependencies_parsed_at":"2024-03-06T04:30:13.232Z","dependency_job_id":"7388c929-540c-4516-b62c-950f1af5717b","html_url":"https://github.com/shoenig/extractors","commit_stats":{"total_commits":36,"total_committers":3,"mean_commits":12.0,"dds":0.5555555555555556,"last_synced_commit":"0d6ba0adf6ee4a2e89de9f3ccf3c493141922bd2"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoenig%2Fextractors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoenig%2Fextractors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoenig%2Fextractors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoenig%2Fextractors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shoenig","download_url":"https://codeload.github.com/shoenig/extractors/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245204544,"owners_count":20577370,"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":["environment-variables","extract","extractor","extractors","go","golang","golang-library","html-form","url"],"created_at":"2024-10-28T20:58:29.586Z","updated_at":"2025-03-24T03:31:16.128Z","avatar_url":"https://github.com/shoenig.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"extractors\n==========\n\nThe `extractors` module provides libraries for defining a schema to easily and safely extract values from environment variables,\nURL path elements, and HTML form values.\n\n![GitHub](https://img.shields.io/github/license/shoenig/extractors.svg)\n[![Run CI Tests](https://github.com/shoenig/extractors/actions/workflows/ci.yaml/badge.svg)](https://github.com/shoenig/extractors/actions/workflows/ci.yaml)\n\n\n# Getting Started\n\nThe `extractors` package can be installed by running\n\n```shell-session\ngo get github.com/shoenig/extractors@latest\n```\n\n```go\nimport (\n    github.com/shoenig/extractors/env      // extract values from environment variables\n    github.com/shoenig/extractors/urlpath  // extract elements from url paths\n    github.com/shoenig/extractors/formdata // extract values from html data\n)\n```\n\n#### env example\n\nUse the `env` package to parse values from environment variables.\n\n```go\nimport github.com/shoenig/go-conceal // for storing sensitive values\n```\n\n```go\nvar (\n    go111module string\n    sshPID      int\n    password    *conceal.Text\n)\n\n_ = env.ParseOS(env.Schema{\n    \"GO111MODULE\":   env.String(\u0026go111module, false),\n    \"SSH_AGENT_PID\": env.Int(\u0026sshPID, true),\n    \"PASSWORD\":      env.Secret(\u0026password, true),\n})\n```\n\n#### formdata example\n\nUse the `formdata` package to parse values from `url.Values` (typically coming\nfrom ``*http.Request.Form` objects from inbound requests.\n\n```go\n// typically coming from a *http.Request.Form\nvalues := url.Values{\n    \"user\":     []string{\"bob\"},\n    \"age\":      []string{\"45\"},\n}\n\nvar (\n    user string\n    age  int\n)\n\n_ = formdata.Parse(values, formdata.Schema{\n    \"user\": formdata.String(\u0026user),\n    \"age\":  formdata.Int(\u0026age),\n})\n```\n\n#### urlpath example\n\nUse the `urlpath` package to parse URL path elements when using a `gorilla/mux`\nrouter.\n\n```go\n// with a mux handler definition like\nrouter.Handle(\"/{kind}/{id}\")\n\n// in the handler implementation, parse the *http.Request URL with\nvar (\n    kind string\n    id   int\n)\n\n_ = urlpath.Parse(request, urlpath.Schema{\n    \"kind\": urlpath.String(\u0026kind),\n    \"id\":   urlpath.Int(\u0026id),\n})\n```\n\n# Contributing\n\nThe `github.com/shoenig/extractors` module is always improving with new features\nand error corrections. For contributing bug fixes and new features please file an issue.\n\n# License\n\nThe `github.com/shoenig/extractors` module is open source under the [BSD-3-Clause](LICENSE) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshoenig%2Fextractors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshoenig%2Fextractors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshoenig%2Fextractors/lists"}