{"id":20388544,"url":"https://github.com/si3nloong/sqlike","last_synced_at":"2026-03-02T07:31:56.018Z","repository":{"id":36348379,"uuid":"188968045","full_name":"si3nloong/sqlike","owner":"si3nloong","description":"Golang Sequel ORM that supports Enum, JSON, Spatial, and many more","archived":false,"fork":false,"pushed_at":"2025-04-14T18:14:36.000Z","size":1901,"stargazers_count":23,"open_issues_count":12,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-27T06:04:51.626Z","etag":null,"topics":["casbin","enum","go","go-sql-orm","golang","golang-sql-orm","json","mysql","opentracing","orm","sequel","spatial","sql","sql-orm","sqldump","sqlike","toxic-query","uuid"],"latest_commit_sha":null,"homepage":"https://sqlike.com","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/si3nloong.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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,"zenodo":null},"funding":{"liberapay":"SianLoong"}},"created_at":"2019-05-28T06:31:01.000Z","updated_at":"2024-02-29T16:12:29.000Z","dependencies_parsed_at":"2024-01-01T23:40:37.675Z","dependency_job_id":"7dabdd1e-c3bc-441b-affe-39154a2bde06","html_url":"https://github.com/si3nloong/sqlike","commit_stats":null,"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/si3nloong/sqlike","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/si3nloong%2Fsqlike","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/si3nloong%2Fsqlike/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/si3nloong%2Fsqlike/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/si3nloong%2Fsqlike/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/si3nloong","download_url":"https://codeload.github.com/si3nloong/sqlike/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/si3nloong%2Fsqlike/sbom","scorecard":{"id":822061,"data":{"date":"2025-08-11","repo":{"name":"github.com/si3nloong/sqlike","commit":"dbe0bcfc722413a87040c37fef3b41dac280ec7b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.3,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/9 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/go.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: third-party GitHubAction not pinned by hash: .github/workflows/go.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/si3nloong/sqlike/go.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/si3nloong/sqlike/go.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/si3nloong/sqlike/go.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/go.yml:50: update your workflow using https://app.stepsecurity.io/secureworkflow/si3nloong/sqlike/go.yml/main?enable=pin","Warn: downloadThenRun not pinned by hash: .github/workflows/go.yml:42","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned","Info:   1 out of   1 goCommand dependencies pinned","Info:   0 out of   1 downloadThenRun dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":7,"reason":"3 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2024-3321 / GHSA-v778-237x-gjrc","Warn: Project is vulnerable to: GO-2025-3487 / GHSA-hcg3-q754-cr77","Warn: Project is vulnerable to: GO-2024-2611 / GHSA-8r3f-844c-mc37"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 22 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T15:51:08.445Z","repository_id":36348379,"created_at":"2025-08-23T15:51:08.445Z","updated_at":"2025-08-23T15:51:08.445Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29994996,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T01:47:34.672Z","status":"online","status_checked_at":"2026-03-02T02:00:07.342Z","response_time":60,"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":["casbin","enum","go","go-sql-orm","golang","golang-sql-orm","json","mysql","opentracing","orm","sequel","spatial","sql","sql-orm","sqldump","sqlike","toxic-query","uuid"],"created_at":"2024-11-15T03:11:22.202Z","updated_at":"2026-03-02T07:31:55.998Z","avatar_url":"https://github.com/si3nloong.png","language":"Go","funding_links":["https://liberapay.com/SianLoong"],"categories":[],"sub_categories":[],"readme":"# sqlike\n\n[![Build](https://github.com/si3nloong/sqlike/workflows/build/badge.svg?branch=main)](https://github.com/si3nloong/sqlike/actions?query=workflow%3Abuild)\n[![Release](https://img.shields.io/github/v/tag/si3nloong/sqlike)](https://github.com/si3nloong/sqlike/releases)\n[![Go Report](https://goreportcard.com/badge/github.com/si3nloong/sqlike)](https://goreportcard.com/report/github.com/si3nloong/sqlike)\n[![Go Coverage](https://codecov.io/gh/si3nloong/sqlike/branch/main/graph/badge.svg)](https://codecov.io/gh/si3nloong/sqlike)\n[![LICENSE](https://img.shields.io/github/license/si3nloong/sqlike)](https://github.com/si3nloong/sqlike/blob/main/LICENSE)\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fsi3nloong%2Fsqlike.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fsi3nloong%2Fsqlike?ref=badge_shield)\n\n\u003e A Golang SQL ORM which anti-toxic query and focus on the latest features.\n\n## 🔨 Installation\n\n```console\ngo get github.com/si3nloong/sqlike\n```\n\nFully compatible with native library `database/sql`, which mean you are allow to use `driver.Valuer` and `sql.Scanner`.\n\n## 📻 Legacy Support\n\nSQLike did support **mysql 5.7** as well. For better compatibility, we suggest you to use at least mysql 8.0.\n\n## 🪣 Minimum Requirements\n\n- **mysql 8.0** and above\n- **golang 1.15** and above\n\n## ❓ Why another ORM?\n\n- We don't really care about _legacy support_, we want _latest feature_ that mysql and golang offer us\n- We want to get rid from **toxic query** (also known as slow query)\n\n## ✨ What do we provide apart from native package (database/sql)?\n\n- Support `ENUM` and `SET`\n- Support `UUID` (^8.0)\n- Support `JSON`\n- Support `descending index` (^8.0)\n- Support `multi-valued` index (^8.0.17)\n- Support `Spatial` with package [orb](https://github.com/paulmach/orb), such as `Point`, `LineString`\n- Support `generated column` of `stored column` and `virtual column`\n- Extra custom type such as `Date`, `Key`, `Boolean`\n- Support `struct` on `Find`, `FindOne`, `InsertOne`, `Insert`, `ModifyOne`, `DeleteOne`, `Delete`, `DestroyOne` and `Paginate` apis\n- Support `Transactions`\n- Support cursor based pagination\n- Support advance and complex query statement\n- Support [civil.Date](https://cloud.google.com/go/civil#Date), [civil.Time](https://cloud.google.com/go/civil#Time) and [time.Location](https://pkg.go.dev/time#Time)\n- Support [language.Tag](https://godoc.org/golang.org/x/text/language#example-Tag--Values) and [currency.Unit](https://godoc.org/golang.org/x/text/currency#Unit)\n- Support authorization plugin [Casbin](https://github.com/casbin/casbin)\n- Support tracing plugin [OpenTracing](https://github.com/opentracing/opentracing-go)\n- Developer friendly, (query is highly similar to native sql query)\n- Support `sqldump` for backup purpose **(experiment)**\n\n\u003c!-- You can refer to [examples](https://github.com/si3nloong/sqlike/tree/main/examples) folder to see what apis we offer and learn how to use those apis --\u003e\n\n## ⚠️ Limitation\n\nOur main objective is anti toxic query, that why some functionality we doesn't offer out of box\n\n- offset based pagination (but you may achieve this by using `Limit` and `Offset`)\n- eager loading (we want to avoid magic function, you should handle this by your own using goroutines)\n- join (eg. left join, outer join, inner join), join clause is consider as toxic query, you should alway find your record using primary key\n- left wildcard search using Like is not allow (but you may use `expr.Raw` to bypass it)\n- bidirectional sorting is not allow (except mysql 8.0 and above)\n- currently only support `mysql` driver (postgres and sqlite yet to implement)\n\n## General APIs\n\n```go\npackage main\n\nimport (\n    \"time\"\n    \"github.com/si3nloong/sqlike/sqlike/actions\"\n    \"github.com/si3nloong/sqlike/sqlike\"\n    \"github.com/si3nloong/sqlike/sqlike/options\"\n    \"github.com/si3nloong/sqlike/sql/expr\"\n    \"github.com/google/uuid\"\n    \"context\"\n\n    _ \"github.com/go-sql-driver/mysql\"\n)\n\n// UserStatus :\ntype UserStatus string\n\nconst (\n    UserStatusActive  UserStatus = \"ACTIVE\"\n    UserStatusSuspend UserStatus = \"SUSPEND\"\n)\n\ntype User struct {\n    ID        uuid.UUID  `sqlike:\",primary_key\"`\n    ICNo      string     `sqlike:\",generated_column\"` // generated column generated by virtual column `Detail.ICNo`\n    Name      string     `sqlike:\",size=200,charset=latin1\"` // you can set the data type length and charset with struct tag\n    Email     string     `sqlike:\",unique\"` // set to unique\n    Address   string     `sqlike:\",longtext\"` // `longtext` is an alias of long text data type in mysql\n    Detail    struct {\n        ICNo    string `sqlike:\",virtual_column=ICNo\"` // virtual column\n        PhoneNo string\n        Age     uint\n    }\n    Status    UserStatus `sqlike:\",enum=ACTIVE|SUSPEND\"` // enum data type\n    CreatedAt time.Time\n    UpdatedAt time.Time\n}\n\nfunc newUser() (user User) {\n    now := time.Now()\n    user.ID = uuid.New()\n    user.CreatedAt = now\n    user.UpdatedAt = now\n    return\n}\n\nfunc main() {\n    ctx := context.Background()\n    client := sqlike.MustConnect(\n        ctx,\n        \"mysql\",\n        options.Connect().\n        SetUsername(\"root\").\n        SetPassword(\"\").\n        SetHost(\"localhost\").\n        SetPort(\"3306\"),\n    )\n\n    client.SetPrimaryKey(\"ID\") // Change default primary key name\n    version := client.Version() // Display driver version\n    dbs, _ := client.ListDatabases(ctx) // List databases\n\n    userTable := client.Database(\"sqlike\").Table(\"User\")\n\n    // Drop Table\n    userTable.Drop(ctx)\n\n    // Migrate Table\n    userTable.Migrate(ctx, User{})\n\n    // Truncate Table\n    userTable.Truncate(ctx)\n\n    // Insert one record\n    {\n        user := newUser()\n        if _, err := userTable.InsertOne(ctx, \u0026user); err != nil {\n            panic(err)\n        }\n    }\n\n    // Insert multiple record\n    {\n        users := [...]User{\n            newUser(),\n            newUser(),\n            newUser(),\n        }\n        if _, err := userTable.Insert(ctx, \u0026users); err != nil {\n            panic(err)\n        }\n    }\n\n    // Find one record\n    {\n        user := User{}\n        err := userTable.FindOne(ctx, nil).Decode(\u0026user)\n        if err != nil {\n            // `sqlike.ErrNoRows` is an alias of `sql.ErrNoRows`\n            if err != sqlike.ErrNoRows {  // or you may check with sql.ErrNoRows\n                panic(err)\n            }\n            // record not exist\n        }\n    }\n\n    // Find multiple records\n    {\n        users := make([]User, 0)\n        result, err := userTable.Find(\n            ctx,\n            actions.Find().\n                Where(\n                    expr.Equal(\"ID\", result.ID),\n                ).\n                OrderBy(\n                    expr.Desc(\"UpdatedAt\"),\n                ),\n        )\n        if err != nil {\n            panic(err)\n        }\n        // map into the struct of slice\n        if err:= result.All(\u0026users); err != nil {\n            panic(err)\n        }\n    }\n\n    // Update one record with all fields of struct\n    {\n        user.Name = `🤖 Hello World!`\n        if err := userTable.ModifyOne(ctx, \u0026user); err != nil {\n            panic(err)\n        }\n    }\n\n    // Update one record with selected fields\n    {\n        userTable.UpdateOne(\n            ctx,\n            actions.UpdateOne().\n                Where(\n                    expr.Equal(\"ID\", 100),\n                ).Set(\n                    expr.ColumnValue(\"Name\", \"SianLoong\"),\n                    expr.ColumnValue(\"Email\", \"test@gmail.com\"),\n                ),\n            options.UpdateOne().SetDebug(true), // debug the query\n        )\n    }\n\n    {\n        limit := uint(10)\n        pg, err := userTable.Paginate(\n            ctx,\n            actions.Paginate().\n                OrderBy(\n                    expr.Desc(\"CreatedAt\"),\n                ).\n                Limit(limit + 1),\n             options.Paginate().SetDebug(true),\n        )\n        if err != nil {\n            panic(err)\n        }\n\n        for {\n            var users []User\n            if err := pg.All(\u0026users); err != nil {\n                panic(err)\n            }\n            length := uint(len(users))\n            if length == 0 {\n                break\n            }\n            cursor := users[length-1].ID\n            if err := pg.NextCursor(ctx, cursor); err != nil {\n                if err == sqlike.ErrInvalidCursor {\n                    break\n                }\n                panic(err)\n            }\n            if length \u003c= limit {\n                break\n            }\n        }\n\n    }\n}\n```\n\nInspired by [gorm](https://github.com/jinzhu/gorm), [mongodb-go-driver](https://github.com/mongodb/mongo-go-driver) and [sqlx](https://github.com/jmoiron/sqlx).\n\n## 🎉 Big Thanks To\n\nThanks to these awesome companies for their support of Open Source developers ❤\n\n[![GitHub](https://jstools.dev/img/badges/github.svg)](https://github.com/open-source)\n[![NPM](https://jstools.dev/img/badges/npm.svg)](https://www.npmjs.com/)\n\n## 🧲 Adopters \n\n\u003cimg src=\"https://camo.githubusercontent.com/2c975785e2902b4ca4d1a9e9fd4bd21b3e576395631f1dc7c49f170cdeb7f1f8/68747470733a2f2f61737365742e77657469782e6d792f696d616765732f6c6f676f2f77657469782e706e67\"\nwidth=\"120px\" style=\"margin-right: 10px\" /\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/28108597/188676138-59b5fa89-9788-48ce-9a12-bdcc378bb8b7.png\" width=\"150px\" style=\"margin-right: 10px\" /\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/28108597/188675656-af6fb714-0460-40b3-8935-f0eeaa0886b1.png\" width=\"130px\" style=\"margin-right: 10px\" /\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/28108597/188676512-59a6f5bd-5c57-4051-bbd9-9275402b415f.png\" width=\"70px\" /\u003e\n\n## 📄 License\n\n[MIT](https://github.com/si3nloong/sqlike/blob/main/LICENSE)\n\nCopyright (c) 2019-present, SianLoong Lee\n\n[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fsi3nloong%2Fsqlike.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2Fsi3nloong%2Fsqlike?ref=badge_large)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsi3nloong%2Fsqlike","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsi3nloong%2Fsqlike","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsi3nloong%2Fsqlike/lists"}