| 12345678910111213141516171819202122232425262728 |
- package models
- import (
- "git.qianqiusoft.com/qianqiusoft/light-apiengine/config"
- "github.com/xormplus/xorm"
- "sync"
- )
- var beans []interface{}
- var beansLock sync.Mutex
- func RegisterModel(models ...interface{}) {
- beansLock.Lock()
- defer beansLock.Unlock()
- for _, model := range models {
- beans = append(beans, model)
- }
- }
- func SyncDb(db *xorm.Engine) {
- if !config.AppConfig.SyncDb {
- return
- }
-
- db.Sync2(beans...)
- }
|