mirror of
https://github.com/Walter-Sparrow/lunar-tear.git
synced 2026-07-02 05:43:41 +03:00
Add SQLite persistence, import-snapshot tool, and karma functionality
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package sqlite
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"time"
|
||||
|
||||
"lunar-tear/server/internal/store"
|
||||
)
|
||||
|
||||
type SQLiteStore struct {
|
||||
db *sql.DB
|
||||
clock store.Clock
|
||||
}
|
||||
|
||||
var (
|
||||
_ store.UserRepository = (*SQLiteStore)(nil)
|
||||
_ store.SessionRepository = (*SQLiteStore)(nil)
|
||||
)
|
||||
|
||||
func New(db *sql.DB, clock store.Clock) *SQLiteStore {
|
||||
if clock == nil {
|
||||
clock = time.Now
|
||||
}
|
||||
return &SQLiteStore{db: db, clock: clock}
|
||||
}
|
||||
Reference in New Issue
Block a user