mysql

package
v0.0.26 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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
}

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 Option

type Option func(*mySQLClient) error

func WithCharset

func WithCharset(cs string) Option

func WithConnectionLifeTimeLimit

func WithConnectionLifeTimeLimit(dur string) Option

func WithDB

func WithDB(db string) Option

func WithDialer

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

func WithHost

func WithHost(host string) Option

func WithInitialPingDuration

func WithInitialPingDuration(dur string) Option

func WithInitialPingTimeLimit

func WithInitialPingTimeLimit(lim string) Option

func WithMaxIdleConns

func WithMaxIdleConns(conns int) Option

func WithMaxOpenConns

func WithMaxOpenConns(conns int) Option

func WithName

func WithName(name string) Option

func WithPass

func WithPass(pass string) Option

func WithPort

func WithPort(port int) Option

func WithTLSConfig

func WithTLSConfig(cfg *tls.Config) Option

func WithTimezone

func WithTimezone(tz string) Option

func WithUser

func WithUser(user string) Option

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
}

Jump to

Keyboard shortcuts

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