Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for fc (0.13 sec)

  1. callbacks/callmethod.go

    package callbacks
    
    import (
    	"reflect"
    
    	"gorm.io/gorm"
    )
    
    func callMethod(db *gorm.DB, fc func(value interface{}, tx *gorm.DB) bool) {
    	tx := db.Session(&gorm.Session{NewDB: true})
    	if called := fc(db.Statement.ReflectValue.Interface(), tx); !called {
    		switch db.Statement.ReflectValue.Kind() {
    		case reflect.Slice, reflect.Array:
    			db.Statement.CurDestIndex = 0
    			for i := 0; i < db.Statement.ReflectValue.Len(); i++ {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 846 bytes
    - Viewed (0)
  2. tests/tracer_test.go

    func (S Tracer) Error(ctx context.Context, s string, i ...interface{}) {
    	S.Logger.Error(ctx, s, i...)
    }
    
    func (S Tracer) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error) {
    	S.Logger.Trace(ctx, begin, fc, err)
    	S.Test(ctx, begin, fc, err)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Oct 18 09:28:06 GMT 2022
    - 830 bytes
    - Viewed (0)
  3. logger/logger.go

    //
    //nolint:cyclop
    func (l *logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error) {
    	if l.LogLevel <= Silent {
    		return
    	}
    
    	elapsed := time.Since(begin)
    	switch {
    	case err != nil && l.LogLevel >= Error && (!errors.Is(err, ErrRecordNotFound) || !l.IgnoreRecordNotFoundError):
    		sql, rows := fc()
    		if rows == -1 {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Nov 07 02:19:41 GMT 2023
    - 5.8K bytes
    - Viewed (0)
  4. schema/schema_helper_test.go

    				t.Errorf("schema %v failed to found primary key: %v", s, field)
    			}
    		}
    	})
    }
    
    func checkSchemaField(t *testing.T, s *schema.Schema, f *schema.Field, fc func(*schema.Field)) {
    	t.Run("CheckField/"+f.Name, func(t *testing.T) {
    		if fc != nil {
    			fc(f)
    		}
    
    		if f.TagSettings == nil {
    			if f.Tag != "" {
    				f.TagSettings = schema.ParseTagSetting(f.Tag.Get("gorm"), ";")
    			} else {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  5. tests/callbacks_test.go

    	}
    
    	return fmt.Sprint(got) == fmt.Sprint(fnames), fmt.Sprintf("expects %v, got %v", fnames, got)
    }
    
    func getFuncName(fc interface{}) string {
    	reflectValue, ok := fc.(reflect.Value)
    	if !ok {
    		reflectValue = reflect.ValueOf(fc)
    	}
    
    	fnames := strings.Split(runtime.FuncForPC(reflectValue.Pointer()).Name(), ".")
    	return fnames[len(fnames)-1]
    }
    
    func c1(*gorm.DB) {}
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 7.2K bytes
    - Viewed (0)
  6. finisher_api.go

    	}
    
    	defer conn.Close()
    	tx.Statement.ConnPool = conn
    	return fc(tx)
    }
    
    // Transaction start a transaction as a block, return error will rollback, otherwise to commit. Transaction executes an
    // arbitrary number of commands in fc within a transaction. On success the changes are committed; if an error occurs
    // they are rolled back.
    func (db *DB) Transaction(fc func(tx *DB) error, opts ...*sql.TxOptions) (err error) {
    	panicked := true
    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)
  7. migrator/migrator.go

    	gorm.Dialector
    }
    
    type printSQLLogger struct {
    	logger.Interface
    }
    
    func (l *printSQLLogger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error) {
    	sql, _ := fc()
    	fmt.Println(sql + ";")
    	l.Interface.Trace(ctx, begin, fc, err)
    }
    
    // GormDataTypeInterface gorm data type interface
    type GormDataTypeInterface interface {
    	GormDBDataType(*gorm.DB, *schema.Field) string
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  8. callbacks/preload.go

    	column, values := schema.ToQueryValues(clause.CurrentTable, relForeignKeys, foreignValues)
    
    	if len(values) != 0 {
    		for _, cond := range conds {
    			if fc, ok := cond.(func(*gorm.DB) *gorm.DB); ok {
    				tx = fc(tx)
    			} else {
    				inlineConds = append(inlineConds, cond)
    			}
    		}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  9. tests/preload_test.go

    	DB.Create(&users)
    
    	query := make([]string, 0)
    	sess := DB.Session(&gorm.Session{Logger: Tracer{
    		Logger: DB.Config.Logger,
    		Test: func(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error) {
    			sql, _ := fc()
    			query = append(query, sql)
    		},
    	}})
    
    	var result []User
    	err := sess.
    		Joins("Manager").
    		Preload("Manager.Tools").
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 14.9K bytes
    - Viewed (0)
  10. schema/schema.go

    			fieldInterface := fieldValue.Interface()
    			if fc, ok := fieldInterface.(CreateClausesInterface); ok {
    				field.Schema.CreateClauses = append(field.Schema.CreateClauses, fc.CreateClauses(field)...)
    			}
    
    			if fc, ok := fieldInterface.(QueryClausesInterface); ok {
    				field.Schema.QueryClauses = append(field.Schema.QueryClauses, fc.QueryClauses(field)...)
    			}
    
    			if fc, ok := fieldInterface.(UpdateClausesInterface); ok {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Oct 10 06:50:29 GMT 2023
    - 13.7K bytes
    - Viewed (0)
Back to top