Documentation ¶
Index ¶
- Variables
- func RegisterMigrationServiceServer(s *grpc.Server, srv MigrationServiceServer)
- type DatabaseForceVersionRequest
- func (*DatabaseForceVersionRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DatabaseForceVersionRequest) GetVersion() int32
- func (*DatabaseForceVersionRequest) ProtoMessage()
- func (x *DatabaseForceVersionRequest) ProtoReflect() protoreflect.Message
- func (x *DatabaseForceVersionRequest) Reset()
- func (x *DatabaseForceVersionRequest) String() string
- type DatabaseForceVersionResponse
- func (*DatabaseForceVersionResponse) Descriptor() ([]byte, []int)deprecated
- func (x *DatabaseForceVersionResponse) GetStatus() *MigrationStatus
- func (*DatabaseForceVersionResponse) ProtoMessage()
- func (x *DatabaseForceVersionResponse) ProtoReflect() protoreflect.Message
- func (x *DatabaseForceVersionResponse) Reset()
- func (x *DatabaseForceVersionResponse) String() string
- type DatabaseMigrateRequest
- type DatabaseMigrateResponse
- func (*DatabaseMigrateResponse) Descriptor() ([]byte, []int)deprecated
- func (x *DatabaseMigrateResponse) GetStatus() *MigrationStatus
- func (*DatabaseMigrateResponse) ProtoMessage()
- func (x *DatabaseMigrateResponse) ProtoReflect() protoreflect.Message
- func (x *DatabaseMigrateResponse) Reset()
- func (x *DatabaseMigrateResponse) String() string
- type DatabaseRollbackRequest
- type DatabaseRollbackResponse
- func (*DatabaseRollbackResponse) Descriptor() ([]byte, []int)deprecated
- func (x *DatabaseRollbackResponse) GetStatus() *MigrationStatus
- func (*DatabaseRollbackResponse) ProtoMessage()
- func (x *DatabaseRollbackResponse) ProtoReflect() protoreflect.Message
- func (x *DatabaseRollbackResponse) Reset()
- func (x *DatabaseRollbackResponse) String() string
- type DatabaseStatusRequest
- type DatabaseStatusResponse
- func (*DatabaseStatusResponse) Descriptor() ([]byte, []int)deprecated
- func (x *DatabaseStatusResponse) GetStatus() *MigrationStatus
- func (*DatabaseStatusResponse) ProtoMessage()
- func (x *DatabaseStatusResponse) ProtoReflect() protoreflect.Message
- func (x *DatabaseStatusResponse) Reset()
- func (x *DatabaseStatusResponse) String() string
- type MigrationConfig
- type MigrationService
- func (s MigrationService) DatabaseForceVersion(ctx context.Context, request *DatabaseForceVersionRequest) (*DatabaseForceVersionResponse, error)
- func (s MigrationService) DatabaseMigrate(ctx context.Context, request *DatabaseMigrateRequest) (*DatabaseMigrateResponse, error)
- func (s MigrationService) DatabaseRollback(ctx context.Context, request *DatabaseRollbackRequest) (*DatabaseRollbackResponse, error)
- func (s MigrationService) DatabaseStatus(ctx context.Context, request *DatabaseStatusRequest) (*DatabaseStatusResponse, error)
- type MigrationServiceClient
- type MigrationServiceServer
- type MigrationStatus
- func (*MigrationStatus) Descriptor() ([]byte, []int)deprecated
- func (x *MigrationStatus) GetDirty() bool
- func (x *MigrationStatus) GetLatestVersion() int32
- func (x *MigrationStatus) GetUpToDate() bool
- func (x *MigrationStatus) GetVersion() uint32
- func (*MigrationStatus) ProtoMessage()
- func (x *MigrationStatus) ProtoReflect() protoreflect.Message
- func (x *MigrationStatus) Reset()
- func (x *MigrationStatus) String() string
- type Migrator
- type UnimplementedMigrationServiceServer
- func (UnimplementedMigrationServiceServer) DatabaseForceVersion(context.Context, *DatabaseForceVersionRequest) (*DatabaseForceVersionResponse, error)
- func (UnimplementedMigrationServiceServer) DatabaseMigrate(context.Context, *DatabaseMigrateRequest) (*DatabaseMigrateResponse, error)
- func (UnimplementedMigrationServiceServer) DatabaseRollback(context.Context, *DatabaseRollbackRequest) (*DatabaseRollbackResponse, error)
- func (UnimplementedMigrationServiceServer) DatabaseStatus(context.Context, *DatabaseStatusRequest) (*DatabaseStatusResponse, error)
- type UnsafeMigrationServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_dbmigration_dbmigration_proto protoreflect.FileDescriptor
Functions ¶
func RegisterMigrationServiceServer ¶ added in v0.1.14
func RegisterMigrationServiceServer(s *grpc.Server, srv MigrationServiceServer)
Types ¶
type DatabaseForceVersionRequest ¶ added in v0.1.14
type DatabaseForceVersionRequest struct { Version int32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` // contains filtered or unexported fields }
func (*DatabaseForceVersionRequest) Descriptor
deprecated
added in
v0.1.14
func (*DatabaseForceVersionRequest) Descriptor() ([]byte, []int)
Deprecated: Use DatabaseForceVersionRequest.ProtoReflect.Descriptor instead.
func (*DatabaseForceVersionRequest) GetVersion ¶ added in v0.1.14
func (x *DatabaseForceVersionRequest) GetVersion() int32
func (*DatabaseForceVersionRequest) ProtoMessage ¶ added in v0.1.14
func (*DatabaseForceVersionRequest) ProtoMessage()
func (*DatabaseForceVersionRequest) ProtoReflect ¶ added in v0.1.14
func (x *DatabaseForceVersionRequest) ProtoReflect() protoreflect.Message
func (*DatabaseForceVersionRequest) Reset ¶ added in v0.1.14
func (x *DatabaseForceVersionRequest) Reset()
func (*DatabaseForceVersionRequest) String ¶ added in v0.1.14
func (x *DatabaseForceVersionRequest) String() string
type DatabaseForceVersionResponse ¶ added in v0.1.14
type DatabaseForceVersionResponse struct { Status *MigrationStatus `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` // contains filtered or unexported fields }
func (*DatabaseForceVersionResponse) Descriptor
deprecated
added in
v0.1.14
func (*DatabaseForceVersionResponse) Descriptor() ([]byte, []int)
Deprecated: Use DatabaseForceVersionResponse.ProtoReflect.Descriptor instead.
func (*DatabaseForceVersionResponse) GetStatus ¶ added in v0.1.14
func (x *DatabaseForceVersionResponse) GetStatus() *MigrationStatus
func (*DatabaseForceVersionResponse) ProtoMessage ¶ added in v0.1.14
func (*DatabaseForceVersionResponse) ProtoMessage()
func (*DatabaseForceVersionResponse) ProtoReflect ¶ added in v0.1.14
func (x *DatabaseForceVersionResponse) ProtoReflect() protoreflect.Message
func (*DatabaseForceVersionResponse) Reset ¶ added in v0.1.14
func (x *DatabaseForceVersionResponse) Reset()
func (*DatabaseForceVersionResponse) String ¶ added in v0.1.14
func (x *DatabaseForceVersionResponse) String() string
type DatabaseMigrateRequest ¶ added in v0.1.14
type DatabaseMigrateRequest struct {
// contains filtered or unexported fields
}
func (*DatabaseMigrateRequest) Descriptor
deprecated
added in
v0.1.14
func (*DatabaseMigrateRequest) Descriptor() ([]byte, []int)
Deprecated: Use DatabaseMigrateRequest.ProtoReflect.Descriptor instead.
func (*DatabaseMigrateRequest) ProtoMessage ¶ added in v0.1.14
func (*DatabaseMigrateRequest) ProtoMessage()
func (*DatabaseMigrateRequest) ProtoReflect ¶ added in v0.1.14
func (x *DatabaseMigrateRequest) ProtoReflect() protoreflect.Message
func (*DatabaseMigrateRequest) Reset ¶ added in v0.1.14
func (x *DatabaseMigrateRequest) Reset()
func (*DatabaseMigrateRequest) String ¶ added in v0.1.14
func (x *DatabaseMigrateRequest) String() string
type DatabaseMigrateResponse ¶ added in v0.1.14
type DatabaseMigrateResponse struct { Status *MigrationStatus `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` // contains filtered or unexported fields }
func (*DatabaseMigrateResponse) Descriptor
deprecated
added in
v0.1.14
func (*DatabaseMigrateResponse) Descriptor() ([]byte, []int)
Deprecated: Use DatabaseMigrateResponse.ProtoReflect.Descriptor instead.
func (*DatabaseMigrateResponse) GetStatus ¶ added in v0.1.14
func (x *DatabaseMigrateResponse) GetStatus() *MigrationStatus
func (*DatabaseMigrateResponse) ProtoMessage ¶ added in v0.1.14
func (*DatabaseMigrateResponse) ProtoMessage()
func (*DatabaseMigrateResponse) ProtoReflect ¶ added in v0.1.14
func (x *DatabaseMigrateResponse) ProtoReflect() protoreflect.Message
func (*DatabaseMigrateResponse) Reset ¶ added in v0.1.14
func (x *DatabaseMigrateResponse) Reset()
func (*DatabaseMigrateResponse) String ¶ added in v0.1.14
func (x *DatabaseMigrateResponse) String() string
type DatabaseRollbackRequest ¶ added in v0.1.14
type DatabaseRollbackRequest struct {
// contains filtered or unexported fields
}
func (*DatabaseRollbackRequest) Descriptor
deprecated
added in
v0.1.14
func (*DatabaseRollbackRequest) Descriptor() ([]byte, []int)
Deprecated: Use DatabaseRollbackRequest.ProtoReflect.Descriptor instead.
func (*DatabaseRollbackRequest) ProtoMessage ¶ added in v0.1.14
func (*DatabaseRollbackRequest) ProtoMessage()
func (*DatabaseRollbackRequest) ProtoReflect ¶ added in v0.1.14
func (x *DatabaseRollbackRequest) ProtoReflect() protoreflect.Message
func (*DatabaseRollbackRequest) Reset ¶ added in v0.1.14
func (x *DatabaseRollbackRequest) Reset()
func (*DatabaseRollbackRequest) String ¶ added in v0.1.14
func (x *DatabaseRollbackRequest) String() string
type DatabaseRollbackResponse ¶ added in v0.1.14
type DatabaseRollbackResponse struct { Status *MigrationStatus `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` // contains filtered or unexported fields }
func (*DatabaseRollbackResponse) Descriptor
deprecated
added in
v0.1.14
func (*DatabaseRollbackResponse) Descriptor() ([]byte, []int)
Deprecated: Use DatabaseRollbackResponse.ProtoReflect.Descriptor instead.
func (*DatabaseRollbackResponse) GetStatus ¶ added in v0.1.14
func (x *DatabaseRollbackResponse) GetStatus() *MigrationStatus
func (*DatabaseRollbackResponse) ProtoMessage ¶ added in v0.1.14
func (*DatabaseRollbackResponse) ProtoMessage()
func (*DatabaseRollbackResponse) ProtoReflect ¶ added in v0.1.14
func (x *DatabaseRollbackResponse) ProtoReflect() protoreflect.Message
func (*DatabaseRollbackResponse) Reset ¶ added in v0.1.14
func (x *DatabaseRollbackResponse) Reset()
func (*DatabaseRollbackResponse) String ¶ added in v0.1.14
func (x *DatabaseRollbackResponse) String() string
type DatabaseStatusRequest ¶ added in v0.1.14
type DatabaseStatusRequest struct {
// contains filtered or unexported fields
}
func (*DatabaseStatusRequest) Descriptor
deprecated
added in
v0.1.14
func (*DatabaseStatusRequest) Descriptor() ([]byte, []int)
Deprecated: Use DatabaseStatusRequest.ProtoReflect.Descriptor instead.
func (*DatabaseStatusRequest) ProtoMessage ¶ added in v0.1.14
func (*DatabaseStatusRequest) ProtoMessage()
func (*DatabaseStatusRequest) ProtoReflect ¶ added in v0.1.14
func (x *DatabaseStatusRequest) ProtoReflect() protoreflect.Message
func (*DatabaseStatusRequest) Reset ¶ added in v0.1.14
func (x *DatabaseStatusRequest) Reset()
func (*DatabaseStatusRequest) String ¶ added in v0.1.14
func (x *DatabaseStatusRequest) String() string
type DatabaseStatusResponse ¶ added in v0.1.14
type DatabaseStatusResponse struct { Status *MigrationStatus `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` // contains filtered or unexported fields }
func (*DatabaseStatusResponse) Descriptor
deprecated
added in
v0.1.14
func (*DatabaseStatusResponse) Descriptor() ([]byte, []int)
Deprecated: Use DatabaseStatusResponse.ProtoReflect.Descriptor instead.
func (*DatabaseStatusResponse) GetStatus ¶ added in v0.1.14
func (x *DatabaseStatusResponse) GetStatus() *MigrationStatus
func (*DatabaseStatusResponse) ProtoMessage ¶ added in v0.1.14
func (*DatabaseStatusResponse) ProtoMessage()
func (*DatabaseStatusResponse) ProtoReflect ¶ added in v0.1.14
func (x *DatabaseStatusResponse) ProtoReflect() protoreflect.Message
func (*DatabaseStatusResponse) Reset ¶ added in v0.1.14
func (x *DatabaseStatusResponse) Reset()
func (*DatabaseStatusResponse) String ¶ added in v0.1.14
func (x *DatabaseStatusResponse) String() string
type MigrationConfig ¶
type MigrationService ¶
type MigrationService struct { UnimplementedMigrationServiceServer // contains filtered or unexported fields }
func (MigrationService) DatabaseForceVersion ¶
func (s MigrationService) DatabaseForceVersion(ctx context.Context, request *DatabaseForceVersionRequest) (*DatabaseForceVersionResponse, error)
func (MigrationService) DatabaseMigrate ¶
func (s MigrationService) DatabaseMigrate(ctx context.Context, request *DatabaseMigrateRequest) (*DatabaseMigrateResponse, error)
func (MigrationService) DatabaseRollback ¶
func (s MigrationService) DatabaseRollback(ctx context.Context, request *DatabaseRollbackRequest) (*DatabaseRollbackResponse, error)
func (MigrationService) DatabaseStatus ¶
func (s MigrationService) DatabaseStatus(ctx context.Context, request *DatabaseStatusRequest) (*DatabaseStatusResponse, error)
type MigrationServiceClient ¶ added in v0.1.14
type MigrationServiceClient interface { // Migrate the database DatabaseMigrate(ctx context.Context, in *DatabaseMigrateRequest, opts ...grpc.CallOption) (*DatabaseMigrateResponse, error) // Get db status (currently only contains migration information) DatabaseStatus(ctx context.Context, in *DatabaseStatusRequest, opts ...grpc.CallOption) (*DatabaseStatusResponse, error) // Rollback database DatabaseRollback(ctx context.Context, in *DatabaseRollbackRequest, opts ...grpc.CallOption) (*DatabaseRollbackResponse, error) // Get migration status DatabaseForceVersion(ctx context.Context, in *DatabaseForceVersionRequest, opts ...grpc.CallOption) (*DatabaseForceVersionResponse, error) }
MigrationServiceClient is the client API for MigrationService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewMigrationServiceClient ¶ added in v0.1.14
func NewMigrationServiceClient(cc grpc.ClientConnInterface) MigrationServiceClient
type MigrationServiceServer ¶ added in v0.1.14
type MigrationServiceServer interface { // Migrate the database DatabaseMigrate(context.Context, *DatabaseMigrateRequest) (*DatabaseMigrateResponse, error) // Get db status (currently only contains migration information) DatabaseStatus(context.Context, *DatabaseStatusRequest) (*DatabaseStatusResponse, error) // Rollback database DatabaseRollback(context.Context, *DatabaseRollbackRequest) (*DatabaseRollbackResponse, error) // Get migration status DatabaseForceVersion(context.Context, *DatabaseForceVersionRequest) (*DatabaseForceVersionResponse, error) // contains filtered or unexported methods }
MigrationServiceServer is the server API for MigrationService service. All implementations must embed UnimplementedMigrationServiceServer for forward compatibility
func NewMigrationService ¶
func NewMigrationService(log *zap.SugaredLogger, config MigrationConfig) MigrationServiceServer
type MigrationStatus ¶ added in v0.1.14
type MigrationStatus struct { Version uint32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` LatestVersion int32 `protobuf:"varint,2,opt,name=latest_version,json=latestVersion,proto3" json:"latest_version,omitempty"` UpToDate bool `protobuf:"varint,3,opt,name=up_to_date,json=upToDate,proto3" json:"up_to_date,omitempty"` Dirty bool `protobuf:"varint,4,opt,name=dirty,proto3" json:"dirty,omitempty"` // contains filtered or unexported fields }
func (*MigrationStatus) Descriptor
deprecated
added in
v0.1.14
func (*MigrationStatus) Descriptor() ([]byte, []int)
Deprecated: Use MigrationStatus.ProtoReflect.Descriptor instead.
func (*MigrationStatus) GetDirty ¶ added in v0.1.14
func (x *MigrationStatus) GetDirty() bool
func (*MigrationStatus) GetLatestVersion ¶ added in v0.1.14
func (x *MigrationStatus) GetLatestVersion() int32
func (*MigrationStatus) GetUpToDate ¶ added in v0.1.14
func (x *MigrationStatus) GetUpToDate() bool
func (*MigrationStatus) GetVersion ¶ added in v0.1.14
func (x *MigrationStatus) GetVersion() uint32
func (*MigrationStatus) ProtoMessage ¶ added in v0.1.14
func (*MigrationStatus) ProtoMessage()
func (*MigrationStatus) ProtoReflect ¶ added in v0.1.14
func (x *MigrationStatus) ProtoReflect() protoreflect.Message
func (*MigrationStatus) Reset ¶ added in v0.1.14
func (x *MigrationStatus) Reset()
func (*MigrationStatus) String ¶ added in v0.1.14
func (x *MigrationStatus) String() string
type Migrator ¶
type Migrator struct {
// contains filtered or unexported fields
}
func NewMigrator ¶
func NewMigrator(log *zap.SugaredLogger, sqlConnStr, fileDir string) Migrator
func (Migrator) ForceVersion ¶
func (m Migrator) ForceVersion(version int32) (*MigrationStatus, error)
func (Migrator) Migrate ¶
func (m Migrator) Migrate() (*MigrationStatus, error)
func (Migrator) Rollback ¶
func (m Migrator) Rollback() (*MigrationStatus, error)
func (Migrator) Status ¶
func (m Migrator) Status() (*MigrationStatus, error)
type UnimplementedMigrationServiceServer ¶ added in v0.1.14
type UnimplementedMigrationServiceServer struct { }
UnimplementedMigrationServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedMigrationServiceServer) DatabaseForceVersion ¶ added in v0.1.14
func (UnimplementedMigrationServiceServer) DatabaseForceVersion(context.Context, *DatabaseForceVersionRequest) (*DatabaseForceVersionResponse, error)
func (UnimplementedMigrationServiceServer) DatabaseMigrate ¶ added in v0.1.14
func (UnimplementedMigrationServiceServer) DatabaseMigrate(context.Context, *DatabaseMigrateRequest) (*DatabaseMigrateResponse, error)
func (UnimplementedMigrationServiceServer) DatabaseRollback ¶ added in v0.1.14
func (UnimplementedMigrationServiceServer) DatabaseRollback(context.Context, *DatabaseRollbackRequest) (*DatabaseRollbackResponse, error)
func (UnimplementedMigrationServiceServer) DatabaseStatus ¶ added in v0.1.14
func (UnimplementedMigrationServiceServer) DatabaseStatus(context.Context, *DatabaseStatusRequest) (*DatabaseStatusResponse, error)
type UnsafeMigrationServiceServer ¶ added in v0.1.14
type UnsafeMigrationServiceServer interface {
// contains filtered or unexported methods
}
UnsafeMigrationServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MigrationServiceServer will result in compilation errors.