mysql

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2024 License: ISC Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func New

func New(db *sql.DB, sessionMaxAge int64, opts *Opts) (*mysql, error)

New returns a new mysql context that implements the sessions DB interface. The opts param can be used to override the default mysql context settings.

The sessionMaxAge is the max age in seconds of a session. This function cleans up any expired sessions from the database as part of the initialization. A sessionMaxAge of <=0 will cause the sessions database to be dropped and recreated.

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using slog.

Types

type Opts

type Opts struct {
	// TableName is the table name for the sessions table.
	TableName string

	// OpTimeout is the timeout for a single database operation.
	OpTimeout time.Duration
}

Opts contains configurable options for the sessions database. These are not required. Sane defaults are used when the options are not provided.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL