upper/db
upper/db 是 Go 的生产性数据访问层(DAL),它提供了不可知的工具来处理不同的数据源,例如:
参见 upper.io/v4 的文档和代码样本。
游览
在您的浏览器中 查看 真实的例子。
许可证
根据 MIT 许可 授权
贡献者
请看 贡献者名单。
PostgreSQL、CockroachDB、MySQL、SQLite 和 MongoDB 的数据访问层,具有类似 ORM 的功能。「Data access layer for PostgreSQL, CockroachDB, MySQL, SQLite and MongoDB with ORM-like features.」
upper/db 是 Go 的生产性数据访问层(DAL),它提供了不可知的工具来处理不同的数据源,例如:
参见 upper.io/v4 的文档和代码样本。
在您的浏览器中 查看 真实的例子。
根据 MIT 许可 授权
请看 贡献者名单。
名稱與所有者 | upper/db |
---|---|
主編程語言 | Go |
編程語言 | Go (語言數: 2) |
平台 | Linux, Mac, Windows |
許可證 | MIT License |
創建於 | 2013-10-23 02:04:36 |
---|---|
推送於 | 2025-03-21 00:44:06 |
最后一次提交 | 2025-03-20 18:44:05 |
發布數 | 82 |
最新版本名稱 | v4.10.0 (發布於 ) |
第一版名稱 | v2.0.0-rc1 (發布於 2016-08-04 07:28:52) |
星數 | 3.6k |
---|---|
關注者數 | 56 |
派生數 | 237 |
提交數 | 1.7k |
已啟用問題? | |
問題數 | 413 |
打開的問題數 | 150 |
拉請求數 | 260 |
打開的拉請求數 | 9 |
關閉的拉請求數 | 45 |
已啟用Wiki? | |
---|---|
已存檔? | |
是復刻? | |
已鎖定? | |
是鏡像? | |
是私有? |
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
Take the tour to see real live examples in your
browser.
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)
This is the source code repository, check out our release
notes and see examples and
documentation at upper.io/db.v3.
See CHANGELOG.md.
Licensed under MIT License