oceanbase

package
v0.0.0-...-fee78ac Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TEST_DATABASE_SQL         = "SELECT 1"
	TEST_OCEANBASE_SQL        = "SHOW DATABASES"
	TEST_OCEANBASE_TABLES_SQL = "SHOW TABLES"
)
View Source
const (
	STATE_PROCESS_NOT_RUNNING = iota
	STATE_PROCESS_RUNNING
	STATE_CONNECTION_RESTRICTED
	STATE_CONNECTION_AVAILABLE
)

Variables

View Source
var (
	ERR_OBSERVER_NOT_EXIST = errors.New("observer process not exist")
)
View Source
var OBStateMap = map[int]string{
	0: "OB process not running",
	1: "OB process running with no connection",
	2: "OB process running with restricted connection",
	3: "OB process running with available connection",
}
View Source
var OBStateShortMap = map[int]string{
	0: "NOT RUNNING",
	1: "RUNNING",
	2: "RESTRICTED",
	3: "AVAILABLE",
}

Functions

func AutoMigrateObTables

func AutoMigrateObTables(parallel bool) (err error)

func CheckObserverProcess

func CheckObserverProcess() error

if observer process not exist, return error

func ClearInstance

func ClearInstance()

func CreateDataBase

func CreateDataBase(dBname string) (err error)

CreateDataBase will query whether the ocs db exists, create it if it does not exist

func GetAvailableInstance

func GetAvailableInstance() (db *gorm.DB, err error)

func GetInstance

func GetInstance() (db *gorm.DB, err error)

GetInstance will return the current connection regardless of the database it is connected with. If the connection cannot execute the SQL command 'SHOW DATABASES', it will return an error.

func GetLastInitError

func GetLastInitError() error

func GetOcsInstance

func GetOcsInstance() (db *gorm.DB, err error)

GetOcsInstance will return a connection to the OCS database. If the connection cannot execute the SQL command 'SHOW DATABASES', it will return an error.

func GetRestrictedInstance

func GetRestrictedInstance() (db *gorm.DB, err error)

GetRestrictedInstance will return the connection which not specify any database and this connection can only execute the SQL command 'SELECT 1'.

func GetState

func GetState() int

func HasAttemptedConnection

func HasAttemptedConnection() bool

func HasOceanbaseInstance

func HasOceanbaseInstance() bool

func Init

func Init()

func IsConnecting

func IsConnecting() bool

func IsDuplicateColumn

func IsDuplicateColumn(err error) bool

func IsInitPasswordError

func IsInitPasswordError() bool

func IsTableAlreadyExists

func IsTableAlreadyExists(err error) bool

func IsTableNotExists

func IsTableNotExists(err error) bool

func LoadGormWithTenant

func LoadGormWithTenant(tenant string, password string) (*gorm.DB, error)

LoadTmpInstanceWithTenant creates a db instance according to the configuration.

func LoadOceanbaseInstance

func LoadOceanbaseInstance(config ...*config.ObDataSourceConfig) error

LoadOceanbaseInstance creates a db instance according to the configuration. The `config` is a variable-length parameter, and the corresponding operation is selected according to whether the parameter is set or not. If there are no special requirements, do not set config.

func LoadOceanbaseInstanceForTest

func LoadOceanbaseInstanceForTest(dsConfig *config.ObDataSourceConfig) error

LoadOceanbaseInstanceForTest will try connecting ob with the given configuration to verify that the configuration is correct.

func NewConnectSubscriber

func NewConnectSubscriber() *connectSubscriber

Types

This section is empty.

Jump to

Keyboard shortcuts

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