migrate

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntRevisions

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

A EntRevisions provides implementation for the migrate.RevisionReadWriter interface.

func NewEntRevisions

func NewEntRevisions(ac *sqlclient.Client, opts ...Option) (*EntRevisions, error)

NewEntRevisions creates a new EntRevisions with the given sqlclient.Client. It is important to call EntRevisions.Init to initialize the underlying Ent client.

func (*EntRevisions) Flush added in v0.4.2

func (r *EntRevisions) Flush(ctx context.Context) error

Flush writes the changes saved in memory to the database.

This method exists to support both execution of migration in a transaction and saving revision for SQLite flavors, since attempting to write to the database while in a transaction will fail there.

func (*EntRevisions) Init

func (r *EntRevisions) Init(ctx context.Context) error

Init makes sure the revision table does exist in the connected database.

func (*EntRevisions) ReadRevisions

func (r *EntRevisions) ReadRevisions(ctx context.Context) (migrate.Revisions, error)

ReadRevisions reads the revisions from the revisions table.

ReadRevisions will not return results only saved to cache.

func (*EntRevisions) WriteRevision added in v0.4.2

func (r *EntRevisions) WriteRevision(ctx context.Context, rev *migrate.Revision) error

WriteRevision writes a revision to the revisions table.

type Option added in v0.4.2

type Option func(*EntRevisions) error

Option allows to configure EntRevisions by using functional arguments.

func WithSchema added in v0.4.2

func WithSchema(s string) Option

WithSchema configures the schema to use for the revision table.

Directories

Path Synopsis
ent

Jump to

Keyboard shortcuts

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