{"id":38346390,"url":"https://github.com/randree/gormseeder","last_synced_at":"2026-01-17T03:03:48.705Z","repository":{"id":57626728,"uuid":"402413251","full_name":"randree/gormseeder","owner":"randree","description":"A simple go database seeder powered by GROM","archived":false,"fork":false,"pushed_at":"2021-09-02T12:48:47.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-07-27T22:33:33.102Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/randree.png","metadata":{"files":{"readme":"README.md","changelog":"history.go","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":"2021-09-02T12:32:01.000Z","updated_at":"2023-04-18T09:01:13.000Z","dependencies_parsed_at":"2022-08-31T09:12:37.378Z","dependency_job_id":null,"html_url":"https://github.com/randree/gormseeder","commit_stats":null,"previous_names":[],"tags_count":1,"template":null,"template_full_name":null,"purl":"pkg:github/randree/gormseeder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randree%2Fgormseeder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randree%2Fgormseeder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randree%2Fgormseeder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randree%2Fgormseeder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/randree","download_url":"https://codeload.github.com/randree/gormseeder/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/randree%2Fgormseeder/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28492597,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T02:39:23.645Z","status":"ssl_error","status_checked_at":"2026-01-17T02:34:19.649Z","response_time":85,"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":[],"created_at":"2026-01-17T03:03:48.612Z","updated_at":"2026-01-17T03:03:48.683Z","avatar_url":"https://github.com/randree.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GORMSeeder - A simple database seeder based on GORM\n\nThe GORMSeeder is a lightweight but powerful and flexible seeder tool based on GORM. Especially useful in container environments like Docker.\n\nThe goal is to create a build of your seeder setup.\n\n## Steps for deployment\n\n* Create a go build\n* Putting build in a `FROM scratch AS bin` container for minimal size\n* Deploy\n* Start service or container with environment variables to perform a seed on database\n\n## Example\n\nSee example under `example/` to see how it works.\n\nThe folder looks like \n```bash\n├── Seeder\n│   ├── main.go\n│   ├── seed00001_create-mock-user.go\n│   ├── seed00002_create-locales.go\n│   └── seed00003_create-products.go\n    ...\n```\n\n`seed`-files can have any names.\n\nExample for `main.go`:\n```golang\npackage main\n\nimport (\n\t\"fmt\"\n\n\tgs \"github.com/randree/gormseeder\"\n\t\"gorm.io/driver/postgres\"\n\t\"gorm.io/gorm\"\n)\n\nfunc main() {\n\tdb, err := gorm.Open(postgres.Open(\"host=localhost user=user password=passpass dbname=testdb port=5432 sslmode=disable\"))\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t}\n\n\tgs.InitSeeder(db, \"seeders\")\n}\n```\n\n`seed`-files (e.g. `seed001_mock-user-list.go`) looks like:\n```golang\npackage main\n\nimport (\n\tgs \"github.com/randree/gormseeder\"\n\t\"gorm.io/gorm\"\n)\n\nfunc init() {\n\tgs.Seed(gs.State{\n\n\t\tTag: \"\u003ctag-name\u003e\",\n\n\t\tPerform: func(db *gorm.DB) error {\n\t\t\t\n\t\t\t...\n\n\t\t\treturn err\n\t\t},\n\t})\n}\n```\n\n## Create and use module\n\nSteps to create a go module:\n```console\n$ go mod init Seeder\n```\nTo load dependencies:\n```console\n$ go mod tidy\n```\n\nTo run a Seeder:\n```console\n$ TAG=\u003ctag-name\u003e (go run ./... | \u003cgo-build\u003e)\n```\n\nWith `TAG=all` you can perform all seeds in one go.\n\nTo show a Seeder history:\n```console\n$ HISTORY=1 (go run ./... | \u003cgo-build\u003e)\n\n| DATETIME HISTORY                       | FILENAME                  | USER       |\n| -------------------------------------- | ------------------------- | ---------- |\n| 2021-08-31 13:09:47.932619 +0200 CEST  | seed003_mock-user-list.go | admin      |\n| 2021-08-31 13:09:47.908876 +0200 CEST  | seed002_mock-products.go  | foo        |\n| 2021-08-31 13:09:47.871357 +0200 CEST  | seed001_customers.go      | bar        |\n```\n\nTo show version:\n```console\n$ VERSION=1 (go run ./... | \u003cgo-build\u003e)\n\nGormseeder version:  0.1.0\n```\n\n### Calls\n\n```console\n$ TAG=\u003cTag\u003e [HISTORY=1] [VERSION=1] (Docker Container | go build | go run ./...)\n```\nDocker-compose file\n```yaml\n...\n  migrator:\n    image: from_scratch_image\n    environment:\n      TAG: \u003cTag\u003e\n...\n\n```\nIf you want to seed everything use `TAG=all`.\n\n## References\n\n- [GROM](https://gorm.io/) The GORM project.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandree%2Fgormseeder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frandree%2Fgormseeder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frandree%2Fgormseeder/lists"}