Productive data access layer for Go.
Latest commit 199d13d Aug 29, 2018
Permalink
Failed to load latest commit information.
_examples/booktown-books First v3 release Dec 16, 2016
internal sqladapter: Describe database mutexes Aug 29, 2018
lib Merge pull request #449 from russtone/issue-448 May 26, 2018
mongo make db.Result.One() return db.ErrNoMoreRows Jan 8, 2018
mssql fix: byte array auto-conversion Feb 11, 2018
mysql fix typo Form -> From May 26, 2018
postgresql fix: byte array auto-conversion Feb 11, 2018
ql fix: byte array auto-conversion Feb 11, 2018
sqlite fix: byte array auto-conversion Feb 11, 2018
tests db: code cleaning Sep 23, 2017
.gitignore wip: Using go:generate to share the same tests across adapters. Mar 21, 2016
.travis.yml update mssql image name Dec 3, 2017
CHANGELOG.md Add CHANGELOG.md Dec 16, 2016
Makefile wip: more tests for compariosn operators Sep 20, 2017
README.md Add MSSQL to the README May 2, 2017
collection.go db: split interfaces into different modules Aug 30, 2017
comparison.go wip: more tests for compariosn operators Sep 20, 2017
compound.go db: split interfaces into different modules Aug 30, 2017
cond.go db: split interfaces into different modules Aug 30, 2017
cond_test.go Ignore unassigned values Feb 7, 2017
constraint.go db: split interfaces into different modules Aug 30, 2017
database.go db: split interfaces into different modules Aug 30, 2017
db.go db: split interfaces into different modules Aug 30, 2017
env.go Code documentation revision. Oct 10, 2016
errors.go Code documentation revision. Oct 10, 2016
function.go db: split interfaces into different modules Aug 30, 2017
intersection.go db: split interfaces into different modules Aug 30, 2017
logger.go Add context to query status Aug 13, 2017
marshal.go db: split interfaces into different modules Aug 30, 2017
operators.go db: split interfaces into different modules Aug 30, 2017
raw.go db: split interfaces into different modules Aug 30, 2017
result.go db: split interfaces into different modules Aug 30, 2017
settings.go db: promote postgresql.scannerValuer and postgresql.valueWrapper to s… Aug 19, 2017
tx.go db: split interfaces into different modules Aug 30, 2017
union.go db: split interfaces into different modules Aug 30, 2017
url.go db: split interfaces into different modules Aug 30, 2017
wrapper.go Keep sqlbuilder name. Aug 3, 2016

README.md

upper.io/db.v3 Build Status GoDoc

The upper.io/db.v3 package for Go is a productive data access layer for Go that provides a common interface to work with different data sources such as PostgreSQL, MySQL, SQLite, MSSQL, QL and MongoDB.

go get upper.io/db.v3

The tour

screen shot 2017-05-01 at 19 23 22

Take the tour to see real live examples in your browser.

Live demos

You can run the following example on our playground:

package main

import (
	"log"

	"upper.io/db.v3/postgresql"
)

var settings = postgresql.ConnectionURL{
	Host:     "demo.upper.io",
	Database: "booktown",
	User:     "demouser",
	Password: "demop4ss",
}

type Book struct {
	ID        int    `db:"id"`
	Title     string `db:"title"`
	AuthorID  int    `db:"author_id"`
	SubjectID int    `db:"subject_id"`
}

func main() {
	sess, err := postgresql.Open(settings)
	if err != nil {
		log.Fatalf("db.Open(): %q\n", err)
	}
	defer sess.Close()

	var books []Book
	err = sess.Collection("books").Find().All(&books)
	if err != nil {
		log.Fatalf("Find(): %q\n", err)
	}

	for i, book := range books {
		log.Printf("Book %d: %#v\n", i, book)
	}
}

Or you can also run it locally from the _examples directory:

go run _examples/booktown-books/main.go
2016/08/10 08:42:48 "The Shining" (ID: 7808)
2016/08/10 08:42:48 "Dune" (ID: 4513)
2016/08/10 08:42:48 "2001: A Space Odyssey" (ID: 4267)
2016/08/10 08:42:48 "The Cat in the Hat" (ID: 1608)
2016/08/10 08:42:48 "Bartholomew and the Oobleck" (ID: 1590)
2016/08/10 08:42:48 "Franklin in the Dark" (ID: 25908)
2016/08/10 08:42:48 "Goodnight Moon" (ID: 1501)
2016/08/10 08:42:48 "Little Women" (ID: 190)
2016/08/10 08:42:48 "The Velveteen Rabbit" (ID: 1234)
2016/08/10 08:42:48 "Dynamic Anatomy" (ID: 2038)
2016/08/10 08:42:48 "The Tell-Tale Heart" (ID: 156)
2016/08/10 08:42:48 "Programming Python" (ID: 41473)
2016/08/10 08:42:48 "Learning Python" (ID: 41477)
2016/08/10 08:42:48 "Perl Cookbook" (ID: 41478)
2016/08/10 08:42:48 "Practical PostgreSQL" (ID: 41472)

Documentation for users

This is the source code repository, check out our release notes and see examples and documentation at upper.io/db.v3.

Changelog

See CHANGELOG.md.

License

This project is licensed under the terms of the MIT License.

Copyright (c) 2012-present The upper.io/db authors. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Authors and contributors