Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionsService ¶
ConnectionsService provides functions for connecting to database
type DirectoryMigratorService ¶
type DirectoryMigratorService struct { Migrations *MigrationsService `inject:""` Connections *ConnectionsService `inject:""` Directory ModelDirectory `inject:""` }
DirectoryMigratorService provides the migration command
func (*DirectoryMigratorService) Run ¶
func (m *DirectoryMigratorService) Run() error
Run performs all the migrations for the models listed in the directory.
func (*DirectoryMigratorService) RunCommand ¶
func (m *DirectoryMigratorService) RunCommand(c *cli.Context)
RunCommand performs all the migrations for the models listed in the directory and provides some feedback through standard output.
type MigrationsService ¶
type MigrationsService struct {
Connections *ConnectionsService `inject:""`
}
MigrationsService provides migration-related functions
func (*MigrationsService) Run ¶
func (m *MigrationsService) Run(models []interface{}) error
Run automatically runs migrations for the database. Note that some changes will not be applied automatically if they destroy data, such as removing a table or column.
type ModelDirectory ¶
type ModelDirectory interface {
GetModels() []interface{}
}
A ModelDirectory lists an application models, which can be used for migrations and administration of models.
type RepositoryService ¶
type RepositoryService struct {
Connections *ConnectionsService `inject:""`
}
RepositoryService provides function for building structures following the repository pattern.
func (*RepositoryService) Exists ¶
func (r *RepositoryService) Exists(model interface{}, id int) bool
Exists checks if a model instance exists in the database by its ID
func (*RepositoryService) Find ¶
func (r *RepositoryService) Find(model interface{}, id int) error
Find attempts to find a specific model instance by its ID.
func (*RepositoryService) FirstOrFail ¶
func (r *RepositoryService) FirstOrFail(model interface{}, query *gorm.DB) error
FirstOrFail is a shortcut for using First and checking for the RecordNotFound error