{"id":13658487,"url":"https://github.com/ctripcorp/SQLlin","last_synced_at":"2025-04-24T11:31:47.868Z","repository":{"id":63704846,"uuid":"570015389","full_name":"ctripcorp/SQLlin","owner":"ctripcorp","description":"A DSL ORM library for Kotlin Multiplatform.","archived":false,"fork":false,"pushed_at":"2025-02-12T06:57:25.000Z","size":6293,"stargazers_count":242,"open_issues_count":2,"forks_count":15,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-12T07:53:22.661Z","etag":null,"topics":["android","ios","kotlin","kotlin-jvm","kotlin-multiplaform","kotlin-multiplatform-library","kotlin-native-library","macos","sqlite"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ctripcorp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","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":"2022-11-24T06:24:01.000Z","updated_at":"2025-02-12T06:57:29.000Z","dependencies_parsed_at":"2023-09-22T18:30:42.880Z","dependency_job_id":"4bdb9351-9048-4223-a011-223855f9231b","html_url":"https://github.com/ctripcorp/SQLlin","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctripcorp%2FSQLlin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctripcorp%2FSQLlin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctripcorp%2FSQLlin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ctripcorp%2FSQLlin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ctripcorp","download_url":"https://codeload.github.com/ctripcorp/SQLlin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250618315,"owners_count":21460069,"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":["android","ios","kotlin","kotlin-jvm","kotlin-multiplaform","kotlin-multiplatform-library","kotlin-native-library","macos","sqlite"],"created_at":"2024-08-02T05:00:59.983Z","updated_at":"2025-04-24T11:31:47.211Z","avatar_url":"https://github.com/ctripcorp.png","language":"C","readme":"# SQLlin\n\n中文版请见[这里](README_CN.md)\n\nSQLlin is an ORM library for Kotlin Multiplatform that is based on DSL and KSP. It uses SQLite under the hood. You can write SQL\nstatements with your Kotlin code and these can be verified by Kotlin compiler. Sample just like be this:\n\n```kotlin\nprivate val db by lazy { Database(name = \"person.db\", path = path, version = 1) }\n\nfun sample() {\n    val tom = Person(age = 4, name = \"Tom\")\n    val jerry = Person(age = 3, name = \"Jerry\")\n    val jack = Person(age = 8, name = \"Jack\")\n    val selectStatement: SelectStatement\u003cPerson\u003e = db {\n        PersonTable { table -\u003e\n            table INSERT listOf(tom, jerry, jack)\n            table UPDATE SET { age = 5; name = \"Tom\" } WHERE ((age LTE 5) AND (name NEQ \"Tom\"))\n            table DELETE WHERE ((age GTE 10) OR (name NEQ \"Jerry\"))\n            table SELECT WHERE (age LTE 5) GROUP_BY age HAVING (upper(name) EQ \"TOM\") ORDER_BY (age to DESC) LIMIT 2 OFFSET 1\n        }\n    }\n    selectStatement.getResult().forEach { person -\u003e\n        println(person.name)\n    }\n}\n```\nSQLlin is able to insert Kotlin objects into database directly, and could query Kotlin objects from database directly. The serialization\nand deserialization ability is based on [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization).\n\nSQLlin supports these platforms:\n\n- Multiplatform Common\n- Android (6.0+)\n- JVM (Java 11+, since `1.2.0`)\n- iOS (x64, arm64, simulatorArm64)\n- macOS (x64, arm64)\n- watchOS (x64, arm32, arm64, simulatorArm64, deviceArm64)\n- tvOS (x64, arm64, simulatorArm64)\n- Linux (x64, arm64)\n- Windows (mingwX64)\n\nThe architecture design of SQLlin is shown in the figure:\n\n![sqllin-architecture](sqllin-architecture.png)\n\nSQLlin has 3 major parts: _sqllin-dsl_, _sqllin-driver_ and _sqllin-processor_. The _sqllin-driver_ is a set of common multiplatform SQLite low-level\nAPIs, most of the time it is not recommended to use it directly. The _sqllin-dsl_ is DSL implementations for SQL statements, it is based on\n_sqllin-driver_. The _sqllin-processor_ uses KSP to process annotations and generate code for using with _sqllin-dsl_.\n\nYou can learn how to use _sqllin-dsl_ in these documentations:\n\n- [Getting Start](./sqllin-dsl/doc/getting-start.md)\n- [Modify Database and Transaction](./sqllin-dsl/doc/modify-database-and-transaction.md)\n- [Query](./sqllin-dsl/doc/query.md)\n- [Concurrency Safety](./sqllin-dsl/doc/concurrency-safety.md)\n- [SQL Functions](./sqllin-dsl/doc/sql-functions.md)\n- [Advanced Query](./sqllin-dsl/doc/advanced-query.md)\n\nI don't recommend using _sqllin-driver_ directly, but if you want to learn more about it, you can read:\n\n- [The sqllin-driver Basic Design and Usage](./sqllin-driver/README.md)\n\n## R8/ProGuard\n\nDue to _sqllin-dsl_'s serialization and deserialization are based on [kotlinx.serialization](https://github.com/Kotlin/kotlinx.serialization), the R8/ProGuard configuration please refer to\n[kotlinx.serialization#Android](https://github.com/Kotlin/kotlinx.serialization#Android).\n\n## License\n\nDistributed under the [Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0).\n\nSee [LICENSE](LICENSE.txt) for more information.","funding_links":[],"categories":["Libraries","数据库开发"],"sub_categories":["📦 Storage"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctripcorp%2FSQLlin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fctripcorp%2FSQLlin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fctripcorp%2FSQLlin/lists"}