gotosocial/vendor/github.com/uptrace/bun
kim a156188b3e
[chore] update dependencies, bump to Go 1.19.1 (#826)
* update dependencies, bump Go version to 1.19

* bump test image Go version

* update golangci-lint

* update gotosocial-drone-build

* sign

* linting, go fmt

* update swagger docs

* update swagger docs

* whitespace

* update contributing.md

* fuckin whoopsie doopsie

* linterino, linteroni

* fix followrequest test not starting processor

* fix other api/client tests not starting processor

* fix remaining tests where processor not started

* bump go-runners version

* don't check last-webfingered-at, processor may have updated this

* update swagger command

* update bun to latest version

* fix embed to work the same as before with new bun

Signed-off-by: kim <grufwub@gmail.com>
Co-authored-by: tsmethurst <tobi.smethurst@protonmail.com>
2022-09-28 18:30:40 +01:00
..
dialect [chore] update dependencies, bump to Go 1.19.1 (#826) 2022-09-28 18:30:40 +01:00
extra/bunjson Pg to bun (#148) 2021-08-25 15:34:33 +02:00
internal [chore] Update bun and sqlite dependencies (#478) 2022-04-24 12:26:22 +02:00
migrate [chore] update dependencies, bump to Go 1.19.1 (#826) 2022-09-28 18:30:40 +01:00
schema [chore] update dependencies, bump to Go 1.19.1 (#826) 2022-09-28 18:30:40 +01:00
.gitignore [chore] Update bun and sqlite dependencies (#478) 2022-04-24 12:26:22 +02:00
.prettierrc.yml upstep bun to v1.0.14 (#291) 2021-10-24 13:14:37 +02:00
bun.go [chore] Update bun and sqlite dependencies (#478) 2022-04-24 12:26:22 +02:00
CHANGELOG.md [chore] update dependencies, bump to Go 1.19.1 (#826) 2022-09-28 18:30:40 +01:00
commitlint.config.js update bun library to latest commit (#206) 2021-09-11 13:53:44 +02:00
CONTRIBUTING.md [chore] Update bun and sqlite dependencies (#478) 2022-04-24 12:26:22 +02:00
db.go [chore] update dependencies, bump to Go 1.19.1 (#826) 2022-09-28 18:30:40 +01:00
hook.go [feature] Clean up/uncache remote media (#407) 2022-03-07 11:08:26 +01:00
LICENSE Pg to bun (#148) 2021-08-25 15:34:33 +02:00
Makefile [chore] update dependencies, bump to Go 1.19.1 (#826) 2022-09-28 18:30:40 +01:00
model_map_slice.go upstep bun to v1.0.14 (#291) 2021-10-24 13:14:37 +02:00
model_map.go upstep bun to v1.0.14 (#291) 2021-10-24 13:14:37 +02:00
model_scan.go upstep bun to v1.0.14 (#291) 2021-10-24 13:14:37 +02:00
model_slice.go upstep bun to v1.0.9 (#252) 2021-09-29 15:09:45 +02:00
model_table_has_many.go upstep bun to v1.0.9 (#252) 2021-09-29 15:09:45 +02:00
model_table_m2m.go upstep bun to v1.0.9 (#252) 2021-09-29 15:09:45 +02:00
model_table_slice.go [chore] Update bun and sqlite dependencies (#478) 2022-04-24 12:26:22 +02:00
model_table_struct.go upstep bun to v1.0.14 (#291) 2021-10-24 13:14:37 +02:00
model.go upstep bun to v1.0.14 (#291) 2021-10-24 13:14:37 +02:00
package.json [chore] update dependencies, bump to Go 1.19.1 (#826) 2022-09-28 18:30:40 +01:00
query_base.go [chore] update dependencies, bump to Go 1.19.1 (#826) 2022-09-28 18:30:40 +01:00
query_column_add.go [feature] Clean up/uncache remote media (#407) 2022-03-07 11:08:26 +01:00
query_column_drop.go [feature] Clean up/uncache remote media (#407) 2022-03-07 11:08:26 +01:00
query_delete.go [chore] Update bun / sqlite versions; update gtsmodels (#754) 2022-08-15 11:35:05 +01:00
query_index_create.go [chore] Update bun and sqlite dependencies (#478) 2022-04-24 12:26:22 +02:00
query_index_drop.go [feature] Clean up/uncache remote media (#407) 2022-03-07 11:08:26 +01:00
query_insert.go [chore] Update bun / sqlite versions; update gtsmodels (#754) 2022-08-15 11:35:05 +01:00
query_raw.go [chore] update dependencies, bump to Go 1.19.1 (#826) 2022-09-28 18:30:40 +01:00
query_select.go [chore] Update bun / sqlite versions; update gtsmodels (#754) 2022-08-15 11:35:05 +01:00
query_table_create.go [chore] Update bun / sqlite versions; update gtsmodels (#754) 2022-08-15 11:35:05 +01:00
query_table_drop.go [feature] Clean up/uncache remote media (#407) 2022-03-07 11:08:26 +01:00
query_table_truncate.go [feature] Clean up/uncache remote media (#407) 2022-03-07 11:08:26 +01:00
query_update.go [chore] Update bun / sqlite versions; update gtsmodels (#754) 2022-08-15 11:35:05 +01:00
query_values.go [chore] Update bun and sqlite dependencies (#478) 2022-04-24 12:26:22 +02:00
README.md [chore] update dependencies, bump to Go 1.19.1 (#826) 2022-09-28 18:30:40 +01:00
relation_join.go [chore] update dependencies, bump to Go 1.19.1 (#826) 2022-09-28 18:30:40 +01:00
util.go Pg to bun (#148) 2021-08-25 15:34:33 +02:00
version.go [chore] update dependencies, bump to Go 1.19.1 (#826) 2022-09-28 18:30:40 +01:00

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

build workflow PkgGoDev Documentation Chat

Bun is brought to you by uptrace/uptrace. Uptrace is an open source and blazingly fast distributed tracing tool powered by OpenTelemetry and ClickHouse. Give it a star as well!

Features

Resources:

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

Contributors

Thanks to all the people who already contributed!