{"id":25014360,"url":"https://github.com/gregoryv/ex","last_synced_at":"2025-06-17T03:34:34.021Z","repository":{"id":57487327,"uuid":"128048694","full_name":"gregoryv/ex","owner":"gregoryv","description":"go package for writing simpler examples","archived":false,"fork":false,"pushed_at":"2020-05-02T06:38:40.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T05:13:21.126Z","etag":null,"topics":["example","go","golang","http","json","test"],"latest_commit_sha":null,"homepage":"","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/gregoryv.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-04T10:48:44.000Z","updated_at":"2020-06-21T07:48:45.000Z","dependencies_parsed_at":"2022-09-01T22:51:19.557Z","dependency_job_id":null,"html_url":"https://github.com/gregoryv/ex","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/gregoryv/ex","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregoryv%2Fex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregoryv%2Fex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregoryv%2Fex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregoryv%2Fex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gregoryv","download_url":"https://codeload.github.com/gregoryv/ex/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gregoryv%2Fex/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260286059,"owners_count":22986497,"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":["example","go","golang","http","json","test"],"created_at":"2025-02-05T07:19:10.470Z","updated_at":"2025-06-17T03:34:33.995Z","avatar_url":"https://github.com/gregoryv.png","language":"Go","readme":"[![Build Status](https://travis-ci.org/gregoryv/ex.svg?branch=master)](https://travis-ci.org/gregoryv/ex)\n[![codecov](https://codecov.io/gh/gregoryv/ex/branch/master/graph/badge.svg)](https://codecov.io/gh/gregoryv/ex)\n\n[ex](https://godoc.org/github.com/gregoryv/ex) - implements interfaces which write output to stdout\n\nThis is useful for writing short Examples in go, eg. when testing output\nfrom http handlers.\n\n## Examples\n\nWriters implement the http.ResponseWriter interface\n\n### JsonWriter\n\n    r := bytes.NewBufferString(`{\"name\":\"John\",\"car\":{\"model\":\"x,2\",\"plate\":\"abc123\"}}`)\n\tio.Copy(jsonWriter, r)\n\t\nOutput:\n\n    {\n        \"name\":\"John\",\n        \"car\":{\n            \"model\":\"x,2\",\n            \"plate\":\"abc123\"\n        }\n    }\n\n\n### StatusWriter\n\n    w := NewStatusWriter()\n    w.Write([]byte(\"Hello, world!\"))\n\t\nOutput:\n\n    200\n\t\n\t\n### BodyWriter\n\n    bodyWriter.Write([]byte(\"Hello, world!\"))\n\t\nOutput:\n\n    Hello, world!\n\t\n\t\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregoryv%2Fex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgregoryv%2Fex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgregoryv%2Fex/lists"}