mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 10:22:25 -05:00 
			
		
		
		
	bumps uptrace/bun dependencies to v1.2.6 (#3569)
This commit is contained in:
		
					parent
					
						
							
								a444adee97
							
						
					
				
			
			
				commit
				
					
						3fceb5fc1a
					
				
			
		
					 68 changed files with 6517 additions and 194 deletions
				
			
		
							
								
								
									
										105
									
								
								vendor/github.com/uptrace/bun/query_select.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										105
									
								
								vendor/github.com/uptrace/bun/query_select.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -6,8 +6,6 @@ import ( | |||
| 	"database/sql" | ||||
| 	"errors" | ||||
| 	"fmt" | ||||
| 	"strconv" | ||||
| 	"strings" | ||||
| 	"sync" | ||||
| 
 | ||||
| 	"github.com/uptrace/bun/dialect" | ||||
|  | @ -25,14 +23,12 @@ type union struct { | |||
| type SelectQuery struct { | ||||
| 	whereBaseQuery | ||||
| 	idxHintsQuery | ||||
| 	orderLimitOffsetQuery | ||||
| 
 | ||||
| 	distinctOn []schema.QueryWithArgs | ||||
| 	joins      []joinQuery | ||||
| 	group      []schema.QueryWithArgs | ||||
| 	having     []schema.QueryWithArgs | ||||
| 	order      []schema.QueryWithArgs | ||||
| 	limit      int32 | ||||
| 	offset     int32 | ||||
| 	selFor     schema.QueryWithArgs | ||||
| 
 | ||||
| 	union []union | ||||
|  | @ -66,10 +62,12 @@ func (q *SelectQuery) Err(err error) *SelectQuery { | |||
| 	return q | ||||
| } | ||||
| 
 | ||||
| // Apply calls the fn passing the SelectQuery as an argument. | ||||
| func (q *SelectQuery) Apply(fn func(*SelectQuery) *SelectQuery) *SelectQuery { | ||||
| 	if fn != nil { | ||||
| 		return fn(q) | ||||
| // Apply calls each function in fns, passing the SelectQuery as an argument. | ||||
| func (q *SelectQuery) Apply(fns ...func(*SelectQuery) *SelectQuery) *SelectQuery { | ||||
| 	for _, fn := range fns { | ||||
| 		if fn != nil { | ||||
| 			q = fn(q) | ||||
| 		} | ||||
| 	} | ||||
| 	return q | ||||
| } | ||||
|  | @ -279,46 +277,22 @@ func (q *SelectQuery) Having(having string, args ...interface{}) *SelectQuery { | |||
| } | ||||
| 
 | ||||
| func (q *SelectQuery) Order(orders ...string) *SelectQuery { | ||||
| 	for _, order := range orders { | ||||
| 		if order == "" { | ||||
| 			continue | ||||
| 		} | ||||
| 
 | ||||
| 		index := strings.IndexByte(order, ' ') | ||||
| 		if index == -1 { | ||||
| 			q.order = append(q.order, schema.UnsafeIdent(order)) | ||||
| 			continue | ||||
| 		} | ||||
| 
 | ||||
| 		field := order[:index] | ||||
| 		sort := order[index+1:] | ||||
| 
 | ||||
| 		switch strings.ToUpper(sort) { | ||||
| 		case "ASC", "DESC", "ASC NULLS FIRST", "DESC NULLS FIRST", | ||||
| 			"ASC NULLS LAST", "DESC NULLS LAST": | ||||
| 			q.order = append(q.order, schema.SafeQuery("? ?", []interface{}{ | ||||
| 				Ident(field), | ||||
| 				Safe(sort), | ||||
| 			})) | ||||
| 		default: | ||||
| 			q.order = append(q.order, schema.UnsafeIdent(order)) | ||||
| 		} | ||||
| 	} | ||||
| 	q.addOrder(orders...) | ||||
| 	return q | ||||
| } | ||||
| 
 | ||||
| func (q *SelectQuery) OrderExpr(query string, args ...interface{}) *SelectQuery { | ||||
| 	q.order = append(q.order, schema.SafeQuery(query, args)) | ||||
| 	q.addOrderExpr(query, args...) | ||||
| 	return q | ||||
| } | ||||
| 
 | ||||
| func (q *SelectQuery) Limit(n int) *SelectQuery { | ||||
| 	q.limit = int32(n) | ||||
| 	q.setLimit(n) | ||||
| 	return q | ||||
| } | ||||
| 
 | ||||
| func (q *SelectQuery) Offset(n int) *SelectQuery { | ||||
| 	q.offset = int32(n) | ||||
| 	q.setOffset(n) | ||||
| 	return q | ||||
| } | ||||
| 
 | ||||
|  | @ -615,35 +589,9 @@ func (q *SelectQuery) appendQuery( | |||
| 			return nil, err | ||||
| 		} | ||||
| 
 | ||||
| 		if fmter.Dialect().Features().Has(feature.OffsetFetch) { | ||||
| 			if q.limit > 0 && q.offset > 0 { | ||||
| 				b = append(b, " OFFSET "...) | ||||
| 				b = strconv.AppendInt(b, int64(q.offset), 10) | ||||
| 				b = append(b, " ROWS"...) | ||||
| 
 | ||||
| 				b = append(b, " FETCH NEXT "...) | ||||
| 				b = strconv.AppendInt(b, int64(q.limit), 10) | ||||
| 				b = append(b, " ROWS ONLY"...) | ||||
| 			} else if q.limit > 0 { | ||||
| 				b = append(b, " OFFSET 0 ROWS"...) | ||||
| 
 | ||||
| 				b = append(b, " FETCH NEXT "...) | ||||
| 				b = strconv.AppendInt(b, int64(q.limit), 10) | ||||
| 				b = append(b, " ROWS ONLY"...) | ||||
| 			} else if q.offset > 0 { | ||||
| 				b = append(b, " OFFSET "...) | ||||
| 				b = strconv.AppendInt(b, int64(q.offset), 10) | ||||
| 				b = append(b, " ROWS"...) | ||||
| 			} | ||||
| 		} else { | ||||
| 			if q.limit > 0 { | ||||
| 				b = append(b, " LIMIT "...) | ||||
| 				b = strconv.AppendInt(b, int64(q.limit), 10) | ||||
| 			} | ||||
| 			if q.offset > 0 { | ||||
| 				b = append(b, " OFFSET "...) | ||||
| 				b = strconv.AppendInt(b, int64(q.offset), 10) | ||||
| 			} | ||||
| 		b, err = q.appendLimitOffset(fmter, b) | ||||
| 		if err != nil { | ||||
| 			return nil, err | ||||
| 		} | ||||
| 
 | ||||
| 		if !q.selFor.IsZero() { | ||||
|  | @ -782,31 +730,6 @@ func (q *SelectQuery) appendTables(fmter schema.Formatter, b []byte) (_ []byte, | |||
| 	return q.appendTablesWithAlias(fmter, b) | ||||
| } | ||||
| 
 | ||||
| func (q *SelectQuery) appendOrder(fmter schema.Formatter, b []byte) (_ []byte, err error) { | ||||
| 	if len(q.order) > 0 { | ||||
| 		b = append(b, " ORDER BY "...) | ||||
| 
 | ||||
| 		for i, f := range q.order { | ||||
| 			if i > 0 { | ||||
| 				b = append(b, ", "...) | ||||
| 			} | ||||
| 			b, err = f.AppendQuery(fmter, b) | ||||
| 			if err != nil { | ||||
| 				return nil, err | ||||
| 			} | ||||
| 		} | ||||
| 
 | ||||
| 		return b, nil | ||||
| 	} | ||||
| 
 | ||||
| 	// MSSQL: allows Limit() without Order() as per https://stackoverflow.com/a/36156953 | ||||
| 	if q.limit > 0 && fmter.Dialect().Name() == dialect.MSSQL { | ||||
| 		return append(b, " ORDER BY _temp_sort"...), nil | ||||
| 	} | ||||
| 
 | ||||
| 	return b, nil | ||||
| } | ||||
| 
 | ||||
| //------------------------------------------------------------------------------ | ||||
| 
 | ||||
| func (q *SelectQuery) Rows(ctx context.Context) (*sql.Rows, error) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue