{"id":31584177,"url":"https://github.com/itzg/try-postgres-arrays","last_synced_at":"2025-10-06T00:46:17.061Z","repository":{"id":296657378,"uuid":"991007886","full_name":"itzg/try-postgres-arrays","owner":"itzg","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-27T01:51:51.000Z","size":49,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-21T18:17:14.824Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itzg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-05-27T01:48:05.000Z","updated_at":"2025-07-21T04:11:44.000Z","dependencies_parsed_at":"2025-06-01T15:05:38.641Z","dependency_job_id":"4585a7f0-fcbf-4e7d-9a85-cab0c5a5f631","html_url":"https://github.com/itzg/try-postgres-arrays","commit_stats":null,"previous_names":["itzg/try-postgres-arrays"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/itzg/try-postgres-arrays","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzg%2Ftry-postgres-arrays","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzg%2Ftry-postgres-arrays/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzg%2Ftry-postgres-arrays/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzg%2Ftry-postgres-arrays/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itzg","download_url":"https://codeload.github.com/itzg/try-postgres-arrays/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzg%2Ftry-postgres-arrays/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278542685,"owners_count":26004061,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"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":[],"created_at":"2025-10-06T00:46:14.554Z","updated_at":"2025-10-06T00:46:17.057Z","avatar_url":"https://github.com/itzg.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"Tries out:\n- [Postgres array types](https://www.postgresql.org/docs/current/arrays.html)\n- [Spring Data JDBC](https://docs.spring.io/spring-data/relational/reference/jdbc.html)\n- [Liquibase](https://docs.liquibase.com/start/home.html)\n\n## Info\n\nEntity class is declared with a [list field](https://docs.spring.io/spring-data/relational/reference/jdbc/mapping.html#jdbc.entity-persistence.types), `tags`:\n\n```java\n@Table(\"tasks\")\npublic record Task(\n    @Id\n    Long id,\n    String name,\n    List\u003cString\u003e tags\n) {\n}\n```\n\nIn the Liquibase changeset's [createTable](https://docs.liquibase.com/change-types/create-table.html) [columns](https://docs.liquibase.com/change-types/nested-tags/column.html), the type accepts array syntax:\n\n```yaml\n  - column:\n      name: tags\n      type: text[]\n```\n\nA [custom query method in the repository interface](https://docs.spring.io/spring-data/relational/reference/jdbc/query-methods.html#jdbc.query-methods.at-query) can be created to retrieve all the tags:\n\n```java\npublic interface TaskRepository extends CrudRepository\u003cTask, Long\u003e {\n    @Query(\"SELECT DISTINCT unnest(tags) AS tag FROM tasks ORDER BY tag\")\n    List\u003cString\u003e findAllTags();\n}\n```\n\n## Usage\n\nStart the Spring Boot app, which starts Postgres via [Compose support](https://docs.spring.io/spring-boot/reference/features/dev-services.html#features.dev-services.docker-compose).\n\nCreate a task with tags\n\n```http request\nPOST http://localhost:8080/tasks\nContent-Type: application/json\n\n{\n    \"name\": \"test3\",\n    \"tags\": [\"blue\", \"green\"]\n}\n```\n\nRetrieve tasks\n\n```http request\nGET http://localhost:8080/tasks\n```\n\nRetrieve all task tags\n\n```http request\nGET http://localhost:8080/task-tags\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitzg%2Ftry-postgres-arrays","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitzg%2Ftry-postgres-arrays","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitzg%2Ftry-postgres-arrays/lists"}