{"id":24926747,"url":"https://github.com/michaelwp/go-gcs-wrapper","last_synced_at":"2025-03-28T12:26:19.691Z","repository":{"id":245676131,"uuid":"818842054","full_name":"michaelwp/go-gcs-wrapper","owner":"michaelwp","description":"go-gcs-wrapper is a library that makes it easy for Go applications to interact with Google Cloud Storage. This wrapper handles the complex details of the Google Cloud Storage API, allowing developers to use storage features with less code and effort","archived":false,"fork":false,"pushed_at":"2024-06-23T10:00:02.000Z","size":219,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-02T12:53:10.356Z","etag":null,"topics":["cloud","gcs","gcswrapper","go","google","gopackage","storage","wrapper"],"latest_commit_sha":null,"homepage":"https://goblog.dev/articles/28","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/michaelwp.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":"2024-06-23T03:08:36.000Z","updated_at":"2024-07-02T14:02:25.000Z","dependencies_parsed_at":"2024-06-23T11:03:33.131Z","dependency_job_id":null,"html_url":"https://github.com/michaelwp/go-gcs-wrapper","commit_stats":null,"previous_names":["michaelwp/go-gcs-wrapper"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2Fgo-gcs-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2Fgo-gcs-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2Fgo-gcs-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelwp%2Fgo-gcs-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelwp","download_url":"https://codeload.github.com/michaelwp/go-gcs-wrapper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246028445,"owners_count":20712017,"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":["cloud","gcs","gcswrapper","go","google","gopackage","storage","wrapper"],"created_at":"2025-02-02T12:53:16.084Z","updated_at":"2025-03-28T12:26:19.668Z","avatar_url":"https://github.com/michaelwp.png","language":"Go","readme":"# go-gcs-wrapper\ngo-gcs-wrapper is a library that makes it easy for Go applications to interact with Google Cloud Storage. \nIt provides simple functions for tasks like uploading files and generating signed URLs for secure access. \nThis wrapper handles the complex details of the Google Cloud Storage API, allowing developers to use storage features \nwith less code and effort.\n\n### installation\n```shell\ngo get -d github.com/michaelwp/go-gcs-wrapper\n```\n\n### basic of use\n- Upload file\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"github.com/joho/godotenv\"\n\tgogcswrapper \"github.com/michaelwp/go-gcs-wrapper\"\n\t\"log\"\n\t\"os\"\n)\n\nfunc init() {\n\terr := godotenv.Load(\".env\")\n\tif err != nil {\n\t\tlog.Fatal(\"Error loading .env file\", err)\n\t}\n}\n\nfunc main() {\n\tprojectId := os.Getenv(\"GOOGLE_APPLICATION_PROJECT_ID\")\n\tbucket := os.Getenv(\"GOOGLE_APPLICATION_BUCKET\")\n\tobject := \"go_gcs.png\"\n\tuploadObjPath := \"upload_tes\"\n\tlocalObjPath := \".\"\n\n\tctx := context.Background()\n\tgcs := gogcswrapper.NewGCS(ctx, projectId)\n\n\tparams := \u0026gogcswrapper.UploadParams{\n\t\tBucketAndObject: \u0026gogcswrapper.BucketAndObject{\n\t\t\tBucket: bucket,\n\t\t\tObject: object,\n\t\t},\n\t\tLocalObjPath:  localObjPath,\n\t\tUploadObjPath: uploadObjPath,\n\t}\n\n\terr := gcs.Upload(ctx, params)\n\tif err != nil {\n\t\tlog.Fatal(\"error uploading file\", err)\n\t}\n}\n```\n\n- Generate signed Url\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"github.com/joho/godotenv\"\n\tgogcswrapper \"github.com/michaelwp/go-gcs-wrapper\"\n\t\"log\"\n\t\"os\"\n\t\"time\"\n)\n\nfunc init() {\n\terr := godotenv.Load(\".env\")\n\tif err != nil {\n\t\tlog.Fatal(\"Error loading .env file\", err)\n\t}\n}\n\nfunc main() {\n\tprojectId := os.Getenv(\"GOOGLE_APPLICATION_PROJECT_ID\")\n\tbucket := os.Getenv(\"GOOGLE_APPLICATION_BUCKET\")\n\tobject := \"go_gcs.png\"\n\tuploadObjPath := \"upload_tes\"\n\n\tctx := context.Background()\n\tgcs := gogcswrapper.NewGCS(ctx, projectId)\n\n\tparams := \u0026gogcswrapper.GenerateSignedURLParams{\n\t\tBucketAndObject: \u0026gogcswrapper.BucketAndObject{\n\t\t\tBucket: bucket,\n\t\t\tObject: object,\n\t\t},\n\t\tUploadObjPath:  uploadObjPath,\n\t\tExpirationTime: time.Now().Add(time.Minute * 10),\n\t}\n\n\tsignedUrl, err := gcs.GenerateSignedURL(params)\n\tif err != nil {\n\t\tlog.Fatal(\"error generating sign url\", err)\n\t}\n\n\tfmt.Printf(\"Signed URL: %s\\n\", signedUrl)\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelwp%2Fgo-gcs-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelwp%2Fgo-gcs-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelwp%2Fgo-gcs-wrapper/lists"}