mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-05-06 20:03:05 +08:00
- 引入 third_party/highgo-pq 作为 HighGo 专用驱动实现 - 调整驱动注册与连接入口,避免覆盖 postgres 驱动 - 保持 PG 数据源行为不变并补充接入文档
26 lines
579 B
Go
26 lines
579 B
Go
// Package pq is a pure Go Postgres driver for the database/sql package.
|
|
|
|
//go:build aix || darwin || dragonfly || freebsd || (linux && !android) || nacl || netbsd || openbsd || plan9 || solaris || rumprun || illumos
|
|
// +build aix darwin dragonfly freebsd linux,!android nacl netbsd openbsd plan9 solaris rumprun illumos
|
|
|
|
package pq
|
|
|
|
import (
|
|
"os"
|
|
"os/user"
|
|
)
|
|
|
|
func userCurrent() (string, error) {
|
|
u, err := user.Current()
|
|
if err == nil {
|
|
return u.Username, nil
|
|
}
|
|
|
|
name := os.Getenv("USER")
|
|
if name != "" {
|
|
return name, nil
|
|
}
|
|
|
|
return "", ErrCouldNotDetectUsername
|
|
}
|