{"id":37162233,"url":"https://github.com/riptl/go-binary","last_synced_at":"2026-01-14T19:18:34.287Z","repository":{"id":96132302,"uuid":"464223522","full_name":"riptl/go-binary","owner":"riptl","description":"Encoding/decoding in Borsh and other formats.","archived":false,"fork":true,"pushed_at":"2022-08-21T06:35:02.000Z","size":232,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-13T21:25:52.804Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"gagliardetto/binary","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/riptl.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,"governance":null}},"created_at":"2022-02-27T18:46:04.000Z","updated_at":"2022-08-20T12:07:26.000Z","dependencies_parsed_at":"2023-07-17T20:20:18.442Z","dependency_job_id":null,"html_url":"https://github.com/riptl/go-binary","commit_stats":null,"previous_names":["terorie/binary","riptl/go-binary","terorie/go-binary"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/riptl/go-binary","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riptl%2Fgo-binary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riptl%2Fgo-binary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riptl%2Fgo-binary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riptl%2Fgo-binary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/riptl","download_url":"https://codeload.github.com/riptl/go-binary/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riptl%2Fgo-binary/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28432244,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T18:57:19.464Z","status":"ssl_error","status_checked_at":"2026-01-14T18:52:48.501Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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-14T19:18:33.643Z","updated_at":"2026-01-14T19:18:34.279Z","avatar_url":"https://github.com/riptl.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# binary\n\n\n### Borsh\n\n#### Decoding borsh\n\n```golang\n dec := bin.NewBorshDecoder(data)\n var meta token_metadata.Metadata\n err = dec.Decode(\u0026meta)\n if err != nil {\n   panic(err)\n }\n```\n\n#### Encoding borsh\n\n```golang\nbuf := new(bytes.Buffer)\nenc := bin.NewBorshEncoder(buf)\nerr := enc.Encode(meta)\nif err != nil {\n  panic(err)\n}\n// fmt.Print(buf.Bytes())\n```\n\n### Optional Types\n\n```golang\ntype Person struct {\n\tName string\n\tAge  uint8 `bin:\"optional\"`\n}\n```\n\nRust equivalent:\n```rust\nstruct Person {\n    name: String,\n    age: Option\u003cu8\u003e\n}\n```\n\n### Enum Types\n\n```golang\ntype MyEnum struct {\n\tEnum  bin.BorshEnum `borsh_enum:\"true\"`\n\tOne   bin.EmptyVariant\n\tTwo   uint32\n\tThree int16\n}\n```\n\nRust equivalent:\n```rust\nenum MyEnum {\n    One,\n    Two(u32),\n    Three(i16),\n}\n```\n\n### Exported vs Unexported Fields\n\nIn this example, the `two` field will be skipped by the encoder/decoder because the\nfield is not exported.\n```golang\ntype MyStruct struct {\n\tOne   string\n\ttwo   uint32\n\tThree int16\n}\n```\n\n### Skip Decoding/Encoding Attributes\n\nEncoding/Decoding of exported fields can be skipped using the `borsh_skip` tag.\n```golang\ntype MyStruct struct {\n\tOne   string\n\tTwo   uint32 `borsh_skip:\"true\"`\n\tThree int16\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friptl%2Fgo-binary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friptl%2Fgo-binary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friptl%2Fgo-binary/lists"}