Ejemplo n.º 1
0
func (this *DefaultUser) GetExecutionContext() *lib.ExecutionContext {
	args := map[string]interface{}{
		"email": "*****@*****.**",
	}

	sqlInstructionToApply := lib.NewSqlInstructionWithArgs(NEW_DEFAULT_USER, args)
	sqlInstructionToRollback := lib.NewSqlInstructionWithArgs(DELETE_DEFAULT_USER, args)

	execContext := lib.NewExecutionContext()
	execContext.AddQueryToApply(sqlInstructionToApply)
	execContext.AddQueryToRollback(sqlInstructionToRollback)

	return execContext
}
Ejemplo n.º 2
0
func (this *NewsTableMigrationScript) GetExecutionContext() *lib.ExecutionContext {
	execContext := lib.NewExecutionContext()
	execContext.AddQueryToApply(lib.NewSimpleSqlInstruction(CREATE_NEWS_TABLE_SQL))
	execContext.AddQueryToRollback(lib.NewSimpleSqlInstruction(DROP_NEWS_TABLE_SQL))
	callback := func() error {
		newsRepo := news.NewNewsRepository(this.conn)
		newsEntity := news.News{
			Title:    "Some news",
			Text:     "Some text",
			AuthorId: 1}
		newsRepo.CreateNews(newsEntity)
		return nil
	}
	execContext.SuccessCallback = callback

	return execContext
}
Ejemplo n.º 3
0
func (this *UserTable) GetExecutionContext() *lib.ExecutionContext {
	execContext := lib.NewExecutionContext()
	execContext.AddQueryToApply(lib.NewSimpleSqlInstruction(CREATE_USER_TABLE))
	execContext.AddQueryToRollback(lib.NewSimpleSqlInstruction(DROP_USER_TABLE))
	return execContext
}