mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 19:42:26 -05:00 
			
		
		
		
	update bun library -> v1.0.4
Signed-off-by: kim (grufwub) <grufwub@gmail.com>
This commit is contained in:
		
					parent
					
						
							
								2b14b20802
							
						
					
				
			
			
				commit
				
					
						bdcc090851
					
				
			
		
					 87 changed files with 538 additions and 503 deletions
				
			
		
							
								
								
									
										23
									
								
								vendor/github.com/uptrace/bun/query_insert.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										23
									
								
								vendor/github.com/uptrace/bun/query_insert.go
									
										
									
										generated
									
									
										vendored
									
									
								
							|  | @ -5,6 +5,7 @@ import ( | |||
| 	"database/sql" | ||||
| 	"fmt" | ||||
| 	"reflect" | ||||
| 	"strings" | ||||
| 
 | ||||
| 	"github.com/uptrace/bun/dialect/feature" | ||||
| 	"github.com/uptrace/bun/internal" | ||||
|  | @ -16,7 +17,7 @@ type InsertQuery struct { | |||
| 	returningQuery | ||||
| 	customValueQuery | ||||
| 
 | ||||
| 	onConflict schema.QueryWithArgs | ||||
| 	on schema.QueryWithArgs | ||||
| 	setQuery | ||||
| 
 | ||||
| 	ignore  bool | ||||
|  | @ -88,13 +89,13 @@ func (q *InsertQuery) ExcludeColumn(columns ...string) *InsertQuery { | |||
| 	return q | ||||
| } | ||||
| 
 | ||||
| // Value overwrites model value for the column in INSERT and UPDATE queries. | ||||
| func (q *InsertQuery) Value(column string, value string, args ...interface{}) *InsertQuery { | ||||
| // Value overwrites model value for the column. | ||||
| func (q *InsertQuery) Value(column string, expr string, args ...interface{}) *InsertQuery { | ||||
| 	if q.table == nil { | ||||
| 		q.err = errNilModel | ||||
| 		return q | ||||
| 	} | ||||
| 	q.addValue(q.table, column, value, args) | ||||
| 	q.addValue(q.table, column, expr, args) | ||||
| 	return q | ||||
| } | ||||
| 
 | ||||
|  | @ -162,7 +163,7 @@ func (q *InsertQuery) AppendQuery(fmter schema.Formatter, b []byte) (_ []byte, e | |||
| 	} | ||||
| 	b = append(b, "INTO "...) | ||||
| 
 | ||||
| 	if q.db.features.Has(feature.InsertTableAlias) && !q.onConflict.IsZero() { | ||||
| 	if q.db.features.Has(feature.InsertTableAlias) && !q.on.IsZero() { | ||||
| 		b, err = q.appendFirstTableWithAlias(fmter, b) | ||||
| 	} else { | ||||
| 		b, err = q.appendFirstTable(fmter, b) | ||||
|  | @ -382,7 +383,7 @@ func (q *InsertQuery) appendFields( | |||
| //------------------------------------------------------------------------------ | ||||
| 
 | ||||
| func (q *InsertQuery) On(s string, args ...interface{}) *InsertQuery { | ||||
| 	q.onConflict = schema.SafeQuery(s, args) | ||||
| 	q.on = schema.SafeQuery(s, args) | ||||
| 	return q | ||||
| } | ||||
| 
 | ||||
|  | @ -392,12 +393,12 @@ func (q *InsertQuery) Set(query string, args ...interface{}) *InsertQuery { | |||
| } | ||||
| 
 | ||||
| func (q *InsertQuery) appendOn(fmter schema.Formatter, b []byte) (_ []byte, err error) { | ||||
| 	if q.onConflict.IsZero() { | ||||
| 	if q.on.IsZero() { | ||||
| 		return b, nil | ||||
| 	} | ||||
| 
 | ||||
| 	b = append(b, " ON "...) | ||||
| 	b, err = q.onConflict.AppendQuery(fmter, b) | ||||
| 	b, err = q.on.AppendQuery(fmter, b) | ||||
| 	if err != nil { | ||||
| 		return nil, err | ||||
| 	} | ||||
|  | @ -413,7 +414,7 @@ func (q *InsertQuery) appendOn(fmter schema.Formatter, b []byte) (_ []byte, err | |||
| 		if err != nil { | ||||
| 			return nil, err | ||||
| 		} | ||||
| 	} else if len(q.columns) > 0 { | ||||
| 	} else if q.onConflictDoUpdate() { | ||||
| 		fields, err := q.getDataFields() | ||||
| 		if err != nil { | ||||
| 			return nil, err | ||||
|  | @ -434,6 +435,10 @@ func (q *InsertQuery) appendOn(fmter schema.Formatter, b []byte) (_ []byte, err | |||
| 	return b, nil | ||||
| } | ||||
| 
 | ||||
| func (q *InsertQuery) onConflictDoUpdate() bool { | ||||
| 	return strings.HasSuffix(strings.ToUpper(q.on.Query), " DO UPDATE") | ||||
| } | ||||
| 
 | ||||
| func (q *InsertQuery) appendSetExcluded(b []byte, fields []*schema.Field) []byte { | ||||
| 	b = append(b, " SET "...) | ||||
| 	for i, f := range fields { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue