Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for offcut (0.18 sec)

  1. chainable_api.go

    	return
    }
    
    // Offset specify the number of records to skip before starting to return the records
    //
    // Offset conditions can be cancelled by using `Offset(-1)`.
    //
    //	// select the third user
    //	db.Offset(2).First(&user)
    //	// select the first user by cancelling an earlier chained offset
    //	db.Offset(5).Offset(-1).First(&user)
    func (db *DB) Offset(offset int) (tx *DB) {
    	tx = db.getInstance()
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  2. finisher_api.go

    	)
    
    	// user specified offset or limit
    	var totalSize int
    	if c, ok := tx.Statement.Clauses["LIMIT"]; ok {
    		if limit, ok := c.Expression.(clause.Limit); ok {
    			if limit.Limit != nil {
    				totalSize = *limit.Limit
    			}
    
    			if totalSize > 0 && batchSize > totalSize {
    				batchSize = totalSize
    			}
    
    			// reset to offset to 0 in next batch
    			tx = tx.Offset(-1).Session(&Session{})
    		}
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  3. tests/sql_builder_test.go

    	sql = DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
    		return tx.Model(&User{}).Where(&User{Name: "foo", Age: 20}).Limit(10).Offset(5).Order("name ASC").First(&User{})
    	})
    	assertEqualSQL(t, `SELECT * FROM "users" WHERE ("users"."name" = 'foo' AND "users"."age" = 20) AND "users"."deleted_at" IS NULL ORDER BY name ASC,"users"."id" LIMIT 1 OFFSET 5`, sql)
    
    	// last and unscoped
    	sql = DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 16.7K bytes
    - Viewed (0)
  4. gorm.go

    	db.Plugins[name] = plugin
    	return nil
    }
    
    // ToSQL for generate SQL string.
    //
    //	db.ToSQL(func(tx *gorm.DB) *gorm.DB {
    //			return tx.Model(&User{}).Where(&User{Name: "foo", Age: 20})
    //				.Limit(10).Offset(5)
    //				.Order("name ASC")
    //				.First(&User{})
    //	})
    func (db *DB) ToSQL(queryFn func(tx *DB) *DB) string {
    	tx := queryFn(db.Session(&Session{DryRun: true, SkipDefaultTransaction: true}))
    	stmt := tx.Statement
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
Back to top