package
0.0.0-20240109094730-acd972998012
Repository: https://github.com/forget-c/gopkg.git
Documentation: pkg.go.dev

# README

executor.go

executor.go文件中定义了脚本执行器相关的结构体和方法。

MakeExecutor方法会根据文件后缀创建对应的脚本执行器,目前支持的脚本类型有:pythonsqlbash二进制可执行文件

你可以实现自己的MakeExecutorExecutor来支持更多脚本类型

finder.go

finder.go文件中定义了脚本查找器和管理器相关的结构体和方法。

Scan

Scan方法会扫描指定目录下的所有脚本文件,并按照顺序返回脚本列表。

脚本的命名规则:

  • 以数字开头,数字越小,越早执行
  • "_"用于分割, 例如:001_init.sh -> 002_init.sh -> 003_init.sh
  • 以"rollback"结尾的为回滚脚本,用于正常脚本执行失败时的回滚操作,例如:001_init_rollback.sh

ScriptManager

ScriptManager提供脚本管理的相关方法,用于执行脚本。

ScriptManager 将脚本定义为三个阶段, prerunpost

Prepare

ScriptManager.checkers用于检查是否满足脚本执行条件以及初始化一些数据到stat

ScriptManager.getters用于从stat中获取指定数据

# Functions

No description provided by the author
No description provided by the author
No description provided by the author
NewBashExecutor return a bash executor.
NewBinaryExecutor return a binary executor.
NewPythonExecutor return a python executor.
No description provided by the author
NewSQLExecutor return a sql executor.
No description provided by the author

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author