gdsn

package
v0.0.0-...-047dcd9 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DSN

type DSN struct {
	Driver   Driver
	User     string
	Password string
	Host     string // Domain or IP address without port (e.g. localhost) or path to unix domain socket directory (e.g. /private/tmp)
	Port     uint16
	Path     string // Sub path after port, but before Options. It is database sometimes.
	Database string
	Options  map[string]string
}

func Parse

func Parse(s string) (*DSN, error)

Compare to gaddr.ParseURL, gdsn.Parse use professional database package to parse data source name string. Some databases have DSNs in specific formats, for example, MongoDB DSN supports multiple ports.

func ParseForSpecificDriver

func ParseForSpecificDriver(s string, dvr Driver) (*DSN, error)

func (*DSN) Build

func (ci *DSN) Build(dvr Driver) (string, error)

func (*DSN) HostAndPort

func (ci *DSN) HostAndPort() string

Jump to

Keyboard shortcuts

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