Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/loeffel-io/sql
SQL Query Builder - ORM Wrapper
https://github.com/loeffel-io/sql
golang orm sql
Last synced: about 1 month ago
JSON representation
SQL Query Builder - ORM Wrapper
- Host: GitHub
- URL: https://github.com/loeffel-io/sql
- Owner: loeffel-io
- License: mit
- Created: 2020-02-18T11:37:59.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-03-21T17:02:08.000Z (over 4 years ago)
- Last Synced: 2024-06-20T00:44:32.359Z (5 months ago)
- Topics: golang, orm, sql
- Language: Go
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SQL Query Builder - ORM Wrapper
[![Build Status](http://ci.loeffel.io/api/badges/loeffel-io/sql/status.svg)](http://ci.loeffel.io/loeffel-io/sql)
[![Go Report Card](https://goreportcard.com/badge/github.com/loeffel-io/sql)](https://goreportcard.com/report/github.com/loeffel-io/sql)- Full flexibility
- Zero third-party dependencies
- Useable by any ORM
- Support for Select, From, Join, Left Join, Where, OrderBy### [Gorm](https://github.com/jinzhu/gorm) Usage
```go
subquery := sql.Create().
Select(true, "purchases.*").
Select(true, "...").
From(true, "purchases").
Join(true, "transactions ON transactions.purchase_id=purchases.id")query := sql.Create().Select(true, "*").
From(true, "(?) purchases", gorm.Expr(subquery.GetSQL(), subquery.GetValues()...)).
Join(true, "transactions ON transactions.id=purchases.last_transaction_id")db.
Raw(query.GetSQL(), query.GetValues()...).
Offset(...).
Limit(...).
Order(...).
Unscoped().
Find(&purchases).
Error
```