mysql

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const DefaultTimeOut = "2s"

Variables

View Source
var (

	// IsRecordNotFoundError ...
	IsRecordNotFoundError = gorm.IsRecordNotFoundError

	// ErrRecordNotFound returns a "record not found error". Occurs only when attempting to query the database with a struct; querying with a slice won't return this error
	ErrRecordNotFound = gorm.ErrRecordNotFound
	// ErrInvalidSQL occurs when you attempt a query with invalid SQL
	ErrInvalidSQL = gorm.ErrInvalidSQL
	// ErrInvalidTransaction occurs when you are trying to `Commit` or `Rollback`
	ErrInvalidTransaction = gorm.ErrInvalidTransaction
	// ErrCantStartTransaction can't start transaction when you are trying to start one with `Begin`
	ErrCantStartTransaction = gorm.ErrCantStartTransaction
	// ErrUnaddressable unaddressable value
	ErrUnaddressable = gorm.ErrUnaddressable
)

Functions

This section is empty.

Types

type Association

type Association = gorm.Association

Association ...

type Callback

type Callback = gorm.Callback

Callback alias of gorm.Callback

type CallbackProcessor

type CallbackProcessor = gorm.CallbackProcessor

CallbackProcessor alias of gorm.CallbackProcessor

type DB

type DB = gorm.DB

DB ...

func Open

func Open(dialect string, check *MysqlHealthCheck) (*DB, error)

Open ...

type DSN

type DSN struct {
	User     string            // Username
	Password string            // Password (requires User)
	Net      string            // Network type
	Addr     string            // Network address (requires Net)
	DBName   string            // Database name
	Params   map[string]string // Connection parameters
}

DSN ...

func ParseDSN

func ParseDSN(dsn string) (cfg *DSN, err error)

ParseDSN parses the DSN string to a NodeConfig

type Dialect

type Dialect = gorm.Dialect

Dialect alias of gorm.Dialect

type Errors

type Errors = gorm.Errors

Errors ...

type Field

type Field = gorm.Field

Field ...

type Logger

type Logger = gorm.Logger

Logger ...

type Model

type Model = gorm.Model

Model ...

type ModelStruct

type ModelStruct = gorm.ModelStruct

ModelStruct ...

type MysqlHealthCheck

type MysqlHealthCheck struct {
	DSN string `json:"dsn"`
}

MysqlHealthCheck mysql check config

Example
// get instance
mysqlHealthCheck := NewMysqlHealthCheck()
// LoadExtConfig
err := mysqlHealthCheck.LoadExtConfig(DsnConfig)
if err != nil {
	fmt.Println(err)
}
// DoHealthCheck
resHealthCheck, err := mysqlHealthCheck.DoHealthCheck()
if err != nil {
	fmt.Println(err)
}
fmt.Println(resHealthCheck)
Output:

func NewMysqlHealthCheck

func NewMysqlHealthCheck() *MysqlHealthCheck

NewMysqlHealthCheck new a instance

func (*MysqlHealthCheck) DoHealthCheck

func (h *MysqlHealthCheck) DoHealthCheck() (resHealthCheck *view.ResHealthCheck, err error)

DoHealthCheck check is invoked periodically to perform the mysql check

func (*MysqlHealthCheck) LoadExtConfig

func (h *MysqlHealthCheck) LoadExtConfig(extConfig string) (err error)

LoadExtConfig parse config

func (*MysqlHealthCheck) ParseDSN

func (h *MysqlHealthCheck) ParseDSN(dsn string) (cfg *DSN, err error)

ParseDSN parses the DSN string to a NodeConfig

type RowQueryResult

type RowQueryResult = gorm.RowQueryResult

RowQueryResult ...

type RowsQueryResult

type RowsQueryResult = gorm.RowsQueryResult

RowsQueryResult ...

type SQLCommon

type SQLCommon = gorm.SQLCommon

SQLCommon alias of gorm.SQLCommon

type Scope

type Scope = gorm.Scope

Scope ...

type StructField

type StructField = gorm.StructField

StructField ...

Jump to

Keyboard shortcuts

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