Merge pull request #708 from pacificporter/is_byte_array_or_slice
Fix SqlTag() in case of ByteSlice
This commit is contained in:
		
						commit
						67f88d977b
					
				@ -53,7 +53,7 @@ func (postgres) SqlTag(value reflect.Value, size int, autoIncrease bool) string
 | 
				
			|||||||
			return "hstore"
 | 
								return "hstore"
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		if isByteArray(value) {
 | 
							if isByteArrayOrSlice(value) {
 | 
				
			||||||
			if isUUID(value) {
 | 
								if isUUID(value) {
 | 
				
			||||||
				return "uuid"
 | 
									return "uuid"
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@ -65,8 +65,8 @@ func (postgres) SqlTag(value reflect.Value, size int, autoIncrease bool) string
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
var byteType = reflect.TypeOf(uint8(0))
 | 
					var byteType = reflect.TypeOf(uint8(0))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func isByteArray(value reflect.Value) bool {
 | 
					func isByteArrayOrSlice(value reflect.Value) bool {
 | 
				
			||||||
	return value.Kind() == reflect.Array && value.Type().Elem() == byteType
 | 
						return (value.Kind() == reflect.Array || value.Kind() == reflect.Slice) && value.Type().Elem() == byteType
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func isUUID(value reflect.Value) bool {
 | 
					func isUUID(value reflect.Value) bool {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user