Documentation ¶
Index ¶
- Constants
- type EntRevisions
- func (r *EntRevisions) Flush(ctx context.Context) error
- func (r *EntRevisions) Ident() *migrate.TableIdent
- func (r *EntRevisions) Init(ctx context.Context) error
- func (r *EntRevisions) ReadRevision(ctx context.Context, v string) (*migrate.Revision, error)
- func (r *EntRevisions) ReadRevisions(ctx context.Context) (migrate.Revisions, error)
- func (r *EntRevisions) WriteRevision(ctx context.Context, rev *migrate.Revision) error
- type Option
Constants ¶
const DefaultRevisionSchema = "atlas_schema_revisions"
DefaultRevisionSchema is the default schema for storing revisions table.
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 ¶
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) Ident ¶ added in v0.6.0
func (r *EntRevisions) Ident() *migrate.TableIdent
Ident returns the table identifier.
func (*EntRevisions) Init ¶
func (r *EntRevisions) Init(ctx context.Context) error
Init runs migration for the revisions' table in the connected database.
func (*EntRevisions) ReadRevision ¶ added in v0.6.0
ReadRevision reads a revision from the revisions table.
ReadRevision will not return results only saved in cache.
func (*EntRevisions) ReadRevisions ¶
ReadRevisions reads the revisions from the revisions table.
ReadRevisions will not return results only saved to cache.
func (*EntRevisions) WriteRevision ¶
WriteRevision writes a revision to the revisions table.
type Option ¶
type Option func(*EntRevisions) error
Option allows to configure EntRevisions by using functional arguments.
func WithSchema ¶
WithSchema configures the schema to use for the revision table.