Merge pull request #5043 from Saurabh-Thakre/patch-2
This commit is contained in:
		
						commit
						93b1a6f7ea
					
				| @ -255,7 +255,7 @@ func (tx *DB) assignInterfacesToValue(values ...interface{}) { | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| // FirstOrInit gets the first matched record or initialize a new instance with given conditions (only works with struct or map conditions)
 | ||||
| func (db *DB) FirstOrInit(dest interface{}, conds ...interface{}) (tx *DB) { | ||||
| 	queryTx := db.Limit(1).Order(clause.OrderByColumn{ | ||||
| 		Column: clause.Column{Table: clause.CurrentTable, Name: clause.PrimaryKey}, | ||||
| @ -281,6 +281,7 @@ func (db *DB) FirstOrInit(dest interface{}, conds ...interface{}) (tx *DB) { | ||||
| 	return | ||||
| } | ||||
| 
 | ||||
| // FirstOrCreate gets the first matched record or create a new one with given conditions (only works with struct, map conditions)
 | ||||
| func (db *DB) FirstOrCreate(dest interface{}, conds ...interface{}) (tx *DB) { | ||||
| 	queryTx := db.Limit(1).Order(clause.OrderByColumn{ | ||||
| 		Column: clause.Column{Table: clause.CurrentTable, Name: clause.PrimaryKey}, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Jason Lee
						Jason Lee