mysql

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package mysql provides the functions for handling vald's data with MySQL.

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 {
	GetVector(ctx context.Context, uuid string) (Vector, error)
	GetIPs(ctx context.Context, uuid string) ([]string, error)
}

type MySQL

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

MySQL represents the interface to handle MySQL operation.

func New

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

New creates the new mySQLClient with option. It will return error when set option is failed.

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 net.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 WithNetwork added in v1.0.3

func WithNetwork(network string) Option

WithNetwork returns the option to set the network type (tcp, unix).

func WithPass

func WithPass(pass string) Option

WithPass returns the option to set the pass.

func WithPort

func WithPort(port uint16) Option

WithPort returns the option to set the port.

func WithSocketPath added in v1.0.3

func WithSocketPath(socketPath string) Option

WithSocketPath returns the option to set the socketPath for unix domain socket connection.

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 {
	SetVector(ctx context.Context, vec Vector) error
	SetVectors(ctx context.Context, vecs ...Vector) error
	DeleteVector(ctx context.Context, uuid string) error
	DeleteVectors(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

type Vector added in v1.0.0

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

Vector is an interface to handle vector keep in MySQL.

Directories

Path Synopsis
Package dbr provides the dbr functions for handling with databases.
Package dbr provides the dbr functions for handling with databases.

Jump to

Keyboard shortcuts

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