Documentation ¶
Overview ¶
For managing authentication database.
Database management stuff.
Commonly used ConnectionHooks.
For managing review DBs.
For managing user DBs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenAuthDB ¶
Opens the authentication database. The caller has to Close the db.
func OpenReviewDB ¶
Opens review database. The caller has to Close the db.
func OpenUserDB ¶
Opens database for one user. The caller has to Close the db.
func UpgradeReviewDB ¶
Upgrades review DB to the latest version.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Wrapper around sql.Conn.
func NewConnection ¶
func NewConnection( db *sql.DB, ctx context.Context, hooks ...ConnectionHook, ) (*Connection, error)
The caller is expected to close the Connection after use.
func (*Connection) Close ¶
func (c *Connection) Close() error
type ConnectionHook ¶
type ConnectionHook struct { // Called after the connection is created. Enter func(con *Connection) error // Called before the connection is closed. Exit func(con *Connection) error }
func AttachCourse ¶
func AttachCourse(path string) ConnectionHook
Enter: attach course database. Exit: detach course database.
func DefaultConnectionHook ¶
func DefaultConnectionHook() ConnectionHook
Source Files ¶
Click to show internal directories.
Click to hide internal directories.