Add support for int64 scans (#2)
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				Build / build (push) Successful in 4m18s
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	Build / build (push) Successful in 4m18s
				
			Reviewed-on: #2
This commit is contained in:
		
							
								
								
									
										2
									
								
								query.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								query.go
									
									
									
									
									
								
							| @@ -217,6 +217,8 @@ func (r *Rows) scanArgument(i int, arg any) error { | |||||||
| 		*asString = r.query.stmt.ColumnText(i) | 		*asString = r.query.stmt.ColumnText(i) | ||||||
| 	} else if asInt, ok := arg.(*int); ok { | 	} else if asInt, ok := arg.(*int); ok { | ||||||
| 		*asInt = r.query.stmt.ColumnInt(i) | 		*asInt = r.query.stmt.ColumnInt(i) | ||||||
|  | 	} else if asInt, ok := arg.(*int64); ok { | ||||||
|  | 		*asInt = r.query.stmt.ColumnInt64(i) | ||||||
| 	} else if asBool, ok := arg.(*bool); ok { | 	} else if asBool, ok := arg.(*bool); ok { | ||||||
| 		*asBool = r.query.stmt.ColumnBool(i) | 		*asBool = r.query.stmt.ColumnBool(i) | ||||||
| 	} else if reflect.TypeOf(arg).Kind() == reflect.Ptr && reflect.TypeOf(arg).Elem().Kind() == reflect.Ptr { | 	} else if reflect.TypeOf(arg).Kind() == reflect.Ptr && reflect.TypeOf(arg).Elem().Kind() == reflect.Ptr { | ||||||
|   | |||||||
| @@ -167,6 +167,15 @@ func TestQueryWithPointerStringArguments(t *testing.T) { | |||||||
| 	require.Equal(t, "bar", *result) | 	require.Equal(t, "bar", *result) | ||||||
| } | } | ||||||
|  |  | ||||||
|  | func TestQueryWithInt64Scan(t *testing.T) { | ||||||
|  | 	db := openTestDb(t) | ||||||
|  | 	var result int64 | ||||||
|  | 	err := db.Query("select 2").ScanSingle(&result) | ||||||
|  | 	require.NoError(t, err) | ||||||
|  | 	require.NotNil(t, result) | ||||||
|  | 	require.Equal(t, int64(2), result) | ||||||
|  | } | ||||||
|  |  | ||||||
| func TestQueryWithPointerStringArgumentsCanSetToNull(t *testing.T) { | func TestQueryWithPointerStringArgumentsCanSetToNull(t *testing.T) { | ||||||
| 	db := openTestDb(t) | 	db := openTestDb(t) | ||||||
| 	db.Query("update mytable set value=null where key = 'foo'").MustExec() | 	db.Query("update mytable set value=null where key = 'foo'").MustExec() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user