github.com/wawandco/oxplugins@v0.7.11/tools/pop/migration/creator/create.go (about)

     1  package creator
     2  
     3  import "github.com/pkg/errors"
     4  
     5  var creations = []Creator{
     6  	&FizzCreator{},
     7  	&SQLCreator{},
     8  }
     9  
    10  // CreateMigrationFor selects the correct creation implemention
    11  // Based on the input
    12  func CreateMigrationFor(name string) (Creator, error) {
    13  	for _, creation := range creations {
    14  		if creation.Name() == name {
    15  			return creation, nil
    16  		}
    17  	}
    18  
    19  	return nil, errors.Errorf("invalid migration type")
    20  }