Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitDb ¶
func InitDb( ctx context.Context, name string, db *sql.DB, ddls []string, versionMigrations []MigrationFunc, ) error
InitDb initializes the database by checking whether it needs to be created or upgraded. The ddls are the DDL statements to create the tables in the database and their initial required content. The schemaVersion will be set inside the databse if it is newly created. Otherwise, the version is read from the databse and returned. This value should be checked against the expected version to determine if the database needs to be upgraded. It is up to the caller to close the database if an error is returned by this function.
Types ¶
Click to show internal directories.
Click to hide internal directories.