{"id":13481577,"url":"https://github.com/slick/slick","last_synced_at":"2025-05-13T00:04:38.643Z","repository":{"id":506252,"uuid":"133684","full_name":"slick/slick","owner":"slick","description":"Slick (Scala Language Integrated Connection Kit) is a modern database query and access library for Scala","archived":false,"fork":false,"pushed_at":"2025-05-01T23:24:04.000Z","size":12481,"stargazers_count":2658,"open_issues_count":428,"forks_count":614,"subscribers_count":140,"default_branch":"main","last_synced_at":"2025-05-13T00:04:11.756Z","etag":null,"topics":["database","scala","sql"],"latest_commit_sha":null,"homepage":"https://scala-slick.org/","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slick.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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},"funding":{"github":["nafg"]}},"created_at":"2009-02-20T22:51:53.000Z","updated_at":"2025-05-12T18:39:49.000Z","dependencies_parsed_at":"2023-07-05T15:02:56.778Z","dependency_job_id":"f022af59-7062-42ca-b0fe-a89bbd791209","html_url":"https://github.com/slick/slick","commit_stats":{"total_commits":2318,"total_committers":210,"mean_commits":"11.038095238095238","dds":0.5280414150129422,"last_synced_commit":"dce2d0489ba74c0d9e5e5206279e01146f46559e"},"previous_names":[],"tags_count":81,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slick%2Fslick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slick%2Fslick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slick%2Fslick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slick%2Fslick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slick","download_url":"https://codeload.github.com/slick/slick/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253843211,"owners_count":21972873,"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":["database","scala","sql"],"created_at":"2024-07-31T17:00:53.005Z","updated_at":"2025-05-13T00:04:38.608Z","avatar_url":"https://github.com/slick.png","language":"Scala","readme":"# Slick\n\n[![Sponsor1Badge]][Sponsor1Link]\n\n\n[![MavenBadge]][MavenLink]\n\n[![DiscussionsBadge]][DiscussionsLink]\n[![DiscordBadge]][DiscordLink]\n[![GitterBadge]][GitterLink]\n\n[Sponsor1Badge]: https://img.shields.io/github/sponsors/nafg?label=Sponsor%20@nafg\n[Sponsor1Link]: https://github.com/sponsors/nafg\n\n[MavenBadge]: https://img.shields.io/maven-central/v/com.typesafe.slick/slick_2.13.svg\n[MavenLink]: http://mvnrepository.com/artifact/com.typesafe.slick/slick_2.13\n\n[DiscussionsBadge]: https://img.shields.io/github/discussions/slick/slick?label=GitHub+Discussions\n[DiscussionsLink]: https://github.com/slick/slick/discussions\n[DiscordBadge]: https://img.shields.io/badge/Discord%20-%23slick%20on%20Scala%20server-blue\n[DiscordLink]: https://discord.gg/yQheBhUtAa\n[GitterBadge]: https://badges.gitter.im/Join%20Chat.svg\n[GitterLink]: https://gitter.im/slick/slick?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\n\n\u003c!--  [\u003csnippet include-in-website\u003e] --\u003e\n\nSlick is an advanced, comprehensive database access library for Scala with strongly-typed, highly composable APIs.\n\nSlick makes it easy to use your database in a way that's natural to it. It allows you to work with relational databases\nalmost as if you were using Scala collections, while at the same time giving you full control over when the\ndatabase is accessed and how much data is transferred. And by writing your queries in Scala you can benefit from\ncompile-time safety and great compositionality, while retaining the ability to drop down to raw SQL when necessary for\ncustom or advanced database features.\n\nIts features include:\n\n - Query API inspired by Scala's collections API\n - Full control over how the database schema is seen by Slick,\n   by using an explicit representation that can be code-generated from the actual database\n - Asynchronous API using `Future` for complete results, and a streaming API that conforms to\n   the [Reactive Streams](https://www.reactive-streams.org/) interface, for easy integration with\n   any streaming library, such as [Akka Streams](https://doc.akka.io/docs/akka/current/stream/index.html),\n   [FS2](https://fs2.io/#/), or [ZIO](https://github.com/zio/interop-reactive-streams).\n- Composability at many levels\n   - Compose actions (steps to run in a database context) with for comprehensions\n   - Compose queries with for comprehensions or combinators\n   - Compose row expressions (column sets, predicates, and column mappings)\n - A database metadata introspection API\n\nSlick features an advanced query compiler which can generate SQL for a variety\nof different database engines from the same Scala code, allowing you to focus on\napplication logic without worrying about database-specific syntax and quirks.\n\n## Resources\n\n### Learn\n- Full documentation, including Scaladocs and more complex examples, can be \nfound on the [website](https://scala-slick.org). For the latest release you can go straight to \nhttps://scala-slick.org/doc/stable/\n- Our friends at [`underscore.io`](https://underscore.io/) have written \"Essential \nSlick\", an excellent guide to using slick from first principles, and is \navailable [as a free download](https://underscore.io/books/essential-slick/)\n\n- [Videos by Rock the JVM](https://www.youtube.com/playlist?list=PLmtsMNDRU0BxIFCdPgm77Dx5Ll9SQ76pR)\n\n### Get help\n- Post questions and suggestions on [GitHub Discussions](https://github.com/slick/slick/discussions)\n- Ask on the [#slick channel on the official Scala Discord server](https://discord.gg/yQheBhUtAa)\n- There is a [gitter channel](https://gitter.im/slick/slick) too, but Discord is preferred\n- Report bugs to [GitHub issues](https://github.com/slick/slick/issues)\n\n\n## Example\n\nAs a simple example we will create a Scala object `Coffee`, and a table to store \ninstances of this object in the database:\n\n```scala\nimport slick.jdbc.PostgresProfile.api._\n\n// First declare our Scala object\nfinal case class Coffee(name: String, price: Double)\n\n// Next define how Slick maps from a database table to Scala objects\nclass Coffees(tag: Tag) extends Table[Coffee](tag, \"COFFEES\") {\n  def name  = column[String](\"NAME\")\n  def price = column[Double](\"PRICE\")\n  def * = (name, price).mapTo[Coffee]\n}\n\n// The `TableQuery` object gives us access to Slick's rich query API\nval coffees = TableQuery[Coffees]\n\n// Inserting is done by appending to our query object\n// as if it were a regular Scala collection\n// SQL: insert into COFFEES (NAME, PRICE) values ('Latte', 2.50)\ncoffees += Coffee(\"Latte\", 2.50)\n\n// Fetching data is also done using the query object\n// SQL: select NAME from COFFEES\ncoffees.map(_.name)\n\n// More complex queries can be chained together\n// SQL: select NAME, PRICE from COFFEES where PRICE \u003c 10.0 order by NAME\ncoffees.filter(_.price \u003c 10.0).sortBy(_.name)\n```\n\n## Database support\n\nThe following databases are directly supported by Slick, and are currently covered\nby a large suite of automated tests to ensure compatibility:\n\n| Database        | JDBC Driver                                                    | Tested server version |\n|-----------------|----------------------------------------------------------------|-----------------------|\n| PostgreSQL      | `\"org.postgresql\" % \"postgresql\" % \"42.5.0\"`                   | Latest                |\n| MySQL           | `\"com.mysql\" % \"mysql-connector-j\" % \"8.0.33\"`                 | Latest                |\n| SQLServer       | `\"com.microsoft.sqlserver\" % \"mssql-jdbc\" % \"7.2.2.jre11\"`     | 2022                  |\n| Oracle          | `\"com.oracle.database.jdbc.debug\" % \"ojdbc8_g\" % \"21.6.0.0.1\"` | 11g                   |\n| DB2             | `\"com.ibm.db2.jcc\" % \"db2jcc\" % \"db2jcc4\"`                     | 11.5.7.0              |\n| Derby/JavaDB    | `\"org.apache.derby\" % \"derby\" % \"10.14.2.0\"`                   |                       |\n| H2              | `\"com.h2database\" % \"h2\" % \"1.4.200\"`                          |                       |\n| HSQLDB/HyperSQL | `\"org.hsqldb\" % \"hsqldb\" % \"2.5.2\"`                            |                       |\n| SQLite          | `\"org.xerial\" % \"sqlite-jdbc\" % \"3.39.2.1\"`                    |                       |\n\nAccessing other database systems is possible, although possibly with a reduced feature \nset.\n\n## Contributing\n\nSlick is community-maintained: pull requests are very welcome, and we\nask that all contributors abide by the [Lightbend Community Code of Conduct](https://www.lightbend.com/conduct).\n\nLightbend staff (such as @SethTisue) may be able to assist with\nadministrative issues.\n\n\u003c!-- [\u003cendsnippet include-in-website\u003e] --\u003e\n","funding_links":["https://github.com/sponsors/nafg"],"categories":["Scala","数据库开发","Table of Contents","\u003ca name=\"Scala\"\u003e\u003c/a\u003eScala","Database"],"sub_categories":["Database"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslick%2Fslick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslick%2Fslick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslick%2Fslick/lists"}