mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 12:22:24 -05:00 
			
		
		
		
	[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>
This commit is contained in:
		
					parent
					
						
							
								00d38855d4
							
						
					
				
			
			
				commit
				
					
						a156188b3e
					
				
			
		
					 1135 changed files with 258905 additions and 137146 deletions
				
			
		
							
								
								
									
										86
									
								
								vendor/github.com/uptrace/bun/relation_join.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										86
									
								
								vendor/github.com/uptrace/bun/relation_join.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -4,6 +4,7 @@ import ( | |||
| 	"context" | ||||
| 	"reflect" | ||||
| 
 | ||||
| 	"github.com/uptrace/bun/dialect/feature" | ||||
| 	"github.com/uptrace/bun/internal" | ||||
| 	"github.com/uptrace/bun/schema" | ||||
| ) | ||||
|  | @ -60,6 +61,14 @@ func (j *relationJoin) manyQuery(q *SelectQuery) *SelectQuery { | |||
| 	q = q.Model(hasManyModel) | ||||
| 
 | ||||
| 	var where []byte | ||||
| 
 | ||||
| 	if q.db.dialect.Features().Has(feature.CompositeIn) { | ||||
| 		return j.manyQueryCompositeIn(where, q) | ||||
| 	} | ||||
| 	return j.manyQueryMulti(where, q) | ||||
| } | ||||
| 
 | ||||
| func (j *relationJoin) manyQueryCompositeIn(where []byte, q *SelectQuery) *SelectQuery { | ||||
| 	if len(j.Relation.JoinFields) > 1 { | ||||
| 		where = append(where, '(') | ||||
| 	} | ||||
|  | @ -88,6 +97,29 @@ func (j *relationJoin) manyQuery(q *SelectQuery) *SelectQuery { | |||
| 	return q | ||||
| } | ||||
| 
 | ||||
| func (j *relationJoin) manyQueryMulti(where []byte, q *SelectQuery) *SelectQuery { | ||||
| 	where = appendMultiValues( | ||||
| 		q.db.Formatter(), | ||||
| 		where, | ||||
| 		j.JoinModel.rootValue(), | ||||
| 		j.JoinModel.parentIndex(), | ||||
| 		j.Relation.BaseFields, | ||||
| 		j.Relation.JoinFields, | ||||
| 		j.JoinModel.Table().SQLAlias, | ||||
| 	) | ||||
| 
 | ||||
| 	q = q.Where(internal.String(where)) | ||||
| 
 | ||||
| 	if j.Relation.PolymorphicField != nil { | ||||
| 		q = q.Where("? = ?", j.Relation.PolymorphicField.SQLName, j.Relation.PolymorphicValue) | ||||
| 	} | ||||
| 
 | ||||
| 	j.applyTo(q) | ||||
| 	q = q.Apply(j.hasManyColumns) | ||||
| 
 | ||||
| 	return q | ||||
| } | ||||
| 
 | ||||
| func (j *relationJoin) hasManyColumns(q *SelectQuery) *SelectQuery { | ||||
| 	b := make([]byte, 0, 32) | ||||
| 
 | ||||
|  | @ -151,7 +183,7 @@ func (j *relationJoin) m2mQuery(q *SelectQuery) *SelectQuery { | |||
| 	//nolint | ||||
| 	var join []byte | ||||
| 	join = append(join, "JOIN "...) | ||||
| 	join = fmter.AppendQuery(join, string(j.Relation.M2MTable.Name)) | ||||
| 	join = fmter.AppendQuery(join, string(j.Relation.M2MTable.SQLName)) | ||||
| 	join = append(join, " AS "...) | ||||
| 	join = append(join, j.Relation.M2MTable.SQLAlias...) | ||||
| 	join = append(join, " ON ("...) | ||||
|  | @ -312,3 +344,55 @@ func appendChildValues( | |||
| 	} | ||||
| 	return b | ||||
| } | ||||
| 
 | ||||
| // appendMultiValues is an alternative to appendChildValues that doesn't use the sql keyword ID | ||||
| // but instead use a old style ((k1=v1) AND (k2=v2)) OR (...) of conditions. | ||||
| func appendMultiValues( | ||||
| 	fmter schema.Formatter, b []byte, v reflect.Value, index []int, baseFields, joinFields []*schema.Field, joinTable schema.Safe, | ||||
| ) []byte { | ||||
| 	// This is based on a mix of appendChildValues and query_base.appendColumns | ||||
| 
 | ||||
| 	// These should never missmatch in length but nice to know if it does | ||||
| 	if len(joinFields) != len(baseFields) { | ||||
| 		panic("not reached") | ||||
| 	} | ||||
| 
 | ||||
| 	// walk the relations | ||||
| 	b = append(b, '(') | ||||
| 	seen := make(map[string]struct{}) | ||||
| 	walk(v, index, func(v reflect.Value) { | ||||
| 		start := len(b) | ||||
| 		for i, f := range baseFields { | ||||
| 			if i > 0 { | ||||
| 				b = append(b, " AND "...) | ||||
| 			} | ||||
| 			if len(baseFields) > 1 { | ||||
| 				b = append(b, '(') | ||||
| 			} | ||||
| 			// Field name | ||||
| 			b = append(b, joinTable...) | ||||
| 			b = append(b, '.') | ||||
| 			b = append(b, []byte(joinFields[i].SQLName)...) | ||||
| 
 | ||||
| 			// Equals value | ||||
| 			b = append(b, '=') | ||||
| 			b = f.AppendValue(fmter, b, v) | ||||
| 			if len(baseFields) > 1 { | ||||
| 				b = append(b, ')') | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		b = append(b, ") OR ("...) | ||||
| 
 | ||||
| 		if _, ok := seen[string(b[start:])]; ok { | ||||
| 			b = b[:start] | ||||
| 		} else { | ||||
| 			seen[string(b[start:])] = struct{}{} | ||||
| 		} | ||||
| 	}) | ||||
| 	if len(seen) > 0 { | ||||
| 		b = b[:len(b)-6] // trim ") OR (" | ||||
| 	} | ||||
| 	b = append(b, ')') | ||||
| 	return b | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue