Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 40 for hooks (0.2 sec)

  1. tests/hooks_test.go

    	product2 := Product3{Name: "Product", Price: 0}
    	DB.Session(&gorm.Session{SkipHooks: true}).Create(&product2)
    
    	if product2.Price != 0 {
    		t.Errorf("invalid price after create without hooks, got %+v", product2)
    	}
    }
    
    func TestHooksForSlice(t *testing.T) {
    	DB.Migrator().DropTable(&Product3{})
    	DB.AutoMigrate(&Product3{})
    
    	products := []*Product3{
    		{Name: "Product-1", Price: 100},
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
  2. istioctl/pkg/injector/injector-list.go

    	if len(hooks) == 0 {
    		fmt.Fprintf(writer, "No Istio injection hooks present.\n")
    		return nil
    	}
    
    	w := new(tabwriter.Writer).Init(writer, 0, 8, 1, ' ', 0)
    	fmt.Fprintln(w, "NAMESPACES\tINJECTOR-HOOK\tISTIO-REVISION\tSIDECAR-IMAGE")
    	for _, hook := range hooks {
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Thu Jan 04 03:08:06 GMT 2024
    - 10.4K bytes
    - Viewed (0)
  3. callbacks/create.go

    package callbacks
    
    import (
    	"fmt"
    	"reflect"
    	"strings"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    // BeforeCreate before create hooks
    func BeforeCreate(db *gorm.DB) {
    	if db.Error == nil && db.Statement.Schema != nil && !db.Statement.SkipHooks && (db.Statement.Schema.BeforeSave || db.Statement.Schema.BeforeCreate) {
    		callMethod(db, func(value interface{}, tx *gorm.DB) (called bool) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  4. tests/transaction_test.go

    			return tx2.Scan(&User{}).Error
    		})
    	})
    
    	if err != nil {
    		t.Error(err)
    	}
    
    	// method with hooks
    	err = DB.Transaction(func(tx1 *gorm.DB) error {
    		// callMethod do
    		tx2 := tx1.Find(&User{}).Session(&gorm.Session{NewDB: true})
    		// trx in hooks
    		return tx2.Transaction(func(tx3 *gorm.DB) error {
    			return tx3.Where("user_id", user.ID).Delete(&Account{}).Error
    		})
    	})
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  5. istioctl/pkg/tag/revision.go

    	}
    	for _, hook := range webhooks {
    		rev := renderWithDefault(hook.GetLabels()[label.IoIstioRev.Name], DefaultRevisionName)
    		tagLabel := hook.GetLabels()[IstioTagLabel]
    		ri, revPresent := revisions[rev]
    		if revPresent {
    			if tagLabel != "" {
    				ri.Webhooks = append(ri.Webhooks, &MutatingWebhookConfigInfo{
    					Name:     hook.Name,
    					Revision: rev,
    					Tag:      tagLabel,
    				})
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Sat Jan 28 13:16:05 GMT 2023
    - 4.5K bytes
    - Viewed (0)
  6. callbacks/update.go

    					if _, ok := dest[rel.Name]; ok {
    						db.AddError(rel.Field.Set(db.Statement.Context, db.Statement.ReflectValue, dest[rel.Name]))
    					}
    				}
    			}
    		}
    	}
    }
    
    // BeforeUpdate before update hooks
    func BeforeUpdate(db *gorm.DB) {
    	if db.Error == nil && db.Statement.Schema != nil && !db.Statement.SkipHooks && (db.Statement.Schema.BeforeSave || db.Statement.Schema.BeforeUpdate) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 05:44:55 GMT 2024
    - 9.4K bytes
    - Viewed (1)
  7. schema/schema.go

    			default:
    				logger.Default.Warn(context.Background(), "Model %v don't match %vInterface, should be `%v(*gorm.DB) error`. Please see https://gorm.io/docs/hooks.html", schema, cbName, cbName)
    			}
    		}
    	}
    
    	// Cache the schema
    	if v, loaded := cacheStore.LoadOrStore(schemaCacheKey, schema); loaded {
    		s := v.(*Schema)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Oct 10 06:50:29 GMT 2023
    - 13.7K bytes
    - Viewed (0)
  8. istioctl/pkg/checkinject/checkinject.go

    	return cmd
    }
    
    func printCheckInjectorResults(writer io.Writer, was []webhookAnalysis) error {
    	if len(was) == 0 {
    		fmt.Fprintf(writer, "ERROR: no Istio injection hooks present.\n")
    		return nil
    	}
    	w := table.NewStyleWriter(writer)
    	w.SetAddRowFunc(func(obj interface{}) table.Row {
    		wa := obj.(webhookAnalysis)
    		row := table.Row{
    			Cells: make([]table.Cell, 0),
    		}
    Go
    - Registered: Wed May 01 22:53:12 GMT 2024
    - Last Modified: Sat Apr 13 05:23:38 GMT 2024
    - 9.3K bytes
    - Viewed (0)
  9. src/cmd/asm/internal/lex/lex.go

    )
    
    // IsRegisterShift reports whether the token is one of the ARM register shift operators.
    func IsRegisterShift(r ScanToken) bool {
    	return ROT <= r && r <= LSH // Order looks backwards because these are negative.
    }
    
    func (t ScanToken) String() string {
    	switch t {
    	case scanner.EOF:
    		return "EOF"
    	case scanner.Ident:
    		return "identifier"
    	case scanner.Int:
    Go
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Tue Aug 29 18:31:05 GMT 2023
    - 4.1K bytes
    - Viewed (0)
  10. cmd/bucket-encryption-handlers.go

    	updatedAt, err := globalBucketMetadataSys.Update(ctx, bucket, bucketSSEConfig, configData)
    	if err != nil {
    		writeErrorResponse(ctx, w, toAPIError(ctx, err), r.URL)
    		return
    	}
    
    	// Call site replication hook.
    	//
    	// We encode the xml bytes as base64 to ensure there are no encoding
    	// errors.
    	cfgStr := base64.StdEncoding.EncodeToString(configData)
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Thu Apr 04 12:04:40 GMT 2024
    - 6.4K bytes
    - Viewed (0)
Back to top