{"id":36454569,"url":"https://github.com/hidevopsio/formbinder","last_synced_at":"2026-01-11T23:01:40.203Z","repository":{"id":252742161,"uuid":"840983991","full_name":"hidevopsio/formBinder","owner":"hidevopsio","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-11T09:46:47.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-12T08:11:33.431Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hidevopsio.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":"2024-08-11T09:46:27.000Z","updated_at":"2024-08-12T08:11:35.831Z","dependencies_parsed_at":"2024-08-12T08:21:38.194Z","dependency_job_id":null,"html_url":"https://github.com/hidevopsio/formBinder","commit_stats":null,"previous_names":["hidevopsio/formbinder"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hidevopsio/formBinder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hidevopsio%2FformBinder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hidevopsio%2FformBinder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hidevopsio%2FformBinder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hidevopsio%2FformBinder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hidevopsio","download_url":"https://codeload.github.com/hidevopsio/formBinder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hidevopsio%2FformBinder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28326166,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T22:11:01.104Z","status":"ssl_error","status_checked_at":"2026-01-11T22:10:58.990Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-01-11T23:01:39.704Z","updated_at":"2026-01-11T23:01:40.194Z","avatar_url":"https://github.com/hidevopsio.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Iris Form Binder for `context.ReadForm`\n======\n\nform-binder is a clone of the [formam](https://github.com/monoculum/forma) package, slightly edited to use the \"form\" tag instead of \"formam\".\n\nFeatures\n--------\n\n* Nesting ad infinitum in `maps`, `structs` and `slices`.\n* `UnmarshalText` in values and keys of maps.\n* the `map`'s key supported are: `string`, `int` and variants, `uint` and variants, `uintptr`, `float32`, `float64`, `bool`, `struct`, `custom types` to one of the above types registered by function or `UnmarshalText` method, a `pointer` to one of the above types\n* A field with `interface{}` that has a `map`, `struct` or `slice` as value is perfectly possible access to them! (see example below)\n* decode `time.Time` with format \"2006-01-02\" by its UnmarshalText method.\n* decode `url.URL`\n* The `slice` and `array` is possible to access without to indicate a index (If it is the last field, of course)`\n* You can to register a `func` for a `custom type` for all fields that include it or one in particular! (see example below)\n\nTypes\n-----\n\nThe supported field types in the destination struct are:\n\n* `string`\n* `bool`\n* `int`, `int8`, `int16`, `int32`, `int64`\n* `uint`, `uint8`, `uint16`, `uint32`, `uint64`\n* `float32`, `float64`\n* `slice`, `array`\n* `struct` and `struct anonymous`\n* `map`\n* `interface{}`\n* `time.Time`\n* `url.URL`\n* `custom types` to one of the above types\n* a `pointer` to one of the above types\n\n**NOTE**: the nesting in `maps`, `structs` and `slices` can be ad infinitum.\n\nUsage\n-----\n\n### Client-side - in form html\n\n- Use symbol `.` for access a field of a struct. (i.e, `struct.field1`)\n- Use `[\u003cindex\u003e]` for access to index of a slice/array. (i.e, `struct.array[0]`). If the array/slice is the last field of the path, it is not necessary to indicate the index\n- Use `[\u003ckey\u003e]` for access to key of a map. (i.e, `struct.map[es-ES]`).\n\n```html\n\u003c!-- file: views/form.html --\u003e\n\u003cform method=\"POST\"\u003e\n  \u003cinput type=\"text\" name=\"Name\" value=\"Sony\"/\u003e\n  \u003cinput type=\"text\" name=\"Location.Country\" value=\"Japan\"/\u003e\n  \u003cinput type=\"text\" name=\"Location.City\" value=\"Tokyo\"/\u003e\n  \u003cinput type=\"text\" name=\"Products[0].Name\" value=\"Playstation 4\"/\u003e\n  \u003cinput type=\"text\" name=\"Products[0].Type\" value=\"Video games\"/\u003e\n  \u003cinput type=\"text\" name=\"Products[1].Name\" value=\"TV Bravia 32\"/\u003e\n  \u003cinput type=\"text\" name=\"Products[1].Type\" value=\"TVs\"/\u003e\n  \u003cinput type=\"text\" name=\"Founders[0]\" value=\"Masaru Ibuka\"/\u003e\n  \u003cinput type=\"text\" name=\"Founders[0]\" value=\"Akio Morita\"/\u003e\n  \u003cinput type=\"text\" name=\"Employees\" value=\"90000\"/\u003e\n  \u003cinput type=\"text\" name=\"public\" value=\"true\"/\u003e\n  \u003cinput type=\"url\" name=\"website\" value=\"http://www.sony.net\"/\u003e\n  \u003cinput type=\"date\" name=\"foundation\" value=\"1946-05-07\"/\u003e\n  \u003cinput type=\"text\" name=\"Interface.ID\" value=\"12\"/\u003e\n  \u003cinput type=\"text\" name=\"Interface.Name\" value=\"Go Programming Language\"/\u003e\n  \u003cinput type=\"submit\"/\u003e\n\u003c/form\u003e\n```\n\n### Server-Side - in iris app\n\n```go\n\n// file: main.go\npackage main\n\nimport (\n    \"net/url\"\n    \"time\"\n\n    \"github.com/kataras/iris\"\n)\n\ntype InterfaceStruct struct {\n    ID   int\n    Name string\n}\n\ntype Company struct {\n  Public     bool      `form:\"public\"`\n  Website    url.URL   `form:\"website\"`\n  Foundation time.Time `form:\"foundation\"`\n  Name       string\n  Location   struct {\n    Country  string\n    City     string\n  }\n  Products   []struct {\n    Name string\n    Type string\n  }\n  Founders   []string\n  Employees  int64\n\n  Interface interface{}\n}\n\nfunc main() {\n    app := iris.New()\n    app.RegisterView(iris.HTML(\"./views\", \".html\"))\n\n    app.Get(\"/\", func(ctx iris.Context) {\n        ctx.View(\"form.html\")\n    })\n\n    // IMPORTANT\n    app.Post(\"/\", func(ctx iris.Context) {\n        m := Company{\n            Interface: \u0026InterfaceStruct{}, // its is possible to access to the fields although it's an interface field!\n        }\n        err := ctx.ReadForm(\u0026m)\n        if err != nil {\n            ctx.StatusCode(iris.StatusBadRequest)\n            ctx.WriteString(err.Error())\n        }\n    })\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhidevopsio%2Fformbinder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhidevopsio%2Fformbinder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhidevopsio%2Fformbinder/lists"}