added SkipOutputStatement
This commit is contained in:
		
							parent
							
								
									b444011d09
								
							
						
					
					
						commit
						a90d464894
					
				
							
								
								
									
										17
									
								
								gorm.go
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								gorm.go
									
									
									
									
									
								
							@ -49,7 +49,8 @@ type Config struct {
 | 
				
			|||||||
	CreateBatchSize int
 | 
						CreateBatchSize int
 | 
				
			||||||
	// TranslateError enabling error translation
 | 
						// TranslateError enabling error translation
 | 
				
			||||||
	TranslateError bool
 | 
						TranslateError bool
 | 
				
			||||||
 | 
						// SkipOutputStatement disable OUTPUT clause when inserting a row
 | 
				
			||||||
 | 
						SkipOutputStatement bool
 | 
				
			||||||
	// ClauseBuilders clause builder
 | 
						// ClauseBuilders clause builder
 | 
				
			||||||
	ClauseBuilders map[string]clause.ClauseBuilder
 | 
						ClauseBuilders map[string]clause.ClauseBuilder
 | 
				
			||||||
	// ConnPool db conn pool
 | 
						// ConnPool db conn pool
 | 
				
			||||||
@ -110,6 +111,7 @@ type Session struct {
 | 
				
			|||||||
	AllowGlobalUpdate        bool
 | 
						AllowGlobalUpdate        bool
 | 
				
			||||||
	FullSaveAssociations     bool
 | 
						FullSaveAssociations     bool
 | 
				
			||||||
	QueryFields              bool
 | 
						QueryFields              bool
 | 
				
			||||||
 | 
						SkipOutputStatement      bool
 | 
				
			||||||
	Context                  context.Context
 | 
						Context                  context.Context
 | 
				
			||||||
	Logger                   logger.Interface
 | 
						Logger                   logger.Interface
 | 
				
			||||||
	NowFunc                  func() time.Time
 | 
						NowFunc                  func() time.Time
 | 
				
			||||||
@ -224,6 +226,11 @@ func (db *DB) Session(config *Session) *DB {
 | 
				
			|||||||
			clone:     1,
 | 
								clone:     1,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	)
 | 
						)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if config.SkipOutputStatement {
 | 
				
			||||||
 | 
							tx.Config.SkipOutputStatement = true
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if config.CreateBatchSize > 0 {
 | 
						if config.CreateBatchSize > 0 {
 | 
				
			||||||
		tx.Config.CreateBatchSize = config.CreateBatchSize
 | 
							tx.Config.CreateBatchSize = config.CreateBatchSize
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -318,6 +325,14 @@ func (db *DB) Debug() (tx *DB) {
 | 
				
			|||||||
	})
 | 
						})
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Debug start debug mode
 | 
				
			||||||
 | 
					func (db *DB) SkipOutput() (tx *DB) {
 | 
				
			||||||
 | 
						tx = db.getInstance()
 | 
				
			||||||
 | 
						return tx.Session(&Session{
 | 
				
			||||||
 | 
							SkipOutputStatement: true,
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Set store value with key into current db instance's context
 | 
					// Set store value with key into current db instance's context
 | 
				
			||||||
func (db *DB) Set(key string, value interface{}) *DB {
 | 
					func (db *DB) Set(key string, value interface{}) *DB {
 | 
				
			||||||
	tx := db.getInstance()
 | 
						tx := db.getInstance()
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user