Documentation ¶
Overview ¶
Code adapted from https://github.com/jackc/tern/blob/master/migrate/internal/sqlsplit/sqlsplit.go
Index ¶
- func SQLSplit(sql string) []string
- type DatabaseName
- type DatabaseServer
- type DatabaseStatus
- type LocalSqlServer
- func (l *LocalSqlServer) BuildAndRunMigrations(fs afero.Fs, databasesToMigrate map[string]*resourcespb.SqlDatabaseResource) error
- func (l *LocalSqlServer) ConnectionString(ctx context.Context, req *sqlpb.SqlConnectionStringRequest) (*sqlpb.SqlConnectionStringResponse, error)
- func (l *LocalSqlServer) GetState() State
- func (l *LocalSqlServer) Publish(state State)
- func (l *LocalSqlServer) Query(ctx context.Context, connectionString string, query string) ([]*orderedmap.OrderedMap[string, any], error)
- func (l *LocalSqlServer) RegisterDatabases(lrs resources.LocalResourcesState)
- func (l *LocalSqlServer) Stop() error
- func (l *LocalSqlServer) SubscribeToState(subscriberFunction func(State))
- type MigrationRunner
- type State
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DatabaseName ¶ added in v1.53.0
type DatabaseName = string
type DatabaseServer ¶ added in v1.53.0
type DatabaseServer struct { DatabaseName string Status string ResourceRegister *resources.ResourceRegister[resourcespb.SqlDatabaseResource] ConnectionString string }
type DatabaseStatus ¶ added in v1.53.0
type DatabaseStatus string
const ( DatabaseStatusStarting DatabaseStatus = "starting" DatabaseStatusBuildingMigrations DatabaseStatus = "building migrations" DatabaseStatusApplyingMigrations DatabaseStatus = "applying migrations" DatabaseStatusActive DatabaseStatus = "active" DatabaseStatusError DatabaseStatus = "error" )
type LocalSqlServer ¶
type LocalSqlServer struct { State State sqlpb.UnimplementedSqlServer // contains filtered or unexported fields }
func NewLocalSqlServer ¶
func NewLocalSqlServer(projectName string, localResources *resources.LocalResourcesService, migrationRunner MigrationRunner) (*LocalSqlServer, error)
func (*LocalSqlServer) BuildAndRunMigrations ¶ added in v1.53.0
func (l *LocalSqlServer) BuildAndRunMigrations(fs afero.Fs, databasesToMigrate map[string]*resourcespb.SqlDatabaseResource) error
func (*LocalSqlServer) ConnectionString ¶
func (l *LocalSqlServer) ConnectionString(ctx context.Context, req *sqlpb.SqlConnectionStringRequest) (*sqlpb.SqlConnectionStringResponse, error)
func (*LocalSqlServer) GetState ¶ added in v1.53.0
func (l *LocalSqlServer) GetState() State
func (*LocalSqlServer) Publish ¶ added in v1.53.0
func (l *LocalSqlServer) Publish(state State)
func (*LocalSqlServer) Query ¶ added in v1.49.0
func (l *LocalSqlServer) Query(ctx context.Context, connectionString string, query string) ([]*orderedmap.OrderedMap[string, any], error)
create a function that will execute a query on the local database
func (*LocalSqlServer) RegisterDatabases ¶ added in v1.53.0
func (l *LocalSqlServer) RegisterDatabases(lrs resources.LocalResourcesState)
func (*LocalSqlServer) Stop ¶
func (l *LocalSqlServer) Stop() error
func (*LocalSqlServer) SubscribeToState ¶ added in v1.53.0
func (l *LocalSqlServer) SubscribeToState(subscriberFunction func(State))
type MigrationRunner ¶ added in v1.53.0
type MigrationRunner = func(fs afero.Fs, servers map[string]*DatabaseServer, databasesToMigrate map[string]*resourcespb.SqlDatabaseResource) error
type State ¶ added in v1.53.0
type State = map[DatabaseName]*DatabaseServer
Click to show internal directories.
Click to hide internal directories.