mysql

package
v2.3.5 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package mysql define mysql db operation

Index

Constants

View Source
const DefaultLockLeaseAge = 10 * time.Second

DefaultLockLeaseAge define default db locker lease age

Variables

This section is empty.

Functions

func InitDb

func InitDb(user, password, host, port, dbName string, migrateLock bool) (*gorm.DB, error)

InitDb Connect db server and create database if not exists then switch to this database, returns *gorm.DB, error

func InitDbByDsn

func InitDbByDsn(dsn string, migrateLock bool) (*gorm.DB, error)

InitDbByDsn Connect db server by dsn and returns *gorm.DB, error @param dsn @param migrateLock @return *gorm.DB @return error

Types

type Locker

type Locker interface {
	Lock()
	UnLock()
}

Locker db lock

func NewDbLocker

func NewDbLocker(db *gorm.DB, holder string, lease time.Duration) Locker

NewDbLocker new db locker

Jump to

Keyboard shortcuts

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