{"id":21403995,"url":"https://github.com/csmadhu/gob","last_synced_at":"2026-04-19T10:33:02.795Z","repository":{"id":57540576,"uuid":"288920493","full_name":"csmadhu/gob","owner":"csmadhu","description":"Bulk Inserts to Postgres, MySQL, Cassandra","archived":false,"fork":false,"pushed_at":"2020-09-15T19:08:59.000Z","size":95,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-16T16:44:11.185Z","etag":null,"topics":["cassandra","golang","mysql","postgresql"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csmadhu.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}},"created_at":"2020-08-20T06:03:53.000Z","updated_at":"2020-10-30T03:43:13.000Z","dependencies_parsed_at":"2022-09-26T18:30:39.650Z","dependency_job_id":null,"html_url":"https://github.com/csmadhu/gob","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/csmadhu/gob","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csmadhu%2Fgob","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csmadhu%2Fgob/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csmadhu%2Fgob/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csmadhu%2Fgob/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csmadhu","download_url":"https://codeload.github.com/csmadhu/gob/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csmadhu%2Fgob/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32004036,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cassandra","golang","mysql","postgresql"],"created_at":"2024-11-22T16:11:30.694Z","updated_at":"2026-04-19T10:33:02.750Z","avatar_url":"https://github.com/csmadhu.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gob\nBulk upserts to PostgreSQL, MySQL, Cassandra\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/csmadhu/gob)](https://goreportcard.com/report/github.com/csmadhu/gob)\n[![GoDoc](https://godoc.org/github.com/csmadhu/gob?status.svg)](https://pkg.go.dev/github.com/csmadhu/gob?tab=doc)\n[![Conventional Commit](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n[![Gitmoji](https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg?style=flat-square)](https://gitmoji.carloscuesta.me)\n[![Go](https://github.com/csmadhu/gob/workflows/Go/badge.svg)](https://github.com/csmadhu/gob/actions)\n![Supported Go Versions](https://img.shields.io/badge/Go-1.15+-lightgrey.svg)\n[![GitHub Release](https://img.shields.io/github/release/csmadhu/gob.svg)](https://github.com/csmadhu/gob/releases)\n[![License](https://img.shields.io/badge/license-GPL%20(%3E%3D%202)-blue)](https://github.com/csmadhu/gob/blob/master/LICENSE)\n\n---------------------------------------\n  * [Installation](#installation)\n  * [Usage](#usage)\n  * [Options](#options)\n  * [Examples](#examples)\n---------------------------------------\n\n## Installation\n```bash\ngo get -u github.com/csmadhu/gob\n```\n\n# Usage\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/csmadhu/gob\"\n)\n\nfunc main() {\n\tg, err := gob.New(gob.WithDBProvider(gob.DBProviderPg),\n\t\tgob.WithDBConnStr(\"postgres://postgres:postgres@localhost:5432/gob?pool_max_conns=1\"))\n\tif err != nil {\n\t\tlog.Fatalf(\"init gob; err: %v\", err)\n\t}\n\tdefer g.Close()\n\n\t// upsert records to table student\n\tvar rows []gob.Row\n\tfor i := 0; i \u003c 10; i++ {\n\t\trow := gob.NewRow()\n\t\trow.Add(\"name\", fmt.Sprintf(\"foo-%d\", i))\n\t\trow.Add(\"age\", 20)\n\n\t\trows = append(rows, row)\n\t}\n\n\tif err := g.Upsert(context.Background(), gob.UpsertArgs{\n\t\tModel:          \"students\",\n\t\tKeys:           []string{\"name\"},\n\t\tConflictAction: gob.ConflictActionUpdate,\n\t\tRows:           rows}); err != nil {\n\t\tlog.Fatalf(\"upsert students; err: %v\", err)\n\t}\n}\n```\n\n## Options\nAll options are optional. Options not applicable to Database provider is ignored.\n\n\u003ctable\u003e\n\t\u003ctr\u003e\n\t\t\u003cth\u003eoption\u003c/th\u003e\n\t\t\u003cth\u003edescription\u003c/th\u003e\n\t\t\u003cth\u003etype\u003c/th\u003e\n\t\t\u003cth\u003edefault\u003c/th\u003e\n\t\t\u003cth\u003eDB providers\u003c/th\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eWithBatchSize\u003c/b\u003e\u003c/th\u003e\n\t\t\u003ctd\u003eTransaction Batch Size\u003c/td\u003e\n\t\t\u003ctd\u003eint\u003c/td\u003e\n\t\t\u003ctd\u003e10000\u003c/td\u003e\n\t\t\u003ctd\u003e\u003cul\u003e\u003cli\u003ePostgreSQL\u003c/li\u003e\u003cli\u003eMySQL\u003c/li\u003e\u003c/ul\u003e\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eWithDBProvider\u003c/b\u003e\u003c/th\u003e\n\t\t\u003ctd\u003eDatabase provider\u003c/td\u003e\n\t\t\u003ctd\u003egob.DBProvider\u003c/td\u003e\n\t\t\u003ctd\u003eDBProviderPg\u003c/td\u003e\n\t\t\u003ctd\u003e\n\t\t\t\u003cul\u003e\n\t\t\t\t\u003cli\u003ePostgreSQL\u003c/li\u003e\n\t\t\t\t\u003cli\u003eMySQL\u003c/li\u003e\n\t\t\t\t\u003cli\u003eCassandra\u003c/li\u003e\n\t\t\t\u003c/ul\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eWithDBConnStr\u003c/b\u003e\u003c/th\u003e\n\t\t\u003ctd\u003eDB URL/DSN\n\t\t\t\u003cul\u003e\n\t\t\t\t\u003cli\u003ePostgreSQL \u003cb\u003epostgres://username:password@host:port/batabase\u003c/b\u003e\u003cbr\u003e\n\t\t\t\t\tReferences\n\t\t\t\t\t\t\u003cul\u003e\n\t\t\t\t\t\t\t\u003cli\u003ehttps://pkg.go.dev/github.com/jackc/pgconn?tab=doc#ParseConfig\u003c/li\u003e\n\t\t\t\t\t\t\t\u003cli\u003ehttps://pkg.go.dev/github.com/jackc/pgx/v4?tab=doc#ParseConfig\u003c/li\u003e\n\t\t\t\t\t\t\u003c/ul\u003e\n\t\t\t\t\u003c/li\u003e\n\t\t\t\t\u003cli\u003eMySQL \u003cb\u003eusername:password@(host:port)/database\u003c/b\u003e\u003c/li\u003e\n\t\t\t\t\u003cli\u003eCassandra \u003cb\u003e\u003cnobr\u003ecassandra://username:password@host1--host2--host3:port/keyspace?consistency=quorum\u0026compressor=snappy\u0026tokenAware=true\u003c/nobr\u003e\u003c/b\u003e\u003cbr\u003e\n\t\t\t\t\tReferences\n\t\t\t\t\t\t\u003cul\u003e\n\t\t\t\t\t\t\u003cli\u003ehttps://godoc.org/github.com/gocql/gocql#Consistency\u003c/li\u003e\n\t\t\t\t\t\t\u003cli\u003ehttps://godoc.org/github.com/gocql/gocql#Compressor\u003c/li\u003e\n\t\t\t\t\t\t\u003cli\u003ehttps://godoc.org/github.com/gocql/gocql#PoolConfig\u003c/li\u003e\n\t\t\t\t\t\t\u003cli\u003ehttps://godoc.org/github.com/gocql/gocql#HostSelectionPolicy\u003c/li\u003e\n\t\t\t\t\t\t\u003cli\u003ehttps://godoc.org/github.com/gocql/gocql#TokenAwareHostPolicy\u003c/li\u003e\n\t\t\t\t\t\t\u003c/ul\u003e\n\t\t\t\t\u003c/li\u003e\n\t\t\t\u003c/ul\u003e\n\t\t\u003c/td\u003e\n\t\t\u003ctd\u003estring\u003c/td\u003e\n\t\t\u003ctd\u003e\u003cnobr\u003epostgres://postgres:postgres@localhost:5432/gob?pool_max_conns=1\u003c/nobr\u003e\u003c/td\u003e\n\t\t\u003ctd\u003e\n\t\t\t\u003cul\u003e\n\t\t\t\t\u003cli\u003ePostgreSQL\u003c/li\u003e\n\t\t\t\t\u003cli\u003eMySQL\u003c/li\u003e\n\t\t\t\t\u003cli\u003eCassandra\u003c/li\u003e\n\t\t\t\u003c/ul\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eWithConnIdleTime\u003c/b\u003e\u003c/th\u003e\n\t\t\u003ctd\u003eMaximum amount of time conn may be idle\u003c/td\u003e\n\t\t\u003ctd\u003etime.Duration\u003c/td\u003e\n\t\t\u003ctd\u003e3 second\u003c/td\u003e\n\t\t\u003ctd\u003e\n\t\t\t\u003cul\u003e\n\t\t\t\t\u003cli\u003ePostgreSQL\u003c/li\u003e\n\t\t\t\t\u003cli\u003eMySQL\u003c/li\u003e\n\t\t\t\u003c/ul\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eWithConnLifeTime\u003c/b\u003e\u003c/th\u003e\n\t\t\u003ctd\u003eMaximum amount of time conn may be reused\u003c/td\u003e\n\t\t\u003ctd\u003etime.Duration\u003c/td\u003e\n\t\t\u003ctd\u003e3 second\u003c/td\u003e\n\t\t\u003ctd\u003e\n\t\t\t\u003cul\u003e\n\t\t\t\t\u003cli\u003ePostgreSQL\u003c/li\u003e\n\t\t\t\t\u003cli\u003eMySQL\u003c/li\u003e\n\t\t\t\t\u003cli\u003eCassandra\u003c/li\u003e\n\t\t\t\u003c/ul\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eWithIdleConns\u003c/b\u003e\u003c/th\u003e\n\t\t\u003ctd\u003eMaximum number of connections idle in pool\u003c/td\u003e\n\t\t\u003ctd\u003eint\u003c/td\u003e\n\t\t\u003ctd\u003e2\u003c/td\u003e\n\t\t\u003ctd\u003e\n\t\t\t\u003cul\u003e\n\t\t\t\t\u003cli\u003ePostgreSQL\u003c/li\u003e\n\t\t\t\t\u003cli\u003eMySQL\u003c/li\u003e\n\t\t\t\u003c/ul\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\t\u003ctr\u003e\n\t\t\u003ctd\u003e\u003cb\u003eWithOpenConns\u003c/b\u003e\u003c/th\u003e\n\t\t\u003ctd\u003eMaximum number of connections open to database\u003c/td\u003e\n\t\t\u003ctd\u003eint\u003c/td\u003e\n\t\t\u003ctd\u003e10\u003c/td\u003e\n\t\t\u003ctd\u003e\n\t\t\t\u003cul\u003e\n\t\t\t\t\u003cli\u003ePostgreSQL\u003c/li\u003e\n\t\t\t\t\u003cli\u003eMySQL\u003c/li\u003e\n\t\t\t\t\u003cli\u003eCassandra\u003c/li\u003e\n\t\t\t\u003c/ul\u003e\n\t\t\u003c/td\u003e\n\t\u003c/tr\u003e\n\u003c/table\u003e\n\n## Examples\nExamples for supported Database provider can be found [here](https://github.com/csmadhu/gob/tree/master/examples)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsmadhu%2Fgob","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsmadhu%2Fgob","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsmadhu%2Fgob/lists"}