{"id":3853765,"name":"github.com/jba/codec","ecosystem":"go","description":"Package codec implements an encoder for Go values. It relies on code generation\nrather than reflection, so it is significantly faster than reflection-based\nencoders like gob. It can also preserve sharing among pointers (but not other\nforms of sharing, like sub-slices).\n\nEncodings with maps are not deterministic, due to the non-deterministic order of\nmap iteration.\n\nThe package supports Go built-in types (int, string and so on) out of the box,\nbut for any other type you must generate code by calling GenerateFile. This can\nbe done with a small program in your project's directory:\n\nCode will be generated for each type listed and for all types they contain. So\nthis program will generate code for []mypkg.Type1, mypkg.Type1, *mypkg.Type2,\nand mypkg.Type2.\n\nThe \"//+build ignore\" tag prevents the program from being compiled as part of\nyour package. Instead, invoke it directly with \"go run\". Use \"go generate\" to do\nso if you like:\n\nOn subsequent runs, the generator reads the generated file to get the names and\norder of all struct fields. It uses this information to generate correct code\nwhen fields are moved or added. Make sure the old generated files remain\navailable to the generator, or changes to your structs may result in existing\nencoded data being decoded incorrectly.\n\nCreate an Encoder by passing it an io.Writer:\n\nThen use it to encode one or more values:\n\nTo decode, pass an io.Reader to NewDecoder, and call Decode:\n\nBy default, if two pointers point to the same value, that value will be\nduplicated upon decoding. If there is a cycle, where a value directly or\nindirectly points to itself, then the encoder will crash by exceeding available\nstack space. This is the same behavior as encoding/gob and many other encoders.\n\nSet EncodeOptions.TrackPointers to true to preserve pointer sharing and cycles,\nat the cost of slower encoding.\n\nOther forms of memory sharing are not preserved. For example, if two slices\nrefer to the same underlying array during encoding, they will refer to separate\narrays after decoding.\n\nStruct tags in the style of encoding/json are supported, under the name \"codec\".\nYou can easily generate code for structs designed for the encoding/json package\nby changing the name to \"json\" in an option to GenerateFile.\n\nAn example:\n\nHere, field A will use the name \"B\" and field C will be omitted. There is no\nneed for the omitempty option because the encoder always omits zero values.\n\nSince the encoding uses numbers for fields instead of names, renaming a field\ndoesn't actually affect the encoding. It does matter if subsequent changes are\nmade to the struct, however. For example, say that originally T was\n\nbut you rename the field to \"B\":\n\nThe generator will treat \"B\" as a new field. Data encoded with \"A\" will not be\ndecoded into \"B\". So you should use a tag to express that it is a renaming:","homepage":"https://github.com/jba/codec","licenses":"BSD-3-Clause","normalized_licenses":["BSD-3-Clause"],"repository_url":"https://github.com/jba/codec","keywords_array":[],"namespace":"github.com/jba","versions_count":6,"first_release_published_at":"2021-01-17T15:52:03.000Z","latest_release_published_at":"2021-02-15T22:31:15.000Z","latest_release_number":"v0.4.1","last_synced_at":"2026-04-15T02:05:11.664Z","created_at":"2022-04-11T21:19:40.716Z","updated_at":"2026-04-15T02:05:11.664Z","registry_url":"https://pkg.go.dev/github.com/jba/codec","install_command":"go get github.com/jba/codec","documentation_url":"https://pkg.go.dev/github.com/jba/codec#section-documentation","metadata":{},"repo_metadata":{"uuid":"326736757","full_name":"jba/codec","owner":"jba","description":"A fast encoder for Go.","archived":false,"fork":false,"pushed_at":"2021-02-15T22:31:45.000Z","size":48765,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2023-03-07T15:37:14.300Z","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":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"logo_url":null,"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}},"created_at":"2021-01-04T16:05:43.000Z","updated_at":"2021-08-17T10:38:04.000Z","dependencies_parsed_at":"2022-08-14T02:00:47.867Z","dependency_job_id":null,"html_url":"https://github.com/jba/codec","commit_stats":null,"repository_url":"http://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jba%2Fcodec","tags_url":"http://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jba%2Fcodec/tags","manifests_url":"http://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jba%2Fcodec/manifests","owner_url":"http://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jba","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":108921946,"host_url":"http://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"http://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"http://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names"}},"repo_metadata_updated_at":"2023-03-21T19:09:47.926Z","dependent_packages_count":0,"downloads":null,"downloads_period":null,"dependent_repos_count":1,"rankings":{"downloads":null,"dependent_repos_count":4.726210113019375,"dependent_packages_count":9.55954712080186,"stargazers_count":9.743536810965626,"forks_count":18.850625625073906,"docker_downloads_count":null,"average":10.719979917465192},"purl":"pkg:golang/github.com/jba/codec","advisories":[],"docker_usage_url":"https://docker.ecosyste.ms/usage/go/github.com/jba/codec","docker_dependents_count":null,"docker_downloads_count":null,"usage_url":"https://repos.ecosyste.ms/usage/go/github.com/jba/codec","dependent_repositories_url":"https://repos.ecosyste.ms/api/v1/usage/go/github.com/jba/codec/dependencies","status":null,"funding_links":[],"critical":null,"issue_metadata":{"last_synced_at":"2023-05-18T09:38:42.901Z","issues_count":0,"pull_requests_count":1,"avg_time_to_close_issue":null,"avg_time_to_close_pull_request":597168.0,"issues_closed_count":0,"pull_requests_closed_count":1,"pull_request_authors_count":1,"issue_authors_count":0,"avg_comments_per_issue":null,"avg_comments_per_pull_request":0.0,"merged_pull_requests_count":1,"bot_issues_count":0,"bot_pull_requests_count":0,"past_year_issues_count":0,"past_year_pull_requests_count":0,"past_year_avg_time_to_close_issue":null,"past_year_avg_time_to_close_pull_request":null,"past_year_issues_closed_count":0,"past_year_pull_requests_closed_count":0,"past_year_pull_request_authors_count":0,"past_year_issue_authors_count":0,"past_year_avg_comments_per_issue":null,"past_year_avg_comments_per_pull_request":null,"past_year_bot_issues_count":0,"past_year_bot_pull_requests_count":0,"past_year_merged_pull_requests_count":0},"versions_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fjba%2Fcodec/versions","version_numbers_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fjba%2Fcodec/version_numbers","dependent_packages_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fjba%2Fcodec/dependent_packages","related_packages_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fjba%2Fcodec/related_packages","codemeta_url":"https://packages.ecosyste.ms/api/v1/registries/proxy.golang.org/packages/github.com%2Fjba%2Fcodec/codemeta","maintainers":[]}