Added support to schema name in returning clause
This commit is contained in:
		
							parent
							
								
									447885d98f
								
							
						
					
					
						commit
						51213b0f69
					
				@ -5,6 +5,7 @@ import (
 | 
				
			|||||||
	"database/sql/driver"
 | 
						"database/sql/driver"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"reflect"
 | 
						"reflect"
 | 
				
			||||||
 | 
						"strings"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/lib/pq/hstore"
 | 
						"github.com/lib/pq/hstore"
 | 
				
			||||||
@ -60,7 +61,12 @@ func (postgres) SqlTag(value reflect.Value, size int, autoIncrease bool) string
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s postgres) ReturningStr(tableName, key string) string {
 | 
					func (s postgres) ReturningStr(tableName, key string) string {
 | 
				
			||||||
	return fmt.Sprintf("RETURNING %v.%v", s.Quote(tableName), key)
 | 
						fullName := strings.Split(tableName,".")
 | 
				
			||||||
 | 
						if len(fullName) == 1 {
 | 
				
			||||||
 | 
							return fmt.Sprintf("RETURNING %v.%v", s.Quote(tableName), key)
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							return fmt.Sprintf("RETURNING %v.%v.%v", s.Quote(fullName[0]), s.Quote(fullName[1]), key)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s postgres) HasTable(scope *Scope, tableName string) bool {
 | 
					func (s postgres) HasTable(scope *Scope, tableName string) bool {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user