mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-23 11:02:57 -06:00
* start fixing up tests * fix up tests + automate with drone * fiddle with linting * messing about with drone.yml * some more fiddling * hmmm * add cache * add vendor directory * verbose * ci updates * update some little things * update sig
8.4 KiB
8.4 KiB
Changelog
❤️ Uptrace.dev - All-in-one tool to optimize performance and monitor errors & logs
Important. Please check Bun - the next
iteration of go-pg built on top of sql.DB.
v10.10
-
Removed extra OpenTelemetry spans from go-pg core. Now go-pg instrumentation only adds a single span with a SQL query (instead of 4 spans). There are multiple reasons behind this decision:
- Traces become smaller and less noisy.
- Bun can't support the same level of instrumentation and it is nice to keep the projects synced.
- It may be costly to process those 3 extra spans for each query.
Eventually we hope to replace the information that we no longer collect with OpenTelemetry Metrics.
v10.9
- To make updating easier, extra modules now have the same version as go-pg does. That means that you need to update your imports:
github.com/go-pg/pg/extra/pgdebug -> github.com/go-pg/pg/extra/pgdebug/v10
github.com/go-pg/pg/extra/pgotel -> github.com/go-pg/pg/extra/pgotel/v10
github.com/go-pg/pg/extra/pgsegment -> github.com/go-pg/pg/extra/pgsegment/v10
- Exported
pg.Querywhich should be used instead oform.Query. - Added
pg.DBIwhich is a DB interface implemented bypg.DBandpg.Tx.
v10
Resources
- Docs at https://pg.uptrace.dev/ powered by mkdocs.
- RealWorld example application.
- Discord.
Features
Select,Insert, andUpdatesupportmap[string]interface{}.Selectalso supports[]map[string]interface{}.
var mm []map[string]interface{}
err := db.Model((*User)(nil)).Limit(10).Select(&mm)
- Columns that start with
_are ignored if there is no destination field. - Optional faster json encoding.
- Added pgext.OpenTelemetryHook that adds OpenTelemetry instrumentation.
- Added pgext.DebugHook that logs failed queries.
- Added
db.Pingto check if database is healthy.
Changes
- ORM relations are reworked and now require
reltag option (but existing code will continue working until v11). Supported options:pg:"rel:has-one"- has one relation.pg:"rel:belongs-to"- belongs to relation.pg:"rel:has-many"- has many relation.pg:"many2many:book_genres"- many to many relation.
- Changed
pg.QueryHookto return temp byte slice to reduce memory usage. ,msgpackstruct tag marshals data in MessagePack format using https://github.com/vmihailenco/msgpack- Empty slices and maps are no longer marshaled as
NULL. Nil slices and maps are still marshaled asNULL. - Changed
UpdateNotZeroto include zero fields withpg:",use_zero"tag. Consider usingModel(*map[string]interface{})for inserts and updates. joinFKis deprecated in favor ofjoin_fk.partitionByis deprecated in favor ofpartition_by.- ORM shortcuts are removed:
db.Select(model)becomesdb.Model(model).WherePK().Select().db.Insert(model)becomesdb.Model(model).Insert().db.Update(model)becomesdb.Model(model).WherePK().Update().db.Delete(model)becomesdb.Model(model).WherePK().Delete().
- Deprecated types and funcs are removed.
WhereStructis removed.
v9
pg:",notnull"is reworked. Now it means SQLNOT NULLconstraint and nothing more.- Added
pg:",use_zero"to prevent go-pg from converting Go zero values to SQLNULL. - UpdateNotNull is renamed to UpdateNotZero. As previously it omits zero Go values, but it does not take in account if field is nullable or not.
- ORM supports DistinctOn.
- Hooks accept and return context.
- Client respects Context.Deadline when setting net.Conn deadline.
- Client listens on Context.Done while waiting for a connection from the pool and returns an error when context is cancelled.
Query.Columndoes not accept relation name any more. UseQuery.Relationinstead which returns an error if relation does not exist.- urlvalues package is removed in favor of https://github.com/go-pg/urlstruct. You can also use
struct based filters via
Query.WhereStruct. NewModelandAddModelmethods ofHooklessModelinterface were renamed toNextColumnScannerandAddColumnScannerrespectively.types.Fandpg.Fare deprecated in favor ofpg.Ident.types.Qis deprecated in favor ofpg.Safe.pg.Qis deprecated in favor ofpg.SafeQuery.TableNamefield is deprecated in favor oftableName.- Always use
pg:"..."struct field tag instead ofsql:"...". pg:",override"is deprecated in favor ofpg:",inherit".
v8
- Added
QueryContext,ExecContext, andModelContextwhich acceptcontext.Context. Queries are cancelled when context is cancelled. - Model hooks are changed to accept
context.Contextas first argument. - Fixed array and hstore parsers to handle multiple single quotes (#1235).
v7
- DB.OnQueryProcessed is replaced with DB.AddQueryHook.
- Added WhereStruct.
- orm.Pager is moved to urlvalues.Pager. Pager.FromURLValues returns an error if page or limit params can't be parsed.
v6.16
- Read buffer is re-worked. Default read buffer is increased to 65kb.
v6.15
- Added Options.MinIdleConns.
- Options.MaxAge renamed to Options.MaxConnAge.
- PoolStats.FreeConns is renamed to PoolStats.IdleConns.
- New hook BeforeSelectQuery.
,overrideis renamed to,inherit.- Dialer.KeepAlive is set to 5 minutes by default.
- Added support "scram-sha-256" authentication.
v6.14
- Fields ignored with
sql:"-"tag are no longer considered by ORM relation detector.
v6.12
Insert,Update, andDeletecan returnpg.ErrNoRowsandpg.ErrMultiRowswhenReturningis used and model expects single row.
v6.11
db.Model(&strct).Update()anddb.Model(&strct).Delete()no longer adds WHERE condition based on primary key when there are no conditions. Instead you should usedb.Update(&strct)ordb.Model(&strct).WherePK().Update().
v6.10
?Columnsis renamed to?TableColumns.?Columnsis changed to produce column names without table alias.
v6.9
pg:"fk"tag now accepts SQL names instead of Go names, e.g.pg:"fk:ParentId"becomespg:"fk:parent_id". Old code should continue working in most cases, but it is strongly advised to start using new convention.- uint and uint64 SQL type is changed from decimal to bigint according to the lesser of two evils
principle. Use
sql:"type:decimal"to get old behavior.
v6.8
CreateTableno longer adds ON DELETE hook by default. To get old behavior users should addsql:"on_delete:CASCADE"tag on foreign key field.
v6
types.Resultis renamed toorm.Result.- Added
OnQueryProcessedevent that can be used to log / report queries timing. Query logger is removed. orm.URLValuesis renamed toorm.URLFilters. It no longer adds ORDER clause.orm.Pageris renamed toorm.Pagination.- Support for net.IP and net.IPNet.
- Support for context.Context.
- Bulk/multi updates.
- Query.WhereGroup for enclosing conditions in parentheses.
v5
- All fields are nullable by default.
,nulltag is replaced with,notnull. Result.Affectedrenamed toResult.RowsAffected.- Added
Result.RowsReturned. Createrenamed toInsert,BeforeCreatetoBeforeInsert,AfterCreatetoAfterInsert.- Indexed placeholders support, e.g.
db.Exec("SELECT ?0 + ?0", 1). - Named placeholders are evaluated when query is executed.
- Added Update and Delete hooks.
- Order reworked to quote column names. OrderExpr added to bypass Order quoting restrictions.
- Group reworked to quote column names. GroupExpr added to bypass Group quoting restrictions.
v4
Options.HostandOptions.Portmerged intoOptions.Addr.- Added
Options.MaxRetries. Now queries are not retried by default. LoadIntorenamed toScan,ColumnLoaderrenamed toColumnScanner, LoadColumn renamed to ScanColumn,NewRecord() interface{}changed toNewModel() ColumnScanner,AppendQuery(dst []byte) []bytechanged toAppendValue(dst []byte, quote bool) ([]byte, error).- Structs, maps and slices are marshalled to JSON by default.
- Added support for scanning slices, .e.g. scanning
[]int. - Added object relational mapping.