MyGit
🚩收到GitHub仓库的更新通知

uptrace/bun

Fork: 189 Star: 3162 (更新于 2024-05-07 15:46:32)

license: BSD-2-Clause

Language: Go .

SQL-first Golang ORM

最后发布版本: v1.2.1 ( 2024-04-02 22:43:07)

官方网址 GitHub网址

✨免费申请网站SSL证书,支持多域名和泛域名,点击查看

SQL-first Golang ORM for PostgreSQL, MySQL, MSSQL, and SQLite

build workflow PkgGoDev Documentation Chat

Bun is brought to you by :star: uptrace/uptrace. Uptrace is an open-source APM tool that supports distributed tracing, metrics, and logs. You can use it to monitor applications and set up automatic alerts to receive notifications via email, Slack, Telegram, and others.

See OpenTelemetry example which demonstrates how you can use Uptrace to monitor Bun.

Features

Resources

Tutorials

Wrote a tutorial for Bun? Create a PR to add here and on Bun site.

Featured projects using Bun

Why another database client?

So you can elegantly write complex queries:

regionalSales := db.NewSelect().
	ColumnExpr("region").
	ColumnExpr("SUM(amount) AS total_sales").
	TableExpr("orders").
	GroupExpr("region")

topRegions := db.NewSelect().
	ColumnExpr("region").
	TableExpr("regional_sales").
	Where("total_sales > (SELECT SUM(total_sales) / 10 FROM regional_sales)")

var items []map[string]interface{}
err := db.NewSelect().
	With("regional_sales", regionalSales).
	With("top_regions", topRegions).
	ColumnExpr("region").
	ColumnExpr("product").
	ColumnExpr("SUM(quantity) AS product_units").
	ColumnExpr("SUM(amount) AS product_sales").
	TableExpr("orders").
	Where("region IN (SELECT region FROM top_regions)").
	GroupExpr("region").
	GroupExpr("product").
	Scan(ctx, &items)
WITH regional_sales AS (
    SELECT region, SUM(amount) AS total_sales
    FROM orders
    GROUP BY region
), top_regions AS (
    SELECT region
    FROM regional_sales
    WHERE total_sales > (SELECT SUM(total_sales)/10 FROM regional_sales)
)
SELECT region,
       product,
       SUM(quantity) AS product_units,
       SUM(amount) AS product_sales
FROM orders
WHERE region IN (SELECT region FROM top_regions)
GROUP BY region, product

And scan results into scalars, structs, maps, slices of structs/maps/scalars:

users := make([]User, 0)
if err := db.NewSelect().Model(&users).OrderExpr("id ASC").Scan(ctx); err != nil {
	panic(err)
}

user1 := new(User)
if err := db.NewSelect().Model(user1).Where("id = ?", 1).Scan(ctx); err != nil {
	panic(err)
}

See Getting started guide and check examples.

See also

Contributing

See CONTRIBUTING.md for some hints.

And thanks to all the people who already contributed!

最近版本更新:(数据更新于 2024-05-13 12:42:14)

2024-04-02 22:43:07 v1.2.1

2024-04-02 15:55:14 v1.2.0

2024-01-11 14:55:13 v1.1.17

2023-09-16 13:55:29 v1.1.16

2023-09-10 16:35:16 v1.1.15

2023-05-24 19:18:22 v1.1.14

2023-05-06 18:29:05 v1.1.13

2023-02-20 19:43:31 v1.1.12

2023-02-01 15:28:25 v1.1.11

2023-01-16 16:54:32 v1.1.10

主题(topics):

database, go, golang, mssql, mysql, orm, postgresql, sql, sqlite, sqlite3

uptrace/bun同语言 Go最近更新仓库

2024-05-17 04:31:35 plandex-ai/plandex

2024-05-16 16:38:24 aurora-develop/aurora

2024-05-16 04:59:25 helm/helm

2024-05-16 03:44:16 kubernetes-sigs/aws-ebs-csi-driver

2024-05-15 22:27:34 AdguardTeam/AdGuardHome

2024-05-15 21:04:45 SagerNet/sing-box