ormmysql

package module
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: BSD-3-Clause Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

New init new mysql connection

func WithClient added in v0.3.6

func WithClient() plugins.Plugin

WithClient launch MySQL connection pool

Types

type Config

type Config struct {
	Pool []Item `yaml:"mysql"`
}

Config pool of configs

func (*Config) List

func (c *Config) List() (list []sqlcommon.ItemInterface)

List getting all configs

type ConfigMysql

type ConfigMysql struct {
	Pool    []Item                  `yaml:"mysql"`
	Migrate []orm.ConfigMigrateItem `yaml:"mysql_migrate"`
}

ConfigMysql mysql config model

func (*ConfigMysql) Default

func (v *ConfigMysql) Default()

func (*ConfigMysql) List

func (v *ConfigMysql) List() (list []sqlcommon.ItemInterface)

List getting all configs

type Item

type Item struct {
	Name              string        `yaml:"name"`
	Host              string        `yaml:"host"`
	Port              int           `yaml:"port"`
	Schema            string        `yaml:"schema"`
	User              string        `yaml:"user"`
	Password          string        `yaml:"password"`
	Timezone          string        `yaml:"timezone"`
	TxIsolationLevel  string        `yaml:"txisolevel"`
	Charset           string        `yaml:"charset"`
	Collation         string        `yaml:"collation"`
	MaxIdleConn       int           `yaml:"maxidleconn"`
	MaxOpenConn       int           `yaml:"maxopenconn"`
	InterpolateParams bool          `yaml:"interpolateparams"`
	MaxConnTTL        time.Duration `yaml:"maxconnttl"`
	Timeout           time.Duration `yaml:"timeout"`
	ReadTimeout       time.Duration `yaml:"readtimeout"`
	WriteTimeout      time.Duration `yaml:"writetimeout"`
	OtherParams       string        `yaml:"other_params"`
}

Item config model

func (Item) GetDSN

func (i Item) GetDSN() string

GetDSN connection params

func (Item) GetName

func (i Item) GetName() string

GetName getting config name

func (Item) Setup

func (i Item) Setup(s sqlcommon.SetupInterface)

Setup setting config conntections params

type MySQL

type MySQL interface {
	Pool(name string) orm.Stmt
}

MySQL connection MySQL interface

Jump to

Keyboard shortcuts

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