mirror of
https://github.com/owncast/owncast.git
synced 2024-10-10 19:16:02 +00:00
30 lines
582 B
Go
30 lines
582 B
Go
package chatrepository
|
|
|
|
import "github.com/owncast/owncast/storage/data"
|
|
|
|
type ChatRepository struct {
|
|
datastore *data.Store
|
|
}
|
|
|
|
func New(datastore *data.Store) *ChatRepository {
|
|
r := &ChatRepository{
|
|
datastore: datastore,
|
|
}
|
|
|
|
r.startPruner()
|
|
|
|
return r
|
|
}
|
|
|
|
// NOTE: This is temporary during the transition period.
|
|
var temporaryGlobalInstance *ChatRepository
|
|
|
|
// GetUserRepository will return the user repository.
|
|
func Get() *ChatRepository {
|
|
if temporaryGlobalInstance == nil {
|
|
i := New(data.GetDatastore())
|
|
temporaryGlobalInstance = i
|
|
}
|
|
return temporaryGlobalInstance
|
|
}
|