MCPcopy Create free account

hub / github.com/adlio/schema / functions

Functions152 in github.com/adlio/schema

↓ 22 callersFunctionNewMigrator
NewMigrator creates a new Migrator with the supplied options
migrator.go:23
↓ 15 callersMethodExecContext
(ctx context.Context, query string, args ...interface{})
schema.go:32
↓ 13 callersMethodApply
Apply takes a slice of Migrations and applies any which have not yet been applied against the provided database. Apply can be re-called sequentially w
migrator.go:46
↓ 12 callersFunctionWithDialect
WithDialect builds an Option which will set the supplied dialect on a Migrator. Usage: NewMigrator(WithDialect(MySQL))
options.go:12
↓ 11 callersFunctiontestMigrations
(t *testing.T, dirName string)
migrator_test.go:305
↓ 10 callersMethodScan
(src interface{})
mysql.go:125
↓ 9 callersMethodConnect
Connect creates an additional *database/sql.DB connection for a particular test database.
testdb_test.go:202
↓ 9 callersMethodQuotedTableName
QuotedTableName returns the dialect-quoted fully-qualified name for the migrations tracking table
migrator.go:37
↓ 9 callersMethodQuotedTableName
(schemaName, tableName string)
dialect.go:10
↓ 9 callersFunctionwithEachTestDB
(t *testing.T, f func(t *testing.T, tdb *TestDB))
main_test.go:76
↓ 8 callersFunctionWithTableName
WithTableName is an option which customizes the name of the schema_migrations tracking table. It can be called with either 1 or 2 string arguments. If
options.go:25
↓ 8 callersFunctionexpectErrorContains
(t *testing.T, err error, contains string)
errors_test.go:134
↓ 7 callersMethodDatabaseName
()
testdb_test.go:46
↓ 7 callersMethodPassword
()
testdb_test.go:37
↓ 7 callersMethodUsername
()
testdb_test.go:28
↓ 6 callersMethodDSN
()
testdb_test.go:134
↓ 6 callersMethodMD5
MD5 computes the MD5 hash of the Script for this migration so that it can be uniquely identified later.
migration.go:18
↓ 6 callersFunctionexpectID
(t *testing.T, migration *Migration, expectedID string)
migration_test.go:52
↓ 6 callersFunctionmakeTestMigrator
makeTestMigrator is a utility function which produces a migrator with an isolated environment (isolated due to a unique name for the migration trackin
migrator_test.go:299
↓ 5 callersFunctionMigrationsFromDirectoryPath
MigrationsFromDirectoryPath retrieves a slice of Migrations from the contents of the directory. Only .sql files are read
file.go:20
↓ 5 callersMethodQueryContext
(ctx context.Context, query string, args ...interface{})
schema.go:33
↓ 5 callersMethodQuotedIdent
(ident string)
mssql.go:88
↓ 4 callersMethodCreateMigrationsTable
(ctx context.Context, tx Queryer, tableName string)
dialect.go:12
↓ 4 callersMethodGetAppliedMigrations
(ctx context.Context, tx Queryer, tableName string)
dialect.go:13
↓ 4 callersMethodPort
Port asks Docker for the host-side port we can use to connect to the relevant container's database port.
testdb_test.go:57
↓ 4 callersFunctionSortMigrations
SortMigrations sorts a slice of migrations by their IDs
migration.go:23
↓ 4 callersFunctionexpectScriptMatch
(t *testing.T, migration *Migration, regexpString string)
migration_test.go:59
↓ 4 callersMethodlog
(msgs ...interface{})
migrator.go:182
↓ 4 callersMethodquotedIdent
quotedIdent wraps the supplied string in the MySQL identifier quote character
mysql.go:107
↓ 3 callersMethodConn
(ctx context.Context)
schema.go:19
↓ 3 callersFunctionFSMigrations
FSMigrations receives a filesystem (such as an embed.FS) and extracts all files matching the provided glob as Migrations, with the filename (without e
embed_go116.go:18
↓ 3 callersFunctionMigrationFromFilePath
MigrationFromFilePath creates a Migration from a path on disk
file.go:47
↓ 3 callersFunctionMigrationIDFromFilename
MigrationIDFromFilename removes directory paths and extensions from the filename to make a friendlier Migration ID
file.go:14
↓ 3 callersMethodQuotedIdent
QuotedIdent wraps the supplied string in the Postgres identifier quote character
postgres.go:108
↓ 3 callersMethodlock
(tx Queryer)
migrator.go:99
↓ 3 callersMethodrun
(tx Queryer, migrations []*Migration)
migrator.go:138
↓ 3 callersMethodunlock
(tx Queryer)
migrator.go:110
↓ 2 callersMethodGetAppliedMigrations
GetAppliedMigrations retrieves all already-applied migrations in a map keyed by the migration IDs
applied-migration.go:28
↓ 2 callersMethodIsDocker
()
testdb_test.go:73
↓ 2 callersMethodIsRunnable
()
testdb_test.go:110
↓ 2 callersFunctionMigrationFromFile
MigrationFromFile builds a migration by reading from an open File-like object. The migration's ID will be based on the file's name. The file will *not
file.go:67
↓ 2 callersMethodName
()
file.go:60
↓ 2 callersMethodPath
Path computes the full path to the database on disk (applies only to SQLite instances).
testdb_test.go:121
↓ 2 callersMethodUnlock
(ctx context.Context, tx Queryer, tableName string)
dialect.go:22
↓ 2 callersFunctionWithLogger
WithLogger builds an Option which will set the supplied Logger on a Migrator. Usage: NewMigrator(WithLogger(logrus.New()))
options.go:58
↓ 2 callersMethodadvisoryLockID
advisoryLockID generates a table-specific lock name to use
mysql.go:115
↓ 2 callersMethodadvisoryLockID
advisoryLockID generates a consistent integer ID for use with SQL Server's sp_getapplock based on the table name. It uses a CRC32 checksum of the tabl
mssql.go:77
↓ 2 callersMethodadvisoryLockID
advisoryLockID generates a table-specific lock name to use
postgres.go:135
↓ 2 callersFunctionassertZonesMatch
assertZonesMatch accepts two Times and fails the test if their time zones don't match.
migrator_test.go:316
↓ 2 callersFunctioncoalesceErrs
(errs ...error)
migrator.go:188
↓ 2 callersMethodcomputeMigrationPlan
(tx Queryer, toRun []*Migration)
migrator.go:121
↓ 2 callersMethodgetLockMode
getLockMode checks if we currently hold a lock and returns the lock mode. This is extracted to a helper to ensure rows are properly closed before any
mssql.go:57
↓ 2 callersFunctionwithEachDialect
(t *testing.T, f func(t *testing.T, d Dialect))
main_test.go:67
↓ 1 callersMethodBeginTx
(ctx context.Context, opts *sql.TxOptions)
schema.go:38
↓ 1 callersMethodCleanup
Cleanup should be called after all tests with a database instance are complete. For dockertest-based tests, it deletes the docker containers. For SQLi
testdb_test.go:213
↓ 1 callersMethodDockerEnvars
DockerEnvars computes the environment variables that are needed for a docker instance.
testdb_test.go:83
↓ 1 callersMethodInit
Init sets up a test database instance for connections. For dockertest-based instances, this function triggers the `docker run` call. For SQLite-based
testdb_test.go:160
↓ 1 callersMethodInsertAppliedMigration
(ctx context.Context, tx Queryer, tableName string, migration *AppliedMigration)
dialect.go:14
↓ 1 callersMethodLock
(ctx context.Context, tx Queryer, tableName string)
dialect.go:21
↓ 1 callersMethodPrint
(...interface{})
options.go:53
↓ 1 callersMethodScanString
(src string)
mysql.go:138
↓ 1 callersFunctionWithContext
WithContext is an Option which sets the Migrator to run within the provided Context
options.go:42
↓ 1 callersMethodrunMigration
(tx Queryer, migration *Migration)
migrator.go:158
↓ 1 callersFunctionunorderedMigrations
()
migration_test.go:31
MethodConn
(ctx context.Context)
errors_test.go:41
MethodCreateMigrationsTable
CreateMigrationsTable implements the Dialect interface to create the table which tracks applied migrations. It only creates the table if it does not a
sqlite.go:19
MethodCreateMigrationsTable
CreateMigrationsTable implements the Dialect interface to create the table which tracks applied migrations. It only creates the table if it does not a
mysql.go:39
MethodCreateMigrationsTable
(ctx context.Context, tx Queryer, tableName string)
mssql.go:113
MethodCreateMigrationsTable
CreateMigrationsTable implements the Dialect interface to create the table which tracks applied migrations. It only creates the table if it does not a
postgres.go:41
MethodExecContext
(ctx context.Context, query string, args ...interface{})
mssql_test.go:72
MethodExecContext
(ctx context.Context, sql string, args ...interface{})
errors_test.go:29
MethodGetAppliedMigrations
GetAppliedMigrations retrieves all data from the migrations tracking table
sqlite.go:47
MethodGetAppliedMigrations
GetAppliedMigrations retrieves all data from the migrations tracking table
mysql.go:67
MethodGetAppliedMigrations
(ctx context.Context, tx Queryer, tableName string)
mssql.go:133
MethodGetAppliedMigrations
GetAppliedMigrations retrieves all data from the migrations tracking table
postgres.go:70
MethodInsertAppliedMigration
InsertAppliedMigration implements the Dialect interface to insert a record into the migrations tracking table *after* a migration has successfully run
sqlite.go:34
MethodInsertAppliedMigration
InsertAppliedMigration implements the Dialect interface to insert a record into the migrations tracking table *after* a migration has successfully run
mysql.go:54
MethodInsertAppliedMigration
(ctx context.Context, tx Queryer, tableName string, am *AppliedMigration)
mssql.go:161
MethodInsertAppliedMigration
InsertAppliedMigration implements the Dialect interface to insert a record into the migrations tracking table *after* a migration has successfully run
postgres.go:57
MethodIsSQLite
()
testdb_test.go:77
MethodLock
Lock implements the Locker interface to obtain a global lock before the migrations are run.
mysql.go:20
MethodLock
Lock implements the Locker interface to obtain a global lock before the migrations are run. It uses SQL Server's sp_getapplock stored procedure with a
mssql.go:23
MethodLock
Lock implements the Locker interface to obtain a global lock before the migrations are run.
postgres.go:22
MethodName
()
file_test.go:79
MethodPrint
(v ...interface{})
mysql_test.go:89
MethodPrint
(msgs ...interface{})
options_test.go:91
MethodQueryContext
(ctx context.Context, query string, args ...interface{})
mssql_test.go:76
MethodQueryContext
(ctx context.Context, sql string, args ...interface{})
errors_test.go:33
MethodQuotedTableName
QuotedTableName returns the string value of the name of the migration tracking table after it has been quoted for SQLite
sqlite.go:77
MethodQuotedTableName
QuotedTableName returns the string value of the name of the migration tracking table after it has been quoted for MySQL
mysql.go:98
MethodQuotedTableName
(schemaName, tableName string)
mssql.go:81
MethodQuotedTableName
QuotedTableName returns the string value of the name of the migration tracking table after it has been quoted for Postgres
postgres.go:99
MethodRead
(p []byte)
file_test.go:83
MethodRead
(b []byte)
file.go:61
FunctionTestApplyBeginFailure
(t *testing.T)
errors_test.go:82
FunctionTestApplyConnFailure
(t *testing.T)
errors_test.go:63
FunctionTestApplyCreateFailure
(t *testing.T)
errors_test.go:95
FunctionTestApplyInLexicalOrder
TestApplyInLexicalOrder ensures that each dialect runs migrations in their lexical order rather than the order they were provided in the slice. This i
migrator_test.go:61
FunctionTestApplyLockFailure
(t *testing.T)
errors_test.go:72
FunctionTestApplyWithNilDBProvidesHelpfulError
(t *testing.T)
errors_test.go:45
next →1–100 of 152, ranked by callers