mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-24 15:55:14 +00:00
22 lines
452 B
Go
22 lines
452 B
Go
package service
|
|
|
|
type PersistenceServiceFacade struct {
|
|
Redis *RedisPersistenceService
|
|
Json *JsonPersistenceService
|
|
Memory *MemoryService
|
|
}
|
|
|
|
// Get returns the preferred persistence service by fallbacks
|
|
// Redis will be preferred at the first position.
|
|
func (facade *PersistenceServiceFacade) Get() PersistenceService {
|
|
if facade.Redis != nil {
|
|
return facade.Redis
|
|
}
|
|
|
|
if facade.Json != nil {
|
|
return facade.Json
|
|
}
|
|
|
|
return facade.Memory
|
|
}
|