mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-30 06:38:37 -04:00 
			
		
		
		
	[Vendor] Update directly used dependencys (#15593)
* update github.com/blevesearch/bleve v2.0.2 -> v2.0.3 * github.com/denisenkom/go-mssqldb v0.9.0 -> v0.10.0 * github.com/editorconfig/editorconfig-core-go v2.4.1 -> v2.4.2 * github.com/go-chi/cors v1.1.1 -> v1.2.0 * github.com/go-git/go-billy v5.0.0 -> v5.1.0 * github.com/go-git/go-git v5.2.0 -> v5.3.0 * github.com/go-ldap/ldap v3.2.4 -> v3.3.0 * github.com/go-redis/redis v8.6.0 -> v8.8.2 * github.com/go-sql-driver/mysql v1.5.0 -> v1.6.0 * github.com/go-swagger/go-swagger v0.26.1 -> v0.27.0 * github.com/lib/pq v1.9.0 -> v1.10.1 * github.com/mattn/go-sqlite3 v1.14.6 -> v1.14.7 * github.com/go-testfixtures/testfixtures v3.5.0 -> v3.6.0 * github.com/issue9/identicon v1.0.1 -> v1.2.0 * github.com/klauspost/compress v1.11.8 -> v1.12.1 * github.com/mgechev/revive v1.0.3 -> v1.0.6 * github.com/microcosm-cc/bluemonday v1.0.7 -> v1.0.8 * github.com/niklasfasching/go-org v1.4.0 -> v1.5.0 * github.com/olivere/elastic v7.0.22 -> v7.0.24 * github.com/pelletier/go-toml v1.8.1 -> v1.9.0 * github.com/prometheus/client_golang v1.9.0 -> v1.10.0 * github.com/xanzy/go-gitlab v0.44.0 -> v0.48.0 * github.com/yuin/goldmark v1.3.3 -> v1.3.5 * github.com/6543/go-version v1.2.4 -> v1.3.1 * do github.com/lib/pq v1.10.0 -> v1.10.1 again ...
This commit is contained in:
		
							
								
								
									
										97
									
								
								vendor/github.com/google/go-querystring/query/encode.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										97
									
								
								vendor/github.com/google/go-querystring/query/encode.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -51,8 +51,8 @@ type Encoder interface { | ||||
| //	- the field is empty and its tag specifies the "omitempty" option | ||||
| // | ||||
| // The empty values are false, 0, any nil pointer or interface value, any array | ||||
| // slice, map, or string of length zero, and any time.Time that returns true | ||||
| // for IsZero(). | ||||
| // slice, map, or string of length zero, and any type (such as time.Time) that | ||||
| // returns true for IsZero(). | ||||
| // | ||||
| // The URL parameter name defaults to the struct field name but can be | ||||
| // specified in the struct field's tag value.  The "url" key in the struct | ||||
| @@ -82,7 +82,14 @@ type Encoder interface { | ||||
| // | ||||
| // time.Time values default to encoding as RFC3339 timestamps.  Including the | ||||
| // "unix" option signals that the field should be encoded as a Unix time (see | ||||
| // time.Unix()) | ||||
| // time.Unix()).  The "unixmilli" and "unixnano" options will encode the number | ||||
| // of milliseconds and nanoseconds, respectively, since January 1, 1970 (see | ||||
| // time.UnixNano()).  Including the "layout" struct tag (separate from the | ||||
| // "url" tag) will use the value of the "layout" tag as a layout passed to | ||||
| // time.Format.  For example: | ||||
| // | ||||
| // 	// Encode a time.Time as YYYY-MM-DD | ||||
| // 	Field time.Time `layout:"2006-01-02"` | ||||
| // | ||||
| // Slice and Array values default to encoding as multiple URL values of the | ||||
| // same name.  Including the "comma" option signals that the field should be | ||||
| @@ -92,7 +99,13 @@ type Encoder interface { | ||||
| // Including the "brackets" option signals that the multiple URL values should | ||||
| // have "[]" appended to the value name. "numbered" will append a number to | ||||
| // the end of each incidence of the value name, example: | ||||
| // name0=value0&name1=value1, etc. | ||||
| // name0=value0&name1=value1, etc.  Including the "del" struct tag (separate | ||||
| // from the "url" tag) will use the value of the "del" tag as the delimiter. | ||||
| // For example: | ||||
| // | ||||
| // 	// Encode a slice of bools as ints ("1" for true, "0" for false), | ||||
| // 	// separated by exclamation points "!". | ||||
| // 	Field []bool `url:",int" del:"!"` | ||||
| // | ||||
| // Anonymous struct fields are usually encoded as if their inner exported | ||||
| // fields were fields in the outer struct, subject to the standard Go | ||||
| @@ -151,11 +164,15 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error { | ||||
| 			continue | ||||
| 		} | ||||
| 		name, opts := parseTag(tag) | ||||
|  | ||||
| 		if name == "" { | ||||
| 			if sf.Anonymous && sv.Kind() == reflect.Struct { | ||||
| 				// save embedded struct for later processing | ||||
| 				embedded = append(embedded, sv) | ||||
| 				continue | ||||
| 			if sf.Anonymous { | ||||
| 				v := reflect.Indirect(sv) | ||||
| 				if v.IsValid() && v.Kind() == reflect.Struct { | ||||
| 					// save embedded struct for later processing | ||||
| 					embedded = append(embedded, v) | ||||
| 					continue | ||||
| 				} | ||||
| 			} | ||||
|  | ||||
| 			name = sf.Name | ||||
| @@ -170,7 +187,9 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error { | ||||
| 		} | ||||
|  | ||||
| 		if sv.Type().Implements(encoderType) { | ||||
| 			if !reflect.Indirect(sv).IsValid() { | ||||
| 			// if sv is a nil pointer and the custom encoder is defined on a non-pointer | ||||
| 			// method receiver, set sv to the zero value of the underlying type | ||||
| 			if !reflect.Indirect(sv).IsValid() && sv.Type().Elem().Implements(encoderType) { | ||||
| 				sv = reflect.New(sv.Type().Elem()) | ||||
| 			} | ||||
|  | ||||
| @@ -181,28 +200,38 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error { | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| 		// recursively dereference pointers. break on nil pointers | ||||
| 		for sv.Kind() == reflect.Ptr { | ||||
| 			if sv.IsNil() { | ||||
| 				break | ||||
| 			} | ||||
| 			sv = sv.Elem() | ||||
| 		} | ||||
|  | ||||
| 		if sv.Kind() == reflect.Slice || sv.Kind() == reflect.Array { | ||||
| 			var del byte | ||||
| 			var del string | ||||
| 			if opts.Contains("comma") { | ||||
| 				del = ',' | ||||
| 				del = "," | ||||
| 			} else if opts.Contains("space") { | ||||
| 				del = ' ' | ||||
| 				del = " " | ||||
| 			} else if opts.Contains("semicolon") { | ||||
| 				del = ';' | ||||
| 				del = ";" | ||||
| 			} else if opts.Contains("brackets") { | ||||
| 				name = name + "[]" | ||||
| 			} else { | ||||
| 				del = sf.Tag.Get("del") | ||||
| 			} | ||||
|  | ||||
| 			if del != 0 { | ||||
| 			if del != "" { | ||||
| 				s := new(bytes.Buffer) | ||||
| 				first := true | ||||
| 				for i := 0; i < sv.Len(); i++ { | ||||
| 					if first { | ||||
| 						first = false | ||||
| 					} else { | ||||
| 						s.WriteByte(del) | ||||
| 						s.WriteString(del) | ||||
| 					} | ||||
| 					s.WriteString(valueString(sv.Index(i), opts)) | ||||
| 					s.WriteString(valueString(sv.Index(i), opts, sf)) | ||||
| 				} | ||||
| 				values.Add(name, s.String()) | ||||
| 			} else { | ||||
| @@ -211,30 +240,25 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error { | ||||
| 					if opts.Contains("numbered") { | ||||
| 						k = fmt.Sprintf("%s%d", name, i) | ||||
| 					} | ||||
| 					values.Add(k, valueString(sv.Index(i), opts)) | ||||
| 					values.Add(k, valueString(sv.Index(i), opts, sf)) | ||||
| 				} | ||||
| 			} | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| 		for sv.Kind() == reflect.Ptr { | ||||
| 			if sv.IsNil() { | ||||
| 				break | ||||
| 			} | ||||
| 			sv = sv.Elem() | ||||
| 		} | ||||
|  | ||||
| 		if sv.Type() == timeType { | ||||
| 			values.Add(name, valueString(sv, opts)) | ||||
| 			values.Add(name, valueString(sv, opts, sf)) | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| 		if sv.Kind() == reflect.Struct { | ||||
| 			reflectValue(values, sv, name) | ||||
| 			if err := reflectValue(values, sv, name); err != nil { | ||||
| 				return err | ||||
| 			} | ||||
| 			continue | ||||
| 		} | ||||
|  | ||||
| 		values.Add(name, valueString(sv, opts)) | ||||
| 		values.Add(name, valueString(sv, opts, sf)) | ||||
| 	} | ||||
|  | ||||
| 	for _, f := range embedded { | ||||
| @@ -247,7 +271,7 @@ func reflectValue(values url.Values, val reflect.Value, scope string) error { | ||||
| } | ||||
|  | ||||
| // valueString returns the string representation of a value. | ||||
| func valueString(v reflect.Value, opts tagOptions) string { | ||||
| func valueString(v reflect.Value, opts tagOptions, sf reflect.StructField) string { | ||||
| 	for v.Kind() == reflect.Ptr { | ||||
| 		if v.IsNil() { | ||||
| 			return "" | ||||
| @@ -267,6 +291,15 @@ func valueString(v reflect.Value, opts tagOptions) string { | ||||
| 		if opts.Contains("unix") { | ||||
| 			return strconv.FormatInt(t.Unix(), 10) | ||||
| 		} | ||||
| 		if opts.Contains("unixmilli") { | ||||
| 			return strconv.FormatInt((t.UnixNano() / 1e6), 10) | ||||
| 		} | ||||
| 		if opts.Contains("unixnano") { | ||||
| 			return strconv.FormatInt(t.UnixNano(), 10) | ||||
| 		} | ||||
| 		if layout := sf.Tag.Get("layout"); layout != "" { | ||||
| 			return t.Format(layout) | ||||
| 		} | ||||
| 		return t.Format(time.RFC3339) | ||||
| 	} | ||||
|  | ||||
| @@ -291,8 +324,12 @@ func isEmptyValue(v reflect.Value) bool { | ||||
| 		return v.IsNil() | ||||
| 	} | ||||
|  | ||||
| 	if v.Type() == timeType { | ||||
| 		return v.Interface().(time.Time).IsZero() | ||||
| 	type zeroable interface { | ||||
| 		IsZero() bool | ||||
| 	} | ||||
|  | ||||
| 	if z, ok := v.Interface().(zeroable); ok { | ||||
| 		return z.IsZero() | ||||
| 	} | ||||
|  | ||||
| 	return false | ||||
|   | ||||
		Reference in New Issue
	
	Block a user