Properly init tables for redis
This commit is contained in:
parent
553055f073
commit
7b439cc568
2 changed files with 21 additions and 1 deletions
|
@ -235,6 +235,11 @@ Teams sind global, d.h. Ein Team kann mehrere Namespaces verwalten.
|
||||||
* [x] Password Reset -> Link via email oder so
|
* [x] Password Reset -> Link via email oder so
|
||||||
* [ ] Settings
|
* [ ] Settings
|
||||||
|
|
||||||
|
### Bugfixes
|
||||||
|
|
||||||
|
* [ ] Panic wenn mailer nicht erreichbar -> Als workaround mailer deaktivierbar machen, bzw keine mails verschicken
|
||||||
|
* [ ] "unexpected EOF"
|
||||||
|
|
||||||
### Docs
|
### Docs
|
||||||
|
|
||||||
* [ ] Bauanleitung in die Readme/docs
|
* [ ] Bauanleitung in die Readme/docs
|
||||||
|
|
|
@ -30,7 +30,8 @@ import (
|
||||||
var (
|
var (
|
||||||
x *xorm.Engine
|
x *xorm.Engine
|
||||||
|
|
||||||
tables []interface{}
|
tables []interface{}
|
||||||
|
tablesWithPointer []interface{}
|
||||||
)
|
)
|
||||||
|
|
||||||
func getEngine() (*xorm.Engine, error) {
|
func getEngine() (*xorm.Engine, error) {
|
||||||
|
@ -68,6 +69,19 @@ func init() {
|
||||||
new(ListUser),
|
new(ListUser),
|
||||||
new(NamespaceUser),
|
new(NamespaceUser),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
tablesWithPointer = append(tables,
|
||||||
|
&User{},
|
||||||
|
&List{},
|
||||||
|
&ListTask{},
|
||||||
|
&Team{},
|
||||||
|
&TeamMember{},
|
||||||
|
&TeamList{},
|
||||||
|
&TeamNamespace{},
|
||||||
|
&Namespace{},
|
||||||
|
&ListUser{},
|
||||||
|
&NamespaceUser{},
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetEngine sets the xorm.Engine
|
// SetEngine sets the xorm.Engine
|
||||||
|
@ -88,6 +102,7 @@ func SetEngine() (err error) {
|
||||||
cacher := xrc.NewRedisCacher(viper.GetString("redis.host"), viper.GetString("redis.password"), xrc.DEFAULT_EXPIRATION, x.Logger())
|
cacher := xrc.NewRedisCacher(viper.GetString("redis.host"), viper.GetString("redis.password"), xrc.DEFAULT_EXPIRATION, x.Logger())
|
||||||
x.SetDefaultCacher(cacher)
|
x.SetDefaultCacher(cacher)
|
||||||
gob.Register(tables)
|
gob.Register(tables)
|
||||||
|
gob.Register(tablesWithPointer) // Need to register tables with pointer as well...
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
fmt.Println("Did not find a valid cache type. Caching disabled. Please refer to the docs for poosible cache types.")
|
fmt.Println("Did not find a valid cache type. Caching disabled. Please refer to the docs for poosible cache types.")
|
||||||
|
|
Loading…
Add table
Reference in a new issue