mysql

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: MIT Imports: 23 Imported by: 2

README

Sqlite backend

Adding a migration

  1. Install golang-migrate/migrate
  2. migrate create -ext sql -dir ./db/migrations -seq <name>
    

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMysqlBackend

func NewMysqlBackend(host string, port int, user, password, database string, opts ...option) *mysqlBackend

func NewMysqlBackendWithDB added in v1.4.2

func NewMysqlBackendWithDB(db *sql.DB, opts ...option) *mysqlBackend

NewMysqlBackendWithDB creates a new MySQL backend using an existing database connection. When using this constructor, the backend will not close the database connection when Close() is called. Migrations are disabled by default; to enable them, use WithApplyMigrations(true) along with WithMigrationDSN to provide a DSN that supports multi-statement queries.

func WithApplyMigrations added in v0.18.0

func WithApplyMigrations(applyMigrations bool) option

WithApplyMigrations automatically applies database migrations on startup.

func WithBackendOptions added in v0.18.0

func WithBackendOptions(opts ...backend.BackendOption) option

WithBackendOptions allows to pass generic backend options.

func WithMigrationDSN added in v1.4.2

func WithMigrationDSN(dsn string) option

WithMigrationDSN sets the DSN to use for running migrations. This is required when using NewMysqlBackendWithDB with ApplyMigrations enabled. The DSN should support multi-statement queries.

func WithMySQLOptions added in v0.18.0

func WithMySQLOptions(f func(db *sql.DB)) option

Types

This section is empty.

Jump to

Keyboard shortcuts

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