Documentation
¶
Index ¶
- func Init(db *sqlx.DB, runtimeConfig *wiki.RuntimeConfig) (*sqliteDb, error)
- func RunMigrations(db *sqlx.DB, dialect Dialect) error
- type Dialect
- type PreparedStatements
- type SessionStore
- func (s *SessionStore) Delete(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
- func (s *SessionStore) Get(r *http.Request, name string) (*sessions.Session, error)
- func (s *SessionStore) New(r *http.Request, name string) (*sessions.Session, error)
- func (s *SessionStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PreparedStatements ¶
type PreparedStatements struct {
SelectArticleByLatestRevisionStmt *sqlx.Stmt
SelectArticleByRevisionHashStmt *sqlx.Stmt
SelectArticleByRevisionIDStmt *sqlx.Stmt
SelectUserScreennameStmt *sqlx.Stmt
SelectUserScreennameWithHashStmt *sqlx.Stmt
}
PreparedStatements holds the prepared SQL statements used for database queries. This struct is exported to allow reuse in test utilities.
func InitializeStatements ¶
func InitializeStatements(conn *sqlx.DB) (*PreparedStatements, error)
InitializeStatements prepares all the SQL statements needed for database operations. This function is exported to allow reuse in test utilities.
type SessionStore ¶
SessionStore is a gorilla/sessions backend backed by SQLite. It replaces the unmaintained michaeljs1990/sqlitestore package, reusing the app's existing *sqlx.DB (modernc.org/sqlite, pure Go).
Wire-compatible with sqlitestore: the cookie carries a securecookie-encoded integer session ID; the session payload is a separate securecookie-encoded blob in the session_data column.
func NewSessionStore ¶
NewSessionStore creates a SessionStore. keyPairs are passed to securecookie.CodecsFromPairs (hash key, optional encrypt key, …).
func (*SessionStore) Delete ¶
func (s *SessionStore) Delete(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Delete removes the session from the database and expires the cookie.
func (*SessionStore) New ¶
New creates or loads a session. Decode errors from the cookie are returned (so callers can detect tampering), but DB load errors are silently swallowed — matching gorilla store convention (treat as "new session").
func (*SessionStore) Save ¶
func (s *SessionStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Save persists the session to the database and sets the cookie.