{"id":13411639,"url":"https://github.com/kak-tus/nan","last_synced_at":"2026-01-12T01:03:26.650Z","repository":{"id":44569031,"uuid":"261574716","full_name":"kak-tus/nan","owner":"kak-tus","description":"Zero allocation Nullable structures in one library with handy conversion functions, marshallers and unmarshallers","archived":false,"fork":false,"pushed_at":"2023-07-06T13:16:40.000Z","size":732,"stargazers_count":86,"open_issues_count":0,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-05-15T23:42:08.877Z","etag":null,"topics":["golang"],"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/kak-tus.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-05T20:20:54.000Z","updated_at":"2025-05-02T06:36:17.000Z","dependencies_parsed_at":"2024-06-18T22:59:36.313Z","dependency_job_id":"9dfb755a-6874-40d6-acd6-89f51c018c3f","html_url":"https://github.com/kak-tus/nan","commit_stats":null,"previous_names":["kak-tus/nel"],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/kak-tus/nan","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kak-tus%2Fnan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kak-tus%2Fnan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kak-tus%2Fnan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kak-tus%2Fnan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kak-tus","download_url":"https://codeload.github.com/kak-tus/nan/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kak-tus%2Fnan/sbom","scorecard":{"id":547992,"data":{"date":"2025-08-11","repo":{"name":"github.com/kak-tus/nan","commit":"3a108dd710da3c573b70590f8ab6de40fb8c9248"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1","Warn: no topLevel permission defined: .github/workflows/go.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":1,"reason":"Found 3/27 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/kak-tus/nan/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/kak-tus/nan/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:55: update your workflow using https://app.stepsecurity.io/secureworkflow/kak-tus/nan/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:69: update your workflow using https://app.stepsecurity.io/secureworkflow/kak-tus/nan/codeql-analysis.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/kak-tus/nan/go.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/kak-tus/nan/go.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/go.yml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/kak-tus/nan/go.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/go.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/kak-tus/nan/go.yml/master?enable=pin","Warn: downloadThenRun not pinned by hash: .github/workflows/go.yml:27","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   0 out of   1 downloadThenRun dependencies pinned","Info:   1 out of   1 goCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":7,"reason":"SAST tool detected but not run on all commits","details":["Info: SAST configuration detected: CodeQL","Warn: 0 commits out of 6 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T10:01:56.969Z","repository_id":44569031,"created_at":"2025-08-20T10:01:56.969Z","updated_at":"2025-08-20T10:01:56.969Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28330169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T00:36:25.062Z","status":"ssl_error","status_checked_at":"2026-01-12T00:36:15.229Z","response_time":60,"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":["golang"],"created_at":"2024-07-30T20:01:15.274Z","updated_at":"2026-01-12T01:03:26.634Z","avatar_url":"https://github.com/kak-tus.png","language":"Go","funding_links":[],"categories":["Go","数据结构","Data Structures and Algorithms","数据结构与算法","Generators","数据结构`go语言实现的数据结构与算法`","Data Integration Frameworks","Data Structures","Uncategorized"],"sub_categories":["标准 CLI","Nullable Types","可空类型","Advanced Console UIs"],"readme":"# nan - **N**o **A**llocations **N**evermore\n\nPackage nan - Zero allocation Nullable structures in one library with handy conversion functions,\nmarshallers and unmarshallers.\n\n[![Godoc](https://godoc.org/github.com/kak-tus/nan?status.svg)](https://pkg.go.dev/github.com/kak-tus/nan?tab=doc)\n[![Coverage Status](https://coveralls.io/repos/github/kak-tus/nan/badge.svg?branch=master)](https://coveralls.io/github/kak-tus/nan?branch=master)\n[![Go Report Card](https://goreportcard.com/badge/github.com/kak-tus/nan)](https://goreportcard.com/report/github.com/kak-tus/nan)\n![Go](https://github.com/kak-tus/nan/workflows/Go/badge.svg)\n\nFeatures:\n- short name \"nan\"\n- handy conversion functions\n- select which marshalers you want and limit dependencies to only those you actually need\n- ability to convert your custom structs to nan compatible type with Valid field and all requested encoders/decoders\n\nSupported types:\n- bool\n- float32\n- float64\n- int\n- int8\n- int16\n- int32\n- int64\n- string\n- time.Time\n- uint\n- uint8\n- uint16\n- uint32\n- uint64\n- more types will be added as necessary\n\nSupported marshallers:\n- Standart JSON\n- encoding.TextMarshaler/TextUnmarshaler. Reuses standard JSON logic and format\n- jsoniter\n- easyjson\n- go-json\n- Scylla and Cassandra. Compatible with gocql\n- SQL\n\n## Usage\n\nSimply create struct field or variable with one of the exported types and use it without any changes to external API.\n\nJSON input/output will be converted to null or non null values. Scylla and Cassandra will use wire format compatible\nwith gocql.\n\n```\nvar data struct {\n  Code nan.NullString `json:\"code\"`\n}\n\nb, err := jsoniter.Marshal(data)\nif err != nil {\n  panic(err)\n}\n\n// {\"code\":null}\nprintln(string(b))\n\ndata.Code = nan.String(\"1\")\n// Equals to\n// data.Code = nan.NullString{String: \"1\", Valid: true}\n\nb, err = jsoniter.Marshal(data)\nif err != nil {\n  panic(err)\n}\n\n// {\"code\":\"1\"}\nprintln(string(b))\n\ncode := \"2\"\n\n// From addr. Can has value or be nil\ndata.Code = nan.StringAddr(\u0026code)\n\nb, err = jsoniter.Marshal(data)\nif err != nil {\n  panic(err)\n}\n\n// {\"code\":\"2\"}\nprintln(string(b))\n\n// To usual value from nan\ncodeVal := data.Code.String\n\n// 2\nprintln(codeVal)\n\n// To value addr from nan\ncodeAddr := data.Code.Addr()\n\n// 2\nprintln(*codeAddr)\n```\n\n## Helpers\n\nHow often you write something like this?\n\n```\nval := true\naddr := \u0026val\n```\n\nWith nan helpers you can write shorter\n\n```\naddr := nan.Bool(true).Addr()\n```\n\nWith this you got less lines of code without readability loose.\n\n## Generate marshalers\n\n```\n# go install github.com/kak-tus/nan/cmd/nan@latest\n# nan -help\n```\n\nInstead of depending on the whole github.com/kak-tus/nan you can also use `nan` command to select which marshalers you want. Simply run `nan` with one or more arguments and it will generate implementations for the specified marshalers in the current directory. For example, running\n```\n# nan gen -json -jsoniter\n```\nwill generate nan.go, json.go, jsoniter.go files in the current working directory that contain only encoding/json and jsoniter marshalers. Nothing else will be generated so you don't have to depend on all the marshalers that github.com/kak-tus/nan supports. Generated files will use current directory name as its package name. You can also specify your own package name with `-pkg` argument.\n\n## Custom structs generator\n\nImagine, that you have custom struct\n\n```\ntype MyStruct struct {\n\tID   int\n\tName string\n}\n```\n\nUse nan command on its file\n\n```\n# nan extra -json -jsoniter example/structs.go\n```\n\nThis will generate *_nan.go near source files with json (or any other supported marshallers). And now you have nan compatible struct with all needed marshallers\n\n```\nvar val MyStruct\n\nnullVal := NanMyStruct(val)\n// Equals to\n// nullVal := NullMyStruct{MyStruct: val, Valid: true}\n\nfmt.Println(nullVal.ID)\n```\n\nSee [example](./example/README.md) to specific of easyjson, cql, sql generation.\n\nnan extra coommand supports any number of file names at command line.\n\n## Benchmarks\n\n[See here](./bench/README.md).\n\n## sqlc integration\n\n[See here](./sqlc.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkak-tus%2Fnan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkak-tus%2Fnan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkak-tus%2Fnan/lists"}