Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 26 for now (0.19 sec)

  1. tests/embedded_struct_test.go

    		t.Errorf("Expected to get back a nil Author but got: %v", hnPost.Author)
    	}
    
    	now := time.Now().Round(time.Second)
    	NewPost := HNPost{
    		BasePost: &BasePost{Title: "embedded_pointer_type2"},
    		Author: &Author{
    			Name:        "test",
    			Content:     Content{"test"},
    			ContentPtr:  nil,
    			Birthday:    now,
    			BirthdayPtr: nil,
    		},
    	}
    	DB.Create(&NewPost)
    
    	hnPost = HNPost{}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Oct 26 03:58:13 GMT 2023
    - 7.3K bytes
    - Viewed (0)
  2. tests/soft_delete_test.go

    package tests_test
    
    import (
    	"database/sql"
    	"encoding/json"
    	"errors"
    	"regexp"
    	"testing"
    
    	"github.com/jinzhu/now"
    	"gorm.io/gorm"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestSoftDelete(t *testing.T) {
    	user := *GetUser("SoftDelete", Config{})
    	DB.Save(&user)
    
    	var count int64
    	var age uint
    
    	if DB.Model(&User{}).Where("name = ?", user.Name).Count(&count).Error != nil || count != 1 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Feb 01 06:40:55 GMT 2023
    - 5.7K bytes
    - Viewed (0)
  3. tests/create_test.go

    package tests_test
    
    import (
    	"errors"
    	"fmt"
    	"regexp"
    	"testing"
    	"time"
    
    	"github.com/jinzhu/now"
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	. "gorm.io/gorm/utils/tests"
    )
    
    func TestCreate(t *testing.T) {
    	user := *GetUser("create", Config{})
    
    	if results := DB.Create(&user); results.Error != nil {
    		t.Fatalf("errors happened when create: %v", results.Error)
    	} else if results.RowsAffected != 1 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 26.4K bytes
    - Viewed (0)
  4. callbacks.go

    	return cs.processors["raw"]
    }
    
    func (p *processor) Execute(db *DB) *DB {
    	// call scopes
    	for len(db.Statement.scopes) > 0 {
    		db = db.executeScopes()
    	}
    
    	var (
    		curTime           = time.Now()
    		stmt              = db.Statement
    		resetBuildClauses bool
    	)
    
    	if len(stmt.BuildClauses) == 0 {
    		stmt.BuildClauses = p.Clauses
    		resetBuildClauses = true
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 8.6K bytes
    - Viewed (1)
  5. tests/group_by_test.go

    		Name:     "groupby",
    		Age:      10,
    		Birthday: Now(),
    		Active:   true,
    	}, {
    		Name:     "groupby",
    		Age:      20,
    		Birthday: Now(),
    	}, {
    		Name:     "groupby",
    		Age:      30,
    		Birthday: Now(),
    		Active:   true,
    	}, {
    		Name:     "groupby1",
    		Age:      110,
    		Birthday: Now(),
    	}, {
    		Name:     "groupby1",
    		Age:      220,
    		Birthday: Now(),
    		Active:   true,
    	}, {
    		Name:     "groupby1",
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 3.3K bytes
    - Viewed (0)
  6. utils/tests/utils.go

    			isEqual()
    		} else {
    			t.Errorf("%v: expect: %+v, got %+v", utils.FileWithLineNum(), expect, got)
    			return
    		}
    	}
    }
    
    func Now() *time.Time {
    	now := time.Now()
    	return &now
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Mar 10 09:21:56 GMT 2023
    - 3.9K bytes
    - Viewed (0)
  7. go.sum

    github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
    github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
    github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
    Plain Text
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Aug 19 13:33:31 GMT 2023
    - 336 bytes
    - Viewed (0)
  8. tests/customize_field_test.go

    		Date *time.Time `gorm:"column:mapped_time"`
    	}
    
    	DB.Migrator().DropTable(&CustomizeColumn{})
    	DB.AutoMigrate(&CustomizeColumn{})
    
    	expected := "foo"
    	now := time.Now()
    	cc := CustomizeColumn{ID: 666, Name: expected, Date: &now}
    
    	if count := DB.Create(&cc).RowsAffected; count != 1 {
    		t.Error("There should be one record be affected when create record")
    	}
    
    	var cc1 CustomizeColumn
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Sep 11 09:33:31 GMT 2020
    - 6.9K bytes
    - Viewed (0)
  9. logger/logger.go

    		IgnoreRecordNotFoundError: false,
    		Colorful:                  true,
    	})
    	// Recorder logger records running SQL into a recorder instance
    	Recorder = traceRecorder{Interface: Default, BeginAt: time.Now()}
    )
    
    // New initialize logger
    func New(writer Writer, config Config) Interface {
    	var (
    		infoStr      = "%s\n[info] "
    		warnStr      = "%s\n[warn] "
    		errStr       = "%s\n[error] "
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Nov 07 02:19:41 GMT 2023
    - 5.8K bytes
    - Viewed (0)
  10. logger/sql_test.go

    package logger_test
    
    import (
    	"database/sql/driver"
    	"encoding/json"
    	"fmt"
    	"regexp"
    	"strings"
    	"testing"
    
    	"github.com/jinzhu/now"
    	"gorm.io/gorm/logger"
    )
    
    type JSON json.RawMessage
    
    func (j JSON) Value() (driver.Value, error) {
    	if len(j) == 0 {
    		return nil, nil
    	}
    	return json.RawMessage(j).MarshalJSON()
    }
    
    type ExampleStruct struct {
    	Name string
    	Val  string
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 08:00:02 GMT 2024
    - 8.4K bytes
    - Viewed (0)
Back to top