Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for Connections (0.2 sec)

  1. tests/connection_test.go

    func TestWithSingleConnection(t *testing.T) {
    	expectedName := "test"
    	var actualName string
    
    	setSQL, getSQL := getSetSQL(DB.Dialector.Name())
    	if len(setSQL) == 0 || len(getSQL) == 0 {
    		return
    	}
    
    	err := DB.Connection(func(tx *gorm.DB) error {
    		if err := tx.Exec(setSQL, expectedName).Error; err != nil {
    			return err
    		}
    
    		if err := tx.Raw(getSQL).Scan(&actualName).Error; err != nil {
    			return err
    		}
    		return nil
    	})
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 28 14:16:42 GMT 2022
    - 963 bytes
    - Viewed (0)
  2. chainable_api.go

    //	db.Offset(5).Offset(-1).First(&user)
    func (db *DB) Offset(offset int) (tx *DB) {
    	tx = db.getInstance()
    	tx.Statement.AddClause(clause.Limit{Offset: offset})
    	return
    }
    
    // Scopes pass current database connection to arguments `func(DB) DB`, which could be used to add conditions dynamically
    //
    //	func AmountGreaterThan1000(db *gorm.DB) *gorm.DB {
    //	    return db.Where("amount > ?", 1000)
    //	}
    //
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  3. LICENSE

    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    Plain Text
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun May 21 13:24:00 GMT 2023
    - 1.1K bytes
    - Viewed (0)
  4. tests/associations_many2many_test.go

    	AssertEqual(t, nil, err)
    	AssertEqual(t, user2, findUser2)
    }
    
    func TestConcurrentMany2ManyAssociation(t *testing.T) {
    	db, err := OpenTestConnection(&gorm.Config{})
    	if err != nil {
    		t.Fatalf("open test connection failed, err: %+v", err)
    	}
    
    	count := 3
    
    	var languages []Language
    	for i := 0; i < count; i++ {
    		language := Language{Code: fmt.Sprintf("consurrent %d", i)}
    		db.Create(&language)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 13.2K bytes
    - Viewed (0)
  5. finisher_api.go

    		}
    		tx.Statement.ReflectValue = elem
    	}
    	Scan(rows, tx, ScanInitialized)
    	return tx.Error
    }
    
    // Connection uses a db connection to execute an arbitrary number of commands in fc. When finished, the connection is
    // returned to the connection pool.
    func (db *DB) Connection(fc func(tx *DB) error) (err error) {
    	if db.Error != nil {
    		return db.Error
    	}
    
    	tx := db.getInstance()
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
Back to top