engine

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	COLLECTION_NAME_MIGRATIONS_LOG = "mongol_migrations_3710611845fe4161b74d2ec5eafe9124"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	Forward  Migration
	Backward Migration
	Hash     string
	ID       string
}

func NewChange

func NewChange(c *ChangeFile, workingDir string, changelogPath string, id string) (*Change, custom_error.CustomError)

type ChangeFile

type ChangeFile struct {
	Forward  []*MigrationFile `json:"migration"`
	Backward []*MigrationFile `json:"rollback,omitempty"`
}

func (*ChangeFile) UnmarshalJSON added in v0.2.2

func (c *ChangeFile) UnmarshalJSON(data []byte) error

type ChangeLog

type ChangeLog interface {
	GetConnectionString() string
	GetDBName() string
	GetChangeSets() []*ChangeSet
	GetChangeSetSource() ChangeSetSource
	Apply(processor ChangeSetProcessor) custom_error.CustomError
}

func NewChangeLog

func NewChangeLog(path string) (ChangeLog, custom_error.CustomError)

func NewRollbackChangeLog

func NewRollbackChangeLog(path string) (ChangeLog, custom_error.CustomError)

type ChangeSet

type ChangeSet struct {
	ID      string
	Changes []*Change
}

type ChangeSetApplyStrategy

type ChangeSetApplyStrategy func(sets []*ChangeSet, processor ChangeSetProcessor) custom_error.CustomError

type ChangeSetFile

type ChangeSetFile struct {
	ID      string       `json:"id"`
	Changes []ChangeFile `json:"changes,omitempty"`
}

type ChangeSetProcessor

type ChangeSetProcessor interface {
	Process(changeSet *ChangeSet) custom_error.CustomError
}

func NewChangeSetApplier

func NewChangeSetApplier(startTransaction TransactionFactory) (ChangeSetProcessor, custom_error.CustomError)

func NewRollbackChangeSetApplier

func NewRollbackChangeSetApplier(startTransaction TransactionFactory) (ChangeSetProcessor, custom_error.CustomError)

type ChangeSetSource

type ChangeSetSource interface {
	Apply(processor ChangeSetProcessor) custom_error.CustomError
}

func NewArrayChangeLog

func NewArrayChangeLog(changeSets []*ChangeSet) (ChangeSetSource, custom_error.CustomError)

type DocumentApplier

type DocumentApplier interface {
	Apply(value interface{}) custom_error.CustomError
}

type DummyMigration

type DummyMigration struct {
}

func (*DummyMigration) Apply

type LimitCounter

type LimitCounter interface {
	Get() int64
	Dec()
}

type Migration

type Migration interface {
	Apply(visitor DocumentApplier) custom_error.CustomError
}

func NewMigration

func NewMigration(m *MigrationFile, workingDir string, changelogPath string, hash hash.Hash) (Migration, custom_error.CustomError)

func NewMultiMigration added in v0.2.2

func NewMultiMigration(m []*MigrationFile, workingDir string, changelogPath string, hash hash.Hash) (Migration, custom_error.CustomError)

type MigrationExtractor

type MigrationExtractor func(change *Change) Migration

type MigrationFile

type MigrationFile struct {
	Path         string `json:"include,omitempty"`
	RelativePath bool   `json:"relativeToChangelogFile"`
}

type MultipleMigration added in v0.2.2

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

func (*MultipleMigration) Apply added in v0.2.2

type SimpleMigration

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

func (*SimpleMigration) Apply

type SimulatedTransaction

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

func (*SimulatedTransaction) Apply

func (*SimulatedTransaction) Commit

func (*SimulatedTransaction) Rollback

type Transaction

type Transaction interface {
	Commit() custom_error.CustomError
	Apply(changeSet *Change) custom_error.CustomError
	Rollback() custom_error.CustomError
}

type TransactionFactory

type TransactionFactory func(changeID string) (Transaction, custom_error.CustomError)

func NewDummyTransactionFactory

func NewDummyTransactionFactory(log logs.Logger) TransactionFactory

func NewRollbackSimulatedTransactionFactory

func NewRollbackSimulatedTransactionFactory(dbChanger DocumentApplier, transactionRecFactory TransactionRecordFactory, appliedChanges map[string]struct{}, maxChanges int64, log logs.Logger) (TransactionFactory, custom_error.CustomError)

func NewSimulatedTransactionFactory

func NewSimulatedTransactionFactory(dbChanger DocumentApplier, transactionRecFactory TransactionRecordFactory, appliedChanges map[string]struct{}, maxChanges int64, log logs.Logger) (TransactionFactory, custom_error.CustomError)

type TransactionRecordFactory

type TransactionRecordFactory func(changeID string, hashValue string) (interface{}, custom_error.CustomError)

func NewRollbackTransactionRecordFactory

func NewRollbackTransactionRecordFactory(collectionName string) TransactionRecordFactory

func NewTransactionRecordFactory

func NewTransactionRecordFactory(collectionName string) TransactionRecordFactory

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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