diff --git a/dialect_sqlite3.go b/dialect_sqlite3.go index c13fd02b..c32524f4 100644 --- a/dialect_sqlite3.go +++ b/dialect_sqlite3.go @@ -14,10 +14,6 @@ import ( "github.com/go-xorm/core" ) -// func init() { -// RegisterDialect("sqlite3", &sqlite3{}) -// } - var ( sqlite3ReservedWords = map[string]bool{ "ABORT": true, diff --git a/engine.go b/engine.go index b2b2f97b..5cc8da95 100644 --- a/engine.go +++ b/engine.go @@ -195,6 +195,11 @@ func (engine *Engine) SetMaxIdleConns(conns int) { engine.db.SetMaxIdleConns(conns) } +// SetConnMaxLifetime sets the maximum amount of time a connection may be reused. +func (engine *Engine) SetConnMaxLifetime(d time.Duration) { + engine.db.SetConnMaxLifetime(d) +} + // SetDefaultCacher set the default cacher. Xorm's default not enable cacher. func (engine *Engine) SetDefaultCacher(cacher core.Cacher) { engine.Cacher = cacher diff --git a/session_pk_test.go b/session_pk_test.go index b9c70321..3030fca4 100644 --- a/session_pk_test.go +++ b/session_pk_test.go @@ -7,6 +7,7 @@ package xorm import ( "errors" "testing" + "time" "github.com/go-xorm/core" "github.com/stretchr/testify/assert" @@ -1117,3 +1118,17 @@ func TestSingleAutoIncrColumn(t *testing.T) { _, err := testEngine.Insert(&Account{}) assert.NoError(t, err) } + +func TestCompositePK(t *testing.T) { + type TaskSolution struct { + UID string `xorm:"notnull pk UUID 'uid'"` + TID string `xorm:"notnull pk UUID 'tid'"` + Created time.Time `xorm:"created"` + Updated time.Time `xorm:"updated"` + } + + assert.NoError(t, prepareEngine()) + assertSync(t, new(TaskSolution)) + + assert.NoError(t, testEngine.Sync2(new(TaskSolution))) +}