mysql

package
v0.0.57 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventReceiver added in v0.0.51

type EventReceiver = dbr.EventReceiver

type Getter

type Getter interface {
	GetMeta(ctx context.Context, uuid string) (MetaVector, error)
	GetIPs(ctx context.Context, uuid string) ([]string, error)
}

type MetaVector

type MetaVector interface {
	GetUUID() string
	GetVector() []byte
	GetMeta() string
	GetIPs() []string
}

MetaVector is an interface to handle metadata keep in MySQL.

type MySQL

type MySQL interface {
	Open(ctx context.Context) error
	Close(ctx context.Context) error
	Getter
	Setter
}

func New

func New(opts ...Option) (MySQL, error)

type NullEventReceiver added in v0.0.51

type NullEventReceiver = dbr.NullEventReceiver

type Option

type Option func(*mySQLClient) error

Option represents the functional option for mySQLClient.

func WithCharset

func WithCharset(cs string) Option

WithCharset returns the option to set the charset.

func WithConnectionLifeTimeLimit

func WithConnectionLifeTimeLimit(dur string) Option

WithConnectionLifeTimeLimit returns the option to set the connMaxLifeTime.

func WithDB

func WithDB(db string) Option

WithDB returns the option to set the db.

func WithDialer

func WithDialer(der tcp.Dialer) Option

WithDialer returns the option to set the dialer.

func WithDialerFunc added in v0.0.51

func WithDialerFunc(der func(ctx context.Context, addr, port string) (net.Conn, error)) Option

WithDialerFunc returns the option to set the dialer function.

func WithEventReceiver added in v0.0.51

func WithEventReceiver(er EventReceiver) Option

WithEventReceiver returns the option to set the eventReceiver.

func WithHost

func WithHost(host string) Option

WithHost returns the option to set the host.

func WithInitialPingDuration

func WithInitialPingDuration(dur string) Option

WithInitialPingDuration returns the option to set the initialPingDuration.

func WithInitialPingTimeLimit

func WithInitialPingTimeLimit(lim string) Option

WithInitialPingTimeLimit returns the option to set the initialPingTimeLimit.

func WithMaxIdleConns

func WithMaxIdleConns(conns int) Option

WithMaxIdleConns returns the option to set the maxIdleConns. If conns is negative numner, no idle connections are retained. ref: https://golang.org/src/database/sql/sql.go?s=24983:25019#L879

func WithMaxOpenConns

func WithMaxOpenConns(conns int) Option

WithMaxOpenConns returns the option to set the maxOpenConns. If conns is negative numner, no limit on the number of open connections. ref: https://golang.org/src/database/sql/sql.go?s=24983:25019#L923

func WithName

func WithName(name string) Option

WithName returns the option to sst the name.

func WithPass

func WithPass(pass string) Option

WithPass returns the option to set the pass.

func WithPort

func WithPort(port int) Option

WithPort returns the option to set the port.

func WithTLSConfig

func WithTLSConfig(cfg *tls.Config) Option

WithTLSConfig returns the option to set the tlsConfig.

func WithTimezone

func WithTimezone(tz string) Option

WithTimezone returns the option to set the timezone.

func WithUser

func WithUser(user string) Option

WithUser returns the option to set the user.

type Setter

type Setter interface {
	SetMeta(ctx context.Context, meta MetaVector) error
	SetMetas(ctx context.Context, metas ...MetaVector) error
	DeleteMeta(ctx context.Context, uuid string) error
	DeleteMetas(ctx context.Context, uuids ...string) error
	SetIPs(ctx context.Context, uuid string, ips ...string) error
	RemoveIPs(ctx context.Context, ips ...string) error
}

type TracingEventReceiver added in v0.0.51

type TracingEventReceiver = dbr.TracingEventReceiver

Jump to

Keyboard shortcuts

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