{"id":21949794,"url":"https://github.com/dogukanayd/go-test-database","last_synced_at":"2026-04-17T15:33:37.876Z","repository":{"id":144211273,"uuid":"263129510","full_name":"dogukanayd/go-test-database","owner":"dogukanayd","description":"go-test-database","archived":false,"fork":false,"pushed_at":"2020-05-26T22:19:11.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-11T05:45:46.284Z","etag":null,"topics":["docker","docker-sdk","go","golang","test-automation","testing","unit-testing","unittest"],"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/dogukanayd.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":"2020-05-11T18:50:57.000Z","updated_at":"2020-05-26T22:19:13.000Z","dependencies_parsed_at":"2023-08-15T23:56:40.898Z","dependency_job_id":null,"html_url":"https://github.com/dogukanayd/go-test-database","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/dogukanayd/go-test-database","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dogukanayd%2Fgo-test-database","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dogukanayd%2Fgo-test-database/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dogukanayd%2Fgo-test-database/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dogukanayd%2Fgo-test-database/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dogukanayd","download_url":"https://codeload.github.com/dogukanayd/go-test-database/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dogukanayd%2Fgo-test-database/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31934352,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T12:37:54.787Z","status":"ssl_error","status_checked_at":"2026-04-17T12:37:25.095Z","response_time":62,"last_error":"SSL_read: 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":["docker","docker-sdk","go","golang","test-automation","testing","unit-testing","unittest"],"created_at":"2024-11-29T05:36:27.619Z","updated_at":"2026-04-17T15:33:37.861Z","avatar_url":"https://github.com/dogukanayd.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-test-database\n#### What this package does?\nThis package creates up and running mysql container(using docker sdk) for your applications and returns a connection\nto the created database, so you can easily query the test database.\n\n![alt text](https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcS_5LAwzTqOQRs8pYq_fJHA8n7djUMdcgkeR2Qg69ajuggKXhgm\u0026usqp=CAU)\n\n# Requirements\n* :3305 port must not be used\n* docker\n\n# INSTALL\n```bash\ngo get github.com/dogukanayd/go-test-database\n``` \n\n# USAGE\nLet's say you have a package named greetings also in this package you have a function named `Hello`\nand this function send some query to the database, well from at this point you need a database separated\nfrom your local database. Here is all you need to do.\n\n```go\nconnection, def := mysql_unit.NewUnit()\n```\n\nand below you can find full dummy example\n\n```go\npackage greetings\n\nimport (\n\tmysql_unit \"github.com/dogukanayd/go-test-database/mysql-unit\"\n\t\"log\"\n\t\"testing\"\n)\n\nfunc TestHello(t *testing.T) {\n\tconnection, def := mysql_unit.NewUnit()\n\n\tq := `CREATE TABLE test_table(id int(11),name varchar(500)) ENGINE = InnoDB  DEFAULT CHARSET = utf8;`\n\t_, err := connection.Query(q)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tdefer def()\n\n\tt.Log(\"ping success\")\n}\n```\n\nWhen you call the `NewUnit` function;\n```go\nconnection, tearDown := NewUnit()\n```\nit's return two parameters;\n * connection: *sql.DB // connection that allows you to query the database \n * tearDown\n \nhere is the defination of the `NewUnit` function;\n```go\nfunc NewUnit() (*sql.DB, func()) {}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdogukanayd%2Fgo-test-database","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdogukanayd%2Fgo-test-database","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdogukanayd%2Fgo-test-database/lists"}