Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 7 days 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 5 years ago)
- Default Branch: master
- Last Pushed: 2022-09-04T16:29:52.000Z (about 2 years ago)
- Last Synced: 2024-06-21T09:38:33.812Z (5 months 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
[![Travis](https://img.shields.io/travis/ddliu/go-dbless.svg?style=flat-square)](https://travis-ci.org/ddliu/go-dbless)
[![godoc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](https://godoc.org/github.com/ddliu/go-dbless)
[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE)
[![Go Report Card](https://goreportcard.com/badge/github.com/ddliu/go-dbless)](https://goreportcard.com/report/github.com/ddliu/go-dbless)
[![cover.run](https://cover.run/go/github.com/ddliu/go-dbless.svg?style=flat&tag=golang-1.10)](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-dblessfunc 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,
},
})
}
```