2022-05-16 07:37:23 +08:00
|
|
|
package store
|
|
|
|
|
2022-05-22 00:59:22 +08:00
|
|
|
import (
|
|
|
|
"database/sql"
|
2022-06-27 22:09:06 +08:00
|
|
|
|
2022-08-07 08:09:43 +08:00
|
|
|
"github.com/usememos/memos/api"
|
2022-06-27 22:09:06 +08:00
|
|
|
"github.com/usememos/memos/server/profile"
|
2022-05-22 00:59:22 +08:00
|
|
|
)
|
|
|
|
|
2022-08-24 21:53:12 +08:00
|
|
|
// Store provides database access to all raw objects.
|
2022-05-16 07:37:23 +08:00
|
|
|
type Store struct {
|
2022-05-22 00:59:22 +08:00
|
|
|
db *sql.DB
|
2022-05-22 09:29:34 +08:00
|
|
|
profile *profile.Profile
|
2022-08-07 08:09:43 +08:00
|
|
|
cache api.CacheService
|
2022-05-16 07:37:23 +08:00
|
|
|
}
|
|
|
|
|
2022-08-24 21:53:12 +08:00
|
|
|
// New creates a new instance of Store.
|
2022-05-22 09:29:34 +08:00
|
|
|
func New(db *sql.DB, profile *profile.Profile) *Store {
|
2022-08-07 08:09:43 +08:00
|
|
|
cacheService := NewCacheService()
|
|
|
|
|
2022-05-16 07:37:23 +08:00
|
|
|
return &Store{
|
2022-05-22 00:59:22 +08:00
|
|
|
db: db,
|
|
|
|
profile: profile,
|
2022-08-07 08:09:43 +08:00
|
|
|
cache: cacheService,
|
2022-05-16 07:37:23 +08:00
|
|
|
}
|
|
|
|
}
|