Documentation
¶
Overview ¶
Package location contains functionality related to source location.
Index ¶
Constants ¶
const ( TypeStdin = "stdin" TypeFile = "local_file" TypeSQL = "sql" TypeHTTP = "http_file" TypeUnknown = "unknown" )
Variables ¶
This section is empty.
Functions ¶
func Abs ¶
Abs returns the absolute path of loc. That is, relative paths etc. are resolved. If loc is not a file path or it cannot be processed, loc is returned unmodified.
func Redact ¶
Redact returns a redacted version of the source location loc, with the password component (if any) of the location masked.
func Short ¶
Short returns a short location string. For example, the base name (data.xlsx) for a file, or for a DSN, user@host[:port]/db.
func WithPassword ¶
WithPassword returns the location string with the password value set, overriding any existing password. If loc is not a URL (e.g. it's a file path), it is returned unmodified.
Types ¶
type Fields ¶
type Fields struct {
// Loc is the original unparsed location value.
Loc string
// DriverType is the associated source driver type, which may
// be empty until later determination.
DriverType drivertype.Type
// Scheme is the original location Scheme.
Scheme string
// User is the username, if applicable.
User string
// Pass is the password, if applicable.
Pass string
// Hostname is the Hostname, if applicable.
Hostname string
// Name is the "source Name", e.g. "sakila". Typically this
// is the database Name, but for a file location such
// as "/path/to/things.xlsx" it would be "things".
Name string
// Ext is the file extension, if applicable.
Ext string
// DSN is the connection "data source Name" that can be used in a
// call to sql.Open. Empty for non-SQL locations.
DSN string
// Port is the Port number or 0 if not applicable.
Port int
}
Fields is a parsed representation of a source location.