db

package
v0.0.0-...-78b6ac7 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var IOFSFileRegex = regexp.MustCompile(`^([0-9]+)_(.*)\.(` + string(source.Down) + `|` + string(source.Up) + `)\.(.*)$`)

Functions

func GetClient

func GetClient(config *local_config.Config, maxRetry uint) (*gorm.DB, error)

func MigrateDatabase

func MigrateDatabase(client *gorm.DB) error

func NewCustomIOFSDriver

func NewCustomIOFSDriver(fsys fs.FS, path string) (source.Driver, error)

NewCustomIOFSDriver returns a new Driver from io/fs#FS and a relative path.

func Parse

func Parse(raw string) (*source.Migration, error)

Parse returns Migration for matching IOFSFileRegex pattern.

Types

type PartialDriver

type PartialDriver struct {
	// contains filtered or unexported fields
}

PartialDriver is a helper service for creating new source drivers working with io/fs.FS instances. It implements all source.Driver interface methods except for Open(). New driver could embed this struct and add missing Open() method.

To prepare PartialDriver for use Init() function.

func (*PartialDriver) Close

func (d *PartialDriver) Close() error

Close is part of source.Driver interface implementation. Closes the file system if possible.

func (*PartialDriver) First

func (d *PartialDriver) First() (version uint, err error)

First is part of source.Driver interface implementation.

func (*PartialDriver) Init

func (d *PartialDriver) Init(fsys fs.FS, path string) error

Init prepares not initialized IoFS instance to read migrations from a io/fs#FS instance and a relative path.

func (*PartialDriver) Next

func (d *PartialDriver) Next(version uint) (nextVersion uint, err error)

Next is part of source.Driver interface implementation.

func (*PartialDriver) Prev

func (d *PartialDriver) Prev(version uint) (prevVersion uint, err error)

Prev is part of source.Driver interface implementation.

func (*PartialDriver) ReadDown

func (d *PartialDriver) ReadDown(version uint) (r io.ReadCloser, identifier string, err error)

ReadDown is part of source.Driver interface implementation.

func (*PartialDriver) ReadUp

func (d *PartialDriver) ReadUp(version uint) (r io.ReadCloser, identifier string, err error)

ReadUp is part of source.Driver interface implementation.

Jump to

Keyboard shortcuts

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