func extractConfig() pgx.ConnConfig {
	var config pgx.ConnConfig

	config.Host = "localhost"
	config.User = "******"
	config.Password = "******"
	config.Database = "yourdatabase"

	return config
}
示例#2
0
文件: store.go 项目: gebv/magickeys
func extractPGXStorageConfig(c models.StorageSettings) pgx.ConnConfig {
	var config pgx.ConnConfig

	config.Host = c.Host
	config.User = c.User
	config.Password = c.Password
	config.Database = c.Database
	config.Logger = databaseLogger{}
	config.LogLevel = pgx.LogLevelError

	return config
}
示例#3
0
文件: main.go 项目: jgrossophoff/pgx
func extractConfig() pgx.ConnConfig {
	var config pgx.ConnConfig

	config.Host = os.Getenv("TODO_DB_HOST")
	if config.Host == "" {
		config.Host = "localhost"
	}

	config.User = os.Getenv("TODO_DB_USER")
	if config.User == "" {
		config.User = os.Getenv("USER")
	}

	config.Password = os.Getenv("TODO_DB_PASSWORD")

	config.Database = os.Getenv("TODO_DB_DATABASE")
	if config.Database == "" {
		config.Database = "todo"
	}

	return config
}