{"id":20534229,"url":"https://github.com/gookit/gsr","last_synced_at":"2025-04-14T06:53:28.443Z","repository":{"id":43415837,"uuid":"370879584","full_name":"gookit/gsr","owner":"gookit","description":"Go Standards Recommendations - common interfaces. e.g: cache, logger. Golang 一些通用的接口定义","archived":false,"fork":false,"pushed_at":"2024-03-11T15:49:22.000Z","size":26,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T20:41:09.367Z","etag":null,"topics":["go-cache","go-logger","golang","golang-interface","interface-design","logger"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/gookit/gsr","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/gookit.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":"2021-05-26T02:07:23.000Z","updated_at":"2023-07-18T09:15:10.000Z","dependencies_parsed_at":"2024-03-11T22:00:17.871Z","dependency_job_id":null,"html_url":"https://github.com/gookit/gsr","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gookit%2Fgsr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gookit%2Fgsr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gookit%2Fgsr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gookit%2Fgsr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gookit","download_url":"https://codeload.github.com/gookit/gsr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248837281,"owners_count":21169374,"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":["go-cache","go-logger","golang","golang-interface","interface-design","logger"],"created_at":"2024-11-16T00:25:53.134Z","updated_at":"2025-04-14T06:53:28.421Z","avatar_url":"https://github.com/gookit.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GSR\n\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/gookit/gsr?style=flat-square)\n[![GoDoc](https://godoc.org/github.com/gookit/gsr?status.svg)](https://pkg.go.dev/github.com/gookit/gsr)\n[![Go Report Card](https://goreportcard.com/badge/github.com/gookit/gsr)](https://goreportcard.com/report/github.com/gookit/gsr)\n\nGo Standards Recommendations\n\n## Install\n\n```bash\ngo get github.com/gookit/gsr\n```\n\n## Interfaces\n\n- [logger](logger.go)\n- [cacher](cacher.go)\n- [parser](parser.go)\n\n## Usage\n\n### Logger Interface\n\n**Std Logger**\n\n```go\npackage main\nimport (\n\t\"github.com/gookit/gsr\"\n)\n\ntype MyApp struct {\n\tlogger gsr.StdLogger // std logger\n}\n\nfunc (ma *MyApp) SetLogger(logger gsr.StdLogger)  {\n\tma.logger = logger\n}\n```\n\n**Full Logger**\n\n```go\npackage main\nimport (\n\t\"github.com/gookit/gsr\"\n)\n\ntype MyApp struct {\n\tlogger gsr.Logger // full logger\n}\n\nfunc (ma *MyApp) SetLogger(logger gsr.Logger)  {\n\tma.logger = logger\n}\n```\n\n### Cache Interface\n\n**Simple Cache**\n\n```go\npackage main\nimport (\n\t\"github.com/gookit/gsr\"\n)\n\ntype MyApp struct {\n\tcacher gsr.SimpleCacher\n}\n\nfunc (ma *MyApp) SetCacher(cacher gsr.SimpleCacher)  {\n\tma.cacher = cacher\n}\n```\n\n### DataParser interface\n\n```go\n// DataParser interface for Marshal/Unmarshal data\ntype DataParser interface {\n\tMarshal(v any) ([]byte, error)\n\tUnmarshal(data []byte, ptr any) error\n}\n```\n\n## LICENSE\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgookit%2Fgsr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgookit%2Fgsr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgookit%2Fgsr/lists"}