db

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: MIT Imports: 11 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(url string) error

Creates the database.

func Drop

func Drop(url string) error

Creates the database.

func GenerateMigration

func GenerateMigration(name string, options ...migrationOption) error

GenerateMigration in the migrations folder using the migrations template

func RunMigrations

func RunMigrations(fs embed.FS, conn *sqlx.DB) error

func UseMigrationFolder added in v1.2.9

func UseMigrationFolder(folder string) migrationOption

UseMigrationFolder sets the folder for migrations

func WithDriver

func WithDriver(name string) connectionOption

Types

type ConnFn

type ConnFn func() (*sqlx.DB, error)

ConnFn is the database connection builder function that will be used by the application based on the driver and connection string.

func ConnectionFn

func ConnectionFn(url string, opts ...connectionOption) ConnFn

ConnectionFn is the database connection builder function that will be used by the application based on the driver and connection string. It opens the connection only once and return the same connection on subsequent calls.

Jump to

Keyboard shortcuts

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