db

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(url string) error

Create a new database based on the passed URL.

func Drop

func Drop(url string) error

Drop a database based on the passed URL.

func GenerateMigration

func GenerateMigration(name string, options ...migrations.Option) error

GenerateMigration in the migrations folder using the migrations template

func RunMigrations

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

RunMigrations by checking in the migrations database table, each of the adapters take care of this.

func WithDriver

func WithDriver(name string) connectionOption

WithDriver allows to specify the driver to use driver defaults to postgres.

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.

type Manager added in v1.2.10

type Manager interface {
	Create() error
	Drop() error
}

Manager is the interface that wraps the basic methods to create and drop a database.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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