{"id":22189039,"url":"https://github.com/mikunalpha/utils","last_synced_at":"2025-03-24T20:19:12.383Z","repository":{"id":134176881,"uuid":"77994779","full_name":"mikunalpha/utils","owner":"mikunalpha","description":"Common utilities for developing within Go","archived":false,"fork":false,"pushed_at":"2017-01-11T05:59:42.000Z","size":8,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T00:41:21.484Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikunalpha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-01-04T08:04:18.000Z","updated_at":"2017-05-09T11:56:13.000Z","dependencies_parsed_at":"2024-08-13T11:02:59.535Z","dependency_job_id":null,"html_url":"https://github.com/mikunalpha/utils","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikunalpha%2Futils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikunalpha%2Futils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikunalpha%2Futils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikunalpha%2Futils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikunalpha","download_url":"https://codeload.github.com/mikunalpha/utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245343981,"owners_count":20599867,"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":[],"created_at":"2024-12-02T11:14:26.521Z","updated_at":"2025-03-24T20:19:12.365Z","avatar_url":"https://github.com/mikunalpha.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# utils\n\n### Get new ptr of common type\n```Go\nfunc NewPtrString(s string) *string {}\nfunc NewPtrBool(s bool) *bool {}\nfunc NewPtrInt(i int) *int {}\nfunc NewPtrInt8(i int8) *int8 {}\nfunc NewPtrInt16(i int16) *int16 {}\nfunc NewPtrInt32(i int32) *int32 {}\nfunc NewPtrInt64(i int32) *int64 {}\nfunc NewPtrUint(i uint) *uint {}\nfunc NewPtrUint8(i uint8) *uint8 {}\nfunc NewPtrUint16(i uint16) *uint16 {}\nfunc NewPtrUint32(i uint32) *uint32 {}\nfunc NewPtrUint64(i uint32) *uint64 {}\nfunc NewPtrFloat32(f float32) *float32 {}\nfunc NewPtrFloat64(f float64) *float64 {}\n```\n\n### Utils of slice of common type\n```Go\ntype SliceOfString []string\nfunc (sos SliceOfString) Unique() []string {}\nfunc (sos SliceOfString) InSlice(t string) bool {}\n\ntype SliceOfPtrString []*string\nfunc (sos SliceOfPtrString) Unique() []*string {}\nfunc (sos SliceOfPtrString) InSlice(t string) bool {}\n\ntype SliceOfBool []bool\nfunc (sos SliceOfBool) Unique() []bool {}\nfunc (sos SliceOfBool) InSlice(t bool) bool {}\n\ntype SliceOfPtrBool []*bool\nfunc (sos SliceOfPtrBool) Unique() []*bool {}\nfunc (sos SliceOfPtrBool) InSlice(t bool) bool {}\n\ntype SliceOfInt []int\nfunc (soi SliceOfInt) Unique() []int {}\nfunc (soi SliceOfInt) InSlice(t int) bool {}\n\ntype SliceOfPtrInt []*int\nfunc (sopi SliceOfPtrInt) Unique() []*int {}\nfunc (sopi SliceOfPtrInt) InSlice(t int) bool {}\n\n// type SliceOfInt8 ...\n// type SliceOfInt16 ...\n// type SliceOfInt32 ...\n// type SliceOfInt64 ...\n// type SliceOfPtrInt8 ...\n// type SliceOfPtrInt16 ...\n// type SliceOfPtrInt32 ...\n// type SliceOfPtrInt64 ...\n\n// type SliceOfUint ...\n// type SliceOfUint8 ...\n// type SliceOfUint16 ...\n// type SliceOfUint32 ...\n// type SliceOfUint64 ...\n// type SliceOfPtrUint ...\n// type SliceOfPtrUint8 ...\n// type SliceOfPtrUint16 ...\n// type SliceOfPtrUint32 ...\n// type SliceOfPtrUint64 ...\n\n// type SliceOfFloat32 ...\n// type SliceOfFloat64 ...\n// type SliceOfPtrFloat32 ...\n// type SliceOfPtrFloat64 ...\n```\n\n### Get copy of http Request body\n```Go\nfunc GetRequestBody(r *http.Request) []byte {}\n```\n\n### Get variable from ENV or from file\n```Go\nfunc LoadEnvs(path string) {}\nfunc EnvString(key string, spare string) string {}\nfunc EnvBool(key string, spare bool) bool {}\nfunc EnvInt(key string, spare int64) int64 {}\nfunc EnvFloat(key string, spare float64) float64 {}\n```\nThe file format as below:\n```\nVAR1=abc\nVAR2=true\nVAR3=10\nVAR4=1.5\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikunalpha%2Futils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikunalpha%2Futils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikunalpha%2Futils/lists"}