{"id":20604885,"url":"https://github.com/allaboutapps/integresql-client-go","last_synced_at":"2025-04-15T02:28:26.827Z","repository":{"id":144210083,"uuid":"257259210","full_name":"allaboutapps/integresql-client-go","owner":"allaboutapps","description":"Client library for interacting with a IntegreSQL server, managing isolated PostgreSQL databases for your integration tests.","archived":false,"fork":false,"pushed_at":"2024-02-06T11:44:06.000Z","size":36,"stargazers_count":24,"open_issues_count":5,"forks_count":2,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-28T14:11:53.543Z","etag":null,"topics":["client-library","go","golang","id-allaboutapps-backend","integration-testing","postgres","postgresql"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/allaboutapps/integresql-client-go?tab=doc","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/allaboutapps.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-04-20T11:26:29.000Z","updated_at":"2025-01-20T19:48:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"962670f3-ea92-4b9b-b1d3-7b36afb4615e","html_url":"https://github.com/allaboutapps/integresql-client-go","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allaboutapps%2Fintegresql-client-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allaboutapps%2Fintegresql-client-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allaboutapps%2Fintegresql-client-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allaboutapps%2Fintegresql-client-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allaboutapps","download_url":"https://codeload.github.com/allaboutapps/integresql-client-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248993366,"owners_count":21195184,"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":["client-library","go","golang","id-allaboutapps-backend","integration-testing","postgres","postgresql"],"created_at":"2024-11-16T09:25:25.676Z","updated_at":"2025-04-15T02:28:26.818Z","avatar_url":"https://github.com/allaboutapps.png","language":"Go","readme":"# IntegreSQL Client Library for Golang\r\n\r\nClient library for interacting with a [`IntegreSQL` server](https://github.com/allaboutapps/integresql), managing isolated PostgreSQL databases for your integration tests.\r\n\r\n## Overview [![](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white)](https://pkg.go.dev/github.com/allaboutapps/integresql-client-go?tab=doc) [![](https://goreportcard.com/badge/github.com/allaboutapps/integresql-client-go)](https://goreportcard.com/report/github.com/allaboutapps/integresql-client-go) ![](https://github.com/allaboutapps/integresql-client-go/workflows/build/badge.svg?branch=master)\r\n\r\n## Table of Contents\r\n\r\n- [Background](#background)\r\n- [Install](#install)\r\n- [Configuration](#configuration)\r\n- [Usage](#usage)\r\n- [Contributing](#contributing)\r\n    - [Development setup](#development-setup)\r\n    - [Development quickstart](#development-quickstart)\r\n- [Maintainers](#maintainers)\r\n- [License](#license)\r\n\r\n## Background\r\n\r\nSee [IntegreSQL: Background](https://github.com/allaboutapps/integresql#background)\r\n\r\n## Install\r\n\r\nInstall the `IntegreSQL` client for Go using `go get` or by simply importing the library in your testing code (go modules, see below):\r\n\r\n```bash\r\ngo get github.com/allaboutapps/integresql-client-go\r\n```\r\n\r\n## Configuration\r\n\r\nThe `IntegreSQL` client library requires little configuration which can either be passed via the `ClientConfig` struct or parsed from environment variables automatically. The following settings are available:\r\n\r\n| Description                                                | Environment variable            | Default                        | Required |\r\n| ---------------------------------------------------------- | ------------------------------- | ------------------------------ | -------- |\r\n| IntegreSQL: base URL of server `http://127.0.0.1:5000/api` | `INTEGRESQL_CLIENT_BASE_URL`    | `\"http://integresql:5000/api\"` |          |\r\n| IntegreSQL: API version of server                          | `INTEGRESQL_CLIENT_API_VERSION` | `\"v1\"`                         |          |\r\n\r\n\r\n## Usage\r\n\r\nIf you want to take a look on how we integrate IntegreSQL - 🤭 - please just try our [go-starter](https://github.com/allaboutapps/go-starter) project or take a look at our [testing setup code](https://github.com/allaboutapps/go-starter/blob/master/internal/test/testing.go). \r\n\r\nIn general setting up the `IntegreSQL` client, initializing a PostgreSQL template (migrate + seed) and retrieving a PostgreSQL test database goes like this:\r\n\r\n```go\r\npackage yourpkg\r\n\r\nimport (\r\n    \"github.com/allaboutapps/integresql-client-go\"\r\n    \"github.com/allaboutapps/integresql-client-go/pkg/util\"\r\n)\r\n\r\nfunc doStuff() error {\r\n    c, err := integresql.DefaultClientFromEnv()\r\n    if err != nil {\r\n        return err\r\n    }\r\n\r\n    // compute a hash over all database related files in your workspace (warm template cache)\r\n    hash, err := hash.GetTemplateHash(\"/app/scripts/migrations\", \"/app/internal/fixtures/fixtures.go\")\r\n    if err != nil {\r\n        return err\r\n    }\r\n\r\n    template, err := c.InitializeTemplate(context.TODO(), hash)\r\n    if err != nil {\r\n        return err\r\n    }\r\n\r\n    // Use template database config received to initialize template\r\n    // e.g. by applying migrations and fixtures\r\n\r\n    if err := c.FinalizeTemplate(context.TODO(), hash); err != nil {\r\n        return err\r\n    }\r\n\r\n    test, err := c.GetTestDatabase(context.TODO(), hash)\r\n    if err != nil {\r\n        return err\r\n    }\r\n\r\n    // Use test database config received to run integration tests in isolated DB\r\n}\r\n```\r\n\r\nA very basic example has been added as the `cmd/cli` executable, you can build it using `make cli` and execute `integresql-cli` afterwards.\r\n\r\n## Contributing\r\n\r\nPull requests are welcome. For major changes, please [open an issue](https://github.com/allaboutapps/integresql/issues/new) first to discuss what you would like to change.\r\n\r\nPlease make sure to update tests as appropriate.\r\n\r\n### Development setup\r\n\r\n`IntegreSQL` requires the following local setup for development:\r\n\r\n- [Docker CE](https://docs.docker.com/install/) (19.03 or above)\r\n- [Docker Compose](https://docs.docker.com/compose/install/) (1.25 or above)\r\n\r\nThe project makes use of the [devcontainer functionality](https://code.visualstudio.com/docs/remote/containers) provided by [Visual Studio Code](https://code.visualstudio.com/) so no local installation of a Go compiler is required when using VSCode as an IDE.\r\n\r\nShould you prefer to develop the `IntegreSQL` client library without the Docker setup, please ensure a working [Go](https://golang.org/dl/) (1.14 or above) environment has been configured as well as an `IntegreSQL` server and a a PostgreSQL instance are available (tested against PostgreSQL version 12 or above, but *should* be compatible to lower versions) and the appropriate environment variables have been configured as described in the [Install](#install) section.\r\n\r\n### Development quickstart\r\n\r\n1. Start the local docker-compose setup and open an interactive shell in the development container:\r\n\r\n```bash\r\n# Build the development Docker container, start it and open a shell\r\n./docker-helper.sh --up\r\n```\r\n\r\n2. Initialize the project, downloading all dependencies and tools required (executed within the dev container):\r\n\r\n```bash\r\n# Init dependencies/tools\r\nmake init\r\n\r\n# Build executable (generate, format, build, vet)\r\nmake\r\n```\r\n\r\n3. Execute project tests:\r\n\r\n```bash\r\n# Execute tests\r\nmake test\r\n```\r\n\r\n## Maintainers\r\n\r\n- [Nick Müller - @MorpheusXAUT](https://github.com/MorpheusXAUT)\r\n- [Mario Ranftl - @majodev](https://github.com/majodev)\r\n\r\n## License\r\n\r\n[MIT](LICENSE) © 2020 aaa – all about apps GmbH | Nick Müller | Mario Ranftl and the `IntegreSQL` project contributors","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallaboutapps%2Fintegresql-client-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallaboutapps%2Fintegresql-client-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallaboutapps%2Fintegresql-client-go/lists"}