dbmigration

package
v0.1.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 (*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 (*DatabaseForceVersionResponse) ProtoMessage added in v0.1.14

func (*DatabaseForceVersionResponse) ProtoMessage()

func (*DatabaseForceVersionResponse) ProtoReflect added in v0.1.14

func (*DatabaseForceVersionResponse) Reset added in v0.1.14

func (x *DatabaseForceVersionResponse) Reset()

func (*DatabaseForceVersionResponse) String added in v0.1.14

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 MigrationConfig struct {
	MigrateOnStart bool
	SqlFileDir     string
	SqlConnStr     string
}

type MigrationService

type MigrationService struct {
	UnimplementedMigrationServiceServer
	// contains filtered or unexported fields
}

func (MigrationService) DatabaseForceVersion

func (MigrationService) DatabaseMigrate

func (MigrationService) DatabaseRollback

func (MigrationService) DatabaseStatus

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) DatabaseMigrate added in v0.1.14

func (UnimplementedMigrationServiceServer) DatabaseRollback added in v0.1.14

func (UnimplementedMigrationServiceServer) DatabaseStatus added in v0.1.14

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL