mirror of
				https://codeberg.org/forgejo/forgejo.git
				synced 2025-10-31 14:31:02 +00:00 
			
		
		
		
	Move binding as subrepo
This commit is contained in:
		
					parent
					
						
							
								33f2d33a46
							
						
					
				
			
			
				commit
				
					
						5c2da610a2
					
				
			
		
					 18 changed files with 1594 additions and 445 deletions
				
			
		|  | @ -8,3 +8,49 @@ type ( | |||
| 	// Type TmplData represents data in the templates. | ||||
| 	TmplData map[string]interface{} | ||||
| ) | ||||
| 
 | ||||
| // __________.__            .___.__ | ||||
| // \______   \__| ____    __| _/|__| ____    ____ | ||||
| //  |    |  _/  |/    \  / __ | |  |/    \  / ___\ | ||||
| //  |    |   \  |   |  \/ /_/ | |  |   |  \/ /_/  > | ||||
| //  |______  /__|___|  /\____ | |__|___|  /\___  / | ||||
| //         \/        \/      \/         \//_____/ | ||||
| 
 | ||||
| // Errors represents the contract of the response body when the | ||||
| // binding step fails before getting to the application. | ||||
| type BindingErrors struct { | ||||
| 	Overall map[string]string `json:"overall"` | ||||
| 	Fields  map[string]string `json:"fields"` | ||||
| } | ||||
| 
 | ||||
| // Total errors is the sum of errors with the request overall | ||||
| // and errors on individual fields. | ||||
| func (err BindingErrors) Count() int { | ||||
| 	return len(err.Overall) + len(err.Fields) | ||||
| } | ||||
| 
 | ||||
| func (this *BindingErrors) Combine(other BindingErrors) { | ||||
| 	for key, val := range other.Fields { | ||||
| 		if _, exists := this.Fields[key]; !exists { | ||||
| 			this.Fields[key] = val | ||||
| 		} | ||||
| 	} | ||||
| 	for key, val := range other.Overall { | ||||
| 		if _, exists := this.Overall[key]; !exists { | ||||
| 			this.Overall[key] = val | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| const ( | ||||
| 	BindingRequireError         string = "Required" | ||||
| 	BindingAlphaDashError       string = "AlphaDash" | ||||
| 	BindingMinSizeError         string = "MinSize" | ||||
| 	BindingMaxSizeError         string = "MaxSize" | ||||
| 	BindingEmailError           string = "Email" | ||||
| 	BindingUrlError             string = "Url" | ||||
| 	BindingDeserializationError string = "DeserializationError" | ||||
| 	BindingIntegerTypeError     string = "IntegerTypeError" | ||||
| 	BindingBooleanTypeError     string = "BooleanTypeError" | ||||
| 	BindingFloatTypeError       string = "FloatTypeError" | ||||
| ) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue