Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Releases: upper/db

v4.10.0

09 Mar 15:14
@xiam xiam
4c2dd6b
This commit was created on GitHub.com and signed with GitHub’s verified signature.
GPG key ID: B5690EEEBB952194
Verified
Learn about vigilant mode.

Choose a tag to compare

What's Changed

Full Changelog: v4.9.0...v4.10.0

Contributors

xiam
Assets 2
Loading

v4.9.0

08 Sep 02:12
@xiam xiam
fb5164f
This commit was created on GitHub.com and signed with GitHub’s verified signature.
GPG key ID: B5690EEEBB952194
Verified
Learn about vigilant mode.

Choose a tag to compare

What's Changed

Full Changelog: v4.8.0...v4.9.0

Contributors

xiam
Loading

v4.8.0

23 Jun 22:48
@xiam xiam
b8d22cf
This commit was created on GitHub.com and signed with GitHub’s verified signature.
GPG key ID: B5690EEEBB952194
Verified
Learn about vigilant mode.

Choose a tag to compare

What's Changed

  • cockroachdb: fix tests with DELETE and LIMIT by @xiam in #701
  • test suite maintenance by @xiam in #713

Full Changelog: v4.7.0...v4.8.0

Contributors

xiam
Loading
c-nv-s and Xytrical reacted with hooray emoji koddr reacted with heart emoji
3 people reacted

v4.7.0

05 Nov 14:02
@xiam xiam
1d0115f
This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
GPG key ID: 4AEE18F83AFDEB23
Expired
Verified
Learn about vigilant mode.

Choose a tag to compare

Maintenance release with dependency upgrades.

Loading

Release v4.6.0-rc1

30 Aug 14:34
@xiam xiam
8a3fe0c
This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
GPG key ID: 4AEE18F83AFDEB23
Expired
Verified
Learn about vigilant mode.

Choose a tag to compare

This release includes memory and speed optimizations.

Loading

Release v4.6.0

04 Sep 18:11
@xiam xiam
8a3fe0c
This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
GPG key ID: 4AEE18F83AFDEB23
Expired
Verified
Learn about vigilant mode.

Choose a tag to compare

This release includes memory and speed optimizations.

Loading

Release v4.5.4

25 Jun 14:30
@xiam xiam
2147806
This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
GPG key ID: 4AEE18F83AFDEB23
Expired
Verified
Learn about vigilant mode.

Choose a tag to compare

Merge pull request #652 from upper/with-context
Refactor WithContext to make it work without cloning the session and add `ConnMaxIdleTime`
Loading

Release v4.5.3

17 Jun 00:41
@xiam xiam
b5aff2b
This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
GPG key ID: 4AEE18F83AFDEB23
Expired
Verified
Learn about vigilant mode.

Choose a tag to compare

Merge pull request #656 from upper/allow-select-from-db-result
allow using db.Result as subquery
Loading

Release v4.5.2

08 Mar 23:21
@xiam xiam
f79575d
This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
GPG key ID: 4AEE18F83AFDEB23
Expired
Verified
Learn about vigilant mode.

Choose a tag to compare

Merge pull request #649 from upper/refactor-memory-and-speed-optimiza...
Loading

v4.5.0

03 Jan 17:37
@xiam xiam
28dd6cd
This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
GPG key ID: 4AEE18F83AFDEB23
Expired
Verified
Learn about vigilant mode.

Choose a tag to compare

Release notes

The github.com/lib/pq package that we used as driver for PostgreSQL and CockroachDB went under maintenance mode, the package maintainers recommended users to switch to github.com/jackc/pgx. We followed that recommendation, and this release uses github.com/jackc/pgx as driver for both PostgreSQL and CockroachDB.

For some codebases, the update will be completely transparent, but others cases might require slight modifications to their code, specially if they're using custom field types. If you're upgrading to v4.5.0 make sure you're either using the special types with driver.Value and sql.Scanner methods provided by the github.com/upper/db/v4/adapter/postgresql package, or provide your own ones.

If the change is too complicated, you'll be able to use github.com/lib/pq for a while by including the pgx build constraint along the other build tags. See:

go build -tags=pgx ...

however, this is a temporary solution, support for the github.com/lib/pq driver is going to be definitely removed on February 28th 2022.

Upgrading your codebase

If you upgraded to v4.5.0 and your code doesn't compile anymore or if it throws runtime errors around conversions between Go types and database types you'll have to tweak it a bit. Basically, you'll have to make sure you're providing scanners and values for all your types. Basic Go types, like int, string, bool or even a slice of basic types won't require any special handling, but some other types like *[]intor []uint will do.

For instance, if your struct looks like this:

type Foo struct {
	ID uint64 `db:"id"`
	Names *[]string `db:"names"`
}

you'll have to convert it into:

import (
	"github.com/upper/db/v4/adapter/postgresql"
)
type Foo struct {
	ID uint64 `db:"id"` // no need to be updated
	Names *postgresql.StringArray `db:"names"` // changed
}

The table below has some of the most common equivalences between old types and new types:

instead of use
*[]string *postgresql.StringArray
*[]int64 *postgresql.Int64Array
*[]float64 *postgresql.Float64Array
*[]float32 *postgresql.Float32Array
*[]bool *postgresql.BoolArray
*map[string]interface{} *postgresql.JSONBMap
*[]interface{} *postgresql.JSONBArray

If you're using custom types that are not provided in the table above, like map[string]bool, you'll have to provide your own driver.Value and sql.Scanner methods.

If the destination type is JSONB you can use postgresql.JSONBValue and postgresql.ScanJSONB to make those conversions easier, see the example below:

package foo
import (
	"github.com/upper/db/v4/adapter/postgresql"
)
type CustomJSONB map[string]bool
func (c CustomJSONB) Value() (driver.Value, error) {
	return postgresql.JSONBValue(c)
}
func (c *CustomJSONB) Scan(src interface{}) error {
	return postgresql.ScanJSONB(c, src)
}

You can also use the *postgresql.JSONBConverter type to add automatic conversions to some types, like this:

package foo
import (
	"github.com/upper/db/v4/adapter/postgresql"
)
type CustomJSONB struct {
	N string `json:"name"`
	V float64 `json:"value"`
	*postgresql.JSONBConverter
}
type CustomJSONBObjectArray []postgresql.CustomJSONB
func (CustomJSONBObjectArray) ConvertValue(in interface{}) interface {
	sql.Scanner
	driver.Valuer
} {
	return &postgresql.JSONB{in}
}
type CustomJSONBObjectMap map[string]CustomJSONB
func (c CustomJSONBObjectMap) Value() (driver.Value, error) {
	return postgresql.JSONBValue(c)
}
func (c *CustomJSONBObjectMap) Scan(src interface{}) error {
	return postgresql.ScanJSONB(c, src)
}

Thanks for using db/v4!

What's Changed

  • Replace lib/pq with pgx by @xiam in #627
  • Fix sqlite.New panic by @sdvcrx in #635
  • Fix condition that forced the statement cache to be skipped by @xiam in #638

New Contributors

Acknowledgements

Special thanks to @pkieltyka and Horizon Blockchain Games for their continuos support over the years! Thank you very much

Full Changelog: v4.2.1...v4.5.0

Contributors

pkieltyka, xiam, and 3 other contributors
Loading
mfridman and aciobanupaack reacted with hooray emoji
2 people reacted
Previous 1 3 4
Previous

AltStyle によって変換されたページ (->オリジナル) /