mirror of
				https://github.com/TeaOSLab/EdgeCommon.git
				synced 2025-11-04 05:00:24 +08:00 
			
		
		
		
	
		
			
	
	
		
			25 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			25 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| 
								 | 
							
								package firewallconfigs
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// attach option
							 | 
						||
| 
								 | 
							
								type FieldOption struct {
							 | 
						||
| 
								 | 
							
									Type        string                                       `json:"type"`
							 | 
						||
| 
								 | 
							
									Name        string                                       `json:"name"`
							 | 
						||
| 
								 | 
							
									Code        string                                       `json:"code"`
							 | 
						||
| 
								 | 
							
									Value       string                                       `json:"value"` // default value
							 | 
						||
| 
								 | 
							
									IsRequired  bool                                         `json:"isRequired"`
							 | 
						||
| 
								 | 
							
									Size        int                                          `json:"size"`
							 | 
						||
| 
								 | 
							
									Comment     string                                       `json:"comment"`
							 | 
						||
| 
								 | 
							
									Placeholder string                                       `json:"placeholder"`
							 | 
						||
| 
								 | 
							
									RightLabel  string                                       `json:"rightLabel"`
							 | 
						||
| 
								 | 
							
									MaxLength   int                                          `json:"maxLength"`
							 | 
						||
| 
								 | 
							
									Validate    func(value string) (ok bool, message string) `json:"-"`
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								func NewFieldOption(name string, code string) *FieldOption {
							 | 
						||
| 
								 | 
							
									return &FieldOption{
							 | 
						||
| 
								 | 
							
										Type: "field",
							 | 
						||
| 
								 | 
							
										Name: name,
							 | 
						||
| 
								 | 
							
										Code: code,
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
								}
							 |