https://github.com/ddliu/go-dbless
Database library with less complexity and less modeling.
https://github.com/ddliu/go-dbless
database golang json model mysql orm postgresql sql sqlite
Last synced: 12 months ago
JSON representation
Database library with less complexity and less modeling.
- Host: GitHub
- URL: https://github.com/ddliu/go-dbless
- Owner: ddliu
- License: mit
- Created: 2019-06-23T08:27:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-09-04T16:29:52.000Z (over 3 years ago)
- Last Synced: 2025-01-03T01:21:22.835Z (about 1 year ago)
- Topics: database, golang, json, model, mysql, orm, postgresql, sql, sqlite
- Language: Go
- Size: 43 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-dbless
[](https://travis-ci.org/ddliu/go-dbless)
[](https://godoc.org/github.com/ddliu/go-dbless)
[](LICENSE)
[](https://goreportcard.com/report/github.com/ddliu/go-dbless)
[](https://cover.run/go?tag=golang-1.10&repo=github.com%2Fddliu%2Fgo-dbless)
Database library with less complexity and less modeling.
## Install
```
go get -u github.com/ddliu/go-dbless
```
## Usage
```go
import (
"github.com/ddliu/go-dbless"
_ "github.com/ddliu/go-dbless/driver/mysql"
_ "github.com/go-sql-driver/mysql"
)
db := dbless.Open("mysql", "dsn")
```
### Basic
- Insert
- Update
- Delete
- GetRows
- GetRow
- Scalar
### Schema
- List databases
- List tables
- List columns
### Resource
```go
package main
import github.com/ddliu/go-dbless
func main() {
db := somedb()
resource := dbless.Resource{
Name: "user",
Timestamp: true,
DB: db,
}
id, err := resource.Save(dbless.Record{
"username": "ddliu",
"password": "123456",
})
user, err := record.Get(id)
listing := resource.List(dbless.ListInput{
Pagination: dbless.Pagination {
PageSize: 20,
Page: 1,
},
})
}
```