config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUser             = "user"
	DefaultPassword         = "password"
	DefaultSocket           = "/tmp/mysql.sock"
	DefaultHost             = "localhost"
	DefaultPort             = 3306
	DefaultDatabase         = "db"
	DefaultMemoryNetwork    = "memory"
	DefaultMemoryAddress    = "bufconn"
	DefaultMemoryBufferSize = 1024 * 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigOptions

type ConfigOptions struct {
	Transport Transport
	Listener  *bufconn.Listener
	User      string
	Password  string
	Socket    string
	Host      string
	Port      int
	Database  string
}

ConfigOptions are options for the [GoMySQLServerFactory] implementations.

func DefaultGoMySQLServerConfigOptions

func DefaultGoMySQLServerConfigOptions() ConfigOptions

DefaultGoMySQLServerConfigOptions are the default options used in the [DefaultGoMySQLServerFactory].

type GoMySQLServerConfig

type GoMySQLServerConfig struct {
	// contains filtered or unexported fields
}

GoMySQLServerConfig is the server configuration.

func NewGoMySQLServerConfig

func NewGoMySQLServerConfig(options ...GoMySQLServerConfigOption) *GoMySQLServerConfig

NewGoMySQLServerConfig returns a new GoMySQLServerConfig.

func (*GoMySQLServerConfig) DSN

func (c *GoMySQLServerConfig) DSN() (string, error)

DSN returns the dsn, depending on the configuration transport.

func (*GoMySQLServerConfig) Database

func (c *GoMySQLServerConfig) Database() string

Database returns the configuration database.

func (*GoMySQLServerConfig) Host

func (c *GoMySQLServerConfig) Host() string

Host returns the configuration host.

func (*GoMySQLServerConfig) Listener

func (c *GoMySQLServerConfig) Listener() *bufconn.Listener

Listener returns the configuration listener.

func (*GoMySQLServerConfig) Password

func (c *GoMySQLServerConfig) Password() string

Password returns the configuration password.

func (*GoMySQLServerConfig) Port

func (c *GoMySQLServerConfig) Port() int

Port returns the configuration port.

func (*GoMySQLServerConfig) Socket

func (c *GoMySQLServerConfig) Socket() string

Socket returns the configuration socket.

func (*GoMySQLServerConfig) Transport

func (c *GoMySQLServerConfig) Transport() Transport

Transport returns the configuration transport.

func (*GoMySQLServerConfig) User

func (c *GoMySQLServerConfig) User() string

User returns the configuration user.

type GoMySQLServerConfigOption

type GoMySQLServerConfigOption func(o *ConfigOptions)

GoMySQLServerConfigOption are functional options for the [GoMySQLServerFactory] implementations.

func WithDatabase

func WithDatabase(database string) GoMySQLServerConfigOption

WithDatabase is used to specify the database.

func WithHost

func WithHost(host string) GoMySQLServerConfigOption

WithHost is used to specify the host.

func WithPassword

func WithPassword(password string) GoMySQLServerConfigOption

WithPassword is used to specify the password.

func WithPort

func WithPort(port int) GoMySQLServerConfigOption

WithPort is used to specify the port.

func WithSocket

func WithSocket(socket string) GoMySQLServerConfigOption

WithSocket is used to specify the socket.

func WithTransport

func WithTransport(transport Transport) GoMySQLServerConfigOption

WithTransport is used to specify the Transport.

func WithUser

func WithUser(user string) GoMySQLServerConfigOption

WithUser is used to specify the user.

type Transport

type Transport string

Transport is an enum for the supported database connection protocols.

const (
	UnknownTransport Transport = "unknown"
	TCPTransport     Transport = "tcp"
	SocketTransport  Transport = "socket"
	MemoryTransport  Transport = "memory"
)

func FetchTransport

func FetchTransport(name string) Transport

FetchTransport returns a Transport for a given name.

func (Transport) String

func (t Transport) String() string

String returns a string representation of the Transport.

Jump to

Keyboard shortcuts

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