vmysql

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRecordNotFound = gorm.ErrRecordNotFound
)

Functions

func Set

func Set(mysql *Mysql)

Types

type Config

type Config = gorm.Config

type DB

type DB = gorm.DB

func Open

func Open(dialector gorm.Dialector, opts ...gorm.Option) (db *DB, err error)

type Mysql

type Mysql struct {
	Client  *DB
	Options *Options
}

func Get

func Get() *Mysql

func New

func New(options map[string]any) (mysqlS *Mysql, err error)

New create new mysql

func (*Mysql) GetDsn

func (mysqlS *Mysql) GetDsn() string

GetDsn get dsn

func (*Mysql) SetConfig

func (mysqlS *Mysql) SetConfig(options map[string]any) (err error)

SetConfig set config

type Options

type Options struct {
	Charset  string `mapstructure:",omitempty"`
	Db       string `mapstructure:",omitempty"`
	Host     string `mapstructure:",omitempty"`
	Loc      string `mapstructure:",omitempty"`
	Password string `mapstructure:",omitempty"`
	Port     int    `mapstructure:",omitempty"`
	Timeout  string `mapstructure:",omitempty"`
	UserName string `mapstructure:",omitempty"`
}

func (*Options) String

func (o *Options) String() (data string)

Jump to

Keyboard shortcuts

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